QuantumNest provides several command-line scripts for development, deployment, and maintenance tasks.
CLI scripts are included in the repository:
git clone https://github.com/quantsingularity/QuantumNest.git
cd QuantumNest
chmod +x scripts/*.shMost scripts support these common options:
| Option | Description | Example |
|---|---|---|
--help |
Show help message | ./script.sh --help |
--verbose |
Enable verbose output | ./script.sh --verbose |
--dry-run |
Show what would be done | ./script.sh --dry-run |
| Command | Arguments | Description | Example |
|---|---|---|---|
setup_quantumnest_env.sh |
None | Initial environment setup | ./setup_quantumnest_env.sh |
run_quantumnest.sh |
None | Start all services | ./run_quantumnest.sh |
env_manager.sh |
status|template|sync|backup|restore|validate |
Manage environment variables | ./scripts/env_manager.sh status |
Description: Automated environment setup for QuantumNest
Usage:
./setup_quantumnest_env.shWhat it does:
- Checks system dependencies (Node.js, Python, Docker)
- Creates Python virtual environment
- Installs backend dependencies
- Installs frontend dependencies
- Installs blockchain dependencies
- Generates environment files
- Initializes databases
Example Output:
🚀 QuantumNest Environment Setup
================================
✓ Checking dependencies...
✓ Node.js v18.0.0 found
✓ Python 3.10.0 found
✓ Docker 20.10.0 found
✓ Setting up backend...
✓ Created virtual environment
✓ Installed 87 packages
✓ Setting up frontend...
✓ Installed 245 packages
Setup complete! Run ./run_quantumnest.sh to start.
Description: Start all QuantumNest services
Usage:
./run_quantumnest.sh [options]Options:
--backend-only- Start only backend API--frontend-only- Start only frontend--no-celery- Skip Celery worker
Example:
# Start all services
./run_quantumnest.sh
# Start only backend
./run_quantumnest.sh --backend-onlyDescription: Manage environment variables across components
Usage:
./scripts/env_manager.sh [COMMAND] [OPTIONS]Commands:
| Command | Description | Example |
|---|---|---|
status |
Check environment file status | ./scripts/env_manager.sh status |
template |
Generate template .env files | ./scripts/env_manager.sh template |
sync |
Synchronize common variables | ./scripts/env_manager.sh sync |
backup |
Backup all environment files | ./scripts/env_manager.sh backup |
restore [TIMESTAMP] |
Restore from backup | ./scripts/env_manager.sh restore 20250401 |
validate |
Validate environment files | ./scripts/env_manager.sh validate |
Example:
# Check status
./scripts/env_manager.sh status
# Output:
# Component: backend
# Status: ✓ .env file exists
# Variables: 42 defined
#
# Component: frontend
# Status: ✗ .env file missing
# Variables: 0 defined
# Generate templates
./scripts/env_manager.sh template
# Validate configuration
./scripts/env_manager.sh validate| Command | Arguments | Description | Example |
|---|---|---|---|
build.sh |
None | Build all components | ./scripts/build.sh |
run_all_tests.sh |
[component] |
Run test suites | ./scripts/run_all_tests.sh backend |
lint-all.sh |
None | Run linters | ./scripts/lint-all.sh |
dependency_checker.sh |
None | Check dependencies | ./scripts/dependency_checker.sh |
Description: Build all QuantumNest components
Usage:
./scripts/build.sh [options]Options:
--clean- Clean before building--production- Production build--component=NAME- Build specific component
Example:
# Build all
./scripts/build.sh
# Clean build
./scripts/build.sh --clean
# Build frontend only
./scripts/build.sh --component=frontendDescription: Execute all test suites
Usage:
./scripts/run_all_tests.sh [component]Arguments:
backend- Run backend tests onlyfrontend- Run frontend tests onlyblockchain- Run smart contract tests only
Example:
# Run all tests
./scripts/run_all_tests.sh
# Run backend tests only
./scripts/run_all_tests.sh backend
# Output:
# ================================
# Running Backend Tests
# ================================
#
# test_user_creation.py ✓
# test_portfolio_api.py ✓
# test_ai_models.py ✓
#
# 87 tests passed, 0 failedDescription: Run code linters for all components
Usage:
./scripts/lint-all.sh [options]Options:
--fix- Automatically fix issues--strict- Fail on warnings
Example:
# Check all code
./scripts/lint-all.sh
# Fix issues automatically
./scripts/lint-all.sh --fixDescription: Check and report on dependencies
Usage:
./scripts/dependency_checker.sh [options]Options:
--update- Check for updates--security- Security vulnerability scan--report- Generate detailed report
Example:
# Check dependencies
./scripts/dependency_checker.sh
# Check for security vulnerabilities
./scripts/dependency_checker.sh --security
# Output:
# Checking backend dependencies...
# ✓ fastapi 0.104.1 (latest: 0.105.0)
# ⚠ requests 2.28.0 (security update available: 2.31.0)
# ✓ sqlalchemy 2.0.21 (latest)
#
# Security Issues Found: 1
# Recommendation: Update requests package| Command | Arguments | Description | Example |
|---|---|---|---|
log_aggregator.sh |
collect|watch|clean|search|analyze |
Manage logs | ./scripts/log_aggregator.sh watch |
Description: Collect and analyze logs from all components
Usage:
./scripts/log_aggregator.sh [COMMAND] [OPTIONS]Commands:
| Command | Description | Example |
|---|---|---|
collect |
Collect logs from all components | ./scripts/log_aggregator.sh collect |
watch |
Watch logs in real-time | ./scripts/log_aggregator.sh watch |
clean |
Clean old log files | ./scripts/log_aggregator.sh clean |
search [term] |
Search across all logs | ./scripts/log_aggregator.sh search "error" |
analyze |
Analyze logs for issues | ./scripts/log_aggregator.sh analyze |
Example:
# Collect all logs
./scripts/log_aggregator.sh collect
# Watch logs in real-time
./scripts/log_aggregator.sh watch
# Search for errors
./scripts/log_aggregator.sh search "error"
# Output:
# Searching for 'error' in logs...
#
# backend/app.log:
# 2025-04-01 10:30:15 ERROR - Database connection failed
# 2025-04-01 10:31:20 ERROR - Timeout in AI prediction
#
# frontend/console.log:
# 2025-04-01 10:32:05 ERROR - Failed to fetch portfolio data
#
# Found 3 occurrences
# Analyze logs
./scripts/log_aggregator.sh analyze
# Output:
# Log Analysis Summary
# ====================
# Total Errors: 15
# Total Warnings: 42
#
# Top Errors:
# 1. Database timeout (8 occurrences)
# 2. API rate limit (4 occurrences)
# 3. Invalid token (3 occurrences)# 1. Initial setup
./setup_quantumnest_env.sh
# 2. Start development
./run_quantumnest.sh
# 3. Run tests during development
./scripts/run_all_tests.sh
# 4. Check code quality
./scripts/lint-all.sh --fix
# 5. View logs
./scripts/log_aggregator.sh watch# 1. Validate environment
./scripts/env_manager.sh validate
# 2. Check dependencies
./scripts/dependency_checker.sh --security
# 3. Run tests
./scripts/run_all_tests.sh
# 4. Build for production
./scripts/build.sh --production
# 5. Backup environment
./scripts/env_manager.sh backup# 1. Check system status
./scripts/dependency_checker.sh
# 2. Analyze logs for issues
./scripts/log_aggregator.sh analyze
# 3. Clean old logs
./scripts/log_aggregator.sh clean
# 4. Update dependencies (if needed)
./scripts/dependency_checker.sh --update# Clone and setup
git clone https://github.com/quantsingularity/QuantumNest.git
cd QuantumNest
./setup_quantumnest_env.sh
# Start application
./run_quantumnest.sh
# In another terminal, verify services
curl http://localhost:8000/health
curl http://localhost:3000# Validate environment
./scripts/env_manager.sh validate
# Check for security issues
./scripts/dependency_checker.sh --security
# Run all tests
./scripts/run_all_tests.sh
# If all pass, build
./scripts/build.sh --production# Search logs for errors
./scripts/log_aggregator.sh search "error"
# Watch logs in real-time
./scripts/log_aggregator.sh watch
# Analyze patterns
./scripts/log_aggregator.sh analyze# Backup current environment
./scripts/env_manager.sh backup
# Make changes to .env files
vim code/backend/.env
# Validate changes
./scripts/env_manager.sh validate
# If issues, restore backup
./scripts/env_manager.sh restore 20250401_103000chmod +x scripts/*.shcd code/backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtEnsure you're running from repository root:
cd /path/to/QuantumNest
./scripts/script_name.shSee Also: