inboxd 1.0.8 → 1.0.9

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,43 @@ 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
+ ```
86
106
 
87
- ### Skill Location
88
- `.claude/skills/inbox-assistant/SKILL.md`
107
+ The `inbox setup` wizard also offers to install the skill automatically.
108
+
109
+ ### Skill Location & Versioning
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 has a `version` field in its front matter. When updating:
117
+ 1. Bump version in `SKILL.md`
118
+ 2. Users run `inbox install-skill` to get the update
119
+
120
+ ### Architecture
121
+
122
+ ```
123
+ src/skill-installer.js # Handles copying skill to ~/.claude/skills/
124
+ scripts/postinstall.js # npm postinstall hint about install-skill
125
+ ```
89
126
 
90
127
  ### What the Skill Provides
91
128
  - **Triage**: Classify emails (Important, Newsletters, Promotions, Notifications, Low-Priority)
@@ -100,6 +137,7 @@ This package includes a Claude Code skill for AI-powered inbox management.
100
137
  | `inbox analyze --count 50` | Get email data as JSON for classification |
101
138
  | `inbox delete --ids "id1,id2" --confirm` | Delete with confirmation flag |
102
139
  | `inbox restore --last N` | Undo last N deletions |
140
+ | `inbox install-skill` | Install/update the Claude Code skill |
103
141
 
104
142
  ### Email Object Shape (from `analyze`)
105
143
  ```json
package/README.md CHANGED
@@ -84,6 +84,7 @@ inbox summary
84
84
  | `inbox deletion-log` | View deletion history |
85
85
  | `inbox logout --all` | Remove all accounts |
86
86
  | `inbox install-service` | Install background monitoring (macOS) |
87
+ | `inbox install-skill` | Install Claude Code skill for AI agents |
87
88
 
88
89
  ## Configuration
89
90
 
@@ -143,18 +144,40 @@ inbox analyze --count 20
143
144
 
144
145
  ## AI Agent Integration
145
146
 
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.
147
+ 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
148
 
148
- ### Using with Claude Code
149
+ ### The Pattern: Agent-Ready CLI Tools
149
150
 
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
- ```
151
+ 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
152
 
155
- 2. Invoke with `/inbox-assistant` or just ask Claude to manage your inbox.
153
+ 1. **Structured output** (`--json`, `analyze`) for agents to parse
154
+ 2. **Opinionated commands** with built-in safety (logging before delete, undo capability)
155
+ 3. **Skills** that teach agents how to use the tool effectively
156
156
 
157
- ### What the Skill Does
157
+ This package includes a **skill** that can be installed globally, enabling any Claude Code session to manage your inbox intelligently.
158
+
159
+ ### Installing the Skill
160
+
161
+ After installing inboxd, run:
162
+
163
+ ```bash
164
+ inbox install-skill
165
+ ```
166
+
167
+ This copies the inbox-assistant skill to `~/.claude/skills/`, making it available in all your Claude Code sessions.
168
+
169
+ The setup wizard (`inbox setup`) also offers to install the skill automatically.
170
+
171
+ ### What the Skill Enables
172
+
173
+ Once installed, you can ask Claude Code things like:
174
+
175
+ - "Check my emails" → Summary + recommendations
176
+ - "Clean up my inbox" → Identifies deletable emails, confirms before removing
177
+ - "What's important?" → Surfaces action-required emails only
178
+ - "Undo" → Restores recently deleted emails
179
+
180
+ The skill provides:
158
181
 
159
182
  | Capability | Description |
160
183
  |------------|-------------|
@@ -163,6 +186,15 @@ This package includes a Claude Code skill for AI-powered inbox management. The s
163
186
  | **Restore** | Provides undo capability for accidental deletions |
164
187
  | **Safety** | Never auto-deletes, enforces batch limits, always shows before deleting |
165
188
 
189
+ ### Updating the Skill
190
+
191
+ When you update inboxd, run `inbox install-skill` again to get the latest skill version:
192
+
193
+ ```bash
194
+ npm update -g inboxd
195
+ inbox install-skill
196
+ ```
197
+
166
198
  ### CLI vs MCP
167
199
 
168
200
  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.9",
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,79 @@
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 (previous saved to SKILL.md.backup)\n`);
66
+ } else {
67
+ console.log(`\n✓ inbox-assistant skill updated\n`);
68
+ }
69
+ }
70
+ }
71
+ // Up-to-date → silent (no message)
72
+ } catch (err) {
73
+ // Fail silently - postinstall should not break npm install
74
+ // User can always run 'inbox install-skill' manually
75
+ }
76
+ }
77
+
78
+ // Run the update logic
79
+ handleSkillUpdate();