[AAASM-4308] 📝 (docs): Add MkDocs shared metadata macros to prevent docs drift#229
Conversation
Adds mkdocs-macros-plugin to the docs dependency group only (not runtime),
adds docs_macros.py that reads pyproject.toml via tomllib and exposes an
`aa` variable to Markdown pages, and enables the plugin in mkdocs.yml with
`on_undefined: strict` + `on_error_fail: true` so undefined `{{ aa.* }}`
references fail the strict build.
Refs AAASM-4308.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Route the current SDK version, PyPI URL, docs URL, repo URL, import name, CLI name, and pip/uv install commands through the `aa` macro variable on the main user-facing pages (quick-start, compatibility index, release process, examples runtime environment). Historical release notes and per-release adapter/version tables are left literal — they describe historical facts, not current state. Refs AAASM-4308. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds docs/development/docs-macros.md — a maintainer contract for the
shared metadata / macros layer. Covers:
- What the top-level `aa` variable is and where each subsection comes
from (`pyproject.toml` for package facts; string literals in
`docs_macros.py` for URLs, install commands, import / CLI names).
- How to add a new shared value: edit `docs_macros.py`, reference it as
`{{ aa.<section>.<key> }}`, and rely on `on_undefined: strict` +
`on_error_fail: true` under `mkdocs build --strict` (already run in
CI via `.github/workflows/documentation.yaml`) to catch typos.
- What NOT to template: historical release notes, per-release adapter
tables, and pinning-pattern examples (`agent-assembly==0.0.x`) must
stay literal.
Links the new page from `docs/development/index.md` and adds it to the
`Development` section of the nav in `mkdocs.yml`.
Closes AAASM-4308.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Claude Code review — AAASM-4308CI status: all 22 required checks green (unit + integration tests, CodeQL, docs strict build, SonarCloud, codecov, pip-audit). AC coverage vs Jira AAASM-4308:
Side-effect assessment: additive-only. Runtime FE validation: N/A — MkDocs Material builds a static site; no interactive frontend behavior added/changed. Verdict: Ready to approve and merge. 3 clean atomic gitmoji commits, all AC met. |
The Python version cell in the "Python versions" table hardcoded
`requires-python = ">=3.12,<4.0"` — a value that must stay in lockstep
with pyproject.toml. Replace the literal with
`{{ aa.python_sdk.requires_python }}` so the compatibility page sources
the range from the AAASM-4308 shared metadata macros.
Refs AAASM-4308.
|
Claude Code re-review — AAASM-4308 (post coverage-audit follow-up)CI status: all 29 required checks green (22 pass, 7 skipped — branch-conditional). New commits since last review (1):
Coverage-audit disposition confirmed:
Side effects: none. Additive-only, docs-only. FE validation: N/A — mkdocs Material builds a static site; no interactive frontend touched. Verdict: ready to approve and merge. |



Description
Adds a MkDocs shared-metadata / macros layer so the Python SDK docs source
drift-prone factual values — the current SDK version, PyPI / repo / docs URLs,
import and CLI names, and canonical install commands — from one place
(
pyproject.toml+docs_macros.py) instead of being hand-copied acrossMarkdown pages.
Implementation:
mkdocs-macros-pluginadded to the docs dependency group only inpyproject.toml(not runtime).docs_macros.pyat the repo root readspyproject.tomlviatomlliband exposes an
aaobject to Markdown pages, with subsections forpackage facts, canonical URLs, and install commands.
mkdocs.ymlenables the macros plugin withon_undefined: strictandon_error_fail: true, so an undefined{{ aa.* }}reference failsmkdocs build --strictinstead of rendering as an empty string. CIalready runs
uv run mkdocs build --strictin.github/workflows/documentation.yaml, so the strict guard is thePR check.
quick-start.md,compatibility/index.md,compatibility/release-process.md,examples/preparing-the-runtime-environment.md)now go through macros for the current SDK version, PyPI URL, docs URL,
repo URL, import name, CLI name, and pip / uv install commands.
they describe historical facts, not current state.
docs/development/docs-macros.mddescribes the macrocontract: where each value comes from, how to add a new one, and what
must stay literal. Linked from the Development index and nav.
Type of Change
Breaking Changes
Related Issues
Before / After examples
Package version —
docs/quick-start.mdBefore:
After:
The version now flows from
pyproject.toml→docs_macros.py→ the renderedpage automatically at every build.
Install command —
docs/quick-start.mdBefore:
=== "uv" ```bash uv add agent-assembly ```After:
=== "uv" ```bash {{ aa.commands.install_uv }} ```The install snippet is now a single source of truth in
docs_macros.py.Testing
uv sync --group docssucceedsuv run mkdocs build --strictsucceeds locally (strict-mode zerowarnings after the branch was committed)
rg "0\.0\.1rc3" docs/shows only historical / adapter-releasereferences and the maintainer-doc's own quoted example — no
current-state page still hardcodes the version
.github/workflows/documentation.yamlalready runsuv run mkdocs build --strict, so an undefined-macro typo will failCI
Checklist
mkdocs-macros-pluginis docs-onlyHow to verify locally
Then open
site/quick-start/index.htmland confirm the install snippetsand current version are rendered from
pyproject.toml(currently0.0.1rc3), and that the new maintainer page atsite/development/docs-macros/index.htmlrenders correctly.Coverage audit follow-up
A read-only coverage audit flagged three additional literals that still
appear inside the drift-prone value set. Their disposition:
README.mdinstall snippets —pip install agent-assemblyanduv add agent-assemblyin the "Installation" and quick-start sections(HIGH). Deferred.
README.mdis rendered by GitHub, not bymkdocs-macros-plugin, so raw{{ aa.* }}Jinja would render asliteral
{{ }}on the repo landing page. There is no existingREADME.md.j2template orscripts/render_readme.pygenerator in therepo, so templating the README would require a separate render step
outside the mkdocs pipeline. Out of scope for this PR; can be filed
as a follow-up ticket if we decide to keep the README's install
snippet in lockstep with
docs_macros.py.README.mdline ~130 quick-start install (HIGH). Deferred for thesame reason as (1).
docs/compatibility/runtime.md—requires-python = ">=3.12,<4.0"literal in the "Python versions" table (MEDIUM). Fixed in commit
46c5979— replaced the literal with{{ aa.python_sdk.requires_python }}so the compatibility page readsthe range from
pyproject.tomlvia the shared macros. Verified withuv run mkdocs build --strictand by inspecting the rendered HTML.Closes AAASM-4308.