Files
BrowserOS/tools/dev/browser
Nikhil 899d322a8b feat: unified browseros-dev CLI for dev & test workflows (#389)
* feat: replace flaky TypeScript dev:watch with Go CLI (devwatch)

The Bun-based scripts/dev/start.ts orchestrator had fundamental issues with
WXT when launched via `bun run --filter` with cwd manipulation. This replaces
it with a Go CLI at tools/devwatch/ that provides:

- Process supervision with auto-restart on crash
- Colored log streaming with [tag] prefixes
- Automatic port discovery (--new flag)
- Fresh user-data directory creation
- Process group management for clean shutdown (SIGTERM → SIGKILL escalation)
- CDP readiness polling before starting the server

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: run agent codegen before wxt and add force-kill on double Ctrl+C

- Run graphql-codegen if generated/graphql/ doesn't exist, matching the
  agent's own `dev` script behavior
- Second Ctrl+C sends SIGKILL to all process groups and exits immediately,
  so you're never stuck in a restart loop

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add run.sh wrapper that checks for Go and prompts to install

If Go isn't installed, shows a clear message with install instructions
(brew install go / go.dev/dl). Also skips rebuilding if the binary
already exists and main.go hasn't changed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore: show double Ctrl+C hint at startup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: swap ANSI escape codes for fatih/color

Adds proper TTY detection, NO_COLOR env var support, and cleaner
color API. Also improves help output with bold/dim styling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: restructure devwatch into browseros-dev CLI with cobra subcommands

Expands the single-file devwatch into a modular CLI with three subcommands:
- `watch` — dev environment with process supervision (port of devwatch)
- `test` — start test env, run bun test, clean up (replaces TS test helpers)
- `cleanup` — kill ports + remove orphaned temp dirs (replaces cleanup.sh)

Shared Go packages for browser lifecycle (CDP polling, arg building),
server health checks (health + extension status), and process management
(managed proc, port killing, streaming, monorepo root finding).

Fixes PR #389 feedback:
- Add timeout after SIGKILL in Stop() to prevent indefinite hang
- Fix run.sh freshness check to detect changes in all .go files
- Add double Ctrl+C force-kill to test command
- Guard test cleanup with sync.Once to prevent race condition

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore: replace run.sh freshness logic with Makefile

Make handles timestamp-based dependency tracking natively. The Makefile
rebuilds only when any .go file, go.mod, or go.sum is newer than the
binary. run.sh just checks for Go, calls make, and execs the binary.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 16:45:59 -08:00
..