Commit Graph

4 Commits

Author SHA1 Message Date
Nikhil
64b25c1610 fix: resolve dev runner port conflicts (#422)
* fix: resolve dev runner port conflicts

* fix: address PR review comments for dev_runner_port_fallback
2026-03-05 15:52:12 -08:00
Nikhil
010fb88b56 fix: handle SIGQUIT in dev:watch to prevent runtime crash on macOS (#405)
SIGQUIT (Ctrl+\) was not in the signal notify list, causing Go's default
handler to dump goroutines. On macOS ARM64 this triggers a known runtime
bug where semasleep panics on the signal stack.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 12:09:19 -08:00
Nikhil
acb7dfc624 fix: pass user data dir to WXT when using dev:watch --new (#403)
The --new flag creates a fresh temp profile directory but WXT's
chromiumProfile was hardcoded to /tmp/browseros-dev, ignoring it.
Pass BROWSEROS_USER_DATA_DIR env var from the Go dev tool and read
it in web-ext.config.ts.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 10:58:43 -08:00
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