@rulecatch/ai-pooler 0.4.0
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 +232 -0
- package/dist/cli.js +1338 -0
- package/dist/cli.js.map +1 -0
- package/dist/flush.js +1114 -0
- package/dist/flush.js.map +1 -0
- package/dist/index.cjs +1278 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +625 -0
- package/dist/index.js +1240 -0
- package/dist/index.js.map +1 -0
- package/package.json +63 -0
- package/templates/rulecatch-track.sh +549 -0
package/README.md
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# @rulecatch/ai-pooler
|
|
2
|
+
|
|
3
|
+
AI development analytics for Claude Code, Cursor, and other AI coding assistants.
|
|
4
|
+
|
|
5
|
+
Track your AI-assisted development sessions: tool usage, code changes, productivity patterns, and costs.
|
|
6
|
+
|
|
7
|
+
**Privacy-first by design**: Zero-knowledge encryption means we literally cannot read your personal data.
|
|
8
|
+
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Install globally
|
|
13
|
+
npm install -g @rulecatch/ai-pooler
|
|
14
|
+
|
|
15
|
+
# Set up automatic tracking
|
|
16
|
+
rulecatch init --api-key=YOUR_KEY --project-id=my-project
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
That's it! All your Claude Code sessions will now be tracked automatically.
|
|
20
|
+
|
|
21
|
+
## Privacy & Security
|
|
22
|
+
|
|
23
|
+
We take your privacy seriously. Rulecatch uses **zero-knowledge architecture** - we cannot read your personal data even if we wanted to.
|
|
24
|
+
|
|
25
|
+
### Zero-Knowledge Encryption
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Optional: Enable zero-knowledge privacy mode
|
|
29
|
+
rulecatch privacy setup --region=eu
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
When enabled:
|
|
33
|
+
- **Your privacy key** is created and stored locally (never sent to us)
|
|
34
|
+
- **All PII is hashed** before leaving your machine (emails, usernames, file paths)
|
|
35
|
+
- **You choose your data region** (US or EU) - client routes data accordingly
|
|
36
|
+
- **We only see hashes** - cryptographically impossible to reverse
|
|
37
|
+
|
|
38
|
+
### What This Means
|
|
39
|
+
|
|
40
|
+
| Data Type | Without Privacy Mode | With Privacy Mode |
|
|
41
|
+
|-----------|---------------------|-------------------|
|
|
42
|
+
| Email | `user@example.com` | `a7f3b2c1...` (hash) |
|
|
43
|
+
| Git username | `RuleCatchUser` | `e9d4f1a8...` (hash) |
|
|
44
|
+
| File paths | `/home/user/project/secret.ts` | `b2c3d4e5...` (hash) |
|
|
45
|
+
| Tool calls | `Read`, `Edit`, `Bash` | `Read`, `Edit`, `Bash` (unchanged) |
|
|
46
|
+
| Token counts | `15,234` | `15,234` (unchanged) |
|
|
47
|
+
|
|
48
|
+
### GDPR Compliance
|
|
49
|
+
|
|
50
|
+
- **EU Data Residency**: Use `--region=eu` to store data in Frankfurt, Germany
|
|
51
|
+
- **Right to Deletion**: Delete all your data anytime from the dashboard
|
|
52
|
+
- **Right to Access**: Export all your data in machine-readable format
|
|
53
|
+
- **Data Minimization**: We only collect what's needed for analytics
|
|
54
|
+
- **Client-Side Control**: Your machine decides where data goes, not us
|
|
55
|
+
|
|
56
|
+
### Privacy Commands
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Set up privacy with EU data residency
|
|
60
|
+
rulecatch privacy setup --region=eu
|
|
61
|
+
|
|
62
|
+
# Check privacy status
|
|
63
|
+
rulecatch privacy status
|
|
64
|
+
|
|
65
|
+
# Verify your privacy key
|
|
66
|
+
rulecatch privacy verify
|
|
67
|
+
|
|
68
|
+
# Export key for hooks (required after setup)
|
|
69
|
+
rulecatch privacy export-key
|
|
70
|
+
|
|
71
|
+
# Reset privacy configuration
|
|
72
|
+
rulecatch privacy reset
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## What Gets Tracked
|
|
76
|
+
|
|
77
|
+
Via Claude Code hooks, we automatically capture:
|
|
78
|
+
|
|
79
|
+
- **Session start/end** - When you begin and end coding sessions
|
|
80
|
+
- **Tool calls** - Every Read, Write, Edit, Bash, Glob, Grep call (name, success/failure)
|
|
81
|
+
- **File paths** - Which files tools operate on (hashed in privacy mode)
|
|
82
|
+
- **Languages used** - Inferred from file extensions (TypeScript, Python, etc.)
|
|
83
|
+
- **Lines changed** - Actual `git diff` stats captured at session end
|
|
84
|
+
- **Files modified** - List of changed files from git (hashed in privacy mode)
|
|
85
|
+
- **Git context** - Repository, branch, commit, dirty state
|
|
86
|
+
- **Turn completions** - When Claude finishes responding
|
|
87
|
+
- **Token usage** - Input/output tokens (calculated from Claude's stats)
|
|
88
|
+
- **Cost estimates** - Based on model and token usage
|
|
89
|
+
|
|
90
|
+
### What We Never Collect
|
|
91
|
+
|
|
92
|
+
- **No code content** - We never see your actual code
|
|
93
|
+
- **No keystrokes** - We never capture what you type
|
|
94
|
+
- **No prompt content** - Your conversations stay private
|
|
95
|
+
- **No file content** - Only metadata, never the actual files
|
|
96
|
+
|
|
97
|
+
## Commands
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Set up tracking (run once)
|
|
101
|
+
rulecatch init --api-key=KEY --project-id=PROJECT
|
|
102
|
+
|
|
103
|
+
# Check setup status
|
|
104
|
+
rulecatch status
|
|
105
|
+
|
|
106
|
+
# Send test event
|
|
107
|
+
rulecatch test --api-key=KEY
|
|
108
|
+
|
|
109
|
+
# View recent activity
|
|
110
|
+
rulecatch logs
|
|
111
|
+
|
|
112
|
+
# Remove tracking
|
|
113
|
+
rulecatch uninstall
|
|
114
|
+
|
|
115
|
+
# Show help
|
|
116
|
+
rulecatch help
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Privacy Setup (Recommended)
|
|
120
|
+
|
|
121
|
+
For maximum privacy, set up zero-knowledge mode:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# 1. Set up privacy (choose your region)
|
|
125
|
+
rulecatch privacy setup --region=eu # EU data residency
|
|
126
|
+
rulecatch privacy setup --region=us # US data residency (default)
|
|
127
|
+
|
|
128
|
+
# 2. Export key for hooks
|
|
129
|
+
rulecatch privacy export-key
|
|
130
|
+
|
|
131
|
+
# 3. Set up tracking as normal
|
|
132
|
+
rulecatch init --api-key=KEY --project-id=PROJECT
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Test Your Setup
|
|
136
|
+
|
|
137
|
+
Clone the test project to verify data flows correctly:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
git clone https://github.com/TheDecipherist/rulecatch-test
|
|
141
|
+
cd rulecatch-test
|
|
142
|
+
# Follow instructions in README
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Init Options
|
|
146
|
+
|
|
147
|
+
| Option | Description |
|
|
148
|
+
|--------|-------------|
|
|
149
|
+
| `--api-key=KEY` | Your Rulecatch API key (from dashboard) |
|
|
150
|
+
| `--project-id=ID` | Project identifier for grouping data |
|
|
151
|
+
| `--endpoint=URL` | Custom API endpoint (optional) |
|
|
152
|
+
|
|
153
|
+
## Privacy Options
|
|
154
|
+
|
|
155
|
+
| Option | Description |
|
|
156
|
+
|--------|-------------|
|
|
157
|
+
| `--region=eu` | Store data in EU (Frankfurt) for GDPR compliance |
|
|
158
|
+
| `--region=us` | Store data in US (Virginia) - default |
|
|
159
|
+
|
|
160
|
+
## Optional: Server Mode
|
|
161
|
+
|
|
162
|
+
For additional features (metrics queries, session control), add to `.claude.json`:
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"mcpServers": {
|
|
167
|
+
"rulecatch": {
|
|
168
|
+
"command": "npx",
|
|
169
|
+
"args": ["@rulecatch/ai-pooler"],
|
|
170
|
+
"env": {
|
|
171
|
+
"RULECATCH_AI_KEY": "your-key",
|
|
172
|
+
"RULECATCH_PROJECT_ID": "your-project"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
This enables Claude to call tracking tools directly:
|
|
180
|
+
- `rulecatch_session_start` - Start a tracked session
|
|
181
|
+
- `rulecatch_session_end` - End session and get metrics
|
|
182
|
+
- `rulecatch_get_metrics` - View current session stats
|
|
183
|
+
|
|
184
|
+
## Environment Variables
|
|
185
|
+
|
|
186
|
+
| Variable | Required | Description |
|
|
187
|
+
|----------|----------|-------------|
|
|
188
|
+
| `RULECATCH_AI_KEY` | Yes | API key from dashboard |
|
|
189
|
+
| `RULECATCH_PROJECT_ID` | Yes | Project identifier |
|
|
190
|
+
| `RULECATCH_ENDPOINT` | No | API endpoint (auto-selected by region) |
|
|
191
|
+
| `RULECATCH_VERSION` | No | Your project version (for correlation) |
|
|
192
|
+
| `RULECATCH_COMMIT` | No | Git commit hash |
|
|
193
|
+
|
|
194
|
+
## How It Works
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
┌─────────────────────────────────────────────┐
|
|
198
|
+
│ YOUR MACHINE (Full Control) │
|
|
199
|
+
│ │
|
|
200
|
+
│ Claude Code → Hook fires → Privacy check │
|
|
201
|
+
│ ↓ │
|
|
202
|
+
│ PII hashed locally (SHA-256) │
|
|
203
|
+
│ ↓ │
|
|
204
|
+
│ Region check → Route to US or EU API │
|
|
205
|
+
└─────────────────────────────────────────────┘
|
|
206
|
+
↓
|
|
207
|
+
┌─────────────┴─────────────┐
|
|
208
|
+
↓ ↓
|
|
209
|
+
┌───────────────────┐ ┌───────────────────┐
|
|
210
|
+
│ US API (Virginia)│ │ EU API (Frankfurt)│
|
|
211
|
+
│ │ │ │
|
|
212
|
+
│ We receive: │ │ We receive: │
|
|
213
|
+
│ - Hashed PII │ │ - Hashed PII │
|
|
214
|
+
│ - Plain metrics │ │ - Plain metrics │
|
|
215
|
+
│ │ │ │
|
|
216
|
+
│ We CANNOT see: │ │ We CANNOT see: │
|
|
217
|
+
│ - Your email │ │ - Your email │
|
|
218
|
+
│ - Your username │ │ - Your username │
|
|
219
|
+
│ - Your file paths│ │ - Your file paths│
|
|
220
|
+
└───────────────────┘ └───────────────────┘
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Links
|
|
224
|
+
|
|
225
|
+
- **Dashboard**: https://dashboard.rulecatch.ai
|
|
226
|
+
- **Documentation**: https://rulecatch.ai/docs
|
|
227
|
+
- **Privacy Policy**: https://rulecatch.ai/privacy
|
|
228
|
+
- **GitHub**: https://github.com/TheDecipherist/rulecatch
|
|
229
|
+
|
|
230
|
+
## License
|
|
231
|
+
|
|
232
|
+
MIT
|