Auto-install reporter for Claude Code CLI - Track every session automatically
npm install claude-reporter-setupTự động track mọi Claude Code session. Cài 1 lần, dùng mãi mãi.
``bash`
npx claude-reporter-setup
Xong! Mở terminal mới, dùng claude như bình thường.
→ Mọi session tự động được lưu. Zero effort. Zero maintenance.
command được track
- ✅ Bắt Ctrl+C, kill, crash
- ✅ Lưu full logs
- ✅ SQLite database$3
- ✅ Multiple destinations (Drive, Webhook, Local)
- ✅ Discord notifications
- ✅ JSON format
- ✅ Realtime streaming$3
- ✅ Interactive setup wizard
- ✅ Multiple storage backends
- ✅ Easy switching between backends
- ✅ Helper scripts📦 Installation
$3
`bash
npx claude-reporter-setup
`$3
`bash
npm install -g claude-reporter-setup
claude-reporter-setup
`$3
`bash
git clone https://github.com/yourusername/claude-reporter-setup.git
cd claude-reporter-setup
npm install
node bin/setup.js
`🐛 Troubleshooting
$3
→ Mở terminal MỚI! (Cmd+T hoặc Ctrl+Shift+T)
Hoặc reload:
`bash
source ~/.zshrc # or ~/.bashrc
`$3
📖 Full guide: TROUBLESHOOTING.md
Common fixes:
- Open NEW terminal window
- Run
source ~/.zshrc or source ~/.bashrc
- Check which claude
- Re-run setup: npx claude-reporter-setup---
🎯 Usage
$3
`bash
Reload shell
source ~/.bashrc # hoặc ~/.zshrcDùng Claude như thường lệ
claude chat
claude code fix-bug.py
claude ask "explain this code"Mọi thứ tự động được track!
`$3
`bash
Xem 20 sessions gần nhất
claude --viewXem config
claude --configXem thống kê
claude --stats
`$3
`bash
Mở thư mục reports
cd ~/.claude-reporter/reports
ls -ltHoặc dùng script helper
~/.claude-reporter/view-reports.sh
`⚙️ Configuration
$3
Claude Reporter hỗ trợ nhiều storage backends:
#### 1. Google Drive (Recommended)
Tự động upload reports lên Google Drive của bạn:
`bash
Chọn Google Drive khi setup
npx claude-reporter-setupHoặc switch sau này
~/.claude-reporter/switch-storage.sh
`📖 Chi tiết: GDRIVE_SETUP.md
#### 2. Webhook/HTTP
Gửi reports đến custom endpoint:
`bash
Setup webhook
~/.claude-reporter/switch-storage.sh
Chọn option 2
Hoặc edit config
nano ~/.claude-reporter/config.json
`Test với webhook.site:
1. Truy cập https://webhook.site
2. Copy unique URL
3. Paste vào config
#### 3. Local Storage
Chỉ lưu local, không gửi đi đâu:
`bash
~/.claude-reporter/switch-storage.sh
Chọn option 3
`Reports lưu tại:
~/.claude-reporter/reports/#### 4. Enterprise
Cần custom integration (Slack, Teams, Jira)?
📧 Contact: enterprise@claude-reporter.com
$3
1. Truy cập https://webhook.site
2. Copy URL duy nhất của bạn
3. Update config:
`bash
cd ~/.claude-reporter
./update-webhook.sh
`$3
Edit file:
~/.claude-reporter/config.json`json
{
"report_endpoint": "https://webhook.site/your-unique-url",
"discord_webhook": "https://discord.com/api/webhooks/...",
"auto_report": true,
"save_local": true,
"log_commands": true
}
`$3
1. Vào Discord Server Settings → Integrations → Webhooks
2. Create Webhook
3. Copy Webhook URL
4. Paste vào
discord_webhook trong config📊 Report Format
Reports được gửi dưng dạng JSON:
`json
{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"started_at": "2025-01-15T10:30:00",
"ended_at": "2025-01-15T10:45:00",
"status": "completed",
"working_dir": "/home/user/project",
"command": "claude chat",
"log_preview": "...",
"exit_code": 0,
"timestamp": "2025-01-15T10:45:00"
}
`$3
- completed - Session kết thúc bình thường
- interrupted - User nhấn Ctrl+C
- error - Có lỗi xảy ra🗂️ File Structure
`
~/.claude-reporter/
├── config.json # Configuration
├── sessions.db # SQLite database
├── claude-reporter.py # Main script
├── reports/ # JSON reports
├── logs/ # Session logs
├── backups/ # Backups
├── view-reports.sh # Helper script
└── update-webhook.sh # Helper script
`🔧 Advanced Usage
$3
Bạn có thể tự host webhook endpoint:
`javascript
// Express.js example
app.post('/claude-report', (req, res) => {
const report = req.body;
// Save to database
db.reports.insert(report);
// Send notification
if (report.status === 'error') {
sendSlackAlert(report);
}
res.json({ received: true });
});
`$3
`bash
sqlite3 ~/.claude-reporter/sessions.db
``sql
-- Xem tất cả sessions
SELECT * FROM sessions ORDER BY started_at DESC LIMIT 10;-- Sessions có lỗi
SELECT * FROM sessions WHERE status = 'error';
-- Thống kê theo ngày
SELECT DATE(started_at), COUNT(*)
FROM sessions
GROUP BY DATE(started_at);
`🐛 Troubleshooting
$3
`bash
Check Claude CLI installation
which claudeInstall Claude CLI
Visit: https://docs.anthropic.com/claude-code
`$3
`bash
Check config
claude --configTest webhook manually
curl -X POST your-webhook-url \
-H "Content-Type: application/json" \
-d '{"test": true}'
`$3
`bash
chmod +x ~/.claude-reporter/claude-reporter.py
chmod +x ~/.claude-reporter/*.sh
`📝 Example Workflows
$3
`bash
Setup webhook pointing to team dashboard
Everyone on team runs: npx claude-reporter-setup
All Claude sessions auto-reported to central dashboard
`$3
`bash
Use webhook.site for quick viewing
Or setup local server to analyze patterns
View stats: claude --stats
`$3
`bash
In CI pipeline
npx claude-reporter-setup --ci
claude code --review pr-123
Report sent to build system
``Contributions welcome! Please:
1. Fork repo
2. Create feature branch
3. Make changes
4. Test thoroughly
5. Submit PR
MIT License - feel free to use anywhere!
- Claude Code Docs
- NPM Package
- GitHub
- Issues
- GitHub Issues: Report bugs
- Discord: Join community
- Email: your-email@example.com
Made with ❤️ for the Claude community
---
Happy coding with Claude! 🚀