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.
- Uses Crystal's native
crystal docscommand - Zero external dependencies for documentation
- Automatically extracts API documentation from code comments
- Generates beautiful, searchable HTML documentation
- 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
- Automatic deployment via GitHub Actions
- Documentation updates on every push to main
- Hosted at: https://amberframework.github.io/amber_cli/
- SEO-optimized with sitemaps and canonical URLs
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
# Generate documentation locally
./scripts/generate_docs.sh
# Manual generation
crystal docs --project-name="Amber CLI" --output=docs- Trigger: Push to
mainbranch - Generate: Crystal docs with full configuration
- Deploy: Upload to GitHub Pages
- Live: Available within minutes
- Code Comments - Crystal docstrings throughout codebase
- Documentation Module - Comprehensive guides and examples
- README - Quick start and overview
- Command Help - Integrated help system
Overview- Introduction and quick startNewCommand- Creating new applicationsDatabaseCommand- Database managementGenerationSystem- Code generationDevelopmentTools- Watch mode and execApplicationAnalysis- Routes and pipelinesSecurityAndConfiguration- Encryption and configPluginSystem- Plugin managementCommandReference- Complete command referenceConfigurationReference- All configuration optionsTroubleshooting- Common issues and solutions
- 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
# .github/workflows/docs.yml
- Installs Crystal
- Generates documentation with full options
- Configures GitHub Pages
- Deploys automaticallycrystal 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"- 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
- 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
- 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
- Code Comments - Add Crystal docstrings to classes/methods
- Documentation Module - Update
src/amber_cli/documentation.cr - Examples - Include usage examples in comments
- Test Locally - Run
./scripts/generate_docs.sh
- Use Crystal's documentation format
- Include examples for complex features
- Link to related functionality
- Keep language clear and concise
- Test documentation generation before PR
- Documentation rebuilds on every push to main
- Links to source code automatically updated
- Version information tracked from git
- Search index automatically regenerated
- Live Documentation: https://amberframework.github.io/amber_cli/
- Crystal Docs Reference: https://crystal-lang.org/reference/1.16/syntax_and_semantics/documenting_code.html
- GitHub Repository: https://github.com/amberframework/amber_cli
- Local Generation Script:
./scripts/generate_docs.sh
- ✅ 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.