Documentation Update - Central Environment Configuration: ✅ DEVELOPMENT ENVIRONMENT UPDATED: Changed from dev/env/ to central /etc/aitbc/.env - docs/advanced/05_development/DEVELOPMENT_GUIDELINES.md: Updated to reflect central environment - Reason: dev/env/ is now empty after cleanup, /etc/aitbc/.env is comprehensive central config - Benefit: Single source of truth for environment configuration ✅ CENTRAL ENVIRONMENT CONFIGURATION: 📁 Location: /etc/aitbc/.env (comprehensive environment configuration) 📋 Contents: Blockchain core, Coordinator API, Marketplace Web settings 🔧 Configuration: 79 lines of complete environment setup 🔒 Security: Production-ready with security notices and secrets management ✅ ENVIRONMENT CONTENTS: 🔗 Blockchain Core: chain_id, RPC settings, keystore paths, block production 🌐 Coordinator API: APP_ENV, database URLs, API keys, rate limiting 🏪 Marketplace Web: VITE configuration, API settings, authentication 📝 Notes: Security guidance, validation commands, secrets management ✅ STRUCTURAL IMPROVEMENT: 📁 Before: dev/env/ (empty after cleanup) 📁 After: /etc/aitbc/.env (central comprehensive configuration) 📖 Documentation: Updated to reflect actual structure 🎯 Usage: Single environment file for all configuration needs ✅ BENEFITS ACHIEVED: ✅ Central Configuration: Single .env file for all environment settings ✅ Production Ready: Comprehensive configuration with security guidance ✅ Standard Location: /etc/aitbc/ follows system configuration standards ✅ Easy Maintenance: One file to update for environment changes ✅ Clear Documentation: Reflects actual directory structure RESULT: Successfully updated development guidelines to use central /etc/aitbc/.env instead of empty dev/env/ directory, providing clear guidance for environment configuration management.
5.4 KiB
5.4 KiB
Developer File Organization Guidelines
📁 Where to Put Files
Essential Root Files (Keep at Root)
.editorconfig- Editor configuration.env.example- Environment template.gitignore- Git ignore rulesLICENSE- Project licenseREADME.md- Project documentationpyproject.toml- Python project configurationpoetry.lock- Dependency lock filepytest.ini- Test configurationscripts/testing/run_all_tests.sh- Main test runner
Development Scripts → dev/scripts/
# Development fixes and patches
dev/scripts/fix_*.py
dev/scripts/fix_*.sh
dev/scripts/patch_*.py
dev/scripts/simple_test.py
Test Files → dev/tests/
# Test scripts and scenarios
dev/tests/test_*.py
dev/tests/test_*.sh
dev/tests/test_scenario_*.sh
dev/tests/run_mc_test.sh
dev/tests/simple_test_results.json
Multi-Chain Testing → dev/multi-chain/
# Multi-chain specific files
dev/multi-chain/MULTI_*.md
dev/multi-chain/test_multi_chain*.py
dev/multi-chain/test_multi_site.py
Configuration Files → config/
# Configuration and environment files
config/.aitbc.yaml
config/.aitbc.yaml.example
config/.env.production
config/.nvmrc
config/.lycheeignore
Development Environment → /etc/aitbc/.env
# Central environment configuration
/etc/aitbc/.env
Cache and Temporary → dev/cache/
# Cache and temporary directories
dev/cache/.pytest_cache/
dev/cache/.ruff_cache/
dev/cache/logs/
dev/cache/.vscode/
🚀 Quick Start Commands
Creating New Files
# Create a new test script
touch dev/tests/test_my_feature.py
# Create a new development script
touch dev/scripts/fix_my_issue.py
# Create a new patch script
touch dev/scripts/patch_component.py
Checking Organization
# Check current file organization
./scripts/check-file-organization.sh
# Auto-fix organization issues
./scripts/move-to-right-folder.sh --auto
Git Integration
# Git will automatically check file locations on commit
git add .
git commit -m "My changes" # Will run pre-commit hooks
⚠️ Common Mistakes to Avoid
❌ Don't create these files at root:
test_*.pyortest_*.sh→ Usedev/tests/patch_*.pyorfix_*.py→ Usedev/scripts/MULTI_*.md→ Usedev/multi-chain/node_modules/or.venv/→ Usedev/env/.pytest_cache/or.ruff_cache/→ Usedev/cache/
✅ Do this instead:
# Right way to create test files
touch dev/tests/test_new_feature.py
# Right way to create patch files
touch dev/scripts/fix_bug.py
# Right way to handle dependencies
npm install # Will go to dev/env/node_modules/
python -m venv dev/env/.venv
🔧 IDE Configuration
VS Code
The project includes .vscode/settings.json with:
- Excluded patterns for cache directories
- File watcher exclusions
- Auto-format on save
- Organize imports on save
Git Hooks
Pre-commit hooks automatically:
- Check file locations
- Suggest correct locations
- Prevent commits with misplaced files
📞 Getting Help
If you're unsure where to put a file:
- Run
./scripts/check-file-organization.sh - Check this guide
- Ask in team chat
- When in doubt, use
dev/subdirectories
🔄 Maintenance
- Weekly: Run organization check
- Monthly: Review new file patterns
- As needed: Update guidelines for new file types
🛡️ Prevention System
The project includes a comprehensive prevention system:
1. Git Pre-commit Hooks
- Automatically check file locations before commits
- Block commits with misplaced files
- Provide helpful suggestions
2. Automated Scripts
check-file-organization.sh- Scan for issuesmove-to-right-folder.sh- Auto-fix organization
3. IDE Configuration
- VS Code settings hide clutter
- File nesting for better organization
- Tasks for easy access to tools
4. CI/CD Validation
- Pull request checks for file organization
- Automated comments with suggestions
- Block merges with organization issues
🎯 Best Practices
File Naming
- Use descriptive names
- Follow existing patterns
- Include file type in name (test_, patch_, fix_)
Directory Structure
- Keep related files together
- Use logical groupings
- Maintain consistency
Development Workflow
- Create files in correct location initially
- Use IDE tasks to check organization
- Run scripts before commits
- Fix issues automatically when prompted
🔍 Troubleshooting
Common Issues
"Git commit blocked due to file organization"
# Run the auto-fix script
./scripts/move-to-right-folder.sh --auto
# Then try commit again
git add .
git commit -m "My changes"
"Can't find my file"
# Check if it was moved automatically
find . -name "your-file-name"
# Or check organization status
./scripts/check-file-organization.sh
"VS Code shows too many files"
- The
.vscode/settings.jsonexcludes cache directories - Reload VS Code to apply settings
- Check file explorer settings
📚 Additional Resources
- Project Organization Workflow
- File Organization Prevention System
- Git Hooks Documentation
- VS Code Settings
Last updated: March 2, 2026
For questions or suggestions, please open an issue or contact the development team.