Skip to content

Proposal for lstk JSON output schema#374

Draft
peter-smith-phd wants to merge 4 commits into
mainfrom
devx-956-json-output-standard
Draft

Proposal for lstk JSON output schema#374
peter-smith-phd wants to merge 4 commits into
mainfrom
devx-956-json-output-standard

Conversation

@peter-smith-phd

@peter-smith-phd peter-smith-phd commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR is primarily a review of the lstk JSON output schema design. The main thing to review is docs/structured-output.md, containing the detailed specification of how the JSON output from lstk should be structured. This is a proposal, but as soon as we solidify the design it'll be locked in (e.g. we can't iterate without changing the schema version number).

This includes:

  • The overall payload structure, with lots of examples.
  • How errors are reported (the "error" object)
  • The various error codes that give us programmatic access (rather than textual) for error situations.

To prove this all works, three commands (stop, reset, update) are wired up end-to-end with --json as a pilot. These were chosen as simple commands that could exercise the new schema, and give a feel for how it looks.

Additionally, the docs/structured-output.md` proposes but doesn't solidify the details for all the other commands. We can revisit these schemas when we actually add JSON support for each command (in later PRs).

If you do nothing else, please read docs/structured-output.md

@peter-smith-phd peter-smith-phd changed the title JSON output schema: envelope, error codes, and --json for stop/reset/update Proposal for lstk JSON output schema Jul 8, 2026
@peter-smith-phd peter-smith-phd added semver: minor docs: needed Pull request requires documentation updates labels Jul 8, 2026
peter-smith-phd and others added 4 commits July 9, 2026 11:09
Checkpoint before implementation: proposal, design, specs, and tasks for
a standardized JSON envelope, error-code taxonomy, and per-command output
schema across lstk's --json flag, informed by prior art (Kubernetes,
Terraform, GitHub CLI, Docker, AWS CLI, JSON-RPC 2.0) and naming choices
that anticipate future YAML support.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…eset/update

Implements the shared envelope/error-code contract from the json-output-schema
proposal and wires --json support through stop, reset, and update as a pilot,
to validate the design before rolling it out to the rest of the command surface.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
requireJSONSupport now renders an unsupported command's --json rejection as
a JSON envelope on stdout (error.code: NOT_JSON_CAPABLE) instead of plain
text on stderr, but these tests still asserted the old stderr-based
contract from the earlier add-json-flag PR. Update them to decode the
envelope and assert against it instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Rebased onto main, which removed the deprecated `lstk config profile`
command (#360) — it no longer exists, so it shouldn't be listed as a
command that "will never support --json".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@peter-smith-phd peter-smith-phd force-pushed the devx-956-json-output-standard branch from 1ad7edc to 593101b Compare July 8, 2026 23:11

@skyrpex skyrpex left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, specially the logs streaming using NDJSON :) Nice job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: needed Pull request requires documentation updates semver: minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants