Skip to content

Show one-time ToS/Privacy disclaimer in Studio CLI and Studio Code#3763

Merged
sejas merged 4 commits into
trunkfrom
stu-1734-show-tos-disclaimer-in-studio-cli-and-studio-code
Jun 10, 2026
Merged

Show one-time ToS/Privacy disclaimer in Studio CLI and Studio Code#3763
sejas merged 4 commits into
trunkfrom
stu-1734-show-tos-disclaimer-in-studio-cli-and-studio-code

Conversation

@sejas

@sejas sejas commented Jun 10, 2026

Copy link
Copy Markdown
Member

Related issues

How AI was used in this PR

AI assisted with the implementation, tests, and code review passes.

Proposed Changes

It shows the terms of service and privacy policy the first time you execute a command. It doesn't stop the command from being executed it's just displayed above the command the first time.

Per legal guidelines, users must see a Terms of Service / Privacy Policy notice near the primary action the first time they use Studio from the terminal. Currently the CLI and Studio Code show no such notice.

  • The first time a user runs any Studio CLI command in an interactive terminal, a one-time boxed notice prints to stderr (mirroring the existing update alert): "By continuing, you agree to our Terms of Service and have read our Privacy Policy", with links to both documents. It never shows again afterwards.
  • In Studio Code (studio code / studio ai), the notice renders natively inside the TUI, right under the welcome logo, instead of the CLI banner.
  • The notice is careful never to get in the way or be silently consumed:
    • It writes to stderr only, so --json (NDJSON) output and piped stdout stay machine-clean.
    • Headless contexts defer rather than burn the one-time flag: runs spawned by the desktop app (which shows its own disclaimer), remote-session daemon turns, and any run where stderr is not a TTY (MCP clients, cron, redirects) skip the notice and let the next interactive run show it.
    • Failures reading/writing config or writing to a closed stderr never break the command.

Note: studio code sessions list/delete and other non-interactive invocations intentionally defer the notice to the next visible run.

Testing Instructions

Setup: npm install && npm run cli:build. To simulate a new user, remove the tosNoticeShownAt key from ~/.studio/cli.json.

CLI first run

  1. Run node apps/cli/dist/cli/main.mjs auth status in a real terminal.
  2. Expect a blue boxed disclaimer (stderr) before command output, with both URLs.
  3. ~/.studio/cli.json now contains tosNoticeShownAt; running the command again shows no banner.
Screenshot 2026-06-10 at 15 30 53

Studio Code TUI

  1. Remove the flag again, run node apps/cli/dist/cli/main.mjs code.
  2. Expect the dimmed disclaimer under the welcome logo (no stderr box). Flag persists; rerunning code shows nothing.
Screenshot 2026-06-10 at 15 21 10

Second and following times executed

  1. Run any command or node apps/cli/dist/cli/main.mjs code again
  2. Observe the message doesn't appear anymore
Screenshot 2026-06-10 at 15 23 00

Desktop app

  1. npm start, start a site, use Studio Code from the app — no CLI banner anywhere (IPC-spawned runs are suppressed). I'll create a follow-up for that.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@sejas sejas self-assigned this Jun 10, 2026
@sejas sejas marked this pull request as ready for review June 10, 2026 14:50
@sejas sejas requested review from a team, nightnei and youknowriad June 10, 2026 14:51

@nightnei nightnei left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and works as expected, I confirm that tosNoticeShownAt is set always correctly and I don't see the banner again.

Screenshot 2026-06-10 at 16 21 43 Screenshot 2026-06-10 at 16 22 49

@epeicher epeicher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sejas for adding this! I have tested it, and I can see the ToS when expected. LGTM!

studio auth command first time and second time studio code first time studio code second time
Image Image Image

@katinthehatsite

Copy link
Copy Markdown
Contributor

Some CodeQL actions were failing so I pushed an empty commit to trigger CI again.

@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 2c14418 vs trunk

app-size

Metric trunk 2c14418 Diff Change
App Size (Mac) 1358.08 MB 1358.09 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 2c14418 Diff Change
load 1648 ms 1667 ms +19 ms ⚪ 0.0%

site-startup

Metric trunk 2c14418 Diff Change
siteCreation 9030 ms 9493 ms +463 ms 🔴 5.1%
siteStartup 4395 ms 4394 ms 1 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

sejas added a commit that referenced this pull request Jun 10, 2026
- On the onboarding screen, the "By continuing, you agree to our Terms of Service and have read our Privacy Policy." notice was pinned to the bottom of the window, far from the actions it refers to. It now appears directly above the "Log in to WordPress.com" / "Skip" buttons, so users see the terms before continuing — matching the intent of the one-time ToS disclaimer work in #3763.
@sejas sejas merged commit 2736e98 into trunk Jun 10, 2026
12 checks passed
@sejas sejas deleted the stu-1734-show-tos-disclaimer-in-studio-cli-and-studio-code branch June 10, 2026 17:07
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.

5 participants