ADR-0007: Settings resolution, init, and config show¶
Context¶
v1-spec.md already specified a docs_dir configuration precedence chain and an init command, but no code implemented either: every command hardcoded docs_dir = Path.cwd() / "docs", so there was no way to point the toolkit at a non-default docs root, and no bootstrap path for a brand-new wiki other than hand-creating the structure doctor would otherwise just report as missing.
Decision¶
wiki_toolkit/settings.pyresolvesdocs_dirin precedence order: CLI flag →WIKI_TOOLKIT_DOCS_DIRenv var →[tool.wiki_toolkit]table inpyproject.toml(located upward from cwd, matching howruff/mypylocate project config) → built-in default (docs/). Resolution returns the value and which source produced it (flag/env/pyproject/default) as a small result type, not a bare path.- New
config showcommand prints the resolved value and its source, read-only. - New
initcommand scaffoldsdocs/{sources,wiki}/, emptycatalog.jsonl/log.jsonl/source-manifest.jsonl, andschema.mdfrom a built-in template verbatim (unchanged from toolkit-spec.md’s Schema section). It refuses to overwrite anything already present, reporting each already-present item instead of erroring the whole run — so a partialinitcan be completed by re-running. doctorgains the “resolved configuration and its source” line already promised byv1-spec.md’s contract but not yet implemented.- All 9 pre-existing commands (plus
doctor) are retrofitted with a--docs-diroption, replacing their hardcoded default.
Consequences¶
- No business-logic module’s function signature changes — they already took
docs_dir: Pathas a plain parameter; onlycli.py’s option wiring and each command’s default-resolution line change. initlater gained a sixth scaffolded item (the local skills copy) without reopening this ADR — see ADR-0009.