Skip to content

Commit 1d3e49a

Browse files
taeoldgemini-code-assist[bot]joehan
authored
Expose firebase init aitools command (#8949)
* fix(init): update Claude AIToolModule for latest Claude Code compatibility Updates MCP server configuration to use .mcp.json instead of deprecated .claude/settings.local.json. Updates to use CLAUDE.md instead of deprecated CLAUDE.local.md. Fixes compatibility with Claude Code 1.0.69+. * feat(init): expose aitools command Adds firebase init:aitools to available commands. Fixes formatting in FIREBASE.md prompt file. * fix(init): register aitools in command choices Adds aitools to init command choices array so it's recognized as valid feature. Marked as hidden to keep it from public menu while in development. * Update src/init/features/aitools/claude.ts Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * style * add changelog. --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Joe Hanley <[email protected]>
1 parent 839b99a commit 1d3e49a

File tree

6 files changed

+23
-13
lines changed

6 files changed

+23
-13
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
- Fixed issue where `__name__` fields with DESCENDING order were incorrectly filtered from index listings, causing duplicate index issues (#7629) and deployment conflicts (#8859). The fix now preserves `__name__` fields with explicit DESCENDING order while filtering out implicit ASCENDING `__name__` fields.
12
- Fixed an issue where `firebase init dataconnect` didn't enable the Data Connect API by default (#8927).
3+
- Add firebase init aitools to help developers set up Firebase AI tools in their projects (#8949).
24
- Updated the Firebase Data Connect local toolkit to v2.11.0, which includes the following changes (#8948):
35
- [Fixed] Kotlin code generation with enums
46
- [Fixed] Deploying schemas with enums would report false breaking changes

prompts/FIREBASE.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ firebase deploy --except functions
3232

3333
firebase use staging
3434
firebase use production
35-
36-
````
35+
```
3736
</example>
3837

3938
## Local Development

src/commands/init.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ if (isEnabled("apptesting")) {
116116
});
117117
}
118118

119+
choices.push({
120+
value: "aitools",
121+
name: "AI Tools: Configure AI coding assistants to work with your Firebase project",
122+
checked: false,
123+
hidden: true,
124+
});
125+
119126
const featureNames = choices.map((choice) => choice.value);
120127

121128
const HELP = `Interactively configure the current directory as a Firebase project or initialize new features in an already configured Firebase project directory.

src/init/features/aitools/claude.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { Config } from "../../../config";
22
import { AIToolModule, AIToolConfigResult } from "./types";
33
import { updateFirebaseSection } from "./promptUpdater";
44

5-
const CLAUDE_SETTINGS_PATH = ".claude/settings.local.json";
6-
const CLAUDE_PROMPT_PATH = "CLAUDE.local.md";
5+
const MCP_CONFIG_PATH = ".mcp.json";
6+
const CLAUDE_PROMPT_PATH = "CLAUDE.md";
77

88
export const claude: AIToolModule = {
99
name: "claude",
@@ -12,8 +12,8 @@ export const claude: AIToolModule = {
1212
/**
1313
* Configures Claude Code with Firebase context.
1414
*
15-
* - .claude/settings.local.json: Merges with existing config (preserves user settings)
16-
* - CLAUDE.local.md: Updates Firebase section only (preserves user content)
15+
* - .mcp.json: Merges with existing MCP server config (preserves user settings)
16+
* - CLAUDE.md: Updates Firebase section only (preserves user content)
1717
*/
1818
async configure(
1919
config: Config,
@@ -22,11 +22,11 @@ export const claude: AIToolModule = {
2222
): Promise<AIToolConfigResult> {
2323
const files: AIToolConfigResult["files"] = [];
2424

25-
// Handle MCP configuration - merge with existing if present
26-
let existingConfig: any = {};
27-
let settingsUpdated = false;
25+
// Handle MCP configuration in .mcp.json - merge with existing if present
26+
let existingConfig: { mcpServers?: Record<string, { command: string; args: string[] }> } = {};
27+
let mcpUpdated = false;
2828
try {
29-
const existingContent = config.readProjectFile(CLAUDE_SETTINGS_PATH);
29+
const existingContent = config.readProjectFile(MCP_CONFIG_PATH);
3030
if (existingContent) {
3131
existingConfig = JSON.parse(existingContent);
3232
}
@@ -43,11 +43,11 @@ export const claude: AIToolModule = {
4343
command: "npx",
4444
args: ["-y", "firebase-tools", "experimental:mcp", "--dir", projectPath],
4545
};
46-
config.writeProjectFile(CLAUDE_SETTINGS_PATH, JSON.stringify(existingConfig, null, 2));
47-
settingsUpdated = true;
46+
config.writeProjectFile(MCP_CONFIG_PATH, JSON.stringify(existingConfig, null, 2));
47+
mcpUpdated = true;
4848
}
4949

50-
files.push({ path: CLAUDE_SETTINGS_PATH, updated: settingsUpdated });
50+
files.push({ path: MCP_CONFIG_PATH, updated: mcpUpdated });
5151

5252
const { updated } = await updateFirebaseSection(config, CLAUDE_PROMPT_PATH, enabledFeatures, {
5353
interactive: true,

src/init/features/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ export {
3636
RequiredInfo as ApptestingInfo,
3737
actuate as apptestingAcutate,
3838
} from "./apptesting";
39+
export { doSetup as aitools } from "./aitools";

src/init/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ const featuresList: Feature[] = [
8787
askQuestions: features.apptestingAskQuestions,
8888
actuate: features.apptestingAcutate,
8989
},
90+
{ name: "aitools", displayName: "AI Tools", doSetup: features.aitools },
9091
];
9192

9293
const featureMap = new Map(featuresList.map((feature) => [feature.name, feature]));

0 commit comments

Comments
 (0)