Skip to content

feat: add firebase init aitools command. #8807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/scripts/webframeworks-deploy-tests/angular/**
/scripts/webframeworks-deploy-tests/nextjs/**
/src/frameworks/docs/**
/prompts

# Intentionally invalid YAML file:
/src/test/fixtures/extension-yamls/invalid/extension.yaml
19 changes: 16 additions & 3 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"cross-spawn": "^7.0.5",
"csv-parse": "^5.0.4",
"deep-equal-in-any-order": "^2.0.6",
"diff": "^5.0.0",

Choose a reason for hiding this comment

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

medium

The diff package is added as a dependency, but it doesn't seem to be used anywhere in the codebase. To keep dependencies minimal, please remove it if it's not needed.

"exegesis": "^4.2.0",
"exegesis-express": "^4.0.0",
"express": "^4.16.4",
Expand Down Expand Up @@ -189,6 +190,7 @@
"@types/cors": "^2.8.10",
"@types/cross-spawn": "^6.0.1",
"@types/deep-equal-in-any-order": "^1.0.3",
"@types/diff": "^5.0.0",

Choose a reason for hiding this comment

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

medium

The @types/diff package is added as a dev dependency, but the diff package doesn't seem to be used. This can be removed along with the diff dependency.

"@types/express": "^4.17.0",
"@types/express-serve-static-core": "^4.17.8",
"@types/fs-extra": "^9.0.13",
Expand Down
122 changes: 122 additions & 0 deletions prompts/FIREBASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Firebase CLI Context

<project-structure>
```
project/
├── firebase.json # Main configuration
├── .firebaserc # Project aliases
├── firestore.rules # Security rules
├── functions/ # Cloud Functions
├── public/ # Hosting files
└── firebase-debug.log # Created when CLI commands fail
```
</project-structure>

## Common Commands

<example>
```bash
# Initialize new features
firebase init hosting
firebase init functions
firebase init firestore

# Deploy everything or specific services

firebase deploy
firebase deploy --only hosting
firebase deploy --only functions:processOrder,functions:sendEmail
firebase deploy --except functions

# Switch between projects

firebase use staging
firebase use production

````
</example>

## Local Development

<example>
```bash
# Start all emulators
firebase emulators:start

# Start specific emulators
firebase emulators:start --only functions,firestore

# Common emulator URLs
# Emulator UI: http://localhost:4000
# Functions: http://localhost:5001
# Firestore: http://localhost:8080
# Hosting: http://localhost:5000
````

</example>

## Debugging Failed Commands

<example>
```bash
# When any firebase command fails
cat firebase-debug.log # Contains detailed error traces

# Common fixes for errors in debug log

firebase login --reauth # Fix authentication errors
firebase use # Fix wrong project errors

````
</example>

## Complete Workflow Example

<example>
```bash
# Clone and setup a Firebase project
git clone https://github.com/example/my-app
cd my-app

# Initialize Firebase in existing project
firebase init

# Start local development
firebase emulators:start

# Make changes, then deploy to staging
firebase use staging
firebase deploy

# Deploy to production
firebase use production
firebase deploy --only hosting,firestore
````

</example>

## Service Detection in firebase.json

<example>
```json
{
"hosting": {
"public": "dist",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
},
"functions": {
"source": "functions",
"runtime": "nodejs20"
},
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"emulators": {
"functions": { "port": 5001 },
"firestore": { "port": 8080 },
"hosting": { "port": 5000 }
}
}
```
</example>
Loading
Loading