mirror of
https://github.com/eyaltoledano/claude-task-master.git
synced 2026-01-30 06:12:05 +00:00
docs: auto-update documentation based on changes in next branch
This PR was automatically generated to update documentation based on recent changes. Original commit: feat: upgrade ai-sdk-provider-claude-code to v2.2.0 for native structured outputs (#1436)\n\n\n Co-authored-by: Claude <claude-assistant@anthropic.com>
This commit is contained in:
@@ -6,13 +6,22 @@ description: "Configure Task Master through environment variables in a .env file
|
||||
## Required Configuration
|
||||
|
||||
<Note>
|
||||
Task Master requires an Anthropic API key to function. Add this to your `.env` file:
|
||||
Task Master requires at least one AI provider to function. You can use:
|
||||
|
||||
**Option 1: Direct API Key (Traditional)**
|
||||
```bash
|
||||
ANTHROPIC_API_KEY=sk-ant-api03-your-api-key
|
||||
```
|
||||
Get your key from the [Anthropic Console](https://console.anthropic.com/).
|
||||
|
||||
You can obtain an API key from the [Anthropic Console](https://console.anthropic.com/).
|
||||
**Option 2: Claude Code CLI (Recommended)**
|
||||
```bash
|
||||
claude setup-token # No API key needed in .env
|
||||
task-master models --set-main claude-code:sonnet
|
||||
```
|
||||
Uses OAuth authentication with native structured outputs (v2.2.0+).
|
||||
|
||||
See the [Claude Code Integration Guide](/configuration/claude-code-integration) for details.
|
||||
</Note>
|
||||
|
||||
## Optional Configuration
|
||||
@@ -30,6 +39,7 @@ description: "Configure Task Master through environment variables in a .env file
|
||||
| `PROJECT_VERSION` | `"1.0.0"` | Version in metadata | `PROJECT_VERSION=2.1.0` |
|
||||
| `PERPLEXITY_API_KEY` | - | For research-backed features | `PERPLEXITY_API_KEY=pplx-...` |
|
||||
| `PERPLEXITY_MODEL` | `"sonar-medium-online"` | Perplexity model | `PERPLEXITY_MODEL=sonar-large-online` |
|
||||
| `CLAUDE_CODE_OAUTH_TOKEN` | - | Claude Code CLI OAuth token (optional) | `CLAUDE_CODE_OAUTH_TOKEN=token123` |
|
||||
|
||||
## TDD Workflow Configuration
|
||||
|
||||
|
||||
330
apps/docs/configuration/claude-code-integration.mdx
Normal file
330
apps/docs/configuration/claude-code-integration.mdx
Normal file
@@ -0,0 +1,330 @@
|
||||
---
|
||||
title: "Claude Code Integration"
|
||||
description: "Complete guide for using Task Master with Claude Code CLI for enhanced AI-powered development workflows with native structured outputs"
|
||||
---
|
||||
|
||||
# Claude Code Integration
|
||||
|
||||
Task Master provides seamless integration with the Claude Code CLI, enabling AI-powered development workflows without requiring direct API keys. The integration leverages OAuth tokens managed by the Claude Code CLI and supports **native structured outputs** for guaranteed schema-compliant responses.
|
||||
|
||||
## Features
|
||||
|
||||
- **OAuth Authentication**: Secure token management via Claude Code CLI
|
||||
- **Native Structured Outputs (v2.2.0+)**: Guaranteed schema-compliant JSON responses
|
||||
- **Full AI SDK Compatibility**: Works with generateText, streamText, and generateObject functions
|
||||
- **Automatic Error Handling**: Graceful degradation when Claude Code is unavailable
|
||||
- **Type Safety**: Full TypeScript support with proper type definitions
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Install Claude Code CLI
|
||||
|
||||
Follow the [Claude Code documentation](https://docs.anthropic.com/claude-code) for installation instructions specific to your system.
|
||||
|
||||
### 2. Set Up Authentication
|
||||
|
||||
Configure OAuth authentication with the Claude Code CLI:
|
||||
|
||||
```bash
|
||||
claude setup-token
|
||||
```
|
||||
|
||||
This command will:
|
||||
- Guide you through OAuth authentication
|
||||
- Store the token securely for CLI usage
|
||||
- Enable Task Master to use Claude Code without manual API key configuration
|
||||
|
||||
### 3. Configure Task Master
|
||||
|
||||
Add Claude Code to your Task Master configuration:
|
||||
|
||||
```bash
|
||||
# Interactive setup
|
||||
task-master models --setup
|
||||
# Select "claude-code" from the provider list
|
||||
|
||||
# Or set directly
|
||||
task-master models --set-main claude-code:sonnet
|
||||
```
|
||||
|
||||
### 4. Start Using
|
||||
|
||||
```bash
|
||||
# Task Master will now use Claude Code for AI operations
|
||||
task-master add-task --prompt="Implement user authentication system" --research
|
||||
task-master expand --id=1 --research
|
||||
```
|
||||
|
||||
## Authentication
|
||||
|
||||
### Authentication Priority
|
||||
|
||||
Task Master attempts authentication in this order:
|
||||
|
||||
1. **Environment Variable** (optional): `CLAUDE_CODE_OAUTH_TOKEN`
|
||||
- Useful for CI/CD environments or when you want to override the default token
|
||||
- Not required if you've set up the CLI token
|
||||
|
||||
2. **Claude Code CLI Token** (recommended): Token managed by `claude setup-token`
|
||||
- Automatically used when available
|
||||
- Most convenient for local development
|
||||
|
||||
3. **Fallback**: Error if neither is available
|
||||
|
||||
### Environment Configuration (Optional)
|
||||
|
||||
While not required for local development, you may need to set environment variables in specific scenarios:
|
||||
|
||||
```bash
|
||||
# CI/CD pipelines, Docker containers, or custom token usage
|
||||
export CLAUDE_CODE_OAUTH_TOKEN="your_oauth_token_here"
|
||||
```
|
||||
|
||||
## Model Configuration
|
||||
|
||||
### Supported Models
|
||||
|
||||
- `claude-code:sonnet` - Claude 3.5 Sonnet via Claude Code CLI
|
||||
- `claude-code:opus` - Claude 3 Opus via Claude Code CLI
|
||||
|
||||
### Configuration Examples
|
||||
|
||||
```javascript
|
||||
// In your .taskmaster/config.json
|
||||
{
|
||||
"models": {
|
||||
"main": "claude-code:sonnet", // Use Claude Code with Sonnet
|
||||
"research": "perplexity-llama-3.1-sonar-large-128k-online",
|
||||
"fallback": "claude-code:opus" // Use Claude Code with Opus as fallback
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Native Structured Outputs (v2.2.0+)
|
||||
|
||||
### Overview
|
||||
|
||||
As of `ai-sdk-provider-claude-code` v2.2.0, Claude Code supports **native structured outputs** via the Claude Agent SDK's `outputFormat` option. This provides significant benefits for Task Master's structured data generation.
|
||||
|
||||
### Key Benefits
|
||||
|
||||
- **Guaranteed Schema Compliance**: Uses constrained decoding to ensure responses always match your Zod schema
|
||||
- **No JSON Parsing Errors**: Schema validation handled internally by the SDK
|
||||
- **No Prompt Engineering Required**: No need for "output valid JSON" instructions - the SDK enforces schema natively
|
||||
- **Better Performance**: No retry/extraction logic needed for valid JSON output
|
||||
|
||||
### How It Works
|
||||
|
||||
When Task Master calls `generateObject()` with a Zod schema, the Claude Code provider:
|
||||
|
||||
1. Sets `mode: 'json'` (via `needsExplicitJsonSchema = true`)
|
||||
2. Passes the schema to the SDK
|
||||
3. The SDK converts the Zod schema to JSON Schema and uses `outputFormat: { type: 'json_schema', schema: ... }`
|
||||
4. Claude Agent SDK returns `structured_output` with guaranteed schema compliance
|
||||
|
||||
### Supported Commands
|
||||
|
||||
All Task Master commands that generate structured data benefit from native schema support:
|
||||
|
||||
- `parse-prd` - Parsing PRD documents into tasks
|
||||
- `add-task` - Creating new tasks
|
||||
- `expand-task` - Expanding tasks into subtasks
|
||||
- `update-tasks` - Batch updating tasks
|
||||
- `update-task-by-id` - Updating individual tasks
|
||||
- `analyze-complexity` - Analyzing task complexity
|
||||
|
||||
### Example Usage
|
||||
|
||||
```javascript
|
||||
import { z } from 'zod';
|
||||
|
||||
// Define your schema
|
||||
const taskSchema = z.object({
|
||||
title: z.string().min(1),
|
||||
description: z.string().min(1),
|
||||
priority: z.enum(['high', 'medium', 'low']),
|
||||
dependencies: z.array(z.number().int())
|
||||
});
|
||||
|
||||
// Task Master will automatically use native structured outputs
|
||||
// when Claude Code is configured as the provider
|
||||
```
|
||||
|
||||
## Integration Scenarios
|
||||
|
||||
### Local Development
|
||||
|
||||
Most common setup for individual developers:
|
||||
|
||||
```bash
|
||||
# 1. Install and authenticate with Claude Code
|
||||
claude setup-token
|
||||
|
||||
# 2. Configure Task Master
|
||||
task-master models --set-main claude-code:sonnet
|
||||
|
||||
# 3. Use normally - OAuth tokens handled automatically
|
||||
task-master add-task --prompt="Add dark mode support"
|
||||
```
|
||||
|
||||
### Docker/Containers
|
||||
|
||||
When running in Docker environments:
|
||||
|
||||
```dockerfile
|
||||
# Install Claude Code CLI in your container
|
||||
RUN npm install -g @anthropic/claude-code
|
||||
|
||||
# Set environment variable for authentication
|
||||
ENV CLAUDE_CODE_OAUTH_TOKEN="your_token_here"
|
||||
```
|
||||
|
||||
### CI/CD Pipelines
|
||||
|
||||
For automated environments:
|
||||
|
||||
```yaml
|
||||
# GitHub Actions example
|
||||
env:
|
||||
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_TOKEN }}
|
||||
|
||||
steps:
|
||||
- name: Install Claude Code CLI
|
||||
run: npm install -g @anthropic/claude-code
|
||||
|
||||
- name: Run Task Master
|
||||
run: task-master analyze-complexity --research
|
||||
```
|
||||
|
||||
### MCP Server Configuration
|
||||
|
||||
For Claude Code integration via MCP:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"task-master-ai": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "task-master-ai"],
|
||||
"env": {
|
||||
"CLAUDE_CODE_OAUTH_TOKEN": "your_token_here"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
#### "Claude Code CLI not available" Error
|
||||
|
||||
**Problem**: Task Master cannot connect to Claude Code CLI.
|
||||
|
||||
**Solutions**:
|
||||
- Ensure Claude Code CLI is installed and in your PATH
|
||||
- Run `claude setup-token` to configure authentication
|
||||
- Verify Claude Code CLI works: `claude --help`
|
||||
|
||||
#### Authentication Failures
|
||||
|
||||
**Problem**: Token authentication is failing.
|
||||
|
||||
**Solutions**:
|
||||
- Re-run `claude setup-token` to refresh your OAuth token
|
||||
- Check if your token has expired
|
||||
- Verify Claude Code CLI can authenticate: try a simple `claude` command
|
||||
|
||||
#### Model Not Available
|
||||
|
||||
**Problem**: Specified Claude Code model is not supported.
|
||||
|
||||
**Solutions**:
|
||||
- Use supported models: `sonnet` or `opus`
|
||||
- Check model availability: `task-master models --list`
|
||||
- Verify your Claude Code CLI has access to the requested model
|
||||
|
||||
### Debug Steps
|
||||
|
||||
1. **Test Claude Code CLI directly**:
|
||||
```bash
|
||||
claude --help
|
||||
# Should show help without errors
|
||||
```
|
||||
|
||||
2. **Test authentication**:
|
||||
```bash
|
||||
claude setup-token --verify
|
||||
# Should confirm token is valid
|
||||
```
|
||||
|
||||
3. **Test Task Master integration**:
|
||||
```bash
|
||||
task-master models --test claude-code:sonnet
|
||||
# Should successfully connect and test the model
|
||||
```
|
||||
|
||||
4. **Check logs**:
|
||||
- Task Master logs will show detailed error messages
|
||||
- Use `--verbose` flag for more detailed output
|
||||
|
||||
### Performance Considerations
|
||||
|
||||
- **Native structured outputs** eliminate retry logic, improving response times
|
||||
- **OAuth token refresh** is handled automatically by Claude Code CLI
|
||||
- **Local CLI integration** reduces network latency compared to direct API calls
|
||||
|
||||
## Migration from Direct API Usage
|
||||
|
||||
If you're currently using Anthropic API keys directly:
|
||||
|
||||
### Before (Direct API)
|
||||
```json
|
||||
{
|
||||
"models": {
|
||||
"main": "claude-3-5-sonnet-20241022"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
export ANTHROPIC_API_KEY="sk-ant-api03-..."
|
||||
```
|
||||
|
||||
### After (Claude Code)
|
||||
```json
|
||||
{
|
||||
"models": {
|
||||
"main": "claude-code:sonnet"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
claude setup-token
|
||||
# No API key needed in environment
|
||||
```
|
||||
|
||||
### Benefits of Migration
|
||||
|
||||
- **Better security**: OAuth tokens vs API keys
|
||||
- **Automatic token management**: No manual key rotation
|
||||
- **Native structured outputs**: Better reliability and performance
|
||||
- **CLI integration**: Leverages existing Claude Code workflows
|
||||
|
||||
## Security Best Practices
|
||||
|
||||
- **OAuth tokens** are managed securely by Claude Code CLI
|
||||
- **No API keys** need to be stored in your project files
|
||||
- **Tokens are automatically refreshed** by the Claude Code CLI
|
||||
- **Environment variables** should only be used in secure environments
|
||||
|
||||
## Getting Help
|
||||
|
||||
If you encounter issues:
|
||||
|
||||
1. Check the [Claude Code CLI documentation](https://docs.anthropic.com/claude-code)
|
||||
2. Verify your authentication setup with `claude setup-token --verify`
|
||||
3. Review Task Master logs for detailed error messages
|
||||
4. Report issues on [GitHub](https://github.com/eyaltoledano/claude-task-master/issues) with both Task Master and Claude Code version information
|
||||
@@ -112,15 +112,17 @@ AWS_ACCESS_KEY_ID="your-aws-access-key"
|
||||
AWS_SECRET_ACCESS_KEY="your-aws-secret-key"
|
||||
```
|
||||
|
||||
### CLAUDE_CODE_API_KEY
|
||||
### CLAUDE_CODE_OAUTH_TOKEN
|
||||
- **Provider**: Claude Code CLI
|
||||
- **Required**: ❌ **No** (uses OAuth tokens)
|
||||
- **Purpose**: Integration with local Claude Code CLI
|
||||
- **Authentication**: Uses OAuth tokens, no API key needed
|
||||
- **Authentication**: Uses OAuth tokens managed by `claude setup-token`
|
||||
- **Features**: Native structured outputs (v2.2.0+) with guaranteed schema compliance
|
||||
|
||||
```bash
|
||||
# Not typically needed
|
||||
CLAUDE_CODE_API_KEY="not-usually-required"
|
||||
# Optional - Only needed for CI/CD or custom environments
|
||||
# Local development uses tokens from `claude setup-token` automatically
|
||||
CLAUDE_CODE_OAUTH_TOKEN="your_oauth_token_here"
|
||||
```
|
||||
|
||||
### GEMINI_API_KEY
|
||||
|
||||
@@ -3,4 +3,32 @@ title: "What's New"
|
||||
sidebarTitle: "What's New"
|
||||
---
|
||||
|
||||
Stay up to date with the latest Task Master features and improvements.
|
||||
|
||||
## Latest Updates
|
||||
|
||||
### Claude Code v2.2.0 Integration
|
||||
|
||||
**Enhanced AI Provider Support with Native Structured Outputs**
|
||||
|
||||
Task Master now includes upgraded support for Claude Code CLI with significant improvements:
|
||||
|
||||
- **Native Structured Outputs**: Guaranteed schema-compliant JSON responses using the Claude Agent SDK's `outputFormat` option
|
||||
- **Better Reliability**: No more JSON parsing errors or retry logic needed
|
||||
- **Improved Performance**: Faster response times with constrained decoding
|
||||
- **Enhanced Security**: OAuth token management via `claude setup-token`
|
||||
|
||||
All structured data generation commands now benefit from this upgrade:
|
||||
- `parse-prd` - Parsing PRD documents into tasks
|
||||
- `add-task` - Creating new tasks
|
||||
- `expand-task` - Expanding tasks into subtasks
|
||||
- `update-tasks` - Batch updating tasks
|
||||
- `analyze-complexity` - Analyzing task complexity
|
||||
|
||||
[Learn more about Claude Code integration →](/configuration/claude-code-integration)
|
||||
|
||||
---
|
||||
|
||||
## Previous Releases
|
||||
|
||||
An easy way to see the latest releases
|
||||
65
output.txt
Normal file
65
output.txt
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user