@inboxapi/cli 0.3.0 → 0.3.2

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.
Files changed (34) hide show
  1. package/README.md +21 -9
  2. package/package.json +7 -7
  3. package/{claude/skills → skills/claude}/check-inbox/SKILL.md +5 -5
  4. package/{claude/skills → skills/claude}/compose/SKILL.md +8 -4
  5. package/{claude/skills → skills/claude}/email-digest/SKILL.md +5 -4
  6. package/{claude/skills → skills/claude}/email-forward/SKILL.md +8 -4
  7. package/{claude/skills → skills/claude}/email-reply/SKILL.md +8 -4
  8. package/{claude/skills → skills/claude}/email-search/SKILL.md +11 -7
  9. package/{claude/skills → skills/claude}/setup-inboxapi/SKILL.md +18 -5
  10. package/skills/codex/check-inbox/SKILL.md +37 -0
  11. package/skills/codex/compose/SKILL.md +54 -0
  12. package/skills/codex/email-digest/SKILL.md +57 -0
  13. package/skills/codex/email-forward/SKILL.md +54 -0
  14. package/skills/codex/email-reply/SKILL.md +55 -0
  15. package/skills/codex/email-search/SKILL.md +43 -0
  16. package/skills/codex/setup-inboxapi/SKILL.md +47 -0
  17. package/skills/gemini/check-inbox/SKILL.md +37 -0
  18. package/skills/gemini/compose/SKILL.md +54 -0
  19. package/skills/gemini/email-digest/SKILL.md +57 -0
  20. package/skills/gemini/email-forward/SKILL.md +54 -0
  21. package/skills/gemini/email-reply/SKILL.md +55 -0
  22. package/skills/gemini/email-search/SKILL.md +43 -0
  23. package/skills/gemini/setup-inboxapi/SKILL.md +56 -0
  24. package/{claude → skills}/hooks/email-activity-logger.js +16 -4
  25. package/skills/hooks/email-send-guard.js +93 -0
  26. package/skills/opencode/check-inbox.md +36 -0
  27. package/skills/opencode/compose.md +53 -0
  28. package/skills/opencode/email-digest.md +56 -0
  29. package/skills/opencode/email-forward.md +53 -0
  30. package/skills/opencode/email-reply.md +54 -0
  31. package/skills/opencode/email-search.md +36 -0
  32. package/skills/opencode/setup-inboxapi.md +55 -0
  33. package/claude/hooks/email-send-guard.js +0 -69
  34. /package/{claude → skills}/hooks/credential-check.js +0 -0
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: setup-inboxapi
3
+ description: "Set up InboxAPI email tools in your AI coding agent. Adds MCP server config, installs skills, and verifies credentials. Use when the user wants to configure InboxAPI for their project."
4
+ ---
5
+
6
+ # Setup InboxAPI
7
+
8
+ Configure InboxAPI email tools for this project.
9
+
10
+ ## Steps
11
+
12
+ 1. **Check current setup**: Look for existing MCP server configuration files
13
+
14
+ 2. **Add MCP server** (if not already configured):
15
+ - For Codex CLI: Run `codex mcp add inboxapi -- npx -y @inboxapi/cli`
16
+ - Or create/update the appropriate config file with the InboxAPI MCP server entry
17
+
18
+ 3. **Install skills**: Run `npx -y @inboxapi/cli setup-skills` to copy bundled skills into the project
19
+
20
+ 4. **Verify credentials**:
21
+ - Run: `npx -y @inboxapi/cli whoami` to check if credentials are set up
22
+ - If not authenticated, instruct the user: "Run `npx -y @inboxapi/cli login` in a terminal to authenticate"
23
+
24
+ 5. **Show summary**:
25
+ ```
26
+ InboxAPI Setup Complete!
27
+
28
+ MCP Server: configured
29
+ Email: <email> (or "not authenticated yet")
30
+
31
+ Installed Skills:
32
+ /check-inbox — View inbox summary
33
+ /compose — Write and send emails
34
+ /email-search — Search emails
35
+ /email-reply — Reply with thread context
36
+ /email-digest — Email activity digest
37
+ /email-forward — Forward emails
38
+
39
+ Next steps:
40
+ - Run /check-inbox to see your emails
41
+ - Run /compose to send your first email
42
+ ```
43
+
44
+ ## Notes
45
+
46
+ - All CLI commands output JSON by default — parse the JSON response to extract the relevant fields
47
+ - This skill is safe to run multiple times — it won't duplicate entries or overwrite local edits
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: check-inbox
3
+ description: Check your InboxAPI email inbox and display a summary of recent messages. Use when the user wants to see their emails, check mail, or view their inbox.
4
+ ---
5
+
6
+ # Check Inbox
7
+
8
+ Fetch and display a summary of recent emails from the user's InboxAPI inbox.
9
+
10
+ ## Steps
11
+
12
+ 1. Run: `npx -y @inboxapi/cli whoami` to identify the current account and email address
13
+ 2. Run: `npx -y @inboxapi/cli get-email-count` to show the total number of emails
14
+ 3. Run: `npx -y @inboxapi/cli get-emails --limit <N>` where `<N>` is `$ARGUMENTS` if provided, otherwise `20`
15
+ 4. Present results in a formatted table with columns:
16
+ - **From** — sender name or address
17
+ - **Subject** — email subject line (truncated to 60 chars)
18
+ - **Date** — received date in relative format (e.g., "2 hours ago", "yesterday")
19
+ 5. After the table, show a summary line: "Showing X of Y emails for <email>"
20
+
21
+ ## Output Format
22
+
23
+ Use this markdown table format:
24
+
25
+ ```
26
+ | # | From | Subject | Date |
27
+ |---|------|---------|------|
28
+ | 1 | Alice <alice@example.com> | Re: Project update... | 2h ago |
29
+ ```
30
+
31
+ If the inbox is empty, display: "Your inbox is empty. Your email address is <email>."
32
+
33
+ ## Notes
34
+
35
+ - All CLI commands output JSON by default — parse the JSON response to extract the relevant fields
36
+ - Do NOT read full email bodies — only show the summary list
37
+ - 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
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: compose
3
+ description: Compose and send an email with guided prompts, addressbook lookup, and send confirmation. Use when the user wants to write and send an email.
4
+ ---
5
+
6
+ # Compose Email
7
+
8
+ Guide the user through composing and sending an email safely.
9
+
10
+ ## Steps
11
+
12
+ 1. **Identify sender**: Run: `npx -y @inboxapi/cli whoami` to get the current account email address
13
+
14
+ 2. **Resolve recipient**:
15
+ - If `$ARGUMENTS` is provided, use it as the recipient hint
16
+ - Run: `npx -y @inboxapi/cli get-addressbook` to check for matching contacts
17
+ - If multiple matches found, ask the user to pick one
18
+ - If no match, ask the user to confirm or provide the full email address
19
+
20
+ 3. **Collect email details**: Ask the user for:
21
+ - **To**: Recipient email (pre-filled if resolved above)
22
+ - **Subject**: Email subject line
23
+ - **Body**: Email content (plain text)
24
+
25
+ 4. **Preview**: Show the complete email before sending:
26
+ ```
27
+ From: <your-email@inboxapi.ai>
28
+ To: <recipient@example.com>
29
+ Subject: <subject>
30
+ ---
31
+ <body>
32
+ ```
33
+
34
+ 5. **Safety checks**:
35
+ - Warn if the recipient address matches the sender's own @inboxapi.ai address
36
+ - Warn if the body is empty
37
+ - Warn if the subject is empty
38
+
39
+ 6. **Confirm**: Ask the user to confirm: "Send this email? (yes/no)"
40
+
41
+ 7. **Send**: Run: `npx -y @inboxapi/cli send-email --to "<recipient>" --subject "<subject>" --body "<body>"`
42
+
43
+ 8. **Confirm delivery**: Report the result to the user
44
+
45
+ ## Notes
46
+
47
+ - All CLI commands output JSON by default — parse the JSON response to extract the relevant fields
48
+
49
+ ## Rules
50
+
51
+ - ALWAYS show a preview before sending
52
+ - ALWAYS ask for explicit confirmation before calling send-email
53
+ - NEVER send an email without the user confirming
54
+ - If the user cancels, acknowledge and do not send
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: email-digest
3
+ description: Generate a digest summary of recent email activity grouped by thread. Use when the user wants an overview of their email activity.
4
+ ---
5
+
6
+ # Email Digest
7
+
8
+ Generate a structured digest of recent email activity.
9
+
10
+ ## Steps
11
+
12
+ 1. **Determine timeframe**: Use `$ARGUMENTS` if provided (e.g., "today", "this week", "last 3 days"), otherwise default to "last 24 hours"
13
+
14
+ 2. **Get account info**: Run: `npx -y @inboxapi/cli whoami` for the account email
15
+
16
+ 3. **Get total count**: Run: `npx -y @inboxapi/cli get-email-count` for inbox statistics
17
+
18
+ 4. **Fetch recent emails**: Run: `npx -y @inboxapi/cli get-emails --limit 50`
19
+
20
+ 5. **Group by thread**: For threads with multiple emails, run `npx -y @inboxapi/cli get-thread --message-id "<message-id>"` to understand the conversation
21
+
22
+ 6. **Generate digest** with these sections:
23
+
24
+ ```markdown
25
+ # Email Digest — <timeframe>
26
+ Account: <email>
27
+
28
+ ## Summary
29
+ - Total emails in inbox: X
30
+ - Emails in this period: Y
31
+ - Unique senders: Z
32
+ - Threads with activity: N
33
+
34
+ ## Active Threads
35
+ ### 1. <Subject>
36
+ - Participants: alice@..., bob@...
37
+ - Messages in period: 3
38
+ - Latest: "Brief preview of most recent message..."
39
+ - Status: Awaiting your reply / You replied / FYI only
40
+
41
+ ## New Emails (not in threads)
42
+ | From | Subject | Date |
43
+ |------|---------|------|
44
+ | ... | ... | ... |
45
+
46
+ ## Needs Attention
47
+ - Emails you haven't replied to where you were directly addressed
48
+ ```
49
+
50
+ 7. **Offer actions**: "Would you like to reply to any of these, or read a specific email?"
51
+
52
+ ## Notes
53
+
54
+ - All CLI commands output JSON by default — parse the JSON response to extract the relevant fields
55
+ - Focus on actionable insights, not raw data
56
+ - Highlight emails that likely need a response
57
+ - Keep the digest concise — summarize, don't reproduce full emails
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: email-forward
3
+ description: Forward an email to someone with an optional message. Use when the user wants to forward a specific email to another person.
4
+ ---
5
+
6
+ # Email Forward
7
+
8
+ Help the user forward an email to another recipient.
9
+
10
+ ## Steps
11
+
12
+ 1. **Find the email to forward**:
13
+ - Try `npx -y @inboxapi/cli get-email "$ARGUMENTS"` first — if it succeeds, use that email
14
+ - If it fails (e.g., not a valid message ID), fall back to `npx -y @inboxapi/cli search-emails --subject "<query>"` with the argument
15
+ - If multiple results, show them and ask the user to pick one
16
+
17
+ 2. **Show email content**: Display the email being forwarded:
18
+ ```
19
+ --- Email to forward ---
20
+ From: <original sender>
21
+ Subject: <subject>
22
+ Date: <date>
23
+ ---
24
+ <body preview, first 500 chars>
25
+ ```
26
+
27
+ 3. **Resolve recipient**:
28
+ - Ask "Who do you want to forward this to?"
29
+ - Run: `npx -y @inboxapi/cli get-addressbook` to check for matching contacts
30
+ - Confirm the recipient email address
31
+
32
+ 4. **Optional message**: Ask "Add a message? (or press enter to skip)"
33
+
34
+ 5. **Preview**:
35
+ ```
36
+ Forwarding to: <recipient>
37
+ Subject: Fwd: <original subject>
38
+ Your message: <optional message or "(none)">
39
+ Original email from: <sender>, <date>
40
+ ```
41
+
42
+ 6. **Confirm**: Ask "Forward this email? (yes/no)"
43
+
44
+ 7. **Send**: Run: `npx -y @inboxapi/cli forward-email --message-id "<id>" --to "<recipient>"` (add `--note "<message>"` if provided)
45
+
46
+ ## Notes
47
+
48
+ - All CLI commands output JSON by default — parse the JSON response to extract the relevant fields
49
+
50
+ ## Rules
51
+
52
+ - ALWAYS show what's being forwarded before sending
53
+ - ALWAYS confirm before forwarding
54
+ - NEVER forward without explicit user confirmation
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: email-reply
3
+ description: Reply to an email with full thread context. Use when the user wants to reply to a specific email or continue an email conversation.
4
+ ---
5
+
6
+ # Email Reply
7
+
8
+ Help the user reply to an email with full thread context.
9
+
10
+ ## Steps
11
+
12
+ 1. **Find the email**:
13
+ - Try `npx -y @inboxapi/cli get-email "$ARGUMENTS"` first — if it succeeds, use that email
14
+ - 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
15
+ - If multiple results, present them and ask the user to pick one
16
+
17
+ 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
18
+
19
+ 3. **Display thread**: Show the conversation history in chronological order:
20
+ ```
21
+ --- Thread: <subject> ---
22
+
23
+ [1] From: alice@example.com (Jan 15, 2:30 PM)
24
+ > Original message text...
25
+
26
+ [2] From: you@inboxapi.ai (Jan 15, 3:00 PM)
27
+ > Your previous reply...
28
+
29
+ [3] From: alice@example.com (Jan 15, 4:15 PM)
30
+ > Latest message you're replying to...
31
+ ```
32
+
33
+ 4. **Compose reply**: Ask the user what they want to say in their reply
34
+
35
+ 5. **Preview**: Show the reply before sending:
36
+ ```
37
+ Replying to: alice@example.com
38
+ Subject: Re: <subject>
39
+ ---
40
+ <reply body>
41
+ ```
42
+
43
+ 6. **Confirm**: Ask "Send this reply? (yes/no)"
44
+
45
+ 7. **Send**: Run: `npx -y @inboxapi/cli send-reply --message-id "<id>" --body "<reply>"`
46
+
47
+ ## Notes
48
+
49
+ - All CLI commands output JSON by default — parse the JSON response to extract the relevant fields
50
+
51
+ ## Rules
52
+
53
+ - ALWAYS show the thread context before composing
54
+ - ALWAYS preview and confirm before sending
55
+ - NEVER send without explicit user confirmation
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: email-search
3
+ description: Search your InboxAPI emails using natural language. Use when the user wants to find specific emails by sender, subject, date, or content.
4
+ ---
5
+
6
+ # Email Search
7
+
8
+ Search emails using natural language and present results clearly.
9
+
10
+ ## Steps
11
+
12
+ 1. Take the user's query from `$ARGUMENTS`
13
+ - If no arguments provided, ask: "What are you looking for?"
14
+
15
+ 2. Translate the natural language query into CLI flags for `search-emails`:
16
+ - Extract sender hints (e.g., "from John" -> `--sender "John"`)
17
+ - Extract subject hints (e.g., "about invoices" -> `--subject "invoices"`)
18
+ - Extract date hints (e.g., "last week", "yesterday" -> `--since "..."`, `--until "..."`)
19
+ - Combine with `--limit` as needed
20
+
21
+ 3. Run: `npx -y @inboxapi/cli search-emails` with the appropriate flags (`--sender "..."`, `--subject "..."`, `--since "..."`, `--until "..."`)
22
+
23
+ 4. Present results in a formatted table:
24
+ ```
25
+ | # | From | Subject | Date |
26
+ |---|------|---------|------|
27
+ ```
28
+
29
+ 5. After showing results, offer: "Would you like to read any of these emails? Provide the number."
30
+
31
+ 6. If the user picks one, run `npx -y @inboxapi/cli get-email "<message-id>"` with the email ID
32
+
33
+ 7. If no results, suggest alternative searches or broader terms
34
+
35
+ ## Notes
36
+
37
+ - All CLI commands output JSON by default — parse the JSON response to extract the relevant fields
38
+
39
+ ## Examples
40
+
41
+ - `/email-search invoices from accounting` -> search for "invoices" filtered by sender containing "accounting"
42
+ - `/email-search meeting tomorrow` -> search for "meeting" in recent emails
43
+ - `/email-search` -> prompt user for search query
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: setup-inboxapi
3
+ description: Set up InboxAPI email tools in your AI coding agent. Adds MCP server config, installs skills, and verifies credentials. Use when the user wants to configure InboxAPI for their project.
4
+ ---
5
+
6
+ # Setup InboxAPI
7
+
8
+ Configure InboxAPI email tools for this project.
9
+
10
+ ## Steps
11
+
12
+ 1. **Check current setup**: Look for existing MCP server configuration files
13
+
14
+ 2. **Add MCP server** (if not already configured):
15
+ - For Gemini CLI: Add to `settings.json` under `mcpServers`:
16
+ ```json
17
+ {
18
+ "mcpServers": {
19
+ "inboxapi": {
20
+ "command": "npx",
21
+ "args": ["-y", "@inboxapi/cli"]
22
+ }
23
+ }
24
+ }
25
+ ```
26
+
27
+ 3. **Install skills**: Run `npx -y @inboxapi/cli setup-skills` to copy bundled skills into the project
28
+
29
+ 4. **Verify credentials**:
30
+ - Run: `npx -y @inboxapi/cli whoami` to check if credentials are set up
31
+ - If not authenticated, instruct the user: "Run `npx -y @inboxapi/cli login` in a terminal to authenticate"
32
+
33
+ 5. **Show summary**:
34
+ ```
35
+ InboxAPI Setup Complete!
36
+
37
+ MCP Server: configured
38
+ Email: <email> (or "not authenticated yet")
39
+
40
+ Installed Skills:
41
+ /check-inbox — View inbox summary
42
+ /compose — Write and send emails
43
+ /email-search — Search emails
44
+ /email-reply — Reply with thread context
45
+ /email-digest — Email activity digest
46
+ /email-forward — Forward emails
47
+
48
+ Next steps:
49
+ - Run /check-inbox to see your emails
50
+ - Run /compose to send your first email
51
+ ```
52
+
53
+ ## Notes
54
+
55
+ - All CLI commands output JSON by default — parse the JSON response to extract the relevant fields
56
+ - This skill is safe to run multiple times — it won't duplicate entries or overwrite local edits
@@ -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 = "";
@@ -0,0 +1,93 @@
1
+ #!/usr/bin/env node
2
+ // InboxAPI Email Send Guard — PreToolUse hook
3
+ // Reviews outbound emails before sending. Logs details to stderr for user visibility.
4
+ // Exit 0 = allow
5
+
6
+ const fs = require("fs");
7
+
8
+ function main() {
9
+ const input = fs.readFileSync(0, "utf8");
10
+ let data;
11
+ try {
12
+ data = JSON.parse(input);
13
+ } catch {
14
+ process.exit(0);
15
+ }
16
+
17
+ const toolName = data.tool_name || "";
18
+ const toolInput = data.tool_input || {};
19
+
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
+ }
34
+
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
+ }
65
+
66
+ // Log details to stderr so the user sees them in the Claude Code UI
67
+ process.stderr.write(`\n[InboxAPI Send Guard] ${action}\n`);
68
+ process.stderr.write(` To: ${toDisplay}\n`);
69
+ process.stderr.write(` Subject: ${subject}\n`);
70
+ if (body.length > 0) {
71
+ const preview = body.length > 200 ? body.substring(0, 200) + "..." : body;
72
+ process.stderr.write(` Body: ${preview}\n`);
73
+ }
74
+ process.stderr.write("\n");
75
+
76
+ // Check for self-send (common AI agent mistake)
77
+ const hasInboxApiRecipient = toDisplay.includes("@inboxapi.ai") || toDisplay.includes("@inboxapi.com");
78
+ if (hasInboxApiRecipient) {
79
+ process.stderr.write(
80
+ ` [WARNING] Recipient is an @inboxapi address. Did you mean to send to an external address?\n\n`,
81
+ );
82
+ }
83
+
84
+ // Check for empty body
85
+ if (body.trim().length === 0) {
86
+ process.stderr.write(` [WARNING] Email body is empty.\n\n`);
87
+ }
88
+
89
+ // Allow by default — the user sees the preview and can deny via Claude Code's permission prompt
90
+ process.exit(0);
91
+ }
92
+
93
+ main();
@@ -0,0 +1,36 @@
1
+ ---
2
+ description: Check your InboxAPI email inbox and display a summary of recent messages
3
+ ---
4
+
5
+ # Check Inbox
6
+
7
+ Fetch and display a summary of recent emails from the user's InboxAPI inbox.
8
+
9
+ ## Steps
10
+
11
+ 1. Run: `npx -y @inboxapi/cli whoami` to identify the current account and email address
12
+ 2. Run: `npx -y @inboxapi/cli get-email-count` to show the total number of emails
13
+ 3. Run: `npx -y @inboxapi/cli get-emails --limit <N>` where `<N>` is `$ARGUMENTS` if provided, otherwise `20`
14
+ 4. Present results in a formatted table with columns:
15
+ - **From** — sender name or address
16
+ - **Subject** — email subject line (truncated to 60 chars)
17
+ - **Date** — received date in relative format (e.g., "2 hours ago", "yesterday")
18
+ 5. After the table, show a summary line: "Showing X of Y emails for <email>"
19
+
20
+ ## Output Format
21
+
22
+ Use this markdown table format:
23
+
24
+ ```
25
+ | # | From | Subject | Date |
26
+ |---|------|---------|------|
27
+ | 1 | Alice <alice@example.com> | Re: Project update... | 2h ago |
28
+ ```
29
+
30
+ If the inbox is empty, display: "Your inbox is empty. Your email address is <email>."
31
+
32
+ ## Notes
33
+
34
+ - All CLI commands output JSON by default — parse the JSON response to extract the relevant fields
35
+ - Do NOT read full email bodies — only show the summary list
36
+ - 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
@@ -0,0 +1,53 @@
1
+ ---
2
+ description: Compose and send an email with guided prompts and send confirmation
3
+ ---
4
+
5
+ # Compose Email
6
+
7
+ Guide the user through composing and sending an email safely.
8
+
9
+ ## Steps
10
+
11
+ 1. **Identify sender**: Run: `npx -y @inboxapi/cli whoami` to get the current account email address
12
+
13
+ 2. **Resolve recipient**:
14
+ - If `$ARGUMENTS` is provided, use it as the recipient hint
15
+ - Run: `npx -y @inboxapi/cli get-addressbook` to check for matching contacts
16
+ - If multiple matches found, ask the user to pick one
17
+ - If no match, ask the user to confirm or provide the full email address
18
+
19
+ 3. **Collect email details**: Ask the user for:
20
+ - **To**: Recipient email (pre-filled if resolved above)
21
+ - **Subject**: Email subject line
22
+ - **Body**: Email content (plain text)
23
+
24
+ 4. **Preview**: Show the complete email before sending:
25
+ ```
26
+ From: <your-email@inboxapi.ai>
27
+ To: <recipient@example.com>
28
+ Subject: <subject>
29
+ ---
30
+ <body>
31
+ ```
32
+
33
+ 5. **Safety checks**:
34
+ - Warn if the recipient address matches the sender's own @inboxapi.ai address
35
+ - Warn if the body is empty
36
+ - Warn if the subject is empty
37
+
38
+ 6. **Confirm**: Ask the user to confirm: "Send this email? (yes/no)"
39
+
40
+ 7. **Send**: Run: `npx -y @inboxapi/cli send-email --to "<recipient>" --subject "<subject>" --body "<body>"`
41
+
42
+ 8. **Confirm delivery**: Report the result to the user
43
+
44
+ ## Notes
45
+
46
+ - All CLI commands output JSON by default — parse the JSON response to extract the relevant fields
47
+
48
+ ## Rules
49
+
50
+ - ALWAYS show a preview before sending
51
+ - ALWAYS ask for explicit confirmation before calling send-email
52
+ - NEVER send an email without the user confirming
53
+ - If the user cancels, acknowledge and do not send