Repository navigation
fix(cli): keep first-run commands from hanging or faking success without a terminal - #339
erikengervall wants to merge 10 commits into
Conversation
…ls before login in init -y
There was a problem hiding this comment.
All reported issues were addressed across 8 files
Shadow auto-approve: would not auto-approve because issues were found.
View guided diff | Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review |
@capy-ai[bot] I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 8 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Shadow auto-approve: would auto-approve. Focused first-run CLI fix: bare firecrawl shows help without a TTY, the shared login prompt rejects on closed stdin, and non-interactive init installs skills before auth. Tests pin the reorder and prompt rejections.
View guided diff | Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review |
@capy-ai[bot] I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 8 files
Confidence score: 4/5
- In
src/utils/auth.ts, the stdin-closed message recommendsfirecrawl login --browser, but that flow ignores the custom API URL. Use a custom-URL-specific message that recommends--api-keyorFIRECRAWL_API_KEYinstead.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/utils/auth.ts">
<violation number="1" location="src/utils/auth.ts:658">
P3: The custom-API manual flow now recommends `firecrawl login --browser` when stdin closes, but that browser path ignores the custom API URL. Use a custom-URL-specific message that recommends `--api-key`/`FIRECRAWL_API_KEY` or rerunning without `--method manual` to save the URL without a key.</violation>
</file>
Shadow auto-approve: would not auto-approve because issues were found.
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Shadow auto-approve: would require human review. Non-TTY first-run fixes (shared prompt, help fallback, init reorder) plus version bump, but a dismissed finding about the custom-API login error message is still unaddressed in the diff.
View guided diff | Turn on auto-fix | Re-trigger cubic
Three first-run fixes for people and agents running the CLI without a terminal. This builds on #338, which makes the login prompt fail when stdin ends; until #338 merges, this diff also shows its two files.
Bare
firecrawlwithout a terminalWith no API key,
firecrawlwith no arguments opened the onboarding auth picker even when stdin was not a terminal. The picker could not read input, printedError: User force closed the prompt with 0 null, and the process exited 0. Agents that probefirecrawlsaw a false success and no usage. Without a terminal, it now prints the banner and help, as it already does for an authenticated user. Interactive terminals keep the picker.One shared prompt
setup.tsandlaunch.tseach had their own copy of the readline prompt that the login flow used, with the same problem: when the input closed (Ctrl+D) the promise never settled and the process exited 0 mid-question. The prompt from #338 moves tosrc/utils/prompt.tsand all three callers use it. A closed input now rejects with a caller-specific message (setup defaultspoints at--agent/--yes,launchat passing the app name), and Ctrl+C exits 130.Skills before login in
init -y/--allThe documented agent setup line,
npx -y firecrawl-cli@latest init --all --browser, ran authentication first. Browser login waits up to five minutes for the user, so an agent whose shell command times out sooner never reached the skills step. Non-interactive init now installs the CLI and the skills first and authenticates last, and the step numbers follow that order. The interactive wizard is unchanged.Before and after, with an empty
HOMEand noFIRECRAWL_API_KEY:Bumps the version to 1.26.16, on top of the 1.26.15 that #336 shipped.
Testing
src/__tests__/commands/init.test.ts: in non-interactive init, the skills install runs before login, and a failed login still exits 1. It fails without the reorder.src/__tests__/utils/auth.test.tscovers the shared prompt through the login flow.pnpm test,pnpm type-check,pnpm format:check,pnpm build. I also ran the two commands above by hand on the built CLI.Summary by cubic
Fixes first-run CLI commands hanging or falsely succeeding when run without a terminal.
firecrawlwith no API key skips the interactive auth picker when stdin isn't a TTY and prints the banner and help instead.initnow installs the CLI and skills before authenticating, so an auth timeout can't prevent the skills step.Written for commit a885b63. Summary will update on new commits.
Found by Wildfire, Firecrawl's integration testing: these first-run hangs surfaced while reproducing the failing
cli-setup-mcpcheck.