Skip to content

fix(core): migrate Gemini CLI contextFileName to context.fileName#35581

Open
animeshxd wants to merge 1 commit intonrwl:masterfrom
animeshxd:fix/gemini-cli-context-config
Open

fix(core): migrate Gemini CLI contextFileName to context.fileName#35581
animeshxd wants to merge 1 commit intonrwl:masterfrom
animeshxd:fix/gemini-cli-context-config

Conversation

@animeshxd
Copy link
Copy Markdown

Current Behavior

Gemini CLI v0.3.0 and higher (google-gemini/gemini-cli#7244 ) no longer supports the top-level "contextFileName" key in .gemini/settings.json. Workspaces using the setup-ai-agents generator or the Nx Gemini integration write and read contextFileName in the old flat format, which is silently ignored by newer Gemini versions, causing the context file to not be picked up at all.

Additionally, context.fileName can be a string[] in the new API, but the existing code only handled string, meaning multi-file configurations were not supported.

Expected Behavior

  • The setup-ai-agents generator writes context configuration using the new nested format:
  "context": {
    "fileName": "AGENTS.md"
  }
  • Any existing contextFileName key found in .gemini/settings.json is automatically migrated to context.fileName when the generator runs, without overwriting an already-set context.fileName.
  • When context.fileName is a string[], the first entry is used as the primary file for writing agent rules.
  • utils.ts resolves the context file path by preferring context.fileName over the legacy contextFileName, with full support for both string and string[] values.
  • The root .gemini/settings.json is updated to use the new format.

Related Issue(s)

Fixes #

Gemini CLI v0.3.0+ no longer supports the "contextFileName" key at the top level of settings. It has been replaced with a nested "context" object.

This commit updates the `setup-ai-agents` generator and related utilities to:
- Use the new `context.fileName` structure.
- Automatically migrate existing `.gemini/settings.json` files to the new format.
- Support reading `context.fileName` when it is provided as an array of strings.
@animeshxd animeshxd requested a review from a team as a code owner May 5, 2026 20:16
@animeshxd animeshxd requested a review from leosvelperez May 5, 2026 20:16
@netlify
Copy link
Copy Markdown

netlify Bot commented May 5, 2026

👷 Deploy request for nx-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit e3a087e

@netlify
Copy link
Copy Markdown

netlify Bot commented May 5, 2026

👷 Deploy request for nx-dev pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit e3a087e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant