Maintainer Guide¶
This page summarizes how the API, CLI, and documentation site are wired together.
Public API boundary¶
The stable Python API is exported from:
Currently, that package exports:
When adding new public APIs, update:
src/co_op_translator/api/__init__.pydocs/api.md- relevant API tests under
tests/co_op_translator/, such astest_api.pyortest_review_api.py
Avoid documenting lower-level core modules as stable API unless the project intends to support them directly.
CLI entry points¶
The package defines these Poetry scripts:
[tool.poetry.scripts]
translate = "co_op_translator.__main__:main"
evaluate = "co_op_translator.__main__:main"
migrate-links = "co_op_translator.__main__:main"
co-op-review = "co_op_translator.__main__:main"
src/co_op_translator/__main__.py dispatches by script name:
translatecallsco_op_translator.cli.translate.translate_commandevaluatecallsco_op_translator.cli.evaluate.evaluate_commandmigrate-linkscallsco_op_translator.cli.migrate_links.migrate_links_commandco-op-reviewcallsco_op_translator.cli.review.review_command
When adding or changing CLI options, update:
- the relevant
src/co_op_translator/cli/*.pycommand getting_started/command-reference.mddocs/cli.md- CLI-related tests, if behavior changes
Translation flow¶
The high-level translation flow is:
- Parse CLI arguments or API parameters.
- Validate LLM configuration with
LLMConfig. - Validate Azure AI Vision when image translation is selected.
- Normalize language codes.
- Detect legacy language folder aliases.
- Estimate translation volume.
- Update README language/course sections when applicable.
- Delegate project translation to
ProjectTranslator. ProjectTranslatordelegates file processing toTranslationManager.
Review flow¶
The deterministic review flow is:
- Parse CLI arguments or API parameters.
- Normalize requested language codes.
- Build one or more review targets from
root_dir,root_dirs, orgroups. - Optionally limit source files with
--changed-from. - Run deterministic checks for structure, translation freshness, Markdown integrity, and local link/image paths.
- Print either text output or GitHub-flavored Markdown.
- Exit with a failure when review errors are found.
The review flow does not require API keys and should remain suitable for pull request CI. The pull request workflow writes a check summary on every run and only posts a PR comment when co-op-review fails.
Documentation site¶
The docs site is configured by:
Build locally:
Preview locally:
The generated site is written to site/, which is ignored by git.
GitHub Pages workflow¶
.github/workflows/docs.yml builds the site on pull requests and deploys it on pushes to main.
The workflow installs:
Installing runtime dependencies before docs dependencies lets mkdocstrings import the package and render the public Python API reference.
Docs quality bar¶
Before merging documentation changes, run:
Use strict builds so broken links, invalid navigation entries, and API rendering issues fail early.