diff --git a/examples/webhook.ts b/examples/webhook.ts index 5c6c5ad..f17e387 100755 --- a/examples/webhook.ts +++ b/examples/webhook.ts @@ -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 diff --git a/package.json b/package.json index 2674a5a..5373487 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/lib/bin/cli.ts b/src/lib/bin/cli.ts index 1550efb..e254c3b 100755 --- a/src/lib/bin/cli.ts +++ b/src/lib/bin/cli.ts @@ -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'; diff --git a/src/lib/bin/commands/listen.ts b/src/lib/bin/commands/listen.ts index d22dd28..ea391ea 100644 --- a/src/lib/bin/commands/listen.ts +++ b/src/lib/bin/commands/listen.ts @@ -12,8 +12,8 @@ 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 ', 'The endpoint to forward updates to.') - .action(async (options) => { + .argument('', 'The endpoint to forward updates to.') + .action(async (endpoint) => { // Auth const client = createBrowserUseClient(); @@ -21,7 +21,7 @@ export const listen = new Command('listen') // Proxy - const { dev: localTargetEndpoint } = options; + const localTargetEndpoint = endpoint; if (typeof localTargetEndpoint !== 'string') { // NOTE: This should never happen because the command is validated by commander. @@ -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', () => {