Skip to content

fix: add z.ai coding plan support#1370

Merged
Crunchyman-ralph merged 3 commits intonextfrom
ralph/fix/add.zai.coding.plan
Nov 1, 2025
Merged

fix: add z.ai coding plan support#1370
Crunchyman-ralph merged 3 commits intonextfrom
ralph/fix/add.zai.coding.plan

Conversation

@Crunchyman-ralph
Copy link
Collaborator

@Crunchyman-ralph Crunchyman-ralph commented Nov 1, 2025

What type of PR is this?

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

Description

Related Issues

How to Test This

# Example commands or steps

Expected result:

Contributor Checklist

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

Changelog Entry


For Maintainers

  • PR title follows conventional commits
  • Target branch correct
  • Labels added
  • Milestone assigned (if applicable)

Summary by CodeRabbit

  • New Features

    • Added ZAI Coding Plan as a separate provider option alongside the standard ZAI provider
    • New glm-4.6, glm-4.5 and glm-4.5-air models exposed for the coding provider; glm-4.5-air added for standard ZAI
  • User Experience

    • CLI now shows provider / readable model names during model setup and selection
    • API key detection extended to recognize ZAI provider keys
  • Documentation

    • Broadened custom base URL description to cover compatible providers
  • Tests

    • Added unit tests and mocks for the new coding provider

@changeset-bot
Copy link

changeset-bot bot commented Nov 1, 2025

🦋 Changeset detected

Latest commit: 6ebfcb2

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 1, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adds a separate "zai-coding" provider variant routed to Z.ai's Coding Plan endpoint and integrates it across provider exports, registration, config detection, supported-models, CLI model display, provider-aware model selection, and unit tests.

Changes

Cohort / File(s) Summary
Provider Implementation & Export
src/ai-providers/zai-coding.js, src/ai-providers/index.js
New ZAICodingProvider class extending OpenAICompatibleProvider configured for the Coding Plan base URL and exported from the providers index.
Provider Registration & Config
scripts/modules/ai-services-unified.js, scripts/modules/config-manager.js, packages/tm-core/src/common/constants/providers.ts
Register zai-coding in PROVIDERS; map zai and zai-coding API key checks to ZAI_API_KEY; add 'zai-coding' to VALIDATED_PROVIDERS.
Supported Models Data
scripts/modules/supported-models.json
Update zai models (rename glm-4.5v→glm-4.5, adjust metrics, add glm-4.5-air) and add zai-coding section with glm-4.6, glm-4.5, glm-4.5-air entries (zero-cost configs, updated swe_score, max_tokens, allowed_roles).
Model Selection & Validation Logic
scripts/modules/task-manager/models.js
Introduce provider-aware model lookup using providerHint; add provider-specific validation/lookup branches (OPENROUTER, OLLAMA, BEDROCK, AZURE, VERTEX, LMSTUDIO, OPENAI_COMPATIBLE, etc.), explicit errors/warnings, and baseURL handling.
CLI Types & Prompt Display
apps/cli/src/commands/models/types.ts, apps/cli/src/commands/models/prompts.ts
Add optional name?: string to ModelInfo; prefer model name as displayName (fallback to id) when rendering provider/model choices.
Tests & Mocks
tests/unit/ai-providers/zai-coding.test.js, tests/unit/ai-services-unified.test.js
New unit tests for ZAICodingProvider (constructor, API key, client, validateAuth) and updated provider mock to include ZAICodingProvider.
CLI/Tooling Text & Packaging
.changeset/light-clowns-hope.md, mcp-server/src/tools/models.js, apps/extension/package.json
Add changeset; reword MCP models tool baseURL description to generic providers; update apps/extension devDependency task-master-ai version to *.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant ModelLookup
    participant ProviderValidator
    participant ExternalService

    User->>CLI: setModel(modelId, provider=hint)
    CLI->>ModelLookup: lookup by id + providerHint
    alt Internal match found (id + provider)
        ModelLookup-->>CLI: return internal model (hinted provider)
    else No internal match
        CLI->>ProviderValidator: validate hinted provider + model
        alt OPENROUTER / OLLAMA / remote providers
            ProviderValidator->>ExternalService: fetch live models / check server
            ExternalService-->>ProviderValidator: model found or error
        else Local/compatible providers (LMSTUDIO, OPENAI_COMPATIBLE, etc.)
            ProviderValidator-->>ProviderValidator: provider-specific checks / baseURL handling
        end
        ProviderValidator-->>CLI: validation result (success/warning/error)
    end
    alt Success
        CLI-->>User: Model configured with determined provider
    else Failure
        CLI-->>User: Error + guidance (specify provider or check baseURL/API key)
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45–75 minutes

Areas requiring extra attention:

  • scripts/modules/task-manager/models.js — complex provider-aware lookup, many provider branches, baseURL and error/warning flows.
  • scripts/modules/supported-models.json — ensure model entries (names, swe_score, costs, allowed_roles, max_tokens) are correct and consistent between zai and zai-coding.
  • config/key handling — scripts/modules/config-manager.js and provider constructors (ZAI_API_KEY) to confirm detection and error messages are consistent.
  • Tests and provider mock updates — validate tests accurately reflect runtime behavior for missing/present API keys and client creation.

Possibly Related PRs

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 pull request title "add z.ai coding plan support" directly and clearly describes the main change in the changeset. The PR adds a new provider variant (ZAICodingProvider) to support the ZAI Coding Plan subscription endpoint, allowing users to select between the standard ZAI endpoint and the coding-focused endpoint. The title is concise, specific, and accurately summarizes this primary addition. A teammate reviewing the commit history would immediately understand that this PR introduces ZAI Coding Plan support. The title contains no vague terminology or noise and is not misleading or off-topic.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

