Skip to content

fix(firebase-basics): fix non-interactive CLI auth, project selection, and web SDK config - #194

Open
Yuangwang wants to merge 3 commits into
firebase:mainfrom
Yuangwang:fix/firebase-basics-non-interactive-cli
Open

Yuangwang wants to merge 3 commits into
firebase:mainfrom
Yuangwang:fix/firebase-basics-non-interactive-cli

Conversation

@Yuangwang

@Yuangwang Yuangwang commented Sep 30, 2026 •

Copy link
Copy Markdown

Fixes three CLI commands in firebase-basics that fail when run by AI agents:

  • Check login:list before running login (since login fails in non-interactive shells even when already logged in).
  • Create firebase.json before running firebase use <PROJECT_ID> (since use fails if firebase.json is missing).
  • Pass the required WEB argument in apps:sdkconfig WEB <APP_ID> and check apps:list WEB first before creating a duplicate app.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Firebase setup instructions in SKILL.md and web_setup.md to improve robustness for automated agents, such as checking login status prior to authentication, ensuring firebase.json exists before running firebase use, and correctly specifying the WEB platform argument for SDK configurations. The review feedback suggests a more robust method for initializing firebase.json to avoid creating duplicate empty files when running in subdirectories of existing projects.

Comment thread skills/firebase-basics/SKILL.md Outdated

```bash
[ -f firebase.json ] || echo "{}" > firebase.json

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

If the agent is running in a subdirectory of an existing Firebase project, [ -f firebase.json ] will evaluate to false (since the file is in the parent directory), causing it to write a duplicate, empty firebase.json in the subdirectory. This can interfere with other Firebase CLI commands. A more robust approach is to attempt running firebase use first, and only initialize firebase.json if the command fails specifically with a "could not locate firebase.json" error.

Suggested change
[ -f firebase.json ] || echo "{}" > firebase.json
npx -y firebase-tools@latest use <PROJECT_ID> 2>&1 | grep -q "could not locate firebase.json" && echo "{}" > firebase.json && npx -y firebase-tools@latest use <PROJECT_ID>

This branch has not been deployed

No deployments
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