Skip to content

feat: add Antigravity profile with MCP auto-configuration#1682

Open
adrhardtke wants to merge 6 commits intoeyaltoledano:mainfrom
adrhardtke:feat/add-antigravity-init-setup
Open

feat: add Antigravity profile with MCP auto-configuration#1682
adrhardtke wants to merge 6 commits intoeyaltoledano:mainfrom
adrhardtke:feat/add-antigravity-init-setup

Conversation

@adrhardtke
Copy link
Copy Markdown

@adrhardtke adrhardtke commented Apr 6, 2026

What type of PR is this?

  • 🐛 Bug fix
  • ✨ Feature
  • 🔌 Integration
  • 📝 Docs
  • 🧹 Refactor
  • Other:

Description

This PR adds a new Antigravity profile integration to the task-master init command, enabling automatic MCP (Model Context Protocol) configuration for projects using the Antigravity IDE.

Key features:

  • Adds antigravity as a selectable profile in task-master init
  • Automatically creates .gemini/antigravity/mcp_config.json in the project root
  • Integrates task-master-ai MCP server into the configuration
  • Supports non-destructive updates (preserves existing MCP servers)
  • Implements automatic detection with (detected) status
  • Follows existing profile architecture and lifecycle hooks

Technical highlights:

  • New profile module with lifecycle hooks (isInstalled, onAddRulesProfile, onRemoveRulesProfile)
  • Detection via filesystem marker: .gemini/antigravity/mcp_config.json
  • Safe JSON merge strategy for MCP configuration
  • Full integration with existing profile registry and CLI flow

Related Issues

N/A (new feature)


How to Test This

# Install dependencies
npm install

# Build project
npm run build

# Run init
task-master init

Steps:

  1. Select Antigravity from the profile list

  2. Verify file creation:

    .gemini/antigravity/mcp_config.json
    
  3. Confirm task-master-ai MCP server is added

  4. Re-run task-master init → should show (detected)

Expected result:

  • Antigravity appears as an option
  • MCP config is created or updated safely
  • Existing configs are preserved
  • Detection works correctly

Contributor Checklist

  • Created changeset: npm run changeset
  • Tests pass: npm test
  • Format check passes
  • Addressed CodeRabbit comments (if any)
  • Linked related issues (if any)
  • Manually tested the changes

Changelog Entry

Added Antigravity IDE profile with automatic MCP configuration and detection support.


Summary by CodeRabbit

  • New Features

    • Added an "Antigravity" initialization profile that can create and manage a local MCP configuration for the app, with detection and removal capabilities.
  • Tests

    • Added unit tests to verify the Antigravity profile is registered and exposes expected metadata.
  • Chores

    • Normalized JSON configuration formatting across project files.

- Add antigravity profile that creates .gemini/antigravity/mcp_config.json
- Implement custom lifecycle hooks for MCP server configuration
- Add task-master-ai server with npx command and project root env var
- Support non-destructive updates to existing MCP configs
- Add marker detection for .gemini/antigravity/mcp_config.json
- Enable '(detected)' status in task-master init profile selection
- Integrate with existing IDE detection system
- Document minor version bump for new Antigravity profile
- Describe MCP config creation in project root directory
- Add test case for antigravity profile validation
- Test profile structure and configuration
- Ensure profile is properly exported and accessible
- Remove unused ANTIGRAVITY_CONFIG_FILE constant from paths.js
- Update .taskmaster/config.json with profile changes
- Ensure clean configuration state after profile implementation
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 6, 2026

🦋 Changeset detected

Latest commit: f908c0f

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 6, 2026

📝 Walkthrough

Walkthrough

Adds a new "Antigravity" rules profile that manages an MCP config at the user home path (~/.gemini/antigravity/mcp_config.json) with detection, add, and remove handlers, registry/export updates, unit tests, and a changeset entry.

Changes