🧹 Nitpick comments (1)
tests/unit/ai-providers/zai-coding.test.js (1)

51-58: Consider strengthening the test assertion or clarifying the test intent.

The test is titled "should use coding endpoint by default" but only verifies that the client is defined, not that it actually uses the coding endpoint. While the defaultBaseURL is verified in the constructor test and the base class handles URL resolution, a more explicit assertion would strengthen confidence.

Consider either:

  1. Adding an assertion to verify the endpoint configuration (if accessible), or
  2. Renaming the test to better reflect what it actually verifies (e.g., "should create client with default configuration")
📜 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 560a469 and 7d6ab17.

📒 Files selected for processing (12)
  • .changeset/light-clowns-hope.md (1 hunks)
  • apps/cli/src/commands/models/prompts.ts (1 hunks)
  • apps/cli/src/commands/models/types.ts (1 hunks)
  • mcp-server/src/tools/models.js (1 hunks)
  • packages/tm-core/src/common/constants/providers.ts (1 hunks)
  • scripts/modules/ai-services-unified.js (2 hunks)
  • scripts/modules/config-manager.js (1 hunks)
  • scripts/modules/supported-models.json (1 hunks)
  • scripts/modules/task-manager/models.js (1 hunks)
  • src/ai-providers/index.js (1 hunks)
  • src/ai-providers/zai-coding.js (1 hunks)
  • tests/unit/ai-providers/zai-coding.test.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (26)
src/ai-providers/*.js

📄 CodeRabbit inference engine (.cursor/rules/ai_providers.mdc)

src/ai-providers/*.js: Create a new provider module file in src/ai-providers/ named .js when adding a new AI provider.
Provider modules must export three functions: generateText, streamText, and generateObject.
Provider modules must import the provider's create function from @ai-sdk/, and import generateText, streamText, generateObject from the core ai package, as well as the log utility from ../../scripts/modules/utils.js.
Implement generateText, streamText, and generateObject functions in provider modules with basic validation and try/catch error handling.

Provider-specific wrappers for Vercel AI SDK functions must be implemented in src/ai-providers/*.js, each file corresponding to a provider.

Files:

  • src/ai-providers/zai-coding.js
  • src/ai-providers/index.js
**/*.js

📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)

**/*.js: Declare and initialize global variables at the top of modules to avoid hoisting issues.
Use proper function declarations to avoid hoisting issues and initialize variables before they are referenced.
Do not reference variables before their declaration in module scope.
Use dynamic imports (import()) to avoid initialization order issues in modules.

Files:

  • src/ai-providers/zai-coding.js
  • src/ai-providers/index.js
  • mcp-server/src/tools/models.js
  • tests/unit/ai-providers/zai-coding.test.js
  • scripts/modules/config-manager.js
  • scripts/modules/ai-services-unified.js
  • scripts/modules/task-manager/models.js
.changeset/*.md

📄 CodeRabbit inference engine (.cursor/rules/changeset.mdc)

.changeset/*.md: When running npm run changeset or npx changeset add, provide a concise summary of the changes for the CHANGELOG.md in imperative mood, typically a single line, and not a detailed Git commit message.
The changeset summary should be user-facing, describing what changed in the released version that is relevant to users or consumers of the package.
Do not use your detailed Git commit message body as the changeset summary.

Files:

  • .changeset/light-clowns-hope.md
.changeset/*

📄 CodeRabbit inference engine (.cursor/rules/new_features.mdc)

Create appropriate changesets for new features, use semantic versioning, include tagged system information in release notes, and document breaking changes if any.

Files:

  • .changeset/light-clowns-hope.md
mcp-server/src/tools/*.js

📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)

MCP server tools in mcp-server/src/tools/*.js must have their execute methods wrapped with the withNormalizedProjectRoot higher-order function from tools/utils.js to ensure consistent path handling.

mcp-server/src/tools/*.js: MCP tools must follow a specific structure: use server.addTool with snake_case tool names, define parameters using Zod, and implement the execute function as an async function.
All MCP tool execute methods that require access to the project root MUST be wrapped with the withNormalizedProjectRoot Higher-Order Function (HOF) from mcp-server/src/tools/utils.js.
MCP tools should always call *Direct wrappers instead of executeTaskMasterCommand, except as a fallback if a direct function is not yet implemented.
Use camelCase with Tool suffix for tool registration functions in mcp-server/src/tools/.
Use snake_case for tool names exposed to MCP clients in server.addTool definitions.
Log the start of execution with arguments (sanitized if sensitive), log successful completion with result summary, log all error conditions with appropriate log levels, and include the cache status in result logs in MCP tool files.
Do not log entire large data structures or sensitive information in MCP tool files.
Use handleApiResult to format and return the response from MCP tools.

mcp-server/src/tools/*.js: Create tool definitions in 'mcp-server/src/tools/', use Zod for parameter validation, include optional tag parameter for multi-context support, and follow established naming conventions.
For long-running operations that should not block the client, use the AsyncOperationManager in MCP tools and implement progress reporting.

Files:

  • mcp-server/src/tools/models.js
mcp-server/src/{tools,core/direct-functions}/*.js

📄 CodeRabbit inference engine (.cursor/rules/mcp.mdc)

mcp-server/src/{tools,core/direct-functions}/*.js: Use kebab-case for all file names in mcp-server/src/tools/ and mcp-server/src/core/direct-functions/.
Use helpers from mcp-server/src/tools/utils.js, mcp-server/src/core/utils/path-utils.js, and mcp-server/src/core/utils/ai-client-utils.js for centralized utilities.

Files:

  • mcp-server/src/tools/models.js
mcp-server/src/tools/**/*.js

