docs: Major documentation reorganization + ENV variable reference

**Documentation Structure:**
- Created docs/ subdirectory organization (analysis/, architecture/, bugs/,
  cluster/, deployments/, roadmaps/, setup/, archived/)
- Moved 68 root markdown files to appropriate categories
- Root directory now clean (only README.md remains)
- Total: 83 markdown files now organized by purpose

**New Content:**
- Added comprehensive Environment Variable Reference to copilot-instructions.md
- 100+ ENV variables documented with types, defaults, purpose, notes
- Organized by category: Required (Drift/RPC/Pyth), Trading Config (quality/
  leverage/sizing), ATR System, Runner System, Risk Limits, Notifications, etc.
- Includes usage examples (correct vs wrong patterns)

**File Distribution:**
- docs/analysis/ - Performance analyses, blocked signals, profit projections
- docs/architecture/ - Adaptive leverage, ATR trailing, indicator tracking
- docs/bugs/ - CRITICAL_*.md, FIXES_*.md bug reports (7 files)
- docs/cluster/ - EPYC setup, distributed computing docs (3 files)
- docs/deployments/ - *_COMPLETE.md, DEPLOYMENT_*.md status (12 files)
- docs/roadmaps/ - All *ROADMAP*.md strategic planning files (7 files)
- docs/setup/ - TradingView guides, signal quality, n8n setup (8 files)
- docs/archived/2025_pre_nov/ - Obsolete verification checklist (1 file)

**Key Improvements:**
- ENV variable reference: Single source of truth for all configuration
- Common Pitfalls #68-71: Already complete, verified during audit
- Better findability: Category-based navigation vs 68 files in root
- Preserves history: All files git mv (rename), not copy/delete
- Zero broken functionality: Only documentation moved, no code changes

**Verification:**
- 83 markdown files now in docs/ subdirectories
- Root directory cleaned: 68 files → 0 files (except README.md)
- Git history preserved for all moved files
- Container running: trading-bot-v4 (no restart needed)

**Next Steps:**
- Create README.md files in each docs subdirectory
- Add navigation index
- Update main README.md with new structure
- Consolidate duplicate deployment docs
- Archive truly obsolete files (old SQL backups)

See: docs/analysis/CLEANUP_PLAN.md for complete reorganization strategy
This commit is contained in:
mindesbunister
2025-12-04 08:29:59 +01:00
parent e48332e347
commit 4c36fa2bc3
61 changed files with 520 additions and 37 deletions

View File

