ADR 0008: Use environment-aware TypeDoc generation (CI direct, local wrapper)
- Status: Accepted
- Date: 2026-02-28
Context
The repository is developed on Windows paths that may include parentheses (for example, PC (2)), and this causes local TypeDoc execution failures in some command paths (spawnSync ... EINVAL / entry-point resolution issues).
At the same time, CI runs in a stable Linux environment where direct TypeDoc invocation is reliable and should remain the canonical execution path.
We need:
- reliable local docs generation for maintainers,
- predictable CI behavior for release/deploy pipelines,
- and minimal behavioral divergence across environments.
Decision
Adopt an environment-aware docs generation strategy:
- In CI (
CI=trueorGITHUB_ACTIONS=true), run TypeDoc directly via:typedoc --options typedoc.config.json
- In local development, route TypeDoc through
scripts/run-typedoc-docs.mjsto apply Windows-path-safe execution behavior.
The docs workspace script docs:api becomes the environment-aware entrypoint. Explicit scripts remain available for deterministic runs:
docs:api:defaultfor direct TypeDoc behavior,docs:api:localfor wrapper-based local behavior.
Rationale
- CI stability: keep the simplest and most standard invocation in automation.
- Local reliability: avoid known Windows path edge cases for contributors.
- Controlled complexity: isolate workaround logic to a single script boundary.
Consequences
- Script behavior is intentionally environment-dependent.
- The wrapper script becomes a maintained internal tool.
- CI logs and local logs may differ slightly in startup path, while output artifacts remain aligned.
Revisit Triggers
Re-evaluate if:
- TypeDoc fully resolves Windows path handling for this repository layout,
- Node/process invocation changes make the wrapper unnecessary,
- or CI starts requiring the wrapper path for parity.