Cohort / File(s) Summary
New Antigravity Profile
src/profiles/antigravity.js
New profile module implementing isInstalled, onAddRulesProfile, and onRemoveRulesProfile to read/write ~/.gemini/antigravity/mcp_config.json, create/remove directories, and invoke npx -y task-master-ai mcp-server when creating the server entry.
Profile Registry & Types
src/constants/profiles.js, src/profiles/index.js
Added 'antigravity' to RULE_PROFILES and RulesProfile typedef; re-exported antigravityProfile from profiles index.
Detection Map
packages/tm-profiles/src/detection/profiles-map.ts
Added an IDE_MARKER entry for antigravity (profileName: 'antigravity', displayName: 'Antigravity', markers: []).
Config & Formatting
.taskmaster/config.json, src/constants/paths.js
Reformatted .taskmaster/config.json whitespace/indentation (content unchanged); added a blank line in src/constants/paths.js (no functional change).
Changeset & Tests
.changeset/add-antigravity-profile.md, tests/unit/profiles.test.js
Added changeset marking a minor release for task-master-ai and unit test asserting antigravity is registered and has expected fields.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant CLI as "Profiles module"
participant FS as "Filesystem (~/.gemini)"
participant NPX as "npx / task-master-ai"
participant MCP as "mcp_config.json"
CLI->>FS: ensure ~/.gemini/antigravity exists
CLI->>MCP: read existing mcp_config.json
alt server missing
CLI->>NPX: run npx -y task-master-ai mcp-server (creates server entry)
NPX-->>CLI: server object
CLI->>MCP: insert task-master-ai server and write file
else server present
CLI-->>MCP: no write (already configured)
end
CLI->>FS: best-effort cleanup on remove (delete entries/directories)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • Crunchyman-ralph
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main change: introducing an Antigravity profile with MCP auto-configuration, which directly matches the primary objective of adding a new IDE profile for automatic MCP setup.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.taskmaster/config.json:
- Around line 1-46: The commit contains manual edits to the managed "models"
configuration (entries "main", "research", "fallback") in the generated config
file; revert these manual changes and update model configuration using the
supported workflow instead: undo the edits to the managed config, then run the
official CLI command (task-master models) or use the models MCP tool to apply
the desired provider/modelId/maxTokens/temperature changes so the managed file
is updated correctly and remains consistent with the toolchain.

In `@src/profiles/antigravity.js`:
- Line 16: The isInstalled check currently returns the server object or
undefined (config.mcpServers && config.mcpServers['task-master-ai']), so change
it to return a strict boolean by wrapping the expression with Boolean(...);
update the return in the isInstalled function to return
Boolean(config.mcpServers && config.mcpServers['task-master-ai']) so callers
always get true/false rather than an object or undefined.
- Around line 97-99: The current code unconditionally removes the entire MCP
config file when config.mcpServers is empty; instead, check whether other
top-level keys exist before deleting: if Object.keys(config.mcpServers).length
=== 0 then remove only the mcpServers key from config and write the updated
config back to disk, and only call fs.rmSync(mcpConfigPath, { force: true }) if
Object.keys(config).length === 0 (no other keys remain); update the log calls
accordingly (use log('info', ...) when deleting the file and when updating the
config) so unrelated user settings are not lost.
- Around line 15-16: Replace direct fs.readFileSync/fs.writeFileSync usage with
the project's readJSON and writeJSON utilities when accessing the MCP config:
call readJSON(mcpConfigPath) to load the config, use the returned object (e.g.,
check config.mcpServers && config.mcpServers['task-master-ai']), and use
writeJSON(mcpConfigPath, config) when persisting changes; ensure you propagate
or handle errors the utilities provide. Update all similar occurrences that
operate on mcpConfigPath (the instances at the noted locations) so they use
readJSON/writeJSON and maintain the same logic around config.mcpServers and the
'task-master-ai' key.

In `@tests/unit/profiles.test.js`:
- Line 10: The test assertion for profile.mcpConfig in
tests/unit/profiles.test.js is inverted; update the expectation to assert true
instead of false. Locate the failing assertion
(expect(profile.mcpConfig).toBe(false)) and change it to
expect(profile.mcpConfig).toBe(true) so it matches the antigravity profile's
mcpConfig value set to true.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: acfc799d-3857-4c08-bb40-b28fbc9615a9

📥 Commits

Reviewing files that changed from the base of the PR and between 1c7365c and 56babd8.

📒 Files selected for processing (8)
  • .changeset/add-antigravity-profile.md
  • .taskmaster/config.json
  • packages/tm-profiles/src/detection/profiles-map.ts
  • src/constants/paths.js
  • src/constants/profiles.js
  • src/profiles/antigravity.js
  • src/profiles/index.js
  • tests/unit/profiles.test.js

Comment on lines 1 to +46
{
"models": {
"main": {
"provider": "claude-code",
"modelId": "opus",
"maxTokens": 32000,
"temperature": 0.2
},
"research": {
"provider": "perplexity",
"modelId": "sonar-reasoning-pro",
"maxTokens": 8700,
"temperature": 0.1
},
"fallback": {
"provider": "claude-code",
"modelId": "sonnet",
"maxTokens": 64000,
"temperature": 0.2
}
},
"global": {
"logLevel": "silent",
"debug": false,
"defaultNumTasks": 10,
"defaultSubtasks": 5,
"defaultPriority": "medium",
"projectName": "Taskmaster",
"ollamaBaseURL": "http://localhost:11434/api",
"bedrockBaseURL": "https://bedrock.us-east-1.amazonaws.com",
"responseLanguage": "English",
"enableCodebaseAnalysis": true,
"enableProxy": false,
"anonymousTelemetry": true,
"userId": "1234567890",
"azureBaseURL": "https://your-endpoint.azure.com/",
"defaultTag": "master"
},
"claudeCode": {},
"codexCli": {},
"grokCli": {
"timeout": 120000,
"workingDirectory": null,
"defaultModel": "grok-4-latest"
}
}
"models": {
"main": {
"provider": "claude-code",
"modelId": "opus",
"maxTokens": 32000,
"temperature": 0.2
},
"research": {
"provider": "perplexity",
"modelId": "sonar-reasoning-pro",
"maxTokens": 8700,
"temperature": 0.1
},
"fallback": {
"provider": "claude-code",
"modelId": "sonnet",
"maxTokens": 64000,
"temperature": 0.2
}
},
"global": {
"logLevel": "silent",
"debug": false,
"defaultNumTasks": 10,
"defaultSubtasks": 5,
"defaultPriority": "medium",
"projectName": "Taskmaster",
"ollamaBaseURL": "http://localhost:11434/api",
"bedrockBaseURL": "https://bedrock.us-east-1.amazonaws.com",
"responseLanguage": "English",
"enableCodebaseAnalysis": true,
"enableProxy": false,
"anonymousTelemetry": true,
"userId": "1234567890",
"azureBaseURL": "https://your-endpoint.azure.com/",
"defaultTag": "master"
},
"claudeCode": {},
"codexCli": {},
"grokCli": {
"timeout": 120000,
"workingDirectory": null,
"defaultModel": "grok-4-latest"
}
} No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Avoid manual edits to .taskmaster/config.json.

This looks like formatting-only churn in a managed file; please update this via the supported command flow instead of direct edits.

As per coding guidelines: "Do not manually edit .taskmaster/config.json; use task-master models command or models MCP tool to manage configuration."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.taskmaster/config.json around lines 1 - 46, The commit contains manual
edits to the managed "models" configuration (entries "main", "research",
"fallback") in the generated config file; revert these manual changes and update
model configuration using the supported workflow instead: undo the edits to the
managed config, then run the official CLI command (task-master models) or use
the models MCP tool to apply the desired provider/modelId/maxTokens/temperature
changes so the managed file is updated correctly and remains consistent with the
toolchain.

Comment on lines +15 to +16
const config = JSON.parse(fs.readFileSync(mcpConfigPath, 'utf8'));
return config.mcpServers && config.mcpServers['task-master-ai'];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Use shared readJSON/writeJSON utilities for MCP config file operations.

The current direct fs.readFileSync/fs.writeFileSync usage bypasses the project’s JSON I/O standard and centralized error/validation handling.

As per coding guidelines: "Use readJSON and writeJSON utilities for all JSON file operations instead of raw fs.readFileSync or fs.writeFileSync."

