Structured output & CLI API hardening (output + errors + --describe)
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start by reading the existing OutputFormat patterns in events.rs, fee_stats.rs, ledger/fetch.rs, and print.rs. Trace how command specs feed the parser and help output, then define the scope for structured envelopes, error metadata, and --describe. Done means the listed example envelopes reproduce, --describe emits args/output/errors[]/examples, and commands produce parseable JSON under output=json.
Written by the indexing model from the issue text.
Description
Part of the Improve Agent UX for Wallets epic.
Summary
Harden the CLI API so an agent/human can parse any command's result and chain commands together without scraping plain text. Three facets, tracked as one task: a global structured-output flag, a structured error catalog, and a --describe machine-readable schema.
1. Structured output
New global flag:
output=json|default
- default — today's default (plain text for most commands, a few existing JSON exceptions).
- json — an object with predictable keys representing the same data plus enriched output in some cases (e.g. errors paired with a resolution).
Example (ok):
{ "status": "ok", "result": "9999999500", "error": null }
Example (error):
{
"status": "error",
"result": null,
"error": {
"code": "tx_simulation_failed",
"domain": "tx",
"message": "host invocation failed: Error(Contract, #2)",
"details": {
"contract_id": "C...",
"error_code": 2,
"error_name": "InsufficientBalance",
"diagnostic_events": ["..."]
}
}
}
2. Structured errors
commands return an object with a consistent set of keys.
errors add context along with raw error details to aid users/agents towards remediation of the error.
3. --describe
A projection of the command spec: a machine-readable schema for a command or the tree (args, output schema, errors[], examples). Backed by a command-spec source file feeding the parser / --help / --describe generator.
Build on existing OutputFormat patterns (events.rs, fee_stats.rs, ledger/fetch.rs) and print.rs.
Acceptance criteria
- The spec's example envelopes (ok-result and error-with-remediation) reproduce.
-
--describeemitsargs/output/errors[]/examples. - commands emit parseable JSON under
output=json.
- Dominant language
- Rust
- Stars
- 123
- Forks
- 141
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 17
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stellar/stellar-cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
stellar/stellar-cli#2384 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
stellar/stellar-cli#2347 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
stellar/stellar-cli#2723 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
stellar/stellar-cli#2722 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
stellar/stellar-cli#2703 ·
All issues in stellar/stellar-cli
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100