Compare commits
5 Commits
task-maste
...
docs/auto-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca1c72675d | ||
|
|
ccb87a516a | ||
|
|
b8830d9508 | ||
|
|
548beb4344 | ||
|
|
555da2b5b9 |
5
.changeset/open-tips-notice.md
Normal file
5
.changeset/open-tips-notice.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"task-master-ai": minor
|
||||
---
|
||||
|
||||
Add 4.5 haiku and sonnet to supported models for claude-code and anthropic ai providers
|
||||
22
.changeset/pre.json
Normal file
22
.changeset/pre.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"mode": "pre",
|
||||
"tag": "rc",
|
||||
"initialVersions": {
|
||||
"task-master-ai": "0.29.0",
|
||||
"@tm/cli": "",
|
||||
"docs": "0.0.6",
|
||||
"extension": "0.25.6",
|
||||
"@tm/mcp": "0.28.0-rc.2",
|
||||
"@tm/ai-sdk-provider-grok-cli": "",
|
||||
"@tm/build-config": "",
|
||||
"@tm/claude-code-plugin": "0.0.2",
|
||||
"@tm/core": ""
|
||||
},
|
||||
"changesets": [
|
||||
"dirty-hairs-know",
|
||||
"fix-parent-directory-traversal",
|
||||
"fix-warning-box-alignment",
|
||||
"light-owls-stay",
|
||||
"metal-rocks-help"
|
||||
]
|
||||
}
|
||||
36
.changeset/some-dodos-wonder.md
Normal file
36
.changeset/some-dodos-wonder.md
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
"task-master-ai": minor
|
||||
---
|
||||
|
||||
Add autonomous TDD workflow automation system with new `tm autopilot` commands and MCP tools for AI-driven test-driven development.
|
||||
|
||||
**New CLI Commands:**
|
||||
|
||||
- `tm autopilot start <taskId>` - Initialize TDD workflow
|
||||
- `tm autopilot next` - Get next action in workflow
|
||||
- `tm autopilot status` - Check workflow progress
|
||||
- `tm autopilot complete` - Advance phase with test results
|
||||
- `tm autopilot commit` - Save progress with metadata
|
||||
- `tm autopilot resume` - Continue from checkpoint
|
||||
- `tm autopilot abort` - Cancel workflow
|
||||
|
||||
**New MCP Tools:**
|
||||
Seven new autopilot tools for programmatic control: `autopilot_start`, `autopilot_next`, `autopilot_status`, `autopilot_complete_phase`, `autopilot_commit`, `autopilot_resume`, `autopilot_abort`
|
||||
|
||||
**Features:**
|
||||
|
||||
- Complete RED → GREEN → COMMIT cycle enforcement
|
||||
- Intelligent commit message generation with metadata
|
||||
- Activity logging and state persistence
|
||||
- Configurable workflow settings via `.taskmaster/config.json`
|
||||
- Comprehensive AI agent integration documentation
|
||||
|
||||
**Documentation:**
|
||||
|
||||
- AI Agent Integration Guide (2,800+ lines)
|
||||
- TDD Quick Start Guide
|
||||
- Example prompts and integration patterns
|
||||
|
||||
> **Learn more:** [TDD Workflow Quickstart Guide](https://dev.task-master.dev/tdd-workflow/quickstart)
|
||||
|
||||
This release enables AI agents to autonomously execute test-driven development workflows with full state management and recovery capabilities.
|
||||
45
CHANGELOG.md
45
CHANGELOG.md
@@ -1,5 +1,50 @@
|
||||
# task-master-ai
|
||||
|
||||
## 0.30.0-rc.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1181](https://github.com/eyaltoledano/claude-task-master/pull/1181) [`a69d8c9`](https://github.com/eyaltoledano/claude-task-master/commit/a69d8c91dc9205a3fdaf9d32276144fa3bcad55d) Thanks [@karol-f](https://github.com/karol-f)! - Add configurable MCP tool loading to optimize LLM context usage
|
||||
|
||||
You can now control which Task Master MCP tools are loaded by setting the `TASK_MASTER_TOOLS` environment variable in your MCP configuration. This helps reduce context usage for LLMs by only loading the tools you need.
|
||||
|
||||
**Configuration Options:**
|
||||
- `all` (default): Load all 36 tools
|
||||
- `core` or `lean`: Load only 7 essential tools for daily development
|
||||
- Includes: `get_tasks`, `next_task`, `get_task`, `set_task_status`, `update_subtask`, `parse_prd`, `expand_task`
|
||||
- `standard`: Load 15 commonly used tools (all core tools plus 8 more)
|
||||
- Additional tools: `initialize_project`, `analyze_project_complexity`, `expand_all`, `add_subtask`, `remove_task`, `generate`, `add_task`, `complexity_report`
|
||||
- Custom list: Comma-separated tool names (e.g., `get_tasks,next_task,set_task_status`)
|
||||
|
||||
**Example .mcp.json configuration:**
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"task-master-ai": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "task-master-ai"],
|
||||
"env": {
|
||||
"TASK_MASTER_TOOLS": "standard",
|
||||
"ANTHROPIC_API_KEY": "your_key_here"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For complete details on all available tools, configuration examples, and usage guidelines, see the [MCP Tools documentation](https://docs.task-master.dev/capabilities/mcp#configurable-tool-loading).
|
||||
|
||||
- [#1312](https://github.com/eyaltoledano/claude-task-master/pull/1312) [`d7fca18`](https://github.com/eyaltoledano/claude-task-master/commit/d7fca1844f24ad8ce079c21d9799a3c4b4413381) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Improve next command to work with remote
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1314](https://github.com/eyaltoledano/claude-task-master/pull/1314) [`6bc75c0`](https://github.com/eyaltoledano/claude-task-master/commit/6bc75c0ac68b59cb10cee70574a689f83e4de768) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Improve auth token refresh flow
|
||||
|
||||
- [#1302](https://github.com/eyaltoledano/claude-task-master/pull/1302) [`3283506`](https://github.com/eyaltoledano/claude-task-master/commit/3283506444d59896ecb97721ef2e96e290eb84d3) Thanks [@bjcoombs](https://github.com/bjcoombs)! - Enable Task Master commands to traverse parent directories to find project root from nested paths
|
||||
|
||||
Fixes #1301
|
||||
|
||||
## 0.29.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -20,7 +20,7 @@ To optimize LLM context usage, you can control which Task Master MCP tools are l
|
||||
### Configuration Modes
|
||||
|
||||
#### All Tools (Default)
|
||||
Loads all 36 available tools. Use when you need full Task Master functionality.
|
||||
Loads all 44 available tools. Use when you need full Task Master functionality.
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -40,7 +40,7 @@ Loads all 36 available tools. Use when you need full Task Master functionality.
|
||||
If `TASK_MASTER_TOOLS` is not set, all tools are loaded by default.
|
||||
|
||||
#### Core Tools (Lean Mode)
|
||||
Loads only 7 essential tools for daily development. Ideal for minimal context usage.
|
||||
Loads only 12 essential tools for daily development. Ideal for minimal context usage.
|
||||
|
||||
**Core tools included:**
|
||||
- `get_tasks` - List all tasks
|
||||
@@ -50,6 +50,11 @@ Loads only 7 essential tools for daily development. Ideal for minimal context us
|
||||
- `update_subtask` - Add implementation notes
|
||||
- `parse_prd` - Generate tasks from PRD
|
||||
- `expand_task` - Break down tasks into subtasks
|
||||
- `autopilot_start` - Start TDD workflow
|
||||
- `autopilot_next` - Get next workflow action
|
||||
- `autopilot_status` - Check workflow status
|
||||
- `autopilot_complete_phase` - Complete workflow phase
|
||||
- `autopilot_commit` - Commit workflow changes
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -69,7 +74,7 @@ Loads only 7 essential tools for daily development. Ideal for minimal context us
|
||||
You can also use `"lean"` as an alias for `"core"`.
|
||||
|
||||
#### Standard Tools
|
||||
Loads 15 commonly used tools. Balances functionality with context efficiency.
|
||||
Loads 20 commonly used tools. Balances functionality with context efficiency.
|
||||
|
||||
**Standard tools include all core tools plus:**
|
||||
- `initialize_project` - Set up new projects
|
||||
@@ -80,6 +85,9 @@ Loads 15 commonly used tools. Balances functionality with context efficiency.
|
||||
- `generate` - Generate task markdown files
|
||||
- `add_task` - Create new tasks
|
||||
- `complexity_report` - View complexity analysis
|
||||
- `autopilot_resume` - Resume interrupted workflow
|
||||
- `autopilot_finalize` - Complete and merge workflow
|
||||
- `autopilot_abort` - Abort current workflow
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -129,8 +137,8 @@ When the MCP server starts, it logs which tools were loaded:
|
||||
Task Master MCP Server starting...
|
||||
Tool mode configuration: standard
|
||||
Loading standard tools
|
||||
Registering 15 MCP tools (mode: standard)
|
||||
Successfully registered 15/15 tools
|
||||
Registering 20 MCP tools (mode: standard)
|
||||
Successfully registered 20/20 tools
|
||||
```
|
||||
|
||||
## Tool Categories
|
||||
@@ -185,4 +193,15 @@ The MCP tools can be categorized in the same way as the core functionalities:
|
||||
- **`list_tags`**: Lists all tags.
|
||||
- **`use_tag`**: Switches to a different tag.
|
||||
- **`rename_tag`**: Renames a tag.
|
||||
- **`copy_tag`**: Copies a tag.
|
||||
- **`copy_tag`**: Copies a tag.
|
||||
|
||||
### 7. Autonomous TDD Workflow (Autopilot)
|
||||
|
||||
- **`autopilot_start`**: Initialize autonomous TDD workflow for a task.
|
||||
- **`autopilot_next`**: Get next action with context in the workflow.
|
||||
- **`autopilot_status`**: Check current workflow status and progress.
|
||||
- **`autopilot_complete_phase`**: Complete current phase with test results.
|
||||
- **`autopilot_commit`**: Commit changes with generated metadata.
|
||||
- **`autopilot_resume`**: Resume interrupted workflow from saved state.
|
||||
- **`autopilot_finalize`**: Complete workflow and merge changes.
|
||||
- **`autopilot_abort`**: Abort current workflow and clean up state.
|
||||
@@ -33,7 +33,47 @@ description: "Configure Task Master through environment variables in a .env file
|
||||
|
||||
## TDD Workflow Configuration
|
||||
|
||||
Additional options for autonomous TDD workflow:
|
||||
Comprehensive options for autonomous TDD workflow via `.taskmaster/config.json`:
|
||||
|
||||
### Core Workflow Settings
|
||||
|
||||
| Setting | Default | Description |
|
||||
| --- | --- | --- |
|
||||
| `workflow.enableAutopilot` | `true` | Enable autopilot/TDD workflow features |
|
||||
| `workflow.maxPhaseAttempts` | `3` | Maximum retry attempts for phase validation |
|
||||
| `workflow.branchPattern` | `"task-{taskId}"` | Branch naming pattern for workflow branches |
|
||||
| `workflow.requireCleanWorkingTree` | `true` | Require clean working tree before starting workflow |
|
||||
| `workflow.autoStageChanges` | `true` | Automatically stage all changes during commit phase |
|
||||
|
||||
### Commit Configuration
|
||||
|
||||
| Setting | Default | Description |
|
||||
| --- | --- | --- |
|
||||
| `workflow.includeCoAuthor` | `true` | Include co-author attribution in commits |
|
||||
| `workflow.coAuthorName` | `"Claude"` | Co-author name for commit messages |
|
||||
| `workflow.coAuthorEmail` | `"noreply@anthropic.com"` | Co-author email for commit messages |
|
||||
| `workflow.commitMessageTemplate` | `"{type}: {description}\n\n{body}"` | Commit message template pattern |
|
||||
| `workflow.defaultCommitType` | `"feat"` | Default commit type for autopilot |
|
||||
| `workflow.allowedCommitTypes` | `["feat", "fix", "refactor", "test", "docs", "chore"]` | Allowed conventional commit types |
|
||||
|
||||
### Test Validation Thresholds
|
||||
|
||||
| Setting | Default | Description |
|
||||
| --- | --- | --- |
|
||||
| `workflow.testThresholds.minTests` | `1` | Minimum test count for valid RED phase |
|
||||
| `workflow.testThresholds.maxFailuresInGreen` | `0` | Maximum allowed failing tests in GREEN phase |
|
||||
|
||||
### Activity Logging
|
||||
|
||||
| Setting | Default | Description |
|
||||
| --- | --- | --- |
|
||||
| `workflow.enableActivityLogging` | `true` | Enable activity logging for workflow events |
|
||||
| `workflow.activityLogPath` | `".taskmaster/logs"` | Path to store workflow activity logs |
|
||||
| `workflow.enableStateBackup` | `true` | Enable automatic backup of workflow state |
|
||||
| `workflow.maxStateBackups` | `10` | Maximum workflow state backups to retain |
|
||||
| `workflow.operationTimeout` | `300000` | Timeout for workflow operations in milliseconds |
|
||||
|
||||
### Environment Variables (Legacy Support)
|
||||
|
||||
| Variable | Default | Description |
|
||||
| --- | --- | --- |
|
||||
@@ -41,9 +81,11 @@ Additional options for autonomous TDD workflow:
|
||||
| `TM_AUTO_COMMIT` | `true` | Auto-commit after GREEN phase |
|
||||
| `TM_PROJECT_ROOT` | Current dir | Default project root |
|
||||
|
||||
## Example .env File
|
||||
## Example Configuration
|
||||
|
||||
```
|
||||
### Environment Variables (.env file)
|
||||
|
||||
```bash
|
||||
# Required
|
||||
ANTHROPIC_API_KEY=sk-ant-api03-your-api-key
|
||||
|
||||
@@ -66,11 +108,56 @@ DEFAULT_PRIORITY=medium
|
||||
DEBUG=false
|
||||
LOG_LEVEL=info
|
||||
|
||||
# TDD Workflow
|
||||
# TDD Workflow (Legacy)
|
||||
TM_MAX_ATTEMPTS=3
|
||||
TM_AUTO_COMMIT=true
|
||||
```
|
||||
|
||||
### Config JSON (.taskmaster/config.json)
|
||||
|
||||
```json
|
||||
{
|
||||
"models": {
|
||||
"main": "claude-3-5-sonnet-20241022",
|
||||
"research": "perplexity-llama-3.1-sonar-large-128k-online",
|
||||
"fallback": "claude-3-haiku-20240307"
|
||||
},
|
||||
"workflow": {
|
||||
"enableAutopilot": true,
|
||||
"maxPhaseAttempts": 3,
|
||||
"branchPattern": "task-{taskId}",
|
||||
"requireCleanWorkingTree": true,
|
||||
"autoStageChanges": true,
|
||||
"includeCoAuthor": true,
|
||||
"coAuthorName": "Claude",
|
||||
"coAuthorEmail": "noreply@anthropic.com",
|
||||
"commitMessageTemplate": "{type}: {description}\n\n{body}",
|
||||
"defaultCommitType": "feat",
|
||||
"allowedCommitTypes": ["feat", "fix", "refactor", "test", "docs", "chore"],
|
||||
"testThresholds": {
|
||||
"minTests": 1,
|
||||
"maxFailuresInGreen": 0
|
||||
},
|
||||
"enableActivityLogging": true,
|
||||
"activityLogPath": ".taskmaster/logs",
|
||||
"enableStateBackup": true,
|
||||
"maxStateBackups": 10,
|
||||
"operationTimeout": 300000
|
||||
},
|
||||
"tasks": {
|
||||
"defaultPriority": "medium",
|
||||
"maxSubtasks": 10,
|
||||
"validateDependencies": true
|
||||
},
|
||||
"logging": {
|
||||
"enabled": true,
|
||||
"level": "info",
|
||||
"logRequests": false,
|
||||
"logPerformance": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### If `task-master init` doesn't respond:
|
||||
|
||||
@@ -275,7 +275,7 @@
|
||||
"tailwindcss": "4.1.11",
|
||||
"typescript": "^5.9.2",
|
||||
"@tm/core": "*",
|
||||
"task-master-ai": "*"
|
||||
"task-master-ai": "0.30.0-rc.0"
|
||||
},
|
||||
"overrides": {
|
||||
"glob@<8": "^10.4.5",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"description": "Task Master MCP Tools - TypeScript MCP server tools for AI agent integration",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"version": "0.28.0-rc.2",
|
||||
"version": "",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./src/index.ts",
|
||||
"exports": {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Available Models as of October 5, 2025
|
||||
# Available Models as of October 18, 2025
|
||||
|
||||
## Main Models
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
| anthropic | claude-opus-4-20250514 | 0.725 | 15 | 75 |
|
||||
| anthropic | claude-3-7-sonnet-20250219 | 0.623 | 3 | 15 |
|
||||
| anthropic | claude-3-5-sonnet-20241022 | 0.49 | 3 | 15 |
|
||||
| anthropic | claude-sonnet-4-5-20250929 | 0.73 | 3 | 15 |
|
||||
| anthropic | claude-haiku-4-5-20251001 | 0.45 | 1 | 5 |
|
||||
| claude-code | opus | 0.725 | 0 | 0 |
|
||||
| claude-code | sonnet | 0.727 | 0 | 0 |
|
||||
| claude-code | haiku | 0.45 | 0 | 0 |
|
||||
| codex-cli | gpt-5 | 0.749 | 0 | 0 |
|
||||
| codex-cli | gpt-5-codex | 0.749 | 0 | 0 |
|
||||
| mcp | mcp-sampling | — | 0 | 0 |
|
||||
@@ -102,6 +105,7 @@
|
||||
| ----------- | -------------------------------------------- | --------- | ---------- | ----------- |
|
||||
| claude-code | opus | 0.725 | 0 | 0 |
|
||||
| claude-code | sonnet | 0.727 | 0 | 0 |
|
||||
| claude-code | haiku | 0.45 | 0 | 0 |
|
||||
| codex-cli | gpt-5 | 0.749 | 0 | 0 |
|
||||
| codex-cli | gpt-5-codex | 0.749 | 0 | 0 |
|
||||
| mcp | mcp-sampling | — | 0 | 0 |
|
||||
@@ -142,8 +146,11 @@
|
||||
| anthropic | claude-opus-4-20250514 | 0.725 | 15 | 75 |
|
||||
| anthropic | claude-3-7-sonnet-20250219 | 0.623 | 3 | 15 |
|
||||
| anthropic | claude-3-5-sonnet-20241022 | 0.49 | 3 | 15 |
|
||||
| anthropic | claude-sonnet-4-5-20250929 | 0.73 | 3 | 15 |
|
||||
| anthropic | claude-haiku-4-5-20251001 | 0.45 | 1 | 5 |
|
||||
| claude-code | opus | 0.725 | 0 | 0 |
|
||||
| claude-code | sonnet | 0.727 | 0 | 0 |
|
||||
| claude-code | haiku | 0.45 | 0 | 0 |
|
||||
| codex-cli | gpt-5 | 0.749 | 0 | 0 |
|
||||
| codex-cli | gpt-5-codex | 0.749 | 0 | 0 |
|
||||
| mcp | mcp-sampling | — | 0 | 0 |
|
||||
|
||||
80
output.txt
Normal file
80
output.txt
Normal file
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "task-master-ai",
|
||||
"version": "0.29.0",
|
||||
"version": "0.30.0-rc.0",
|
||||
"description": "A task management system for ambitious AI-driven development that doesn't overwhelm and confuse Cursor.",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface LoggerConfig {
|
||||
export class Logger {
|
||||
private config: Required<LoggerConfig>;
|
||||
private static readonly DEFAULT_CONFIG: Required<LoggerConfig> = {
|
||||
level: LogLevel.WARN,
|
||||
level: LogLevel.SILENT,
|
||||
silent: false,
|
||||
prefix: '',
|
||||
timestamp: false,
|
||||
|
||||
@@ -307,6 +307,20 @@ function validateProviderModelCombination(providerName, modelId) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of supported model IDs for a given provider from supported-models.json
|
||||
* @param {string} providerName - The name of the provider (e.g., 'claude-code', 'anthropic')
|
||||
* @returns {string[]} Array of supported model IDs, or empty array if provider not found
|
||||
*/
|
||||
export function getSupportedModelsForProvider(providerName) {
|
||||
if (!MODEL_MAP[providerName]) {
|
||||
return [];
|
||||
}
|
||||
return MODEL_MAP[providerName]
|
||||
.filter((model) => model.supported !== false)
|
||||
.map((model) => model.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates Claude Code AI provider custom settings
|
||||
* @param {object} settings The settings to validate
|
||||
|
||||
@@ -43,6 +43,28 @@
|
||||
"allowed_roles": ["main", "fallback"],
|
||||
"max_tokens": 8192,
|
||||
"supported": true
|
||||
},
|
||||
{
|
||||
"id": "claude-sonnet-4-5-20250929",
|
||||
"swe_score": 0.73,
|
||||
"cost_per_1m_tokens": {
|
||||
"input": 3.0,
|
||||
"output": 15.0
|
||||
},
|
||||
"allowed_roles": ["main", "fallback"],
|
||||
"max_tokens": 64000,
|
||||
"supported": true
|
||||
},
|
||||
{
|
||||
"id": "claude-haiku-4-5-20251001",
|
||||
"swe_score": 0.45,
|
||||
"cost_per_1m_tokens": {
|
||||
"input": 1.0,
|
||||
"output": 5.0
|
||||
},
|
||||
"allowed_roles": ["main", "fallback"],
|
||||
"max_tokens": 200000,
|
||||
"supported": true
|
||||
}
|
||||
],
|
||||
"claude-code": [
|
||||
@@ -67,6 +89,17 @@
|
||||
"allowed_roles": ["main", "fallback", "research"],
|
||||
"max_tokens": 64000,
|
||||
"supported": true
|
||||
},
|
||||
{
|
||||
"id": "haiku",
|
||||
"swe_score": 0.45,
|
||||
"cost_per_1m_tokens": {
|
||||
"input": 0,
|
||||
"output": 0
|
||||
},
|
||||
"allowed_roles": ["main", "fallback", "research"],
|
||||
"max_tokens": 200000,
|
||||
"supported": true
|
||||
}
|
||||
],
|
||||
"codex-cli": [
|
||||
|
||||
@@ -12,7 +12,10 @@
|
||||
|
||||
import { createClaudeCode } from 'ai-sdk-provider-claude-code';
|
||||
import { BaseAIProvider } from './base-provider.js';
|
||||
import { getClaudeCodeSettingsForCommand } from '../../scripts/modules/config-manager.js';
|
||||
import {
|
||||
getClaudeCodeSettingsForCommand,
|
||||
getSupportedModelsForProvider
|
||||
} from '../../scripts/modules/config-manager.js';
|
||||
import { execSync } from 'child_process';
|
||||
import { log } from '../../scripts/modules/utils.js';
|
||||
|
||||
@@ -24,14 +27,24 @@ let _claudeCliAvailable = null;
|
||||
*
|
||||
* Features:
|
||||
* - No API key required (uses local Claude Code CLI)
|
||||
* - Supports 'sonnet' and 'opus' models
|
||||
* - Supported models loaded from supported-models.json
|
||||
* - Command-specific configuration support
|
||||
*/
|
||||
export class ClaudeCodeProvider extends BaseAIProvider {
|
||||
constructor() {
|
||||
super();
|
||||
this.name = 'Claude Code';
|
||||
this.supportedModels = ['sonnet', 'opus'];
|
||||
// Load supported models from supported-models.json
|
||||
this.supportedModels = getSupportedModelsForProvider('claude-code');
|
||||
|
||||
// Validate that models were loaded successfully
|
||||
if (this.supportedModels.length === 0) {
|
||||
log(
|
||||
'warn',
|
||||
'No supported models found for claude-code provider. Check supported-models.json configuration.'
|
||||
);
|
||||
}
|
||||
|
||||
// Claude Code requires explicit JSON schema mode
|
||||
this.needsExplicitJsonSchema = true;
|
||||
// Claude Code does not support temperature parameter
|
||||
|
||||
@@ -10,7 +10,10 @@ import { createCodexCli } from 'ai-sdk-provider-codex-cli';
|
||||
import { BaseAIProvider } from './base-provider.js';
|
||||
import { execSync } from 'child_process';
|
||||
import { log } from '../../scripts/modules/utils.js';
|
||||
import { getCodexCliSettingsForCommand } from '../../scripts/modules/config-manager.js';
|
||||
import {
|
||||
getCodexCliSettingsForCommand,
|
||||
getSupportedModelsForProvider
|
||||
} from '../../scripts/modules/config-manager.js';
|
||||
|
||||
export class CodexCliProvider extends BaseAIProvider {
|
||||
constructor() {
|
||||
@@ -20,8 +23,17 @@ export class CodexCliProvider extends BaseAIProvider {
|
||||
this.needsExplicitJsonSchema = false;
|
||||
// Codex CLI does not support temperature parameter
|
||||
this.supportsTemperature = false;
|
||||
// Restrict to supported models for OAuth subscription usage
|
||||
this.supportedModels = ['gpt-5', 'gpt-5-codex'];
|
||||
// Load supported models from supported-models.json
|
||||
this.supportedModels = getSupportedModelsForProvider('codex-cli');
|
||||
|
||||
// Validate that models were loaded successfully
|
||||
if (this.supportedModels.length === 0) {
|
||||
log(
|
||||
'warn',
|
||||
'No supported models found for codex-cli provider. Check supported-models.json configuration.'
|
||||
);
|
||||
}
|
||||
|
||||
// CLI availability check cache
|
||||
this._codexCliChecked = false;
|
||||
this._codexCliAvailable = null;
|
||||
|
||||
@@ -43,9 +43,9 @@ describe('Claude Code Error Handling', () => {
|
||||
|
||||
// These should work even if CLI is not available
|
||||
expect(provider.name).toBe('Claude Code');
|
||||
expect(provider.getSupportedModels()).toEqual(['sonnet', 'opus']);
|
||||
expect(provider.getSupportedModels()).toEqual(['opus', 'sonnet', 'haiku']);
|
||||
expect(provider.isModelSupported('sonnet')).toBe(true);
|
||||
expect(provider.isModelSupported('haiku')).toBe(false);
|
||||
expect(provider.isModelSupported('haiku')).toBe(true);
|
||||
expect(provider.isRequiredApiKey()).toBe(false);
|
||||
expect(() => provider.validateAuth()).not.toThrow();
|
||||
});
|
||||
|
||||
@@ -40,14 +40,14 @@ describe('Claude Code Integration (Optional)', () => {
|
||||
it('should create a working provider instance', () => {
|
||||
const provider = new ClaudeCodeProvider();
|
||||
expect(provider.name).toBe('Claude Code');
|
||||
expect(provider.getSupportedModels()).toEqual(['sonnet', 'opus']);
|
||||
expect(provider.getSupportedModels()).toEqual(['opus', 'sonnet', 'haiku']);
|
||||
});
|
||||
|
||||
it('should support model validation', () => {
|
||||
const provider = new ClaudeCodeProvider();
|
||||
expect(provider.isModelSupported('sonnet')).toBe(true);
|
||||
expect(provider.isModelSupported('opus')).toBe(true);
|
||||
expect(provider.isModelSupported('haiku')).toBe(false);
|
||||
expect(provider.isModelSupported('haiku')).toBe(true);
|
||||
expect(provider.isModelSupported('unknown')).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
@@ -28,6 +28,14 @@ jest.unstable_mockModule('../../../src/ai-providers/base-provider.js', () => ({
|
||||
}
|
||||
}));
|
||||
|
||||
// Mock config getters
|
||||
jest.unstable_mockModule('../../../scripts/modules/config-manager.js', () => ({
|
||||
getClaudeCodeSettingsForCommand: jest.fn(() => ({})),
|
||||
getSupportedModelsForProvider: jest.fn(() => ['opus', 'sonnet', 'haiku']),
|
||||
getDebugFlag: jest.fn(() => false),
|
||||
getLogLevel: jest.fn(() => 'info')
|
||||
}));
|
||||
|
||||
// Import after mocking
|
||||
const { ClaudeCodeProvider } = await import(
|
||||
'../../../src/ai-providers/claude-code.js'
|
||||
@@ -96,13 +104,13 @@ describe('ClaudeCodeProvider', () => {
|
||||
describe('model support', () => {
|
||||
it('should return supported models', () => {
|
||||
const models = provider.getSupportedModels();
|
||||
expect(models).toEqual(['sonnet', 'opus']);
|
||||
expect(models).toEqual(['opus', 'sonnet', 'haiku']);
|
||||
});
|
||||
|
||||
it('should check if model is supported', () => {
|
||||
expect(provider.isModelSupported('sonnet')).toBe(true);
|
||||
expect(provider.isModelSupported('opus')).toBe(true);
|
||||
expect(provider.isModelSupported('haiku')).toBe(false);
|
||||
expect(provider.isModelSupported('haiku')).toBe(true);
|
||||
expect(provider.isModelSupported('unknown')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,6 +20,7 @@ jest.unstable_mockModule('ai-sdk-provider-codex-cli', () => ({
|
||||
// Mock config getters
|
||||
jest.unstable_mockModule('../../../scripts/modules/config-manager.js', () => ({
|
||||
getCodexCliSettingsForCommand: jest.fn(() => ({ allowNpx: true })),
|
||||
getSupportedModelsForProvider: jest.fn(() => ['gpt-5', 'gpt-5-codex']),
|
||||
// Provide commonly imported getters to satisfy other module imports if any
|
||||
getDebugFlag: jest.fn(() => false),
|
||||
getLogLevel: jest.fn(() => 'info')
|
||||
|
||||
Reference in New Issue
Block a user