All pages
Powered by GitBook
1 of 4

Documentation Commands

wheels docs

Base command for documentation generation and management.

Note: This command is currently broken. Use subcommands directly.

Synopsis

wheels docs [subcommand] [options]

Description

The wheels docs command provides documentation tools for Wheels applications. It generates API documentation, manages inline documentation, and serves documentation locally. While the base command is currently broken, the subcommands generate and serve work correctly.

Subcommands

Command
Description
Status

generate

Generate documentation

✓ Working

serve

Serve documentation locally

✓ Working

Options

Option
Description

--help

Show help information

--version

Show version information

Current Status

The base wheels docs command is temporarily unavailable due to a known issue. Please use the subcommands directly:

  • wheels docs generate - Generate documentation

  • wheels docs serve - Serve documentation

Expected Behavior (When Fixed)

When operational, running wheels docs without subcommands would:

  1. Check for existing documentation

  2. Generate if missing or outdated

  3. Provide quick access links

  4. Show documentation statistics

Expected output:

Wheels Documentation Status
==========================

Generated: 2024-01-15 10:30:45
Files: 156 documented (89%)
Coverage: 1,234 of 1,456 functions

Recent Changes:
- UserModel.cfc: 5 new methods
- OrderController.cfc: Updated examples
- config/routes.cfm: New route docs

Quick Actions:
- View docs: http://localhost:4000
- Regenerate: wheels docs generate
- Check coverage: wheels docs coverage

Workaround

Until the base command is fixed, use this workflow:

# Generate documentation
wheels docs generate

# Serve documentation
wheels docs serve

# Or combine in one line
wheels docs generate && wheels docs serve

Documentation System

Supported Formats

  • JavaDoc-style comments

  • Markdown files

  • Inline documentation

  • README files

Documentation Sources

/app/
├── models/          # Model documentation
├── controllers/     # Controller documentation
├── views/          # View helpers documentation
├── config/         # Configuration docs
├── docs/           # Additional documentation
└── README.md       # Project overview

Configuration

Configure in .wheels-docs.json:

{
  "docs": {
    "output": "./documentation",
    "format": "html",
    "theme": "wheels-default",
    "include": [
      "app/**/*.cfc",
      "app/**/*.cfm",
      "docs/**/*.md"
    ],
    "exclude": [
      "vendor/**",
      "tests/**"
    ],
    "options": {
      "private": false,
      "inherited": true,
      "examples": true
    }
  }
}

Documentation Comments

Component Documentation

/**
 * User model for authentication and profile management
 * 
 * @author John Doe
 * @since 1.0.0
 */
component extends="Model" {
    
    /**
     * Authenticate user with credentials
     * 
     * @username The user's username or email
     * @password The user's password
     * @return User object if authenticated, false otherwise
     * 
     * @example
     * user = model("User").authenticate("john@example.com", "secret");
     * if (isObject(user)) {
     *     // Login successful
     * }
     */
    public any function authenticate(required string username, required string password) {
        // Implementation
    }
}

Inline Documentation

<!--- 
    @doc
    This view displays the user profile page
    
    @requires User object in 'user' variable
    @layout layouts/main
--->

Integration

Auto-generation

Set up automatic documentation generation:

// package.json
{
  "scripts": {
    "docs:build": "wheels docs generate",
    "docs:watch": "wheels docs generate --watch",
    "docs:serve": "wheels docs serve"
  }
}

CI/CD

- name: Generate documentation
  run: |
    wheels docs generate
    wheels docs coverage --min=80

When to Use Subcommands

Generate Documentation

Use when:

  • Adding new components

  • Updating documentation comments

  • Before releases

  • Setting up documentation site

wheels docs generate

Serve Documentation

Use when:

  • Reviewing documentation

  • Local development

  • Team documentation access

  • API exploration

wheels docs serve

Troubleshooting

Base Command Not Working

Error: "wheels docs command is broken"

Solution: Use subcommands directly:

