@inboxapi/cli 0.2.25 → 0.3.1

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
@@ -185,7 +185,7 @@ inboxapi get-email "<message-id>"
185
185
  ### `search-emails`
186
186
 
187
187
  ```bash
188
- inboxapi search-emails --query "invoice" --limit 10
188
+ inboxapi search-emails --subject "invoice" --limit 10
189
189
  ```
190
190
 
191
191
  ### `get-attachment`
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  // InboxAPI Activity Logger — PostToolUse hook
3
- // Logs all InboxAPI MCP tool usage to .claude/inboxapi-activity.log
3
+ // Logs InboxAPI tool usage (MCP tool calls and CLI via Bash) to .claude/inboxapi-activity.log
4
4
  // Always exits 0 (non-blocking)
5
5
 
6
6
  const fs = require("fs");
@@ -19,13 +19,25 @@ function main() {
19
19
  const toolInput = data.tool_input || {};
20
20
  const cwd = data.cwd || process.cwd();
21
21
 
22
- // Only log inboxapi tools
23
- if (!toolName.includes("inboxapi")) {
22
+ // Only log inboxapi tools (MCP or CLI via Bash)
23
+ let shortName;
24
+ if (toolName === "Bash") {
25
+ const cmd = (toolInput.command || "");
26
+ if (!cmd.includes("inboxapi")) {
27
+ process.exit(0);
28
+ }
29
+ // Extract subcommand: first non-flag arg after the binary name (skips global options like --human)
30
+ const parts = cmd.split(/\s+/);
31
+ const idx = parts.findIndex(p => p === "inboxapi" || p.endsWith("/inboxapi") || p === "@inboxapi/cli");
32
+ const subcommand = idx > -1 ? parts.slice(idx + 1).find(p => !p.startsWith("-")) : undefined;
33
+ shortName = subcommand || "unknown-cli-cmd";
34
+ } else if (toolName.includes("inboxapi")) {
35
+ shortName = toolName.replace("mcp__inboxapi__", "");
36
+ } else {
24
37
  process.exit(0);
25
38
  }
26
39
 
27
40
  const timestamp = new Date().toISOString();
28
- const shortName = toolName.replace("mcp__inboxapi__", "");
29
41
 
30
42
  // Build a concise log entry (logs identifiers and lengths, not email content)
31
43
  let details = "";
@@ -17,25 +17,51 @@ function main() {
17
17
  const toolName = data.tool_name || "";
18
18
  const toolInput = data.tool_input || {};
19
19
 
20
- // Only inspect send-related tools
21
- if (
22
- !toolName.includes("send_email") &&
23
- !toolName.includes("send_reply") &&
24
- !toolName.includes("forward_email")
25
- ) {
26
- process.exit(0);
27
- }
20
+ let toDisplay, subject, body, action;
21
+
22
+ if (toolName === "Bash") {
23
+ // Check if this is an inboxapi CLI send command
24
+ const cmd = (toolInput.command || "");
25
+ if (!cmd.includes("inboxapi")) {
26
+ process.exit(0);
27
+ }
28
+ const isSend = cmd.includes("send-email");
29
+ const isReply = cmd.includes("send-reply");
30
+ const isForward = cmd.includes("forward-email");
31
+ if (!isSend && !isReply && !isForward) {
32
+ process.exit(0);
33
+ }
28
34
 
29
- const rawTo = toolInput.to || toolInput.recipient || "(unknown)";
30
- const toList = Array.isArray(rawTo) ? rawTo : [rawTo];
31
- const toDisplay = toList.join(", ");
32
- const subject = toolInput.subject || "(no subject)";
33
- const body = toolInput.body || toolInput.message || "";
34
- const action = toolName.includes("forward")
35
- ? "FORWARD"
36
- : toolName.includes("reply")
37
- ? "REPLY"
38
- : "SEND";
35
+ // Best-effort extraction from CLI flags
36
+ // Captures: "quoted", 'quoted', or unquoted value until next --flag or end of string
37
+ const toMatch = cmd.match(/--to(?:=|\s+)(?:"([^"]+)"|'([^']+)'|(.+?)(?=\s+--|$))/);
38
+ toDisplay = (toMatch && (toMatch[1] || toMatch[2] || toMatch[3] || "").trim()) || "(unknown)";
39
+ const subjectMatch = cmd.match(/--subject(?:=|\s+)(?:"([^"]+)"|'([^']+)'|(.+?)(?=\s+--|$))/);
40
+ subject = (subjectMatch && (subjectMatch[1] || subjectMatch[2] || subjectMatch[3] || "").trim()) || "(no subject)";
41
+ const bodyMatch = cmd.match(/--body(?:=|\s+)(?:"([^"]+)"|'([^']+)'|(.+?)(?=\s+--|$))/);
42
+ body = (bodyMatch && (bodyMatch[1] || bodyMatch[2] || bodyMatch[3] || "").trim()) || "";
43
+ action = isForward ? "FORWARD" : isReply ? "REPLY" : "SEND";
44
+ } else {
45
+ // MCP tool call path (existing logic)
46
+ if (
47
+ !toolName.includes("send_email") &&
48
+ !toolName.includes("send_reply") &&
49
+ !toolName.includes("forward_email")
50
+ ) {
51
+ process.exit(0);
52
+ }
53
+
54
+ const rawTo = toolInput.to || toolInput.recipient || "(unknown)";
55
+ const toList = Array.isArray(rawTo) ? rawTo : [rawTo];
56
+ toDisplay = toList.join(", ");
57
+ subject = toolInput.subject || "(no subject)";
58
+ body = toolInput.body || toolInput.message || "";
59
+ action = toolName.includes("forward")
60
+ ? "FORWARD"
61
+ : toolName.includes("reply")
62
+ ? "REPLY"
63
+ : "SEND";
64
+ }
39
65
 
40
66
  // Log details to stderr so the user sees them in the Claude Code UI
41
67
  process.stderr.write(`\n[InboxAPI Send Guard] ${action}\n`);
@@ -48,9 +74,7 @@ function main() {
48
74
  process.stderr.write("\n");
49
75
 
50
76
  // Check for self-send (common AI agent mistake)
51
- const hasInboxApiRecipient = toList.some(
52
- (addr) => typeof addr === "string" && (addr.includes("@inboxapi.ai") || addr.includes("@inboxapi.com")),
53
- );
77
+ const hasInboxApiRecipient = toDisplay.includes("@inboxapi.ai") || toDisplay.includes("@inboxapi.com");
54
78
  if (hasInboxApiRecipient) {
55
79
  process.stderr.write(
56
80
  ` [WARNING] Recipient is an @inboxapi address. Did you mean to send to an external address?\n\n`,
@@ -11,10 +11,9 @@ Fetch and display a summary of recent emails from the user's InboxAPI inbox.
11
11
 
12
12
  ## Steps
13
13
 
14
- 1. Call the `mcp__inboxapi__whoami` tool to identify the current account and email address
15
- 2. Call `mcp__inboxapi__get_email_count` to show the total number of emails
16
- 3. Call `mcp__inboxapi__get_emails` with:
17
- - `limit`: Use `$ARGUMENTS` if provided, otherwise default to `20`
14
+ 1. Run: `npx -y @inboxapi/cli whoami` to identify the current account and email address
15
+ 2. Run: `npx -y @inboxapi/cli get-email-count` to show the total number of emails
16
+ 3. Run: `npx -y @inboxapi/cli get-emails --limit <N>` where `<N>` is `$ARGUMENTS` if provided, otherwise `20`
18
17
  4. Present results in a formatted table with columns:
19
18
  - **From** — sender name or address
20
19
  - **Subject** — email subject line (truncated to 60 chars)
@@ -35,5 +34,6 @@ If the inbox is empty, display: "Your inbox is empty. Your email address is <ema
35
34
 
36
35
  ## Notes
37
36
 
37
+ - All CLI commands output JSON by default — parse the JSON response to extract the relevant fields
38
38
  - Do NOT read full email bodies — only show the summary list
39
- - If the user asks to read a specific email after seeing the list, use `mcp__inboxapi__get_email` with the email ID
39
+ - If the user asks to read a specific email after seeing the list, run `npx -y @inboxapi/cli get-email "<message-id>"` with the email ID
@@ -12,11 +12,11 @@ Guide the user through composing and sending an email safely.
12
12
 
13
13
  ## Steps
14
14
 
15
- 1. **Identify sender**: Call `mcp__inboxapi__whoami` to get the current account email address
15
+ 1. **Identify sender**: Run: `npx -y @inboxapi/cli whoami` to get the current account email address
16
16
 
17
17
  2. **Resolve recipient**:
18
18
  - If `$ARGUMENTS` is provided, use it as the recipient hint
19
- - Call `mcp__inboxapi__get_addressbook` to check for matching contacts
19
+ - Run: `npx -y @inboxapi/cli get-addressbook` to check for matching contacts
20
20
  - If multiple matches found, ask the user to pick one
21
21
  - If no match, ask the user to confirm or provide the full email address
22
22
 
@@ -41,13 +41,17 @@ Guide the user through composing and sending an email safely.
41
41
 
42
42
  6. **Confirm**: Ask the user to confirm: "Send this email? (yes/no)"
43
43
 
44
- 7. **Send**: Call `mcp__inboxapi__send_email` with `to`, `subject`, and `body`
44
+ 7. **Send**: Run: `npx -y @inboxapi/cli send-email --to "<recipient>" --subject "<subject>" --body "<body>"`
45
45
 
46
46
  8. **Confirm delivery**: Report the result to the user
47
47
 
48
+ ## Notes
49
+
50
+ - All CLI commands output JSON by default — parse the JSON response to extract the relevant fields
51
+
48
52
  ## Rules
49
53
 
50
54
  - ALWAYS show a preview before sending
51
- - ALWAYS ask for explicit confirmation before calling send_email
55
+ - ALWAYS ask for explicit confirmation before calling send-email
52
56
  - NEVER send an email without the user confirming
53
57
  - If the user cancels, acknowledge and do not send
@@ -13,13 +13,13 @@ Generate a structured digest of recent email activity.
13
13
 
14
14
  1. **Determine timeframe**: Use `$ARGUMENTS` if provided (e.g., "today", "this week", "last 3 days"), otherwise default to "last 24 hours"
15
15
 
16
- 2. **Get account info**: Call `mcp__inboxapi__whoami` for the account email
16
+ 2. **Get account info**: Run: `npx -y @inboxapi/cli whoami` for the account email
17
17
 
18
- 3. **Get total count**: Call `mcp__inboxapi__get_email_count` for inbox statistics
18
+ 3. **Get total count**: Run: `npx -y @inboxapi/cli get-email-count` for inbox statistics
19
19
 
20
- 4. **Fetch recent emails**: Call `mcp__inboxapi__get_emails` with an appropriate limit (50 for digest)
20
+ 4. **Fetch recent emails**: Run: `npx -y @inboxapi/cli get-emails --limit 50`
21
21
 
22
- 5. **Group by thread**: For threads with multiple emails, call `mcp__inboxapi__get_thread` to understand the conversation
22
+ 5. **Group by thread**: For threads with multiple emails, run `npx -y @inboxapi/cli get-thread --message-id "<message-id>"` to understand the conversation
23
23
 
24
24
  6. **Generate digest** with these sections:
25
25
 
@@ -53,6 +53,7 @@ Generate a structured digest of recent email activity.
53
53
 
54
54
  ## Notes
55
55
 
56
+ - All CLI commands output JSON by default — parse the JSON response to extract the relevant fields
56
57
  - Focus on actionable insights, not raw data
57
58
  - Highlight emails that likely need a response
58
59
  - Keep the digest concise — summarize, don't reproduce full emails
@@ -13,8 +13,8 @@ Help the user forward an email to another recipient.
13
13
  ## Steps
14
14
 
15
15
  1. **Find the email to forward**:
16
- - If `$ARGUMENTS` looks like an email ID, call `mcp__inboxapi__get_email` directly
17
- - Otherwise, call `mcp__inboxapi__search_emails` with the argument
16
+ - Try `npx -y @inboxapi/cli get-email "$ARGUMENTS"` first if it succeeds, use that email
17
+ - If it fails (e.g., not a valid message ID), fall back to `npx -y @inboxapi/cli search-emails --subject "<query>"` with the argument
18
18
  - If multiple results, show them and ask the user to pick one
19
19
 
20
20
  2. **Show email content**: Display the email being forwarded:
@@ -29,7 +29,7 @@ Help the user forward an email to another recipient.
29
29
 
30
30
  3. **Resolve recipient**:
31
31
  - Ask "Who do you want to forward this to?"
32
- - Call `mcp__inboxapi__get_addressbook` to check for matching contacts
32
+ - Run: `npx -y @inboxapi/cli get-addressbook` to check for matching contacts
33
33
  - Confirm the recipient email address
34
34
 
35
35
  4. **Optional message**: Ask "Add a message? (or press enter to skip)"
@@ -44,7 +44,11 @@ Help the user forward an email to another recipient.
44
44
 
45
45
  6. **Confirm**: Ask "Forward this email? (yes/no)"
46
46
 
47
- 7. **Send**: Call `mcp__inboxapi__forward_email` with the email ID, recipient, and optional message
47
+ 7. **Send**: Run: `npx -y @inboxapi/cli forward-email --message-id "<id>" --to "<recipient>"` (add `--note "<message>"` if provided)
48
+
49
+ ## Notes
50
+
51
+ - All CLI commands output JSON by default — parse the JSON response to extract the relevant fields
48
52
 
49
53
  ## Rules
50
54
 
@@ -13,11 +13,11 @@ Help the user reply to an email with full thread context.
13
13
  ## Steps
14
14
 
15
15
  1. **Find the email**:
16
- - If `$ARGUMENTS` looks like an email ID (alphanumeric string), call `mcp__inboxapi__get_email` directly
17
- - Otherwise, call `mcp__inboxapi__search_emails` with the argument as subject/keyword
16
+ - Try `npx -y @inboxapi/cli get-email "$ARGUMENTS"` first — if it succeeds, use that email
17
+ - If it fails (e.g., not a valid message ID), fall back to `npx -y @inboxapi/cli search-emails --subject "<query>"` with the argument as subject/keyword
18
18
  - If multiple results, present them and ask the user to pick one
19
19
 
20
- 2. **Load thread context**: Call `mcp__inboxapi__get_thread` with the email's thread ID to show the full conversation
20
+ 2. **Load thread context**: Run: `npx -y @inboxapi/cli get-thread --message-id "<message-id>"` with the email's message ID to show the full conversation
21
21
 
22
22
  3. **Display thread**: Show the conversation history in chronological order:
23
23
  ```
@@ -45,7 +45,11 @@ Help the user reply to an email with full thread context.
45
45
 
46
46
  6. **Confirm**: Ask "Send this reply? (yes/no)"
47
47
 
48
- 7. **Send**: Call `mcp__inboxapi__send_reply` with the email ID and reply body
48
+ 7. **Send**: Run: `npx -y @inboxapi/cli send-reply --message-id "<id>" --body "<reply>"`
49
+
50
+ ## Notes
51
+
52
+ - All CLI commands output JSON by default — parse the JSON response to extract the relevant fields
49
53
 
50
54
  ## Rules
51
55
 
@@ -14,13 +14,13 @@ Search emails using natural language and present results clearly.
14
14
  1. Take the user's query from `$ARGUMENTS`
15
15
  - If no arguments provided, ask: "What are you looking for?"
16
16
 
17
- 2. Translate the natural language query into a `mcp__inboxapi__search_emails` call:
18
- - Extract sender hints (e.g., "from John" -> search by sender)
19
- - Extract subject hints (e.g., "about invoices" -> search by subject)
20
- - Extract date hints (e.g., "last week", "yesterday")
21
- - Use the full query as the search term
17
+ 2. Translate the natural language query into CLI flags for `search-emails`:
18
+ - Extract sender hints (e.g., "from John" -> `--sender "John"`)
19
+ - Extract subject hints (e.g., "about invoices" -> `--subject "invoices"`)
20
+ - Extract date hints (e.g., "last week", "yesterday" -> `--since "..."`, `--until "..."`)
21
+ - Combine with `--limit` as needed
22
22
 
23
- 3. Call `mcp__inboxapi__search_emails` with the interpreted parameters
23
+ 3. Run: `npx -y @inboxapi/cli search-emails` with the appropriate flags (`--sender "..."`, `--subject "..."`, `--since "..."`, `--until "..."`)
24
24
 
25
25
  4. Present results in a formatted table:
26
26
  ```
@@ -30,10 +30,14 @@ Search emails using natural language and present results clearly.
30
30
 
31
31
  5. After showing results, offer: "Would you like to read any of these emails? Provide the number."
32
32
 
33
- 6. If the user picks one, call `mcp__inboxapi__get_email` with the email ID
33
+ 6. If the user picks one, run `npx -y @inboxapi/cli get-email "<message-id>"` with the email ID
34
34
 
35
35
  7. If no results, suggest alternative searches or broader terms
36
36
 
37
+ ## Notes
38
+
39
+ - All CLI commands output JSON by default — parse the JSON response to extract the relevant fields
40
+
37
41
  ## Examples
38
42
 
39
43
  - `/email-search invoices from accounting` -> search for "invoices" filtered by sender containing "accounting"
@@ -31,7 +31,7 @@ Configure InboxAPI email tools for this Claude Code project.
31
31
  3. **Install skills**: Run `npx -y @inboxapi/cli setup-skills` to copy bundled skills and hooks into the project's `.claude/` directory
32
32
 
33
33
  4. **Verify credentials**:
34
- - Call `mcp__inboxapi__whoami` to check if credentials are set up
34
+ - Run: `npx -y @inboxapi/cli whoami` to check if credentials are set up
35
35
  - If not authenticated, instruct the user: "Run `npx -y @inboxapi/cli login` in a terminal to authenticate"
36
36
 
37
37
  5. **Show summary**:
@@ -61,6 +61,7 @@ Configure InboxAPI email tools for this Claude Code project.
61
61
 
62
62
  ## Notes
63
63
 
64
+ - All CLI commands output JSON by default — parse the JSON response to extract the relevant fields
64
65
  - This skill is safe to run multiple times — it won't duplicate entries or overwrite local edits
65
66
  - Existing `.mcp.json` entries, skill files, and hook files with local edits are preserved
66
67
  - `.claude/settings.json` is merged with new hook config (may be reformatted when hooks are updated)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inboxapi/cli",
3
- "version": "0.2.25",
3
+ "version": "0.3.1",
4
4
  "description": "📧 Email for your AI 🤖",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -28,13 +28,10 @@
28
28
  "test": "cargo test"
29
29
  },
30
30
  "optionalDependencies": {
31
- "@inboxapi/cli-darwin-arm64": "0.2.25",
32
- "@inboxapi/cli-darwin-x64": "0.2.25",
33
- "@inboxapi/cli-linux-arm64": "0.2.25",
34
- "@inboxapi/cli-linux-x64": "0.2.25",
35
- "@inboxapi/cli-win32-x64": "0.2.25"
36
- },
37
- "dependencies": {
38
- "@inboxapi/cli": "^0.2.25"
31
+ "@inboxapi/cli-darwin-arm64": "0.3.1",
32
+ "@inboxapi/cli-darwin-x64": "0.3.1",
33
+ "@inboxapi/cli-linux-arm64": "0.3.1",
34
+ "@inboxapi/cli-linux-x64": "0.3.1",
35
+ "@inboxapi/cli-win32-x64": "0.3.1"
39
36
  }
40
37
  }