Skip to content

Commit 5628118

Browse files
authored
Merge pull request #14 from browser-use/fix/cli
fix: Fix Browser Use CLI
2 parents cfda83f + 132bc96 commit 5628118

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

examples/webhook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async function main() {
3434
}
3535

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

3939
// Start a Webhook Server
4040

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"scripts": {
2020
"test": "./scripts/test",
2121
"build": "./scripts/build",
22+
"postbuild": "chmod +x ./dist/lib/bin/cli.js",
2223
"prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1",
2324
"format": "./scripts/format",
2425
"prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build && ./scripts/utils/git-swap.sh; fi",

src/lib/bin/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env -S npm run tsn -T
1+
#!/usr/bin/env node
22

33
import { program } from 'commander';
44
import { listen } from './commands/listen';

src/lib/bin/commands/listen.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ const tickRef: {
1212

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

1919
const client = createBrowserUseClient();
2020
const secret = getBrowserUseWebhookSecret();
2121

2222
// Proxy
2323

24-
const { dev: localTargetEndpoint } = options;
24+
const localTargetEndpoint = endpoint;
2525

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

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

164164
process.on('SIGINT', () => {

0 commit comments

Comments
 (0)