wheels docs generate
wheels docs serve

Missing Documentation

If documentation is not generated:

  1. Check file patterns in config

  2. Verify comment format

  3. Look for syntax errors

  4. Check exclude patterns

Future Plans

The base command will be restored to provide:

  • Documentation dashboard

  • Coverage reports

  • Quick statistics

  • Change detection

  • Auto-serve option

Notes

  • Subcommands work independently

  • Documentation is generated incrementally

  • Large projects may take time to document

  • Keep documentation comments updated

See Also

  • wheels docs generate - Generate documentation

  • wheels docs serve - Serve documentation

  • Documentation Best Practices

  • API Documentation Guide

wheels docs generate

Generates documentation for your CFWheels application from code comments and annotations.

Usage

wheels docs generate [--output=<dir>] [--format=<format>] [--template=<template>] [--include=<components>] [--serve] [--verbose]

Parameters

  • --output - (Optional) Output directory for docs. Default: docs/api

  • --format - (Optional) Documentation format: html, json, markdown. Default: html

  • --template - (Optional) Documentation template to use: default, bootstrap, minimal. Default: default

  • --include - (Optional) Components to include: models, controllers, views, services. Default: models,controllers

  • --serve - (Optional) Start local server after generation

  • --verbose - (Optional) Verbose output

Description

The docs generate command automatically creates comprehensive documentation from your CFWheels application by parsing:

  • JavaDoc-style comments in CFCs

  • Model relationships and validations

  • Controller actions and routes

  • Configuration files

  • Database schema

  • API endpoints

Examples

Generate complete documentation

wheels docs generate

Generate markdown docs

wheels docs generate --format=markdown

Generate with Bootstrap template

wheels docs generate --template=bootstrap

Generate and serve immediately

wheels docs generate --serve

Generate specific components with verbose output

wheels docs generate --include=models,controllers,services --verbose

Custom output directory

wheels docs generate --output=public/api-docs --format=html

Documentation Sources

Model Documentation

/**
 * User model for authentication and authorization
 * 
 * @author John Doe
 * @since 1.0.0
 */
component extends="Model" {
    
    /**
     * Initialize user relationships and validations
     * @hint Sets up the user model configuration
     */
    function config() {
        // Relationships
        hasMany("orders");
        belongsTo("role");
        
        // Validations
        validatesPresenceOf("email,firstName,lastName");
        validatesUniquenessOf("email");
    }
    
    /**
     * Find active users with recent activity
     * 
     * @param days Number of days to look back
     * @return query Active users
     */
    public query function findActive(numeric days=30) {
        return findAll(
            where="lastLoginAt >= :date",
            params={date: dateAdd("d", -arguments.days, now())}
        );
    }
}

Controller Documentation

/**
 * Handles user management operations
 * 
 * @displayname User Controller
 * @namespace /users
 */
component extends="Controller" {
    
    /**
     * Display paginated list of users
     * 
     * @hint GET /users
     * @access public
     * @return void
     */
    function index() {
        param name="params.page" default="1";
        users = model("user").findAll(
            page=params.page,
            perPage=20,
            order="createdAt DESC"
        );
    }
}

Generated Output

HTML Format

/docs/generated/
├── index.html
├── assets/
│   ├── css/
│   └── js/
├── models/
│   ├── index.html
│   └── user.html
├── controllers/
│   ├── index.html
│   └── users.html
├── api/
│   └── endpoints.html
└── database/
    └── schema.html

Documentation includes:

  • Overview: Application structure and architecture

  • Models: Properties, methods, relationships, validations

  • Controllers: Actions, filters, routes

  • API Reference: Endpoints, parameters, responses

  • Database Schema: Tables, columns, indexes

  • Configuration: Settings and environment variables

Output Example

Generating documentation...
========================

Scanning source files... ✓
✓ Found 15 models
✓ Found 12 controllers  
✓ Found 45 routes
✓ Found 8 API endpoints

