diff --git a/genkit-tools/cli/src/commands/init-ai-tools/ai-tools/studio.ts b/genkit-tools/cli/src/commands/init-ai-tools/ai-tools/studio.ts new file mode 100644 index 0000000000..500818a1d7 --- /dev/null +++ b/genkit-tools/cli/src/commands/init-ai-tools/ai-tools/studio.ts @@ -0,0 +1,42 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AIToolConfigResult, AIToolModule, InitConfigOptions } from '../types'; +import { getGenkitContext, updateContentInPlace } from '../utils'; + +const RULES_PATH = '.idx/airules.md'; + +export const studio: AIToolModule = { + name: 'studio', + displayName: 'Firebase Studio', + + /** + * Configures Firebase Studio (Project IDX) with Genkit context. + * + * - .idx/airules.md: Updates Firebase section only (preserves user content) + * + * Interactive prompts are shown since this file may contain user-defined + * AI rules and instructions that we must preserve. We only manage the + * Genkit-specific section marked with our XML tags. + */ + async configure(options?: InitConfigOptions): Promise { + const files: AIToolConfigResult['files'] = []; + const content = getGenkitContext(); + const { updated } = await updateContentInPlace(RULES_PATH, content); + files.push({ path: RULES_PATH, updated }); + return { files }; + }, +}; diff --git a/genkit-tools/cli/src/commands/init-ai-tools/command.ts b/genkit-tools/cli/src/commands/init-ai-tools/command.ts index 5d1071938a..400e00c694 100644 --- a/genkit-tools/cli/src/commands/init-ai-tools/command.ts +++ b/genkit-tools/cli/src/commands/init-ai-tools/command.ts @@ -22,12 +22,14 @@ import { claude } from './ai-tools/claude'; import { cursor } from './ai-tools/cursor'; import { gemini } from './ai-tools/gemini'; import { generic } from './ai-tools/generic'; +import { studio } from './ai-tools/studio'; import { AIToolChoice, AIToolModule, InitConfigOptions } from './types'; /** Set of all supported AI tools that can be configured (incl. a generic * configuration) */ export const AI_TOOLS: Record = { gemini, + studio, claude, cursor, generic, diff --git a/genkit-tools/cli/src/commands/init-ai-tools/types.ts b/genkit-tools/cli/src/commands/init-ai-tools/types.ts index 18ab730205..64ec5b3f60 100644 --- a/genkit-tools/cli/src/commands/init-ai-tools/types.ts +++ b/genkit-tools/cli/src/commands/init-ai-tools/types.ts @@ -26,7 +26,7 @@ export interface AIToolConfigResult { /** `init:ai-tools` config options. */ export interface InitConfigOptions { // yes (non-interactive) mode. - yesMode: boolean; + yesMode?: boolean; } /** Interface for supported AI tools */