This document explains the repository structure and why files are organized this way.
- Purpose: Contains GitHub Actions + CI-only helpers
- Contents:
workflows/- Actions definitions (check-docs-updates.yml,tests.yml,pre-commit.yml)scripts/validate_docs_structure.py- Lightweight CI validation helperdocs-version-*.json- Metadata files used by historic workflows- CI note:
check-docs-updates.ymlauto-creates thechore/sync-affinity-docsbranch/PR and then explicitly triggerstests.ymlandpre-commit.ymlviaworkflow_dispatchso that required checks run even though the PR is opened by a workflow.
Why here?: Keeps automation-specific assets scoped to GitHub configuration.
- Purpose: Contains all test scripts and test-related files
- Contents:
- Test scripts (
.sh,.py) - Test documentation (
README.md)
- Test scripts (
Why here?: Standard practice - test files belong in a tests/ directory at the repository root, not in .github/.
- Purpose: Documentation for developers working on the project
- Contents:
TESTING.md- Testing guideTEST_RESULTS.md- Test results summary
Why here?: Development documentation belongs in docs/, separate from user-facing documentation.
- Purpose: Houses generated artifacts that mirror the official Affinity API documentation.
- Key files:
docs/v1/affinity_api_docs.md– generated bytools/v1_sync_pipeline/sync_v1_docs.pydocs/v2/affinity_api_docs.md– generated bytools/v2_sync_pipeline/sync_v2_docs.pydocs/v2/openapi.json– generated bytools/v2_sync_pipeline/sync_v2_docs.py(stable OpenAPI download)
Why here?: These are the canonical, committed outputs of the sync pipelines. They should never be edited manually.
- Purpose: Houses the production-ready sync pipeline and QA scripts
- Contents:
sync_v1_docs.py– Fetches live HTML, renders markdown, writes metadataqa/check_links.py– Anchor/external link validationqa/compare_to_live.py– Manual comparison helper for browser snapshots
Why here?: Separates long-lived automation from discarded extraction experiments (scripts/ directory has been removed).
- Purpose: Fetches the Redocly state payload from https://developer.affinity.co/ and generates the v2 markdown mirror + a stable OpenAPI JSON artifact.
- Contents:
sync_v2_docs.py– Fetches Redoc shell HTML + state JS, extracts OpenAPI JSON, renders markdown, writes outputs underdocs/v2/openapi_loader.py– Discovers theredocly-state-*.jsasset and extracts the embedded OpenAPI documentmarkdown_renderer.py– Converts the OpenAPI spec into readable markdown sections + appendices
Why here?: Keeps v2 automation co-located with v1, using the same “generated outputs, never hand-edit” approach.
- Purpose: Python dependencies needed for CI/CD workflows
- Location: Repository root
Why here?: Standard practice—requirements files sit at the root and make it easy for workflows to install dependencies.
- Purpose: Holds HTML snapshots, extracted code blocks, and comparison reports generated by the sync pipeline
- Behavior: Listed in
.gitignore; contents are safe to delete/regenerate
Why here?: Keeps transient data out of version control while giving engineers a predictable place to inspect intermediate outputs.
- ✅ Tests in
tests/- Not in.github/ - ✅ Documentation in
docs/- Organized by purpose - ✅ Requirements at root - Standard location
- ✅ GitHub configs in
.github/- GitHub-specific files - ✅ Clear separation - Each directory has a clear purpose
| File Type | Location | Reason |
|---|---|---|
| Test scripts | tests/ |
Standard practice |
| Test docs | docs/development/ |
Development docs |
| CI scripts | .github/scripts/ |
GitHub-specific (only validate_docs_structure.py remains) |
| Sync pipeline | tools/v1_sync_pipeline/ |
Production automation + QA helpers |
| Sync pipeline (v2) | tools/v2_sync_pipeline/ |
Production automation for v2 docs |
| Workflows | .github/workflows/ |
GitHub Actions |
| Requirements | requirements-ci.txt |
Root level, CI-specific |
| Metadata | .github/docs-version-*.json |
Workflow state |