Processing documentation...
✓ Extracting comments
✓ Building relationships
✓ Generating diagrams
✓ Creating index

Writing documentation...
✓ HTML files generated
✓ Assets copied
✓ Search index created

Documentation generated successfully!
- Output: /docs/generated/
- Files: 82
- Size: 2.4 MB

View documentation:
- Local: file:///path/to/docs/generated/index.html
- Serve: wheels docs serve

Documentation Features

Auto-generated Content

  • Class hierarchies and inheritance

  • Method signatures and parameters

  • Property types and defaults

  • Relationship diagrams

  • Route mappings

  • Database ERD

Search Functionality

// Built-in search in HTML docs
{
  "searchable": true,
  "index": "lunr",
  "fields": ["title", "content", "tags"]
}

Custom Themes

Configure in /config/docs-theme.json:

{
  "theme": "custom",
  "colors": {
    "primary": "#007bff",
    "secondary": "#6c757d"
  },
  "logo": "/assets/logo.png",
  "favicon": "/assets/favicon.ico",
  "customCSS": "/assets/custom.css"
}

Integration

CI/CD Documentation

# Generate docs on every commit
- name: Generate Docs
  run: |
    wheels docs generate --format=html
    wheels docs generate --format=markdown --output=wiki/

Git Hooks

#!/bin/bash
# pre-commit hook
wheels docs generate --include=api --format=json
git add docs/api/openapi.json

Notes

  • Documentation is generated from code comments

  • Use consistent JavaDoc format for best results

  • Private methods are excluded by default

  • Images and diagrams are auto-generated

  • Supports custom templates and themes

wheels docs serve

Serves generated documentation locally for development and review.

Usage

wheels docs serve [--root=<dir>] [--port=<port>] [--open] [--watch]

Parameters

  • --root - (Optional) Root directory to serve. Default: docs/api

  • --port - (Optional) Port to serve on. Default: 35729

  • --open - (Optional) Open browser automatically. Default: true

  • --watch - (Optional) Watch for changes and regenerate. Default: false

Description

The docs serve command starts a local web server to preview your generated documentation. It includes:

  • Live reload on documentation changes

  • Search functionality

  • Responsive design preview

  • Print-friendly styling

  • Offline access support

Examples

Basic documentation server

wheels docs serve

Serve on different port

wheels docs serve --port=8080

Serve from custom directory

wheels docs serve --root=public/api-docs

Serve with file watching

wheels docs serve --watch

Serve without opening browser

wheels docs serve --open=false

Custom configuration

wheels docs serve --root=docs/generated --port=3000 --watch

Server Output

🌐 Starting documentation server...

Server started successfully!
- URL: http://localhost:35729
- Root: /docs/api
- Auto-open: enabled

Press Ctrl+C to stop the server

If documentation is not found:

Documentation directory not found: /docs/api

💡 Tip: Run 'wheels docs generate' first to create documentation

Features

File Watching

When --watch is enabled, the server monitors documentation files for changes and can trigger regeneration.

Browser Integration

With --open=true (default), the server automatically opens your default browser to the documentation URL.

Development Workflow

Typical usage:

# Step 1: Generate documentation
wheels docs generate

# Step 2: Serve documentation
wheels docs serve

# Step 3: Make changes and regenerate
wheels docs generate
# Browser will show updated docs

Custom workflow:

# Generate and serve from custom location
wheels docs generate --output=public/docs
wheels docs serve --root=public/docs --port=8080

Troubleshooting

Port already in use

# Use a different port
wheels docs serve --port=8081

Documentation not found

# Make sure to generate docs first
wheels docs generate
wheels docs serve

Browser doesn't open

# Manually navigate to the URL shown
# Or check your default browser settings

Notes

  • Server is intended for development/review only

  • For production, deploy static files to web server

  • Large documentation sets may take time to generate

  • Browser must support JavaScript for search

  • Offline mode caches documentation locally