|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +This is the documentation repository for OpenSPP - an open-source social protection platform. The documentation is built using Sphinx with MyST parser for Markdown support. |
| 8 | + |
| 9 | +## Build Commands |
| 10 | + |
| 11 | +### Setup Development Environment |
| 12 | +```bash |
| 13 | +# Create Python virtual environment and install dependencies |
| 14 | +make deps |
| 15 | + |
| 16 | +# This will: |
| 17 | +# - Create a Python virtual environment |
| 18 | +# - Install requirements from requirements_frozen.txt |
| 19 | +# - Initialize git submodules (openg2p-program, openg2p-registry) |
| 20 | +``` |
| 21 | + |
| 22 | +### Build Documentation |
| 23 | +```bash |
| 24 | +# Build HTML documentation |
| 25 | +make html |
| 26 | + |
| 27 | +# Live reload server for development (port 8050) |
| 28 | +make livehtml |
| 29 | + |
| 30 | +# Clean build artifacts |
| 31 | +make clean |
| 32 | + |
| 33 | +# Clean everything including virtual environment |
| 34 | +make distclean |
| 35 | +``` |
| 36 | + |
| 37 | +### Quality Checks |
| 38 | +```bash |
| 39 | +# Run Vale for style, grammar, and spell checks |
| 40 | +make vale |
| 41 | + |
| 42 | +# Check for broken links |
| 43 | +make linkcheck |
| 44 | + |
| 45 | +# Run all quality checks and build |
| 46 | +make all # Runs: clean, vale, linkcheck, html |
| 47 | +``` |
| 48 | + |
| 49 | +### Testing |
| 50 | +```bash |
| 51 | +# Run tests (cleans then runs linkcheck) |
| 52 | +make test |
| 53 | +``` |
| 54 | + |
| 55 | +## Architecture |
| 56 | + |
| 57 | +The documentation is organized into several key sections following a modernized structure implemented in January 2025: |
| 58 | + |
| 59 | +1. **docs/** - Main documentation source files (restructured) |
| 60 | + - `overview/` - High-level information for decision makers and new users |
| 61 | + - `features/` - Feature overviews organized by functional area |
| 62 | + - `concepts/` - Conceptual explanations (moved from `explanation/`) |
| 63 | + - `use_cases/` - Use-case specific entry points (social registry, farmer registry, SP-MIS) |
| 64 | + - `case_studies/` - Implementation examples |
| 65 | + - `getting_started/` - Installation guides and quickstart tutorials |
| 66 | + - `user_guide/` - Task-oriented guides for administrators and end-users |
| 67 | + - `registry_management/` - Registry operations and data management |
| 68 | + - `program_management/` - Program creation, cycles, and management |
| 69 | + - `administration/` - System administration tasks |
| 70 | + - `developer_guide/` - Technical information for developers |
| 71 | + - `customization/` - Guides for customizing OpenSPP functionality |
| 72 | + - `integrations/` - Integration guides for external systems |
| 73 | + - `api_usage/` - API guides and references |
| 74 | + - `reference/` - Detailed reference material |
| 75 | + - `modules/` - Documentation for OpenSPP modules (moved from `docs/modules/`) |
| 76 | + - `technical/` - Technical specifications and deep-dives |
| 77 | + - `api/` - API references and specifications |
| 78 | + - `community/` - Community interaction, contribution processes, and legal information |
| 79 | + |
| 80 | +2. **submodules/** - Git submodules containing related OpenG2P projects |
| 81 | + - `odoo/` - Odoo framework (OpenSPP is built on Odoo) |
| 82 | + - `openg2p-program/` - OpenG2P program management modules |
| 83 | + - `openg2p-registry/` - OpenG2P registry modules |
| 84 | + - `queue/` - Queue job management |
| 85 | + |
| 86 | +3. **Configuration** |
| 87 | + - `conf.py` - Sphinx configuration with custom OpenSPP/Odoo integration |
| 88 | + - `.vale.ini` - Vale linter configuration using Microsoft and alex style guides |
| 89 | + - `requirements_frozen.txt` - Pinned Python dependencies |
| 90 | + |
| 91 | +4. **Migration Tools** (available for reference) |
| 92 | + - `refactor_docs.py` - Automated documentation restructuring script |
| 93 | + - `update_navigation.py` - Navigation menu management |
| 94 | + - `update_links.py` - Cross-reference link updating |
| 95 | + |
| 96 | +## Key Development Notes |
| 97 | + |
| 98 | +- The documentation uses Sphinx 4.5.0 with MyST parser for Markdown support |
| 99 | +- Vale is configured for style checking with OpenSPP-specific vocabulary |
| 100 | +- The build system automatically handles Odoo module documentation integration |
| 101 | +- Live reload development server runs on port 8050 |
| 102 | +- GitHub Actions handle automated builds and deployment on push to main branch |
| 103 | +- Redirects are managed using sphinx-reredirects extension (currently disabled due to version conflicts) |
| 104 | + |
| 105 | +## Module Documentation |
| 106 | + |
| 107 | +When documenting OpenSPP modules, follow the existing pattern in `docs/reference/modules/`. Each module should have its own Markdown file with standardized sections for overview, features, configuration, and usage. |
| 108 | + |
| 109 | +## Managing Redirects |
| 110 | + |
| 111 | +When moving or renaming documentation pages, add redirects in `docs/conf.py`: |
| 112 | +```python |
| 113 | +redirects = { |
| 114 | + "old-path": "new-path.html", |
| 115 | +} |
| 116 | +``` |
| 117 | +Note: The sphinx-reredirects extension is currently disabled due to version conflicts with Sphinx 4.5.0. The redirect mappings are prepared in conf.py but commented out until a compatible version is available. |
| 118 | + |
| 119 | +## Documentation Refactoring Lessons Learned |
| 120 | + |
| 121 | +### Automated Migration Approach |
| 122 | + |
| 123 | +The 2025 documentation restructuring used Python scripts for automation: |
| 124 | +- **refactor_docs.py**: Main script for moving files and handling merges/splits |
| 125 | +- **update_navigation.py**: Updates toctree entries in index files |
| 126 | +- **update_links.py**: Updates internal cross-references |
| 127 | + |
| 128 | +This approach proved essential for: |
| 129 | +- Consistency across 117+ file movements |
| 130 | +- Handling complex directory structures and image relocations |
| 131 | +- Maintaining content integrity during merges |
| 132 | + |
| 133 | +### Critical Success Factors |
| 134 | + |
| 135 | +1. **Comprehensive Mapping**: Create detailed mapping of old → new structure before starting |
| 136 | +2. **Phased Execution**: Break migration into discrete phases (audit, move, navigate, validate) |
| 137 | +3. **Navigation Updates**: Moving files is only half the work - updating toctree entries requires systematic attention |
| 138 | +4. **Build Validation**: Test builds frequently to catch dependency issues early |
| 139 | +5. **Content Consolidation**: Migration reveals duplication opportunities (tutorial/howto sections) |
| 140 | + |
| 141 | +### Technical Challenges |
| 142 | + |
| 143 | +- **Dependency Management**: PIL/Pillow library conflicts can break builds |
| 144 | +- **Extension Compatibility**: sphinx-reredirects requires newer Sphinx versions |
| 145 | +- **Cross-Reference Complexity**: Internal links need careful updating across all files |
| 146 | +- **Image Path Management**: Images need to move with their content while maintaining relative paths |
| 147 | + |
| 148 | +When performing future refactoring, use the existing scripts as templates and follow the phased approach documented in `review_work/doc_migration_guide.md`. |
0 commit comments