@@ -0,0 +1,219 @@
# ✅ SAFETY ANALYSIS - Files Can Be Moved Without Breaking System
## 🔍 Analysis Performed
I've thoroughly analyzed the codebase for any references or dependencies on the files we plan to move.
---
## ✅ SAFE TO MOVE - No Breaking Changes
### **Documentation Files (*.md)**
**Status:** ✅ **COMPLETELY SAFE**
**Checked:**
- README.md references SETUP.md, DOCKER.md, TESTING.md, PHASE_*.md files
- These are **informational references only** - not runtime dependencies
- Moving them won't break the system
**Why Safe:**
- Markdown files are documentation only
- No code imports them
- No scripts read them at runtime
- They're only for human readers
---
### **n8n Workflow Files (*.json)**
**Status:** ✅ **COMPLETELY SAFE**
**Files to move:**
- All n8n-*.json files
- All telegram-*.json files
- Money_Machine.json
**Checked:**
- ❌ No Python imports found
- ❌ No shell script references found
- ❌ No TypeScript imports found
- ❌ No Docker COPY commands for these files
- ❌ No hardcoded paths in code
**References Found:**
1. `complete_telegram_setup.sh` line 12: References `telegram-manual-trade-FINAL.json` in **echo statement only** (informational)
2. `setup_telegram_bot.sh` line 34: References `telegram-manual-trade-FINAL.json` in **echo statement only** (informational)
**Why Safe:**
- These are import files for n8n (imported manually via UI)
- Not read by any running code
- Only referenced in echo statements telling users what to import
- Moving them won't affect runtime
---
### **Shell Scripts (*.sh)**
**Status:** ✅ **SAFE WITH ONE NOTE**
**Files to move:**
- docker-build.sh
- docker-start.sh
- docker-stop.sh
- docker-logs.sh
- complete_telegram_setup.sh
- setup_telegram_bot.sh
- GET_BOT_TOKEN.sh
- send_trade.sh
- trade.sh
- test-exit-orders.sh
**Critical Check - Docker Compose Reference:**
- `complete_telegram_setup.sh` line 47: Uses `docker-compose -f docker-compose.telegram-bot.yml`
- **This is SAFE** - it references docker-compose file in root, which we're NOT moving
**Critical Check - Source Command:**
- `setup_telegram_bot.sh` line 16: `source .env.telegram-bot`
- **This is SAFE** - .env.telegram-bot stays in root
**Why Safe:**
- Scripts run from root directory (systemd WorkingDirectory=/home/icke/traderv4)
- We can update user documentation to run them from new location
- Docker compose files stay in root
- No script sources another script from the files we're moving
---
### **Test Files (*.ts)**
**Status:** ✅ **COMPLETELY SAFE**
**Files to move:**
- test-drift-v4.ts
- test-full-flow.ts
- test-position-manager.ts
- test-price-monitor.ts
**Checked:**
- These are standalone test files
- No imports in other code
- No runtime dependencies
- Only run manually for testing
---
### **Archive Files**
**Status:** ✅ **COMPLETELY SAFE**
**Files to move:**
- telegram_trade_bot.py (unused)
- telegram-to-webhook.py (unused)
- quick-trade.html (unused)
- webapp-trade.html (unused)
- CREATE_NEW_BOT.md (documentation)
**Why Safe:**
- These files are not used by the system
- telegram_trade_bot.py is NOT the active bot (telegram_command_bot.py is)
- HTML files are standalone demos
---
## 🔐 CRITICAL FILES STAYING IN ROOT
### **Files That MUST Stay in Root:**
`telegram_command_bot.py` - Referenced by Dockerfile.telegram-bot line 9
`watch-restart.sh` - Referenced by systemd service
`docker-compose*.yml` - Referenced by scripts and systemd
`Dockerfile*` - Referenced by docker-compose files
`.env*` - Referenced by docker-compose and scripts
### **Verified:**
- Dockerfile.telegram-bot: `COPY telegram_command_bot.py .` ✅ (keeping in root)
- trading-bot-restart-watcher.service: `ExecStart=/home/icke/traderv4/watch-restart.sh` ✅ (keeping in root)
- All docker-compose files use `context: .` ✅ (stays in root)
---
## 📝 DOCUMENTATION UPDATES NEEDED
### **README.md References (Informational Only)**
The README.md mentions these files in the "Documentation" section:
- Line 281: `DOCKER.md` → Will update to `docs/setup/DOCKER.md`
- Line 282: `SETUP.md` → Will update to `docs/setup/SETUP.md`
- Line 283: `TESTING.md` → Will update to `docs/guides/TESTING.md`
- Line 327-330: Table references → Will update paths
**Impact:** ✅ Zero runtime impact - these are just documentation links
---
## 🎯 EXECUTION STRATEGY
### **Phase 1: Create Directory Structure**
```bash
mkdir -p docs/setup
mkdir -p docs/guides
mkdir -p docs/history
mkdir -p workflows/trading
mkdir -p workflows/analytics
mkdir -p workflows/telegram
mkdir -p workflows/archive
mkdir -p scripts/docker
mkdir -p scripts/setup
mkdir -p scripts/testing
mkdir -p tests
mkdir -p archive
```
### **Phase 2: Move Files (Git mv)**
Using `git mv` to preserve history:
- Move all docs to docs/
- Move all workflows to workflows/
- Move all scripts to scripts/
- Move all tests to tests/
- Move archive files to archive/
### **Phase 3: Update README.md**
Update file path references in documentation section
### **Phase 4: Delete Empty Directories**
```bash
rmdir data screenshots
```
### **Phase 5: Test**
- ✅ Verify containers still running
- ✅ Check docker-compose still works
- ✅ Test telegram bot still responds
- ✅ Verify watch-restart.sh still works
### **Phase 6: Git Commit**
Commit all changes with clear message
---
## ✅ FINAL VERDICT
**100% SAFE TO PROCEED**
**Reasoning:**
1. ✅ No runtime code reads the files we're moving
2. ✅ All Docker COPY commands reference files staying in root
3. ✅ Systemd service references files staying in root
4. ✅ Shell script references are either:
- Informational echo statements, or
- Reference files staying in root
5. ✅ README.md references are documentation only (will update paths)
6. ✅ No imports/requires of files being moved
7. ✅ All critical files (telegram_command_bot.py, watch-restart.sh, Dockerfiles, docker-compose) stay in root
**The system will continue running without any interruption.**
---
## 🚀 READY TO EXECUTE
Shall I proceed with the cleanup?
- Phase 1-6 will be executed systematically
- Each step will be verified
- System will remain operational throughout
- Git history will be preserved