Conversation
…, and web SDK config
There was a problem hiding this comment.
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.
|
|
||
| ```bash | ||
| [ -f firebase.json ] || echo "{}" > firebase.json |
There was a problem hiding this comment.
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.
| [ -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> |
Fixes three CLI commands in
firebase-basicsthat fail when run by AI agents:login:listbefore runninglogin(sinceloginfails in non-interactive shells even when already logged in).firebase.jsonbefore runningfirebase use <PROJECT_ID>(sinceusefails iffirebase.jsonis missing).WEBargument inapps:sdkconfig WEB <APP_ID>and checkapps:list WEBfirst before creating a duplicate app.