Skip to content

enhancement: expose workspace_root on base_cli.Context #940

Description

@codeforester

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or product improvement

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions