Skip to content

Development Tools#

The CommandCenter solution provides enhanced development tools to streamline your workflow. The primary tool is an interactive PowerShell menu system that organizes common development tasks into logical categories.

Enhanced Development Menu#

Overview#

The run-dev-enhanced.ps1 script provides a hierarchical menu system with organized categories for different development tasks. This replaces the original flat menu with a more user-friendly, structured approach.

Getting Started#

# Start the enhanced development menu
.\run-dev-enhanced.ps1

# View comprehensive help documentation
Get-Help .\run-dev-enhanced.ps1 -Full

The main menu provides access to six primary categories:

┌─────────────────────────────────────────────────────────────────┐
│                    MAIN MENU (Level 1)                          │
├─────────────────────────────────────────────────────────────────┤
│ 1: 🐳 Docker Operations                                         |
│ 2: ⚡ Development Tools                                         │
│ 3: 🗄️  Database Management                                      │
│ 4: 📊 Monitoring & Health                                       │
│ 5: 🏗️  Build & Deploy                                           │
│ 6: 🔧 Utilities                                                 │
│ Q: Quit                                                         │
└─────────────────────────────────────────────────────────────────┘

The main menu header displays:

  • Environment status - Shows if custom .env file is detected
  • Service status - Real-time count of running Docker services

Each category has its own focused sub-menu with related operations.

Category Details#

🐳 Docker Operations#

Comprehensive Docker container and image management:

Option Description Command
1 Start services with watch mode docker compose watch with .env configuration
2 View logs with filtering Interactive log viewer with service and pattern filtering
3 Show running services Container status and resource usage display
4 Stop all services Graceful shutdown of all Docker Compose services
5 Rebuild services Stop, rebuild with --no-cache, and restart
6 Clean Docker buildx cache Remove all buildx cache (with confirmation)
7 Docker cleanup utilities Container, image, and volume cleanup options

Log Filtering#

The log viewer provides:

  • Service selection - View logs from specific services or all services
  • Pattern filtering - Use regex patterns to filter log output
  • Real-time following - Live log streaming with --follow

Docker Cleanup Options#

The cleanup utility offers four levels:

  1. Remove stopped containers - docker container prune -f
  2. Remove unused images - docker image prune -f
  3. Remove unused volumes - docker volume prune -f
  4. Full cleanup - docker system prune -f --volumes (requires caution)

⚡ Development Tools#

Focused development workflow tools:

Option Description Details
1 Run .NET ServerAgent with watch dotnet watch for hot reload development
2 Run frontend in development mode npm run dev for React development server
3 Run tests (unit/integration) Interactive test runner with filtering
4 Format code dotnet format + prettier integration

Test Runner Options#

The test runner provides three modes:

  1. Unit tests only - dotnet test --filter "Category!=Integration"
  2. Integration tests only - dotnet test --filter "Category=Integration"
  3. All tests - dotnet test (complete test suite)

Code Formatting#

Automatically formats both backend and frontend code:

  • Backend - Uses dotnet format for C# code styling
  • Frontend - Uses prettier via npm scripts for TypeScript/JavaScript formatting

🗄️ Database Management#

Entity Framework and database operations:

Option Description Command
1 Run database migrations dotnet ef database update
2 Reset database Drop and recreate database (with confirmation)
3 Test database connection Validate connectivity and configuration

Migration Management#

  • Apply migrations - Updates database to latest migration state
  • Project targeting - Targets .\backend\CommandCenter.WebApi project
  • Safety checks - Confirmation required for destructive operations

Database Reset Process#

  1. Confirmation prompt - Requires typing 'YES' to proceed
  2. Drop database - dotnet ef database drop --force
  3. Recreate database - dotnet ef database update
  4. Apply migrations - Brings database to current schema

📊 Monitoring & Health#

Service monitoring and diagnostics:

Option Description Functionality
1 Service health check HTTP endpoint monitoring for all services
2 Performance monitoring Real-time Docker container resource usage
3 View error logs Filtered error and exception log viewing

Health Check Configuration#

Default health check endpoints:

  • Frontend - http://localhost:3000/health
  • BFF - http://localhost:5000/health
  • API - http://localhost:5001/health

Health status indicators:

  • ✅ Healthy - HTTP 200 response
  • ⚠️ Issues - Non-200 HTTP response
  • ❌ Unavailable - Connection timeout or error

Performance Monitoring#

