Files
trading_bot_v4/CLEANUP_PLAN.md
mindesbunister f8f289232a docs: Add workspace cleanup plan, safety analysis, and recovery procedures
- CLEANUP_PLAN.md: Detailed plan for organizing workspace structure
- SAFETY_ANALYSIS.md: Analysis proving no runtime dependencies will break
- RECOVERY_PLAN.md: Step-by-step recovery procedures if anything goes wrong

All analysis complete - ready to execute cleanup safely.
Files document current state and recovery methods.
2025-10-27 12:52:48 +01:00

292 lines
7.4 KiB
Markdown

# Workspace Cleanup Plan 🧹
## Overview
This workspace has accumulated many files during development phases. Here's a plan to organize everything better.
---
## 📁 PROPOSED STRUCTURE
```
/home/icke/traderv4/
├── README.md (keep - main entry point)
├── .env, .env.example, .env.telegram-bot (keep)
├── package.json, tsconfig.json, etc (keep - project config)
├── Dockerfile* (keep - Docker configs)
├── docker-compose*.yml (keep - Docker compose files)
├── app/ (keep - Next.js application)
├── config/ (keep - trading config)
├── lib/ (keep - core libraries)
├── prisma/ (keep - database)
├── node_modules/ (keep - dependencies)
├── docs/ (NEW - consolidated documentation)
│ ├── setup/
│ │ ├── SETUP.md
│ │ ├── DOCKER.md
│ │ ├── N8N_WORKFLOW_SETUP.md
│ │ ├── N8N_DATABASE_SETUP.md
│ │ ├── SETTINGS_SETUP.md
│ │ └── TELEGRAM_BOT_README.md
│ │
│ ├── guides/
│ │ ├── N8N_WORKFLOW_GUIDE.md
│ │ ├── TESTING.md
│ │ └── WORKFLOW_VERIFICATION.md
│ │
│ └── history/ (archive of completed phases)
│ ├── PHASE_1_COMPLETE.md
│ ├── PHASE_2_COMPLETE.md
│ ├── PHASE_2_SUMMARY.md
│ ├── QUICKREF_PHASE2.md
│ ├── EXIT_ORDERS_TEST_RESULTS.md
│ ├── TEST_STATUS_COMMAND.md
│ ├── TELEGRAM_STATUS_IMPLEMENTATION.md
│ └── STATUS_COMMAND_QUICKREF.txt
├── workflows/ (NEW - n8n workflow files)
│ ├── trading/
│ │ ├── n8n-complete-workflow.json (current main workflow)
│ │ └── Money_Machine.json (main workflow)
│ │
│ ├── analytics/
│ │ ├── n8n-daily-report.json
│ │ ├── n8n-database-analytics.json
│ │ ├── n8n-pattern-analysis.json
│ │ └── n8n-stop-loss-analysis.json
│ │
│ ├── telegram/
│ │ ├── telegram-manual-trade-FINAL.json (current)
│ │ └── telegram-webhook-FINAL.json (current)
│ │
│ └── archive/ (old/unused workflows)
│ ├── n8n-trader-workflow.json
│ ├── n8n-trader-workflow-updated.json
│ ├── n8n-workflow-simple.json
│ ├── telegram-listener-simple.json
│ ├── telegram-n8n-listener.json
│ ├── telegram-polling-addon.json
│ └── telegram-trigger-addon.json
├── scripts/ (NEW - utility scripts)
│ ├── docker/
│ │ ├── docker-build.sh
│ │ ├── docker-start.sh
│ │ ├── docker-stop.sh
│ │ └── docker-logs.sh
│ │
│ ├── setup/
│ │ ├── complete_telegram_setup.sh
│ │ ├── setup_telegram_bot.sh
│ │ └── GET_BOT_TOKEN.sh
│ │
│ └── testing/
│ ├── send_trade.sh
│ ├── trade.sh
│ └── test-exit-orders.sh
├── tests/ (NEW - test files)
│ ├── test-drift-v4.ts
│ ├── test-full-flow.ts
│ ├── test-position-manager.ts
│ └── test-price-monitor.ts
└── archive/ (NEW - old/unused files to keep for reference)
├── telegram_trade_bot.py (unused version)
├── telegram-to-webhook.py
├── quick-trade.html
├── webapp-trade.html
└── CREATE_NEW_BOT.md
```
---
## 🗑️ FILES TO DELETE (Empty/Obsolete)
### Empty Directories
- [x] `data/` - Empty, can be recreated if needed
- [x] `screenshots/` - Empty
### Obsolete Files
None identified - keeping everything in archive for reference
---
## 📦 FILES TO MOVE
### Documentation → `docs/`
**Create `docs/setup/`:**
- SETUP.md
- DOCKER.md
- N8N_WORKFLOW_SETUP.md
- N8N_DATABASE_SETUP.md
- SETTINGS_SETUP.md
- TELEGRAM_BOT_README.md
**Create `docs/guides/`:**
- N8N_WORKFLOW_GUIDE.md
- TESTING.md
- WORKFLOW_VERIFICATION.md
**Create `docs/history/`:**
- PHASE_1_COMPLETE.md
- PHASE_2_COMPLETE.md
- PHASE_2_SUMMARY.md
- QUICKREF_PHASE2.md
- EXIT_ORDERS_TEST_RESULTS.md
- TEST_STATUS_COMMAND.md
- TELEGRAM_STATUS_IMPLEMENTATION.md
- STATUS_COMMAND_QUICKREF.txt
### n8n Workflows → `workflows/`
**Create `workflows/trading/`:**
- n8n-complete-workflow.json
- Money_Machine.json
**Create `workflows/analytics/`:**
- n8n-daily-report.json
- n8n-database-analytics.json
- n8n-pattern-analysis.json
- n8n-stop-loss-analysis.json
**Create `workflows/telegram/`:**
- telegram-manual-trade-FINAL.json
- telegram-webhook-FINAL.json
**Create `workflows/archive/`:**
- n8n-trader-workflow.json
- n8n-trader-workflow-updated.json
- n8n-workflow-simple.json
- telegram-listener-simple.json
- telegram-n8n-listener.json
- telegram-polling-addon.json
- telegram-trigger-addon.json
### Scripts → `scripts/`
**Create `scripts/docker/`:**
- docker-build.sh
- docker-start.sh
- docker-stop.sh
- docker-logs.sh
**Create `scripts/setup/`:**
- complete_telegram_setup.sh
- setup_telegram_bot.sh
- GET_BOT_TOKEN.sh
**Create `scripts/testing/`:**
- send_trade.sh
- trade.sh
- test-exit-orders.sh
### Test Files → `tests/`
- test-drift-v4.ts
- test-full-flow.ts
- test-position-manager.ts
- test-price-monitor.ts
### Archive → `archive/`
**Unused but keep for reference:**
- telegram_trade_bot.py (we use telegram_command_bot.py)
- telegram-to-webhook.py
- quick-trade.html
- webapp-trade.html
- CREATE_NEW_BOT.md
---
## ✅ FILES TO KEEP IN ROOT (Essential)
### Core Configuration
- README.md (main documentation)
- package.json, package-lock.json
- tsconfig.json
- next.config.js
- postcss.config.js
- tailwind.config.js
### Environment Files
- .env
- .env.example
- .env.local
- .env.telegram-bot
### Docker Files
- Dockerfile
- Dockerfile.dev
- Dockerfile.telegram-bot
- docker-compose.yml
- docker-compose.dev.yml
- docker-compose.telegram-bot.yml
### Active Scripts (keep in root for easy access)
- watch-restart.sh (actively used by systemd)
- telegram_command_bot.py (active bot)
### System Files
- trading-bot-restart-watcher.service
- .dockerignore
- .gitignore
### Directories
- app/ (Next.js app)
- config/ (trading config)
- lib/ (core libraries)
- prisma/ (database)
- logs/ (active logs)
- node_modules/ (dependencies)
- .git/ (git repo)
- .github/ (GitHub config)
---
## 🎯 BENEFITS
1. **Cleaner Root Directory**
- Only essential config and active files
- Easy to find what you need
2. **Better Organization**
- Documentation in one place
- Workflows grouped by purpose
- Scripts organized by function
3. **Clear History**
- Phase completion docs archived
- Easy to reference past work
4. **Easier Maintenance**
- Know where to add new files
- Clear separation of concerns
---
## ⚡ EXECUTION PLAN
1. Create new directory structure
2. Move files to new locations
3. Delete empty directories
4. Update any hardcoded paths (if needed)
5. Test that everything still works
6. Git commit with clear message
---
## 🔍 FILES REQUIRING PATH UPDATES
**None expected** - All imports use relative paths or npm packages.
- Scripts reference files by name, not path
- Docker configs use context
- No hardcoded absolute paths found
---
## ❓ AWAITING YOUR APPROVAL
Please review this plan and let me know:
- ✅ Approve as-is
- 🔧 Suggest modifications
- ❌ Cancel cleanup
Once approved, I'll execute the plan systematically!