A comprehensive modular bootstrap system that generates complete AI-powered terminal applications built with .NET 9. Features a clean, maintainable architecture with numbered modules for easy development and extension.
Latest Updates:
- β Centralized binary search paths using new utility functions
- β Reduced code duplication in shell scripts
- β Updated to .NET 9 for compatibility with Freelance-AI project
- β Fixed modular system warnings - no more "modules directory not found" messages
- β Added comprehensive test suite with 17 automated tests
- β Full integration testing for generated projects
# Create project in current directory
./wurp-terminal-bootstrap.sh
# Create project in specific location
./wurp-terminal-bootstrap.sh -p ~/workspace -n my-terminal
# Debug mode to see module loading
./wurp-terminal-bootstrap.sh --debug -p ~/test -n debug-project
# Show help
./wurp-terminal-bootstrap.sh -h| Option | Description | Example |
|---|---|---|
-p, --path |
Base directory for project | -p ~/Projects |
-n, --name |
Project folder name | -n my-terminal |
-d, --debug |
Enable debug mode (shows module loading) | --debug |
-h, --help |
Show help message | -h |
This bootstrap uses a numbered module system for clean, maintainable code:
lib/
βββ wurp-terminal-bootstrap-functions.sh # Smart coordinator with fallbacks
βββ modules/
βββ 00-core.sh # Core utilities (config, colors, validation)
βββ 10-project.sh # Project structure creation
βββ 20-files.sh # File generation (C#, configs, docs)
00-core.sh(270 lines) - Pure utilities, no dependencies, binary search functions10-project.sh(100 lines) - Directory structure only20-files.sh(400 lines) - All C# and config file generation- Smart loading - Modules load in order with graceful fallbacks
- Debug mode - See exactly what's loading with
--debug - Centralized utilities - Common binary search paths prevent duplication
The bootstrap script generates a complete project structure:
your-project/
βββ Program.cs # Main terminal application entry point
βββ WurpTerminal.csproj # .NET 9 project file
βββ wurp-config.json # Centralised configuration
βββ Core/ # Modular C# architecture
β βββ WurpTerminalService.cs # Main terminal service
β βββ AIIntegration.cs # AI command handling
β βββ ThemeManager.cs # Theme management
βββ scripts/
β βββ wurp-terminal # Main launcher script
β βββ lib/
β βββ wurp-terminal-functions.sh # Generated function library
βββ .gitignore # Git ignore file
βββ .editorconfig # Editor configuration
βββ README.md # Project documentation
The created terminal includes:
- π€ Enhanced AI Integration - Full FreelanceAI API integration with smart routing
- π Real-time Metrics - Provider selection, cost tracking, and performance monitoring
- π Command History - Persistent command history with search
- π¨ Multiple Themes - Default, dark, and wurp themes with colors
- π Shell Integration - Works seamlessly with bash/zsh
- β‘ System Commands - Execute any system command with output
- π§ Built-in Commands - help, clear, history, themes, AI commands
- π» Cross-platform - Runs on Linux, macOS, Windows with .NET 8
- π Automatic Failover - Seamless switching between AI providers
- π° Cost Optimisation - Budget tracking and intelligent provider selection
Navigate to your project and use the generated build system:
cd your-project
# Check dependencies (dotnet, jq, curl)
./scripts/wurp-terminal check
# Build the application
./scripts/wurp-terminal build
# Build and publish optimised binary
./scripts/wurp-terminal publish
# Full installation (build, publish, create symlinks)
./scripts/wurp-terminal install
# Show installation status
./scripts/wurp-terminal status
# Run the terminal directly
./scripts/wurp-terminal run
# Or use the installed binary
wurp-terminalOnce installed, use these commands in your AI-powered terminal:
ai explain "docker ps" # Explain what a command does
ai suggest "deploy app" # Get command suggestions for tasks
ai debug "permission denied" # Get debugging help for errors
ai code "REST API controller" # Generate code with smart routing
ai review "my-code.cs" # Code review with AI assistance
ai optimise "slow query" # Performance optimisation suggestions
ai test "async methods" # Testing strategies and examples./scripts/wurp-terminal ai-status # Check FreelanceAI provider status and costs
./scripts/wurp-terminal check # Verify dependencies and AI servicestheme # Show current theme and available options
theme dark # Switch to dark theme
theme wurp # Switch to wurp theme (cyan prompt)
theme default # Switch to default themehelp # Show comprehensive help
history # Show recent command history
clear # Clear screen
exit / quit # Exit terminal gracefully# All system commands work normally
ls -la # File listing
git status # Git commands
npm install # Package managers
docker ps # Container management| Requirement | Purpose | Installation |
|---|---|---|
| .NET 9 SDK | Build and run C# application | |
| jq | JSON configuration processing | sudo apt install jq or brew install jq |
| curl | AI service health checks | sudo apt install curl or brew install curl |
| bash/zsh | Shell compatibility | Usually pre-installed |
# Modify C# file generation
nano lib/modules/20-files.sh
# Change project structure
nano lib/modules/10-project.sh
# Update core utilities (includes binary search functions)
nano lib/modules/00-core.sh
# Add new utility functions to core module
# - get_binary_search_paths() for .NET path management
# - find_binary() for locating compiled applications
# - check_binary_exists() for quick validation
# - get_binary_relative_path() for display purposes
# Test changes with debug mode
DEBUG=true ./wurp-terminal-bootstrap.sh -p ~/test -n dev-test# Ready for additional modules:
lib/modules/30-build.sh # Enhanced build operations
lib/modules/40-integration.sh # Shell and desktop integration
lib/modules/50-services.sh # AI service management
lib/modules/60-management.sh # Advanced project managementWe provide a complete test script that validates all aspects of generated projects:
# Test the current project
./test-wurp-terminal.sh
# Test a specific project
./test-wurp-terminal.sh /path/to/your-project
# Test the example project we just created
./test-wurp-terminal.sh ~/workspace/my-terminalThe test script performs comprehensive validation:
- Help Command - Validates script help system
- Dependency Check - Ensures all required tools are available
- Build Application - Tests .NET 9 compilation
- Publish Application - Validates optimized binary creation
- Status Check - Verifies installation status reporting
- Version Command - Tests terminal version display
- Terminal Help - Validates built-in help system
- AI Explain Command - Tests AI command explanation feature
- AI Suggest Command - Tests AI task suggestion feature
- AI Debug Command - Tests AI debugging assistance
- Theme List Command - Tests theme management listing
- Theme Change Command - Tests theme switching functionality
- Project Structure Validation - Ensures all required files and directories exist
- Configuration File Validation - Validates JSON configuration syntax
- Executable Permissions - Checks script execution permissions
- Published Binary Verification - Uses centralized search paths to confirm binary creation
- Symlink Verification - Tests global installation symlinks
π Wurp Terminal Clone - Test Suite
==================================
βΉοΈ Testing project: /home/user/workspace/my-terminal
π Running Wurp Terminal Tests...
π§ͺ Test 1: Help command
β
PASSED: Help command
π§ͺ Test 2: Dependency check
β
PASSED: Dependency check
...
π§ͺ Test 17: Symlink verification
β
PASSED: Symlink verification
βββββββββββββββββββββββββββββββββββββββ
π Test Results Summary
βββββββββββββββββββββββββββββββββββββββ
βΉοΈ Tests Run: 17
β
Tests Passed: 17
β
All tests passed successfully! π
β¨ Wurp Terminal Clone is working correctly!# See detailed module loading and execution
./wurp-terminal-bootstrap.sh --debug -p ~/debug -n test-project# Check generated project works
cd your-project
./scripts/wurp-terminal check # Verify dependencies
./scripts/wurp-terminal build # Test build process
./scripts/wurp-terminal status # Show installation status
# Run full test suite
/path/to/bootstrap/test-wurp-terminal.sh ./| Component | Purpose | Technology |
|---|---|---|
| Program.cs | Application entry point with async/await | |
| Core/*.cs | Modular service architecture | Clean Architecture pattern |
| wurp-config.json | Centralised configuration | JSON with jq processing |
| scripts/wurp-terminal | Build and deployment automation | Bash with error handling |
| Function library | Reusable build and utility functions | Modular bash functions |
# Simple project in current directory
./wurp-terminal-bootstrap.sh
# Custom location and name
./wurp-terminal-bootstrap.sh -p ~/workspace -n ai-terminal
cd ~/workspace/ai-terminal
./scripts/wurp-terminal install# Create development version with debug
./wurp-terminal-bootstrap.sh --debug -p ~/dev -n terminal-dev
cd ~/dev/terminal-dev
# Iterative development
./scripts/wurp-terminal build # Quick build for testing
./scripts/wurp-terminal publish # Optimised build
./scripts/wurp-terminal install # Full installation# Create production version
./wurp-terminal-bootstrap.sh -p /opt -n company-terminal
cd /opt/company-terminal
./scripts/wurp-terminal install
# Verify installation
./scripts/wurp-terminal status
company-terminal --help- Single responsibility - Each module has one clear purpose
- Easy debugging - Know exactly where to look for issues
- Clean extensions - Add features without touching existing code
- Fast iterations - Modify only what you need
- Debug mode - See exactly what's happening
- Module isolation - Test components independently
- Numbered modules - Clear dependency ordering
- Graceful fallbacks - Works with or without modules
- Future-ready - Easy to add new capabilities
Recent improvements focus on eliminating code duplication and improving maintainability:
get_binary_search_paths()- Standardized .NET binary location pathsfind_binary()- Unified binary location logiccheck_binary_exists()- Quick existence validationget_binary_relative_path()- Consistent path display
# BEFORE: Duplicated in 5+ functions across multiple files
local search_paths=(
"bin/Release/net9.0/linux-x64/publish/$binary_name"
"bin/Release/net9.0/publish/$binary_name"
"bin/Release/net9.0/linux-x64/$binary_name"
"bin/Release/net9.0/linux-x64/publish/$binary_name.dll"
"bin/Release/net9.0/publish/$binary_name.dll"
)
# AFTER: Centralized in core module, reused everywhere
local actual_binary
if actual_binary=$(find_binary); then
# Use the binary
fi- β¬οΈ 60% Code Reduction - Eliminated ~15 lines per function
- π― Consistency - All functions use identical search logic
- π§Ή Maintainability - Change paths in one place only
- π Reusability - Functions exported across modules
- π‘οΈ Error Handling - Improved error reporting
- β Compatibility - Maintained legacy and modular modes
- Core architecture β
- Centralized utility functions for common tasks β
- Reduced code duplication across scripts β
- File generation β
- Project structure β
- Basic build system β
- Enhanced build operations
- Shell/desktop integration
- Service management
- Advanced project management
Built with β€οΈ using .NET 9, C# 12, and Modular Bash Architecture
Transform your terminal experience with AI-powered assistance and modern development practices.