Also applies to: 40-40, 60-60, 76-76, 92-92, 102-102

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/profiles/antigravity.js` around lines 15 - 16, Replace direct
fs.readFileSync/fs.writeFileSync usage with the project's readJSON and writeJSON
utilities when accessing the MCP config: call readJSON(mcpConfigPath) to load
the config, use the returned object (e.g., check config.mcpServers &&
config.mcpServers['task-master-ai']), and use writeJSON(mcpConfigPath, config)
when persisting changes; ensure you propagate or handle errors the utilities
provide. Update all similar occurrences that operate on mcpConfigPath (the
instances at the noted locations) so they use readJSON/writeJSON and maintain
the same logic around config.mcpServers and the 'task-master-ai' key.

}

const config = JSON.parse(fs.readFileSync(mcpConfigPath, 'utf8'));
return config.mcpServers && config.mcpServers['task-master-ai'];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

isInstalled should return a strict boolean.

On Line 16, the function currently returns the server object or undefined, not true/false. Returning Boolean(...) avoids type ambiguity.

Suggested fix
-		return config.mcpServers && config.mcpServers['task-master-ai'];
+		return Boolean(config?.mcpServers?.['task-master-ai']);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return config.mcpServers && config.mcpServers['task-master-ai'];
return Boolean(config?.mcpServers?.['task-master-ai']);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/profiles/antigravity.js` at line 16, The isInstalled check currently
returns the server object or undefined (config.mcpServers &&
config.mcpServers['task-master-ai']), so change it to return a strict boolean by
wrapping the expression with Boolean(...); update the return in the isInstalled
function to return Boolean(config.mcpServers &&
config.mcpServers['task-master-ai']) so callers always get true/false rather
than an object or undefined.

