Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async function main() {
}

console.log('Starting Browser Use Webhook Example');
console.log('Run `browser-use listen --dev http://localhost:3000/webhook`!');
console.log('Run `browser-use listen http://localhost:3000/webhook`!');

// Start a Webhook Server

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"scripts": {
"test": "./scripts/test",
"build": "./scripts/build",
"postbuild": "chmod +x ./dist/lib/bin/cli.js",
"prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1",
"format": "./scripts/format",
"prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build && ./scripts/utils/git-swap.sh; fi",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/bin/cli.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S npm run tsn -T
#!/usr/bin/env node

import { program } from 'commander';
import { listen } from './commands/listen';
Expand Down
8 changes: 4 additions & 4 deletions src/lib/bin/commands/listen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ const tickRef: {

export const listen = new Command('listen')
.description(`Open a local webhook to receive Cloud API updates from the CLI on your local machine.`)
.option('-d, --dev <endpoint>', 'The endpoint to forward updates to.')
.action(async (options) => {
.argument('<endpoint>', 'The endpoint to forward updates to.')
.action(async (endpoint) => {
// Auth

const client = createBrowserUseClient();
const secret = getBrowserUseWebhookSecret();

// Proxy

const { dev: localTargetEndpoint } = options;
const localTargetEndpoint = endpoint;

if (typeof localTargetEndpoint !== 'string') {
// NOTE: This should never happen because the command is validated by commander.
Expand Down Expand Up @@ -158,7 +158,7 @@ export const listen = new Command('listen')
queue.current = delivery.filter((d) => d.delivery === 'rejected').map((d) => d.update);
}, 1_000);

console.log(`Listening in dev mode at: ${localTargetEndpoint}`);
console.log(`Forwarding updates to: ${localTargetEndpoint}!`);
});

process.on('SIGINT', () => {
Expand Down