Problem
Workspace-aware Python commands have to reach through ctx.user_config.workspace.root to find the configured workspace root. That value is typed and correct, but verbose for a high-use command concern.
Verified in lib/python/base_cli/context.py: Context exposes project_root directly, but not workspace_root. Verified in lib/python/base_cli/app.py: _create_context() loads user_config but does not derive a direct workspace-root field.
Proposal
Expose workspace_root: Path | None on base_cli.Context, derived from user_config.workspace.root during context creation.
Expected behavior:
Context includes workspace_root: Path | None = None.
_create_context() sets workspace_root=user_config.workspace.root.
- Workspace-oriented command code can use
ctx.workspace_root directly.
- Existing
ctx.user_config.workspace.root callers keep working.
Acceptance Criteria
- Unit tests cover
ctx.workspace_root when user config has a workspace root.
- Unit tests cover
ctx.workspace_root is None when no workspace root is configured.
- At least one workspace-oriented Python command or test fixture uses the convenience field where it improves clarity.
lib/python/base_cli/README.md documents ctx.workspace_root alongside ctx.project_root.
Notes
Derived from the base_cli 1.1.0 follow-up review. This is one of the highest-impact items because workspace commands already treat the workspace root as a first-class concept.
Problem
Workspace-aware Python commands have to reach through
ctx.user_config.workspace.rootto find the configured workspace root. That value is typed and correct, but verbose for a high-use command concern.Verified in
lib/python/base_cli/context.py:Contextexposesproject_rootdirectly, but notworkspace_root. Verified inlib/python/base_cli/app.py:_create_context()loadsuser_configbut does not derive a direct workspace-root field.Proposal
Expose
workspace_root: Path | Noneonbase_cli.Context, derived fromuser_config.workspace.rootduring context creation.Expected behavior:
Contextincludesworkspace_root: Path | None = None._create_context()setsworkspace_root=user_config.workspace.root.ctx.workspace_rootdirectly.ctx.user_config.workspace.rootcallers keep working.Acceptance Criteria
ctx.workspace_rootwhen user config has a workspace root.ctx.workspace_root is Nonewhen no workspace root is configured.lib/python/base_cli/README.mddocumentsctx.workspace_rootalongsidectx.project_root.Notes
Derived from the
base_cli 1.1.0follow-up review. This is one of the highest-impact items because workspace commands already treat the workspace root as a first-class concept.