Documentation Automation¶
Purpose¶
Scripts and strategies for automating documentation generation, validation, and maintenance in AudioLab.
Contents¶
Scripts¶
generate_docs.ps1- Master script to generate all documentationvalidate_docs.ps1- Check documentation quality (links, spelling, formatting)
Guides¶
changelog_automation.md- Auto-generate changelogs from commitsapi_diff_generation.md- Detect and document API changes between versions
Quick Start¶
Generate All Documentation¶
Generate Specific Documentation¶
# API docs only (Doxygen)
.\generate_docs.ps1 -Target api
# User docs only (MkDocs)
.\generate_docs.ps1 -Target user
# Diagrams only (PlantUML)
.\generate_docs.ps1 -Target diagrams
Validate Documentation¶
# Run all validation checks
.\validate_docs.ps1 -All
# Check specific aspects
.\validate_docs.ps1 -CheckLinks -CheckSpelling
Serve Documentation Locally¶
Master Generation Script¶
generate_docs.ps1¶
Features: - Generates API docs (Doxygen) - Generates user docs (MkDocs) - Generates diagrams (PlantUML) - Clean builds - Development server - Error reporting - Timing information
Usage:
# Full build
.\generate_docs.ps1 -Target all -Clean
# Incremental build
.\generate_docs.ps1 -Target user
# Development mode
.\generate_docs.ps1 -Target user -Serve
Requirements: - Doxygen (for API docs) - Python + MkDocs (for user docs) - PlantUML + Java (for diagrams)
validate_docs.ps1¶
Features: - Check broken links (internal/external) - Spell checking (cSpell) - Markdown formatting (markdownlint) - Empty file detection - TODO/FIXME detection
Usage:
# All checks
.\validate_docs.ps1 -All
# Specific checks
.\validate_docs.ps1 -CheckLinks
.\validate_docs.ps1 -CheckSpelling
.\validate_docs.ps1 -CheckFormat
Requirements: - markdown-link-check (npm) - cspell (npm) - markdownlint-cli (npm)
Automation Workflows¶
Pre-Commit Hook¶
# .git/hooks/pre-commit
#!/bin/bash
# Validate docs before commit
powershell.exe -File "2 - FOUNDATION/03_INFRA/03_11_documentation_platform/03_11_05_documentation_automation/validate_docs.ps1" -CheckLinks -CheckFormat
if [ $? -ne 0 ]; then
echo "Documentation validation failed. Fix errors before committing."
exit 1
fi
CI/CD Pipeline¶
# .github/workflows/docs.yml
name: Documentation
on:
push:
branches: [main]
paths:
- '10_DOCUMENTATION/**'
- '2 - FOUNDATION/04_CORE/**/*.hpp'
- '2 - FOUNDATION/04_CORE/**/*.h'
jobs:
build-and-validate:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install mkdocs mkdocs-material mkdocs-minify-plugin
npm install -g markdown-link-check cspell markdownlint-cli
- name: Validate documentation
run: |
.\2 - FOUNDATION\03_INFRA\03_11_documentation_platform\03_11_05_documentation_automation\validate_docs.ps1 -All
- name: Generate documentation
run: |
.\2 - FOUNDATION\03_INFRA\03_11_documentation_platform\03_11_05_documentation_automation\generate_docs.ps1 -Target all -Clean
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./var/docs
Scheduled Updates¶
# .github/workflows/docs-update.yml
name: Update Documentation
on:
schedule:
- cron: '0 2 * * 1' # Weekly on Monday 2am
jobs:
update:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Regenerate all docs
run: |
.\generate_docs.ps1 -Target all -Clean
- name: Check for changes
run: git diff --exit-code
- name: Create PR if changes
if: failure()
uses: peter-evans/create-pull-request@v5
with:
title: "docs: regenerate documentation"
body: "Automated documentation regeneration"
branch: docs/auto-update
Changelog Automation¶
Using Conventional Commits¶
# Commit with type prefix
git commit -m "feat(dsp): add SIMD-optimized lowpass filter"
git commit -m "fix(core): resolve audio glitch on resize"
git commit -m "docs(api): improve AudioBuffer documentation"
Generate Changelog¶
# Using git-cliff
git cliff --tag v2.0.0 --output CHANGELOG.md
# Using standard-version
npm run release -- --release-as minor
API Diff Generation¶
Compare Versions¶
# Generate API diff between v1.0.0 and v2.0.0
.\scripts\compare-api.ps1 -OldVersion v1.0.0 -NewVersion v2.0.0
Detect Breaking Changes¶
Best Practices¶
Documentation Workflow¶
- Write documentation in markdown
- Validate locally with
validate_docs.ps1 - Preview with
generate_docs.ps1 -Serve - Commit changes
- CI builds and validates
- Deploy automatically to hosting
Version Control¶
- Commit source files (markdown, PlantUML, Doxyfile, mkdocs.yml)
- Don't commit generated files (HTML, PNG from PlantUML)
- Use Git LFS for large media files
Continuous Improvement¶
- Monitor documentation coverage (% of APIs documented)
- Track broken links (should be zero)
- Review and update quarterly
- Collect user feedback
Tooling Setup¶
Install Required Tools¶
Windows:
# Doxygen
winget install doxygen
# Python + MkDocs
winget install Python.Python.3.11
pip install mkdocs mkdocs-material mkdocs-minify-plugin
# PlantUML
winget install plantuml
# Validation tools
npm install -g markdown-link-check cspell markdownlint-cli
# Changelog tools
npm install -g standard-version
cargo install git-cliff # Or: winget install git-cliff
Verify Installation:
doxygen --version
mkdocs --version
plantuml -version
markdown-link-check --version
cspell --version
markdownlint --version
Troubleshooting¶
Doxygen Fails¶
MkDocs Build Errors¶
PlantUML Not Generating¶
Link Check Fails¶
Performance¶
Build Times (Typical)¶
- API Docs (Doxygen): 30-60 seconds
- User Docs (MkDocs): 5-10 seconds
- Diagrams (PlantUML): 1-2 seconds per diagram
Optimization Tips¶
- Use incremental builds (no
-Clean) - Cache dependencies in CI
- Parallelize diagram generation
- Use
mkdocs servefor live preview
References¶
Scripts¶
- generate_docs.ps1 - Master generation script
- validate_docs.ps1 - Validation script
Guides¶
External Tools¶
- Doxygen: https://www.doxygen.nl/
- MkDocs: https://www.mkdocs.org/
- PlantUML: https://plantuml.com/
- git-cliff: https://github.com/orhun/git-cliff
- standard-version: https://github.com/conventional-changelog/standard-version