Skip to content

feat(gemini-cli): upgrade to native structured output support#1437

Merged
Crunchyman-ralph merged 1 commit intoeyaltoledano:nextfrom
ben-vargas:feat-gemini-cli-structured
Nov 24, 2025
Merged

feat(gemini-cli): upgrade to native structured output support#1437
Crunchyman-ralph merged 1 commit intoeyaltoledano:nextfrom
ben-vargas:feat-gemini-cli-structured

Conversation

@ben-vargas
Copy link
Contributor

@ben-vargas ben-vargas commented Nov 23, 2025

Summary

  • 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
  • Improve reliability of parse-prd, expand, add-task, update-task, and analyze-complexity commands

Breaking 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:

Node Version Status (Nov 2025) Risk Level
Node 18 End-of-Life (Apr 2025) 🔴 High - No security patches for 7 months
Node 20 Maintenance LTS 🟢 Safe - Minimum supported version
Node 22 Active LTS 🟢 Recommended

Why this matters:

  • Node 18 reached EOL on April 30, 2025 and has received no security patches since
  • Major cloud platforms (AWS Lambda, Vercel, Azure Functions) have deprecated Node 18 runtimes
  • The ai-sdk-provider-gemini-cli v1.4.0 SDK requires Node 20+ for native structured output features
  • This aligns Task Master with security best practices and modern JavaScript ecosystem standards

Technical 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 detection
  • extractJson() - response parsing with regex fallbacks
  • Custom generateText, streamText, generateObject, streamObject overrides

After (v1.4.0): 95 lines delegating to BaseAIProvider

  • SDK handles system messages via mapPromptToGeminiFormatsystemInstruction
  • SDK provides supportsStructuredOutputs = true and defaultObjectGenerationMode = 'json'
  • Native responseJsonSchema passed directly to Gemini API
  • No JSON extraction or text parsing needed

Test Coverage

  • 25 unit tests for provider configuration and authentication
  • 11 integration tests (NEW) verifying schema forwarding through generateObject/streamObject
  • Total: 36 tests for gemini-cli provider

Files Changed

Category Files
Core package.json, src/ai-providers/gemini-cli.js
Tests gemini-cli.test.js, gemini-cli-structured-output.test.js (new)
Engine bumps apps/cli/package.json, apps/mcp/package.json, packages/ai-sdk-provider-grok-cli/package.json
Docs docs/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.md
Dev tooling scripts/modules/commands.js (added TASKMASTER_SKIP_UPDATE env var)

Test plan

  • Unit tests pass (36 tests)
  • TypeScript type checking passes
  • Format/lint checks pass
  • Build succeeds
  • Manual testing with gemini-cli provider confirmed working

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 Provider (Gemini CLI):
    • Upgrade ai-sdk-provider-gemini-cli to v1.4.0 enabling native responseJsonSchema structured outputs.
    • Refactor src/ai-providers/gemini-cli.js to delegate to SDK (remove JSON extraction/workarounds; system prompts handled by SDK).
    • Add tests for schema-driven generateObject/streamObject and auth/client creation.
  • Platform/Engines:
    • Bump minimum Node.js to 20+ across repo (package.json, apps, packages) and update docs/readmes accordingly.
  • Docs:
    • Update Gemini CLI docs with native structured outputs section and supported models (incl. gemini-3-pro-preview).
    • Adjust Codex CLI/config/contributing/extension/tm-core docs for Node 20+ and guidance.
  • Dependencies:
    • Update dependencies and lockfile (Gemini CLI core/sdk, related packages).

Written by Cursor Bugbot for commit cdf499f. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

  • Breaking Changes

    • Requires Node.js 20 or later (upgraded from 18+)
  • New Features

    • Native structured output support for the Gemini CLI provider
    • Added gemini-3-pro-preview model option
  • Improvements

    • Simplified Gemini CLI provider with SDK-driven integration
    • Upgraded provider dependency to enable native response schema support
  • Tests

    • Added unit tests for structured output generation and streaming
  • Documentation

    • Updated Node.js prerequisites and added native structured outputs guidance

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Nov 23, 2025

🦋 Changeset detected

Latest 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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 23, 2025

Walkthrough

Upgrades 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

