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 package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "firecrawl-cli",
"version": "1.4.0",
"version": "1.4.1",
"description": "Command-line interface for Firecrawl. Scrape, crawl, and extract data from any website directly from your terminal.",
"main": "dist/index.js",
"bin": {
Expand Down
14 changes: 2 additions & 12 deletions src/commands/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,24 +113,14 @@ export async function handleBrowserLaunch(

/**
* Execute a bash command locally with CDP_URL and SESSION_ID env vars.
* Auto-injects --cdp for agent-browser commands.
* agent-browser reads CDP_URL from the environment automatically.
*/
export function executeBashLocally(
command: string,
session: { id: string; cdpUrl: string }
): Promise<{ stdout: string; stderr: string; exitCode: number }> {
return new Promise((resolve) => {
// Auto-inject --cdp for agent-browser commands
let finalCommand = command;
if (command.startsWith('agent-browser') && !command.includes('--cdp')) {
const parts = command.split(' ');
// Insert --cdp after "agent-browser <subcommand>"
const insertIdx = Math.min(2, parts.length);
parts.splice(insertIdx, 0, '--cdp', `'${session.cdpUrl}'`);
finalCommand = parts.join(' ');
}

const child = spawn('sh', ['-c', finalCommand], {
const child = spawn('sh', ['-c', command], {
env: {
...process.env,
CDP_URL: session.cdpUrl,
Expand Down