Repository navigation
Description
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 yamlAcceptance Criteria
-
workspace createandworkspace getaccept-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 listoutput. - 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 jsonand 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
- PR feat(cli): add --output to workspace create and get #4620 implements this scoped change.
- feat(cli): add structured output to remaining list commands #3066 introduced structured output for the remaining list commands and explicitly deferred non-list read surfaces.
- CLI command grammar is inconsistent across subcommands #4280 discusses broader CLI consistency; this issue does not change command grammar.
- feat(cli): structured JSON/YAML error and warning output for --output mode #2040 concerns structured errors and warnings; this issue only adds successful workspace result output.
Activity