From 2d0520b770789b9a52bcee0041d93578503d8231 Mon Sep 17 00:00:00 2001 From: Chris Tate Date: Sat, 10 Jan 2026 11:33:37 -0600 Subject: [PATCH] init --- .gitignore | 33 +++++ README.md | 123 +++++++++++++++++++ bin/veb | 2 + package.json | 34 ++++++ src/actions.ts | 310 +++++++++++++++++++++++++++++++++++++++++++++++ src/browser.ts | 95 +++++++++++++++ src/client.ts | 147 ++++++++++++++++++++++ src/daemon.ts | 161 ++++++++++++++++++++++++ src/index.ts | 316 ++++++++++++++++++++++++++++++++++++++++++++++++ src/protocol.ts | 176 +++++++++++++++++++++++++++ src/types.ts | 160 ++++++++++++++++++++++++ tsconfig.json | 19 +++ 12 files changed, 1576 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100755 bin/veb create mode 100644 package.json create mode 100644 src/actions.ts create mode 100644 src/browser.ts create mode 100644 src/client.ts create mode 100644 src/daemon.ts create mode 100644 src/index.ts create mode 100644 src/protocol.ts create mode 100644 src/types.ts create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d322e88 --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +# Dependencies +node_modules/ + +# Build output +dist/ + +# Logs +*.log +npm-debug.log* + +# IDE +.idea/ +.vscode/ +*.swp +*.swo + +# OS +.DS_Store +Thumbs.db + +# Test artifacts +*.png +*.jpeg +*.jpg + +# Package manager +pnpm-lock.yaml +package-lock.json +yarn.lock + +# Environment +.env +.env.local diff --git a/README.md b/README.md new file mode 100644 index 0000000..c9db724 --- /dev/null +++ b/README.md @@ -0,0 +1,123 @@ +# veb + +Headless browser automation CLI for agents and humans. + +## Installation + +```bash +pnpm install +npx playwright install chromium +pnpm build +``` + +## Usage + +```bash +# Open a URL (auto-starts browser daemon) +veb open https://example.com + +# Click elements +veb click "#submit-btn" +veb click "text=Sign In" + +# Type into inputs +veb type "#email" hello@example.com +veb type "#search" "search query" + +# Press keyboard keys +veb press Enter +veb press Tab + +# Wait for things +veb wait "#loading" # wait for selector +veb wait --text "Welcome" # wait for text +veb wait 2000 # wait 2 seconds + +# Take screenshots +veb screenshot page.png +veb screenshot --full page.png # full page +veb screenshot -s "#hero" # specific element + +# Get accessibility snapshot (great for AI agents) +veb snapshot + +# Extract HTML content +veb extract "table" +veb extract "#main" + +# Evaluate JavaScript +veb eval "document.title" +veb eval "window.location.href" + +# Scroll the page +veb scroll down 500 +veb scroll up +veb scroll -s "#container" down + +# Interact with dropdowns +veb select "#country" "US" + +# Hover over elements +veb hover "#menu" + +# Close browser (stops daemon) +veb close +``` + +## Agent Mode + +Use `--json` flag for machine-readable output: + +```bash +veb open https://example.com --json +# {"id":"abc123","success":true,"data":{"url":"https://example.com/","title":"Example Domain"}} + +veb snapshot --json +# {"id":"def456","success":true,"data":{"snapshot":"..."}} +``` + +## How It Works + +veb runs a background daemon that keeps the browser open between commands. The first command automatically starts the daemon. Use `veb close` to shut it down. + +## Commands Reference + +| Command | Description | +|---------|-------------| +| `open ` | Navigate to a URL | +| `click ` | Click an element | +| `type ` | Type text into an element | +| `press ` | Press a keyboard key | +| `wait ` | Wait for condition | +| `screenshot [path]` | Take a screenshot | +| `snapshot` | Get accessibility tree | +| `extract ` | Get element HTML | +| `eval