Skip to content

feat(REL-15756): updating agent friendly and improved rich text output#663

Open
nieblara wants to merge 1 commit intoREL-12755-fields-flags-1from
REL-12756-richer-plain-text
Open

feat(REL-15756): updating agent friendly and improved rich text output#663
nieblara wants to merge 1 commit intoREL-12755-fields-flags-1from
REL-12756-richer-plain-text

Conversation

@nieblara
Copy link
Contributor

@nieblara nieblara commented Mar 18, 2026

Replace the minimal plaintext output (* name (key) bullets) with table-formatted output using text/tabwriter. Define column sets per resource type starting with 5-6 high-value resources (flags, projects, environments, members, segments). Everything else falls back to the current bullet format. Singular resources show key-value pairs.

before:
Screenshot 2026-03-17 at 9 26 37 PM
Screenshot 2026-03-17 at 9 26 24 PM
Screenshot 2026-03-17 at 9 26 10 PM

after:
Screenshot 2026-03-17 at 9 21 49 PM
Screenshot 2026-03-17 at 9 21 17 PM


Note

Medium Risk
Medium risk because it changes the CLI’s default plaintext rendering across multiple resource commands, which can impact user workflows and tests that parse human-readable output (JSON output remains unchanged).

Overview
Updates plaintext CLI output to be resource-aware: when CmdOutput is given a ResourceName, list responses render as aligned tables and singular responses render as key/value blocks (with fallback to the existing bullet and name (key) formats for unknown resources).

Adds internal/output/table.go with per-resource column registries (initially flags, projects, environments, members, segments) plus formatting helpers (yes/no booleans, tag truncation, timestamp formatting), and extends CmdOutput with optional CmdOutputOpts (including default Fields). Commands now pass ResourceName (e.g., flags archive/toggle, members invite, and generated resources operations), and tests are updated/expanded to assert the new plaintext output while keeping JSON behavior the same.

Written by Cursor Bugbot for commit 887c614. This will update automatically on new commits. Configure here.

@nieblara nieblara changed the title feat(REL-15756) updating agent friendly and improved rich text output feat(REL-15756): updating agent friendly and improved rich text output Mar 18, 2026
Copy link

@JackDanger JackDanger left a comment

Choose a reason for hiding this comment

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

The before/after screenshots look great — the table format is a significant UX improvement for humans. This is the kind of change that makes the CLI feel polished. A few things:

1. PR title says REL-15756 but the branch is REL-12756
Typo in the title — feat(REL-15756) should be feat(REL-12756).

2. This is a plaintext format breaking change
Any script that parses the old bullet format (* name (key)) will break:

# This pattern stops working for flags, projects, environments, members, segments:
ldcli flags list --project my-proj -o plaintext | grep "^\* "

Research shows no known consumers parse plaintext programmatically (everyone uses -o json), so the practical risk is low. But it's still a format change for an existing output mode. Combined with #660's default-output change, this means scripts that neither set output format nor parse JSON get hit twice: different format AND different default.

3. CmdOutput now takes 5 parameters — time to consolidate

CmdOutput(action, outputKind, input, fields, opts)

fields should live inside CmdOutputOpts. You already have the opts struct; having fields as a separate parameter alongside it is inconsistent. This would also clean up every call site that currently passes nil, output.CmdOutputOpts{}.

4. Hardcoded column sets create a long tail of inconsistency
You've defined table columns for 5 resource types (flags, projects, environments, members, segments). The CLI has ~375 auto-generated commands. Everything else falls back to the old bullet format. This means ldcli flags list shows a beautiful table but ldcli segments list shows bullets — wait, segments is covered. But ldcli metrics list, ldcli contexts list, ldcli teams list all fall back. Is there a plan to auto-generate column definitions from the OpenAPI spec, or will this be a gradual manual process?

5. formatTimestamp drops the time component

// Parses RFC3339, outputs "2006-01-02"

For flags with recent changes, the date alone isn't very useful. "2026-03-17" tells me nothing about whether a flag was changed 2 minutes ago or 23 hours ago. Consider showing relative time for recent changes ("2h ago") and date for older ones, or at minimum including the time.

6. Tag truncation magic number
Tags are truncated at 3 items with .... This is fine UX, but the 3 is a magic number buried in the formatting function. A named constant would help readability.

7. Singular resource key-value format is a nice touch
The switch from Successfully updated name (key) to a proper key-value block with Key:, Name:, etc. is much better for both humans and agents reading plaintext. Good call.


Cross-cutting concern for the whole stack:

These 5 PRs together change: (1) default output format in non-TTY, (2) error JSON shape, (3) plaintext rendering format. The agent-prompts repo and sandbox-data-generator scripts are the two known consumers to validate against. The agent-prompts guide specifically teaches .code == 401 error checking which #661 changes.

Given ldcli uses semver and the v1→v2 bump was for an OpenAPI shape change, this stack probably warrants a v3 discussion — or at minimum a clear "Breaking Changes" section in the release notes.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants