Implement version synchronization and template variables for existing documentation system
Issue Description
UPDATED SCOPE: The documentation infrastructure (mdBook + GitHub Actions) already exists and is fully functional. This issue focuses on implementing version synchronization between Cargo.toml and documentation, plus template variables for dynamic content injection.
Current State Analysis:
- ✅ Complete mdBook setup with 7 plugins configured
- ✅ GitHub Actions docs workflow deploying to GitHub Pages
- ✅ Comprehensive justfile with docs commands (docs-build, docs-serve, docs-check)
- ✅ 15+ documentation files covering installation, usage, security, development
- ✅ Referenced spec files exist in
.kiro/specs/documentation-setup/
- ❌ Missing: Version extraction from Cargo.toml to docs
- ❌ Missing: Template variables for dynamic version/feature content
- ❌ Missing: CLI example validation against current clap configuration
- 🚨 Critical: Version discrepancies exist across codebase (v0.2.6 in Cargo.toml, mixed references in docs)
Validation Steps
-
Test current documentation build:
just docs-build
just docs-serve
-
Verify version extraction (after implementation):
# Test that documentation includes current Cargo.toml version
cargo run --bin doc-version-sync
grep "$(grep '^version' Cargo.toml | cut -d'"' -f2)" docs/book/index.html
-
Validate CLI examples match current configuration:
Expected Behavior
- Documentation shows current Cargo.toml version automatically via template variables
- Feature flags documented match current codebase exactly
- CLI examples work with current clap configuration
- Version-specific content updates automatically on build
- All hardcoded version references replaced with dynamic templates
Proposed Implementation
1. Version Synchronization Script
Create src/bin/doc-version-sync.rs that:
- Extracts version from Cargo.toml using regex parsing
- Extracts feature flags from
[features] section
- Updates
book.toml with template variables
- Replaces hardcoded version references in markdown files
- Validates CLI examples against current binary
2. Enhanced Template System
Add to docs/book.toml:
[preprocessor.variables]
[preprocessor.variables.variables]
version = "{{CARGO_VERSION}}"
features = ["json", "csv", "ssl", "additional_mysql_types", "verbose"]
3. Updated Justfile Commands
# Sync documentation with current codebase version
docs-sync:
cargo run --bin doc-version-sync
# Enhanced docs-build with version sync
docs-build-sync: docs-sync docs-build
# Validate CLI examples against current code
docs-validate-cli:
cargo build --release
# Test documented CLI examples work with current binary
4. GitHub Actions Integration
Update .github/workflows/docs.yml to include version sync step:
- name: Sync documentation version
run: |
cargo run --bin doc-version-sync
git diff --exit-code || (echo "Documentation out of sync with version" && exit 1)
Acceptance Criteria
- ✅ WHEN documentation is generated THEN it SHALL include version information matching the current Cargo.toml version
- ✅ WHEN features are documented THEN feature flags SHALL be clearly indicated (e.g., "requires ssl feature")
- ✅ WHEN CLI options are documented THEN they SHALL match the current clap configuration
- ✅ WHEN examples are provided THEN they SHALL work with the current codebase and be testable
- ✅ WHEN breaking changes occur THEN migration guides SHALL be provided in the documentation
Remaining Tasks
DoD (Definition of Done)
Epic: #51 - Documentation Setup Epic
Note: This issue was significantly rescoped after analysis revealed the documentation infrastructure was already complete. Focus is now on the missing synchronization layer between codebase and documentation content.
Implement version synchronization and template variables for existing documentation system
Issue Description
UPDATED SCOPE: The documentation infrastructure (mdBook + GitHub Actions) already exists and is fully functional. This issue focuses on implementing version synchronization between Cargo.toml and documentation, plus template variables for dynamic content injection.
Current State Analysis:
.kiro/specs/documentation-setup/Validation Steps
Test current documentation build:
Verify version extraction (after implementation):
Validate CLI examples match current configuration:
Expected Behavior
Proposed Implementation
1. Version Synchronization Script
Create
src/bin/doc-version-sync.rsthat:[features]sectionbook.tomlwith template variables2. Enhanced Template System
Add to
docs/book.toml:3. Updated Justfile Commands
4. GitHub Actions Integration
Update
.github/workflows/docs.ymlto include version sync step:Acceptance Criteria
Remaining Tasks
src/bin/doc-version-sync.rsfor version extractionbook.tomlfor dynamic contentdocs-syncanddocs-validate-clicommandsDoD (Definition of Done)
Epic: #51 - Documentation Setup Epic
Note: This issue was significantly rescoped after analysis revealed the documentation infrastructure was already complete. Focus is now on the missing synchronization layer between codebase and documentation content.