Relationships
#1753 Add SWAMP_CLI_OUTPUT env var to control default output mode (plaintext/tui/json)
Opened by shelson · 8/20/2026· Shipped 9/14/2026
Problem
Currently, to get non-interactive (plaintext/JSON) output from swamp, you must append --json to every single command. There is no way to set a persistent default. Conversely, if someone prefers the TUI but a script or alias uses --json, there is no env-var-based escape hatch either.
Additionally, the --log CLI option exists but appears to do nothing meaningful — it certainly doesn't switch to non-interactive output as its help text suggests. It should either be fixed or removed.
Proposed Solution
Introduce an environment variable SWAMP_CLI_OUTPUT with three values:
plaintext— default friendly terminal output (existing behavior, no TUI)tui— enable the interactive TUI (equivalent to what would be the default if TUI were on)json— emit JSON output for every command (equivalent to passing--jsonon every command)
If the env var is not set, behavior stays exactly as it is today (no change).
If the env var is set AND --json (or a future --plaintext/--tui) flag is passed on a specific invocation, the CLI flag wins — env var is a default, not a lockdown.
Bonus: Fix or Remove --log
The --log flag currently claims to enable "non-interactive" output but doesn't seem to actually do that. Options:
- Make
--logwork as advertised (output to a file, non-interactive mode) - Repurpose
--logto set a log level (debug/info/warn/error) whileSWAMP_CLI_OUTPUThandles the output mode - Remove
--logentirely if it's vestigial
Alternatives Considered
- Could add
--plaintext/--tuiCLI flags alongside--json, but an env var is the simplest single touchpoint for users who always want one mode. - Could detect
stdoutbeing a pipe/redirect and auto-switch to JSON, but that's brittle and doesn't cover all use cases.
Why This Matters
Users who script swamp or integrate it into other tooling currently have to remember --json on every call. An env var makes this ergonomic, CI-friendly, and discoverable.
Shipped
Click a lifecycle step above to view its details.