📄 CodeRabbit inference engine (.cursor/rules/telemetry.mdc)

MCP tool files in mcp-server/src/tools/ must call the corresponding direct function wrapper and pass the result to handleApiResult(result, log) from mcp-server/src/tools/utils.js, ensuring telemetryData is included in the final MCP response.

Files:

  • mcp-server/src/tools/models.js
mcp-server/src/{core/utils,tools}/**/*.js

📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)

Place utilities specifically designed to support the MCP server implementation into the appropriate subdirectories within mcp-server/src/ (e.g., path/core logic helpers in mcp-server/src/core/utils/, tool execution/response helpers in mcp-server/src/tools/utils.js).

Files:

  • mcp-server/src/tools/models.js
tests/unit/ai-providers/*.test.js

📄 CodeRabbit inference engine (.cursor/rules/ai_providers.mdc)

Create unit tests for the new provider in tests/unit/ai-providers/.test.js, mocking @ai-sdk/ and core ai module functions, and testing all exported functions for correct behavior and error handling.

Files:

  • tests/unit/ai-providers/zai-coding.test.js
tests/{unit,integration,e2e,fixtures}/**/*.js

📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)

Test files must be organized as follows: unit tests in tests/unit/, integration tests in tests/integration/, end-to-end tests in tests/e2e/, and test fixtures in tests/fixtures/.

Files:

  • tests/unit/ai-providers/zai-coding.test.js
**/*.{test,spec}.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/git_workflow.mdc)

**/*.{test,spec}.{js,ts,jsx,tsx}: Create a test file and ensure all tests pass when all subtasks are complete; commit tests if added or modified
When all subtasks are complete, run final testing using the appropriate test runner (e.g., npm test, jest, or manual testing)

Files:

  • tests/unit/ai-providers/zai-coding.test.js
**/*.test.js

📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)

**/*.test.js: Never use asynchronous operations in tests. Make all mocks return synchronous values when possible.
Always mock tests properly based on the way the tested functions are defined and used.
Follow the test file organization: mocks must be set up before importing modules under test, and spies on mocked modules should be set up after imports.
Use fixtures from tests/fixtures/ for consistent sample data across tests.
Always declare mocks before importing the modules being tested in Jest test files.
Use jest.spyOn() after imports to create spies on mock functions and reference these spies in test assertions.
When testing functions with callbacks, get the callback from your mock's call arguments, execute it directly with test inputs, and verify the results.
For ES modules, use jest.mock() before static imports and jest.unstable_mockModule() before dynamic imports to mock dependencies.
Reset mock functions (mockFn.mockReset()) before dynamic imports if they might have been called previously.
When verifying console assertions, assert against the actual arguments passed (single formatted string), not multiple arguments.
Use mock-fs to mock file system operations in tests, and restore the file system after each test.
Mock API calls (e.g., Anthropic/Claude) by mocking the entire module and providing predictable responses.
Set mock environment variables in test setup and restore them after each test.
Maintain test fixtures separate from test logic.
Follow the mock-first-then-import pattern for all Jest mocks.
Do not define mock variables before jest.mock() calls (they won't be accessible due to hoisting).
Use test-specific file paths (e.g., 'test-tasks.json') for all file operations in tests.
Mock readJSON and writeJSON to avoid real file system interactions in tests.
Verify file operations use the correct paths in expect statements.
Use different file paths for each test to avoid test interdependence.
Verify modifications on the in-memory task objects passed to w...

Files:

  • tests/unit/ai-providers/zai-coding.test.js
tests/unit/**/*.test.js

📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)

tests/unit/**/*.test.js: Unit tests must be located in tests/unit/, test individual functions and utilities in isolation, mock all external dependencies, and keep tests small, focused, and fast.
Do not include actual command execution in unit tests.

Files:

  • tests/unit/ai-providers/zai-coding.test.js
tests/{unit,integration,e2e}/**/*.test.js

📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)

tests/{unit,integration,e2e}/**/*.test.js: When testing CLI commands built with Commander.js, test the command action handlers directly rather than trying to mock the entire Commander.js chain.
When mocking the Commander.js chain, mock ALL chainable methods (option, argument, action, on, etc.) and return this (or the mock object) from all chainable method mocks.
Explicitly handle all options, including defaults and shorthand flags (e.g., -p for --prompt), and include null/undefined checks in test implementations for parameters that might be optional.
Do not try to use the real action implementation without proper mocking, and do not mock Commander partially—either mock it completely or test the action directly.
Mock the action handlers for CLI commands and verify they're called with correct arguments.
Use sample task fixtures for consistent test data, mock file system operations, and test both success and error paths for task operations.
Mock console output and verify correct formatting in UI function tests. Use flexible assertions like toContain() or toMatch() for formatted output.
Mock chalk functions to return the input text to make testing easier while still verifying correct function calls.

Files:

  • tests/unit/ai-providers/zai-coding.test.js
