inboxd 1.0.8 → 1.0.10

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.md CHANGED
@@ -23,7 +23,11 @@ src/
23
23
  ├── gmail-monitor.js # Gmail API: fetch, count, trash, restore
24
24
  ├── state.js # Tracks seen emails per account
25
25
  ├── deletion-log.js # Logs deleted emails for restore capability
26
- └── notifier.js # macOS notifications (node-notifier)
26
+ ├── notifier.js # macOS notifications (node-notifier)
27
+ └── skill-installer.js # Copies skill to ~/.claude/skills/
28
+
29
+ scripts/
30
+ └── postinstall.js # npm postinstall hint about install-skill
27
31
 
28
32
  tests/ # Vitest tests with mocked Google APIs
29
33
  __mocks__/ # Manual mocks for googleapis, @google-cloud/local-auth
@@ -82,10 +86,48 @@ All user data lives in `~/.config/inboxd/`:
82
86
 
83
87
  ## AI Agent Integration
84
88
 
85
- This package includes a Claude Code skill for AI-powered inbox management.
89
+ This package follows the **Agent-Ready CLI** pattern: a CLI designed for both humans and AI agents.
90
+
91
+ ### The Pattern
92
+
93
+ Traditional CLIs are for humans. Agent-ready CLIs add:
94
+ 1. **Structured output** (`--json`, `analyze`) for agents to parse
95
+ 2. **Opinionated commands** with built-in safety (log before delete, undo)
96
+ 3. **Skills** that teach agents how to use the tool effectively
97
+
98
+ ### Skill Installation
99
+
100
+ The skill can be installed globally for all Claude Code sessions:
101
+
102
+ ```bash
103
+ inbox install-skill # Install to ~/.claude/skills/
104
+ inbox install-skill --uninstall # Remove
105
+ ```
106
+
107
+ The `inbox setup` wizard also offers to install the skill automatically.
108
+
109
+ ### Skill Location & Update Detection
110
+
111
+ | Location | Purpose |
112
+ |----------|---------|
113
+ | `.claude/skills/inbox-assistant/SKILL.md` | Source (bundled with package) |
114
+ | `~/.claude/skills/inbox-assistant/SKILL.md` | Installed (global for Claude Code) |
115
+
116
+ The skill uses content-hash detection (no version field). Updates are detected automatically:
117
+ - On `npm install`: Auto-updates if skill already installed
118
+ - Manual: Run `inbox install-skill` to update
86
119
 
87
- ### Skill Location
88
- `.claude/skills/inbox-assistant/SKILL.md`
120
+ Safety features:
121
+ - `source: inboxd` marker identifies ownership (won't overwrite user's own skills)
122
+ - Creates `SKILL.md.backup` before replacing modified files
123
+ - Use `--force` to override ownership check
124
+
125
+ ### Architecture
126
+
127
+ ```
128
+ src/skill-installer.js # Handles copying skill to ~/.claude/skills/
129
+ scripts/postinstall.js # npm postinstall hint about install-skill
130
+ ```
89
131
 
90
132
  ### What the Skill Provides
91
133
  - **Triage**: Classify emails (Important, Newsletters, Promotions, Notifications, Low-Priority)
@@ -98,8 +140,21 @@ This package includes a Claude Code skill for AI-powered inbox management.
98
140
  |---------|---------|
99
141
  | `inbox summary --json` | Quick status check (unread counts) |
100
142
  | `inbox analyze --count 50` | Get email data as JSON for classification |
101
- | `inbox delete --ids "id1,id2" --confirm` | Delete with confirmation flag |
143
+ | `inbox analyze --group-by sender` | Group emails by sender domain |
144
+ | `inbox delete --ids "id1,id2" --confirm` | Delete specific emails by ID |
145
+ | `inbox delete --sender "pattern" --dry-run` | Preview deletion by sender filter |
146
+ | `inbox delete --match "pattern" --dry-run` | Preview deletion by subject filter |
102
147
  | `inbox restore --last N` | Undo last N deletions |
