Skip to content

fix(cli): reject --transport when combined with the tui subcommand - #44

Closed
CryptoJones wants to merge 2 commits into
mainfrom
fix/main-transport-tui
Closed

CryptoJones wants to merge 2 commits into
mainfrom
fix/main-transport-tui

Conversation

@CryptoJones

Copy link
Copy Markdown
Owner

Resolves #23. Independent of the other open PRs.

--transport defaulted to "stdio", so main() could not distinguish an explicitly-passed flag from the default — perplexity-agent --transport http tui checked args.command == "tui" first and launched the interactive UI, silently discarding --transport. On a headless host (e.g. a systemd unit edited to append tui) that swaps the hardened HTTP MCP server for an interactive TUI.

The --transport default is now a None sentinel; combining it with the tui subcommand is an argparse usage error (exit 2). Plain tui, plain server, and --transport http server modes are unchanged.

Tests

New test_main_transport_with_tui_is_rejected asserts the exit-2 usage error and that the TUI is not launched. Verified against the real entrypoint too. 81 passed, ruff + mypy --strict clean.

Closes #23.

🤖 Generated with Claude Code

CryptoJones and others added 2 commits June 12, 2026 09:38
`--transport` defaulted to "stdio", so `main()` couldn't tell an explicit flag
from the default and `perplexity-agent --transport http tui` silently ignored
--transport and launched the interactive TUI — e.g. on a headless host whose
unit file was edited to add `tui`. The default is now a None sentinel; pairing
--transport with the `tui` subcommand is an argparse usage error (exit 2).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The "# fail fast if the API key is missing" comment appeared verbatim on both
branches after the call was moved past the subcommand dispatch, reading as
accidental copy-paste. The tui-branch one now explains the ordering (loaded
after the arg check) instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@CryptoJones

Copy link
Copy Markdown
Owner Author

Superseded by #48 (re-targeted onto v0.2.0).

@CryptoJones
CryptoJones deleted the fix/main-transport-tui branch June 12, 2026 16:58
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.

perplexity-agent --transport http tui silently ignores --transport

1 participant