CLI wiring sweep: hoist settings flags onto ctx.obj - #162
Merged
Conversation
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
Contributor
|
Contributor
|
Version hint: patch Comment ID: Display version hint-auto-generated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--docs-dirand--repo-rootfrom per-command flags to group-level options oncli();build_context()runs once per invocation and the resolvedContextis assigned toctx.obj.--docs-dirand calledresolve_docs_dir()now readdocs_dir/repo_rootoff the injectedContextvia@click.pass_obj.Path.cwd()call sites incli.py(doctor,build,source-scan --update,source-snapshot,start-branch,commit-pages,propose-pr,log) now usectx.obj.repo_root.config showdrops its own--docs-diroverride (redundant with the group-level flag) and prints all five resolved settings and their sources (sources are threaded through viactx.meta, shared across the context tree).--docs-dir/--repo-rootnow resolve to absolute paths (resolve_path=True), fixing a bug the review pass caught: a relative--docs-dirflag combined with arepo_rootthat differs from cwd could silently break self-staging (git addrun with the wrong cwd, swallowed bystage_best_effort's best-effort suppression).doctor.py'sDoctorReport.docs_dir_source/run_doctor()type widened fromConfigSourcetoContextConfigSource, since it now also has to accept the"dedicated_file"source tierbuild_context()can report.Closes #157
Test plan
uv run pytest— 259 passeduv run ruff check/uv run ruff format --checkclean on touched filesuv run mypyclean on touched files