Auto-saved at 2025-07-29 14:35:46 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
103 lines
2.4 KiB
Markdown
103 lines
2.4 KiB
Markdown
# PM2 Auto-Commit Service - Quick Reference
|
|
|
|
## ✅ Service Status: RUNNING
|
|
The auto-commit watcher is now running as a PM2 background service!
|
|
|
|
## 🚀 Quick Commands
|
|
|
|
### Service Management
|
|
```bash
|
|
# Check service status
|
|
npm run pm2:status
|
|
|
|
# View auto-commit logs
|
|
npm run services:logs
|
|
|
|
# Stop auto-commit service
|
|
npm run services:stop
|
|
|
|
# Start auto-commit service
|
|
npm run services:start
|
|
|
|
# Restart auto-commit service
|
|
./start-services.sh restart
|
|
```
|
|
|
|
### Manual Operations
|
|
```bash
|
|
# Save changes immediately
|
|
npm run save "Your message"
|
|
|
|
# Create restore point
|
|
npm run restore-point "Before big changes"
|
|
|
|
# List restore points
|
|
./auto-commit.sh list
|
|
```
|
|
|
|
## 📊 Monitoring
|
|
|
|
### Real-time Monitoring
|
|
```bash
|
|
# PM2 monitoring dashboard
|
|
npm run pm2:monit
|
|
|
|
# Live log streaming
|
|
pm2 logs timeshift-auto-commit
|
|
```
|
|
|
|
### Log Files
|
|
- **Output**: `/home/klas/timeshift/logs/auto-commit.out.log`
|
|
- **Errors**: `/home/klas/timeshift/logs/auto-commit.error.log`
|
|
- **Combined**: `/home/klas/timeshift/logs/auto-commit.log`
|
|
|
|
## ⚙️ How It Works
|
|
|
|
1. **File Watching**: Monitors `components/`, `app/`, `lib/` directories
|
|
2. **Smart Delay**: Waits 30 seconds after last change
|
|
3. **Auto-Commit**: Creates timestamped git commits
|
|
4. **Rate Limiting**: Max 10 commits per hour
|
|
5. **Restore Points**: Creates backup branches every 30 minutes
|
|
|
|
## 🛡️ Backup & Recovery
|
|
|
|
### Automatic Backups
|
|
- ✅ Auto-commits every 30 seconds when files change
|
|
- ✅ Restore points every 30 minutes
|
|
- ✅ Session restore point on startup
|
|
|
|
### Manual Recovery
|
|
```bash
|
|
# See all restore points
|
|
./auto-commit.sh list
|
|
|
|
# Restore to specific point
|
|
git checkout restore-point-20250729-142449
|
|
|
|
# Go back to main
|
|
git checkout main
|
|
|
|
# See recent auto-commits
|
|
git log --oneline -10
|
|
```
|
|
|
|
## 🔧 Process Info
|
|
- **Service Name**: `timeshift-auto-commit`
|
|
- **Process ID**: Check with `npm run pm2:status`
|
|
- **Auto-restart**: Yes (if crashes)
|
|
- **Max Memory**: 200MB limit
|
|
- **Log Rotation**: Managed by PM2
|
|
|
|
## 🎯 Benefits Achieved
|
|
|
|
✅ **No more lost work** - Changes saved every 30 seconds
|
|
✅ **Claude restart proof** - Survives session restarts
|
|
✅ **Background operation** - Runs independently
|
|
✅ **Auto-recovery** - PM2 restarts if crashes
|
|
✅ **Full monitoring** - Logs and status tracking
|
|
✅ **Easy management** - Simple npm commands
|
|
|
|
---
|
|
|
|
**🎉 Success**: Your work is now automatically protected!
|
|
The service is running in the background and will continue even if Claude restarts. |