Skip to content

feat(http): label CLI requests with User-Agent#10

Merged
I-am-nothing merged 1 commit into
mainfrom
feat/cli-user-agent
May 3, 2026
Merged

feat(http): label CLI requests with User-Agent#10
I-am-nothing merged 1 commit into
mainfrom
feat/cli-user-agent

Conversation

@I-am-nothing

Copy link
Copy Markdown
Contributor

Companion to web-account's CLI session-label PR (incoming).

Why

Without a UA, the platform's session list shows the CLI as "Unknown browser on Unknown OS" (web-account's `parseUserAgent` only knows browser strings). Now every outbound request labels itself:

```
mirrorstack-cli/0.1.0 (macos; aarch64)
```

Same shape as curl, gh, brew. The web side (separate PR) detects the `mirrorstack-cli/` prefix and renders "MirrorStack CLI on macOS" in the sessions list.

What changed

  • New `src/http.rs` centralizes `reqwest::Client` construction with the right UA.
  • `commands/login.rs` + `api.rs` use `http::client(timeout)` — replaces the inline `Client::builder()...` calls.
  • Test added: `http::tests::user_agent_matches_expected_shape`.

Test plan

  • cargo build / test / clippy / fmt clean
  • 12 tests pass (was 11)

🤖 Generated with Claude Code

Without a UA the platform's session list could only see reqwest's
default placeholder, which the web-account /me/security page rendered
as "Unknown browser on Unknown OS". Now every outbound request from
the CLI carries:

  mirrorstack-cli/0.1.0 (macos; aarch64)

Centralized in a new src/http.rs module so login + whoami (and future
authed commands) all use the same Client builder. Companion change in
web-account parses this prefix and renders "MirrorStack CLI on macOS"
instead of falling through to the browser-UA branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@I-am-nothing I-am-nothing merged commit a6b1002 into main May 3, 2026
5 checks passed
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.

1 participant