Skip to content

Commit 13db8a1

Browse files
authored
feat(genkit-tools/cli): Support Firebase Studio (#3430)
1 parent 12b392f commit 13db8a1

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import { AIToolConfigResult, AIToolModule, InitConfigOptions } from '../types';
18+
import { getGenkitContext, updateContentInPlace } from '../utils';
19+
20+
const RULES_PATH = '.idx/airules.md';
21+
22+
export const studio: AIToolModule = {
23+
name: 'studio',
24+
displayName: 'Firebase Studio',
25+
26+
/**
27+
* Configures Firebase Studio (Project IDX) with Genkit context.
28+
*
29+
* - .idx/airules.md: Updates Firebase section only (preserves user content)
30+
*
31+
* Interactive prompts are shown since this file may contain user-defined
32+
* AI rules and instructions that we must preserve. We only manage the
33+
* Genkit-specific section marked with our XML tags.
34+
*/
35+
async configure(options?: InitConfigOptions): Promise<AIToolConfigResult> {
36+
const files: AIToolConfigResult['files'] = [];
37+
const content = getGenkitContext();
38+
const { updated } = await updateContentInPlace(RULES_PATH, content);
39+
files.push({ path: RULES_PATH, updated });
40+
return { files };
41+
},
42+
};

genkit-tools/cli/src/commands/init-ai-tools/command.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ import { claude } from './ai-tools/claude';
2222
import { cursor } from './ai-tools/cursor';
2323
import { gemini } from './ai-tools/gemini';
2424
import { generic } from './ai-tools/generic';
25+
import { studio } from './ai-tools/studio';
2526
import { AIToolChoice, AIToolModule, InitConfigOptions } from './types';
2627

2728
/** Set of all supported AI tools that can be configured (incl. a generic
2829
* configuration) */
2930
export const AI_TOOLS: Record<string, AIToolModule> = {
3031
gemini,
32+
studio,
3133
claude,
3234
cursor,
3335
generic,

genkit-tools/cli/src/commands/init-ai-tools/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export interface AIToolConfigResult {
2626
/** `init:ai-tools` config options. */
2727
export interface InitConfigOptions {
2828
// yes (non-interactive) mode.
29-
yesMode: boolean;
29+
yesMode?: boolean;
3030
}
3131

3232
/** Interface for supported AI tools */

0 commit comments

Comments
 (0)