oh-my-webbridge Docs
Skip to Content

CLI

Commands of the omw daemon and command line client.

Developer preview

omw is in developer preview and iterating rapidly. THERE WILL BE COMPATIBILITY-BREAKING CHANGES.

omw is the Go daemon and its command line client. It listens on 127.0.0.1:17373 and has no option to bind another address or a network interface. serve and start run the daemon. stop, status, doctor, pair and call need one already running. connection, skill, install-skill, service install, version and help work without it.

CommandPurpose
omw serveRun the daemon in the foreground.
omw startStart a background daemon; safe to run when one is running.
omw stopStop the daemon and leave tabs open.
omw statusPrint the daemon status and one line per browser.
omw doctorSame as status, plus the configuration path.
omw pairPrint a pairing code for a browser extension.
omw connectionPrint the endpoint, token and protocol version.
omw callSend one action to a session.
omw service installInstall a launchd or systemd user service.
omw install-skillWrite the bundled agent guide below a directory.
omw skillPrint the bundled agent guide.
omw versionPrint the daemon version.
omw helpPrint the command list.

Every command exits with status 0 on success. On failure it prints omw: and the error to stderr, then exits with status 1.

serve

omw serve [--cdp ws://127.0.0.1:9222/devtools/browser/...]

Runs the daemon in the foreground until SIGINT or SIGTERM. The listener is fixed at 127.0.0.1:17373. If config.json names another address, the daemon refuses to start.

--cdp points the daemon at a Chrome browser endpoint already running with remote debugging. The URL must start with ws:// or wss:// and carry a host. With this flag, /devtools/browser proxies that endpoint; see CDP.

The endpoint is not written to config.json. A cdp field already present in that file is read at startup, and the flag replaces it for that process.

start

omw start

Starts omw serve in a new session, detached from the terminal, with OMW_HOME set to the configuration directory. Output goes to daemon.log in that directory. The file is emptied on every start. The command waits about two seconds for the daemon to answer /status.

It prints started on success and already running when the daemon answers on the port. When another process holds the port, or the token does not match, it reports a port or credential mismatch and exits with status 1. When the new daemon does not answer in that window, it prints the contents of daemon.log.

stop

omw stop

Sends POST /shutdown and prints the reply, {"stopping":true}. Tabs that sessions opened stay open. Bindings in bindings.json are kept.

status and doctor

omw status
omw doctor

Both print the daemon's /status JSON to stdout and one line per browser to stderr:

chrome: connected (156.0.8078.80)
firefox: not connected

doctor adds the path of config.json to stderr before those lines.

status is an authenticated request. Without a running daemon it exits with status 1 and the connection error.

pair

omw pair

Asks the daemon for a pairing code and prints it in two groups of three digits:

Enter this code in the oh-my-webbridge extension:

    482 913

It works once and expires in 5 minutes.

The code is valid for 5 minutes and 5 attempts. The command polls the daemon every 500 ms and prints Paired with Chrome. or Paired with Firefox. when the extension redeems the code. It exits with status 1 when the code expires. Without a running daemon it prints the hint to run omw start.

connection

omw connection

Prints one JSON object:

{
  "endpoint": "ws://127.0.0.1:17373/extension",
  "token": "64 hex characters",
  "protocol": 1
}

The token is 32 random bytes in hex, the same value that config.json holds. It authorizes every request other than GET /ping and POST /pair, including WebSocket upgrades and CDP connections. Treat it as a secret: do not paste it into issues, logs or pages.

call

omw call [--browser chrome|firefox] [--timeout-ms N] SESSION ACTION [JSON|-]

Sends one action to the daemon and prints its JSON reply. The session name is 1 to 96 letters (including CJK), digits, _, . or -. ACTION is one of the actions in the action reference.

The optional third argument is a JSON object with the action arguments. With -, the command reads that object from stdin, up to 2 MiB. Without it, the daemon receives {}.

omw call research navigate '{"url":"https://example.com/"}'
echo '{"selector":"#submit"}' | omw call --browser firefox form click -

--browser sends the action to the named browser. Without it the daemon routes by the session binding, then the only connected browser, then Chrome.

--timeout-ms sets the command deadline, 1 to 120000 milliseconds, as timeoutMs does in the request body. Without it the deadline is 30 seconds.

omw call --timeout-ms 5000 research wait '{"selector":"#done"}'

Flags come before the session name. Put -- before a session name that starts with -.

The client waits up to 125 seconds. The reply is printed as the daemon sends it. An HTTP status of 400 or above makes the command exit with status 1 after printing the reply.

service install

omw service install

Installs a user service that runs omw serve at login, with OMW_HOME set to the configuration directory the command used.

PlatformFileActivation
macOS~/Library/LaunchAgents/app.oh-my-webbridge.plistlaunchctl bootstrap gui/$UID
Linux~/.config/systemd/user/oh-my-webbridge.servicesystemctl --user daemon-reload, then systemctl --user enable --now oh-my-webbridge.service

The service keeps the daemon running: KeepAlive on macOS, Restart=on-failure with a 3 second delay on Linux. Output is discarded on macOS; the systemd unit keeps the default journal.

install-skill and skill

omw install-skill DIRECTORY
omw skill

install-skill writes the bundled agent guide to DIRECTORY/oh-my-webbridge/SKILL.md with mode 0600, and creates the directory with mode 0700. It refuses to overwrite an existing file.

skill prints the same guide to stdout.

omw install-skill ~/.agents/skills

version and help

omw version
omw --version
omw help

version prints the daemon version. help, --help and a bare omw print the command list.

An unknown command prints omw: unknown command "NAME"; run omw help and exits with status 1.

Configuration directory

The directory is resolved in this order:

  1. OMW_HOME, when set.
  2. macOS: ~/Library/Application Support/oh-my-webbridge.
  3. Linux: $XDG_CONFIG_HOME/oh-my-webbridge, or ~/.config/oh-my-webbridge when XDG_CONFIG_HOME is unset.

The CLI, the daemon, the user service and the SDK all read the same directory. Every command that reads the configuration creates it with mode 0700 when it is missing.

FileContents
config.jsontoken (64 hex characters), address, and an optional cdp endpoint. Created with mode 0600 on first use.
bindings.jsonSession to browser bindings, mode 0600, read at startup.
daemon.logOutput of the daemon started by omw start, emptied on every start.
artifacts/Screenshots and PDFs saved without an explicit path.

The token in config.json is the only credential. Anyone who reads the file can drive the paired browsers, so keep the directory private and do not copy config.json between machines.

Contributors

Page history