=============== LIBRARY RULES =============== From library maintainers: - Wheels uses MVC architecture with conventions over configuration - Controllers should extend the base Controller component - Models represent database tables and handle data persistence - Views use .cfm templates with embedded CFML code - Use the built-in ORM for database operations when possible - Routing follows RESTful conventions by default - Database migrations are handled through the built-in migration system - Use the CLI for generating components and running migrations - Follow the community coding standards for CFML - Documentation should be kept up-to-date with code changes - Tests should be written for all new features and bug fixes ### Wheels CLI: Basic MCP Setup Example Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/mcp/mcp-setup.md A basic example of the 'wheels mcp setup' command. This will automatically detect settings and configure all available IDEs that are installed and supported. ```bash # Auto-detect settings and configure available IDEs wheels mcp setup ``` -------------------------------- ### Install CommandBox CLI Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Installs the CommandBox command-line tool, a prerequisite for using the Wheels CLI. Supports macOS/Linux and Windows. ```bash # macOS/Linux curl -fsSl https://downloads.ortussolutions.com/debs/gpg | sudo apt-key add - echo "deb https://downloads.ortussolutions.com/debs/noarch /" | sudo tee -a /etc/apt/sources.list.d/commandbox.list sudo apt-get update && sudo apt-get install commandbox ``` ```powershell # Windows (PowerShell as Admin)iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) choco install commandbox ``` -------------------------------- ### Start BoxLang Mini-Server Full Configuration Example Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/introduction/readme/boxlang-support.md This command demonstrates a more comprehensive configuration for starting the BoxLang Mini-Server. It includes specifying the host and port, enabling rewrite functionality, and activating debug mode for enhanced logging and troubleshooting. ```bash java -jar /path/to/boxlang-miniserver-1.6.0.jar \ --webroot /path/to/your/app/public \ --host 127.0.0.1 \ --port 8080 \ --rewrite \ --debug ``` -------------------------------- ### Wheels CLI: IDE-Specific MCP Setup Examples Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/mcp/mcp-setup.md Examples demonstrating how to configure MCP integration for specific AI IDEs. This allows for targeted setup, ensuring compatibility with your chosen coding assistant. ```bash # Configure only Claude Code wheels mcp setup --ide=claude # Configure only Cursor wheels mcp setup --ide=cursor # Configure all detected IDEs wheels mcp setup --all ``` -------------------------------- ### Docker Compose Profile Examples Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/cli-guides/testing.md Examples of using Docker Compose profiles to launch specific combinations of services for the Wheels testing environment. This includes starting just the UI, quick test setups, all Lucee engines, all Adobe engines, and all databases. ```bash # Just the UI docker compose --profile ui up -d # Quick test setup (Lucee 5 + MySQL) docker compose --profile quick-test up -d # All Lucee engines docker compose --profile lucee up -d # All Adobe engines docker compose --profile adobe up -d # All databases docker compose --profile db up -d ``` -------------------------------- ### Wheels Development Workflow with BoxLang Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/introduction/readme/boxlang-support.md Illustrates the basic development workflow for a Wheels application using BoxLang and CommandBox. This includes generating an app, installing dependencies, and starting the development server. ```bash # Generate new Wheels app (if needed) wheels g app myapp --engine=boxlang # Navigate to app directory cd myapp # Install BoxLang dependencies box install # Start BoxLang development server server start cfengine=boxlang # Access your application at http://localhost:8080 ``` -------------------------------- ### Wheels CLI: Custom MCP Setup Configuration Examples Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/mcp/mcp-setup.md Advanced examples for customizing the MCP setup process. These include specifying a custom port, forcing an overwrite of existing configuration files, and preventing the automatic start of the server. ```bash # Use specific port wheels mcp setup --port=8080 # Force overwrite existing configs wheels mcp setup --force # Setup without auto-starting server wheels mcp setup --noAutoStart ``` -------------------------------- ### MCP Quick Start Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/mcp/README.md Quick start guide to set up, verify, and test MCP integration. ```APIDOC ## MCP Quick Start ### Description Follow these steps to quickly set up and verify your MCP integration. ### Steps 1. **Initial Setup**: Auto-configure MCP for detected AI IDEs. ```bash wheels mcp setup ``` 2. **Verify Installation**: Check the integration status. ```bash wheels mcp status ``` 3. **Test Connection**: Test MCP functionality. ```bash wheels mcp test ``` ``` -------------------------------- ### IDE Configuration Examples Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/mcp/mcp-setup.md Examples of how the MCP server endpoint is configured within different AI IDEs. ```APIDOC ## IDE Configuration Examples ### Description These examples show the configuration snippets for integrating the Wheels MCP server into popular AI IDEs. ### Method File Configuration ### Endpoint N/A (IDE-specific config files) ### Parameters N/A ### Request Example #### Claude Code Configuration (`~/.claude/config.json`) ```json { "mcpServers": { "wheels": { "transport": { "type": "http", "url": "http://localhost:[port]/wheels/mcp" } } } } ``` #### Cursor Configuration (`~/.cursor/config.json`) ```json { "mcpServers": { "wheels": { "transport": { "type": "http", "url": "http://localhost:[port]/wheels/mcp" } } } } ``` #### Continue Configuration (`~/.continue/config.json`) ```json { "mcpServers": { "wheels": { "transport": { "type": "http", "url": "http://localhost:[port]/wheels/mcp" } } } } ``` #### Windsurf Configuration (`~/.windsurf/config.json`) ```json { "mcpServers": { "wheels": { "transport": { "type": "http", "url": "http://localhost:[port]/wheels/mcp" } } } } ``` ### Response #### Success Response IDE configuration files are updated with the Wheels MCP server details. #### Response Example (Configuration files are updated, no direct response from an API call here) ``` -------------------------------- ### Start Wheels Development Server Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Starts the local development server for the Wheels application, accessible at http://localhost:3000. ```bash box server start ``` -------------------------------- ### Microsoft SQL Server Database Setup Example (Bash) Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/environment/env-setup.md Provides an example for setting up an enterprise environment with Microsoft SQL Server. This command specifies the environment name and the database type. ```bash wheels env setup environment=enterprise --dbtype=mssql ``` -------------------------------- ### Inno Setup Installer Script (Pascal) Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/working-with-wheels/contributing-to-wheels-windows-installer.md The main Inno Setup script file for the Wheels Windows GUI installer. It defines wizard pages and handles user interactions. ```pascal install-wheels.iss # Inno Setup GUI installer (Pascal) ``` -------------------------------- ### Install Wheels CLI Module Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/README.md This command installs the 'wheels-cli' module for CommandBox, which provides additional commands for the Wheels framework. This module is essential for managing Wheels applications. ```commandbox install wheels-cli ``` -------------------------------- ### Docker Compose Quick Start Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/cli-guides/testing.md Commands to quickly start the Wheels testing environment using Docker Compose. It includes starting the TestUI and all test containers, and accessing the TestUI via a web browser. ```bash # Start the TestUI and all test containers docker compose --profile all up -d # Access the TestUI open http://localhost:3000 ``` -------------------------------- ### MySQL Database Setup Example (Bash) Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/environment/env-setup.md Illustrates setting up a production environment with a MySQL database. This command specifies the environment name, database type, and the database name. ```bash wheels env setup environment=prod --dbtype=mysql --database=wheels_production ``` -------------------------------- ### Generate and Start a New Wheels App (CommandBox) Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/README.md This snippet demonstrates the basic commands to generate a new Wheels application named 'myApp' and then start the development server. It utilizes default settings for app creation and downloads the base template and framework core files from ForgeBox.io. ```bash wheels generate app myApp server start ``` -------------------------------- ### Verify CommandBox Installation Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/README.md This snippet shows how to verify the CommandBox installation by checking its version. It can be executed directly from the system terminal or within the CommandBox shell. ```shell box version ``` ```commandbox version ``` -------------------------------- ### Create and Configure Wheels Blog Application Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md This Bash script demonstrates the complete process of creating a new Wheels project named 'myblog', setting up an H2 database, generating scaffolds for posts, authors, and comments, defining model associations, adding routes, setting up the database with seeding, and finally starting the development server and watch mode. ```bash # Create application wheels new myblog --setupH2 cd myblog # Generate blog structure wheels scaffold post title:string,slug:string,content:text,publishedAt:datetime wheels scaffold author name:string,email:string,bio:text wheels generate model comment author:string,email:string,content:text,postId:integer \ --belongs-to=post # Update associations wheels generate property post authorId:integer --belongs-to=author wheels generate property post comments --has-many wheels generate property author posts --has-many # Add routes echo '' >> config/routes.cfm echo '' >> config/routes.cfm # Setup and seed database wheels db setup --seed-count=10 # Start development wheels server start wheels watch # Visit http://localhost:3000/posts ``` -------------------------------- ### Initialize Git Version Control Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Initializes a Git repository for the project and adds the application files to be committed. Includes a sample `.gitignore`. ```bash git init git add . git commit -m "Initial Wheels application" # Add to .gitignore: # /db/sql/ # /logs/ # /temp/ # .env ``` -------------------------------- ### H2 Database Setup Example (Bash) Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/environment/env-setup.md Demonstrates setting up an environment with an H2 embedded database. This is suitable for development and testing as it doesn't require a separate database server. ```bash wheels env setup environment=dev --dbtype=h2 --database=my_dev_db ``` -------------------------------- ### PostgreSQL Database Setup Example (Bash) Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/environment/env-setup.md Shows how to configure a staging environment using PostgreSQL. This command sets the environment, database type, and relies on default credentials or further configuration. ```bash wheels env setup environment=staging --dbtype=postgres ``` -------------------------------- ### Update Inno Setup AppVersion (Pascal) Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/working-with-wheels/contributing-to-wheels-windows-installer.md Demonstrates how to update the application version within the Inno Setup script's [Setup] section. ```pascal AppVersion=1.0 ``` -------------------------------- ### Verify Inno Setup Installation (PowerShell) Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/working-with-wheels/contributing-to-wheels-windows-installer.md Checks if Inno Setup is installed and accessible by trying to open its compiler with a help flag. ```powershell # Should open Inno Setup Compiler & "C:\Program Files (x86)\Inno Setup 6\Compil32.exe" /? ``` -------------------------------- ### Create New Wheels Application Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/README.md This command initiates the creation of a new Wheels application using the 'new' wizard. The wizard will guide the user through template selection, including an option for 'Bleeding Edge' for version 3.0. ```commandbox wheels new ``` -------------------------------- ### MCP Configuration Examples Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/mcp/README.md Examples of MCP configuration for specific IDEs and environment setups. ```APIDOC ## MCP Configuration Examples ### Description Provides configuration examples for integrating Wheels MCP with various AI IDEs and different deployment environments. ### Claude Code Configuration Example JSON for configuring Claude Code. ```json { "mcpServers": { "wheels": { "transport": { "type": "http", "url": "http://localhost:8080/wheels/mcp" } } } } ``` ### Environment-Specific Setup Configure MCP for different ports or IDEs. ```bash # Development environment setup on port 8080 wheels mcp setup --port=8080 # Testing environment setup for Cursor on port 8081 wheels mcp setup --port=8081 --ide=cursor ``` ``` -------------------------------- ### Start Server on Specific Port Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Starts the development server on a port other than the default (3000), useful if the default port is already in use. ```bash box server start port=3001 ``` -------------------------------- ### Setup Custom Environments with Different Bases and Options Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/environment/env-setup.md Demonstrates setting up custom environments with varied configurations. Examples include setting up a feature authentication environment, a performance testing environment with caching disabled, and a client demo environment based on staging. ```bash wheels env setup environment=feature-auth --base=development wheels env setup environment=performance-test --base=production --cache=false wheels env setup environment=client-demo --base=staging ``` -------------------------------- ### Basic CFML Test Structure with TestBox Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/cli-guides/testing.md Demonstrates the fundamental structure of a test file in a Wheels application using TestBox. It includes setup and teardown methods, and example assertions for validating model properties. ```CFML component extends="wheels.Testbox" { function run() { describe("User Model", function() { beforeEach(function() { // Setup before each test variables.user = model("User").new(); }); afterEach(function() { // Cleanup after each test }); it("validates email presence", function() { variables.user.email = ""; expect(variables.user.valid()).toBeFalse(); expect(variables.user.errors).toHaveKey("email"); }); it("validates email format", function() { variables.user.email = "invalid-email"; expect(variables.user.valid()).toBeFalse(); expect(variables.user.errors.email).toInclude("valid email"); }); }); } } ``` -------------------------------- ### Database Migration Commands Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Provides commands for creating database tables, adding columns, and creating indexes using the migration system. ```bash # Create tables wheels dbmigrate create table products # Add columns wheels dbmigrate create column products featured # Create indexes wheels dbmigrate create blank add_index_to_products ``` -------------------------------- ### Start BoxLang Server with CommandBox Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/introduction/readme/boxlang-support.md Starts the CommandBox server using the BoxLang CFML engine. You can specify a particular version of BoxLang if needed. ```bash box server start cfengine=boxlang # Or specify specific BoxLang version (optional) box server start cfengine=boxlang@1.6.0 ``` -------------------------------- ### Initial Setup Example (Bash) Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/environment/env-set.md Demonstrates using 'wheels env set' for initial project setup by creating a new .env file with basic application configuration variables. ```bash wheels env set APP_NAME=MyApp APP_ENV=development DEBUG=true ``` -------------------------------- ### Inspect Server Information Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Retrieves information about the running server, including details about data sources and their connections. ```bash # Check datasource status box server info # Show detailed server info box server show ``` -------------------------------- ### Start BoxLang Mini-Server Basic Command Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/introduction/readme/boxlang-support.md This command starts the BoxLang Mini-Server. It specifies the path to the executable JAR file and sets the webroot directory for your application's public files. The `--rewrite` flag is crucial for enabling URL rewriting, which is necessary for frameworks like Wheels. ```bash java -jar /path/to/boxlang-miniserver-1.6.0.jar \ --webroot /path/to/your/app/public \ --rewrite ``` -------------------------------- ### Generate New Wheels Application Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Creates a new Wheels application with a predefined directory structure, configuration files, and sample code. Includes an option to set up an H2 embedded database. ```bash # Generate new application wheels new blog cd blog ``` ```bash # Generate new application with H2 setup wheels new blog --setupH2 ``` -------------------------------- ### Environment-Specific MCP Setup Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/mcp/README.md Examples of setting up MCP with specific ports and IDEs for different environments, such as development and testing. ```bash # Development environment wheels mcp setup --port=8080 # Testing environment wheels mcp setup --port=8081 --ide=cursor ``` -------------------------------- ### Generate Authentication Scaffolding Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Generates models and controllers for basic user authentication, including user registration and session management. ```bash # Generate user model wheels scaffold name=user properties=email:string,password:string,admin:boolean # Generate session controller wheels generate controller sessions new,create,delete # Run migrations wheels dbmigrate latest ``` -------------------------------- ### Create Application Layout View Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Defines a global layout file for the application's views, typically containing the HTML structure and common elements. ```bash echo '...' > views/layout.cfm ``` -------------------------------- ### Legacy CFML Test Structure Example Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/working-with-wheels/testing-your-application.md This example demonstrates a legacy test structure written in CFML, showcasing package-level setup and teardown, individual test case setup and teardown, and assertion methods. ```cfscript component extends="app.tests.Test" { function packageSetup() { variables.testData = { user: { username: "testuser", email: "test@example.com" } }; } function setup() { variables.testUser = model("User").create(variables.testData.user); } function testUserCreation() { assert('StructKeyExists(variables, "testUser")'); assert('variables.testUser.persisted()'); assert('variables.testUser.username eq "testuser"'); } function testUserValidation() { invalidUser = model("User").new({username: "", email: "invalid"}); assert('NOT invalidUser.valid()'); assert('invalidUser.hasErrors()'); } function teardown() { if (StructKeyExists(variables, "testUser")) { variables.testUser.delete(); } } function packageTeardown() { // Cleanup package-level resources } } ``` -------------------------------- ### Tail Application Log File Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Monitors the `wheels.log` file in real-time to observe application activity and potential errors. ```bash tail -f logs/wheels.log ``` -------------------------------- ### Environment Variables Output Format Example Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/config/config-dump.md An example of the environment variables output format, compatible with `.env` files. This format lists configuration settings as key-value pairs, suitable for loading into application environments. ```bash ## Application Settings DATASOURCE=myapp CACHE_QUERIES=false ENVIRONMENT=development ``` -------------------------------- ### Start BoxLang Mini-Server for Wheels Template Structure Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/introduction/readme/boxlang-support.md This command is specifically tailored for starting the BoxLang Mini-Server when using the Wheels base template structure. It points the webroot to the appropriate directory within the template and configures the port, along with enabling URL rewriting. ```bash java -jar /path/to/boxlang-miniserver-1.6.0.jar \ --webroot /path/to/your/app/templates/base/src/public \ --rewrite \ --port 8080 ``` -------------------------------- ### Generate API Resource Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Creates API endpoints for a resource, generating controllers and routes suitable for serving data via an API. ```bash # Generate API resource wheels generate api-resource product --properties="name:string,price:decimal" ``` ```bash # Convert existing resource to API wheels generate controller api/posts --api ``` -------------------------------- ### Wheels CLI: Basic Configuration Dumping Examples Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/config/config-dump.md Provides fundamental examples of the 'wheels config dump' command. This includes viewing the current configuration, inspecting the configuration for a specific environment (e.g., 'testing'), and exporting the configuration to the console in JSON format. ```bash # View current configuration wheels config dump # View testing environment configuration wheels config dump testing # Export as JSON to console wheels config dump --format=json ``` -------------------------------- ### Install Additional Database Support Modules Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/introduction/readme/boxlang-support.md Provides commands to install BoxLang modules for additional database support, such as Microsoft SQL Server, PostgreSQL, and Oracle. ```bash # Microsoft SQL Server box install bx-mssql # PostGreSQL Server box install bx-postgresql # Oracle Server box install bx-oracle ``` -------------------------------- ### Generate Test Files Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Generates skeleton test files for models and controllers, encouraging the practice of writing automated tests. ```bash # After creating a model wheels generate test model post # After creating a controller wheels generate test controller posts ``` -------------------------------- ### Generate Specific Views Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Generates individual view files for specific actions or templates within a resource. ```bash # Generate specific views wheels generate view posts featured wheels generate view users profile ``` -------------------------------- ### Run Application Tests Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Executes the test suite for the Wheels application. Supports running all tests, in watch mode, or specific test files. ```bash # Run all tests wheels test run # Watch mode wheels test run --watch # Specific tests wheels test run tests/models/PostTest.cfc ``` -------------------------------- ### Install Specific BoxLang Modules Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/introduction/readme/boxlang-support.md Installs individual BoxLang modules using CommandBox. This is useful for adding specific functionalities or database support not included in the default dependencies. ```bash box install bx-compat-cfml box install bx-csrf box install bx-esapi box install bx-image box install bx-wddx box install bx-mysql ``` -------------------------------- ### Initial Project Setup with MCP Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/mcp/README.md Demonstrates the initial setup for a new Wheels project, including creating the application and configuring MCP integration. ```bash wheels g app myproject cd myproject wheels mcp setup ``` -------------------------------- ### Set Environment Configuration Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Reloads the application with specific environment settings (development, testing, production). ```bash # Development wheels reload development # Testing wheels reload testing # Production wheels reload production ``` -------------------------------- ### Gitignore Example for Environment Files Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/configuration.md Demonstrates how to configure the .gitignore file to prevent sensitive environment files (like .env and its variations) from being committed to version control. It includes exceptions for example and default configuration files. ```gitignore # Environment files .env .env.* !.env.example !.env.defaults ``` -------------------------------- ### Manage Database Migrations Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Provides commands to check the status of database migrations, execute specific migrations, or rollback previous migrations. ```bash # Check status wheels db status # Run specific migration wheels dbmigrate exec 20240120000000 # Rollback last migration wheels db rollback ``` -------------------------------- ### Unit Testing Commands - CFC Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/cli-guides/creating-commands.md Shows how to write unit tests for commands using the Testbox framework. It includes examples of testing a 'hello' command with different arguments and capturing its output. Dependencies include the 'wheels.Testbox' component and shell execution. ```cfc // tests/commands/HelloTest.cfc component extends="wheels.Testbox" { function run() { describe("Hello Command", function() { it("greets with default name", function() { var result = execute("wheels hello"); expect(result).toInclude("Hello, World!"); }); it("greets with custom name", function() { var result = execute("wheels hello John"); expect(result).toInclude("Hello, John!"); }); }); } private function execute(required string command) { // Capture output savecontent variable="local.output" { shell.run(arguments.command); } return local.output; } } ``` -------------------------------- ### Integrating Wheels Environment Check with Other Commands Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/get/get-environment.md Provides examples of chaining the 'wheels get environment' command with other common Wheels CLI operations like database migrations, running tests, and starting the server. ```bash # Check environment, then run migrations wheels get environment wheels db migrate ``` ```bash # Verify environment before running tests wheels get environment wheels test ``` ```bash # Check environment, then start server wheels get environment commandbox server start ``` -------------------------------- ### Configure Local Development Environment Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/configuration.md Provides a workflow for setting up a local development environment. This includes copying an example .env file, setting local database credentials, generating necessary secrets for keys, and validating the local environment configuration. ```bash # 1. Copy example file cp .env.example .env # 2. Set local values wheels env set DB_HOST=localhost DB_USER=root DB_PASSWORD= # 3. Generate secrets wheels secret --save-to-env=SECRET_KEY wheels secret --save-to-env=RELOAD_PASSWORD # 4. Validate wheels env validate ``` -------------------------------- ### Add Resource Routes Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Defines RESTful routes for a resource in the application's `config/routes.cfm` file, enabling CRUD operations. ```cfm resources("posts"); ``` -------------------------------- ### Reset Application Database Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Performs a complete reset of the application's database, dropping all tables and recreating them. Use with caution as it destroys all data. ```bash # Complete reset (destroys all data!) wheels db reset --force ``` -------------------------------- ### Wheels Docs Serve Server Output Examples Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/docs/docs-serve.md Shows example output from the 'wheels docs serve' command, including successful server startup messages and messages indicating that documentation was not found. ```text Output directory: D:\Command Box\wheels\templates\base\src\docs\api\ CommandBox:src> wheels docs serve √ | Starting Server | √ | Setting site [wheels-docs-BBAA12EF-7A83-4D03-BD6DBFE4AC17C1F9] Profile to [development] | √ | Loading CFConfig into server Status: starting Server is still starting... waiting... Server is up and running! Starting documentation server... Documentation server started! Serving: D:\Command Box\wheels\templates\base\src\docs\api\ URL: http://localhost:35729 Opening browser... Press Ctrl+C to stop the server ``` ```text Documentation directory not found: /docs/api 💡 Tip: Run 'wheels docs generate' first to create documentation ``` -------------------------------- ### MCP Server Endpoint Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/mcp/mcp-setup.md The MCP server endpoint provides access to API documentation, project context, code patterns, and guides within your Wheels application. ```APIDOC ## MCP Server Endpoint ### Description The native CFML MCP server runs within your Wheels application and exposes various resources and tools via a specific HTTP endpoint. ### Method HTTP ### Endpoint `http://localhost:[port]/wheels/mcp` ### Parameters None for the endpoint itself; client tools interact with it. ### Request Example ```bash # Example of accessing the endpoint directly curl http://localhost:8080/wheels/mcp ``` ### Response #### Success Response (200) Returns information about available resources and tools. The exact response structure depends on the client request. #### Response Example (This is a conceptual example of what a client might receive) ```json { "message": "Welcome to the Wheels MCP Server!", "available_resources": [ "API Documentation", "Project Context", "Code Patterns", "Guides" ], "available_tools": [ "Code Generation", "Database Operations", "Server Management", "Testing" ] } ``` ``` -------------------------------- ### Add Relationship to Models Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Generates a new model and defines relationships (e.g., `belongs-to`, `has-many`) between models, updating relevant files and generating migrations. ```bash # Generate comment model with belongs-to relationship wheels generate model comment --properties="author:string,content:text,postId:integer" \ --belongs-to="post" # Update post model with has-many relationship wheels generate property post comments --has-many # Generate comments controller wheels generate controller comments --rest # Run migration wheels dbmigrate latest ``` -------------------------------- ### Local Testing with CommandBox Server Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/working-with-wheels/using-the-test-environment.md Demonstrates how to start a local CommandBox server and run tests against the locally installed CFML engine. This is useful for quick, local verification without Docker. ```bash # Start a server box server start # Run all tests box wheels test app # Run tests with specific parameters box wheels test app --testBundles=controllers ``` -------------------------------- ### Environment-Specific Settings Pattern (ColdFusion) Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/configuration.md Shows an example of environment-specific configuration settings for production environments in Wheels using ColdFusion, focusing on optimizations and security. ```cfscript // config/production/settings.cfm // Production optimizations set(cacheQueries = true); set(cachePartials = true); set(cachePages = true); set(cacheActions = true); set(cacheImages = true); set(cacheModelConfig = true); set(cacheControllerConfig = true); set(cacheRoutes = true); set(cacheDatabaseSchema = true); set(cacheFileChecking = false); // Security set(showDebugInformation = false); set(showErrorInformation = false); // Error handling set(sendEmailOnError = true); set(errorEmailAddress = application.env['ERROR_EMAIL']); ``` -------------------------------- ### Access Database Shell Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Opens an interactive shell to directly query and manage the application's database. Supports a web console for H2 databases. ```bash # CLI shell wheels db shell # Web console (H2 only) wheels db shell --web ``` -------------------------------- ### Prepare Deployment Configuration Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/configuration.md Details the steps for preparing a deployment configuration by merging default and production environment files, validating the merged file for required variables, and performing a security check on the production setup. This ensures a secure and correctly configured deployment. ```bash # 1. Merge configs for deployment wheels env merge .env.defaults .env.production --output=.env.deploy # 2. Validate merged config wheels env validate --file=.env.deploy \ --required=DB_HOST,DB_USER,DB_PASSWORD,SECRET_KEY # 3. Check security wheels config check production --verbose ``` -------------------------------- ### Generate Scaffolded Feature Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Generates a complete feature scaffold including model, controller, views, database migration, and tests. Properties can be defined with their data types. ```bash wheels generate scaffold name=post properties=title:string,content:text,published:boolean ``` -------------------------------- ### Enable Debug Mode in Application Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Enables detailed debugging information to be displayed in the application by setting a configuration variable. ```cfm ``` -------------------------------- ### Configure Application Database Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Sets the data source name for the application's database connection in the `config/settings.cfm` file. ```cfm ``` -------------------------------- ### HTTP GET Request Example Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/handling-requests-with-controllers/routing.md An example of an HTTP GET request to the `/news/show/5` URL, which would typically be handled by a `show` action in a `news` controller, passing `5` as a `key` parameter. ```http GET /news/show/5 ``` -------------------------------- ### Post-Generation Steps for Wheels App Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/generate/app.md Essential commands to run after generating a Wheels application: navigate to the directory, install dependencies, and start the server. ```bash cd myapp ``` ```bash box install ``` ```bash box server start ``` -------------------------------- ### PowerShell Installation Engine (PowerShell) Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/working-with-wheels/contributing-to-wheels-windows-installer.md The PowerShell script responsible for the core installation logic, including downloads and CommandBox setup. ```powershell install-wheels.ps1 # PowerShell installation engine ``` -------------------------------- ### Environment-Specific Settings Examples Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/get/get-settings.md Examples of environment-specific settings for production and development. ```coldfusion // config/production/settings.cfm set(cacheQueries=true); set(cachePages=true); set(cachePartials=true); set(showDebugInformation=false); set(showErrorInformation=false); set(sendEmailOnError=true); ``` ```coldfusion // config/development/settings.cfm set(cacheQueries=false); set(showDebugInformation=true); set(showErrorInformation=true); set(sendEmailOnError=false); ``` -------------------------------- ### MySQL Database Environment Variables (Shell) Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/environment/env-setup.md An example of the generated `.env.production` file for a MySQL database. It shows typical production settings, including database host, port, user, and password. ```shell ## Wheels Environment: production ## Generated on: 2025-01-18 12:30:00 ## Application Settings WHEELS_ENV=production WHEELS_RELOAD_PASSWORD=wheelsproduction ## Database Settings DB_TYPE=mysql DB_HOST=localhost DB_PORT=3306 DB_DATABASE=wheels_production DB_USER=wheels DB_PASSWORD=wheels_password DB_DATASOURCE=wheels_production ## Server Settings SERVER_PORT=8080 SERVER_CFENGINE=lucee5 ``` -------------------------------- ### Post-Creation Steps (Bash) Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/generate/app-wizard.md Lists the essential commands and steps to take after a Wheels application has been successfully generated, including navigating to the app directory, reviewing configurations, and starting the development server. ```bash Model generation complete! Next steps: 1. cd MyWheelsApp 2. Review generated configuration files 3. Configure your datasource in CFML server admin 4. box server start (to start development server) 5. Visit http://localhost:8080 Additional commands: - wheels generate model User name:string,email:string - wheels generate controller Users - wheels dbmigrate up (run database migrations) - wheels test run (run tests) ``` -------------------------------- ### Basic Environment Setup - Bash Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/environment/env-setup.md Demonstrates the basic usage of the 'wheels env setup' command to create new environments with different database types. It shows how to specify the environment name and optionally the database type, with interactive prompts for credentials when not provided. ```bash # Create development environment with H2 database (default) wheels env setup environment=development # Create staging environment with MySQL (will prompt for credentials) wheels env setup environment=staging --dbtype=mysql # Create production environment with PostgreSQL and caching enabled wheels env setup environment=production --dbtype=postgres --cache=true --debug=false # Create environment with explicit credentials (no prompting) wheels env setup environment=test --dbtype=mssql --host=localhost --port=1433 --username=sa --password=MyPassword123! ``` -------------------------------- ### Interactive Debugging Commands Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/cli-guides/testing.md Provides command-line examples for debugging tests using the 'wheels' CLI. This includes running specific tests in debug mode, enabling verbose output, and displaying SQL queries. ```bash # Run specific test with debugging wheels test debug tests/unit/models/UserTest.cfc # Enable verbose mode wheels test run --verbose # Show SQL queries wheels test run --showSQL ``` -------------------------------- ### Production Configuration Settings (CFML) Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/environment/env-setup.md An example of the generated `config/production/settings.cfm` file. This ColdFusion Markup Language (CFML) script configures various application settings, including database connection, debugging, caching, and security parameters. ```cfml // Environment: production // Generated: 2025-01-18 12:30:00 // Debug Mode: Disabled // Cache Mode: Enabled // Database settings set(dataSourceName="wheels_production"); // Environment settings set(environment="production"); // Debug settings - controlled by debug argument set(showDebugInformation=false); set(showErrorInformation=false); // Caching settings - controlled by cache argument set(cacheFileChecking=true); set(cacheImages=true); set(cacheModelInitialization=true); set(cacheControllerInitialization=true); set(cacheRoutes=true); set(cacheActions=true); set(cachePages=true); set(cachePartials=true); set(cacheQueries=true); // Security set(reloadPassword="wheelsproduction"); // URLs set(urlRewriting="partial"); // Environment-specific settings set(sendEmailOnError=true); set(errorEmailAddress="dev-team@example.com"); ``` -------------------------------- ### Wheels CLI: GET Route Generation Examples Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/generate/route.md This bash snippet provides examples of generating GET routes using the Wheels CLI. It covers routes with handlers, routes using convention without explicit handlers, and routes with dynamic URL segments. ```bash # GET route with handler wheels generate route --get="api/users,api##index" # POST route with handler wheels generate route --post="users/login,sessions##create" # PUT route with handler wheels generate route --put="profiles/[key],profiles##update" # Pattern-only routes (uses convention) wheels generate route --get="products/search" # Single parameter dynamic segment wheels generate route --get="users/[key],users##show" # Multiple parameters dynamic segments wheels generate route --get="posts/[year]/[month],posts##archive" ``` -------------------------------- ### Start a New Wheels Application Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/cli-overview.md Steps to create a new Wheels application, navigate into its directory, and start the development server using CommandBox. ```bash wheels new myapp cd myapp box server start ``` -------------------------------- ### Open Wheels Installer Application Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/working-with-wheels/contributing-to-wheels-macos-installer.md Launches the built Wheels installer application from the output directory. This allows for testing the GUI and the installation process. ```bash open installer/wheels-installer.app ``` -------------------------------- ### Using Base Environment for Setup - Bash Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/environment/env-setup.md Shows how to leverage existing environment configurations as a base for new setups. This allows copying settings from one environment to another while applying different database types or specific customizations. ```bash # Copy settings from development environment but use PostgreSQL wheels env setup environment=testing --base=development --dbtype=postgres # Create staging environment based on production settings wheels env setup environment=staging --base=production --database=staging_db # Create QA environment with custom settings wheels env setup environment=qa --base=development --dbtype=mysql --debug=true --cache=false ``` -------------------------------- ### Initialize and Push Deployment with Wheels CLI Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/deployment/README.md This snippet demonstrates the initial setup and pushing of an application deployment using the Wheels command-line interface. It includes commands for setting up the production environment, pushing the initial deployment with a version tag, and checking the deployment status. ```bash # Initialize deployment for your project wheels deploy setup --environment=production # Push initial deployment wheels deploy push --environment=production --tag=v1.0.0 # Check deployment status wheels deploy status --environment=production ``` -------------------------------- ### Enable File Watching for Auto-Reload Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/quick-start.md Starts a file watcher that automatically reloads the application when changes are detected in `.cfc` and `.cfm` files. ```bash wheels watch ``` -------------------------------- ### Install BoxLang Engine in CommandBox Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/introduction/readme/boxlang-support.md Installs the BoxLang engine within the CommandBox CLI. This is a prerequisite for running BoxLang applications with Wheels using CommandBox. ```bash box install boxlang ``` -------------------------------- ### Wheels CLI: Example - Switch with Backup Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/environment/env-switch.md Demonstrates creating a backup of the current environment configuration before switching to 'production' using the '--backup' option. ```bash wheels env switch production --backup ``` -------------------------------- ### HTTP Request Example Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/handling-requests-with-controllers/routing.md An example of an HTTP GET request to a specific product URL. This demonstrates the basic structure of a request that the Wheels router would process. ```http GET /products/5 ``` -------------------------------- ### Install BoxLang Dependencies from box.json Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/introduction/readme/boxlang-support.md Installs all dependencies listed in the `box.json` file using the CommandBox CLI. This command ensures all required BoxLang modules for Wheels are present. ```bash box install ``` -------------------------------- ### Example GET Route Generation (CFM) Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/generate/route.md Shows the CFM code generated for a specific GET route. This defines a custom URL pattern and maps it to a controller and action. ```cfm .get(pattern="products/sale", to="products##sale") ``` -------------------------------- ### Adhere to Single Responsibility Principle Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/cli-guides/service-architecture.md This section contrasts a 'good' example of a service adhering to the Single Responsibility Principle (SRP) with a 'bad' example. The good example, 'ValidationService', focuses solely on validation tasks, while the bad example, 'UtilityService', mixes unrelated responsibilities like validation, email sending, and PDF generation, violating SRP. ```cfc // Good: Focused service component name="ValidationService" { function validateModel() {} function validateController() {} } // Bad: Mixed responsibilities component name="UtilityService" { function validateModel() {} function sendEmail() {} function generatePDF() {} } ``` -------------------------------- ### Initialize Wheels Project After Vendor Setup Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/development-workflow.md Addresses the 'Cannot determine Wheels version' error by ensuring vendor dependencies are installed using 'box install' before running 'wheels init'. ```bash # Solution: Ensure /vendor/wheels exists box install wheels init ``` -------------------------------- ### List Available Environments Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/environment/env-setup.md Lists all currently configured environments. This is useful for verifying environment creation and identifying correct names for switching or setup. ```bash wheels env list ``` -------------------------------- ### List Wheels Plugins via CommandBox Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/plugins/installing-and-using-plugins.md This command lists all available Wheels plugins from ForgeBox. It requires the Wheels CLI to be installed. ```shell # List all Wheels plugins on forgebox $ wheels plugins list ``` -------------------------------- ### JSON Output Format Example Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/config/config-dump.md An example of the JSON output format for the `wheels config dump` command. This structured format is ideal for programmatic consumption, data storage, and machine-to-machine communication. ```json { "datasource": "myapp", "cacheQueries": false, "environment": "development", "_environment": { "WHEELS_ENV": "development" } } ``` -------------------------------- ### Create Basic Controller - /app/controllers/Say.cfc Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/introduction/readme/beginner-tutorial-hello-world.md This code defines a basic controller named 'Say.cfc' that extends the base 'Controller' component provided by the Wheels framework. It serves as a foundational step for creating applications within Wheels, inheriting essential functionalities. ```javascript component extends="Controller"{ } ``` -------------------------------- ### Example GET Route with Custom Parameters Generation (CFM) Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/generate/route.md Presents the CFM code for a GET route with multiple custom parameters. The generated code shows how these parameters are defined within the route. ```cfm .get(pattern="posts/[year]/[month]", to="posts##archive") ``` -------------------------------- ### Use Dependency Injection for Service Dependencies Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/cli-guides/service-architecture.md This example highlights the best practice of using dependency injection (DI) over direct instantiation for managing service dependencies. The 'good' example shows injecting 'fileService', while the 'bad' example demonstrates the anti-pattern of creating a new instance directly within the code. ```cfc // Good: Injected dependency property name="fileService" inject="FileService@wheels-cli"; // Bad: Direct instantiation variables.fileService = new FileService(); ``` -------------------------------- ### Basic Application Settings Configuration Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/get/get-settings.md An example of basic application settings defined in `config/settings.cfm`. ```coldfusion // config/settings.cfm set(dataSourceName="myapp"); set(URLRewriting="partial"); set(errorEmailAddress="admin@myapp.com"); ``` -------------------------------- ### Interactive Database Credential Prompting - Bash Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/environment/env-setup.md Illustrates the interactive process of setting up an environment when database credentials are not explicitly provided. The command prompts the user for necessary details like host, port, username, and password. ```bash # Running without credentials prompts interactively wheels env setup environment=production --dbtype=mssql # Output: # Setting up production environment... # # Database credentials not provided for mssql database # Would you like to enter database credentials now? [y/n] y # # Please provide database connection details: # # Database Host [localhost]: localhost # Database Port [1433]: 1433 # Database Username [sa]: sa # Database Password: ************ # # Database credentials captured successfully! ``` -------------------------------- ### Example GET Route with Pattern Only Generation (CFM) Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/generate/route.md Illustrates the CFM code for a GET route where only the pattern is specified. The generated code shows a route definition without an explicit handler, relying on convention. ```cfm .get(pattern="products/search") ``` -------------------------------- ### Example GET Route with Dynamic Segment Generation (CFM) Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/generate/route.md Displays the CFM code for a GET route that includes a dynamic segment. The generated code reflects how the dynamic segment is incorporated into the route definition. ```cfm .get(pattern="users/[key]/profile", to="users##profile") ``` -------------------------------- ### Start Form Tag with GET Method for Search Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/displaying-views-to-users/form-helpers-and-showing-errors.md Generates an HTML form tag for a search input, submitting the form via a GET request to the 'users' route. This is typical for filtering or searching resources. ```html #startFormTag(route="users", method="get")# #textFieldTag(type="search", name="q")# #submitTag("Search")# #endFormTag() ``` -------------------------------- ### Colfusion Settings Configuration Example Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/get/get-settings.md Illustrates how to define application settings within a ColdFusion file using the `set()` function. These settings are loaded by the Wheels framework and can be retrieved using the 'wheels get settings' command. ```coldfusion // config/settings.cfm set(dataSourceName="myapp_db"); set(cacheQueries=true); set(errorEmailAddress="admin@example.com"); ``` -------------------------------- ### Starting Docker Containers with Docker Compose Source: https://github.com/wheels-dev/wheels/blob/develop/docs/src/command-line-tools/commands/docker/docker-init.md Commands to manage Docker containers for the Wheels framework. Includes starting, building, viewing logs, stopping, and restarting services. Ensure Docker and Docker Compose are installed. ```bash # Start in detached mode docker-compose up -d # Start with build (after code changes in production) docker-compose up -d --build # View logs docker-compose logs -f # View specific service logs docker-compose logs -f app docker-compose logs -f nginx # Stop containers docker-compose down # Stop and remove volumes (WARNING: deletes database data) docker-compose down -v # Restart a specific service docker-compose restart app # Rebuild and restart docker-compose up -d --build --force-recreate ```