hyperframes icon indicating copy to clipboard operation
hyperframes copied to clipboard

feat(cli): add --no-open flag to preview and play commands

Open na-navi opened this issue 6 months ago • 1 comments

Problem

hyperframes preview and hyperframes play always open the system default browser on startup.

This is problematic for agent-driven workflows where the browser session is managed separately (e.g., Chrome DevTools Protocol, remote debugging, headless automation).

When an agent or script starts a preview server, the automatically opened browser window:

  • Conflicts with an existing managed browser session
  • Cannot be easily closed without human intervention
  • Breaks automated test pipelines that expect no GUI

Proposed Solution

Add a --no-open flag to both preview and play commands:

npx hyperframes preview --no-open
npx hyperframes play --no-open

This should start the server without calling open() (or equivalent) to launch the browser.

Why This Matters

HyperFrames is positioned as agent-oriented. Agents often need to control the browser lifecycle explicitly. Automatically opening the default browser makes agent-driven workflows brittle.

A concrete scenario: an agent runs hyperframes preview --no-open, waits for HTTP 200, then connects via Chrome DevTools Protocol on a separate managed browser instance. The current behavior makes this impossible without manual cleanup.

Scope

  • packages/cli/src/commands/preview.ts — guard all 4 import("open") calls behind the flag
  • packages/cli/src/commands/play.ts — guard the import("open") call behind the flag
  • Both commands should accept --no-open as a boolean argument, defaulting to false

Alternative

A --browser <browser> flag would also help, but --no-open is the smallest and safest primitive that covers the agent use case without changing existing behavior for human users.

na-navi avatar May 15 '26 15:05 na-navi

Opened in wrong repo. Will reopen from fork.

na-navi avatar May 15 '26 15:05 na-navi