feat(gemini-cli): upgrade to native structured output support#1437
Conversation
🦋 Changeset detectedLatest commit: cdf499f 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 |
WalkthroughUpgrades Gemini CLI provider to use ai-sdk-provider-gemini-cli v1.4.0 with native structured outputs (responseJsonSchema), removes in-provider JSON-extraction workarounds, adds structured-output tests and docs, and bumps Node.js minimum to 20.x across the repository. Changes
Sequence Diagram(s)sequenceDiagram
participant App as Application
participant Provider as GeminiCliProvider
participant SDK as ai-sdk-provider-gemini-cli v1.4.0
participant Gemini as Gemini API
Note over App,Provider: Old flow (pre-v1.4.0)
App->>Provider: generateObject(schema)
Provider->>Provider: Inject JSON-enforcement prompt\nSend text request
Provider->>Gemini: Text request
Gemini-->>Provider: Text response
Provider->>Provider: Parse/extract JSON
Provider-->>App: Parsed object
Note over App,Provider: New flow (v1.4.0+)
App->>Provider: generateObject(schema)
Provider->>SDK: generateObject({responseJsonSchema, mode: "auto", ...})
SDK->>Gemini: Structured request
Gemini-->>SDK: Structured JSON response
SDK-->>Provider: Parsed object + usage
Provider-->>App: Object + usage stats
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/unit/ai-providers/gemini-cli.test.js (1)
254-260: Optional: Consider clarifying test description.The test description "should prioritize OAuth over special marker API key" might be clearer as "should use OAuth when API key is the special marker value" since the marker explicitly triggers OAuth mode rather than OAuth being prioritized.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (17)
.changeset/gemini-cli-native-structured-output.md(1 hunks)CONTRIBUTING.md(1 hunks)apps/cli/package.json(1 hunks)apps/docs/getting-started/contribute.mdx(1 hunks)apps/extension/README.md(2 hunks)apps/mcp/package.json(1 hunks)docs/configuration.md(1 hunks)docs/providers/codex-cli.md(1 hunks)docs/providers/gemini-cli.md(3 hunks)package.json(2 hunks)packages/ai-sdk-provider-grok-cli/package.json(1 hunks)packages/claude-code-plugin/commands/install-taskmaster.md(1 hunks)packages/tm-core/README.md(1 hunks)scripts/modules/commands.js(1 hunks)src/ai-providers/gemini-cli.js(3 hunks)tests/unit/ai-providers/gemini-cli-structured-output.test.js(1 hunks)tests/unit/ai-providers/gemini-cli.test.js(5 hunks)
🧰 Additional context used
🧠 Learnings (33)
📓 Common learnings
Learnt from: eyaltoledano
Repo: eyaltoledano/claude-task-master PR: 1069
File: .changeset/floppy-news-buy.md:7-38
Timestamp: 2025-08-02T14:54:52.216Z
Learning: For major feature additions like new CLI commands, eyaltoledano prefers detailed changesets with comprehensive descriptions, usage examples, and feature explanations rather than minimal single-line summaries.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/src/auth/oauth-service.ts:20-20
Timestamp: 2025-09-03T13:46:00.640Z
Learning: For Node.js v22 and later, JSON imports should use `with { type: 'json' }` syntax, not `assert { type: 'json' }`. The `assert` syntax was removed in Node.js v22 in favor of the `with` syntax for import attributes. This applies to the eyaltoledano/claude-task-master codebase which uses Node.js v24.
📚 Learning: 2025-09-24T15:46:28.029Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1114
File: src/ai-providers/gemini-cli.js:12-12
Timestamp: 2025-09-24T15:46:28.029Z
Learning: When AI SDK provider packages are moved from optional dependencies to required dependencies in package.json, static imports should be used instead of dynamic imports with error handling, as the package is guaranteed to be available at runtime.
Applied to files:
packages/ai-sdk-provider-grok-cli/package.jsonsrc/ai-providers/gemini-cli.jspackage.json
📚 Learning: 2025-09-22T19:45:04.337Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1232
File: packages/tm-core/package.json:50-51
Timestamp: 2025-09-22T19:45:04.337Z
Learning: In the eyaltoledano/claude-task-master project, Crunchyman-ralph intentionally omits version fields from internal/private packages in package.json files to prevent changesets from releasing new versions of these packages while still allowing them to be processed for dependency updates. The changesets warnings about missing versions are acceptable as they don't break the process and achieve the desired behavior of only releasing public packages.
Applied to files:
packages/ai-sdk-provider-grok-cli/package.jsonapps/cli/package.jsonapps/mcp/package.jsonscripts/modules/commands.jspackage.jsonpackages/claude-code-plugin/commands/install-taskmaster.md
📚 Learning: 2025-09-26T19:03:33.225Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1252
File: package.json:130-132
Timestamp: 2025-09-26T19:03:33.225Z
Learning: In the eyaltoledano/claude-task-master repository, packages are bundled using tsdown during the build process, which means dependencies imported by the source code (including tm internal packages like tm/ai-sdk-provider-grok-cli) are included in the final bundle and don't need to be available as separate runtime dependencies, so they should remain as devDependencies rather than being moved to dependencies.
Applied to files:
packages/ai-sdk-provider-grok-cli/package.jsonapps/cli/package.json.changeset/gemini-cli-native-structured-output.mdpackage.jsonpackages/claude-code-plugin/commands/install-taskmaster.md
📚 Learning: 2025-09-03T13:46:00.640Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/src/auth/oauth-service.ts:20-20
Timestamp: 2025-09-03T13:46:00.640Z
Learning: For Node.js v22 and later, JSON imports should use `with { type: 'json' }` syntax, not `assert { type: 'json' }`. The `assert` syntax was removed in Node.js v22 in favor of the `with` syntax for import attributes. This applies to the eyaltoledano/claude-task-master codebase which uses Node.js v24.
Applied to files:
apps/docs/getting-started/contribute.mdxapps/cli/package.jsondocs/configuration.mdpackages/claude-code-plugin/commands/install-taskmaster.md
📚 Learning: 2025-07-31T20:49:04.638Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 997
File: apps/extension/package.publish.json:2-8
Timestamp: 2025-07-31T20:49:04.638Z
Learning: In the eyaltoledano/claude-task-master repository, the VS Code extension uses a 3-file packaging system where package.json (with name "extension") is for development within the monorepo, while package.publish.json (with name "task-master-hamster") contains the clean manifest for VS Code marketplace publishing. The different names are intentional and serve distinct purposes in the build and publishing workflow.
Applied to files:
apps/extension/README.md
📚 Learning: 2025-09-26T19:05:47.555Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1252
File: packages/ai-sdk-provider-grok-cli/package.json:11-13
Timestamp: 2025-09-26T19:05:47.555Z
Learning: In the eyaltoledano/claude-task-master repository, internal tm/ packages use a specific export pattern where the "exports" field points to TypeScript source files (./src/index.ts) while "main" points to compiled output (./dist/index.js) and "types" points to source files (./src/index.ts). This pattern is used consistently across internal packages like tm/core and tm/ai-sdk-provider-grok-cli because they are consumed directly during build-time bundling with tsdown rather than being published as separate packages.
Applied to files:
apps/cli/package.json.changeset/gemini-cli-native-structured-output.mdpackages/claude-code-plugin/commands/install-taskmaster.md
📚 Learning: 2025-07-21T14:14:48.694Z
Learnt from: rtmcrc
Repo: eyaltoledano/claude-task-master PR: 933
File: scripts/modules/supported-models.json:238-238
Timestamp: 2025-07-21T14:14:48.694Z
Learning: Model version updates in scripts/modules/supported-models.json may be included in feature PRs if they provide practical improvements like reduced error rates, even if not directly related to the main feature being implemented.
Applied to files:
docs/providers/gemini-cli.md
📚 Learning: 2025-08-08T11:34:45.482Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: .changeset/vast-weeks-fetch.md:5-5
Timestamp: 2025-08-08T11:34:45.482Z
Learning: This repo’s supported models list is CI-generated into docs/models.md from scripts/modules/supported-models.json (workflow: .github/workflows/update-models-md.yml using docs/scripts/models-json-to-markdown.js). Don’t request manual edits to the Markdown; ensure the JSON is correct instead. README links to docs/models.md.
Applied to files:
docs/providers/gemini-cli.md
📚 Learning: 2025-08-08T11:34:45.482Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: .changeset/vast-weeks-fetch.md:5-5
Timestamp: 2025-08-08T11:34:45.482Z
Learning: In this repo, supported-models.md is auto-generated by CI from supported-models.json; do not request manual edits to that file—ensure JSON entries are correct instead.
Applied to files:
docs/providers/gemini-cli.md
📚 Learning: 2025-08-08T11:34:45.482Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: .changeset/vast-weeks-fetch.md:5-5
Timestamp: 2025-08-08T11:34:45.482Z
Learning: In this repo, the supported models list is auto-generated by CI into docs/models.md from scripts/modules/supported-models.json via .github/workflows/update-models-md.yml and docs/scripts/models-json-to-markdown.js. Don’t request manual edits to the Markdown; ensure the JSON is correct instead.
Applied to files:
docs/providers/gemini-cli.md
📚 Learning: 2025-10-01T19:53:34.261Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1262
File: scripts/modules/task-manager/update-tasks.js:216-233
Timestamp: 2025-10-01T19:53:34.261Z
Learning: For scripts/modules/task-manager/*.js: Use generateObjectService with Zod schemas for structured AI responses rather than generateTextService + manual JSON parsing, as modern AI providers increasingly support the tool use and generateObject paradigm with improved reliability.
Applied to files:
docs/providers/gemini-cli.md.changeset/gemini-cli-native-structured-output.mdtests/unit/ai-providers/gemini-cli-structured-output.test.jssrc/ai-providers/gemini-cli.jstests/unit/ai-providers/gemini-cli.test.js
📚 Learning: 2025-11-21T11:09:42.126Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1431
File: apps/cli/tests/helpers/test-utils.ts:1-19
Timestamp: 2025-11-21T11:09:42.126Z
Learning: In the eyaltoledano/claude-task-master project, Vitest test environment provides __dirname as a global even when using ES modules, so test files can safely use __dirname without needing to convert to fileURLToPath(import.meta.url) patterns.
Applied to files:
apps/mcp/package.json
📚 Learning: 2025-09-17T19:09:08.882Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1211
File: jest.resolver.cjs:8-15
Timestamp: 2025-09-17T19:09:08.882Z
Learning: In the eyaltoledano/claude-task-master project, the team only uses .ts files and does not plan to use .tsx or .mts extensions, so Jest resolver and build tooling should focus on .js → .ts mapping only.
Applied to files:
apps/mcp/package.json
📚 Learning: 2025-07-18T17:08:48.695Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-18T17:08:48.695Z
Learning: Applies to scripts/modules/commands.js : Implement version checking to notify users of available updates, use non-blocking version checks, and display update notifications after command completion.
Applied to files:
scripts/modules/commands.js
📚 Learning: 2025-07-18T17:08:48.695Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-18T17:08:48.695Z
Learning: Applies to scripts/modules/commands.js : Implement semantic version comparison and display attractive update notifications using boxen.
Applied to files:
scripts/modules/commands.js
📚 Learning: 2025-07-18T17:09:40.548Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:40.548Z
Learning: Applies to scripts/modules/dependency-manager.js : Remove references to non-existent tasks during validation
Applied to files:
scripts/modules/commands.js
📚 Learning: 2025-07-18T17:08:48.695Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-18T17:08:48.695Z
Learning: Applies to scripts/modules/commands.js : Regenerate task files after destructive operations, passing all required parameters to generation functions, and provide an option to skip regeneration if needed.
Applied to files:
scripts/modules/commands.js
📚 Learning: 2025-07-18T17:09:40.548Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:40.548Z
Learning: Applies to scripts/modules/dependency-manager.js : Do not create circular dependencies between subtasks
Applied to files:
scripts/modules/commands.js
📚 Learning: 2025-07-18T17:09:40.548Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:40.548Z
Learning: Applies to scripts/modules/dependency-manager.js : Check for and remove references to non-existent tasks during cleanup
Applied to files:
scripts/modules/commands.js
📚 Learning: 2025-07-18T17:09:40.548Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:40.548Z
Learning: Applies to scripts/modules/dependency-manager.js : Prevent tasks from depending on themselves
Applied to files:
scripts/modules/commands.js
📚 Learning: 2025-09-22T19:45:13.323Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1232
File: packages/build-config/package.json:14-15
Timestamp: 2025-09-22T19:45:13.323Z
Learning: In the eyaltoledano/claude-task-master repository, Crunchyman-ralph intentionally omits version fields from internal packages (like tm/build-config) to prevent changesets from releasing new versions for these packages. This is the desired behavior for internal tooling packages that should not be published or versioned independently.
Applied to files:
scripts/modules/commands.jspackages/claude-code-plugin/commands/install-taskmaster.md
📚 Learning: 2025-10-14T14:30:14.725Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1289
File: mcp-server/server.js:10-12
Timestamp: 2025-10-14T14:30:14.725Z
Learning: In MCP server implementations using stdio transport (like mcp-server/server.js), the TASK_MASTER_MCP environment variable must be forced to 'true' unconditionally to silence console output from tm-core, as any console.log/warn/error would corrupt the JSON-RPC protocol stream. This is not a user preference but a technical requirement for stdio-based MCP servers.
Applied to files:
scripts/modules/commands.js
📚 Learning: 2025-10-31T18:07:17.402Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1360
File: src/ai-providers/glm.js:0-0
Timestamp: 2025-10-31T18:07:17.402Z
Learning: In src/ai-providers/glm.js, the GLM provider's getClient method should allow defaulting to the 'coding' endpoint when an invalid or unspecified route parameter is provided, as this is the correct behavior per Z.ai's OpenAI-compatible API documentation. Do not enforce strict route validation that throws errors for unknown routes.
Applied to files:
src/ai-providers/gemini-cli.jstests/unit/ai-providers/gemini-cli.test.js
📚 Learning: 2025-09-29T13:33:46.952Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1246
File: src/ai-providers/claude-code.js:40-42
Timestamp: 2025-09-29T13:33:46.952Z
Learning: Claude Code provider should use environment variable isolation to control API key access, temporarily managing ANTHROPIC_API_KEY during client creation to prevent the ai-sdk-provider-claude-code package from automatically picking up API keys intended for other providers, while allowing explicit CLAUDE_CODE_API_KEY usage as a fallback to OAuth authentication.
Applied to files:
src/ai-providers/gemini-cli.jspackage.jsontests/unit/ai-providers/gemini-cli.test.js
📚 Learning: 2025-07-18T17:08:48.695Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-18T17:08:48.695Z
Learning: Applies to scripts/modules/commands.js : Validate file existence for critical file operations, provide context-specific validation for identifiers, and check required API keys for features that depend on them.
Applied to files:
src/ai-providers/gemini-cli.js
📚 Learning: 2025-08-07T13:00:22.966Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1090
File: apps/extension/package.json:241-243
Timestamp: 2025-08-07T13:00:22.966Z
Learning: In monorepos, local packages should use "*" as the version constraint in package.json dependencies, as recommended by npm. This ensures the local version from within the same workspace is always used, rather than attempting to resolve from external registries. This applies to packages like task-master-ai within the eyaltoledano/claude-task-master monorepo.
Applied to files:
package.jsonpackages/claude-code-plugin/commands/install-taskmaster.md
📚 Learning: 2025-09-29T13:33:46.952Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1246
File: src/ai-providers/claude-code.js:40-42
Timestamp: 2025-09-29T13:33:46.952Z
Learning: Claude Code provider should use CLAUDE_CODE_API_KEY environment variable instead of automatically picking up ANTHROPIC_API_KEY to avoid conflicts, since the ai-sdk-provider-claude-code package follows standard Anthropic patterns and prioritizes API keys over OAuth authentication, which can cause unexpected API charges.
Applied to files:
package.json
📚 Learning: 2025-09-29T13:33:46.952Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1246
File: src/ai-providers/claude-code.js:40-42
Timestamp: 2025-09-29T13:33:46.952Z
Learning: Claude Code provider should use environment variable isolation to temporarily manage ANTHROPIC_API_KEY during client creation: if CLAUDE_CODE_API_KEY is set, temporarily set ANTHROPIC_API_KEY to that value; if CLAUDE_CODE_API_KEY is not set but ANTHROPIC_API_KEY exists, temporarily unset ANTHROPIC_API_KEY to force OAuth mode. This prevents the ai-sdk-provider-claude-code package from accidentally using API keys intended for the regular Anthropic provider while still allowing explicit API key usage as a fallback.
Applied to files:
tests/unit/ai-providers/gemini-cli.test.js
📚 Learning: 2025-09-26T19:10:32.906Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1252
File: tsconfig.json:22-28
Timestamp: 2025-09-26T19:10:32.906Z
Learning: In the eyaltoledano/claude-task-master repository, all internal tm/ package path mappings in tsconfig.json consistently point to TypeScript source files (e.g., "./packages/*/src/index.ts") rather than built JavaScript. This is intentional architecture because tsdown bundles internal packages directly from source during build time, eliminating the need for separate compilation of internal packages.
Applied to files:
packages/claude-code-plugin/commands/install-taskmaster.md
📚 Learning: 2025-09-26T19:07:10.485Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1252
File: packages/ai-sdk-provider-grok-cli/package.json:21-35
Timestamp: 2025-09-26T19:07:10.485Z
Learning: In the eyaltoledano/claude-task-master repository, the tsdown build configuration uses `noExternal: [/^tm\//]` which means internal tm/ packages are bundled into the final output while external npm dependencies remain external and are resolved from the root package.json dependencies at runtime. This eliminates the need for peer dependencies in internal packages since the root package.json already provides the required external dependencies.
Applied to files:
packages/claude-code-plugin/commands/install-taskmaster.md
📚 Learning: 2025-09-03T12:16:15.866Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/package.json:13-64
Timestamp: 2025-09-03T12:16:15.866Z
Learning: For internal packages in the claude-task-master project, Crunchyman-ralph prefers pointing package.json "types" entries to src .ts files rather than dist .d.ts files for better developer experience (DX), as the packages are not being exported as SDKs.
Applied to files:
packages/claude-code-plugin/commands/install-taskmaster.md
📚 Learning: 2025-07-17T21:33:57.585Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1002
File: .changeset/puny-friends-give.md:2-3
Timestamp: 2025-07-17T21:33:57.585Z
Learning: In the eyaltoledano/claude-task-master repository, the MCP server code in mcp-server/src/ is part of the main "task-master-ai" package, not a separate "mcp-server" package. When creating changesets for MCP server changes, use "task-master-ai" as the package name.
Applied to files:
packages/claude-code-plugin/commands/install-taskmaster.md
🧬 Code graph analysis (2)
tests/unit/ai-providers/gemini-cli-structured-output.test.js (1)
src/ai-providers/gemini-cli.js (1)
GeminiCliProvider(20-95)
tests/unit/ai-providers/gemini-cli.test.js (1)
src/ai-providers/gemini-cli.js (1)
GeminiCliProvider(20-95)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Test
- GitHub Check: Cursor Bugbot
🔇 Additional comments (25)
CONTRIBUTING.md (1)
173-173: LGTM!The prerequisite update correctly reflects the Node.js 20+ requirement and is appropriately placed in the development setup section.
packages/ai-sdk-provider-grok-cli/package.json (1)
28-28: LGTM!Engine requirement correctly updated to Node.js 20+. The format is consistent with the provider configuration and aligns with SDK v1.4.0 requirements.
apps/docs/getting-started/contribute.mdx (1)
173-173: LGTM!Prerequisite correctly updated to Node.js 20+ in the docs-specific contribution guide, maintaining consistency with the root CONTRIBUTING.md.
apps/extension/README.md (1)
43-43: LGTM!Both Node.js version updates (prerequisites and troubleshooting sections) correctly reflect the 20+ requirement. Clear documentation for extension users across setup and troubleshooting paths.
Also applies to: 128-128
packages/tm-core/README.md (1)
84-84: LGTM!Development prerequisite correctly updated to Node.js >= 20.0.0. The semantic version format is consistent with library documentation standards.
apps/mcp/package.json (1)
37-37: LGTM!Engine requirement correctly updated to Node.js >= 20.0.0, using consistent semantic versioning format with other MCP components.
apps/cli/package.json (1)
44-44: LGTM!Engine requirement correctly updated to Node.js >= 20.0.0, maintaining consistency with all other app and package engine declarations.
docs/configuration.md (1)
508-508: LGTM!Codex CLI provider prerequisite correctly updated to Node.js >= 20. This is appropriately placed in the provider-specific configuration section where users set up their providers.
docs/providers/codex-cli.md (1)
32-32: Node.js version requirement update looks correct.The update from Node.js 18 to 20 aligns with the PR's broader objective to upgrade minimum Node.js requirements across the repository, as Node 18 reached EOL on 2025-04-30.
packages/claude-code-plugin/commands/install-taskmaster.md (1)
94-97: Node.js installation instructions correctly updated.The update from Node 18 to Node 20 in the installation troubleshooting section is consistent with the repository-wide Node.js upgrade.
package.json (2)
118-118: Node.js engine requirement updated.The engine requirement update to Node.js 20+ is consistent with the PR objectives, citing Node 18's EOL on 2025-04-30 and the SDK's requirements.
77-77: The review comment is based on incorrect information.ai-sdk-provider-gemini-cli v1.4.0 requires Node.js ≥18, not Node 20+. The PR description's claim that this SDK upgrade necessitates the engine requirement change to Node 20+ appears to be unfounded. If the Node.js version bump is still warranted, it should be justified by other dependencies or project requirements, not by this SDK.
Likely an incorrect or invalid review comment.
scripts/modules/commands.js (1)
4414-4421: Update check skip logic looks correct.The environment variable guard provides a clean way to skip update checks during development or CI/CD workflows. The logic correctly short-circuits the update check when
TASKMASTER_SKIP_UPDATEis set to "1" or "true".docs/providers/gemini-cli.md (2)
110-113: Model list expansion looks good.The addition of
gemini-3-pro-previewto the available models list is clearly documented with consistent formatting.
157-198: Excellent documentation of native structured output feature.The new section provides comprehensive coverage of the native structured output capability, including:
- Clear explanation of benefits (schema compliance, no parsing errors, reliability, performance)
- Practical workflow description
- List of supported commands
- Requirements (Node.js 20+, SDK v1.4.0+)
This will help users understand the improvements and requirements.
src/ai-providers/gemini-cli.js (3)
6-15: Clear documentation of structural changes.The updated file header effectively explains the shift to native structured output support in SDK v1.4.0 and the elimination of JSON extraction workarounds.
48-77: OAuth-first authentication logic looks correct.The implementation properly handles both OAuth (primary) and API key (fallback) authentication methods. The special value
'gemini-cli-no-key-required'is used to trigger OAuth mode when no API key is provided, which aligns with the provider's design philosophy of leveraging pre-configured OAuth credentials.
87-94: New isRequiredApiKey method aligns with OAuth-first design.The addition of
isRequiredApiKey()returningfalsecorrectly signals that this provider doesn't require an API key, as it primarily uses OAuth authentication. This is consistent with the base class interface shown in the relevant code snippets..changeset/gemini-cli-native-structured-output.md (1)
1-13: Comprehensive and well-structured changeset.The changeset clearly documents:
- The SDK upgrade and its benefits
- Implementation simplification
- Affected commands
- Breaking change (Node.js 20+ requirement)
This follows the learning that detailed changesets are preferred for major feature additions.
Based on learnings, eyaltoledano prefers detailed changesets with comprehensive descriptions for major features.
tests/unit/ai-providers/gemini-cli-structured-output.test.js (4)
1-65: Well-structured test setup with comprehensive mocking.The test file properly mocks all external dependencies (AI SDK, Gemini CLI SDK, utilities) and sets up isolated test conditions. The use of
jest.unstable_mockModuleensures proper module mocking before imports.
66-200: Comprehensive generateObject test coverage.The test suite thoroughly validates:
- Schema forwarding to the AI SDK
- Correct mode selection (auto)
- Schema naming and description
- Usage statistics mapping
- Temperature parameter handling
This provides strong confidence in the structured output integration.
202-269: Adequate streamObject test coverage.The tests verify key aspects of streaming structured objects:
- Schema wrapping with zodSchema
- Default mode configuration
- Token limit passing
Good coverage for the streaming pathway.
271-338: SDK integration tests validate model handling.The tests confirm correct model creation and support for all documented models (gemini-2.5-pro, gemini-2.5-flash, gemini-3-pro-preview). This ensures the provider works correctly with the Gemini CLI SDK.
tests/unit/ai-providers/gemini-cli.test.js (2)
1-262: Comprehensive test coverage for the simplified provider.The test suite effectively validates the key changes in this PR:
- OAuth-first authentication with API key fallback
- Removal of custom JSON extraction methods
- Delegation to base class for text/object generation
- New public API methods (getRequiredApiKeyName, isRequiredApiKey)
- Special marker value handling for authentication
The tests cover edge cases (empty strings, undefined values, error scenarios) and verify both positive and negative behaviors appropriately.
65-69: The test comment is accurate. The AI SDK language-model interface uses supportsStructuredOutputs to pick the default object-generation mode, returning 'json' when supportsStructuredOutputs is true, and the ai-sdk-provider-gemini-cli repo advertises structured-object support. The test correctly verifies that the provider relies on the SDK's native defaults without needing to overrideneedsExplicitJsonSchema.
0947a76 to
ce5904b
Compare
Note: Removed temporary
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
docs/providers/gemini-cli.md (2)
9-9: Fix typo: "offere" should be "offered".Minor grammatical fix needed.
-Have an active Gemini Code Assist license (including those using the free tier offere by Google) +Have an active Gemini Code Assist license (including those using the free tier offered by Google)
119-119: Fix awkward phrasing in sentence.The sentence has incomplete/duplicated phrasing. It currently reads: "Once gemini-cli is installed and authenticated, and Task Master simply use Task Master as normal:" which is unclear.
-Once gemini-cli is installed and authenticated, and Task Master simply use Task Master as normal: +Once gemini-cli is installed and authenticated, simply use Task Master as normal:
🧹 Nitpick comments (3)
src/ai-providers/gemini-cli.js (2)
54-54: Document the magic string constant.The special value
'gemini-cli-no-key-required'appears to be a sentinel triggering OAuth mode. Consider extracting this to a named constant with documentation explaining its purpose and where it originates (e.g., from configuration, CLI args, or env var defaults).+// Special sentinel value indicating OAuth authentication should be used +const OAUTH_SENTINEL = 'gemini-cli-no-key-required'; + async getClient(params) { try { // Primary use case: Use existing gemini CLI authentication via OAuth // Secondary use case: Direct API key (for compatibility) let authOptions = {}; - if (params.apiKey && params.apiKey !== 'gemini-cli-no-key-required') { + if (params.apiKey && params.apiKey !== OAUTH_SENTINEL) { // API key provided - use it for compatibility authOptions = { authType: 'api-key', apiKey: params.apiKey };
48-49: Consider validating params upfront.The method accesses
params.apiKeyandparams.baseURLwithout first validating thatparamsis defined. While the try-catch will handle errors, explicit validation would provide clearer error messages.async getClient(params) { try { + // Ensure params is an object + params = params || {}; + // Primary use case: Use existing gemini CLI authentication via OAuth // Secondary use case: Direct API key (for compatibility)tests/unit/ai-providers/gemini-cli.test.js (1)
236-260: Minor test duplication.The authentication scenario tests at lines 237-260 overlap with earlier tests (lines 91-147), though they're organized differently. While not problematic, consolidating these could improve maintainability.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (16)
.changeset/gemini-cli-native-structured-output.md(1 hunks)CONTRIBUTING.md(1 hunks)apps/cli/package.json(1 hunks)apps/docs/getting-started/contribute.mdx(1 hunks)apps/extension/README.md(2 hunks)apps/mcp/package.json(1 hunks)docs/configuration.md(1 hunks)docs/providers/codex-cli.md(1 hunks)docs/providers/gemini-cli.md(3 hunks)package.json(2 hunks)packages/ai-sdk-provider-grok-cli/package.json(1 hunks)packages/claude-code-plugin/commands/install-taskmaster.md(1 hunks)packages/tm-core/README.md(1 hunks)src/ai-providers/gemini-cli.js(3 hunks)tests/unit/ai-providers/gemini-cli-structured-output.test.js(1 hunks)tests/unit/ai-providers/gemini-cli.test.js(5 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/claude-code-plugin/commands/install-taskmaster.md
🚧 Files skipped from review as they are similar to previous changes (8)
- apps/mcp/package.json
- package.json
- packages/ai-sdk-provider-grok-cli/package.json
- apps/extension/README.md
- docs/configuration.md
- docs/providers/codex-cli.md
- tests/unit/ai-providers/gemini-cli-structured-output.test.js
- .changeset/gemini-cli-native-structured-output.md
🧰 Additional context used
🧠 Learnings (16)
📓 Common learnings
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/src/auth/oauth-service.ts:20-20
Timestamp: 2025-09-03T13:46:00.640Z
Learning: For Node.js v22 and later, JSON imports should use `with { type: 'json' }` syntax, not `assert { type: 'json' }`. The `assert` syntax was removed in Node.js v22 in favor of the `with` syntax for import attributes. This applies to the eyaltoledano/claude-task-master codebase which uses Node.js v24.
📚 Learning: 2025-07-21T14:14:48.694Z
Learnt from: rtmcrc
Repo: eyaltoledano/claude-task-master PR: 933
File: scripts/modules/supported-models.json:238-238
Timestamp: 2025-07-21T14:14:48.694Z
Learning: Model version updates in scripts/modules/supported-models.json may be included in feature PRs if they provide practical improvements like reduced error rates, even if not directly related to the main feature being implemented.
Applied to files:
docs/providers/gemini-cli.md
📚 Learning: 2025-08-08T11:34:45.482Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: .changeset/vast-weeks-fetch.md:5-5
Timestamp: 2025-08-08T11:34:45.482Z
Learning: This repo’s supported models list is CI-generated into docs/models.md from scripts/modules/supported-models.json (workflow: .github/workflows/update-models-md.yml using docs/scripts/models-json-to-markdown.js). Don’t request manual edits to the Markdown; ensure the JSON is correct instead. README links to docs/models.md.
Applied to files:
docs/providers/gemini-cli.md
📚 Learning: 2025-08-08T11:34:45.482Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: .changeset/vast-weeks-fetch.md:5-5
Timestamp: 2025-08-08T11:34:45.482Z
Learning: In this repo, supported-models.md is auto-generated by CI from supported-models.json; do not request manual edits to that file—ensure JSON entries are correct instead.
Applied to files:
docs/providers/gemini-cli.md
📚 Learning: 2025-08-08T11:34:45.482Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: .changeset/vast-weeks-fetch.md:5-5
Timestamp: 2025-08-08T11:34:45.482Z
Learning: In this repo, the supported models list is auto-generated by CI into docs/models.md from scripts/modules/supported-models.json via .github/workflows/update-models-md.yml and docs/scripts/models-json-to-markdown.js. Don’t request manual edits to the Markdown; ensure the JSON is correct instead.
Applied to files:
docs/providers/gemini-cli.md
📚 Learning: 2025-08-02T14:54:52.216Z
Learnt from: eyaltoledano
Repo: eyaltoledano/claude-task-master PR: 1069
File: .changeset/floppy-news-buy.md:7-38
Timestamp: 2025-08-02T14:54:52.216Z
Learning: For major feature additions like new CLI commands, eyaltoledano prefers detailed changesets with comprehensive descriptions, usage examples, and feature explanations rather than minimal single-line summaries.
Applied to files:
docs/providers/gemini-cli.md
📚 Learning: 2025-10-01T19:53:34.261Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1262
File: scripts/modules/task-manager/update-tasks.js:216-233
Timestamp: 2025-10-01T19:53:34.261Z
Learning: For scripts/modules/task-manager/*.js: Use generateObjectService with Zod schemas for structured AI responses rather than generateTextService + manual JSON parsing, as modern AI providers increasingly support the tool use and generateObject paradigm with improved reliability.
Applied to files:
docs/providers/gemini-cli.mdtests/unit/ai-providers/gemini-cli.test.jssrc/ai-providers/gemini-cli.js
📚 Learning: 2025-09-26T19:03:33.225Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1252
File: package.json:130-132
Timestamp: 2025-09-26T19:03:33.225Z
Learning: In the eyaltoledano/claude-task-master repository, packages are bundled using tsdown during the build process, which means dependencies imported by the source code (including tm internal packages like tm/ai-sdk-provider-grok-cli) are included in the final bundle and don't need to be available as separate runtime dependencies, so they should remain as devDependencies rather than being moved to dependencies.
Applied to files:
packages/tm-core/README.mdapps/cli/package.json
📚 Learning: 2025-09-03T13:46:00.640Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/src/auth/oauth-service.ts:20-20
Timestamp: 2025-09-03T13:46:00.640Z
Learning: For Node.js v22 and later, JSON imports should use `with { type: 'json' }` syntax, not `assert { type: 'json' }`. The `assert` syntax was removed in Node.js v22 in favor of the `with` syntax for import attributes. This applies to the eyaltoledano/claude-task-master codebase which uses Node.js v24.
Applied to files:
packages/tm-core/README.mdapps/docs/getting-started/contribute.mdxCONTRIBUTING.mdapps/cli/package.json
📚 Learning: 2025-09-29T13:33:46.952Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1246
File: src/ai-providers/claude-code.js:40-42
Timestamp: 2025-09-29T13:33:46.952Z
Learning: Claude Code provider should use environment variable isolation to control API key access, temporarily managing ANTHROPIC_API_KEY during client creation to prevent the ai-sdk-provider-claude-code package from automatically picking up API keys intended for other providers, while allowing explicit CLAUDE_CODE_API_KEY usage as a fallback to OAuth authentication.
Applied to files:
tests/unit/ai-providers/gemini-cli.test.js
📚 Learning: 2025-10-31T18:07:17.402Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1360
File: src/ai-providers/glm.js:0-0
Timestamp: 2025-10-31T18:07:17.402Z
Learning: In src/ai-providers/glm.js, the GLM provider's getClient method should allow defaulting to the 'coding' endpoint when an invalid or unspecified route parameter is provided, as this is the correct behavior per Z.ai's OpenAI-compatible API documentation. Do not enforce strict route validation that throws errors for unknown routes.
Applied to files:
tests/unit/ai-providers/gemini-cli.test.jssrc/ai-providers/gemini-cli.js
📚 Learning: 2025-09-29T13:33:46.952Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1246
File: src/ai-providers/claude-code.js:40-42
Timestamp: 2025-09-29T13:33:46.952Z
Learning: Claude Code provider should use environment variable isolation to temporarily manage ANTHROPIC_API_KEY during client creation: if CLAUDE_CODE_API_KEY is set, temporarily set ANTHROPIC_API_KEY to that value; if CLAUDE_CODE_API_KEY is not set but ANTHROPIC_API_KEY exists, temporarily unset ANTHROPIC_API_KEY to force OAuth mode. This prevents the ai-sdk-provider-claude-code package from accidentally using API keys intended for the regular Anthropic provider while still allowing explicit API key usage as a fallback.
Applied to files:
tests/unit/ai-providers/gemini-cli.test.js
📚 Learning: 2025-09-24T15:46:28.029Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1114
File: src/ai-providers/gemini-cli.js:12-12
Timestamp: 2025-09-24T15:46:28.029Z
Learning: When AI SDK provider packages are moved from optional dependencies to required dependencies in package.json, static imports should be used instead of dynamic imports with error handling, as the package is guaranteed to be available at runtime.
Applied to files:
src/ai-providers/gemini-cli.js
📚 Learning: 2025-07-18T17:08:48.695Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-18T17:08:48.695Z
Learning: Applies to scripts/modules/commands.js : Validate file existence for critical file operations, provide context-specific validation for identifiers, and check required API keys for features that depend on them.
Applied to files:
src/ai-providers/gemini-cli.js
📚 Learning: 2025-09-22T19:45:04.337Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1232
File: packages/tm-core/package.json:50-51
Timestamp: 2025-09-22T19:45:04.337Z
Learning: In the eyaltoledano/claude-task-master project, Crunchyman-ralph intentionally omits version fields from internal/private packages in package.json files to prevent changesets from releasing new versions of these packages while still allowing them to be processed for dependency updates. The changesets warnings about missing versions are acceptable as they don't break the process and achieve the desired behavior of only releasing public packages.
Applied to files:
apps/cli/package.json
📚 Learning: 2025-09-26T19:05:47.555Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1252
File: packages/ai-sdk-provider-grok-cli/package.json:11-13
Timestamp: 2025-09-26T19:05:47.555Z
Learning: In the eyaltoledano/claude-task-master repository, internal tm/ packages use a specific export pattern where the "exports" field points to TypeScript source files (./src/index.ts) while "main" points to compiled output (./dist/index.js) and "types" points to source files (./src/index.ts). This pattern is used consistently across internal packages like tm/core and tm/ai-sdk-provider-grok-cli because they are consumed directly during build-time bundling with tsdown rather than being published as separate packages.
Applied to files:
apps/cli/package.json
🧬 Code graph analysis (1)
tests/unit/ai-providers/gemini-cli.test.js (1)
src/ai-providers/gemini-cli.js (1)
GeminiCliProvider(20-95)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Build
- GitHub Check: Format Check
- GitHub Check: Typecheck
🔇 Additional comments (16)
docs/providers/gemini-cli.md (2)
110-113: Consistent model listings.The available models are correctly listed in both the "Available Models" section (lines 110–113) and the "Model not found" troubleshooting section (lines 138–141), with
gemini-3-pro-previewadded as the latest option. This aligns well with the v1.4.0 upgrade and PR objectives.Also applies to: 138-141
157-196: New "Native Structured Outputs" section is well-documented.The comprehensive new section clearly explains the structured output feature introduced in v1.4.0: benefits (schema compliance, reliability), implementation details (Zod schema pass-through, responseJsonSchema, responseMimeType), supported commands, and Node.js 20+ requirements. This documentation directly supports the PR's shift to native schema-enforced structured output and will help users understand the improvements and requirements.
CONTRIBUTING.md (1)
173-173: Update aligns with PR's Node.js version requirement.The change correctly reflects the minimum Node.js 20+ requirement across the repo, addressing the EOL of Node 18 and SDK compatibility.
apps/docs/getting-started/contribute.mdx (1)
173-173: LGTM!The documentation update correctly reflects the new Node.js 20+ minimum requirement across the project.
apps/cli/package.json (1)
44-44: LGTM!The engine requirement correctly reflects the new Node.js 20+ minimum. The change aligns with the PR objectives and the rationale provided (Node 18 EOL, SDK requirements).
packages/tm-core/README.md (2)
84-84: Update reflects correct Node.js version requirement.The change from Node.js 18.0.0 to 20.0.0 aligns with the PR's breaking change to support Node.js 20+ (due to Node 18 EOL and SDK requirements).
1-107: Summary mentions two prerequisites sections; only one is visible.The AI summary claims changes to "Overview/Setup and Development prerequisites" sections, but the file shows only one Prerequisites section under Development. The Overview section exists but has no Prerequisites subsection.
src/ai-providers/gemini-cli.js (3)
18-18: LGTM!Static import is correct per project standards.
29-38: LGTM!Delegating auth validation to the SDK is appropriate given the SDK v1.4.0 handles authentication internally.
79-94: LGTM!The new public API methods correctly reflect that Gemini CLI uses OAuth as the primary authentication method with optional API key fallback.
tests/unit/ai-providers/gemini-cli.test.js (6)
23-24: LGTM!Mock extensions appropriately support testing property inheritance and overrides in the provider.
61-69: LGTM!Constructor tests correctly verify that
supportsTemperatureis explicitly set to false andneedsExplicitJsonSchemais inherited as false from the base class.
77-87: LGTM!Tests appropriately verify that
validateAuthaccepts all parameter variations without throwing, consistent with SDK-delegated validation.
112-147: LGTM!Tests comprehensively cover OAuth/API-key selection logic, including the special sentinel value and baseURL propagation for both authentication modes.
156-185: LGTM!Tests properly cover edge cases (empty string API key), error propagation, and the new public API methods.
187-234: LGTM!Tests effectively verify the simplified provider implementation: no method overrides for base SDK functionality and removal of custom JSON extraction helpers.
| * | ||
| * As of v1.4.0, the SDK provides native structured output support via: | ||
| * - supportsStructuredOutputs = true | ||
| * - defaultObjectGenerationMode = 'json' | ||
| * - responseJsonSchema passed directly to Gemini API | ||
| * | ||
| * This eliminates the need for JSON extraction workarounds. | ||
| * System messages are automatically handled by the SDK's mapPromptToGeminiFormat | ||
| * which extracts them to Gemini's systemInstruction field. | ||
| */ |
There was a problem hiding this comment.
🧩 Analysis chain
Verify SDK version and capabilities.
The documentation references specific v1.4.0 features (supportsStructuredOutputs, defaultObjectGenerationMode, responseJsonSchema). Confirm that ai-sdk-provider-gemini-cli v1.4.0 actually provides these capabilities as described.
🌐 Web query:
Does ai-sdk-provider-gemini-cli version 1.4.0 support native structured outputs via supportsStructuredOutputs and responseJsonSchema?
💡 Result:
Short answer: No — ai-sdk-provider-gemini-cli v1.4.0 does not provide native structured-outputs via supportsStructuredOutputs/responseJsonSchema. It emulates structured output using LLM-based parsing and schema helpers (Zod/JSON-schema) rather than true provider-level structured JSON support. [1][2][3]
Sources:
- Provider docs / README (features mention structured object generation with Zod schemas). [1]
- PyPI / gemini-cli-sdk note: "As Gemini CLI doesn't yet support structured JSON output, this SDK uses LLM-based parsing". [2]
- ai-sdk provider docs page (notes and limitations about strict schema constraints / parsing). [3]
Documentation contains factually incorrect claims about SDK capabilities.
The comment states that v1.4.0 provides "native structured output support" via supportsStructuredOutputs, defaultObjectGenerationMode, and responseJsonSchema and that this "eliminates the need for JSON extraction workarounds." However, verification shows that ai-sdk-provider-gemini-cli v1.4.0 does not provide native structured-outputs via supportsStructuredOutputs/responseJsonSchema, but instead emulates structured output using LLM-based parsing and schema helpers. This contradicts the claim that JSON extraction workarounds are eliminated. Correct the documentation to accurately reflect that structured outputs are emulated via LLM-based parsing rather than provided natively by the SDK.
🤖 Prompt for AI Agents
In src/ai-providers/gemini-cli.js around lines 6 to 15, the comment incorrectly
claims ai-sdk-provider-gemini-cli v1.4.0 offers native structured output support
(supportsStructuredOutputs/defaultObjectGenerationMode/responseJsonSchema) and
removes the need for JSON extraction; update the documentation to state that
v1.4.0 does not provide native structured outputs but instead emulates
structured output via LLM-based parsing and schema helper utilities, and clarify
that JSON extraction workarounds are still used under the hood; keep wording
concise and factual, referencing "emulated structured outputs via LLM
parsing/schema helpers" and remove claims about native SDK fields enabling true
structured output.
Crunchyman-ralph
left a comment
There was a problem hiding this comment.
lgtm, miss those contributions @ben-vargas refreshing to review your PRs
ce5904b to
9c47ac9
Compare
|
@ben-vargas make sure the CIs pass, maybe just do an npm i ? |
|
@ben-vargas regarding TASKMASTER_SKIP_UPDATE=1, just add it to your .env |
Yeah, weird that CI is failing with "Missing: yaml@2.8.1 from lock file" - I didn't remove it, maybe just upstread/next was in an odd state when I pulled it. Running an install to rebuild the lock file now. |
9c47ac9 to
9486311
Compare
Upgrade ai-sdk-provider-gemini-cli from v1.1.1 to v1.4.0 to leverage native structured output via Gemini's responseJsonSchema parameter. ## Provider Changes - Simplify gemini-cli.js from 652 lines to 95 lines - Remove all JSON extraction workarounds (_extractSystemMessage, _detectJsonRequest, extractJson, etc.) - Delegate to BaseAIProvider for generateText, streamText, generateObject, and streamObject methods - SDK now handles system messages via mapPromptToGeminiFormat ## Breaking Change: Node.js 20+ Required - Root package.json: >=18.0.0 → >=20.0.0 - apps/cli/package.json: >=18.0.0 → >=20.0.0 - apps/mcp/package.json: >=18.0.0 → >=20.0.0 - packages/ai-sdk-provider-grok-cli/package.json: >=18 → >=20 ## Documentation Updates - docs/providers/gemini-cli.md: Add native structured output section - docs/providers/codex-cli.md: Node 18 → 20 - docs/configuration.md: Node 18 → 20 - CONTRIBUTING.md: Node 18+ → 20+ - apps/docs/getting-started/contribute.mdx: Node 18+ → 20+ - apps/extension/README.md: Node 18 → 20 - packages/tm-core/README.md: Node 18 → 20 - packages/claude-code-plugin/commands/install-taskmaster.md: Node 18 → 20 ## Test Coverage - Rewrite gemini-cli.test.js for minimal provider implementation - Add gemini-cli-structured-output.test.js with 11 integration tests verifying schema forwarding through generateObject/streamObject - Total: 36 tests for gemini-cli provider
9486311 to
cdf499f
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
src/ai-providers/gemini-cli.js (1)
6-14: Correct JSDoc about structured-output behavior forai-sdk-provider-gemini-cli@1.4.0This comment still claims that v1.4.0 provides native structured outputs via
supportsStructuredOutputs,defaultObjectGenerationMode = 'json', and directresponseJsonSchemaenforcement, and that this “eliminates the need for JSON extraction workarounds.” Earlier review already confirmed from the provider’s docs that v1.4.0 emulates structured outputs via LLM-based parsing and schema helpers rather than exposing true nativeresponseJsonSchemasupport.To avoid overstating guarantees, consider something along these lines:
- * - * As of v1.4.0, the SDK provides native structured output support via: - * - supportsStructuredOutputs = true - * - defaultObjectGenerationMode = 'json' - * - responseJsonSchema passed directly to Gemini API - * - * This eliminates the need for JSON extraction workarounds. - * System messages are automatically handled by the SDK's mapPromptToGeminiFormat - * which extracts them to Gemini's systemInstruction field. + * + * As of v1.4.0, the SDK exposes higher-level helpers for structured/object + * generation (e.g. Zod / JSON-schema helpers) and internally emulates + * structured outputs via LLM-based parsing. + * + * This allows this provider to delegate JSON extraction and schema handling to + * the SDK instead of maintaining custom logic here, but it does **not** enable + * native `responseJsonSchema` enforcement by the underlying Gemini API. + * System messages are handled by the SDK's `mapPromptToGeminiFormat`, which + * maps them into Gemini's `systemInstruction` field.This keeps the intent of the change (moving JSON logic into the SDK) without claiming native structured-output capabilities the SDK does not currently provide.
🧹 Nitpick comments (3)
tests/unit/ai-providers/gemini-cli-structured-output.test.js (1)
66-200: generateObject tests cover the key structured-output behavioursThese tests validate the important aspects of the new structured-output flow: forwarding the Zod schema, using
mode: 'auto'whenneedsExplicitJsonSchemais false, passingschemaName/schemaDescription, mapping SDK token usage to input/output/total, and omittingtemperaturewhensupportsTemperatureis false. That gives good confidence that the provider is delegating correctly to the AI SDK’s object-generation API.One minor optional consideration: if
needsExplicitJsonSchemais meant to be an internal implementation detail, you could drop the direct assertion onprovider.needsExplicitJsonSchemaand rely solely on themode: 'auto'assertion to keep the test slightly less coupled to internal flags.tests/unit/ai-providers/gemini-cli.test.js (1)
112-121: Sentinel API-key handling test is good, but overlaps with later scenarioVerifying that the special
apiKey: 'gemini-cli-no-key-required'flows through to OAuth auth options matches the implementation and prevents regressions. Note that the authentication scenarios block later (Line 254 onwards) asserts the same behavior; if you want to reduce duplication, you could keep either the more detailed version here or the higher-level scenario test.src/ai-providers/gemini-cli.js (1)
48-70: Optional: makegetClientmore defensive for undefinedparams
getClientassumesparamsis an object and immediately accessesparams.apiKey/params.baseURL. Callers currently always pass an object, but if a future call site ever passesundefined, the first property access will throw aTypeErrorinside the try/catch.You could make this more robust with a default:
- async getClient(params) { + async getClient(params = {}) {This keeps behavior the same for all existing call sites while making the method safer to call.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (16)
.changeset/gemini-cli-native-structured-output.md(1 hunks)CONTRIBUTING.md(1 hunks)apps/cli/package.json(1 hunks)apps/docs/getting-started/contribute.mdx(1 hunks)apps/extension/README.md(2 hunks)apps/mcp/package.json(1 hunks)docs/configuration.md(1 hunks)docs/providers/codex-cli.md(1 hunks)docs/providers/gemini-cli.md(3 hunks)package.json(2 hunks)packages/ai-sdk-provider-grok-cli/package.json(1 hunks)packages/claude-code-plugin/commands/install-taskmaster.md(1 hunks)packages/tm-core/README.md(1 hunks)src/ai-providers/gemini-cli.js(3 hunks)tests/unit/ai-providers/gemini-cli-structured-output.test.js(1 hunks)tests/unit/ai-providers/gemini-cli.test.js(5 hunks)
🚧 Files skipped from review as they are similar to previous changes (9)
- CONTRIBUTING.md
- packages/claude-code-plugin/commands/install-taskmaster.md
- package.json
- .changeset/gemini-cli-native-structured-output.md
- apps/mcp/package.json
- apps/cli/package.json
- packages/tm-core/README.md
- docs/configuration.md
- apps/docs/getting-started/contribute.mdx
🧰 Additional context used
🧠 Learnings (15)
📓 Common learnings
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/src/auth/oauth-service.ts:20-20
Timestamp: 2025-09-03T13:46:00.640Z
Learning: For Node.js v22 and later, JSON imports should use `with { type: 'json' }` syntax, not `assert { type: 'json' }`. The `assert` syntax was removed in Node.js v22 in favor of the `with` syntax for import attributes. This applies to the eyaltoledano/claude-task-master codebase which uses Node.js v24.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1252
File: package.json:130-132
Timestamp: 2025-09-26T19:03:33.225Z
Learning: In the eyaltoledano/claude-task-master repository, packages are bundled using tsdown during the build process, which means dependencies imported by the source code (including tm internal packages like tm/ai-sdk-provider-grok-cli) are included in the final bundle and don't need to be available as separate runtime dependencies, so they should remain as devDependencies rather than being moved to dependencies.
Learnt from: eyaltoledano
Repo: eyaltoledano/claude-task-master PR: 1069
File: .changeset/floppy-news-buy.md:7-38
Timestamp: 2025-08-02T14:54:52.216Z
Learning: For major feature additions like new CLI commands, eyaltoledano prefers detailed changesets with comprehensive descriptions, usage examples, and feature explanations rather than minimal single-line summaries.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1262
File: scripts/modules/task-manager/update-tasks.js:216-233
Timestamp: 2025-10-01T19:53:34.261Z
Learning: For scripts/modules/task-manager/*.js: Use generateObjectService with Zod schemas for structured AI responses rather than generateTextService + manual JSON parsing, as modern AI providers increasingly support the tool use and generateObject paradigm with improved reliability.
📚 Learning: 2025-07-31T20:49:04.638Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 997
File: apps/extension/package.publish.json:2-8
Timestamp: 2025-07-31T20:49:04.638Z
Learning: In the eyaltoledano/claude-task-master repository, the VS Code extension uses a 3-file packaging system where package.json (with name "extension") is for development within the monorepo, while package.publish.json (with name "task-master-hamster") contains the clean manifest for VS Code marketplace publishing. The different names are intentional and serve distinct purposes in the build and publishing workflow.
Applied to files:
apps/extension/README.md
📚 Learning: 2025-09-24T15:46:28.029Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1114
File: src/ai-providers/gemini-cli.js:12-12
Timestamp: 2025-09-24T15:46:28.029Z
Learning: When AI SDK provider packages are moved from optional dependencies to required dependencies in package.json, static imports should be used instead of dynamic imports with error handling, as the package is guaranteed to be available at runtime.
Applied to files:
packages/ai-sdk-provider-grok-cli/package.jsonsrc/ai-providers/gemini-cli.js
📚 Learning: 2025-09-22T19:45:04.337Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1232
File: packages/tm-core/package.json:50-51
Timestamp: 2025-09-22T19:45:04.337Z
Learning: In the eyaltoledano/claude-task-master project, Crunchyman-ralph intentionally omits version fields from internal/private packages in package.json files to prevent changesets from releasing new versions of these packages while still allowing them to be processed for dependency updates. The changesets warnings about missing versions are acceptable as they don't break the process and achieve the desired behavior of only releasing public packages.
Applied to files:
packages/ai-sdk-provider-grok-cli/package.json
📚 Learning: 2025-09-26T19:03:33.225Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1252
File: package.json:130-132
Timestamp: 2025-09-26T19:03:33.225Z
Learning: In the eyaltoledano/claude-task-master repository, packages are bundled using tsdown during the build process, which means dependencies imported by the source code (including tm internal packages like tm/ai-sdk-provider-grok-cli) are included in the final bundle and don't need to be available as separate runtime dependencies, so they should remain as devDependencies rather than being moved to dependencies.
Applied to files:
packages/ai-sdk-provider-grok-cli/package.json
📚 Learning: 2025-10-31T18:07:17.402Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1360
File: src/ai-providers/glm.js:0-0
Timestamp: 2025-10-31T18:07:17.402Z
Learning: In src/ai-providers/glm.js, the GLM provider's getClient method should allow defaulting to the 'coding' endpoint when an invalid or unspecified route parameter is provided, as this is the correct behavior per Z.ai's OpenAI-compatible API documentation. Do not enforce strict route validation that throws errors for unknown routes.
Applied to files:
src/ai-providers/gemini-cli.jstests/unit/ai-providers/gemini-cli.test.js
📚 Learning: 2025-09-29T13:33:46.952Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1246
File: src/ai-providers/claude-code.js:40-42
Timestamp: 2025-09-29T13:33:46.952Z
Learning: Claude Code provider should use environment variable isolation to control API key access, temporarily managing ANTHROPIC_API_KEY during client creation to prevent the ai-sdk-provider-claude-code package from automatically picking up API keys intended for other providers, while allowing explicit CLAUDE_CODE_API_KEY usage as a fallback to OAuth authentication.
Applied to files:
src/ai-providers/gemini-cli.jstests/unit/ai-providers/gemini-cli.test.js
📚 Learning: 2025-10-01T19:53:34.261Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1262
File: scripts/modules/task-manager/update-tasks.js:216-233
Timestamp: 2025-10-01T19:53:34.261Z
Learning: For scripts/modules/task-manager/*.js: Use generateObjectService with Zod schemas for structured AI responses rather than generateTextService + manual JSON parsing, as modern AI providers increasingly support the tool use and generateObject paradigm with improved reliability.
Applied to files:
src/ai-providers/gemini-cli.jstests/unit/ai-providers/gemini-cli-structured-output.test.jsdocs/providers/gemini-cli.mdtests/unit/ai-providers/gemini-cli.test.js
📚 Learning: 2025-07-18T17:08:48.695Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-18T17:08:48.695Z
Learning: Applies to scripts/modules/commands.js : Validate file existence for critical file operations, provide context-specific validation for identifiers, and check required API keys for features that depend on them.
Applied to files:
src/ai-providers/gemini-cli.js
📚 Learning: 2025-07-21T14:14:48.694Z
Learnt from: rtmcrc
Repo: eyaltoledano/claude-task-master PR: 933
File: scripts/modules/supported-models.json:238-238
Timestamp: 2025-07-21T14:14:48.694Z
Learning: Model version updates in scripts/modules/supported-models.json may be included in feature PRs if they provide practical improvements like reduced error rates, even if not directly related to the main feature being implemented.
Applied to files:
docs/providers/gemini-cli.md
📚 Learning: 2025-08-08T11:34:45.482Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: .changeset/vast-weeks-fetch.md:5-5
Timestamp: 2025-08-08T11:34:45.482Z
Learning: This repo’s supported models list is CI-generated into docs/models.md from scripts/modules/supported-models.json (workflow: .github/workflows/update-models-md.yml using docs/scripts/models-json-to-markdown.js). Don’t request manual edits to the Markdown; ensure the JSON is correct instead. README links to docs/models.md.
Applied to files:
docs/providers/gemini-cli.md
📚 Learning: 2025-08-08T11:34:45.482Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: .changeset/vast-weeks-fetch.md:5-5
Timestamp: 2025-08-08T11:34:45.482Z
Learning: In this repo, supported-models.md is auto-generated by CI from supported-models.json; do not request manual edits to that file—ensure JSON entries are correct instead.
Applied to files:
docs/providers/gemini-cli.md
📚 Learning: 2025-08-08T11:34:45.482Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: .changeset/vast-weeks-fetch.md:5-5
Timestamp: 2025-08-08T11:34:45.482Z
Learning: In this repo, the supported models list is auto-generated by CI into docs/models.md from scripts/modules/supported-models.json via .github/workflows/update-models-md.yml and docs/scripts/models-json-to-markdown.js. Don’t request manual edits to the Markdown; ensure the JSON is correct instead.
Applied to files:
docs/providers/gemini-cli.md
📚 Learning: 2025-08-02T14:54:52.216Z
Learnt from: eyaltoledano
Repo: eyaltoledano/claude-task-master PR: 1069
File: .changeset/floppy-news-buy.md:7-38
Timestamp: 2025-08-02T14:54:52.216Z
Learning: For major feature additions like new CLI commands, eyaltoledano prefers detailed changesets with comprehensive descriptions, usage examples, and feature explanations rather than minimal single-line summaries.
Applied to files:
docs/providers/gemini-cli.md
📚 Learning: 2025-09-29T13:33:46.952Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1246
File: src/ai-providers/claude-code.js:40-42
Timestamp: 2025-09-29T13:33:46.952Z
Learning: Claude Code provider should use environment variable isolation to temporarily manage ANTHROPIC_API_KEY during client creation: if CLAUDE_CODE_API_KEY is set, temporarily set ANTHROPIC_API_KEY to that value; if CLAUDE_CODE_API_KEY is not set but ANTHROPIC_API_KEY exists, temporarily unset ANTHROPIC_API_KEY to force OAuth mode. This prevents the ai-sdk-provider-claude-code package from accidentally using API keys intended for the regular Anthropic provider while still allowing explicit API key usage as a fallback.
Applied to files:
tests/unit/ai-providers/gemini-cli.test.js
🧬 Code graph analysis (2)
tests/unit/ai-providers/gemini-cli-structured-output.test.js (1)
src/ai-providers/gemini-cli.js (1)
GeminiCliProvider(20-95)
tests/unit/ai-providers/gemini-cli.test.js (1)
src/ai-providers/gemini-cli.js (1)
GeminiCliProvider(20-95)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test
🔇 Additional comments (24)
apps/extension/README.md (1)
43-43: Node 20+ prerequisite docs are consistent with the engine bumpBoth the prerequisites and troubleshooting sections now call out Node 20+, which matches the raised engines.node requirement elsewhere in the repo. No further changes needed here; just keep these in sync with the root package.json on future bumps.
Also applies to: 128-128
packages/ai-sdk-provider-grok-cli/package.json (1)
28-28: Engines constraint aligned to Node >=20Raising
engines.nodeto>=20here is consistent with the rest of the monorepo and with the tooling stack used by this package. No additional adjustments required.docs/providers/codex-cli.md (1)
32-32: Codex provider docs now correctly require Node >=20The Codex CLI docs’ Node.js requirement is updated to
>= 20.0.0, matching the engines bump and other documentation. Looks good.docs/providers/gemini-cli.md (2)
110-113: Model list updates for Gemini CLI look consistentDocumenting
gemini-3-pro-previewalongsidegemini-2.5-proandgemini-2.5-flashin both the main “Available Models” and the “Model not found” troubleshooting section keeps usage and error docs aligned. This matches the expanded model support introduced in the PR.Also applies to: 138-141
157-190: Native structured-output docs match the new provider behaviourThe new “Native Structured Outputs (v1.4.0+)” section accurately reflects the move to SDK-native structured outputs: forwarding Zod schemas, relying on
responseJsonSchema/JSON-only responses, and listing the structured-output commands (parse-prd, expand, add-task, update-task, analyze-complexity). The Node 20+ andai-sdk-provider-gemini-cli >= 1.4.0requirements are in line with the engine bump and the new SDK usage, and the important-notes bullets correctly call out limited model support and native schema enforcement. This is well aligned with the code and tests that now use schema-based generateObject/streamObject flows. Based on learnings, this matches the repository’s preferred Zod-based structured-output pattern.Also applies to: 194-198
tests/unit/ai-providers/gemini-cli-structured-output.test.js (3)
1-46: Mock setup and ESM import pattern are solidUsing
jest.unstable_mockModuleforai,ai-sdk-provider-gemini-cli, and local utilities before the top-levelawait importcleanly isolates the provider for unit testing in an ESM/Jest environment. The mocked exports cover the necessary surface area (generateObject/streamObject/zodSchema plus JSONParseError/NoObjectGeneratedError) without overcomplicating the setup.
202-269: streamObject tests exercise schema wrapping and limits appropriatelyThe streaming tests verify that
streamObjectis called once with aschemaproduced via thezodSchemawrapper, that the wrapper receives the original Zod schema, thatmodedefaults to'auto', and thatmaxTokensis mapped through asmaxOutputTokens. Returning and asserting on the rawpartialObjectStreamcontainer keeps the focus on integration with the AI SDK rather than the stream consumption details, which is a good unit-test boundary.
271-338: SDK integration tests correctly pin model wiringThe integration block confirms that
generateObjectis invoked with amodelbuilt from the requestedmodelId, and that this works forgemini-2.5-pro,gemini-2.5-flash, andgemini-3-pro-preview. ThemockModel/createGeminiProvidersetup makes this wiring explicit and ensures the provider passes the expected model into the AI SDK, which is exactly what you want to lock down as more Gemini models are added.tests/unit/ai-providers/gemini-cli.test.js (11)
23-24: BaseAIProvider mock defaults are sensible for test isolationSetting
needsExplicitJsonSchema = falseandsupportsTemperature = trueon the mock base provider matches the expectations these tests assert and keeps Gemini-specific behavior under the concrete provider. No issues here.
61-63: Constructor test forsupportsTemperatureis appropriateAsserting
supportsTemperatureisfalseforGeminiCliProviderencodes the current limitation of the Gemini CLI and will catch accidental regressions if temperature handling is added incorrectly.
77-87: ExtendedvalidateAuthtests cover useful edge casesThe additional tests verifying that
validateAuthdoes not throw when called with no API key, with an empty params object, with no arguments, and withundefinedhelp ensure the no-op implementation remains robust as the call sites evolve.
137-147: OAuth +baseURLpropagation test aligns withgetClientbehaviorThe test confirming that
baseURLis forwarded when no API key is provided and OAuth is used matches thegetClientlogic and ensures custom endpoints are wired correctly.
156-161: Empty-string API key fallback to OAuth is well-specifiedAsserting that an empty string API key results in OAuth-based auth options (
authType: 'oauth-personal') makes the truthy check behavior explicit and guards against regressions if the condition is later refactored.
164-172: Error-propagation test forcreateGeminiProviderfailures is solidMocking
createGeminiProviderto throw and asserting thatgetClientrejects with the same error verifies thathandleErrordoes not swallow initialization failures. This is good coverage for a critical failure path.
175-179:getRequiredApiKeyNamecontract is now testedAdding an assertion that
getRequiredApiKeyName()returns'GEMINI_API_KEY'locks in the public contract used by surrounding tooling (env validation, docs, UI), which is appropriate even though the key is optional.
181-185:isRequiredApiKeytest correctly encodes optional-key semanticsThe test asserting
isRequiredApiKey()returnsfalsemakes it clear that gemini-cli primarily uses OAuth and that the API key is an optional compatibility path. This aligns with the implementation and avoids future ambiguity.
187-233: Base-class delegation and JSON-helper removal tests are useful structural guardsThese tests ensure
GeminiCliProviderdoes not introduce its owngenerateText/streamText/generateObject/streamObjectoverrides and that the legacy JSON extraction helpers remain absent. They provide good white-box coverage that the provider relies on the base class and SDK for these concerns, matching the PR’s goals.
237-260: Authentication scenarios block nicely mirrorsgetClientbehaviorThe scenario-style tests for API-key auth, OAuth without a key, and the special
gemini-cli-no-key-requiredsentinel reinforce the expectations already covered in thegetClientblock and read well as higher-level behavior descriptions. Minor duplication is acceptable here for clarity.
65-69: Fix misleading comment about SDK structured-output flagsThe test correctly asserts that
needsExplicitJsonSchemaisfalse, but the inline comment refers to specific SDK flags (defaultObjectGenerationMode = 'json',supportsStructuredOutputs = true) that earlier analysis ofai-sdk-provider-gemini-cli@1.4.0showed are not exposed as true native structured-output fields. This can mislead future maintainers about what guarantees the SDK actually provides.Consider rewording to describe the behavior more generically, for example:
- // The SDK has defaultObjectGenerationMode = 'json' and supportsStructuredOutputs = true - // so we don't need to override this in the provider - expect(provider.needsExplicitJsonSchema).toBe(false); + // Structured/object generation is handled by the SDK, so the provider + // does not need a custom needsExplicitJsonSchema override. + expect(provider.needsExplicitJsonSchema).toBe(false);This keeps the test assertion while avoiding incorrect claims about SDK internals.
src/ai-providers/gemini-cli.js (5)
18-18: Static import ofBaseAIProviderwith explicit.jsextension matches ESM conventionsImporting
BaseAIProvidervia a static ESM import with the.jsextension is consistent with the rest of the ESM codebase and with the prior guidance to use static imports now that the Gemini SDK provider is a required dependency. No issues here.
Based on learnings, static imports are preferred once providers are no longer optional.
29-38:validateAuthdocumentation matches the intentional no-op implementationThe expanded JSDoc clarifies that auth is expected to be handled by the SDK (OAuth first, API key as an optional fallback), and the empty
validateAuthbody is consistent with that design. Good to keep this behavior explicit in the docs.
50-52: Auth precedence comment aligns withgetClientbehavior and testsThe comment establishing OAuth as the primary path and API key as a compatibility fallback matches the conditional on
params.apiKeyand the associated tests, and it documents the intended priority clearly.
80-85:getRequiredApiKeyNameJSDoc clarifies public contractDocumenting that this returns the
GEMINI_API_KEYenv var name aligns with the new tests and with how other providers expose their key names. This is a clear, stable surface for tooling.
87-94:isRequiredApiKey()addition cleanly encodes optional key behaviorAdding
isRequiredApiKey()returningfalseplus the clarifying JSDoc makes it explicit that Gemini CLI primarily relies on OAuth and that the environment API key is optional. This small API keeps the provider consistent with others while reflecting the gemini-cli-specific auth model.
|
Sonnet found it related to npm/node bug in version I'm running, rebuilt with Node 20 fine and I think it will pass now. |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.changeset/gemini-cli-native-structured-output.md (1)
1-9: Consider expanding the changeset for this major feature.While the technical details are accurate, this changeset could benefit from additional user-facing information about this significant upgrade. Based on the learnings preference for detailed changesets on major features, consider adding:
- User Benefits: Explain what native structured outputs mean for end users (e.g., "Commands like
parse-prd,expand,add-task,update-task, andanalyze-complexitynow return guaranteed schema-compliant JSON with no parsing errors")- Reliability Impact: Emphasize the improved reliability and performance from native API-level schema enforcement
- Requirements: Note that Node.js 20+ is now required (though the PR context suggests this may already be established)
Based on learnings, detailed changesets help users understand the value of major features.
Example expansion:
--- "task-master-ai": minor --- Upgrade gemini-cli provider to native structured output support +**What's New** + +The Gemini CLI provider now uses Gemini API's native `responseJsonSchema` parameter for guaranteed schema-compliant JSON output. This eliminates JSON parsing errors and improves reliability for all structured output commands. + +**Benefits** + +- **No More JSON Parsing Errors**: Native API-level schema enforcement ensures valid, parseable JSON every time +- **Improved Reliability**: Commands return consistent, predictable output that matches your schemas +- **Better Performance**: Eliminates post-processing and JSON extraction overhead + +**Affected Commands** + +All structured output commands benefit from this upgrade: +- `task-master parse-prd` - Parse PRD and generate tasks +- `task-master expand` - Expand tasks into subtasks +- `task-master add-task` - Add new tasks with AI assistance +- `task-master update-task` - Update existing tasks +- `task-master analyze-complexity` - Analyze task complexity + +**Technical Details** + - Upgrade `ai-sdk-provider-gemini-cli` from v1.1.1 to v1.4.0 with native `responseJsonSchema` support - Simplify provider implementation by removing JSON extraction workarounds (652 lines → 95 lines) - Enable native structured output via Gemini API's schema enforcement
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (16)
.changeset/gemini-cli-native-structured-output.md(1 hunks)CONTRIBUTING.md(1 hunks)apps/cli/package.json(1 hunks)apps/docs/getting-started/contribute.mdx(1 hunks)apps/extension/README.md(2 hunks)apps/mcp/package.json(1 hunks)docs/configuration.md(1 hunks)docs/providers/codex-cli.md(1 hunks)docs/providers/gemini-cli.md(3 hunks)package.json(2 hunks)packages/ai-sdk-provider-grok-cli/package.json(1 hunks)packages/claude-code-plugin/commands/install-taskmaster.md(1 hunks)packages/tm-core/README.md(1 hunks)src/ai-providers/gemini-cli.js(3 hunks)tests/unit/ai-providers/gemini-cli-structured-output.test.js(1 hunks)tests/unit/ai-providers/gemini-cli.test.js(5 hunks)
✅ Files skipped from review due to trivial changes (1)
- tests/unit/ai-providers/gemini-cli-structured-output.test.js
🚧 Files skipped from review as they are similar to previous changes (8)
- package.json
- apps/extension/README.md
- packages/claude-code-plugin/commands/install-taskmaster.md
- docs/configuration.md
- src/ai-providers/gemini-cli.js
- apps/mcp/package.json
- packages/tm-core/README.md
- docs/providers/codex-cli.md
🧰 Additional context used
🧠 Learnings (14)
📓 Common learnings
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1252
File: package.json:130-132
Timestamp: 2025-09-26T19:03:33.225Z
Learning: In the eyaltoledano/claude-task-master repository, packages are bundled using tsdown during the build process, which means dependencies imported by the source code (including tm internal packages like tm/ai-sdk-provider-grok-cli) are included in the final bundle and don't need to be available as separate runtime dependencies, so they should remain as devDependencies rather than being moved to dependencies.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/src/auth/oauth-service.ts:20-20
Timestamp: 2025-09-03T13:46:00.640Z
Learning: For Node.js v22 and later, JSON imports should use `with { type: 'json' }` syntax, not `assert { type: 'json' }`. The `assert` syntax was removed in Node.js v22 in favor of the `with` syntax for import attributes. This applies to the eyaltoledano/claude-task-master codebase which uses Node.js v24.
Learnt from: eyaltoledano
Repo: eyaltoledano/claude-task-master PR: 1069
File: .changeset/floppy-news-buy.md:7-38
Timestamp: 2025-08-02T14:54:52.216Z
Learning: For major feature additions like new CLI commands, eyaltoledano prefers detailed changesets with comprehensive descriptions, usage examples, and feature explanations rather than minimal single-line summaries.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1232
File: packages/tm-core/package.json:50-51
Timestamp: 2025-09-22T19:45:04.337Z
Learning: In the eyaltoledano/claude-task-master project, Crunchyman-ralph intentionally omits version fields from internal/private packages in package.json files to prevent changesets from releasing new versions of these packages while still allowing them to be processed for dependency updates. The changesets warnings about missing versions are acceptable as they don't break the process and achieve the desired behavior of only releasing public packages.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1262
File: scripts/modules/task-manager/update-tasks.js:216-233
Timestamp: 2025-10-01T19:53:34.261Z
Learning: For scripts/modules/task-manager/*.js: Use generateObjectService with Zod schemas for structured AI responses rather than generateTextService + manual JSON parsing, as modern AI providers increasingly support the tool use and generateObject paradigm with improved reliability.
📚 Learning: 2025-09-22T19:45:04.337Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1232
File: packages/tm-core/package.json:50-51
Timestamp: 2025-09-22T19:45:04.337Z
Learning: In the eyaltoledano/claude-task-master project, Crunchyman-ralph intentionally omits version fields from internal/private packages in package.json files to prevent changesets from releasing new versions of these packages while still allowing them to be processed for dependency updates. The changesets warnings about missing versions are acceptable as they don't break the process and achieve the desired behavior of only releasing public packages.
Applied to files:
apps/cli/package.jsonpackages/ai-sdk-provider-grok-cli/package.json
📚 Learning: 2025-09-03T13:46:00.640Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/src/auth/oauth-service.ts:20-20
Timestamp: 2025-09-03T13:46:00.640Z
Learning: For Node.js v22 and later, JSON imports should use `with { type: 'json' }` syntax, not `assert { type: 'json' }`. The `assert` syntax was removed in Node.js v22 in favor of the `with` syntax for import attributes. This applies to the eyaltoledano/claude-task-master codebase which uses Node.js v24.
Applied to files:
apps/cli/package.json
📚 Learning: 2025-09-26T19:05:47.555Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1252
File: packages/ai-sdk-provider-grok-cli/package.json:11-13
Timestamp: 2025-09-26T19:05:47.555Z
Learning: In the eyaltoledano/claude-task-master repository, internal tm/ packages use a specific export pattern where the "exports" field points to TypeScript source files (./src/index.ts) while "main" points to compiled output (./dist/index.js) and "types" points to source files (./src/index.ts). This pattern is used consistently across internal packages like tm/core and tm/ai-sdk-provider-grok-cli because they are consumed directly during build-time bundling with tsdown rather than being published as separate packages.
Applied to files:
apps/cli/package.json
📚 Learning: 2025-09-26T19:03:33.225Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1252
File: package.json:130-132
Timestamp: 2025-09-26T19:03:33.225Z
Learning: In the eyaltoledano/claude-task-master repository, packages are bundled using tsdown during the build process, which means dependencies imported by the source code (including tm internal packages like tm/ai-sdk-provider-grok-cli) are included in the final bundle and don't need to be available as separate runtime dependencies, so they should remain as devDependencies rather than being moved to dependencies.
Applied to files:
apps/cli/package.jsonpackages/ai-sdk-provider-grok-cli/package.json
📚 Learning: 2025-07-21T14:14:48.694Z
Learnt from: rtmcrc
Repo: eyaltoledano/claude-task-master PR: 933
File: scripts/modules/supported-models.json:238-238
Timestamp: 2025-07-21T14:14:48.694Z
Learning: Model version updates in scripts/modules/supported-models.json may be included in feature PRs if they provide practical improvements like reduced error rates, even if not directly related to the main feature being implemented.
Applied to files:
docs/providers/gemini-cli.md
📚 Learning: 2025-08-02T14:54:52.216Z
Learnt from: eyaltoledano
Repo: eyaltoledano/claude-task-master PR: 1069
File: .changeset/floppy-news-buy.md:7-38
Timestamp: 2025-08-02T14:54:52.216Z
Learning: For major feature additions like new CLI commands, eyaltoledano prefers detailed changesets with comprehensive descriptions, usage examples, and feature explanations rather than minimal single-line summaries.
Applied to files:
docs/providers/gemini-cli.md
📚 Learning: 2025-08-08T11:34:45.482Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: .changeset/vast-weeks-fetch.md:5-5
Timestamp: 2025-08-08T11:34:45.482Z
Learning: This repo’s supported models list is CI-generated into docs/models.md from scripts/modules/supported-models.json (workflow: .github/workflows/update-models-md.yml using docs/scripts/models-json-to-markdown.js). Don’t request manual edits to the Markdown; ensure the JSON is correct instead. README links to docs/models.md.
Applied to files:
docs/providers/gemini-cli.md
📚 Learning: 2025-08-08T11:34:45.482Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: .changeset/vast-weeks-fetch.md:5-5
Timestamp: 2025-08-08T11:34:45.482Z
Learning: In this repo, supported-models.md is auto-generated by CI from supported-models.json; do not request manual edits to that file—ensure JSON entries are correct instead.
Applied to files:
docs/providers/gemini-cli.md
📚 Learning: 2025-10-01T19:53:34.261Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1262
File: scripts/modules/task-manager/update-tasks.js:216-233
Timestamp: 2025-10-01T19:53:34.261Z
Learning: For scripts/modules/task-manager/*.js: Use generateObjectService with Zod schemas for structured AI responses rather than generateTextService + manual JSON parsing, as modern AI providers increasingly support the tool use and generateObject paradigm with improved reliability.
Applied to files:
docs/providers/gemini-cli.mdtests/unit/ai-providers/gemini-cli.test.js.changeset/gemini-cli-native-structured-output.md
📚 Learning: 2025-09-24T15:46:28.029Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1114
File: src/ai-providers/gemini-cli.js:12-12
Timestamp: 2025-09-24T15:46:28.029Z
Learning: When AI SDK provider packages are moved from optional dependencies to required dependencies in package.json, static imports should be used instead of dynamic imports with error handling, as the package is guaranteed to be available at runtime.
Applied to files:
packages/ai-sdk-provider-grok-cli/package.json
📚 Learning: 2025-09-29T13:33:46.952Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1246
File: src/ai-providers/claude-code.js:40-42
Timestamp: 2025-09-29T13:33:46.952Z
Learning: Claude Code provider should use environment variable isolation to control API key access, temporarily managing ANTHROPIC_API_KEY during client creation to prevent the ai-sdk-provider-claude-code package from automatically picking up API keys intended for other providers, while allowing explicit CLAUDE_CODE_API_KEY usage as a fallback to OAuth authentication.
Applied to files:
tests/unit/ai-providers/gemini-cli.test.js
📚 Learning: 2025-09-29T13:33:46.952Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1246
File: src/ai-providers/claude-code.js:40-42
Timestamp: 2025-09-29T13:33:46.952Z
Learning: Claude Code provider should use environment variable isolation to temporarily manage ANTHROPIC_API_KEY during client creation: if CLAUDE_CODE_API_KEY is set, temporarily set ANTHROPIC_API_KEY to that value; if CLAUDE_CODE_API_KEY is not set but ANTHROPIC_API_KEY exists, temporarily unset ANTHROPIC_API_KEY to force OAuth mode. This prevents the ai-sdk-provider-claude-code package from accidentally using API keys intended for the regular Anthropic provider while still allowing explicit API key usage as a fallback.
Applied to files:
tests/unit/ai-providers/gemini-cli.test.js
📚 Learning: 2025-10-31T18:07:17.402Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1360
File: src/ai-providers/glm.js:0-0
Timestamp: 2025-10-31T18:07:17.402Z
Learning: In src/ai-providers/glm.js, the GLM provider's getClient method should allow defaulting to the 'coding' endpoint when an invalid or unspecified route parameter is provided, as this is the correct behavior per Z.ai's OpenAI-compatible API documentation. Do not enforce strict route validation that throws errors for unknown routes.
Applied to files:
tests/unit/ai-providers/gemini-cli.test.js
🧬 Code graph analysis (1)
tests/unit/ai-providers/gemini-cli.test.js (1)
src/ai-providers/gemini-cli.js (1)
GeminiCliProvider(20-95)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test
🔇 Additional comments (12)
apps/docs/getting-started/contribute.mdx (1)
173-173: LGTM - Node.js prerequisite updated correctly.The update to Node.js 20+ aligns with the repository-wide requirement driven by Node 18's EOL and the SDK upgrade requirements.
CONTRIBUTING.md (1)
173-173: LGTM - Consistent documentation update.The Node.js 20+ requirement is properly reflected in the contributing guidelines, consistent with the broader repository changes.
packages/ai-sdk-provider-grok-cli/package.json (1)
28-28: LGTM - Engine requirement updated for consistency.The Node.js engine constraint update to >=20 ensures consistency across all internal packages in the repository.
apps/cli/package.json (1)
44-44: LGTM - CLI engine requirement updated.The Node.js 20.0.0 minimum requirement for the CLI package is appropriate and aligns with the SDK upgrade and repository-wide standardization.
tests/unit/ai-providers/gemini-cli.test.js (5)
23-24: Well-structured mock updates.The addition of
needsExplicitJsonSchemaandsupportsTemperatureto the BaseAIProvider mock correctly reflects the enhanced base provider interface for structured output support.
61-69: Excellent coverage of provider configuration.These tests validate the provider's configuration for temperature support and explicit JSON schema requirements, ensuring the SDK-driven structured output behavior is properly configured.
112-147: Strong coverage of authentication modes and baseURL propagation.These tests validate the OAuth-default flow with the special marker value and ensure baseURL configuration is correctly passed through to the SDK in both authentication modes.
175-185: Good validation of new public API surface.The tests for
getRequiredApiKeyName()andisRequiredApiKey()properly validate the new public methods that indicate API key requirements, withisRequiredApiKey()correctly returningfalsesince OAuth is the primary authentication method for gemini-cli.
187-234: Thorough verification of architectural changes.This test suite effectively validates:
- Base class delegation (no method overrides for generateText/streamText/generateObject/streamObject)
- Removal of legacy JSON extraction methods
- SDK-driven structured output approach
The comprehensive checks ensure the provider correctly relies on SDK capabilities rather than custom implementations.
docs/providers/gemini-cli.md (3)
111-114: Good model listing update.The addition of
gemini-3-pro-previewexpands the available model options and is consistently documented throughout the file.
157-190: Excellent documentation of the native structured outputs feature.This section provides:
- Clear explanation of key benefits (guaranteed schema compliance, no JSON parsing errors, improved reliability)
- Detailed workflow description showing how schemas are passed to the API
- Comprehensive list of affected commands
- Explicit requirements (Node.js 20+, SDK version)
The documentation will help users understand the value and implementation of this significant upgrade.
192-198: Updated notes section properly reflects all changes.The notes correctly document:
- Extended model support including
gemini-3-pro-preview- Node.js 20+ requirement
- Native schema enforcement support
Summary
ai-sdk-provider-gemini-clifrom v1.1.1 to v1.4.0 with nativeresponseJsonSchemasupportparse-prd,expand,add-task,update-task, andanalyze-complexitycommandsBreaking Change: Node.js 20+ Required
This PR bumps the minimum Node.js requirement from 18 to 20 across all packages. This is a necessary and timely change:
Why this matters:
ai-sdk-provider-gemini-cliv1.4.0 SDK requires Node 20+ for native structured output featuresTechnical Details
Provider Simplification
The gemini-cli provider was completely rewritten to leverage the SDK's native capabilities:
Before (v1.1.1): 652 lines with custom JSON extraction
_extractSystemMessage()- manual system message handling_detectJsonRequest()- JSON request detectionextractJson()- response parsing with regex fallbacksgenerateText,streamText,generateObject,streamObjectoverridesAfter (v1.4.0): 95 lines delegating to BaseAIProvider
mapPromptToGeminiFormat→systemInstructionsupportsStructuredOutputs = trueanddefaultObjectGenerationMode = 'json'responseJsonSchemapassed directly to Gemini APITest Coverage
generateObject/streamObjectFiles Changed
package.json,src/ai-providers/gemini-cli.jsgemini-cli.test.js,gemini-cli-structured-output.test.js(new)apps/cli/package.json,apps/mcp/package.json,packages/ai-sdk-provider-grok-cli/package.jsondocs/providers/gemini-cli.md,docs/providers/codex-cli.md,docs/configuration.md,CONTRIBUTING.md,apps/docs/getting-started/contribute.mdx,apps/extension/README.md,packages/tm-core/README.md,packages/claude-code-plugin/commands/install-taskmaster.mdscripts/modules/commands.js(addedTASKMASTER_SKIP_UPDATEenv var)Test plan
Note
Upgrade Gemini CLI provider to SDK v1.4.0 with native structured outputs, refactor provider to remove JSON hacks, add tests, update docs, and require Node.js 20+ across the repo.
ai-sdk-provider-gemini-clitov1.4.0enabling nativeresponseJsonSchemastructured outputs.src/ai-providers/gemini-cli.jsto delegate to SDK (remove JSON extraction/workarounds; system prompts handled by SDK).generateObject/streamObjectand auth/client creation.package.json, apps, packages) and update docs/readmes accordingly.gemini-3-pro-preview).Written by Cursor Bugbot for commit cdf499f. This will update automatically on new commits. Configure here.
Summary by CodeRabbit
Breaking Changes
New Features
Improvements
Tests
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.