@asifkibria/claude-code-toolkit 1.0.2 → 1.0.7
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 +269 -2
- package/dist/__tests__/scanner.test.js +350 -1
- package/dist/__tests__/scanner.test.js.map +1 -1
- package/dist/cli.js +195 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.js +398 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/scanner.d.ts +181 -0
- package/dist/lib/scanner.d.ts.map +1 -1
- package/dist/lib/scanner.js +1207 -0
- package/dist/lib/scanner.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@asifkibria/claude-code-toolkit)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
[](https://github.com/asifkibria/claude-code-toolkit)
|
|
6
6
|
|
|
7
7
|
A comprehensive MCP server and CLI toolkit for maintaining, optimizing, and troubleshooting your Claude Code installation.
|
|
8
8
|
|
|
@@ -172,6 +172,198 @@ Top 5 by size:
|
|
|
172
172
|
...
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
+
### `cct context` - Estimate Context Size
|
|
176
|
+
|
|
177
|
+
See how much context/tokens your conversations are using.
|
|
178
|
+
|
|
179
|
+
### `cct analytics` - Usage Analytics Dashboard
|
|
180
|
+
|
|
181
|
+
Get a comprehensive view of your Claude Code usage with activity trends, top projects, and tool statistics.
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
$ cct analytics
|
|
185
|
+
|
|
186
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
187
|
+
║ USAGE ANALYTICS DASHBOARD ║
|
|
188
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
189
|
+
|
|
190
|
+
📊 OVERVIEW
|
|
191
|
+
──────────────────────────────────────────────────
|
|
192
|
+
Conversations: 23
|
|
193
|
+
Total Messages: 12,456
|
|
194
|
+
Total Tokens: ~2,345,678
|
|
195
|
+
Total Size: 156.2 MB
|
|
196
|
+
Active Projects: 8
|
|
197
|
+
Avg Msgs/Conv: 542
|
|
198
|
+
Avg Tokens/Conv: ~102,000
|
|
199
|
+
|
|
200
|
+
📈 ACTIVITY (Last 7 days)
|
|
201
|
+
──────────────────────────────────────────────────
|
|
202
|
+
Mon │█████████████████████████│ 234
|
|
203
|
+
Tue │████████████████░░░░░░░░░│ 156
|
|
204
|
+
Wed │██████████████████░░░░░░░│ 178
|
|
205
|
+
...
|
|
206
|
+
|
|
207
|
+
🏆 TOP PROJECTS (by messages)
|
|
208
|
+
──────────────────────────────────────────────────
|
|
209
|
+
-Users-me-myapp │███████████████│ 2,341
|
|
210
|
+
-Users-me-another-proj │████████░░░░░░░│ 1,234
|
|
211
|
+
...
|
|
212
|
+
|
|
213
|
+
🔧 TOP TOOLS
|
|
214
|
+
──────────────────────────────────────────────────
|
|
215
|
+
Read 1,234 (25%)
|
|
216
|
+
Edit 987 (20%)
|
|
217
|
+
Bash 654 (13%)
|
|
218
|
+
...
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### `cct duplicates` - Find Duplicate Content
|
|
222
|
+
|
|
223
|
+
Scan for duplicate conversations and content (images, documents) that waste storage and context.
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
$ cct duplicates
|
|
227
|
+
|
|
228
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
229
|
+
║ DUPLICATE DETECTION REPORT ║
|
|
230
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
231
|
+
|
|
232
|
+
📊 SUMMARY
|
|
233
|
+
──────────────────────────────────────────────────
|
|
234
|
+
Duplicate groups: 5
|
|
235
|
+
Duplicate images: 12
|
|
236
|
+
Duplicate documents: 3
|
|
237
|
+
Wasted space: 45.2 MB
|
|
238
|
+
|
|
239
|
+
📁 DUPLICATE CONVERSATIONS
|
|
240
|
+
──────────────────────────────────────────────────
|
|
241
|
+
[2 copies] Wasted: 12.5 MB
|
|
242
|
+
- -Users-me-myapp/conversation1.jsonl
|
|
243
|
+
- -Users-me-myapp-backup/conversation1.jsonl
|
|
244
|
+
|
|
245
|
+
🖼️ DUPLICATE CONTENT
|
|
246
|
+
──────────────────────────────────────────────────
|
|
247
|
+
🖼️ image [3 copies] ~2.1 MB wasted
|
|
248
|
+
- -Users-me-proj1/conv.jsonl:142
|
|
249
|
+
- -Users-me-proj1/conv.jsonl:856
|
|
250
|
+
... and 1 more locations
|
|
251
|
+
|
|
252
|
+
💡 RECOMMENDATIONS
|
|
253
|
+
──────────────────────────────────────────────────
|
|
254
|
+
- Review duplicate conversations and consider removing copies
|
|
255
|
+
- Same images appear multiple times in your conversations
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### `cct archive` - Archive Old Conversations
|
|
259
|
+
|
|
260
|
+
Move inactive conversations to an archive directory to free up space.
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
$ cct archive --days 60 --dry-run
|
|
264
|
+
|
|
265
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
266
|
+
║ CONVERSATION ARCHIVE REPORT ║
|
|
267
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
268
|
+
|
|
269
|
+
📊 SUMMARY
|
|
270
|
+
──────────────────────────────────────────────────
|
|
271
|
+
Eligible conversations: 8
|
|
272
|
+
Total size: 45.2 MB
|
|
273
|
+
|
|
274
|
+
📁 ARCHIVE CANDIDATES
|
|
275
|
+
──────────────────────────────────────────────────
|
|
276
|
+
...-Users-me-old-project/abc123.jsonl
|
|
277
|
+
65 days inactive, 234 msgs, 12.5 MB
|
|
278
|
+
...-Users-me-another-old/def456.jsonl
|
|
279
|
+
45 days inactive, 156 msgs, 8.2 MB
|
|
280
|
+
...
|
|
281
|
+
|
|
282
|
+
📋 DRY RUN - No changes made
|
|
283
|
+
──────────────────────────────────────────────────
|
|
284
|
+
Would archive: 8 conversations
|
|
285
|
+
Would free: 45.2 MB
|
|
286
|
+
Archive to: ~/.claude/archive
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### `cct maintenance` - Scheduled Maintenance
|
|
290
|
+
|
|
291
|
+
Run automated maintenance checks and actions.
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
$ cct maintenance
|
|
295
|
+
|
|
296
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
297
|
+
║ MAINTENANCE REPORT ║
|
|
298
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
299
|
+
|
|
300
|
+
📊 STATUS
|
|
301
|
+
──────────────────────────────────────────────────
|
|
302
|
+
⚠ Needs Attention
|
|
303
|
+
|
|
304
|
+
📋 PENDING ACTIONS (dry run)
|
|
305
|
+
──────────────────────────────────────────────────
|
|
306
|
+
🔧 Oversized content detected
|
|
307
|
+
3 item(s) (~2.3 MB)
|
|
308
|
+
🗑️ Backups older than 7 days
|
|
309
|
+
5 item(s) (~89.3 MB)
|
|
310
|
+
📦 Conversations inactive for 60+ days
|
|
311
|
+
8 item(s) (~45.2 MB)
|
|
312
|
+
|
|
313
|
+
💡 RECOMMENDATIONS
|
|
314
|
+
──────────────────────────────────────────────────
|
|
315
|
+
- Run 'cct fix' to remove oversized content
|
|
316
|
+
- Run 'cct cleanup --days 7' to remove old backups
|
|
317
|
+
- Run 'cct archive --days 60' to archive inactive conversations
|
|
318
|
+
|
|
319
|
+
# Show scheduled maintenance setup
|
|
320
|
+
$ cct maintenance --schedule
|
|
321
|
+
|
|
322
|
+
# Run maintenance automatically
|
|
323
|
+
$ cct maintenance --auto
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
# Summary of all conversations by context size
|
|
328
|
+
$ cct context
|
|
329
|
+
|
|
330
|
+
Context Usage Summary
|
|
331
|
+
|
|
332
|
+
Total conversations: 23
|
|
333
|
+
Combined tokens: ~1,234,567
|
|
334
|
+
|
|
335
|
+
Top 10 by context size:
|
|
336
|
+
|
|
337
|
+
-Users-me-projects-myapp/abc123.jsonl
|
|
338
|
+
~125,000 tokens (456 messages)
|
|
339
|
+
⚠ Context exceeds 100K tokens - consider archiving older messages
|
|
340
|
+
|
|
341
|
+
-Users-me-projects-another/def456.jsonl
|
|
342
|
+
~45,000 tokens (234 messages)
|
|
343
|
+
...
|
|
344
|
+
|
|
345
|
+
# Detailed breakdown for a specific file
|
|
346
|
+
$ cct context -f ~/.claude/projects/-Users-me-myapp/conversation.jsonl
|
|
347
|
+
|
|
348
|
+
Context Size Estimate
|
|
349
|
+
────────────────────────────────────────
|
|
350
|
+
Total: ~125,000 tokens
|
|
351
|
+
Messages: 456
|
|
352
|
+
|
|
353
|
+
Breakdown:
|
|
354
|
+
User messages: 12,500 tokens
|
|
355
|
+
Assistant messages: 85,000 tokens
|
|
356
|
+
Tool calls: 5,000 tokens
|
|
357
|
+
Tool results: 20,000 tokens
|
|
358
|
+
Images: 2,500 tokens
|
|
359
|
+
|
|
360
|
+
Largest message: Line 342 (assistant)
|
|
361
|
+
~8,500 tokens
|
|
362
|
+
|
|
363
|
+
Warnings:
|
|
364
|
+
⚠ Context exceeds 100K tokens - consider archiving older messages
|
|
365
|
+
```
|
|
366
|
+
|
|
175
367
|
### `cct backups` - List Backups
|
|
176
368
|
|
|
177
369
|
See all backup files.
|
|
@@ -218,11 +410,40 @@ $ cct cleanup --days 7
|
|
|
218
410
|
✓ Deleted 3 backup(s)
|
|
219
411
|
```
|
|
220
412
|
|
|
413
|
+
### `cct export` - Export Conversation
|
|
414
|
+
|
|
415
|
+
Export a conversation to markdown or JSON for backup, sharing, or archiving.
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
# Export to markdown (default)
|
|
419
|
+
$ cct export -f ~/.claude/projects/-Users-me-myapp/conversation.jsonl
|
|
420
|
+
|
|
421
|
+
✓ Exported 156 messages to conversation.md
|
|
422
|
+
|
|
423
|
+
# Export to JSON
|
|
424
|
+
$ cct export -f conversation.jsonl --format json -o backup.json
|
|
425
|
+
|
|
426
|
+
✓ Exported 156 messages to backup.json
|
|
427
|
+
|
|
428
|
+
# Include tool results in export
|
|
429
|
+
$ cct export -f conversation.jsonl --with-tools
|
|
430
|
+
|
|
431
|
+
✓ Exported 156 messages to conversation.md
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
**Export formats:**
|
|
435
|
+
|
|
436
|
+
- **Markdown**: Human-readable format with headers, code blocks, and tool summaries
|
|
437
|
+
- **JSON**: Structured format with full message metadata for programmatic use
|
|
438
|
+
|
|
221
439
|
## CLI Options Reference
|
|
222
440
|
|
|
223
441
|
| Option | Description |
|
|
224
442
|
|--------|-------------|
|
|
225
443
|
| `-f, --file <path>` | Target a specific file instead of all conversations |
|
|
444
|
+
| `-o, --output <path>` | For export: output file path |
|
|
445
|
+
| `--format <type>` | For export: `markdown` or `json` (default: markdown) |
|
|
446
|
+
| `--with-tools` | For export: include tool results in output |
|
|
226
447
|
| `-d, --dry-run` | Preview changes without making them |
|
|
227
448
|
| `--no-backup` | Skip creating backups when fixing (not recommended) |
|
|
228
449
|
| `--days <n>` | For cleanup: delete backups older than n days (default: 7) |
|
|
@@ -239,8 +460,14 @@ When installed as an MCP server, these tools are available to Claude:
|
|
|
239
460
|
|------|-------------|
|
|
240
461
|
| `health_check` | Quick health check with recommendations |
|
|
241
462
|
| `get_conversation_stats` | Detailed statistics about conversations |
|
|
463
|
+
| `estimate_context_size` | Estimate token/context usage of conversations |
|
|
464
|
+
| `usage_analytics` | Usage analytics dashboard with trends and breakdowns |
|
|
465
|
+
| `find_duplicates` | Find duplicate conversations and content |
|
|
466
|
+
| `archive_conversations` | Archive old/inactive conversations |
|
|
467
|
+
| `run_maintenance` | Run maintenance checks and actions |
|
|
242
468
|
| `scan_image_issues` | Scan for oversized content (images, PDFs, documents) |
|
|
243
469
|
| `fix_image_issues` | Fix detected issues with automatic backups |
|
|
470
|
+
| `export_conversation` | Export conversation to markdown or JSON format |
|
|
244
471
|
| `list_backups` | List all backup files |
|
|
245
472
|
| `restore_backup` | Restore a conversation from backup |
|
|
246
473
|
| `cleanup_backups` | Delete old backups to free space |
|
|
@@ -294,12 +521,52 @@ cct cleanup --days 30 --dry-run # Preview
|
|
|
294
521
|
cct cleanup --days 30 # Delete
|
|
295
522
|
```
|
|
296
523
|
|
|
524
|
+
### I want to save or share a conversation
|
|
525
|
+
|
|
526
|
+
```bash
|
|
527
|
+
cct export -f ~/.claude/projects/path/to/conversation.jsonl
|
|
528
|
+
# Creates conversation.md in current directory
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
### My conversations are getting slow
|
|
532
|
+
|
|
533
|
+
```bash
|
|
534
|
+
cct context # See which conversations are using the most tokens
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### I want to see my usage patterns
|
|
538
|
+
|
|
539
|
+
```bash
|
|
540
|
+
cct analytics # Full usage dashboard with trends and stats
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
### I have duplicate content wasting space
|
|
544
|
+
|
|
545
|
+
```bash
|
|
546
|
+
cct duplicates # Find duplicate conversations and content
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
### I want to clean up old conversations
|
|
550
|
+
|
|
551
|
+
```bash
|
|
552
|
+
cct archive --days 60 --dry-run # Preview what would be archived
|
|
553
|
+
cct archive --days 60 # Archive conversations inactive for 60+ days
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
### I want automated maintenance
|
|
557
|
+
|
|
558
|
+
```bash
|
|
559
|
+
cct maintenance # Check what needs attention
|
|
560
|
+
cct maintenance --auto # Automatically fix issues
|
|
561
|
+
cct maintenance --schedule # Get cron/launchd setup instructions
|
|
562
|
+
```
|
|
563
|
+
|
|
297
564
|
## Development
|
|
298
565
|
|
|
299
566
|
```bash
|
|
300
567
|
npm install # Install dependencies
|
|
301
568
|
npm run build # Build TypeScript
|
|
302
|
-
npm test # Run tests (
|
|
569
|
+
npm test # Run tests (70 tests)
|
|
303
570
|
npm run dev # Watch mode
|
|
304
571
|
npm run test:coverage # Coverage report
|
|
305
572
|
```
|