148
+ | `inbox install-skill` | Install/update the Claude Code skill |
149
+
150
+ ### Smart Filtering Options
151
+ | Option | Description |
152
+ |--------|-------------|
153
+ | `--sender <pattern>` | Case-insensitive substring match on From field |
154
+ | `--match <pattern>` | Case-insensitive substring match on Subject field |
155
+ | `--limit <N>` | Max emails for filter operations (default: 50) |
156
+ | `--force` | Override safety warnings (short patterns, large batches) |
157
+ | `--dry-run` | Preview what would be deleted without deleting |
103
158
 
104
159
  ### Email Object Shape (from `analyze`)
105
160
  ```json
package/README.md CHANGED
@@ -80,10 +80,13 @@ inbox summary
80
80
  | `inbox check` | Check for new emails + send notifications |
81
81
  | `inbox check -q` | Silent check (for background use) |
82
82
  | `inbox delete --ids <ids>` | Move emails to trash |
83
+ | `inbox delete --sender <pattern>` | Delete by sender (with confirmation) |
84
+ | `inbox delete --match <pattern>` | Delete by subject (with confirmation) |
83
85
  | `inbox restore --last 1` | Restore last deleted email |
84
86
  | `inbox deletion-log` | View deletion history |
85
87
  | `inbox logout --all` | Remove all accounts |
86
88
  | `inbox install-service` | Install background monitoring (macOS) |
89
+ | `inbox install-skill` | Install Claude Code skill for AI agents |
87
90
 
88
91
  ## Configuration
89
92
 
@@ -143,18 +146,40 @@ inbox analyze --count 20
143
146
 
144
147
  ## AI Agent Integration
145
148
 
146
- This package includes a Claude Code skill for AI-powered inbox management. The skill provides expert-level email triage, cleanup recommendations, and safe deletion workflows.
149
+ This package is designed to be used by both humans and AI agents. While the CLI works great on its own, it really shines when paired with an AI coding assistant like Claude Code.
147
150
 
148
- ### Using with Claude Code
151
+ ### The Pattern: Agent-Ready CLI Tools
149
152
 
150
- 1. Copy the skill to your Claude Code skills directory:
151
- ```bash
152
- cp -r node_modules/inboxd/.claude/skills/inbox-assistant ~/.claude/skills/
153
- ```
153
+ Traditional CLI tools are designed for humans. But with AI agents becoming capable of using tools, we can make CLIs that work for both:
154
154
 
155
- 2. Invoke with `/inbox-assistant` or just ask Claude to manage your inbox.
155
+ 1. **Structured output** (`--json`, `analyze`) for agents to parse
156
+ 2. **Opinionated commands** with built-in safety (logging before delete, undo capability)
157
+ 3. **Skills** that teach agents how to use the tool effectively
156
158
 
157
- ### What the Skill Does
159
+ This package includes a **skill** that can be installed globally, enabling any Claude Code session to manage your inbox intelligently.
160
+
161
+ ### Installing the Skill
162
+
163
+ After installing inboxd, run:
164
+
165
+ ```bash
166
+ inbox install-skill
167
+ ```
168
+
169
+ This copies the inbox-assistant skill to `~/.claude/skills/`, making it available in all your Claude Code sessions.
170
+
171
+ The setup wizard (`inbox setup`) also offers to install the skill automatically.
172
+
173
+ ### What the Skill Enables
174
+
175
+ Once installed, you can ask Claude Code things like:
176
+
177
+ - "Check my emails" → Summary + recommendations
178
+ - "Clean up my inbox" → Identifies deletable emails, confirms before removing
179
+ - "What's important?" → Surfaces action-required emails only
180
+ - "Undo" → Restores recently deleted emails
181
+
182
+ The skill provides:
158
183
 
159
184
  | Capability | Description |
160
185
  |------------|-------------|
@@ -163,6 +188,20 @@ This package includes a Claude Code skill for AI-powered inbox management. The s
163
188
  | **Restore** | Provides undo capability for accidental deletions |
164
189
  | **Safety** | Never auto-deletes, enforces batch limits, always shows before deleting |
165
190
 
191
+ ### Updating the Skill
192
+
193
+ The skill auto-updates when you update inboxd (if already installed). You can also update manually:
194
+
195
+ ```bash
196
+ npm update -g inboxd
197
+ inbox install-skill
198
+ ```
199
+
200
+ Safety features:
201
+ - Won't overwrite skills not created by inboxd (uses `source: inboxd` marker)
202
+ - Creates `SKILL.md.backup` before replacing if you've modified the skill
203
+ - Use `inbox install-skill --force` to override ownership check
204
+
166
205
  ### CLI vs MCP
167
206
 
168
207
  Unlike an MCP server that exposes raw Gmail API primitives, `inboxd` provides **opinionated commands** with built-in safety:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inboxd",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "CLI assistant for Gmail monitoring with multi-account support and AI-ready JSON output",
5
5
  "main": "src/cli.js",
6
6
  "bin": {
@@ -21,7 +21,8 @@
21
21
  "test": "vitest run",
22
22
  "test:watch": "vitest",
23
23
  "lint": "eslint src tests",
24
- "inbox": "node src/cli.js"
24
+ "inbox": "node src/cli.js",
25
+ "postinstall": "node scripts/postinstall.js || true"
25
26
  },
26
27
  "keywords": [
27
28
  "gmail",
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Postinstall script - shows helpful hints after npm install
4
+ * and auto-updates skill if already installed
5
+ */
6
+
7
+ // Skip during CI or if quiet mode
8
+ if (process.env.CI || process.env.npm_config_loglevel === 'silent') {
9
+ process.exit(0);
10
+ }
11
+
12
+ const { getSkillStatus, checkForUpdate, installSkill } = require('../src/skill-installer');
13
+
14
+ /**
15
+ * Show the install hint message for new users
16
+ */
17
+ function showInstallHint() {
18
+ const message = `
19
+ ┌─────────────────────────────────────────────────────────────┐
20
+ │ │
21
+ │ inboxd installed successfully! │
22
+ │ │
23
+ │ Quick start: │
24
+ │ inbox setup # First-time configuration │
25
+ │ │
26
+ │ AI Agent Integration: │
27
+ │ inbox install-skill # Enable Claude Code skill │
28
+ │ │
29
+ │ This lets AI agents manage your inbox with expert triage. │
30
+ │ │
31
+ └─────────────────────────────────────────────────────────────┘
32
+ `;
33
+ console.log(message);
34
+ }
35
+
36
+ /**
37
+ * Handle skill auto-update logic
38
+ */
39
+ function handleSkillUpdate() {
40
+ try {
41
+ const status = getSkillStatus();
42
+
43
+ if (!status.installed) {
44
+ // Not installed → show manual install hint
45
+ showInstallHint();
46
+ return;
47
+ }
48
+
49
+ if (!status.isOurs) {
50
+ // Someone else's skill with same name → don't touch, warn
51
+ console.log(`\n⚠️ ~/.claude/skills/inbox-assistant exists but isn't from inboxd`);
52
+ console.log(` The existing skill has source: "${status.source || 'none'}"`);
53
+ console.log(` Run 'inbox install-skill --force' to replace it\n`);
54
+ return;
55
+ }
56
+
57
+ // It's ours → check for updates
58
+ const update = checkForUpdate();
59
+
60
+ if (update.updateAvailable) {
61
+ const result = installSkill();
62
+
63
+ if (result.success) {
64
+ if (result.backedUp) {
65
+ console.log(`\n✓ inbox-assistant skill updated`);
66
+ console.log(` Your previous version was saved to: SKILL.md.backup\n`);
67
+ } else {
68
+ console.log(`\n✓ inbox-assistant skill updated\n`);
69
+ }
70
+ } else if (result.reason === 'backup_failed') {
71
+ console.log(`\n⚠️ Could not backup existing skill - update skipped`);
72
+ console.log(` Run 'inbox install-skill' manually to update\n`);
73
+ }
74
+ }
75
+ // Up-to-date → silent (no message)
76
+ } catch (err) {
77
+ // Fail silently - postinstall should not break npm install
78
+ // User can always run 'inbox install-skill' manually
79
+ }
80
+ }
81
+
82
+ // Run the update logic
83
+ handleSkillUpdate();