feat: add Firecrawl API key to setup wizard#145
feat: add Firecrawl API key to setup wizard#145udhaya10 wants to merge 2 commits intoparcadei:mainfrom
Conversation
- Add Firecrawl API key prompt to prompt_api_keys() - Write FIRECRAWL_API_KEY to .env via generate_env_file() - Needed by: firecrawl-scrape, research-agent, research-external skills Ref parcadei#141
|
PR author is not in the allowed authors list. |
📝 WalkthroughWalkthroughAdded Firecrawl API key handling to the setup wizard: Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
opc/scripts/setup/wizard.py (1)
623-623:⚠️ Potential issue | 🟡 MinorFallback
api_keysdict is missing the new"firecrawl"key.When the user skips API key configuration, the hardcoded fallback omits
"firecrawl". Whilegenerate_env_fileuses.get()so this won't crash, it's inconsistent withprompt_api_keys()which now always returns a"firecrawl"entry.Proposed fix
- api_keys = {"perplexity": "", "nia": "", "braintrust": ""} + api_keys = {"perplexity": "", "nia": "", "braintrust": "", "firecrawl": ""}
| lines.append(f"NIA_API_KEY={api_keys['nia']}") | ||
| if api_keys.get("braintrust"): | ||
| lines.append(f"BRAINTRUST_API_KEY={api_keys['braintrust']}") | ||
| if api_keys.get("firecrawl"): | ||
| lines.append(f"FIRECRAWL_API_KEY={api_keys['firecrawl']}") | ||
| lines.append("") | ||
|
|
||
| # Write file |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
The fallback dict when user declines API key config was missing the firecrawl key, creating inconsistency with prompt_api_keys() return. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
opc/scripts/setup/wizard.py (1)
406-425: Mask API key inputs to avoid echoing secrets.Add
password=Trueto allPrompt.ask()calls for API keys to hide typed input. This is a security best practice for secret entry.Suggested change
- perplexity = Prompt.ask("Perplexity API key (web search)", default="") - nia = Prompt.ask("Nia API key (documentation search)", default="") - braintrust = Prompt.ask("Braintrust API key (observability)", default="") - firecrawl = Prompt.ask("Firecrawl API key (web scraping)", default="") + perplexity = Prompt.ask("Perplexity API key (web search)", default="", password=True) + nia = Prompt.ask("Nia API key (documentation search)", default="", password=True) + braintrust = Prompt.ask("Braintrust API key (observability)", default="", password=True) + firecrawl = Prompt.ask("Firecrawl API key (web scraping)", default="", password=True)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@opc/scripts/setup/wizard.py` around lines 406 - 425, The Prompt.ask calls in prompt_api_keys currently echo API keys; update each Prompt.ask invocation for "perplexity", "nia", "braintrust", and "firecrawl" inside the prompt_api_keys function to pass password=True so inputs are masked; ensure all four calls use the password parameter while preserving their defaults and labels (e.g., Prompt.ask("Perplexity API key (web search)", default="", password=True)).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@opc/scripts/setup/wizard.py`:
- Around line 406-425: The Prompt.ask calls in prompt_api_keys currently echo
API keys; update each Prompt.ask invocation for "perplexity", "nia",
"braintrust", and "firecrawl" inside the prompt_api_keys function to pass
password=True so inputs are masked; ensure all four calls use the password
parameter while preserving their defaults and labels (e.g.,
Prompt.ask("Perplexity API key (web search)", default="", password=True)).
| lines.append(f"NIA_API_KEY={api_keys['nia']}") | ||
| if api_keys.get("braintrust"): | ||
| lines.append(f"BRAINTRUST_API_KEY={api_keys['braintrust']}") | ||
| if api_keys.get("firecrawl"): | ||
| lines.append(f"FIRECRAWL_API_KEY={api_keys['firecrawl']}") | ||
| lines.append("") | ||
|
|
||
| # Write file |
There was a problem hiding this comment.
Bug: The setup wizard writes FIRECRAWL_API_KEY to the project .env file, but firecrawl_scrape.py only reads from ~/.claude/.env when run standalone, causing authentication failure.
Severity: MEDIUM
Suggested Fix
Modify the load_api_key function in opc/scripts/mcp/firecrawl_scrape.py to also check for the API key in the project root's .env file (Path.cwd() / ".env"). This would align its behavior with other scripts like nia_docs.py and ensure the key is found regardless of how the script is invoked.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: opc/scripts/setup/wizard.py#L502-L509
Potential issue: The setup wizard in `wizard.py` writes the `FIRECRAWL_API_KEY` to the
project root's `.env` file. However, the `firecrawl_scrape.py` script's `load_api_key`
function only checks for the key in environment variables or the `~/.claude/.env` file.
This creates a discrepancy. If a user follows the setup wizard and then attempts to run
`firecrawl_scrape.py` as a standalone tool, as documented in its docstring, the script
will not find the API key, resulting in an authentication failure. While the script
works when invoked via the MCP server, the documented standalone usage is broken.
Summary
Add Firecrawl API key prompt to the setup wizard's
prompt_api_keys()function.Currently the wizard prompts for Perplexity, Nia, and Braintrust but skips Firecrawl, which is needed by 3 skills.
Changes
prompt_api_keys()— addFirecrawl API key (web scraping)promptgenerate_env_file()— writeFIRECRAWL_API_KEYto.envSkills unlocked
firecrawl-scraperesearch-agentresearch-externalAPI key from: https://www.firecrawl.dev
Test plan
FIRECRAWL_API_KEY=xxxappears in.envFIRECRAWL_API_KEYline in.envRef #141
Summary by CodeRabbit