You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* adding agent flag for agent telemtry
* (feat) adding TTY detection for auto-JSON output
* improvements
* addressing pr feedback
* feat(REL-12754): Agent friendly error handling (#661)
* [feat] Agent friendly error handling
* feat(REL-12755): adding --fields flag (#662)
* [feat] adding --fields flag
* feat(REL-15756): updating agent friendly and improved rich text output (#663)
feat(REL-15756) updating agent friendly and improved rich text output
* fix: update stale test assertions for key-value plaintext format
Three tests in root_test.go still asserted the old `name (key)` bullet
format, but the toggle-on command now passes ResourceName: "flags" which
triggers key-value output. Update to match the actual output shape.
Made-with: Cursor
* refactor: move fields into CmdOutputOpts, warn on plaintext --fields
Remove the standalone `fields []string` positional parameter from
CmdOutput and pass fields exclusively through CmdOutputOpts.Fields.
This eliminates the dual-path API and simplifies every call site.
Also emit a stderr warning when --fields is used with plaintext output,
since the flag is silently ignored in that mode.
Made-with: Cursor
* docs: document error shape and table format breaking changes in CHANGELOG
Add entries for the error JSON shape change (new statusCode/suggestion
fields, message casing) and the plaintext table format change. Both are
breaking changes that should be called out for v3.0.
Made-with: Cursor
Copy file name to clipboardExpand all lines: CHANGELOG.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,13 @@
1
1
# Changelog
2
2
3
+
## [Unreleased]
4
+
5
+
### ⚠ BREAKING CHANGES
6
+
7
+
* When stdout is not a TTY, the default `--output` format is now **json** instead of plaintext. Scripts that assumed plaintext when output was piped or redirected should set `LD_OUTPUT=plaintext`, run `ldcli config --set output plaintext`, or pass `--output plaintext` (or `--output json` explicitly if you want JSON regardless of TTY). You can also set **`FORCE_TTY`** or **`LD_FORCE_TTY`** to any non-empty value to keep plaintext as the default when stdout is not a TTY, without changing the saved `output` setting.
8
+
* Error responses now include `statusCode` (integer) and `suggestion` (string) fields in the JSON body. The `message` field for empty-body errors uses `http.StatusText` casing (e.g., `"Method Not Allowed"` instead of the previous `"method not allowed"`). If you parse error JSON from `ldcli`, update any assertions on the exact shape or casing.
9
+
* Plaintext list output for `flags`, `projects`, `environments`, `members`, and `segments` now renders as aligned tables instead of `* name (key)` bullets. Singular resources render as key-value blocks. If you parse plaintext output programmatically, switch to `--output json`.
Running this command creates a configuration file located at `$XDG_CONFIG_HOME/ldcli/config.yml` with the access token. Subsequent commands read from this file, so you do not need to specify the access token each time.
92
92
93
+
### Output format defaults
94
+
95
+
When you do not pass `--output` or `--json`, the default format depends on whether standard output is a terminal: **plaintext** in an interactive terminal, **json** when stdout is not a TTY (for example when piped, in CI, or in agent environments).
96
+
97
+
To force the plaintext default even when stdout is not a TTY, set either **`FORCE_TTY`** or **`LD_FORCE_TTY`** to any non-empty value (similar to tools that use `NO_COLOR`). That only affects the default; explicit `--output`, `--json`, `LD_OUTPUT`, and the `output` setting in your config file still apply.
98
+
99
+
**`LD_OUTPUT`** is the same setting as `output` in the config file, exposed as an environment variable (see the `LD_` prefix above). It is not new with TTY detection; the test suite locks in that it overrides the non-TTY JSON default when set to `plaintext`.
100
+
101
+
Effective output is resolved in this order: **`--json`** (if set, wins over `--output` when both are present), then **`--output`**, then **`LD_OUTPUT`**, then the **`output`** value from your config file, then the TTY-based default above.
CorsOriginFlagDescription="Allowed CORS origin. Use '*' for all origins (default: '*')"
43
53
DevStreamURIDescription="Streaming service endpoint that the dev server uses to obtain authoritative flag data. This may be a LaunchDarkly or Relay Proxy endpoint"
Copy file name to clipboardExpand all lines: cmd/config/testdata/help.golden
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ Supported settings:
9
9
- `dev-stream-uri`: Streaming service endpoint that the dev server uses to obtain authoritative flag data. This may be a LaunchDarkly or Relay Proxy endpoint
10
10
- `environment`: Default environment key
11
11
- `flag`: Default feature flag key
12
-
- `output`: Command response output format in either JSON or plain text
12
+
- `output`: Output format: json or plaintext (default: plaintext in a terminal, json otherwise)
13
13
- `port`: Port for the dev server to run on
14
14
- `project`: Default project key
15
15
- `sync-once`: Only sync new projects. Existing projects will neither be resynced nor have overrides specified by CLI flags applied.
@@ -27,5 +27,6 @@ Global Flags:
27
27
--access-token string LaunchDarkly access token with write-level access
28
28
--analytics-opt-out Opt out of analytics tracking
29
29
--base-uri string LaunchDarkly base URI (default "https://app.launchdarkly.com")
30
+
--fields strings Comma-separated list of top-level fields to include in JSON output (e.g., --fields key,name,kind)
30
31
--json Output JSON format (shorthand for --output json)
31
-
-o, --output string Command response output format in either JSON or plain text (default "plaintext")
32
+
-o, --output string Output format: json or plaintext (default: plaintext in a terminal, json otherwise) (default "plaintext")
0 commit comments