Cohort / File(s) Summary
Node.js engine bumps
package.json, apps/cli/package.json, apps/mcp/package.json, packages/ai-sdk-provider-grok-cli/package.json
Raised Node.js engines requirement from >=18.0.0 to >=20.0.0 across root and workspace packages.
Gemini CLI provider implementation
src/ai-providers/gemini-cli.js
Replaced custom JSON enforcement/parsing with SDK-driven structured outputs via createGeminiProvider; removed needsExplicitJsonSchema field; added isRequiredApiKey() returning false; default OAuth flow with optional API key/baseURL handling; simplified getClient/validateAuth.
Tests — Gemini provider & base
tests/unit/ai-providers/gemini-cli.test.js, tests/unit/ai-providers/gemini-cli-structured-output.test.js, tests/unit/ai-providers/base-provider.js
Added structured-output unit tests; adjusted BaseAIProvider test scaffolding (needsExplicitJsonSchema, supportsTemperature); removed many internal JSON-extraction tests and adapted mocks to SDK behavior.
Dependency & changeset
.changeset/gemini-cli-native-structured-output.md, package.json
Bumped dependency ai-sdk-provider-gemini-cli from ^1.1.1 to ^1.4.0 and added changeset documenting native structured output support.
Docs — Gemini provider & models
docs/providers/gemini-cli.md
Added "Native Structured Outputs (v1.4.0+)" section, expanded model list to include gemini-3-pro-preview, updated notes and Node.js 20+ requirement.
Docs — Codex & configuration
docs/providers/codex-cli.md, docs/configuration.md
Updated Node.js requirement references from >=18 to >=20 in provider docs and configuration.
Docs — contributing/guides/READMEs
CONTRIBUTING.md, apps/docs/getting-started/contribute.mdx, apps/extension/README.md, packages/tm-core/README.md, packages/claude-code-plugin/commands/install-taskmaster.md
Replaced Node.js 18+ references with Node.js 20+ across prerequisites, troubleshooting, and setup instructions.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Focus review on:
    • src/ai-providers/gemini-cli.js — auth flow (OAuth vs API key), baseURL propagation, SDK parameter mapping, and removed JSON logic.
    • tests/unit/ai-providers/* — ensure mocks reflect SDK behavior and structured-output assertions.
    • package.json & workspace engine bumps — confirm CI/tooling compatibility with Node 20.

Possibly related PRs

Suggested reviewers

  • Crunchyman-ralph
  • eyaltoledano

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: upgrading gemini-cli provider to native structured output support, which is the core objective of the PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 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

📥 Commits

Reviewing files that changed from the base of the PR and between 522d9af and 0947a76.

⛔ Files ignored due to path filters (1)
  • package-lock.json is 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.json
  • src/ai-providers/gemini-cli.js
  • package.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.json
  • apps/cli/package.json
  • apps/mcp/package.json
  • scripts/modules/commands.js
  • package.json
  • packages/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.json
  • apps/cli/package.json
  • .changeset/gemini-cli-native-structured-output.md
  • package.json
  • packages/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.mdx
  • apps/cli/package.json
  • docs/configuration.md
  • packages/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.md
  • packages/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.md
  • tests/unit/ai-providers/gemini-cli-structured-output.test.js
  • src/ai-providers/gemini-cli.js
  • tests/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.js
  • packages/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.js
  • 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 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.js
  • package.json
  • tests/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.json
  • packages/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_UPDATE is set to "1" or "true".

docs/providers/gemini-cli.md (2)

110-113: Model list expansion looks good.

The addition of gemini-3-pro-preview to 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() returning false correctly 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_mockModule ensures 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 override needsExplicitJsonSchema.

@ben-vargas ben-vargas force-pushed the feat-gemini-cli-structured branch from 0947a76 to ce5904b Compare November 23, 2025 22:59
@ben-vargas
Copy link
Contributor Author

Note: Removed temporary TASKMASTER_SKIP_UPDATE env var

During development testing of this PR, I temporarily added a TASKMASTER_SKIP_UPDATE environment variable to scripts/modules/commands.js to prevent the CLI auto-update feature from overwriting my npm-linked development version.

I've removed this change to keep this PR focused on gemini-cli native structured output only.

Suggestion for the project

While investigating, I discovered that the codebase already has an established convention for this feature that was never implemented:

TASKMASTER_SKIP_AUTO_UPDATE is used in multiple integration tests:

  • tests/integration/cli/complex-cross-tag-scenarios.test.js
  • apps/cli/tests/integration/commands/next.command.test.ts
  • apps/cli/tests/integration/commands/set-status.command.test.ts
  • apps/cli/tests/integration/commands/list.command.test.ts

These tests set process.env.TASKMASTER_SKIP_AUTO_UPDATE = '1' expecting it to disable auto-updates, but nothing in commands.js actually reads this variable. The tests are essentially no-ops for this feature.

The project should consider implementing TASKMASTER_SKIP_AUTO_UPDATE support in a separate PR to:

  1. Make the existing tests actually work as intended
  2. Provide a documented way for developers to disable auto-updates during local development

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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.apiKey and params.baseURL without first validating that params is 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

📥 Commits

Reviewing files that changed from the base of the PR and between 0947a76 and ce5904b.

⛔ Files ignored due to path filters (1)
  • package-lock.json is 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.md
  • tests/unit/ai-providers/gemini-cli.test.js
  • src/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.md
  • apps/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.md
  • apps/docs/getting-started/contribute.mdx
  • CONTRIBUTING.md
  • apps/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.js
  • src/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-preview added 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 supportsTemperature is explicitly set to false and needsExplicitJsonSchema is inherited as false from the base class.


77-87: LGTM!

Tests appropriately verify that validateAuth accepts 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.

Comment on lines +6 to 15
*
* 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.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 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.

Copy link
Collaborator

@Crunchyman-ralph Crunchyman-ralph left a comment

Choose a reason for hiding this comment

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

lgtm, miss those contributions @ben-vargas refreshing to review your PRs

@ben-vargas ben-vargas force-pushed the feat-gemini-cli-structured branch from ce5904b to 9c47ac9 Compare November 24, 2025 17:34
@Crunchyman-ralph
Copy link
Collaborator

@ben-vargas make sure the CIs pass, maybe just do an npm i ?

@Crunchyman-ralph
Copy link
Collaborator

@ben-vargas regarding TASKMASTER_SKIP_UPDATE=1, just add it to your .env

@ben-vargas
Copy link
Contributor Author

@ben-vargas make sure the CIs pass, maybe just do an npm i ?

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.

@ben-vargas ben-vargas force-pushed the feat-gemini-cli-structured branch from 9c47ac9 to 9486311 Compare November 24, 2025 17:44
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
@ben-vargas ben-vargas force-pushed the feat-gemini-cli-structured branch from 9486311 to cdf499f Compare November 24, 2025 17:47
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
src/ai-providers/gemini-cli.js (1)

6-14: Correct JSDoc about structured-output behavior for ai-sdk-provider-gemini-cli@1.4.0

This comment still claims that v1.4.0 provides native structured outputs via supportsStructuredOutputs, defaultObjectGenerationMode = 'json', and direct responseJsonSchema enforcement, 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 native responseJsonSchema support.

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 behaviours

These tests validate the important aspects of the new structured-output flow: forwarding the Zod schema, using mode: 'auto' when needsExplicitJsonSchema is false, passing schemaName/schemaDescription, mapping SDK token usage to input/output/total, and omitting temperature when supportsTemperature is false. That gives good confidence that the provider is delegating correctly to the AI SDK’s object-generation API.

One minor optional consideration: if needsExplicitJsonSchema is meant to be an internal implementation detail, you could drop the direct assertion on provider.needsExplicitJsonSchema and rely solely on the mode: '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 scenario

Verifying 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: make getClient more defensive for undefined params

getClient assumes params is an object and immediately accesses params.apiKey/params.baseURL. Callers currently always pass an object, but if a future call site ever passes undefined, the first property access will throw a TypeError inside 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

📥 Commits

Reviewing files that changed from the base of the PR and between 9c47ac9 and 9486311.

⛔ Files ignored due to path filters (1)
  • package-lock.json is 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.json
  • 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:

  • 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.js
  • 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 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.js
  • tests/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.js
  • tests/unit/ai-providers/gemini-cli-structured-output.test.js
  • docs/providers/gemini-cli.md
  • tests/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 bump

Both 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 >=20

Raising engines.node to >=20 here 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 >=20

The 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 consistent

Documenting gemini-3-pro-preview alongside gemini-2.5-pro and gemini-2.5-flash in 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 behaviour

The 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+ and ai-sdk-provider-gemini-cli >= 1.4.0 requirements 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 solid

Using jest.unstable_mockModule for ai, ai-sdk-provider-gemini-cli, and local utilities before the top-level await import cleanly 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 appropriately

The streaming tests verify that streamObject is called once with a schema produced via the zodSchema wrapper, that the wrapper receives the original Zod schema, that mode defaults to 'auto', and that maxTokens is mapped through as maxOutputTokens. Returning and asserting on the raw partialObjectStream container 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 wiring

The integration block confirms that generateObject is invoked with a model built from the requested modelId, and that this works for gemini-2.5-pro, gemini-2.5-flash, and gemini-3-pro-preview. The mockModel/createGeminiProvider setup 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 isolation

Setting needsExplicitJsonSchema = false and supportsTemperature = true on 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 for supportsTemperature is appropriate

Asserting supportsTemperature is false for GeminiCliProvider encodes the current limitation of the Gemini CLI and will catch accidental regressions if temperature handling is added incorrectly.


77-87: Extended validateAuth tests cover useful edge cases

The additional tests verifying that validateAuth does not throw when called with no API key, with an empty params object, with no arguments, and with undefined help ensure the no-op implementation remains robust as the call sites evolve.


137-147: OAuth + baseURL propagation test aligns with getClient behavior

The test confirming that baseURL is forwarded when no API key is provided and OAuth is used matches the getClient logic and ensures custom endpoints are wired correctly.


156-161: Empty-string API key fallback to OAuth is well-specified

Asserting 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 for createGeminiProvider failures is solid

Mocking createGeminiProvider to throw and asserting that getClient rejects with the same error verifies that handleError does not swallow initialization failures. This is good coverage for a critical failure path.


175-179: getRequiredApiKeyName contract is now tested

Adding 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: isRequiredApiKey test correctly encodes optional-key semantics

The test asserting isRequiredApiKey() returns false makes 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 guards

These tests ensure GeminiCliProvider does not introduce its own generateText/streamText/generateObject/streamObject overrides 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 mirrors getClient behavior

The scenario-style tests for API-key auth, OAuth without a key, and the special gemini-cli-no-key-required sentinel reinforce the expectations already covered in the getClient block and read well as higher-level behavior descriptions. Minor duplication is acceptable here for clarity.


65-69: Fix misleading comment about SDK structured-output flags

The test correctly asserts that needsExplicitJsonSchema is false, but the inline comment refers to specific SDK flags (defaultObjectGenerationMode = 'json', supportsStructuredOutputs = true) that earlier analysis of ai-sdk-provider-gemini-cli@1.4.0 showed 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 of BaseAIProvider with explicit .js extension matches ESM conventions

Importing BaseAIProvider via a static ESM import with the .js extension 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: validateAuth documentation matches the intentional no-op implementation

The expanded JSDoc clarifies that auth is expected to be handled by the SDK (OAuth first, API key as an optional fallback), and the empty validateAuth body is consistent with that design. Good to keep this behavior explicit in the docs.


50-52: Auth precedence comment aligns with getClient behavior and tests

The comment establishing OAuth as the primary path and API key as a compatibility fallback matches the conditional on params.apiKey and the associated tests, and it documents the intended priority clearly.


80-85: getRequiredApiKeyName JSDoc clarifies public contract

Documenting that this returns the GEMINI_API_KEY env 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 behavior

Adding isRequiredApiKey() returning false plus 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.

@ben-vargas
Copy link
Contributor Author

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.
This is an npm 11.6.3 bug with Node 24.4.0. The CI uses Node 20. Let me switch to Node 20 and try again:

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 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, and analyze-complexity now 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

📥 Commits

Reviewing files that changed from the base of the PR and between 9486311 and cdf499f.

⛔ Files ignored due to path filters (1)
  • package-lock.json is 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.json
  • packages/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.json
  • packages/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.md
  • tests/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 needsExplicitJsonSchema and supportsTemperature to 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() and isRequiredApiKey() properly validate the new public methods that indicate API key requirements, with isRequiredApiKey() correctly returning false since 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-preview expands 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

Copy link
Collaborator

@Crunchyman-ralph Crunchyman-ralph left a comment

Choose a reason for hiding this comment

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

lgtm

@Crunchyman-ralph Crunchyman-ralph merged commit 783398e into eyaltoledano:next Nov 24, 2025
13 checks passed
@ben-vargas ben-vargas deleted the feat-gemini-cli-structured branch November 24, 2025 18:30
@coderabbitai coderabbitai bot mentioned this pull request Nov 24, 2025
16 tasks
@coderabbitai coderabbitai bot mentioned this pull request Nov 25, 2025
16 tasks
sfc-gh-dflippo pushed a commit to sfc-gh-dflippo/task-master-ai that referenced this pull request Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants