()
| 327 | } |
| 328 | |
| 329 | async function main() { |
| 330 | const command = process.argv[2]; |
| 331 | |
| 332 | console.log(` |
| 333 | ${color("cyan", color("bright", "OpenCode Browser v4"))} |
| 334 | ${color("cyan", "Browser automation plugin (native messaging + per-tab ownership)")} |
| 335 | `); |
| 336 | |
| 337 | if (command === "install") { |
| 338 | await install(); |
| 339 | } else if (command === "update") { |
| 340 | await update(); |
| 341 | } else if (command === "uninstall") { |
| 342 | await uninstall(); |
| 343 | } else if (command === "status") { |
| 344 | await status(); |
| 345 | } else if (command === "agent-install") { |
| 346 | await agentInstall(); |
| 347 | } else if (command === "agent-gateway") { |
| 348 | await agentGateway(); |
| 349 | } else { |
| 350 | log(` |
| 351 | ${color("bright", "Usage:")} |
| 352 | npx @different-ai/opencode-browser install |
| 353 | npx @different-ai/opencode-browser update |
| 354 | npx @different-ai/opencode-browser status |
| 355 | npx @different-ai/opencode-browser uninstall |
| 356 | npx @different-ai/opencode-browser agent-install |
| 357 | npx @different-ai/opencode-browser agent-gateway |
| 358 | |
| 359 | ${color("bright", "Options:")} |
| 360 | --extension-id <id> (or OPENCODE_BROWSER_EXTENSION_ID) |
| 361 | |
| 362 | ${color("bright", "Quick Start:")} |
| 363 | 1. Run: npx @different-ai/opencode-browser install |
| 364 | 2. Restart OpenCode |
| 365 | 3. Use: browser_navigate / browser_click / browser_snapshot |
| 366 | |
| 367 | ${color("bright", "Agent Mode:")} |
| 368 | 1. Run: npx @different-ai/opencode-browser agent-install |
| 369 | 2. Set OPENCODE_BROWSER_BACKEND=agent |
| 370 | 3. Optionally run: npx @different-ai/opencode-browser agent-gateway |
| 371 | `); |
| 372 | } |
| 373 | |
| 374 | rl.close(); |
| 375 | } |
| 376 | |
| 377 | async function install() { |
| 378 | header("Step 1: Check Platform"); |
no test coverage detected