Skip to content
Closed
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
46 changes: 46 additions & 0 deletions src/__tests__/cli-argv.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,4 +270,50 @@ describe('CLI argv parsing', () => {
expect(result.stderr).not.toContain('unknown command');
}
);

testWithBuiltCli(
'warns on stderr that browser is deprecated, for the command and its subcommands',
() => {
const offline = [
'--api-key',
'fc-test',
'--api-url',
'http://127.0.0.1:9',
];
for (const [args, status] of [
[['browser', ...offline], 0],
[['browser', 'list', ...offline], 1],
] as const) {
const result = spawnSync(process.execPath, [cliPath, ...args], {
encoding: 'utf8',
env: { ...process.env, FIRECRAWL_NO_UPDATE_CHECK: '1' },
});
expect(result.status).toBe(status);
expect(result.stderr).toContain(
'`firecrawl browser` is deprecated and will be removed'
);
expect(result.stderr).toContain('firecrawl interact');
expect(result.stdout).not.toContain('deprecated and will be removed');
}
}
);

testWithBuiltCli(
'shows the browser deprecation warning in browser help and subcommand help',
() => {
for (const args of [
['browser', '--help'],
['browser', 'list', '--help'],
]) {
const result = spawnSync(process.execPath, [cliPath, ...args], {
encoding: 'utf8',
env: { ...process.env, FIRECRAWL_NO_UPDATE_CHECK: '1' },
});
expect(result.status).toBe(0);
expect(result.stdout).toContain(
'`firecrawl browser` is deprecated and will be removed'
);
}
}
);
});
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2229,6 +2229,8 @@ function createAgentCommand(): Command {
* Create and configure the browser command (deprecated — prefer scrape + interact)
*/
function createBrowserCommand(): Command {
const deprecationWarning =
'Warning: `firecrawl browser` is deprecated and will be removed in a future release. Use `firecrawl scrape <url>`, then `firecrawl interact "<prompt>"` or `firecrawl interact -c "<code>"`. See `firecrawl interact --help`.';
const browserCmd = new Command('browser')
.description(
'[Deprecated: prefer scrape + interact] Launch cloud browser sessions and execute code remotely via Playwright'
Expand All @@ -2249,6 +2251,10 @@ function createBrowserCommand(): Command {
)
.option('-o, --output <path>', 'Output file path (default: stdout)')
.option('--json', 'Output as JSON format', false)
.hook('preAction', () => {
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
Resolved
process.stderr.write(`${deprecationWarning}\n`);
})
.addHelpText('beforeAll', `${deprecationWarning}\n`)
.action(async (code, options) => {
if (code) {
await handleBrowserQuickExecute({
Expand Down
Loading