Skip to content

feat(cli): add structured output to workspace create and get #5470

Closed

Description

@TaylorMutch

User Story

OpenShell workspace conformance tests need to consume the workspace returned by workspace create and workspace get as structured data, so they can assert workspace fields without parsing presentation text. The author of #4620 identifies the workspace conformance stories in #4607 as the concrete use case. The maintainer has accepted this scoped follow-up for that use case.

Problem Statement

openshell workspace list and openshell workspace member list accept --output json|yaml, but workspace create and workspace get emit only human-readable text. Automation cannot obtain the workspace returned by creation or inspection through the same structured-output interface.

Impact / Why This Matters

Scripts that provision or inspect workspaces must parse presentation text or make an additional list request and select the matching workspace. This adds formatting dependencies or unnecessary requests. The workspace conformance work in #4607 documents the absence of structured workspace get output and relies on exit status and list-based state checks instead of inspecting that command's returned object.

Proposed Design

Add -o/--output table|json|yaml to workspace create and workspace get. Keep the default human-readable output. JSON and YAML should describe the single workspace returned by the command, using the same workspace fields as structured workspace list records. Structured stdout must contain only the serialized workspace. Existing command errors remain failures and must not emit a success object.

No gateway API or workspace authorization behavior changes are needed.

Suggested UX

openshell workspace create --name team-research --label env=dev --output json
openshell workspace get team-research --output yaml

Acceptance Criteria

  • workspace create and workspace get accept -o/--output table|json|yaml.
  • JSON is a parseable single workspace object; YAML represents the equivalent object.
  • Workspace fields and values match the representation of an individual workspace in structured workspace list output.
  • Structured stdout contains no ANSI styling or human-readable success messages.
  • Default output remains unchanged.
  • Duplicate creation and missing-workspace errors remain nonzero and do not print a success object to stdout.
  • CLI help, focused tests, and the workspace documentation cover the new flags.

Alternatives Considered

  • Parse the existing text output. This couples automation to presentation formatting.
  • Create or get a workspace, then call workspace list --output json and filter the response. This adds a request and relies on list pagination and selection for data already returned by the original command.
  • Use the SDK directly. This remains available, but requires scripts to leave the CLI workflow to obtain structured results.
  • Gateway interceptors, supervisor middleware, and credential providers do not control CLI output rendering and do not address this gap.

Related Work

Activity

  1. added
    retired:area:cliRetired; do not apply. See #5151 for item-specific migration to the current taxonomy.
    state:acceptedA maintainer decided OpenShell should pursue this issue
    on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    retired:area:cliRetired; do not apply. See #5151 for item-specific migration to the current taxonomy.state:acceptedA maintainer decided OpenShell should pursue this issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions