|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Documentation Build System |
| 6 | + |
| 7 | +This is the Spacelift user documentation repository using MkDocs with Material theme. The live documentation is at https://docs.spacelift.io/. |
| 8 | + |
| 9 | +## Common Commands |
| 10 | + |
| 11 | +### Development |
| 12 | + |
| 13 | +- `make run` - Run the documentation site locally via Docker Compose (http://localhost:8000) |
| 14 | +- `mkdocs serve` - Run locally with MkDocs directly |
| 15 | +- `mkdocs serve -a '0.0.0.0:8000'` - Run with external access |
| 16 | + |
| 17 | +### Testing and Linting |
| 18 | + |
| 19 | +- `make lint` - Run all linting checks (markdown + image optimization) |
| 20 | +- `pre-commit` - Run pre-commit hooks manually |
| 21 | +- `pre-commit install` - Install git hooks for automatic validation |
| 22 | + |
| 23 | +### Self-Hosted Documentation |
| 24 | + |
| 25 | +- `mike serve --branch self-hosted-releases-prod` - Preview self-hosted docs |
| 26 | +- Requires fetching: `git fetch origin self-hosted-releases-prod` |
| 27 | + |
| 28 | +## Architecture |
| 29 | + |
| 30 | +### Dual Documentation System |
| 31 | + |
| 32 | +The repository maintains two versions of documentation: |
| 33 | + |
| 34 | +- **SaaS version**: Standard documentation for cloud users |
| 35 | +- **Self-hosted version**: Documentation for on-premises installations |
| 36 | + |
| 37 | +This is managed through: |
| 38 | + |
| 39 | +- Two navigation files: `nav.yaml` (SaaS) and `nav.self-hosted.yaml` (self-hosted) |
| 40 | +- Conditional content using Jinja macros: `is_saas()` and `is_self_hosted()` |
| 41 | +- Environment variable `SPACELIFT_DISTRIBUTION` controls which version is built |
| 42 | + |
| 43 | +### Key Files and Structure |
| 44 | + |
| 45 | +- `docs/` - All Markdown documentation content |
| 46 | +- `mkdocs.yaml` - Main MkDocs configuration (uses `nav.yaml` by default) |
| 47 | +- `nav.yaml` / `nav.self-hosted.yaml` - Navigation structure for each version |
| 48 | +- `main.py` - Custom Jinja macros for conditional content |
| 49 | +- `hooks/` - MkDocs build hooks for banner fetching and URL processing |
| 50 | +- `overrides/` - Custom theme templates and components |
| 51 | +- `docs/assets/` - Static assets (CSS, images, screenshots) |
| 52 | + |
| 53 | +### Content Organization |
| 54 | + |
| 55 | +Documentation is organized into main sections: |
| 56 | + |
| 57 | +- **Getting Started** - Initial setup and onboarding |
| 58 | +- **Main Concepts** - Core concepts like Stack, Blueprint, Configuration, Run, Policy, Resources |
| 59 | +- **Vendors** - Tool-specific guides (Terraform, Ansible, Kubernetes, etc.) |
| 60 | +- **Integrations** - Third-party integrations and cloud providers |
| 61 | +- **Product** - Product-specific features and administration |
| 62 | + |
| 63 | +### Screenshots and Assets |
| 64 | + |
| 65 | +- Screenshots go in `docs/assets/screenshots/` |
| 66 | +- Images are automatically optimized with oxipng during pre-commit |
| 67 | +- Use descriptive filenames for screenshots |
| 68 | + |
| 69 | +### Conditional Content Patterns |
| 70 | + |
| 71 | +```markdown |
| 72 | +{% if is_saas() %} |
| 73 | +SaaS-only content here |
| 74 | +{% endif %} |
| 75 | + |
| 76 | +{% if is_self_hosted() %} |
| 77 | +Self-hosted-only content here |
| 78 | +{% endif %} |
| 79 | +``` |
| 80 | + |
| 81 | +Use `{% raw %}` blocks when Jinja interferes with code examples containing template syntax. |
| 82 | + |
| 83 | +## Development Workflow |
| 84 | + |
| 85 | +### Making Changes |
| 86 | + |
| 87 | +1. Edit Markdown files in `docs/` directory |
| 88 | +2. Add new pages to appropriate navigation file(s) |
| 89 | +3. Test locally with `make run` |
| 90 | +4. Validate with pre-commit hooks |
| 91 | +5. Both SaaS and self-hosted versions are automatically built on PR |
| 92 | + |
| 93 | +### Adding New Pages |
| 94 | + |
| 95 | +- Add to `nav.yaml` for SaaS-only pages |
| 96 | +- Add to `nav.self-hosted.yaml` for self-hosted-only pages |
| 97 | +- Add to both files for pages that appear in both versions |
| 98 | + |
| 99 | +### Pre-commit Validation |
| 100 | + |
| 101 | +The repository uses pre-commit hooks for: |
| 102 | + |
| 103 | +- Large file detection |
| 104 | +- YAML validation |
| 105 | +- Markdown linting (markdownlint) |
| 106 | +- Link checking (markdown-link-check) |
| 107 | +- PNG optimization (oxipng) |
0 commit comments