**/*.{test,spec}.*

📄 CodeRabbit inference engine (.cursor/rules/test_workflow.mdc)

Test files should follow naming conventions: .test., .spec., or _test. depending on the language

Files:

  • tests/unit/ai-providers/zai-coding.test.js
tests/{unit,integration,e2e}/**

📄 CodeRabbit inference engine (.cursor/rules/test_workflow.mdc)

Organize test directories by test type (unit, integration, e2e) and mirror source structure where possible

Files:

  • tests/unit/ai-providers/zai-coding.test.js
scripts/modules/config-manager.js

📄 CodeRabbit inference engine (.cursor/rules/ai_providers.mdc)

scripts/modules/config-manager.js: Update scripts/modules/config-manager.js to add the new provider to MODEL_MAP, ensure it is included in VALID_PROVIDERS, and update API key handling logic.
If adding Ollama or another provider not requiring an API key, add a specific check at the beginning of isApiKeySet and getMcpApiKeyStatus in scripts/modules/config-manager.js to return true immediately for that provider.

scripts/modules/config-manager.js: Import and use specific getters from scripts/modules/config-manager.js to access configuration values needed for application logic; pass the explicitRoot parameter to getters if calling from MCP direct functions.
Use isApiKeySet(providerName, session) from config-manager.js to check if a provider's key is available before attempting an AI call.
Handle potential ConfigurationError if the .taskmasterconfig file is missing or invalid when accessed via getConfig.

Files:

  • scripts/modules/config-manager.js
scripts/modules/*.js

📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)

Each module in scripts/modules/ should be focused on a single responsibility, following the modular architecture (e.g., commands.js for CLI command handling, task-manager.js for task data and core logic, dependency-manager.js for dependency management, ui.js for CLI output formatting, ai-services-unified.js for AI service integration, config-manager.js for configuration management, utils.js for utility functions).

scripts/modules/*.js: Export all core functions, helper functions, and utility methods needed by your new function or command from their respective modules. Explicitly review the module's export block to ensure every required dependency is included.
Pass all required parameters to functions you call within your implementation and verify that direct function parameters match their core function counterparts.
Use consistent file naming conventions: 'task_${id.toString().padStart(3, '0')}.txt', use path.join for composing file paths, and use appropriate file extensions (.txt for tasks, .json for data).
Use structured error objects with code and message properties, include clear error messages, and handle both function-specific and file system errors.
Import all silent mode utilities together from 'scripts/modules/utils.js' and always use isSilentMode() to check global silent mode status. Wrap core function calls within direct functions using enableSilentMode() and disableSilentMode() in a try/finally block if the core function might produce console output.
Core functions should check outputFormat === 'text' before displaying UI elements and use internal logging that respects silent mode.
Design functions to accept dependencies as parameters (dependency injection) and avoid hard-coded dependencies that are difficult to mock.
Keep pure logic separate from I/O operations or UI rendering to allow testing the logic without mocking complex dependencies.
When implementing core logic for new features, do so in 'scripts/modules/' before CLI or MCP interfaces, and d...

Files:

  • scripts/modules/config-manager.js
  • scripts/modules/ai-services-unified.js
scripts/modules/**

📄 CodeRabbit inference engine (.cursor/rules/dev_workflow.mdc)

When using the MCP server, restart it if core logic in scripts/modules or MCP tool/direct function definitions change.

Files:

  • scripts/modules/config-manager.js
  • scripts/modules/ai-services-unified.js
  • scripts/modules/supported-models.json
  • scripts/modules/task-manager/models.js
scripts/modules/*

📄 CodeRabbit inference engine (.cursor/rules/tags.mdc)

scripts/modules/*: Every command that reads or writes tasks.json must be tag-aware
All command files must import getCurrentTag from utils.js
Every CLI command that operates on tasks must include the --tag CLI option
All commands must resolve the tag using the pattern: options.tag || getCurrentTag(projectRoot) || 'master'
All commands must find projectRoot with error handling before proceeding
All commands must pass { projectRoot, tag } as context to core functions
MCP direct functions must accept and use a context object containing projectRoot and tag, and pass them to core functions
Do not hard-code tag resolution (e.g., const tag = options.tag || 'master';); always use getCurrentTag
Do not omit the --tag CLI option in commands that operate on tasks
Do not omit the context parameter when calling core functions from commands
Do not call readJSON or writeJSON without passing projectRoot and tag

Files:

  • scripts/modules/config-manager.js
  • scripts/modules/ai-services-unified.js
  • scripts/modules/supported-models.json
scripts/modules/ai-services-unified.js

📄 CodeRabbit inference engine (.cursor/rules/ai_providers.mdc)

Integrate the new provider module with scripts/modules/ai-services-unified.js by importing it and adding an entry to the PROVIDER_FUNCTIONS map.

scripts/modules/ai-services-unified.js: Centralize all LLM calls through generateTextService or generateObjectService.
Do not import or call anything from the old ai-services.js, ai-client-factory.js, or ai-client-utils.js files.
Do not fetch AI-specific parameters (model ID, max tokens, temp) using config-manager.js getters for the AI call. Pass the role instead.
Do not implement fallback or retry logic outside ai-services-unified.js.
Do not handle API key resolution outside the service layer (it uses utils.js internally).

The telemetryData object returned by ai-services-unified.js must include the fields: timestamp, userId, commandName, modelUsed, providerName, inputTokens, outputTokens, totalTokens, totalCost, and currency.

Files:

  • scripts/modules/ai-services-unified.js
scripts/modules/ai-services*.js

📄 CodeRabbit inference engine (.cursor/rules/new_features.mdc)

Ensure AI calls correctly handle and propagate telemetryData as described in 'telemetry.mdc'.

Files:

  • scripts/modules/ai-services-unified.js
scripts/modules/supported-models.json

📄 CodeRabbit inference engine (.cursor/rules/ai_providers.mdc)

Add a new key for the provider and an array of model objects under it in scripts/modules/supported-models.json, including id, name, allowed_roles, and optionally swe_score, cost_per_1m_tokens, and max_tokens.

Files:

  • scripts/modules/supported-models.json
scripts/modules/task-manager/*.js

📄 CodeRabbit inference engine (.cursor/rules/ai_services.mdc)

scripts/modules/task-manager/*.js: Centralize all LLM calls through generateTextService or generateObjectService.
Do not import or call anything from the old ai-services.js, ai-client-factory.js, or ai-client-utils.js files.
Do not initialize AI clients (Anthropic, Perplexity, etc.) directly within core logic (task-manager/) or MCP direct functions.
Do not fetch AI-specific parameters (model ID, max tokens, temp) using config-manager.js getters for the AI call. Pass the role instead.
Do not implement fallback or retry logic outside ai-services-unified.js.
Do not handle API key resolution outside the service layer (it uses utils.js internally).
Determine the appropriate role (main, research, fallback) in your core logic and pass it to the service.
Pass the session object (received in the context parameter, especially from direct function wrappers) to the service call when in MCP context.
Use generateTextService and implement robust manual JSON parsing (with Zod validation after parsing) when structured output is needed, as generateObjectService has shown unreliability with some providers/schemas.
Be aware of potential reliability issues with generateObjectService across different providers and complex schemas. Prefer generateTextService + manual parsing as a more robust alternative for structured data needs.

Files in scripts/modules/task-manager/ should each handle a specific action related to task management (e.g., add-task.js, expand-task.js), supporting the tagged task lists system and backward compatibility.

Files:

  • scripts/modules/task-manager/models.js
scripts/modules/task-manager/*

📄 CodeRabbit inference engine (.cursor/rules/tags.mdc)

scripts/modules/task-manager/*: All core functions in scripts/modules/task-manager/ must accept a context parameter and use it to extract projectRoot and tag
All core functions in scripts/modules/task-manager/ must use readJSON(tasksPath, projectRoot, tag) and writeJSON(tasksPath, data, projectRoot, tag)

Files:

  • scripts/modules/task-manager/models.js
scripts/modules/task-manager/**/*.js

📄 CodeRabbit inference engine (.cursor/rules/telemetry.mdc)

scripts/modules/task-manager/**/*.js: Functions in scripts/modules/task-manager/ that invoke AI services must call the appropriate AI service function (e.g., generateObjectService), passing commandName and outputType in the params object.
Core logic functions in scripts/modules/task-manager/ must return an object that includes aiServiceResponse.telemetryData.
If the core logic function handles CLI output (outputFormat === 'text' or 'cli'), and aiServiceResponse.telemetryData is available, it must call displayAiUsageSummary(aiServiceResponse.telemetryData, 'cli') from scripts/modules/ui.js.

Do not call AI-specific getters (like getMainModelId, getMainMaxTokens) from core logic functions in scripts/modules/task-manager/*; instead, pass the role to the unified AI service.

Files:

  • scripts/modules/task-manager/models.js
🧠 Learnings (43)
📓 Common learnings
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/git_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:31.810Z
Learning: Pull Request descriptions must use the provided template, including Task Overview, Subtasks Completed, Implementation Details, Testing, Breaking Changes, and Related Tasks
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: assets/AGENTS.md:0-0
Timestamp: 2025-09-24T15:12:58.855Z
Learning: Applies to assets/.claude/commands/taskmaster-complete.md : Create .claude/commands/taskmaster-complete.md with steps to review task, verify, run tests, set status done, and show next task
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-07-18T17:06:04.909Z
Learning: Applies to tests/unit/ai-providers/*.test.js : Create unit tests for the new provider in tests/unit/ai-providers/<provider-name>.test.js, mocking ai-sdk/<provider-name> and core ai module functions, and testing all exported functions for correct behavior and error handling.
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.384Z
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.
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-07-18T17:06:04.909Z
Learning: Applies to scripts/modules/config-manager.js : Update scripts/modules/config-manager.js to add the new provider to MODEL_MAP, ensure it is included in VALID_PROVIDERS, and update API key handling logic.
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-07-18T17:06:04.909Z
Learning: Applies to src/ai-providers/*.js : Create a new provider module file in src/ai-providers/ named <provider-name>.js when adding a new AI provider.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/src/auth/config.ts:5-7
Timestamp: 2025-09-02T21:51:27.921Z
Learning: The user Crunchyman-ralph prefers not to use node: scheme imports (e.g., 'node:os', 'node:path') for Node.js core modules and considers suggestions to change bare imports to node: scheme as too nitpicky.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1069
File: .changeset/fix-tag-complexity-detection.md:0-0
Timestamp: 2025-08-02T15:33:22.656Z
Learning: For changeset files (.changeset/*.md), Crunchyman-ralph prefers to ignore formatting nitpicks about blank lines between frontmatter and descriptions, as he doesn't mind having them and wants to avoid such comments in future reviews.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1132
File: .github/workflows/weekly-metrics-discord.yml:81-93
Timestamp: 2025-08-13T22:10:46.958Z
Learning: Crunchyman-ralph ignores YAML formatting nitpicks about trailing spaces when there's no project-specific YAML formatter configured, preferring to focus on functionality over cosmetic formatting issues.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1132
File: .github/workflows/weekly-metrics-discord.yml:81-93
Timestamp: 2025-08-13T22:10:46.958Z
Learning: Crunchyman-ralph ignores YAML formatting nitpicks about trailing spaces when there's no project-specific YAML formatter configured, preferring to focus on functionality over cosmetic formatting issues.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1200
File: src/ai-providers/custom-sdk/grok-cli/language-model.js:96-100
Timestamp: 2025-09-19T16:06:42.182Z
Learning: The user Crunchyman-ralph prefers to keep environment variable names explicit (like GROK_CLI_API_KEY) rather than supporting multiple aliases, to avoid overlap and ensure clear separation between different CLI implementations.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/src/subpath-exports.test.ts:6-9
Timestamp: 2025-09-03T12:45:30.724Z
Learning: The user Crunchyman-ralph prefers to avoid overly nitpicky or detailed suggestions in code reviews, especially for test coverage of minor import paths. Focus on more substantial issues rather than comprehensive coverage of all possible edge cases.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: scripts/modules/supported-models.json:242-254
Timestamp: 2025-08-08T11:33:15.297Z
Learning: Preference: In scripts/modules/supported-models.json, the "name" field is optional. For OpenAI entries (e.g., "gpt-5"), Crunchyman-ralph prefers omitting "name" when the id is explicit enough; avoid nitpicks requesting a "name" in such cases.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1217
File: apps/cli/src/index.ts:16-21
Timestamp: 2025-09-18T16:35:35.147Z
Learning: The user Crunchyman-ralph considers suggestions to export types for better ergonomics (like exporting UpdateInfo type alongside related functions) as nitpicky and prefers not to implement such suggestions.
📚 Learning: 2025-07-18T17:06:04.909Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-07-18T17:06:04.909Z
Learning: Applies to src/ai-providers/*.js : Create a new provider module file in src/ai-providers/ named <provider-name>.js when adding a new AI provider.

Applied to files:

  • src/ai-providers/zai-coding.js
  • src/ai-providers/index.js
  • tests/unit/ai-providers/zai-coding.test.js
  • packages/tm-core/src/common/constants/providers.ts
  • scripts/modules/ai-services-unified.js
  • scripts/modules/task-manager/models.js
📚 Learning: 2025-07-18T17:06:04.909Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-07-18T17:06:04.909Z
Learning: Applies to src/ai-providers/*.js : Provider modules must import the provider's create<ProviderName> function from ai-sdk/<provider-name>, and import generateText, streamText, generateObject from the core ai package, as well as the log utility from ../../scripts/modules/utils.js.

Applied to files:

  • src/ai-providers/zai-coding.js
  • src/ai-providers/index.js
  • tests/unit/ai-providers/zai-coding.test.js
  • packages/tm-core/src/common/constants/providers.ts
  • scripts/modules/ai-services-unified.js
  • scripts/modules/task-manager/models.js
📚 Learning: 2025-07-18T17:07:39.336Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-07-18T17:07:39.336Z
Learning: Applies to src/ai-providers/*.js : Provider-specific wrappers for Vercel AI SDK functions must be implemented in src/ai-providers/*.js, each file corresponding to a provider.

Applied to files:

  • src/ai-providers/zai-coding.js
  • src/ai-providers/index.js
  • tests/unit/ai-providers/zai-coding.test.js
  • scripts/modules/ai-services-unified.js
📚 Learning: 2025-07-18T17:06:04.909Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-07-18T17:06:04.909Z
Learning: Applies to tests/unit/ai-providers/*.test.js : Create unit tests for the new provider in tests/unit/ai-providers/<provider-name>.test.js, mocking ai-sdk/<provider-name> and core ai module functions, and testing all exported functions for correct behavior and error handling.

Applied to files:

  • src/ai-providers/zai-coding.js
  • src/ai-providers/index.js
  • tests/unit/ai-providers/zai-coding.test.js
  • packages/tm-core/src/common/constants/providers.ts
  • scripts/modules/ai-services-unified.js
📚 Learning: 2025-07-18T17:06:04.909Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-07-18T17:06:04.909Z
Learning: Applies to src/ai-providers/*.js : Implement generate<ProviderName>Text, stream<ProviderName>Text, and generate<ProviderName>Object functions in provider modules with basic validation and try/catch error handling.

Applied to files:

  • src/ai-providers/zai-coding.js
  • src/ai-providers/index.js
  • tests/unit/ai-providers/zai-coding.test.js
  • packages/tm-core/src/common/constants/providers.ts
  • scripts/modules/ai-services-unified.js
  • scripts/modules/task-manager/models.js
📚 Learning: 2025-07-18T17:06:04.909Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-07-18T17:06:04.909Z
Learning: Applies to src/ai-providers/*.js : Provider modules must export three functions: generate<ProviderName>Text, stream<ProviderName>Text, and generate<ProviderName>Object.

Applied to files:

  • src/ai-providers/zai-coding.js
  • src/ai-providers/index.js
  • tests/unit/ai-providers/zai-coding.test.js
  • scripts/modules/ai-services-unified.js
  • scripts/modules/task-manager/models.js
📚 Learning: 2025-07-18T17:06:04.909Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-07-18T17:06:04.909Z
Learning: Applies to scripts/modules/ai-services-unified.js : Integrate the new provider module with scripts/modules/ai-services-unified.js by importing it and adding an entry to the PROVIDER_FUNCTIONS map.

Applied to files:

  • src/ai-providers/zai-coding.js
  • src/ai-providers/index.js
  • scripts/modules/config-manager.js
  • scripts/modules/ai-services-unified.js
📚 Learning: 2025-10-31T18:07:17.384Z
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.384Z
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/zai-coding.js
  • src/ai-providers/index.js
  • .changeset/light-clowns-hope.md
  • tests/unit/ai-providers/zai-coding.test.js
  • packages/tm-core/src/common/constants/providers.ts
  • scripts/modules/ai-services-unified.js
📚 Learning: 2025-07-18T17:06:04.909Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-07-18T17:06:04.909Z
Learning: Applies to scripts/modules/config-manager.js : Update scripts/modules/config-manager.js to add the new provider to MODEL_MAP, ensure it is included in VALID_PROVIDERS, and update API key handling logic.

Applied to files:

  • src/ai-providers/zai-coding.js
  • scripts/modules/config-manager.js
  • packages/tm-core/src/common/constants/providers.ts
  • scripts/modules/ai-services-unified.js
  • scripts/modules/supported-models.json
  • scripts/modules/task-manager/models.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/zai-coding.js
  • src/ai-providers/index.js
  • scripts/modules/ai-services-unified.js
  • scripts/modules/supported-models.json
📚 Learning: 2025-07-18T17:12:57.903Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to scripts/modules/ai-services.js : Features that use AI models belong in 'scripts/modules/ai-services.js'.

Applied to files:

  • src/ai-providers/zai-coding.js
  • src/ai-providers/index.js
  • scripts/modules/ai-services-unified.js
  • scripts/modules/supported-models.json
  • scripts/modules/task-manager/models.js
📚 Learning: 2025-07-18T17:06:04.909Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-07-18T17:06:04.909Z
Learning: Applies to scripts/modules/supported-models.json : Add a new key for the provider and an array of model objects under it in scripts/modules/supported-models.json, including id, name, allowed_roles, and optionally swe_score, cost_per_1m_tokens, and max_tokens.

Applied to files:

  • apps/cli/src/commands/models/types.ts
  • apps/cli/src/commands/models/prompts.ts
  • scripts/modules/supported-models.json
  • scripts/modules/task-manager/models.js
📚 Learning: 2025-07-18T17:11:36.732Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-07-18T17:11:36.732Z
Learning: Applies to mcp-server/src/tools/*.js : Use camelCase with Tool suffix for tool registration functions in mcp-server/src/tools/.

Applied to files:

  • mcp-server/src/tools/models.js
📚 Learning: 2025-07-18T17:11:36.732Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-07-18T17:11:36.732Z
Learning: Applies to mcp-server/src/tools/*.js : Use snake_case for tool names exposed to MCP clients in server.addTool definitions.

Applied to files:

  • mcp-server/src/tools/models.js
📚 Learning: 2025-07-18T17:12:57.903Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to mcp-server/src/tools/*.js : Create tool definitions in 'mcp-server/src/tools/', use Zod for parameter validation, include optional tag parameter for multi-context support, and follow established naming conventions.

Applied to files:

  • mcp-server/src/tools/models.js
📚 Learning: 2025-07-18T17:11:36.732Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-07-18T17:11:36.732Z
Learning: Applies to mcp-server/src/tools/*.js : MCP tools must follow a specific structure: use server.addTool with snake_case tool names, define parameters using Zod, and implement the execute function as an async function.

Applied to files:

  • mcp-server/src/tools/models.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to **/*.test.js : Do not import real AI service clients in tests; create fully mocked versions that return predictable responses.

Applied to files:

  • tests/unit/ai-providers/zai-coding.test.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to **/*.test.js : Do not use real AI client initialization logic in tests; create test-specific paths that bypass client initialization.

Applied to files:

  • tests/unit/ai-providers/zai-coding.test.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to tests/unit/**/*.test.js : Unit tests must be located in tests/unit/, test individual functions and utilities in isolation, mock all external dependencies, and keep tests small, focused, and fast.

Applied to files:

  • tests/unit/ai-providers/zai-coding.test.js
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/config-manager.js : Use `isApiKeySet(providerName, session)` from `config-manager.js` to check if a provider's key is available before attempting an AI call.

Applied to files:

  • tests/unit/ai-providers/zai-coding.test.js
  • scripts/modules/config-manager.js
📚 Learning: 2025-07-18T17:06:04.909Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-07-18T17:06:04.909Z
Learning: Applies to scripts/modules/config-manager.js : If adding Ollama or another provider not requiring an API key, add a specific check at the beginning of isApiKeySet and getMcpApiKeyStatus in scripts/modules/config-manager.js to return true immediately for that provider.

Applied to files:

  • scripts/modules/config-manager.js
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Support both `.env` files and MCP session environment for environment variable resolution, provide fallbacks for missing values, and handle API key resolution correctly.

Applied to files:

  • scripts/modules/config-manager.js
📚 Learning: 2025-07-18T17:06:57.833Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-07-18T17:06:57.833Z
Learning: Applies to scripts/modules/task-manager/*.js : Do not handle API key resolution outside the service layer (it uses `utils.js` internally).

Applied to files:

  • scripts/modules/config-manager.js
📚 Learning: 2025-07-18T17:06:04.909Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-07-18T17:06:04.909Z
Learning: Applies to .cursor/mcp.json.example : Add the new PROVIDER_API_KEY with its placeholder to the env section for taskmaster-ai in .cursor/mcp.json.example.

Applied to files:

  • scripts/modules/config-manager.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to **/*.test.js : Do not rely on environment variables for API keys in tests; set mock environment variables in test setup.

Applied to files:

  • scripts/modules/config-manager.js
📚 Learning: 2025-07-18T17:06:57.833Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-07-18T17:06:57.833Z
Learning: Applies to scripts/modules/ai-services-unified.js : Do not handle API key resolution outside the service layer (it uses `utils.js` internally).

Applied to files:

  • scripts/modules/config-manager.js
📚 Learning: 2025-07-31T22:08:16.039Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/taskmaster.mdc:0-0
Timestamp: 2025-07-31T22:08:16.039Z
Learning: Applies to {.env,.cursor/mcp.json} : Set API keys for AI providers (e.g., ANTHROPIC_API_KEY, OPENAI_API_KEY, etc.) in your .env file in the project root (for CLI use) or within the env section of your .cursor/mcp.json file (for MCP/Cursor integration).

Applied to files:

  • scripts/modules/config-manager.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:

  • scripts/modules/config-manager.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 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:

  • scripts/modules/config-manager.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:

  • scripts/modules/config-manager.js
📚 Learning: 2025-09-24T15:12:58.855Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: assets/AGENTS.md:0-0
Timestamp: 2025-09-24T15:12:58.855Z
Learning: Applies to assets/**/.env : Store provider API keys in .env for CLI usage; ensure at least one provider key (e.g., ANTHROPIC_API_KEY, PERPLEXITY_API_KEY, OPENAI_API_KEY, etc.) is set; research mode requires PERPLEXITY_API_KEY

Applied to files:

  • scripts/modules/config-manager.js
📚 Learning: 2025-07-18T17:06:04.909Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-07-18T17:06:04.909Z
Learning: API keys for providers must be set in the correct location: in the env section of .cursor/mcp.json for MCP/Cursor, or in a .env file in the project root for CLI.

Applied to files:

  • scripts/modules/config-manager.js
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to {.env,.cursor/mcp.json} : Store API keys only in `.env` (for CLI, loaded by `dotenv` in `scripts/dev.js`) or `.cursor/mcp.json` (for MCP, accessed via `session.env`).

Applied to files:

  • scripts/modules/config-manager.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:

  • scripts/modules/ai-services-unified.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:

  • scripts/modules/supported-models.json
📚 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:

  • scripts/modules/supported-models.json
📚 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:

  • scripts/modules/supported-models.json
📚 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:

  • scripts/modules/supported-models.json
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/task-manager/**/*.js : Do not call AI-specific getters (like `getMainModelId`, `getMainMaxTokens`) from core logic functions in `scripts/modules/task-manager/*`; instead, pass the `role` to the unified AI service.

Applied to files:

  • scripts/modules/supported-models.json
  • scripts/modules/task-manager/models.js
📚 Learning: 2025-09-24T15:12:58.855Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: assets/AGENTS.md:0-0
Timestamp: 2025-09-24T15:12:58.855Z
Learning: Applies to assets/.taskmaster/config.json : Never manually edit .taskmaster/config.json; use task-master models to change AI model settings

Applied to files:

  • scripts/modules/supported-models.json
📚 Learning: 2025-07-18T17:06:57.833Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-07-18T17:06:57.833Z
Learning: Applies to scripts/modules/task-manager/*.js : Do not fetch AI-specific parameters (model ID, max tokens, temp) using `config-manager.js` getters for the AI call. Pass the `role` instead.

Applied to files:

  • scripts/modules/task-manager/models.js
📚 Learning: 2025-07-18T17:06:57.833Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-07-18T17:06:57.833Z
Learning: Applies to scripts/modules/task-manager/*.js : Do not import or call anything from the old `ai-services.js`, `ai-client-factory.js`, or `ai-client-utils.js` files.

Applied to files:

  • scripts/modules/task-manager/models.js
🧬 Code graph analysis (4)
src/ai-providers/zai-coding.js (1)
src/ai-providers/openai-compatible.js (1)
  • OpenAICompatibleProvider (14-132)
tests/unit/ai-providers/zai-coding.test.js (2)
src/ai-providers/zai-coding.js (1)
  • ZAICodingProvider (12-21)
tests/unit/ai-providers/zai.test.js (1)
  • provider (7-78)
scripts/modules/ai-services-unified.js (1)
src/ai-providers/zai-coding.js (1)
  • ZAICodingProvider (12-21)
scripts/modules/task-manager/models.js (3)
scripts/modules/ai-services-unified.js (2)
  • modelData (124-124)
  • modelId (540-540)
scripts/modules/update-config-tokens.js (2)
  • modelData (29-31)
  • modelId (25-25)
mcp-server/src/core/direct-functions/models.js (1)
  • providerHint (41-41)
⏰ 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 (8)
mcp-server/src/tools/models.js (1)

85-85: LGTM! Description improvement aligns with broader provider support.

The updated description correctly reflects that multiple providers (not just openai-compatible) support custom base URLs, which aligns with the PR's addition of zai-coding provider support.

apps/cli/src/commands/models/types.ts (1)

39-39: LGTM! Clean addition of optional display name.

The optional name field enables human-readable model names while maintaining backward compatibility. The fallback to id is properly handled in the consuming code.

apps/cli/src/commands/models/prompts.ts (1)

70-84: LGTM! Proper implementation of display name fallback.

The fallback pattern m.name || m.id is correctly implemented and consistently applied to both the display name and short name. The selection value correctly continues to use m.id rather than the display name, ensuring proper model identification.

.changeset/light-clowns-hope.md (1)

5-13: LGTM!

The description is clear, concise, and user-facing. It effectively communicates the new feature and how users can distinguish between the two ZAI provider options.

src/ai-providers/zai-coding.js (1)

1-21: LGTM!

The implementation correctly extends OpenAICompatibleProvider with appropriate configuration for the Z.ai Coding Plan endpoint. All required parameters are properly set, and the class inherits the necessary methods from the base provider.

tests/unit/ai-providers/zai-coding.test.js (1)

1-80: Comprehensive test coverage.

The test suite provides solid coverage of the ZAICodingProvider functionality, including constructor initialization, API key requirements, client creation, and authentication validation. The tests follow established patterns from the ZAI provider tests.

scripts/modules/supported-models.json (2)

930-952: LGTM!

The zai-coding provider configuration for glm-4.6 and glm-4.5 models is correct. The zero-cost configuration appropriately reflects the subscription-based nature of the Coding Plan, while maintaining consistent model capabilities with the standard zai provider.


895-929: Model configuration updates look good.

The updates to the zai provider models are appropriate:

  • glm-4.5 improvements (score, tokens, roles)
  • New glm-4.5-air lightweight variant addition

Note: The allowed_roles inconsistency for glm-4.5-air has been flagged in a separate comment.

@Crunchyman-ralph Crunchyman-ralph merged commit 9c3b273 into next Nov 1, 2025
9 checks passed
@Crunchyman-ralph Crunchyman-ralph deleted the ralph/fix/add.zai.coding.plan branch November 1, 2025 13:36
github-actions bot added a commit that referenced this pull request Nov 1, 2025
  This PR was automatically generated to update documentation based on recent changes.

  Original commit: fix: add z.ai coding plan support (#1370)\n\n\n

  Co-authored-by: Claude <claude-assistant@anthropic.com>
This was referenced Nov 1, 2025
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.

1 participant