Skip to content

Repository files navigation

webctl

CLI tool for browser automation and debugging, designed for AI agents.

Overview

webctl captures DevTools data (console logs, network requests, JS errors) that standard web fetching tools cannot access. CDP events are ephemeral - you must be listening when they occur. webctl solves this with a persistent daemon that buffers events for later query.

Installation

Homebrew (Linux/macOS)

brew tap p3bot/tap
brew trust p3bot/tap
brew install p3bot/tap/webctl

Build from Source

go build -o webctl ./cmd/webctl

Architecture

Daemon + stateless command model:

webctl start                    # Launch browser, buffer CDP events
webctl console                  # Query buffered console logs
webctl click ".selector"        # Send commands
webctl reload                   # Refresh current page
webctl stop                     # Clean shutdown

Status

Under active development.

Implemented

  • Daemon with CDP event buffering (console, network)
  • IPC via Unix socket
  • CLI framework (Cobra) with abbreviation expansion and JSON output
  • Lifecycle: start, stop (with --force reaper), status, clear
  • Navigation: navigate, reload, back, forward
  • Tabs: tab (list, switch, new, close)
  • Observation: html, markdown, css, console, network, cookies, screenshot, eval
  • Interaction: click, type, select, scroll, focus, key
  • Synchronisation: ready (page load, selector, network idle, JS condition)
  • Local server: serve (static files or reverse proxy with hot reload)

In Progress

  • webctl start --attach: connect to an existing CDP endpoint instead of launching a new browser

Commands

Category Commands
Lifecycle start, stop, status, clear
Navigation navigate, reload, back, forward
Tabs tab
Observation html, markdown, css, console, network, cookies, screenshot, eval
Interaction click, type, select, scroll, focus, key
Synchronisation ready
Local server serve

Agent Workflow

webctl start --headless &
webctl navigate https://localhost:3000
webctl console                             # Check for JS errors
# ... agent fixes code ...
webctl reload
webctl console                             # Verify fix
webctl stop

Companion Packages

The following software packages and systems work well when used side by side with webctl:

  • Snag: Snag web pages via Chromium/Chrome to markdown
  • Kagi: CLI access to the Kagi FastGPT internet search
  • agentation: Point at problems, not code

License

MPL-2.0

About

Browser automation and debugging CLI designed for AI agents

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages