@inboxapi/cli 0.3.0 → 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/claude/hooks/email-activity-logger.js +16 -4
- package/claude/hooks/email-send-guard.js +45 -21
- package/claude/skills/check-inbox/SKILL.md +5 -5
- package/claude/skills/compose/SKILL.md +8 -4
- package/claude/skills/email-digest/SKILL.md +5 -4
- package/claude/skills/email-forward/SKILL.md +8 -4
- package/claude/skills/email-reply/SKILL.md +8 -4
- package/claude/skills/email-search/SKILL.md +11 -7
- package/claude/skills/setup-inboxapi/SKILL.md +2 -1
- package/package.json +6 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// InboxAPI Activity Logger — PostToolUse hook
|
|
3
|
-
// Logs
|
|
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
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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 =
|
|
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.
|
|
15
|
-
2.
|
|
16
|
-
3.
|
|
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,
|
|
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**:
|
|
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
|
-
-
|
|
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**:
|
|
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
|
|
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**:
|
|
16
|
+
2. **Get account info**: Run: `npx -y @inboxapi/cli whoami` for the account email
|
|
17
17
|
|
|
18
|
-
3. **Get total count**:
|
|
18
|
+
3. **Get total count**: Run: `npx -y @inboxapi/cli get-email-count` for inbox statistics
|
|
19
19
|
|
|
20
|
-
4. **Fetch recent emails**:
|
|
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,
|
|
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
|
-
-
|
|
17
|
-
-
|
|
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
|
-
-
|
|
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**:
|
|
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
|
-
-
|
|
17
|
-
-
|
|
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**:
|
|
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**:
|
|
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
|
|
18
|
-
- Extract sender hints (e.g., "from John" ->
|
|
19
|
-
- Extract subject hints (e.g., "about invoices" ->
|
|
20
|
-
- Extract date hints (e.g., "last week", "yesterday")
|
|
21
|
-
-
|
|
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.
|
|
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,
|
|
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
|
-
-
|
|
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.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "📧 Email for your AI 🤖",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"test": "cargo test"
|
|
29
29
|
},
|
|
30
30
|
"optionalDependencies": {
|
|
31
|
-
"@inboxapi/cli-darwin-arm64": "0.3.
|
|
32
|
-
"@inboxapi/cli-darwin-x64": "0.3.
|
|
33
|
-
"@inboxapi/cli-linux-arm64": "0.3.
|
|
34
|
-
"@inboxapi/cli-linux-x64": "0.3.
|
|
35
|
-
"@inboxapi/cli-win32-x64": "0.3.
|
|
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"
|
|
36
36
|
}
|
|
37
37
|
}
|