Provides real-time metrics:

  • CPU usage - Per-container CPU percentage
  • Memory usage - Current and limit memory consumption
  • Container status - Running, stopped, or error states

🏗️ Build & Deploy#

Build processes and deployment automation:

Option Description Implementation
1 Build all (backend + frontend) npx cc build command
2 Build Docker images docker compose build
3 Deploy to staging Placeholder for custom deployment logic

Build Process#

The complete build process includes:

  • Backend compilation - All .NET projects
  • Frontend bundling - React application with optimization
  • Asset processing - Static files and resources
  • Artifact generation - Deployable packages

🔧 Utilities#

Environment management and maintenance tools:

Option Description Functionality
1 Install Root CA Certificate Import RootCA.crt for HTTPS development
2 Edit environment variables Open .env file in available editor
3 Clean artifacts and temporary files Remove build artifacts and temporary directories
4 Show solution statistics Display project metrics and Git information

Environment Management#

  • Editor detection - Prefers VS Code, falls back to Notepad
  • Template creation - Creates .env template if file doesn't exist
  • Configuration validation - Checks for required environment variables

Cleanup Operations#

Removes development artifacts:

  • Artifacts directory - Complete removal of /artifacts/
  • Build outputs - All bin/ and obj/ directories
  • Node modules - Frontend node_modules/ directory
  • Temporary files - Various development temporary files

Solution Statistics#

Provides comprehensive project metrics:

  • Project counts - C# projects, TypeScript/JavaScript files
  • Docker services - Count of defined services
  • Git information - Current branch, commit count
  • File statistics - Code file counts by type

Key Mappings#

  • Number keys (1-7) - Select menu options
  • 'B' key - Go back to previous menu level
  • 'Q' key - Quit application from any menu
  • Enter (empty input) - Clear screen and refresh menu

User Experience Features#

  • Color-coded menus - Visual organization with emoji icons
  • Real-time status - Live service and environment information
  • Non-blocking wait - Key press or automatic timeout continuation
  • Error recovery - Invalid selections with helpful error messages
  • Confirmation prompts - Safety checks for destructive operations

Advanced Usage#

Command Line Integration#

While the interactive menu is recommended, you can also use individual commands:

# Direct Docker operations
docker compose --env-file .env -f docker-compose.yml -f docker-compose.override.yml watch

# Building and testing
npx cc build
dotnet test
dotnet format

# Database operations
dotnet ef database update --project .\backend\CommandCenter.WebApi

Environment Configuration#

The script automatically detects and uses:

  • .env file - Custom environment variables
  • Docker Compose configuration - Multiple compose files
  • Project structure - Automatic path detection
  • Available tools - Git, VS Code, dotnet, npm detection

Customization#

You can customize the script by:

  • Modifying health check URLs - Update service endpoints
  • Adding deployment logic - Implement staging deployment (option 5-3)
  • Extending cleanup operations - Add custom cleanup tasks
  • Adding new menu categories - Extend the menu structure

Troubleshooting#

Common Issues#

  1. Docker not running - Ensure Docker Desktop is started
  2. Permission errors - Run PowerShell as Administrator if needed
  3. Path issues - Run script from solution root directory
  4. Service health checks failing - Verify service URLs and ports

Prerequisites Check#

Verify required tools are installed:

# Check PowerShell version
$PSVersionTable.PSVersion

# Verify Docker
docker --version
docker compose version

# Check .NET SDK
dotnet --version

# Verify Node.js
node --version
npm --version

# Check Git
git --version

Script Debugging#

For troubleshooting script issues:

# Enable verbose output
$VerbosePreference = "Continue"

# Check execution policy
Get-ExecutionPolicy

# Set execution policy if needed
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Migration from Legacy Script#

The enhanced script replaces run-dev.ps1 with:

Improvements#

  • Hierarchical organization - Logical grouping of related tasks
  • Enhanced user interface - Color coding, emojis, and status display
  • Better error handling - Graceful error recovery and helpful messages
  • Additional functionality - New tools and utilities
  • Improved navigation - Multi-level menu with back navigation

Compatibility#

  • All original functionality - Complete feature parity with legacy script
  • Same commands - Identical underlying Docker and .NET commands
  • Environment compatibility - Uses same .env and Docker configuration
  • No breaking changes - Can be used alongside existing workflows

The legacy script remains available for users who prefer the original interface, but the enhanced version is recommended for new development workflows.