Skip to content

feat: add Firecrawl API key to setup wizard#145

Open
udhaya10 wants to merge 2 commits intoparcadei:mainfrom
udhaya10:feat/wizard-firecrawl-api-key
Open

feat: add Firecrawl API key to setup wizard#145
udhaya10 wants to merge 2 commits intoparcadei:mainfrom
udhaya10:feat/wizard-firecrawl-api-key

Conversation

@udhaya10
Copy link
Copy Markdown

@udhaya10 udhaya10 commented Feb 15, 2026

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() — add Firecrawl API key (web scraping) prompt
  • generate_env_file() — write FIRECRAWL_API_KEY to .env

Skills unlocked

Skill Impact when Firecrawl missing
firecrawl-scrape Broken — cannot scrape web pages
research-agent Degraded — loses doc scraping
research-external Degraded — skips doc scraping phase

API key from: https://www.firecrawl.dev

Test plan

  • Run wizard → Step 4 now shows Firecrawl prompt
  • Enter key → verify FIRECRAWL_API_KEY=xxx appears in .env
  • Skip (Enter) → verify no FIRECRAWL_API_KEY line in .env

Ref #141

Summary by CodeRabbit

  • New Features
    • Setup wizard now supports adding a Firecrawl API key during onboarding.
    • Provided Firecrawl key is automatically written to the environment configuration file.
    • Wizard defaults include an empty Firecrawl API key slot so it can be configured later.

- 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
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Feb 15, 2026

PR author is not in the allowed authors list.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 15, 2026

📝 Walkthrough

Walkthrough

Added Firecrawl API key handling to the setup wizard: prompt_api_keys() now collects and returns a firecrawl key; generate_env_file() writes FIRECRAWL_API_KEY to the .env when provided; wizard defaults now include "firecrawl": "" in api_keys.

Changes

Cohort / File(s) Summary
Firecrawl API Key Integration
opc/scripts/setup/wizard.py
Added firecrawl to prompt_api_keys() return shape and to default api_keys; updated generate_env_file() to emit FIRECRAWL_API_KEY when config["api_keys"]["firecrawl"] is non-empty.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding Firecrawl API key support to the setup wizard.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 | 🟡 Minor

Fallback api_keys dict is missing the new "firecrawl" key.

When the user skips API key configuration, the hardcoded fallback omits "firecrawl". While generate_env_file uses .get() so this won't crash, it's inconsistent with prompt_api_keys() which now always returns a "firecrawl" entry.

Proposed fix
-        api_keys = {"perplexity": "", "nia": "", "braintrust": ""}
+        api_keys = {"perplexity": "", "nia": "", "braintrust": "", "firecrawl": ""}

Comment on lines 502 to 509
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.

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>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
opc/scripts/setup/wizard.py (1)

406-425: Mask API key inputs to avoid echoing secrets.

Add password=True to all Prompt.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)).

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6b28a99 and 1f34de8.

📒 Files selected for processing (1)
  • opc/scripts/setup/wizard.py

Comment on lines 502 to 509
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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant