feat(cli): add --json to remaining list/status commands#221
Conversation
Closes profullstack#142. Addresses profullstack#133. Adds machine-readable --json output to the six CLI commands identified in the issue that were missing the convention: - sh1pt config payments list → { providers, defaultProvider } - sh1pt config stack list → { stacks } (value/title/description/supported per entry) - sh1pt build entity compliance list <slug> → { slug, tasks, filter } - sh1pt build entity status <slug> → { slug, state, states } - sh1pt scale deploy status <id> --provider → { instanceId, provider, status, hourlyRate } - sh1pt promote ship target list → { targets } All six commands continue to print human-readable output when the flag is omitted. Includes 10 focused Vitest tests covering both --json and human-readable paths. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
17 similar comments
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
Summary
Closes #142. Addresses #133.
Adds machine-readable
--jsonoutput to the six CLI commands that were missing the convention (every status/list command should support--json):sh1pt config payments list --json{ providers, defaultProvider }sh1pt config stack list --json{ stacks }(value/title/description/supported per entry)sh1pt build entity compliance list <slug> --json{ slug, tasks, filter }sh1pt build entity status <slug> --json{ slug, state, states }sh1pt scale deploy status <id> --provider <id> --json{ instanceId, provider, status, hourlyRate }sh1pt promote ship target list --json{ targets }All six commands continue to print human-readable output when
--jsonis omitted, preserving existing behavior.Implementation details
opts.json, emitconsole.log(JSON.stringify(..., null, 2)), return early.config stack list --jsonreuses the existingSTACKSconstant (value/title/description/supported shape) so the data model is shared.entity compliance listpasses through the--statusfilter value in the JSON response so callers can confirm the active filter.entity statusincludes the full lifecycle state machine (statesarray) so clients can render progress bars without hardcoding the sequence.Test plan
pnpm exec vitest run packages/cli/src/commands/json-output.test.ts— 10/10 passpnpm --filter @profullstack/sh1pt typecheck— no errorsgit diff --check— no trailing whitespace🤖 Generated with Claude Code