Skip to content

feat(auth): tag login signup link with CLI attribution via OSC 8 (DX-5765)#37

Merged
johnpmitsch merged 1 commit into
mainfrom
dx-5765-add-cli-attribution-utm-params-to-qn-auth-login-signup-link
Jun 16, 2026
Merged

feat(auth): tag login signup link with CLI attribution via OSC 8 (DX-5765)#37
johnpmitsch merged 1 commit into
mainfrom
dx-5765-add-cli-attribution-utm-params-to-qn-auth-login-signup-link

Conversation

@johnpmitsch

Copy link
Copy Markdown
Collaborator

Summary

The qn auth login welcome message prints a signup link. We want clicks on it to carry CLI attribution params (utm_source=cli, utm_medium=cli, utm_campaign=clams) — without showing the params to the user.

A plain-text terminal line can't separate the displayed text from the click target, so this uses an OSC 8 terminal hyperlink: the visible text stays the clean https://www.quicknode.com/signup, while the clickable target carries the UTM params. In terminals that don't support OSC 8 (or when styling is disabled), the line degrades to the clean URL with no params — the intended "don't show to the user" behavior.

  • New pub(crate) fn osc8_link(url, text) helper in src/output.rs (no new dependency — the escape is a one-line string).
  • SIGNUP_URL / SIGNUP_URL_TAGGED constants in src/commands/auth.rs keep the visible URL and the tagged target in sync.
  • Hyperlink vs. plain text is chosen with the same suppression rules color uses: --no-color, NO_COLOR set, or TERM=dumb. The welcome only prints on the interactive TTY path, so no extra TTY check is needed.
  • The dashboard/api-keys link is unchanged.

Test plan

  • cargo test — 116 lib tests pass (9 new), all integration suites green.
  • cargo clippy --all-targets -- -D warnings — clean.
  • cargo fmt --check — clean.
  • cargo build --release — no warnings.
  • New unit tests cover: OSC 8 escape framing, divergent display/target text, the tagged URL extending the clean URL with all three UTM params (drift guard), and the suppression decision (--no-color / NO_COLOR / TERM=dumb → plain clean URL).
  • Manual TTY check: in an OSC 8-capable terminal the signup line shows the clean URL and the click target carries the UTM params; with NO_COLOR=1 / TERM=dumb it prints the clean URL as plain text.

Closes DX-5765

…5765)

The `qn auth login` welcome prints a signup link. Carry CLI attribution
params (utm_source/utm_medium/utm_campaign) on the click target while
keeping the visible URL clean, using an OSC 8 terminal hyperlink: the
displayed text stays https://www.quicknode.com/signup and the link target
holds the params.

Add a pub(crate) `osc8_link(url, text)` helper in output.rs. In auth.rs,
define the clean and tagged URLs as constants and pick hyperlink vs. plain
text using the same suppression rules as color (--no-color, NO_COLOR,
TERM=dumb); when suppressed the line degrades to the clean plain URL with
no params. The dashboard link is unchanged.

Adds 9 unit tests (osc8 framing, divergent display/target, URL-param
guard, suppression decision). 116 lib tests pass.
@johnpmitsch johnpmitsch merged commit 4e05616 into main Jun 16, 2026
13 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.

2 participants