Skip to content

Latest commit

 

History

History
174 lines (142 loc) · 6.39 KB

File metadata and controls

174 lines (142 loc) · 6.39 KB

Amber CLI Documentation System

Overview

We have successfully implemented a comprehensive, automated documentation system for the Amber CLI that leverages Crystal's built-in crystal docs command and GitHub Pages for hosting.

🎯 Key Features

Automated Documentation Generation

  • Uses Crystal's native crystal docs command
  • Zero external dependencies for documentation
  • Automatically extracts API documentation from code comments
  • Generates beautiful, searchable HTML documentation

Comprehensive Content

  • API Reference - Automatically generated from code
  • User Guides - Comprehensive guides in src/amber_cli/documentation.cr
  • Command Reference - Detailed command usage and examples
  • Configuration Reference - All configuration options
  • Troubleshooting - Common issues and solutions

GitHub Pages Integration

📁 Structure

amber_cli/
├── src/amber_cli/documentation.cr     # Comprehensive documentation module
├── docs/                              # Generated documentation (ignored in git)
│   ├── README.md                      # Documentation guide
│   └── .gitkeep                       # Ensures directory exists
├── scripts/generate_docs.sh           # Local documentation generation
├── .github/workflows/docs.yml         # GitHub Actions workflow
└── README.md                          # Updated with links to docs

🚀 How It Works

Local Development

# Generate documentation locally
./scripts/generate_docs.sh

# Manual generation
crystal docs --project-name="Amber CLI" --output=docs

Automatic Deployment

  1. Trigger: Push to main branch
  2. Generate: Crystal docs with full configuration
  3. Deploy: Upload to GitHub Pages
  4. Live: Available within minutes

Documentation Sources

  1. Code Comments - Crystal docstrings throughout codebase
  2. Documentation Module - Comprehensive guides and examples
  3. README - Quick start and overview
  4. Command Help - Integrated help system

📝 Content Organization

Main Documentation Classes

  • Overview - Introduction and quick start
  • NewCommand - Creating new applications
  • DatabaseCommand - Database management
  • GenerationSystem - Code generation
  • DevelopmentTools - Watch mode and exec
  • ApplicationAnalysis - Routes and pipelines
  • SecurityAndConfiguration - Encryption and config
  • PluginSystem - Plugin management
  • CommandReference - Complete command reference
  • ConfigurationReference - All configuration options
  • Troubleshooting - Common issues and solutions

Crystal Documentation Features Used

  • Markdown Support - Rich formatting in docstrings
  • Code Examples - Syntax-highlighted code blocks
  • Cross-references - Automatic linking between classes/methods
  • Admonitions - NOTE, WARNING, TODO, etc.
  • Parameter Documentation - Italicized parameter names
  • Inheritance - Automatic documentation inheritance

🔧 Configuration

GitHub Actions Workflow

# .github/workflows/docs.yml
- Installs Crystal
- Generates documentation with full options
- Configures GitHub Pages
- Deploys automatically

Documentation Generation Options

crystal docs \
  --project-name="Amber CLI" \
  --project-version="${VERSION}" \
  --source-url-pattern="github_pattern" \
  --output=docs \
  --format=html \
  --sitemap-base-url="base_url" \
  --canonical-base-url="canonical_url"

🎨 Benefits Achieved

For Users

  • Easy Discovery - Links in README to comprehensive docs
  • Quick Start - Clear examples and getting started guide
  • Complete Reference - Every command and option documented
  • Searchable - Full-text search in documentation
  • Always Current - Automatically updated with code changes

For Developers

  • Low Maintenance - Documentation in code comments
  • Automatic Updates - No manual deployment needed
  • Crystal Native - Uses Crystal's built-in documentation system
  • Version Tracking - Documentation versioned with code
  • Easy Contributing - Clear documentation standards

For the Project

  • Professional Appearance - Beautiful, searchable docs
  • SEO Benefits - Proper meta tags and sitemaps
  • Accessibility - Crystal docs generate accessible HTML
  • Mobile Friendly - Responsive documentation layout
  • Fast Loading - Static site generation

📋 Maintenance

Adding Documentation

  1. Code Comments - Add Crystal docstrings to classes/methods
  2. Documentation Module - Update src/amber_cli/documentation.cr
  3. Examples - Include usage examples in comments
  4. Test Locally - Run ./scripts/generate_docs.sh

Documentation Standards

  • Use Crystal's documentation format
  • Include examples for complex features
  • Link to related functionality
  • Keep language clear and concise
  • Test documentation generation before PR

Automatic Updates

  • Documentation rebuilds on every push to main
  • Links to source code automatically updated
  • Version information tracked from git
  • Search index automatically regenerated

🔗 Links

✅ Success Metrics

  • Zero External Dependencies - Uses only Crystal stdlib
  • Automatic Generation - No manual intervention needed
  • Comprehensive Coverage - All features documented
  • GitHub Pages Integration - Seamless hosting
  • Local Development - Easy local generation
  • Search Functionality - Full-text search available
  • Mobile Responsive - Works on all devices
  • SEO Optimized - Proper meta tags and structure
  • Version Tracking - Documentation follows code versions
  • Professional Quality - Production-ready documentation

This documentation system provides a solid foundation for maintaining comprehensive, up-to-date documentation for the Amber CLI project while minimizing maintenance overhead and maximizing discoverability.