Skip to content

CLI wiring sweep: hoist settings flags onto ctx.obj - #162

Merged
coordt merged 1 commit into
mainfrom
157-cli-wiring-sweep
Aug 16, 2026
Merged

CLI wiring sweep: hoist settings flags onto ctx.obj#162
coordt merged 1 commit into
mainfrom
157-cli-wiring-sweep

Conversation

@coordt

@coordt coordt commented Aug 16, 2026

Copy link
Copy Markdown
Member

Summary

  • Hoists --docs-dir and --repo-root from per-command flags to group-level options on cli(); build_context() runs once per invocation and the resolved Context is assigned to ctx.obj.
  • All 13 commands that previously redeclared --docs-dir and called resolve_docs_dir() now read docs_dir/repo_root off the injected Context via @click.pass_obj.
  • All 8 Path.cwd() call sites in cli.py (doctor, build, source-scan --update, source-snapshot, start-branch, commit-pages, propose-pr, log) now use ctx.obj.repo_root.
  • config show drops its own --docs-dir override (redundant with the group-level flag) and prints all five resolved settings and their sources (sources are threaded through via ctx.meta, shared across the context tree).
  • --docs-dir/--repo-root now resolve to absolute paths (resolve_path=True), fixing a bug the review pass caught: a relative --docs-dir flag combined with a repo_root that differs from cwd could silently break self-staging (git add run with the wrong cwd, swallowed by stage_best_effort's best-effort suppression).
  • doctor.py's DoctorReport.docs_dir_source/run_doctor() type widened from ConfigSource to ContextConfigSource, since it now also has to accept the "dedicated_file" source tier build_context() can report.

Closes #157

Test plan

  • uv run pytest — 259 passed
  • uv run ruff check / uv run ruff format --check clean on touched files
  • uv run mypy clean on touched files
  • Manual code review pass (medium effort) run and findings addressed

build_context() now runs once per CLI invocation in the cli() group
callback; every subcommand reads docs_dir/repo_root off the injected
Context via @click.pass_obj instead of re-declaring --docs-dir and
resolving it locally. config show dumps all five resolved settings
and their sources. --docs-dir/--repo-root resolve to absolute paths
so self-staging still works when repo_root differs from cwd.

Fixes #157
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://callowayproject.github.io/wiki-toolkit/pr-preview/pr-162/

Built to branch gh-pages at 2026-08-16 12:34 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

Copy link
Copy Markdown
Contributor

Version hint: patch
Current version: 0.28.0
New version (when merged): 0.28.1

Comment ID: Display version hint-auto-generated

@coordt
coordt merged commit 86cfe29 into main Aug 16, 2026
7 checks passed
@coordt
coordt deleted the 157-cli-wiring-sweep branch August 16, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI wiring sweep: hoist settings flags onto ctx.obj

1 participant