Comment on lines +97 to +99
if (Object.keys(config.mcpServers).length === 0) {
fs.rmSync(mcpConfigPath, { force: true });
log('info', `[Antigravity] Removed empty MCP config file`);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Avoid deleting the whole config file when non-server keys may still exist.

If mcpServers becomes empty but other top-level settings are present, removing the file drops unrelated user config.

Suggested fix
-				// If no servers left, remove the file
-				if (Object.keys(config.mcpServers).length === 0) {
-					fs.rmSync(mcpConfigPath, { force: true });
-					log('info', `[Antigravity] Removed empty MCP config file`);
+				// If no servers left, only remove file when config is otherwise empty
+				if (Object.keys(config.mcpServers).length === 0) {
+					delete config.mcpServers;
+					if (Object.keys(config).length === 0) {
+						fs.rmSync(mcpConfigPath, { force: true });
+						log('info', `[Antigravity] Removed empty MCP config file`);
+					} else {
+						fs.writeFileSync(mcpConfigPath, JSON.stringify(config, null, 2) + '\n');
+						log('info', `[Antigravity] Removed Task Master from MCP config`);
+					}
 				} else {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/profiles/antigravity.js` around lines 97 - 99, The current code
unconditionally removes the entire MCP config file when config.mcpServers is
empty; instead, check whether other top-level keys exist before deleting: if
Object.keys(config.mcpServers).length === 0 then remove only the mcpServers key
from config and write the updated config back to disk, and only call
fs.rmSync(mcpConfigPath, { force: true }) if Object.keys(config).length === 0
(no other keys remain); update the log calls accordingly (use log('info', ...)
when deleting the file and when updating the config) so unrelated user settings
are not lost.

const profile = getRulesProfile('antigravity');
expect(profile).toBeDefined();
expect(profile.displayName).toBe('Antigravity');
expect(profile.mcpConfig).toBe(false);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

mcpConfig assertion is inverted.

On Line 10, toBe(false) conflicts with the profile definition (src/profiles/antigravity.js, Line 134 sets mcpConfig: true), so this test should assert true.

Suggested fix
-		expect(profile.mcpConfig).toBe(false);
+		expect(profile.mcpConfig).toBe(true);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
expect(profile.mcpConfig).toBe(false);
expect(profile.mcpConfig).toBe(true);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/unit/profiles.test.js` at line 10, The test assertion for
profile.mcpConfig in tests/unit/profiles.test.js is inverted; update the
expectation to assert true instead of false. Locate the failing assertion
(expect(profile.mcpConfig).toBe(false)) and change it to
expect(profile.mcpConfig).toBe(true) so it matches the antigravity profile's
mcpConfig value set to true.

- Move MCP config from project root .gemini/antigravity/mcp_config.json to ~/.gemini/antigravity/mcp_config.json
- Update isInstalled, onAdd, and onRemove functions to use os.homedir()
- Remove project markers for global profile detection
- Update changeset and documentation to reflect global config location
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (3)
src/profiles/antigravity.js (3)

17-17: ⚠️ Potential issue | 🟡 Minor

Return a strict boolean from isInstalled.

Line 17 currently returns an object/undefined expression instead of true/false, which makes the profile detection contract ambiguous.

Suggested fix
-		return config.mcpServers && config.mcpServers['task-master-ai'];
+		return Boolean(config?.mcpServers?.['task-master-ai']);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/profiles/antigravity.js` at line 17, The isInstalled function currently
returns the raw truthy/undefined expression config.mcpServers &&
config.mcpServers['task-master-ai'], which can be an object or undefined; change
it to return a strict boolean by coercing the result (e.g., use Boolean(...) or
!!) so isInstalled always returns true or false when checking
config.mcpServers['task-master-ai'] in the isInstalled function.

97-100: ⚠️ Potential issue | 🟠 Major

Do not delete the entire config file just because mcpServers is empty.

If other top-level settings exist, removing the file causes data loss for unrelated user configuration.

Suggested fix
-				// If no servers left, remove the file
-				if (Object.keys(config.mcpServers).length === 0) {
-					fs.rmSync(mcpConfigPath, { force: true });
-					log('info', `[Antigravity] Removed empty MCP config file`);
+				// If no servers left, remove mcpServers key and delete file only if config is fully empty
+				if (Object.keys(config.mcpServers).length === 0) {
+					delete config.mcpServers;
+					if (Object.keys(config).length === 0) {
+						fs.rmSync(mcpConfigPath, { force: true });
+						log('info', `[Antigravity] Removed empty MCP config file`);
+					} else {
+						fs.writeFileSync(mcpConfigPath, JSON.stringify(config, null, 2) + '\n');
+						log('info', `[Antigravity] Removed Task Master from MCP config`);
+					}
 				} else {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/profiles/antigravity.js` around lines 97 - 100, The current logic removes
the entire MCP config file when config.mcpServers is empty (using
fs.rmSync(mcpConfigPath,...)), which can delete other top-level settings;
instead, modify the code that handles the empty config.mcpServers to persist an
updated config file without the mcpServers key (or write an empty mcpServers
object) rather than deleting mcpConfigPath: detect when
Object.keys(config.mcpServers).length === 0 and update config (delete
config.mcpServers or set it = {}) and write the updated config back to disk
(e.g., via the existing save/write routine) instead of calling fs.rmSync,
referencing config.mcpServers, mcpConfigPath and fs.rmSync in your change.

16-16: ⚠️ Potential issue | 🟠 Major

Replace raw JSON file I/O with shared readJSON/writeJSON utilities.

These lines bypass the project’s standard JSON handling and central validation/error behavior.

As per coding guidelines: "Use readJSON and writeJSON utilities for all JSON file operations instead of raw fs.readFileSync or fs.writeFileSync."

Also applies to: 41-41, 61-61, 77-77, 93-93, 103-103

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/profiles/antigravity.js` at line 16, Replace all direct
fs.readFileSync/JSON.parse and fs.writeFileSync/JSON.stringify uses in
src/profiles/antigravity.js with the project's shared JSON helpers: call
readJSON to load config objects and writeJSON to persist them, and import these
utilities at the top of the file; update the occurrences around the existing
JSON.parse(fs.readFileSync(...)) usage (and the similar spots noted at lines
~41, ~61, ~77, ~93, ~103) so functions that currently read or write MCP config
use readJSON/writeJSON (preserving error handling/validation behavior) and
remove the raw fs+JSON calls.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/profiles/antigravity.js`:
- Around line 80-82: The catch in onAddRulesProfile currently only logs MCP
config creation failures (log('error', `[Antigravity] Failed to create MCP
config: ${error.message}`)) which swallows the error and can incorrectly signal
success; modify onAddRulesProfile to propagate the failure after logging by
rethrowing the caught error (or returning a rejected Promise) so callers see the
setup failure, and ensure any upstream callers handle the thrown error
appropriately; keep the existing log but add throw error (or return
Promise.reject(error)) immediately after to prevent false-success behavior.

---

Duplicate comments:
In `@src/profiles/antigravity.js`:
- Line 17: The isInstalled function currently returns the raw truthy/undefined
expression config.mcpServers && config.mcpServers['task-master-ai'], which can
be an object or undefined; change it to return a strict boolean by coercing the
result (e.g., use Boolean(...) or !!) so isInstalled always returns true or
false when checking config.mcpServers['task-master-ai'] in the isInstalled
function.
- Around line 97-100: The current logic removes the entire MCP config file when
config.mcpServers is empty (using fs.rmSync(mcpConfigPath,...)), which can
delete other top-level settings; instead, modify the code that handles the empty
config.mcpServers to persist an updated config file without the mcpServers key
(or write an empty mcpServers object) rather than deleting mcpConfigPath: detect
when Object.keys(config.mcpServers).length === 0 and update config (delete
config.mcpServers or set it = {}) and write the updated config back to disk
(e.g., via the existing save/write routine) instead of calling fs.rmSync,
referencing config.mcpServers, mcpConfigPath and fs.rmSync in your change.
- Line 16: Replace all direct fs.readFileSync/JSON.parse and
fs.writeFileSync/JSON.stringify uses in src/profiles/antigravity.js with the
project's shared JSON helpers: call readJSON to load config objects and
writeJSON to persist them, and import these utilities at the top of the file;
update the occurrences around the existing JSON.parse(fs.readFileSync(...))
usage (and the similar spots noted at lines ~41, ~61, ~77, ~93, ~103) so
functions that currently read or write MCP config use readJSON/writeJSON
(preserving error handling/validation behavior) and remove the raw fs+JSON
calls.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 66fb47fa-3c0d-40fa-8d66-95813586e460

📥 Commits

Reviewing files that changed from the base of the PR and between 56babd8 and f908c0f.

📒 Files selected for processing (3)
  • .changeset/add-antigravity-profile.md
  • packages/tm-profiles/src/detection/profiles-map.ts
  • src/profiles/antigravity.js
✅ Files skipped from review due to trivial changes (1)
  • .changeset/add-antigravity-profile.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/tm-profiles/src/detection/profiles-map.ts

Comment on lines +80 to +82
} catch (error) {
log('error', `[Antigravity] Failed to create MCP config: ${error.message}`);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Do not swallow setup failures in onAddRulesProfile.

Catching and only logging here can report a successful profile add even when MCP config creation failed.

Suggested fix
 	} catch (error) {
 		log('error', `[Antigravity] Failed to create MCP config: ${error.message}`);
+		throw error;
 	}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} catch (error) {
log('error', `[Antigravity] Failed to create MCP config: ${error.message}`);
}
} catch (error) {
log('error', `[Antigravity] Failed to create MCP config: ${error.message}`);
throw error;
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/profiles/antigravity.js` around lines 80 - 82, The catch in
onAddRulesProfile currently only logs MCP config creation failures (log('error',
`[Antigravity] Failed to create MCP config: ${error.message}`)) which swallows
the error and can incorrectly signal success; modify onAddRulesProfile to
propagate the failure after logging by rethrowing the caught error (or returning
a rejected Promise) so callers see the setup failure, and ensure any upstream
callers handle the thrown error appropriately; keep the existing log but add
throw error (or return Promise.reject(error)) immediately after to prevent
false-success behavior.

@adrhardtke
Copy link
Copy Markdown
Author

Hi team,

I'm adding Antigravity support, but I've encountered a blocking issue during the MCP server initialization. It seems that Antigravity fails to parse the server response because the task-master-ai server is emitting non-JSON logs (Warnings and INFO messages) directly to stdout.

Even with the configuration correctly placed in ~/.gemini/antigravity/mcp_config.json, the client throws the following error:

Plaintext
Error: calling "initialize": invalid character 'W' looking for beginning of value.

@adrhardtke
Copy link
Copy Markdown
Author

Furthermore, when running the server, I noticed a recurring warning from the underlying framework:
[FastMCP warning] could not infer client capabilities after 10 attempts. Connection may be unstable.

This suggests that the logging interference is not only breaking the parser but also preventing a successful handshake, making it impossible for the server to recognize the client's capabilities.

@Crunchyman-ralph
Copy link
Copy Markdown
Collaborator

@adrhardtke ill try to look into it.

usually that fastmcp warning comes from the fact that it's not able to even recognize that the server is an mcp client.

(you can confirm that by running npx task-master-ai directly inside the cli, you'll run into the same issue)

but i'll take this PR and test it on antigravity, thanks for taking the time to contribute !

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.

2 participants