Compare commits

..

7 Commits

Author SHA1 Message Date
github-actions[bot]
5781d61d9c docs: auto-update documentation based on changes in next branch
This PR was automatically generated to update documentation based on recent changes.

  Original commit: Merge pull request #1291 from eyaltoledano/raplh/chore/merge.main\n\n\n

  Co-authored-by: Claude <claude-assistant@anthropic.com>
2025-10-11 09:48:19 +00:00
Ralph Khreish
25a00dca67 Merge pull request #1291 from eyaltoledano/raplh/chore/merge.main 2025-10-11 11:40:42 +02:00
Ralph Khreish
f263d4b2e0 Merge remote-tracking branch 'origin/main' into raplh/chore/merge.main 2025-10-11 11:32:47 +02:00
Ralph Khreish
f12a16d096 feat: add changelog highlights to auto-update notifications (#1286)
Co-authored-by: Claude <noreply@anthropic.com>
2025-10-10 18:49:59 +02:00
Ralph Khreish
aaf903ff2f fix: resolve cross-level dependency bug in add-dependency command (#1191)
Co-authored-by: Ralph Khreish <Crunchyman-ralph@users.noreply.github.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Fixes #542
2025-10-08 15:30:20 +02:00
github-actions[bot]
0df6595245 Version Packages (#1283)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ralph Khreish <35776126+Crunchyman-ralph@users.noreply.github.com>
2025-10-07 20:43:13 +02:00
Ralph Khreish
33e3fbb20f Release 0.28.0 2025-10-07 20:08:47 +02:00
46 changed files with 932 additions and 270 deletions

View File

@@ -0,0 +1,7 @@
---
"task-master-ai": minor
---
Add changelog highlights to auto-update notifications
When the CLI auto-updates to a new version, it now displays a "What's New" section.

View File

@@ -1,11 +0,0 @@
---
"task-master-ai": minor
---
Add Codex CLI provider with OAuth authentication
- Added codex-cli provider for GPT-5 and GPT-5-Codex models (272K input / 128K output)
- OAuth-first authentication via `codex login` - no API key required
- Optional OPENAI_CODEX_API_KEY support
- Codebase analysis capabilities automatically enabled
- Command-specific settings and approval/sandbox modes

View File

@@ -1,5 +0,0 @@
---
"task-master-ai": patch
---
Improve `analyze-complexity` cli docs and `--research` flag documentation

View File

@@ -1,7 +0,0 @@
---
"task-master-ai": minor
---
Add Cursor IDE custom slash command support
Expose Task Master commands as Cursor slash commands by copying assets/claude/commands to .cursor/commands on profile add and cleaning up on remove.

View File

@@ -1,5 +0,0 @@
---
"task-master-ai": patch
---
Change parent task back to "pending" when all subtasks are in "pending" state

View File

@@ -1,5 +0,0 @@
---
"task-master-ai": patch
---
Do a quick fix on build

View File

@@ -1,5 +0,0 @@
---
"task-master-ai": patch
---
Fix MCP connection errors caused by deprecated generateTaskFiles calls. Resolves "Cannot read properties of null (reading 'toString')" errors when using MCP tools for task management operations.

View File

@@ -1,5 +0,0 @@
---
"task-master-ai": patch
---
Fix MCP server error when file parameter not provided - now properly constructs default tasks.json path instead of failing with 'tasksJsonPath is required' error.

View File

@@ -1,5 +0,0 @@
---
"task-master-ai": minor
---
Added api keys page on docs website: docs.task-master.dev/getting-started/api-keys

View File

@@ -1,10 +0,0 @@
---
"task-master-ai": minor
---
Move to AI SDK v5:
- Works better with claude-code and gemini-cli as ai providers
- Improved openai model family compatibility
- Migrate ollama provider to v2
- Closes #1223, #1013, #1161, #1174

View File

@@ -1,30 +0,0 @@
---
"task-master-ai": minor
---
Migrate AI services to use generateObject for structured data generation
This update migrates all AI service calls from generateText to generateObject, ensuring more reliable and structured responses across all commands.
### Key Changes:
- **Unified AI Service**: Replaced separate generateText implementations with a single generateObjectService that handles structured data generation
- **JSON Mode Support**: Added proper JSON mode configuration for providers that support it (OpenAI, Anthropic, Google, Groq)
- **Schema Validation**: Integrated Zod schemas for all AI-generated content with automatic validation
- **Provider Compatibility**: Maintained compatibility with all existing providers while leveraging their native structured output capabilities
- **Improved Reliability**: Structured output generation reduces parsing errors and ensures consistent data formats
### Technical Improvements:
- Centralized provider configuration in `ai-providers-unified.js`
- Added `generateObject` support detection for each provider
- Implemented proper error handling for schema validation failures
- Maintained backward compatibility with existing prompt structures
### Bug Fixes:
- Fixed subtask ID numbering issue where AI was generating inconsistent IDs (101-105, 601-603) instead of sequential numbering (1, 2, 3...)
- Enhanced prompt instructions to enforce proper ID generation patterns
- Ensured subtasks display correctly as X.1, X.2, X.3 format
This migration improves the reliability and consistency of AI-generated content throughout the Task Master application.

View File

@@ -1,13 +0,0 @@
---
"task-master-ai": minor
---
Enhanced Roo Code profile with MCP timeout configuration for improved reliability during long-running AI operations. The Roo profile now automatically configures a 300-second timeout for MCP server operations, preventing timeouts during complex tasks like `parse-prd`, `expand-all`, `analyze-complexity`, and `research` operations. This change also replaces static MCP configuration files with programmatic generation for better maintainability.
**What's New:**
- 300-second timeout for MCP operations (up from default 60 seconds)
- Programmatic MCP configuration generation (replaces static asset files)
- Enhanced reliability for AI-powered operations
- Consistent with other AI coding assistant profiles
**Migration:** No user action required - existing Roo Code installations will automatically receive the enhanced MCP configuration on next initialization.

View File

@@ -1,5 +0,0 @@
---
"task-master-ai": patch
---
Fix Claude Code settings validation for pathToClaudeCodeExecutable

View File

@@ -0,0 +1,7 @@
---
"task-master-ai": patch
---
Fix cross-level task dependencies not being saved
Fixes an issue where adding dependencies between subtasks and top-level tasks (e.g., `task-master add-dependency --id=2.2 --depends-on=11`) would report success but fail to persist the changes. Dependencies can now be created in both directions between any task levels.

View File

@@ -1,26 +0,0 @@
{
"mode": "exit",
"tag": "rc",
"initialVersions": {
"task-master-ai": "0.27.3",
"docs": "0.0.4",
"extension": "0.25.4"
},
"changesets": [
"brave-lions-sing",
"chore-fix-docs",
"cursor-slash-commands",
"curvy-weeks-flow",
"easy-spiders-wave",
"fix-mcp-connection-errors",
"fix-mcp-default-tasks-path",
"flat-cities-say",
"forty-tables-invite",
"gentle-cats-dance",
"mcp-timeout-configuration",
"petite-ideas-grab",
"silly-pandas-find",
"sweet-maps-rule",
"whole-pigs-say"
]
}

View File

@@ -1,5 +0,0 @@
---
"task-master-ai": patch
---
Fix sonar deep research model failing, should be called `sonar-deep-research`

View File

@@ -1,5 +0,0 @@
---
"task-master-ai": minor
---
Upgrade grok-cli ai provider to ai sdk v5

View File

@@ -1,8 +0,0 @@
---
"task-master-ai": patch
---
Fix complexity score not showing for `task-master show` and `task-master list`
- Added complexity score on "next task" when running `task-master list`
- Added colors to complexity to reflect complexity (easy, medium, hard)

View File

@@ -1,5 +1,84 @@
# task-master-ai
## 0.28.0
### Minor Changes
- [#1273](https://github.com/eyaltoledano/claude-task-master/pull/1273) [`b43b7ce`](https://github.com/eyaltoledano/claude-task-master/commit/b43b7ce201625eee956fb2f8cd332f238bb78c21) Thanks [@ben-vargas](https://github.com/ben-vargas)! - Add Codex CLI provider with OAuth authentication
- Added codex-cli provider for GPT-5 and GPT-5-Codex models (272K input / 128K output)
- OAuth-first authentication via `codex login` - no API key required
- Optional OPENAI_CODEX_API_KEY support
- Codebase analysis capabilities automatically enabled
- Command-specific settings and approval/sandbox modes
- [#1215](https://github.com/eyaltoledano/claude-task-master/pull/1215) [`0079b7d`](https://github.com/eyaltoledano/claude-task-master/commit/0079b7defdad550811f704c470fdd01955d91d4d) Thanks [@joedanz](https://github.com/joedanz)! - Add Cursor IDE custom slash command support
Expose Task Master commands as Cursor slash commands by copying assets/claude/commands to .cursor/commands on profile add and cleaning up on remove.
- [#1246](https://github.com/eyaltoledano/claude-task-master/pull/1246) [`18aa416`](https://github.com/eyaltoledano/claude-task-master/commit/18aa416035f44345bde1c7321490345733a5d042) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Added api keys page on docs website: docs.task-master.dev/getting-started/api-keys
- [#1246](https://github.com/eyaltoledano/claude-task-master/pull/1246) [`18aa416`](https://github.com/eyaltoledano/claude-task-master/commit/18aa416035f44345bde1c7321490345733a5d042) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Move to AI SDK v5:
- Works better with claude-code and gemini-cli as ai providers
- Improved openai model family compatibility
- Migrate ollama provider to v2
- Closes #1223, #1013, #1161, #1174
- [#1262](https://github.com/eyaltoledano/claude-task-master/pull/1262) [`738ec51`](https://github.com/eyaltoledano/claude-task-master/commit/738ec51c049a295a12839b2dfddaf05e23b8fede) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Migrate AI services to use generateObject for structured data generation
This update migrates all AI service calls from generateText to generateObject, ensuring more reliable and structured responses across all commands.
### Key Changes:
- **Unified AI Service**: Replaced separate generateText implementations with a single generateObjectService that handles structured data generation
- **JSON Mode Support**: Added proper JSON mode configuration for providers that support it (OpenAI, Anthropic, Google, Groq)
- **Schema Validation**: Integrated Zod schemas for all AI-generated content with automatic validation
- **Provider Compatibility**: Maintained compatibility with all existing providers while leveraging their native structured output capabilities
- **Improved Reliability**: Structured output generation reduces parsing errors and ensures consistent data formats
### Technical Improvements:
- Centralized provider configuration in `ai-providers-unified.js`
- Added `generateObject` support detection for each provider
- Implemented proper error handling for schema validation failures
- Maintained backward compatibility with existing prompt structures
### Bug Fixes:
- Fixed subtask ID numbering issue where AI was generating inconsistent IDs (101-105, 601-603) instead of sequential numbering (1, 2, 3...)
- Enhanced prompt instructions to enforce proper ID generation patterns
- Ensured subtasks display correctly as X.1, X.2, X.3 format
This migration improves the reliability and consistency of AI-generated content throughout the Task Master application.
- [#1112](https://github.com/eyaltoledano/claude-task-master/pull/1112) [`d67b81d`](https://github.com/eyaltoledano/claude-task-master/commit/d67b81d25ddd927fabb6f5deb368e8993519c541) Thanks [@olssonsten](https://github.com/olssonsten)! - Enhanced Roo Code profile with MCP timeout configuration for improved reliability during long-running AI operations. The Roo profile now automatically configures a 300-second timeout for MCP server operations, preventing timeouts during complex tasks like `parse-prd`, `expand-all`, `analyze-complexity`, and `research` operations. This change also replaces static MCP configuration files with programmatic generation for better maintainability.
**What's New:**
- 300-second timeout for MCP operations (up from default 60 seconds)
- Programmatic MCP configuration generation (replaces static asset files)
- Enhanced reliability for AI-powered operations
- Consistent with other AI coding assistant profiles
**Migration:** No user action required - existing Roo Code installations will automatically receive the enhanced MCP configuration on next initialization.
- [#1246](https://github.com/eyaltoledano/claude-task-master/pull/1246) [`986ac11`](https://github.com/eyaltoledano/claude-task-master/commit/986ac117aee00bcd3e6830a0f76e1ad6d10e0bca) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Upgrade grok-cli ai provider to ai sdk v5
### Patch Changes
- [#1235](https://github.com/eyaltoledano/claude-task-master/pull/1235) [`aaacc3d`](https://github.com/eyaltoledano/claude-task-master/commit/aaacc3dae36247b4de72b2d2697f49e5df6d01e3) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Improve `analyze-complexity` cli docs and `--research` flag documentation
- [#1251](https://github.com/eyaltoledano/claude-task-master/pull/1251) [`0b2c696`](https://github.com/eyaltoledano/claude-task-master/commit/0b2c6967c4605c33a100cff16f6ce8ff09ad06f0) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Change parent task back to "pending" when all subtasks are in "pending" state
- [#1274](https://github.com/eyaltoledano/claude-task-master/pull/1274) [`4f984f8`](https://github.com/eyaltoledano/claude-task-master/commit/4f984f8a6965da9f9c7edd60ddfd6560ac022917) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Do a quick fix on build
- [#1277](https://github.com/eyaltoledano/claude-task-master/pull/1277) [`7b5a7c4`](https://github.com/eyaltoledano/claude-task-master/commit/7b5a7c4495a68b782f7407fc5d0e0d3ae81f42f5) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Fix MCP connection errors caused by deprecated generateTaskFiles calls. Resolves "Cannot read properties of null (reading 'toString')" errors when using MCP tools for task management operations.
- [#1276](https://github.com/eyaltoledano/claude-task-master/pull/1276) [`caee040`](https://github.com/eyaltoledano/claude-task-master/commit/caee040907f856d31a660171c9e6d966f23c632e) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Fix MCP server error when file parameter not provided - now properly constructs default tasks.json path instead of failing with 'tasksJsonPath is required' error.
- [#1172](https://github.com/eyaltoledano/claude-task-master/pull/1172) [`b5fe723`](https://github.com/eyaltoledano/claude-task-master/commit/b5fe723f8ead928e9f2dbde13b833ee70ac3382d) Thanks [@jujax](https://github.com/jujax)! - Fix Claude Code settings validation for pathToClaudeCodeExecutable
- [#1192](https://github.com/eyaltoledano/claude-task-master/pull/1192) [`2b69936`](https://github.com/eyaltoledano/claude-task-master/commit/2b69936ee7b34346d6de5175af20e077359e2e2a) Thanks [@nukunga](https://github.com/nukunga)! - Fix sonar deep research model failing, should be called `sonar-deep-research`
- [#1270](https://github.com/eyaltoledano/claude-task-master/pull/1270) [`20004a3`](https://github.com/eyaltoledano/claude-task-master/commit/20004a39ea848f747e1ff48981bfe176554e4055) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Fix complexity score not showing for `task-master show` and `task-master list`
- Added complexity score on "next task" when running `task-master list`
- Added colors to complexity to reflect complexity (easy, medium, hard)
## 0.28.0-rc.2
### Minor Changes

View File

@@ -4,6 +4,13 @@
### Patch Changes
- Updated dependencies []:
- @tm/core@null
## null
### Patch Changes
- Updated dependencies []:
- @tm/core@null

View File

@@ -48,5 +48,6 @@
"*": {
"*": ["src/*"]
}
}
},
"version": ""
}

View File

@@ -12,6 +12,7 @@ export interface UpdateInfo {
currentVersion: string;
latestVersion: string;
needsUpdate: boolean;
highlights?: string[];
}
/**
@@ -59,6 +60,116 @@ export function compareVersions(v1: string, v2: string): number {
return a.pre < b.pre ? -1 : 1; // basic prerelease tie-break
}
/**
* Fetch CHANGELOG.md from GitHub and extract highlights for a specific version
*/
async function fetchChangelogHighlights(version: string): Promise<string[]> {
return new Promise((resolve) => {
const options = {
hostname: 'raw.githubusercontent.com',
path: '/eyaltoledano/claude-task-master/main/CHANGELOG.md',
method: 'GET',
headers: {
'User-Agent': `task-master-ai/${version}`
}
};
const req = https.request(options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
try {
if (res.statusCode !== 200) {
resolve([]);
return;
}
const highlights = parseChangelogHighlights(data, version);
resolve(highlights);
} catch (error) {
resolve([]);
}
});
});
req.on('error', () => {
resolve([]);
});
req.setTimeout(3000, () => {
req.destroy();
resolve([]);
});
req.end();
});
}
/**
* Parse changelog markdown to extract Minor Changes for a specific version
* @internal - Exported for testing purposes only
*/
export function parseChangelogHighlights(
changelog: string,
version: string
): string[] {
try {
// Validate version format (basic semver pattern) to prevent ReDoS
if (!/^\d+\.\d+\.\d+(-[a-zA-Z0-9.-]+)?$/.test(version)) {
return [];
}
// Find the version section
const versionRegex = new RegExp(
`## ${version.replace(/\./g, '\\.')}\\s*\\n`,
'i'
);
const versionMatch = changelog.match(versionRegex);
if (!versionMatch) {
return [];
}
// Extract content from this version to the next version heading
const startIdx = versionMatch.index! + versionMatch[0].length;
const nextVersionIdx = changelog.indexOf('\n## ', startIdx);
const versionContent =
nextVersionIdx > 0
? changelog.slice(startIdx, nextVersionIdx)
: changelog.slice(startIdx);
// Find Minor Changes section
const minorChangesMatch = versionContent.match(
/### Minor Changes\s*\n([\s\S]*?)(?=\n###|\n##|$)/i
);
if (!minorChangesMatch) {
return [];
}
const minorChangesContent = minorChangesMatch[1];
const highlights: string[] = [];
// Extract all bullet points (lines starting with -)
// Format: - [#PR](...) Thanks [@author]! - Description
const bulletRegex = /^-\s+\[#\d+\][^\n]*?!\s+-\s+(.+?)$/gm;
let match;
while ((match = bulletRegex.exec(minorChangesContent)) !== null) {
const desc = match[1].trim();
highlights.push(desc);
}
return highlights;
} catch (error) {
return [];
}
}
/**
* Check for newer version of task-master-ai
*/
@@ -85,7 +196,7 @@ export async function checkForUpdate(
data += chunk;
});
res.on('end', () => {
res.on('end', async () => {
try {
if (res.statusCode !== 200)
throw new Error(`npm registry status ${res.statusCode}`);
@@ -95,10 +206,17 @@ export async function checkForUpdate(
const needsUpdate =
compareVersions(currentVersion, latestVersion) < 0;
// Fetch highlights if update is needed
let highlights: string[] | undefined;
if (needsUpdate) {
highlights = await fetchChangelogHighlights(latestVersion);
}
resolve({
currentVersion,
latestVersion,
needsUpdate
needsUpdate,
highlights
});
} catch (error) {
resolve({
@@ -136,18 +254,29 @@ export async function checkForUpdate(
*/
export function displayUpgradeNotification(
currentVersion: string,
latestVersion: string
latestVersion: string,
highlights?: string[]
) {
const message = boxen(
`${chalk.blue.bold('Update Available!')} ${chalk.dim(currentVersion)}${chalk.green(latestVersion)}\n\n` +
`Auto-updating to the latest version with new features and bug fixes...`,
{
padding: 1,
margin: { top: 1, bottom: 1 },
borderColor: 'yellow',
borderStyle: 'round'
let content = `${chalk.blue.bold('Update Available!')} ${chalk.dim(currentVersion)}${chalk.green(latestVersion)}`;
if (highlights && highlights.length > 0) {
content += '\n\n' + chalk.bold("What's New:");
for (const highlight of highlights) {
content += '\n' + chalk.cyan('• ') + highlight;
}
);
content += '\n\n' + 'Auto-updating to the latest version...';
} else {
content +=
'\n\n' +
'Auto-updating to the latest version with new features and bug fixes...';
}
const message = boxen(content, {
padding: 1,
margin: { top: 1, bottom: 1 },
borderColor: 'yellow',
borderStyle: 'round'
});
console.log(message);
}

View File

@@ -1,5 +1,7 @@
# docs
## 0.0.5
## 0.0.4
## 0.0.3

View File

@@ -6,10 +6,28 @@ description: "Learn how to set up and use Task Master with Cursor AI"
## Setting up Cursor AI Integration
<Check>
Task Master is designed to work seamlessly with [Cursor AI](https://www.cursor.so/), providing a structured workflow for AI-driven development.
Task Master is designed to work seamlessly with [Cursor AI](https://www.cursor.so/), providing a structured workflow for AI-driven development. As of version 0.28.0, Task Master automatically sets up custom slash commands in Cursor IDE.
</Check>
<AccordionGroup>
<Accordion title="Cursor Custom Slash Commands (New in 0.28.0)" icon="terminal">
Task Master now automatically configures custom slash commands in Cursor IDE when adding a profile. These commands provide quick access to Task Master functionality:
### Available Slash Commands
- `/tm-list` - View all tasks with their status
- `/tm-next` - Get the next available task to work on
- `/tm-show` - Show detailed task information
- `/tm-add` - Add a new task with AI assistance
- `/tm-status` - Set task status (pending, in-progress, done, etc.)
- `/tm-expand` - Expand a task into subtasks
- `/tm-complexity` - Analyze task complexity
### Automatic Setup
When you run `task-master profiles add cursor`, the slash commands are automatically copied to `.cursor/commands/`. If you remove the profile with `task-master profiles remove cursor`, the commands are cleaned up automatically.
### Manual Setup
If you need to manually set up the commands, they're available in the `assets/claude/commands/` directory of your Task Master installation.
</Accordion>
<Accordion title="Using Cursor with MCP (Recommended)" icon="sparkles">
If you've already set up Task Master with MCP in Cursor, the integration is automatic. You can simply use natural language to interact with Task Master:

View File

@@ -65,4 +65,37 @@ 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.
## Configuration and Performance
### Timeout Configuration
As of version 0.28.0, Task Master automatically configures appropriate timeouts for MCP operations to handle long-running AI tasks. The Roo Code profile now includes a 300-second timeout (increased from the default 60 seconds) to accommodate complex operations like:
- `parse_prd` - PRD parsing and task generation
- `expand_all` - Expanding multiple tasks into subtasks
- `analyze_project_complexity` - Project-wide complexity analysis
- Research-enabled operations with the `--research` flag
### MCP Server Configuration
The recommended MCP server configuration automatically includes these timeout settings:
```json
{
"mcpServers": {
"task-master-ai": {
"command": "npx",
"args": ["-y", "task-master-ai"],
"timeout": 300000,
"env": {
"ANTHROPIC_API_KEY": "your-key-here",
"PERPLEXITY_API_KEY": "your-key-here"
}
}
}
}
```
This configuration is automatically generated when using Task Master profiles with Roo Code and other AI coding assistants.

View File

@@ -50,8 +50,7 @@
"pages": [
"capabilities/mcp",
"capabilities/cli-root-commands",
"capabilities/task-structure",
"capabilities/rpg-method"
"capabilities/task-structure"
]
}
]

View File

@@ -42,6 +42,20 @@ PERPLEXITY_API_KEY="pplx-your-key-here"
OPENAI_API_KEY="sk-proj-your-key-here"
```
### OPENAI_CODEX_API_KEY (New)
- **Provider**: Codex CLI (GPT-5 and GPT-5-Codex models)
- **Format**: Various formats
- **Required**: ❌ **No** (OAuth-first authentication via `codex login`)
- **Models**: GPT-5, GPT-5-Codex (272K input / 128K output context)
- **Authentication**: Primary authentication is OAuth via `codex login` command
- **Features**: Codebase analysis capabilities automatically enabled
- **Get Access**: Follow Codex CLI setup instructions
```bash
# Optional - OAuth via 'codex login' is preferred
OPENAI_CODEX_API_KEY="your-codex-api-key-here"
```
### GOOGLE_API_KEY
- **Provider**: Google Gemini models
- **Format**: Various formats
@@ -197,16 +211,20 @@ For Claude Code integration, configure keys in `.mcp.json`:
"task-master-ai": {
"command": "npx",
"args": ["-y", "task-master-ai"],
"timeout": 300000,
"env": {
"ANTHROPIC_API_KEY": "your-key-here",
"PERPLEXITY_API_KEY": "your-key-here",
"OPENAI_API_KEY": "your-key-here"
"OPENAI_API_KEY": "your-key-here",
"OPENAI_CODEX_API_KEY": "your-codex-key-here"
}
}
}
}
```
**Note**: The `timeout: 300000` (300 seconds) setting is recommended for long-running AI operations like PRD parsing and complexity analysis.
## Key Requirements
### Minimum Requirements

View File

@@ -1,6 +1,6 @@
{
"name": "docs",
"version": "0.0.4",
"version": "0.0.5",
"private": true,
"description": "Task Master documentation powered by Mintlify",
"scripts": {

View File

@@ -3,4 +3,58 @@ title: "What's New"
sidebarTitle: "What's New"
---
An easy way to see the latest releases
# What's New in Task Master
## Version 0.28.0 - Latest Release
### 🚀 New Features
#### Codex CLI Provider Support
- Added support for GPT-5 and GPT-5-Codex models via Codex CLI
- OAuth-first authentication - no API key required (just run `codex login`)
- 272K input / 128K output context windows
- Codebase analysis capabilities automatically enabled
- Optional `OPENAI_CODEX_API_KEY` support for API-based usage
#### Cursor IDE Slash Commands
- Automatically installs custom slash commands when adding Cursor profile
- Quick access to Task Master functionality directly in Cursor IDE
- Commands include `/tm-list`, `/tm-next`, `/tm-show`, `/tm-add`, and more
- Automatic cleanup when removing Cursor profile
#### Enhanced MCP Configuration
- Improved timeout configuration for long-running AI operations
- 300-second timeout for complex tasks like PRD parsing and task expansion
- Programmatic MCP configuration generation for better reliability
- Enhanced support for Roo Code and other AI coding assistants
### 🔧 Technical Improvements
#### AI SDK v5 Migration
- Migrated to AI SDK v5 for better compatibility with modern AI providers
- Improved support for Claude Code and Gemini CLI integration
- Better structured output generation with `generateObject`
- Enhanced JSON mode support for supported providers
#### Structured Data Generation
- All AI services now use `generateObject` for more reliable responses
- Integrated Zod schemas for automatic validation
- Reduced parsing errors and improved data consistency
- Better subtask ID generation (fixes numbering inconsistencies)
### 🐛 Bug Fixes
- Fixed MCP connection errors from deprecated function calls
- Fixed MCP server errors when file parameters not provided
- Corrected complexity scores display in `task-master show` and `list`
- Fixed Perplexity Sonar Deep Research model naming
- Improved parent task status handling when all subtasks are pending
### 📖 Documentation Updates
- New comprehensive API keys configuration guide
- Enhanced Cursor IDE integration documentation
- Improved MCP timeout configuration documentation
- Updated examples and configuration snippets
---
For detailed release notes and full changelog, visit our [GitHub releases page](https://github.com/eyaltoledano/claude-task-master/releases).

View File

@@ -1,5 +1,12 @@
# Change Log
## 0.25.5
### Patch Changes
- Updated dependencies [[`b43b7ce`](https://github.com/eyaltoledano/claude-task-master/commit/b43b7ce201625eee956fb2f8cd332f238bb78c21), [`aaacc3d`](https://github.com/eyaltoledano/claude-task-master/commit/aaacc3dae36247b4de72b2d2697f49e5df6d01e3), [`0079b7d`](https://github.com/eyaltoledano/claude-task-master/commit/0079b7defdad550811f704c470fdd01955d91d4d), [`0b2c696`](https://github.com/eyaltoledano/claude-task-master/commit/0b2c6967c4605c33a100cff16f6ce8ff09ad06f0), [`4f984f8`](https://github.com/eyaltoledano/claude-task-master/commit/4f984f8a6965da9f9c7edd60ddfd6560ac022917), [`7b5a7c4`](https://github.com/eyaltoledano/claude-task-master/commit/7b5a7c4495a68b782f7407fc5d0e0d3ae81f42f5), [`caee040`](https://github.com/eyaltoledano/claude-task-master/commit/caee040907f856d31a660171c9e6d966f23c632e), [`18aa416`](https://github.com/eyaltoledano/claude-task-master/commit/18aa416035f44345bde1c7321490345733a5d042), [`18aa416`](https://github.com/eyaltoledano/claude-task-master/commit/18aa416035f44345bde1c7321490345733a5d042), [`738ec51`](https://github.com/eyaltoledano/claude-task-master/commit/738ec51c049a295a12839b2dfddaf05e23b8fede), [`d67b81d`](https://github.com/eyaltoledano/claude-task-master/commit/d67b81d25ddd927fabb6f5deb368e8993519c541), [`b5fe723`](https://github.com/eyaltoledano/claude-task-master/commit/b5fe723f8ead928e9f2dbde13b833ee70ac3382d), [`2b69936`](https://github.com/eyaltoledano/claude-task-master/commit/2b69936ee7b34346d6de5175af20e077359e2e2a), [`986ac11`](https://github.com/eyaltoledano/claude-task-master/commit/986ac117aee00bcd3e6830a0f76e1ad6d10e0bca), [`20004a3`](https://github.com/eyaltoledano/claude-task-master/commit/20004a39ea848f747e1ff48981bfe176554e4055)]:
- task-master-ai@0.28.0
## 0.25.5-rc.0
### Patch Changes

View File

@@ -3,7 +3,7 @@
"private": true,
"displayName": "TaskMaster",
"description": "A visual Kanban board interface for TaskMaster projects in VS Code",
"version": "0.25.5-rc.0",
"version": "0.25.5",
"publisher": "Hamster",
"icon": "assets/icon.png",
"engines": {

File diff suppressed because one or more lines are too long

8
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "task-master-ai",
"version": "0.28.0-rc.1",
"version": "0.28.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "task-master-ai",
"version": "0.28.0-rc.1",
"version": "0.28.0",
"license": "MIT WITH Commons-Clause",
"workspaces": [
"apps/*",
@@ -125,13 +125,13 @@
}
},
"apps/docs": {
"version": "0.0.4",
"version": "0.0.5",
"devDependencies": {
"mintlify": "^4.2.111"
}
},
"apps/extension": {
"version": "0.25.5-rc.0",
"version": "0.25.5",
"dependencies": {
"task-master-ai": "*"
},

View File

@@ -1,6 +1,6 @@
{
"name": "task-master-ai",
"version": "0.28.0-rc.2",
"version": "0.28.0",
"description": "A task management system for ambitious AI-driven development that doesn't overwhelm and confuse Cursor.",
"main": "index.js",
"type": "module",
@@ -118,7 +118,13 @@
"bugs": {
"url": "https://github.com/eyaltoledano/claude-task-master/issues"
},
"files": ["dist/**", "README-task-master.md", "README.md", "LICENSE"],
"files": [
"dist/**",
"README-task-master.md",
"README.md",
"LICENSE",
"CHANGELOG.md"
],
"overrides": {
"node-fetch": "^2.6.12",
"whatwg-url": "^11.0.0"

View File

@@ -0,0 +1,3 @@
# @tm/ai-sdk-provider-grok-cli
## null

View File

@@ -31,5 +31,6 @@
"files": ["dist/**/*", "README.md"],
"publishConfig": {
"access": "public"
}
},
"version": ""
}

View File

@@ -2,4 +2,6 @@
## null
## null
## 1.0.1

View File

@@ -24,5 +24,6 @@
},
"dependencies": {
"tsup": "^8.5.0"
}
},
"version": ""
}

View File

@@ -2,6 +2,8 @@
## null
## null
## 0.26.1
All notable changes to the @task-master/tm-core package will be documented in this file.

View File

@@ -42,5 +42,6 @@
"files": ["src", "README.md", "CHANGELOG.md"],
"keywords": ["task-management", "typescript", "ai", "prd", "parser"],
"author": "Task Master AI",
"license": "MIT"
"license": "MIT",
"version": ""
}

View File

@@ -5111,7 +5111,8 @@ async function runCLI(argv = process.argv) {
// Display the upgrade notification first
displayUpgradeNotification(
updateInfo.currentVersion,
updateInfo.latestVersion
updateInfo.latestVersion,
updateInfo.highlights
);
// Then automatically perform the update

View File

@@ -312,18 +312,23 @@ async function removeDependency(tasksPath, taskId, dependencyId, context = {}) {
// Check if the dependency exists by comparing string representations
const dependencyIndex = targetTask.dependencies.findIndex((dep) => {
// Convert both to strings for comparison
let depStr = String(dep);
// Special handling for numeric IDs that might be subtask references
if (typeof dep === 'number' && dep < 100 && isSubtask) {
// It's likely a reference to another subtask in the same parent task
// Convert to full format for comparison (e.g., 2 -> "1.2" for a subtask in task 1)
const [parentId] = formattedTaskId.split('.');
depStr = `${parentId}.${dep}`;
// Direct string comparison (handles both numeric IDs and dot notation)
const depStr = String(dep);
if (depStr === normalizedDependencyId) {
return true;
}
return depStr === normalizedDependencyId;
// For subtasks: handle numeric dependencies that might be references to other subtasks
// in the same parent (e.g., subtask 1.2 depending on subtask 1.1 stored as just "1")
if (typeof dep === 'number' && dep < 100 && isSubtask) {
const [parentId] = formattedTaskId.split('.');
const fullSubtaskRef = `${parentId}.${dep}`;
if (fullSubtaskRef === normalizedDependencyId) {
return true;
}
}
return false;
});
if (dependencyIndex === -1) {
@@ -396,8 +401,9 @@ function isCircularDependency(tasks, taskId, chain = []) {
task = parentTask.subtasks.find((st) => st.id === subtaskId);
}
} else {
// Regular task
task = tasks.find((t) => String(t.id) === taskIdStr);
// Regular task - handle both string and numeric task IDs
const taskIdNum = parseInt(taskIdStr, 10);
task = tasks.find((t) => t.id === taskIdNum || String(t.id) === taskIdStr);
}
if (!task) {

View File

@@ -1,14 +0,0 @@
{
"tasks": [
{
"id": 1,
"dependencies": [],
"subtasks": [
{
"id": 1,
"dependencies": []
}
]
}
]
}

View File

@@ -88,3 +88,38 @@ export const emptySampleTasks = {
},
tasks: []
};
export const crossLevelDependencyTasks = {
tasks: [
{
id: 2,
title: 'Task 2 with subtasks',
description: 'Parent task',
status: 'pending',
dependencies: [],
subtasks: [
{
id: 1,
title: 'Subtask 2.1',
description: 'First subtask',
status: 'pending',
dependencies: []
},
{
id: 2,
title: 'Subtask 2.2',
description: 'Second subtask that should depend on Task 11',
status: 'pending',
dependencies: []
}
]
},
{
id: 11,
title: 'Task 11',
description: 'Top-level task that 2.2 should depend on',
status: 'done',
dependencies: []
}
]
};

View File

@@ -279,12 +279,14 @@ describe('Version comparison utility', () => {
describe('Update check functionality', () => {
let displayUpgradeNotification;
let parseChangelogHighlights;
let consoleLogSpy;
beforeAll(async () => {
// Import from @tm/cli instead of commands.js
const cliModule = await import('../../apps/cli/src/utils/auto-update.js');
displayUpgradeNotification = cliModule.displayUpgradeNotification;
parseChangelogHighlights = cliModule.parseChangelogHighlights;
});
beforeEach(() => {
@@ -302,6 +304,61 @@ describe('Update check functionality', () => {
expect(consoleLogSpy.mock.calls[0][0]).toContain('1.0.0');
expect(consoleLogSpy.mock.calls[0][0]).toContain('1.1.0');
});
test('displays upgrade notification with highlights when provided', () => {
const highlights = [
'Add Codex CLI provider with OAuth authentication',
'Cursor IDE custom slash command support',
'Move to AI SDK v5'
];
displayUpgradeNotification('1.0.0', '1.1.0', highlights);
expect(consoleLogSpy).toHaveBeenCalled();
const output = consoleLogSpy.mock.calls[0][0];
expect(output).toContain('Update Available!');
expect(output).toContain('1.0.0');
expect(output).toContain('1.1.0');
expect(output).toContain("What's New:");
expect(output).toContain(
'Add Codex CLI provider with OAuth authentication'
);
expect(output).toContain('Cursor IDE custom slash command support');
expect(output).toContain('Move to AI SDK v5');
});
test('displays upgrade notification without highlights section when empty array', () => {
displayUpgradeNotification('1.0.0', '1.1.0', []);
expect(consoleLogSpy).toHaveBeenCalled();
const output = consoleLogSpy.mock.calls[0][0];
expect(output).toContain('Update Available!');
expect(output).not.toContain("What's New:");
expect(output).toContain(
'Auto-updating to the latest version with new features and bug fixes'
);
});
test('parseChangelogHighlights validates version format to prevent ReDoS', () => {
const mockChangelog = `
## 1.0.0
### Minor Changes
- [#123](https://example.com) Thanks [@user](https://example.com)! - Test feature
`;
// Valid versions should work
expect(parseChangelogHighlights(mockChangelog, '1.0.0')).toEqual([
'Test feature'
]);
expect(parseChangelogHighlights(mockChangelog, '1.0.0-rc.1')).toEqual([]);
// Invalid versions should return empty array (ReDoS protection)
expect(parseChangelogHighlights(mockChangelog, 'invalid')).toEqual([]);
expect(parseChangelogHighlights(mockChangelog, '1.0')).toEqual([]);
expect(parseChangelogHighlights(mockChangelog, 'a.b.c')).toEqual([]);
expect(
parseChangelogHighlights(mockChangelog, '((((((((((((((((((((((((((((((a')
).toEqual([]);
});
});
// -----------------------------------------------------------------------------

View File

@@ -4,18 +4,47 @@
import { jest } from '@jest/globals';
import {
validateTaskDependencies,
isCircularDependency,
removeDuplicateDependencies,
cleanupSubtaskDependencies,
ensureAtLeastOneIndependentSubtask,
validateAndFixDependencies,
canMoveWithDependencies
} from '../../scripts/modules/dependency-manager.js';
import * as utils from '../../scripts/modules/utils.js';
import { sampleTasks } from '../fixtures/sample-tasks.js';
sampleTasks,
crossLevelDependencyTasks
} from '../fixtures/sample-tasks.js';
// Create mock functions that we can control in tests
const mockTaskExists = jest.fn();
const mockFormatTaskId = jest.fn();
const mockFindCycles = jest.fn();
const mockLog = jest.fn();
const mockReadJSON = jest.fn();
const mockWriteJSON = jest.fn();
// Mock the utils module using the same pattern as move-task-cross-tag.test.js
jest.mock('../../scripts/modules/utils.js', () => ({
log: mockLog,
readJSON: mockReadJSON,
writeJSON: mockWriteJSON,
taskExists: mockTaskExists,
formatTaskId: mockFormatTaskId,
findCycles: mockFindCycles,
traverseDependencies: jest.fn(() => []),
isSilentMode: jest.fn(() => true),
findProjectRoot: jest.fn(() => '/test'),
resolveEnvVariable: jest.fn(() => undefined),
isEmpty: jest.fn((v) =>
v == null
? true
: Array.isArray(v)
? v.length === 0
: typeof v === 'object'
? Object.keys(v).length === 0
: false
),
// Common extras
enableSilentMode: jest.fn(),
disableSilentMode: jest.fn(),
getTaskManager: jest.fn(async () => ({})),
getTagAwareFilePath: jest.fn((basePath, _tag, projectRoot = '.') => basePath),
readComplexityReport: jest.fn(() => null)
}));
// Mock dependencies
jest.mock('path');
jest.mock('chalk', () => ({
green: jest.fn((text) => `<green>${text}</green>`),
@@ -27,22 +56,16 @@ jest.mock('chalk', () => ({
jest.mock('boxen', () => jest.fn((text) => `[boxed: ${text}]`));
// Mock utils module
const mockTaskExists = jest.fn();
const mockFormatTaskId = jest.fn();
const mockFindCycles = jest.fn();
const mockLog = jest.fn();
const mockReadJSON = jest.fn();
const mockWriteJSON = jest.fn();
jest.mock('../../scripts/modules/utils.js', () => ({
log: mockLog,
readJSON: mockReadJSON,
writeJSON: mockWriteJSON,
taskExists: mockTaskExists,
formatTaskId: mockFormatTaskId,
findCycles: mockFindCycles
}));
// Now import SUT after mocks are in place
import {
validateTaskDependencies,
isCircularDependency,
removeDuplicateDependencies,
cleanupSubtaskDependencies,
ensureAtLeastOneIndependentSubtask,
validateAndFixDependencies,
canMoveWithDependencies
} from '../../scripts/modules/dependency-manager.js';
jest.mock('../../scripts/modules/ui.js', () => ({
displayBanner: jest.fn()
@@ -52,8 +75,8 @@ jest.mock('../../scripts/modules/task-manager.js', () => ({
generateTaskFiles: jest.fn()
}));
// Create a path for test files
const TEST_TASKS_PATH = 'tests/fixture/test-tasks.json';
// Use a temporary path for test files - Jest will clean up the temp directory
const TEST_TASKS_PATH = '/tmp/jest-test-tasks.json';
describe('Dependency Manager Module', () => {
beforeEach(() => {
@@ -684,6 +707,8 @@ describe('Dependency Manager Module', () => {
// IMPORTANT: Verify no calls to writeJSON with actual tasks.json
expect(mockWriteJSON).not.toHaveBeenCalledWith(
'tasks/tasks.json',
expect.anything(),
expect.anything(),
expect.anything()
);
});
@@ -737,6 +762,8 @@ describe('Dependency Manager Module', () => {
// IMPORTANT: Verify no calls to writeJSON with actual tasks.json
expect(mockWriteJSON).not.toHaveBeenCalledWith(
'tasks/tasks.json',
expect.anything(),
expect.anything(),
expect.anything()
);
});
@@ -750,6 +777,8 @@ describe('Dependency Manager Module', () => {
// IMPORTANT: Verify no calls to writeJSON with actual tasks.json
expect(mockWriteJSON).not.toHaveBeenCalledWith(
'tasks/tasks.json',
expect.anything(),
expect.anything(),
expect.anything()
);
});
@@ -803,6 +832,8 @@ describe('Dependency Manager Module', () => {
// IMPORTANT: Verify no calls to writeJSON with actual tasks.json
expect(mockWriteJSON).not.toHaveBeenCalledWith(
'tasks/tasks.json',
expect.anything(),
expect.anything(),
expect.anything()
);
});
@@ -916,4 +947,297 @@ describe('Dependency Manager Module', () => {
expect(result.conflicts).toEqual([]);
});
});
describe('Cross-level dependency tests (Issue #542)', () => {
let originalExit;
beforeEach(async () => {
// Ensure a fresh module instance so ESM mocks apply to dynamic imports
jest.resetModules();
originalExit = process.exit;
process.exit = jest.fn();
// For ESM dynamic imports, use the same pattern
await jest.unstable_mockModule('../../scripts/modules/utils.js', () => ({
log: mockLog,
readJSON: mockReadJSON,
writeJSON: mockWriteJSON,
taskExists: mockTaskExists,
formatTaskId: mockFormatTaskId,
findCycles: mockFindCycles,
traverseDependencies: jest.fn(() => []),
isSilentMode: jest.fn(() => true),
findProjectRoot: jest.fn(() => '/test'),
resolveEnvVariable: jest.fn(() => undefined),
isEmpty: jest.fn((v) =>
v == null
? true
: Array.isArray(v)
? v.length === 0
: typeof v === 'object'
? Object.keys(v).length === 0
: false
),
enableSilentMode: jest.fn(),
disableSilentMode: jest.fn(),
getTaskManager: jest.fn(async () => ({})),
getTagAwareFilePath: jest.fn(
(basePath, _tag, projectRoot = '.') => basePath
),
readComplexityReport: jest.fn(() => null)
}));
// Also mock transitive imports to keep dependency surface minimal
await jest.unstable_mockModule('../../scripts/modules/ui.js', () => ({
displayBanner: jest.fn()
}));
await jest.unstable_mockModule(
'../../scripts/modules/task-manager/generate-task-files.js',
() => ({ default: jest.fn() })
);
// Set up test data that matches the issue report
// Clone fixture data before each test to prevent mutation issues
mockReadJSON.mockImplementation(() =>
structuredClone(crossLevelDependencyTasks)
);
// Configure mockTaskExists to properly validate cross-level dependencies
mockTaskExists.mockImplementation((tasks, taskId) => {
if (typeof taskId === 'string' && taskId.includes('.')) {
const [parentId, subtaskId] = taskId.split('.').map(Number);
const task = tasks.find((t) => t.id === parentId);
return (
task &&
task.subtasks &&
task.subtasks.some((st) => st.id === subtaskId)
);
}
const numericId =
typeof taskId === 'string' ? parseInt(taskId, 10) : taskId;
return tasks.some((task) => task.id === numericId);
});
mockFormatTaskId.mockImplementation((id) => {
if (typeof id === 'string' && id.includes('.')) return id; // keep dot notation
return parseInt(id, 10); // normalize top-level task IDs to number
});
});
afterEach(() => {
process.exit = originalExit;
});
test('should allow subtask to depend on top-level task', async () => {
const { addDependency } = await import(
'../../scripts/modules/dependency-manager.js'
);
// Test the specific scenario from Issue #542: subtask 2.2 depending on task 11
await addDependency(TEST_TASKS_PATH, '2.2', 11, { projectRoot: '/test' });
// Verify we wrote to the test path (and not the real tasks.json)
expect(mockWriteJSON).toHaveBeenCalledWith(
TEST_TASKS_PATH,
expect.anything(),
'/test',
undefined
);
expect(mockWriteJSON).not.toHaveBeenCalledWith(
'tasks/tasks.json',
expect.anything(),
expect.anything(),
expect.anything()
);
// Get the specific write call for TEST_TASKS_PATH
const writeCall = mockWriteJSON.mock.calls.find(
([p]) => p === TEST_TASKS_PATH
);
expect(writeCall).toBeDefined();
const savedData = writeCall[1];
const parent2 = savedData.tasks.find((t) => t.id === 2);
const subtask22 = parent2.subtasks.find((st) => st.id === 2);
// Verify the dependency was actually added to subtask 2.2
expect(subtask22.dependencies).toContain(11);
// Also verify a success log was emitted
const successCall = mockLog.mock.calls.find(
([level]) => level === 'success'
);
expect(successCall).toBeDefined();
expect(successCall[1]).toContain('2.2');
expect(successCall[1]).toContain('11');
});
test('should allow top-level task to depend on subtask', async () => {
const { addDependency } = await import(
'../../scripts/modules/dependency-manager.js'
);
// Test reverse scenario: task 11 depending on subtask 2.1
await addDependency(TEST_TASKS_PATH, 11, '2.1', { projectRoot: '/test' });
// Stronger assertions for writeJSON call and locating the correct task
expect(mockWriteJSON).toHaveBeenCalledWith(
TEST_TASKS_PATH,
expect.anything(),
'/test',
undefined
);
expect(mockWriteJSON).not.toHaveBeenCalledWith(
'tasks/tasks.json',
expect.anything(),
expect.anything(),
expect.anything()
);
const writeCall = mockWriteJSON.mock.calls.find(
([p]) => p === TEST_TASKS_PATH
);
expect(writeCall).toBeDefined();
const savedData = writeCall[1];
const task11 = savedData.tasks.find((t) => t.id === 11);
// Verify the dependency was actually added to task 11
expect(task11.dependencies).toContain('2.1');
// Verify a success log was emitted mentioning both task 11 and subtask 2.1
const successCall = mockLog.mock.calls.find(
([level]) => level === 'success'
);
expect(successCall).toBeDefined();
expect(successCall[1]).toContain('11');
expect(successCall[1]).toContain('2.1');
});
test('should properly validate cross-level dependencies exist', async () => {
// Test that validation correctly identifies when a cross-level dependency target doesn't exist
mockTaskExists.mockImplementation((tasks, taskId) => {
// Simulate task 99 not existing
if (taskId === '99' || taskId === 99) {
return false;
}
if (typeof taskId === 'string' && taskId.includes('.')) {
const [parentId, subtaskId] = taskId.split('.').map(Number);
const task = tasks.find((t) => t.id === parentId);
return (
task &&
task.subtasks &&
task.subtasks.some((st) => st.id === subtaskId)
);
}
const numericId =
typeof taskId === 'string' ? parseInt(taskId, 10) : taskId;
return tasks.some((task) => task.id === numericId);
});
const { addDependency } = await import(
'../../scripts/modules/dependency-manager.js'
);
const exitError = new Error('process.exit invoked');
process.exit.mockImplementation(() => {
throw exitError;
});
await expect(
addDependency(TEST_TASKS_PATH, '2.2', 99, { projectRoot: '/test' })
).rejects.toBe(exitError);
expect(process.exit).toHaveBeenCalledWith(1);
expect(mockWriteJSON).not.toHaveBeenCalled();
// Verify that an error was reported to the user
expect(mockLog).toHaveBeenCalled();
});
test('should remove top-level task dependency from a subtask', async () => {
const { addDependency, removeDependency } = await import(
'../../scripts/modules/dependency-manager.js'
);
// Start with cloned data and add 11 to 2.2
await addDependency(TEST_TASKS_PATH, '2.2', 11, { projectRoot: '/test' });
// Get the saved data from the add operation
const addWriteCall = mockWriteJSON.mock.calls.find(
([p]) => p === TEST_TASKS_PATH
);
expect(addWriteCall).toBeDefined();
const dataWithDep = addWriteCall[1];
// Verify the dependency was added
const subtask22AfterAdd = dataWithDep.tasks
.find((t) => t.id === 2)
.subtasks.find((st) => st.id === 2);
expect(subtask22AfterAdd.dependencies).toContain(11);
// Clear mocks and re-setup mockReadJSON with the modified data
jest.clearAllMocks();
mockReadJSON.mockImplementation(() => structuredClone(dataWithDep));
await removeDependency(TEST_TASKS_PATH, '2.2', 11, {
projectRoot: '/test'
});
const writeCall = mockWriteJSON.mock.calls.find(
([p]) => p === TEST_TASKS_PATH
);
expect(writeCall).toBeDefined();
const saved = writeCall[1];
const subtask22 = saved.tasks
.find((t) => t.id === 2)
.subtasks.find((st) => st.id === 2);
expect(subtask22.dependencies).not.toContain(11);
// Verify success log was emitted
const successCall = mockLog.mock.calls.find(
([level]) => level === 'success'
);
expect(successCall).toBeDefined();
expect(successCall[1]).toContain('2.2');
expect(successCall[1]).toContain('11');
});
test('should remove subtask dependency from a top-level task', async () => {
const { addDependency, removeDependency } = await import(
'../../scripts/modules/dependency-manager.js'
);
// Add subtask dependency to task 11
await addDependency(TEST_TASKS_PATH, 11, '2.1', { projectRoot: '/test' });
// Get the saved data from the add operation
const addWriteCall = mockWriteJSON.mock.calls.find(
([p]) => p === TEST_TASKS_PATH
);
expect(addWriteCall).toBeDefined();
const dataWithDep = addWriteCall[1];
// Verify the dependency was added
const task11AfterAdd = dataWithDep.tasks.find((t) => t.id === 11);
expect(task11AfterAdd.dependencies).toContain('2.1');
// Clear mocks and re-setup mockReadJSON with the modified data
jest.clearAllMocks();
mockReadJSON.mockImplementation(() => structuredClone(dataWithDep));
await removeDependency(TEST_TASKS_PATH, 11, '2.1', {
projectRoot: '/test'
});
const writeCall = mockWriteJSON.mock.calls.find(
([p]) => p === TEST_TASKS_PATH
);
expect(writeCall).toBeDefined();
const saved = writeCall[1];
const task11 = saved.tasks.find((t) => t.id === 11);
expect(task11.dependencies).not.toContain('2.1');
// Verify success log was emitted
const successCall = mockLog.mock.calls.find(
([level]) => level === 'success'
);
expect(successCall).toBeDefined();
expect(successCall[1]).toContain('11');
expect(successCall[1]).toContain('2.1');
});
});
});