Compare commits

..

4 Commits

Author SHA1 Message Date
Ralph Khreish
2bc619be3d chore: improve changeset 2025-08-06 23:17:19 +02:00
Ralph Khreish
6dad430347 feat: improve task-checker, executor, and orchestrator 2025-08-06 20:08:15 +02:00
Ralph Khreish
b06d59e487 chore: add changeset
- run format
2025-08-06 12:41:57 +02:00
Ralph Khreish
4fa8fe1fa9 feat: implement claude code agents 2025-08-06 12:41:43 +02:00
21 changed files with 219 additions and 672 deletions

View File

@@ -1,7 +0,0 @@
---
"task-master-ai": patch
---
Fix expand task generating unrelated generic subtasks
Fixed an issue where `task-master expand` would generate generic authentication-related subtasks regardless of the parent task context when using complexity reports. The expansion now properly includes the parent task details alongside any expansion guidance.

View File

@@ -1,5 +1,5 @@
{
"mode": "pre",
"mode": "exit",
"tag": "rc",
"initialVersions": {
"task-master-ai": "0.23.0",
@@ -10,4 +10,4 @@
"tender-trams-refuse",
"vast-sites-leave"
]
}
}

View File

@@ -1,5 +0,0 @@
---
"extension": patch
---
Fix issues with some users not being able to connect to Taskmaster MCP server while using the extension

View File

@@ -1,102 +0,0 @@
#!/usr/bin/env node
import { readFileSync, existsSync } from 'node:fs';
import { join, dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Get context from command line argument or environment
const context = process.argv[2] || process.env.GITHUB_WORKFLOW || 'manual';
function findRootDir(startDir) {
let currentDir = resolve(startDir);
while (currentDir !== '/') {
if (existsSync(join(currentDir, 'package.json'))) {
try {
const pkg = JSON.parse(
readFileSync(join(currentDir, 'package.json'), 'utf8')
);
if (pkg.name === 'task-master-ai' || pkg.repository) {
return currentDir;
}
} catch {}
}
currentDir = dirname(currentDir);
}
throw new Error('Could not find root directory');
}
function checkPreReleaseMode() {
console.log('🔍 Checking if branch is in pre-release mode...');
const rootDir = findRootDir(__dirname);
const preJsonPath = join(rootDir, '.changeset', 'pre.json');
// Check if pre.json exists
if (!existsSync(preJsonPath)) {
console.log('✅ Not in active pre-release mode - safe to proceed');
process.exit(0);
}
try {
// Read and parse pre.json
const preJsonContent = readFileSync(preJsonPath, 'utf8');
const preJson = JSON.parse(preJsonContent);
// Check if we're in active pre-release mode
if (preJson.mode === 'pre') {
console.error('❌ ERROR: This branch is in active pre-release mode!');
console.error('');
// Provide context-specific error messages
if (context === 'Release Check' || context === 'pull_request') {
console.error(
'Pre-release mode must be exited before merging to main.'
);
console.error('');
console.error(
'To fix this, run the following commands in your branch:'
);
console.error(' npx changeset pre exit');
console.error(' git add -u');
console.error(' git commit -m "chore: exit pre-release mode"');
console.error(' git push');
console.error('');
console.error('Then update this pull request.');
} else if (context === 'Release' || context === 'main') {
console.error(
'Pre-release mode should only be used on feature branches, not main.'
);
console.error('');
console.error('To fix this, run the following commands locally:');
console.error(' npx changeset pre exit');
console.error(' git add -u');
console.error(' git commit -m "chore: exit pre-release mode"');
console.error(' git push origin main');
console.error('');
console.error('Then re-run this workflow.');
} else {
console.error('Pre-release mode must be exited before proceeding.');
console.error('');
console.error('To fix this, run the following commands:');
console.error(' npx changeset pre exit');
console.error(' git add -u');
console.error(' git commit -m "chore: exit pre-release mode"');
console.error(' git push');
}
process.exit(1);
}
console.log('✅ Not in active pre-release mode - safe to proceed');
process.exit(0);
} catch (error) {
console.error(`❌ ERROR: Unable to parse .changeset/pre.json aborting.`);
console.error(`Error details: ${error.message}`);
process.exit(1);
}
}
// Run the check
checkPreReleaseMode();

View File

@@ -1,54 +0,0 @@
#!/usr/bin/env node
import { readFileSync, existsSync } from 'node:fs';
import { join, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import {
findRootDir,
runCommand,
getPackageVersion,
createAndPushTag
} from './utils.mjs';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const rootDir = findRootDir(__dirname);
const extensionPkgPath = join(rootDir, 'apps', 'extension', 'package.json');
console.log('🚀 Starting pre-release process...');
// Check if we're in RC mode
const preJsonPath = join(rootDir, '.changeset', 'pre.json');
if (!existsSync(preJsonPath)) {
console.error('⚠️ Not in RC mode. Run "npx changeset pre enter rc" first.');
process.exit(1);
}
try {
const preJson = JSON.parse(readFileSync(preJsonPath, 'utf8'));
if (preJson.tag !== 'rc') {
console.error(`⚠️ Not in RC mode. Current tag: ${preJson.tag}`);
process.exit(1);
}
} catch (error) {
console.error('Failed to read pre.json:', error.message);
process.exit(1);
}
// Get current extension version
const extensionVersion = getPackageVersion(extensionPkgPath);
console.log(`Extension version: ${extensionVersion}`);
// Run changeset publish for npm packages
console.log('📦 Publishing npm packages...');
runCommand('npx', ['changeset', 'publish']);
// Create tag for extension pre-release if it doesn't exist
const extensionTag = `extension-rc@${extensionVersion}`;
const tagCreated = createAndPushTag(extensionTag);
if (tagCreated) {
console.log('This will trigger the extension-pre-release workflow...');
}
console.log('✅ Pre-release process completed!');

View File

@@ -1,30 +0,0 @@
#!/usr/bin/env node
import { existsSync, unlinkSync } from 'node:fs';
import { join, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { findRootDir, runCommand } from './utils.mjs';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const rootDir = findRootDir(__dirname);
console.log('🚀 Starting release process...');
// Double-check we're not in pre-release mode (safety net)
const preJsonPath = join(rootDir, '.changeset', 'pre.json');
if (existsSync(preJsonPath)) {
console.log('⚠️ Warning: pre.json still exists. Removing it...');
unlinkSync(preJsonPath);
}
// Check if the extension version has changed and tag it
// This prevents changeset from trying to publish the private package
runCommand('node', [join(__dirname, 'tag-extension.mjs')]);
// Run changeset publish for npm packages
runCommand('npx', ['changeset', 'publish']);
console.log('✅ Release process completed!');
// The extension tag (if created) will trigger the extension-release workflow

21
.github/scripts/release.sh vendored Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
set -e
echo "🚀 Starting release process..."
# Double-check we're not in pre-release mode (safety net)
if [ -f .changeset/pre.json ]; then
echo "⚠️ Warning: pre.json still exists. Removing it..."
rm -f .changeset/pre.json
fi
# Check if the extension version has changed and tag it
# This prevents changeset from trying to publish the private package
node .github/scripts/tag-extension.mjs
# Run changeset publish for npm packages
npx changeset publish
echo "✅ Release process completed!"
# The extension tag (if created) will trigger the extension-release workflow

114
.github/scripts/tag-extension.mjs vendored Executable file → Normal file
View File

@@ -1,13 +1,33 @@
#!/usr/bin/env node
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { join, dirname } from 'node:path';
import { spawnSync } from 'node:child_process';
import { readFileSync, existsSync } from 'node:fs';
import { join, dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { findRootDir, createAndPushTag } from './utils.mjs';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Find the root directory by looking for package.json
function findRootDir(startDir) {
let currentDir = resolve(startDir);
while (currentDir !== '/') {
if (existsSync(join(currentDir, 'package.json'))) {
// Verify it's the root package.json by checking for expected fields
try {
const pkg = JSON.parse(
readFileSync(join(currentDir, 'package.json'), 'utf8')
);
if (pkg.name === 'task-master-ai' || pkg.repository) {
return currentDir;
}
} catch {}
}
currentDir = dirname(currentDir);
}
throw new Error('Could not find root directory');
}
const rootDir = findRootDir(__dirname);
// Read the extension's package.json
@@ -23,11 +43,95 @@ try {
process.exit(1);
}
// Read root package.json for repository info
const rootPkgPath = join(rootDir, 'package.json');
let rootPkg;
try {
const rootPkgContent = readFileSync(rootPkgPath, 'utf8');
rootPkg = JSON.parse(rootPkgContent);
} catch (error) {
console.error('Failed to read root package.json:', error.message);
process.exit(1);
}
// Ensure we have required fields
assert(pkg.name, 'package.json must have a name field');
assert(pkg.version, 'package.json must have a version field');
assert(rootPkg.repository, 'root package.json must have a repository field');
const tag = `${pkg.name}@${pkg.version}`;
// Create and push the tag if it doesn't exist
createAndPushTag(tag);
// Get repository URL from root package.json
// Get repository URL and clean it up for git ls-remote
let repoUrl = rootPkg.repository.url || rootPkg.repository;
if (typeof repoUrl === 'string') {
// Convert git+https://github.com/... to https://github.com/...
repoUrl = repoUrl.replace(/^git\+/, '');
// Ensure it ends with .git for proper remote access
if (!repoUrl.endsWith('.git')) {
repoUrl += '.git';
}
}
console.log(`Checking remote repository: ${repoUrl} for tag: ${tag}`);
let gitResult = spawnSync('git', ['ls-remote', repoUrl, tag], {
encoding: 'utf8',
env: { ...process.env }
});
if (gitResult.status !== 0) {
console.error('Git ls-remote failed:');
console.error('Exit code:', gitResult.status);
console.error('Error:', gitResult.error);
console.error('Stderr:', gitResult.stderr);
console.error('Command:', `git ls-remote ${repoUrl} ${tag}`);
// For CI environments, try using origin instead of the full URL
if (process.env.CI) {
console.log('Retrying with origin remote...');
gitResult = spawnSync('git', ['ls-remote', 'origin', tag], {
encoding: 'utf8'
});
if (gitResult.status !== 0) {
throw new Error(
`Failed to check remote for tag ${tag}. Exit code: ${gitResult.status}`
);
}
} else {
throw new Error(
`Failed to check remote for tag ${tag}. Exit code: ${gitResult.status}`
);
}
}
const exists = String(gitResult.stdout).trim() !== '';
if (!exists) {
console.log(`Creating new extension tag: ${tag}`);
// Create the tag
const tagResult = spawnSync('git', ['tag', tag]);
if (tagResult.status !== 0) {
console.error(
'Failed to create tag:',
tagResult.error || tagResult.stderr.toString()
);
process.exit(1);
}
// Push the tag
const pushResult = spawnSync('git', ['push', 'origin', tag]);
if (pushResult.status !== 0) {
console.error(
'Failed to push tag:',
pushResult.error || pushResult.stderr.toString()
);
process.exit(1);
}
console.log(`✅ Successfully created and pushed tag: ${tag}`);
} else {
console.log(`Extension tag already exists: ${tag}`);
}

View File

@@ -1,88 +0,0 @@
#!/usr/bin/env node
import { spawnSync } from 'node:child_process';
import { readFileSync } from 'node:fs';
import { join, dirname, resolve } from 'node:path';
// Find the root directory by looking for package.json with task-master-ai
export function findRootDir(startDir) {
let currentDir = resolve(startDir);
while (currentDir !== '/') {
const pkgPath = join(currentDir, 'package.json');
try {
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
if (pkg.name === 'task-master-ai' || pkg.repository) {
return currentDir;
}
} catch {}
currentDir = dirname(currentDir);
}
throw new Error('Could not find root directory');
}
// Run a command with proper error handling
export function runCommand(command, args = [], options = {}) {
console.log(`Running: ${command} ${args.join(' ')}`);
const result = spawnSync(command, args, {
encoding: 'utf8',
stdio: 'inherit',
...options
});
if (result.status !== 0) {
console.error(`Command failed with exit code ${result.status}`);
process.exit(result.status);
}
return result;
}
// Get package version from a package.json file
export function getPackageVersion(packagePath) {
try {
const pkg = JSON.parse(readFileSync(packagePath, 'utf8'));
return pkg.version;
} catch (error) {
console.error(
`Failed to read package version from ${packagePath}:`,
error.message
);
process.exit(1);
}
}
// Check if a git tag exists on remote
export function tagExistsOnRemote(tag, remote = 'origin') {
const result = spawnSync('git', ['ls-remote', remote, tag], {
encoding: 'utf8'
});
return result.status === 0 && result.stdout.trim() !== '';
}
// Create and push a git tag if it doesn't exist
export function createAndPushTag(tag, remote = 'origin') {
// Check if tag already exists
if (tagExistsOnRemote(tag, remote)) {
console.log(`Tag ${tag} already exists on remote, skipping`);
return false;
}
console.log(`Creating new tag: ${tag}`);
// Create the tag locally
const tagResult = spawnSync('git', ['tag', tag]);
if (tagResult.status !== 0) {
console.error('Failed to create tag:', tagResult.error || tagResult.stderr);
process.exit(1);
}
// Push the tag to remote
const pushResult = spawnSync('git', ['push', remote, tag]);
if (pushResult.status !== 0) {
console.error('Failed to push tag:', pushResult.error || pushResult.stderr);
process.exit(1);
}
console.log(`✅ Successfully created and pushed tag: ${tag}`);
return true;
}

View File

@@ -1,110 +0,0 @@
name: Extension Pre-Release
on:
push:
tags:
- "extension-rc@*"
permissions:
contents: write
concurrency: extension-pre-release-${{ github.ref }}
jobs:
publish-extension-rc:
runs-on: ubuntu-latest
environment: extension-release
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache node_modules
uses: actions/cache@v4
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Extension Dependencies
working-directory: apps/extension
run: npm ci
timeout-minutes: 5
- name: Type Check Extension
working-directory: apps/extension
run: npm run check-types
env:
FORCE_COLOR: 1
- name: Build Extension
working-directory: apps/extension
run: npm run build
env:
FORCE_COLOR: 1
- name: Package Extension
working-directory: apps/extension
run: npm run package
env:
FORCE_COLOR: 1
- name: Create VSIX Package (Pre-Release)
working-directory: apps/extension/vsix-build
run: npx vsce package --no-dependencies --pre-release
env:
FORCE_COLOR: 1
- name: Get VSIX filename
id: vsix-info
working-directory: apps/extension/vsix-build
run: |
VSIX_FILE=$(find . -maxdepth 1 -name "*.vsix" -type f | head -n1 | xargs basename)
if [ -z "$VSIX_FILE" ]; then
echo "Error: No VSIX file found"
exit 1
fi
echo "vsix-filename=$VSIX_FILE" >> "$GITHUB_OUTPUT"
echo "Found VSIX: $VSIX_FILE"
- name: Publish to VS Code Marketplace (Pre-Release)
working-directory: apps/extension/vsix-build
run: npx vsce publish --packagePath "${{ steps.vsix-info.outputs.vsix-filename }}" --pre-release
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
FORCE_COLOR: 1
- name: Install Open VSX CLI
run: npm install -g ovsx
- name: Publish to Open VSX Registry (Pre-Release)
working-directory: apps/extension/vsix-build
run: ovsx publish "${{ steps.vsix-info.outputs.vsix-filename }}" --pre-release
env:
OVSX_PAT: ${{ secrets.OVSX_PAT }}
FORCE_COLOR: 1
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: extension-pre-release-${{ github.ref_name }}
path: |
apps/extension/vsix-build/*.vsix
apps/extension/dist/
retention-days: 30
notify-success:
needs: publish-extension-rc
if: success()
runs-on: ubuntu-latest
steps:
- name: Success Notification
run: |
echo "🚀 Extension ${{ github.ref_name }} successfully published as pre-release!"
echo "📦 Available on VS Code Marketplace (Pre-Release)"
echo "🌍 Available on Open VSX Registry (Pre-Release)"

View File

@@ -89,6 +89,32 @@ jobs:
OVSX_PAT: ${{ secrets.OVSX_PAT }}
FORCE_COLOR: 1
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Extension ${{ github.ref_name }}
body: |
VS Code Extension Release ${{ github.ref_name }}
**Marketplaces:**
- [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=Hamster.task-master-hamster)
- [Open VSX Registry](https://open-vsx.org/extension/Hamster/task-master-hamster)
draft: false
prerelease: false
- name: Upload VSIX to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: apps/extension/vsix-build/${{ steps.vsix-info.outputs.vsix-filename }}
asset_name: ${{ steps.vsix-info.outputs.vsix-filename }}
asset_content_type: application/zip
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:

View File

@@ -9,7 +9,6 @@ jobs:
runs-on: ubuntu-latest
# Only allow pre-releases on non-main branches
if: github.ref != 'refs/heads/main'
environment: extension-release
steps:
- uses: actions/checkout@v4
with:
@@ -36,26 +35,9 @@ jobs:
- name: Enter RC mode (if not already in RC mode)
run: |
# Check if we're in pre-release mode with the "rc" tag
if [ -f .changeset/pre.json ]; then
MODE=$(jq -r '.mode' .changeset/pre.json 2>/dev/null || echo '')
TAG=$(jq -r '.tag' .changeset/pre.json 2>/dev/null || echo '')
if [ "$MODE" = "exit" ]; then
echo "Pre-release mode is in 'exit' state, re-entering RC mode..."
npx changeset pre enter rc
elif [ "$MODE" = "pre" ] && [ "$TAG" != "rc" ]; then
echo "In pre-release mode but with wrong tag ($TAG), switching to RC..."
npx changeset pre exit
npx changeset pre enter rc
elif [ "$MODE" = "pre" ] && [ "$TAG" = "rc" ]; then
echo "Already in RC pre-release mode"
else
echo "Unknown mode state: $MODE, entering RC mode..."
npx changeset pre enter rc
fi
else
echo "No pre.json found, entering RC mode..."
# ensure were in the right pre-mode (tag "rc")
if [ ! -f .changeset/pre.json ] \
|| [ "$(jq -r '.tag' .changeset/pre.json 2>/dev/null || echo '')" != "rc" ]; then
npx changeset pre enter rc
fi
@@ -68,12 +50,10 @@ jobs:
- name: Create Release Candidate Pull Request or Publish Release Candidate to npm
uses: changesets/action@v1
with:
publish: node ./.github/scripts/pre-release.mjs
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}
OVSX_PAT: ${{ secrets.OVSX_PAT }}
- name: Commit & Push changes
uses: actions-js/push@master

View File

@@ -18,4 +18,29 @@ jobs:
fetch-depth: 0
- name: Check release mode
run: node ./.github/scripts/check-pre-release-mode.mjs "pull_request"
run: |
set -euo pipefail
echo "🔍 Checking if branch is in pre-release mode..."
if [[ -f .changeset/pre.json ]]; then
if ! PRE_MODE=$(jq -r '.mode' .changeset/pre.json 2>/dev/null); then
echo "❌ ERROR: Unable to parse .changeset/pre.json aborting merge."
exit 1
fi
if [[ "$PRE_MODE" == "pre" ]]; then
echo "❌ ERROR: This branch is in active pre-release mode!"
echo ""
echo "Pre-release mode must be exited before merging to main."
echo ""
echo "To fix this, run the following commands in your branch:"
echo " npx changeset pre exit"
echo " git add -u"
echo " git commit -m 'chore: exit pre-release mode'"
echo " git push"
echo ""
echo "Then update this pull request."
exit 1
fi
fi
echo "✅ Not in active pre-release mode - PR can be merged"

View File

@@ -39,12 +39,30 @@ jobs:
timeout-minutes: 2
- name: Check pre-release mode
run: node ./.github/scripts/check-pre-release-mode.mjs "main"
run: |
set -euo pipefail
echo "🔍 Checking pre-release mode status..."
if [[ -f .changeset/pre.json ]]; then
echo "❌ ERROR: Main branch is in pre-release mode!"
echo ""
echo "Pre-release mode should only be used on feature branches, not main."
echo ""
echo "To fix this, run the following commands locally:"
echo " npx changeset pre exit"
echo " git add -u"
echo " git commit -m 'chore: exit pre-release mode'"
echo " git push origin main"
echo ""
echo "Then re-run this workflow."
exit 1
fi
echo "✅ Not in pre-release mode - proceeding with release"
- name: Create Release Pull Request or Publish to npm
uses: changesets/action@v1
with:
publish: node ./.github/scripts/release.mjs
publish: ./.github/scripts/release.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@@ -64,16 +64,16 @@
"properties": {
"taskmaster.mcp.command": {
"type": "string",
"default": "node",
"description": "The command to execute for the MCP server (e.g., 'node' for bundled server or 'npx' for remote)."
"default": "npx",
"description": "The command or absolute path to execute for the MCP server (e.g., 'npx' or '/usr/local/bin/task-master-ai')."
},
"taskmaster.mcp.args": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Arguments for the MCP server (leave empty to use bundled server)."
"default": ["task-master-ai"],
"description": "An array of arguments to pass to the MCP server command."
},
"taskmaster.mcp.cwd": {
"type": "string",
@@ -238,9 +238,6 @@
"watch:css": "npx @tailwindcss/cli -i ./src/webview/index.css -o ./dist/index.css --watch",
"check-types": "tsc --noEmit"
},
"dependencies": {
"task-master-ai": "*"
},
"devDependencies": {
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/modifiers": "^9.0.0",

View File

@@ -2,7 +2,7 @@
"name": "task-master-hamster",
"displayName": "Taskmaster AI",
"description": "A visual Kanban board interface for Taskmaster projects in VS Code",
"version": "0.23.0",
"version": "0.22.3",
"publisher": "Hamster",
"icon": "assets/icon.png",
"engines": {

View File

@@ -1,7 +1,6 @@
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
import * as vscode from 'vscode';
import * as path from 'path';
import { logger } from './logger';
export interface MCPConfig {
@@ -144,7 +143,7 @@ export class MCPClientManager {
// Create the client
this.client = new Client(
{
name: 'task-master-vscode-extension',
name: 'taskr-vscode-extension',
version: '1.0.0'
},
{
@@ -212,30 +211,6 @@ export class MCPClientManager {
};
logger.log('MCP client connected successfully');
// Log Task Master version information after successful connection
try {
const versionResult = await this.callTool('get_tasks', {});
if (versionResult?.content?.[0]?.text) {
const response = JSON.parse(versionResult.content[0].text);
if (response?.version) {
logger.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
logger.log('✅ Task Master MCP Server Connected');
logger.log(` Version: ${response.version.version || 'unknown'}`);
logger.log(
` Package: ${response.version.name || 'task-master-ai'}`
);
if (response.tag) {
logger.log(
` Current Tag: ${response.tag.currentTag || 'master'}`
);
}
logger.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
}
}
} catch (versionError) {
logger.log('Note: Could not retrieve Task Master version information');
}
} catch (error) {
logger.error('Failed to connect to MCP server:', error);
this.status = {
@@ -337,34 +312,6 @@ export class MCPClientManager {
'Available MCP tools:',
result.tools?.map((t) => t.name) || []
);
// Try to get version information by calling a simple tool
// The get_tasks tool is lightweight and returns version info
try {
const versionResult = await this.callTool('get_tasks', {});
if (versionResult?.content?.[0]?.text) {
// Parse the response to extract version info
const response = JSON.parse(versionResult.content[0].text);
if (response?.version) {
logger.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
logger.log('📦 Task Master MCP Server Connected');
logger.log(` Version: ${response.version.version || 'unknown'}`);
logger.log(
` Package: ${response.version.name || 'task-master-ai'}`
);
if (response.tag) {
logger.log(
` Current Tag: ${response.tag.currentTag || 'master'}`
);
}
logger.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
}
}
} catch (versionError) {
// Don't fail the connection test if we can't get version info
logger.log('Could not retrieve Task Master version information');
}
return true;
} catch (error) {
logger.error('Connection test failed:', error);
@@ -398,34 +345,8 @@ export function createMCPConfigFromSettings(): MCPConfig {
);
const config = vscode.workspace.getConfiguration('taskmaster');
let command = config.get<string>('mcp.command', 'node');
let args = config.get<string[]>('mcp.args', []);
// If using default settings, use the bundled MCP server
if (command === 'node' && args.length === 0) {
try {
// Try to resolve the bundled MCP server
const taskMasterPath = require.resolve('task-master-ai');
const mcpServerPath = path.resolve(
path.dirname(taskMasterPath),
'mcp-server/server.js'
);
// Verify the server file exists
const fs = require('fs');
if (!fs.existsSync(mcpServerPath)) {
throw new Error('MCP server file not found at: ' + mcpServerPath);
}
args = [mcpServerPath];
logger.log(`📦 Using bundled MCP server at: ${mcpServerPath}`);
} catch (error) {
logger.error('❌ Could not find bundled task-master-ai server:', error);
// Fallback to npx
command = 'npx';
args = ['-y', 'task-master-ai'];
}
}
let command = config.get<string>('mcp.command', 'npx');
const args = config.get<string[]>('mcp.args', ['task-master-ai']);
// Use proper VS Code workspace detection
const defaultCwd =

7
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "task-master-ai",
"version": "0.23.1-rc.0",
"version": "0.23.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "task-master-ai",
"version": "0.23.1-rc.0",
"version": "0.23.0",
"license": "MIT WITH Commons-Clause",
"workspaces": [
"apps/*",
@@ -86,9 +86,6 @@
},
"apps/extension": {
"version": "0.23.0",
"dependencies": {
"task-master-ai": "*"
},
"devDependencies": {
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/modifiers": "^9.0.0",

View File

@@ -527,18 +527,6 @@ async function expandTask(
const { systemPrompt, userPrompt: promptContent } =
await promptManager.loadPrompt('expand-task', promptParams, variantKey);
// Debug logging to identify the issue
logger.debug(`Selected variant: ${variantKey}`);
logger.debug(
`Prompt params passed: ${JSON.stringify(promptParams, null, 2)}`
);
logger.debug(
`System prompt (first 500 chars): ${systemPrompt.substring(0, 500)}...`
);
logger.debug(
`User prompt (first 500 chars): ${promptContent.substring(0, 500)}...`
);
// --- End Complexity Report / Prompt Logic ---
// --- AI Subtask Generation using generateTextService ---

View File

@@ -69,7 +69,7 @@
"complexity-report": {
"condition": "expansionPrompt",
"system": "You are an AI assistant helping with task breakdown. Generate {{#if (gt subtaskCount 0)}}exactly {{subtaskCount}}{{else}}an appropriate number of{{/if}} subtasks based on the provided prompt and context.\nRespond ONLY with a valid JSON object containing a single key \"subtasks\" whose value is an array of the generated subtask objects.\nEach subtask object in the array must have keys: \"id\", \"title\", \"description\", \"dependencies\", \"details\", \"status\".\nEnsure the 'id' starts from {{nextSubtaskId}} and is sequential.\nFor 'dependencies', use the full subtask ID format: \"{{task.id}}.1\", \"{{task.id}}.2\", etc. Only reference subtasks within this same task.\nEnsure 'status' is 'pending'.\nDo not include any other text or explanation.",
"user": "Break down the following task based on the analysis prompt:\n\nParent Task:\nID: {{task.id}}\nTitle: {{task.title}}\nDescription: {{task.description}}\nCurrent details: {{#if task.details}}{{task.details}}{{else}}None{{/if}}\n\nExpansion Guidance:\n{{expansionPrompt}}{{#if additionalContext}}\n\n{{additionalContext}}{{/if}}{{#if complexityReasoningContext}}\n\n{{complexityReasoningContext}}{{/if}}{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}{{/if}}\n\nGenerate {{#if (gt subtaskCount 0)}}exactly {{subtaskCount}}{{else}}an appropriate number of{{/if}} subtasks with sequential IDs starting from {{nextSubtaskId}}."
"user": "{{#if isClaudeCode}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before generating subtasks:\n\n1. Use the Glob tool to explore relevant files for this task (e.g., \"**/*.js\", \"src/**/*.ts\")\n2. Use the Grep tool to search for existing implementations related to this task\n3. Use the Read tool to examine files that would be affected by this task\n4. Understand the current implementation state and patterns used\n\nBased on your analysis:\n- Identify existing code that relates to this task\n- Understand patterns and conventions to follow\n- Generate subtasks that integrate smoothly with existing code\n- Ensure subtasks are specific and actionable based on the actual codebase\n\nProject Root: {{projectRoot}}\n\n{{/if}}{{expansionPrompt}}{{#if additionalContext}}\n\n{{additionalContext}}{{/if}}{{#if complexityReasoningContext}}\n\n{{complexityReasoningContext}}{{/if}}{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}{{/if}}"
},
"research": {
"condition": "useResearch === true && !expansionPrompt",

View File

@@ -1,134 +0,0 @@
import { jest } from '@jest/globals';
import { PromptManager } from '../../../scripts/modules/prompt-manager.js';
describe('expand-task prompt template', () => {
let promptManager;
beforeEach(() => {
promptManager = new PromptManager();
});
const testTask = {
id: 1,
title: 'Setup AWS Infrastructure',
description: 'Provision core AWS services',
details: 'Create VPC, subnets, and security groups'
};
const baseParams = {
task: testTask,
subtaskCount: 3,
nextSubtaskId: 1,
additionalContext: '',
complexityReasoningContext: '',
gatheredContext: '',
useResearch: false,
expansionPrompt: undefined
};
test('default variant includes task context', () => {
const { userPrompt } = promptManager.loadPrompt(
'expand-task',
baseParams,
'default'
);
expect(userPrompt).toContain(testTask.title);
expect(userPrompt).toContain(testTask.description);
expect(userPrompt).toContain(testTask.details);
expect(userPrompt).toContain('Task ID: 1');
});
test('research variant includes task context', () => {
const params = { ...baseParams, useResearch: true };
const { userPrompt } = promptManager.loadPrompt(
'expand-task',
params,
'research'
);
expect(userPrompt).toContain(testTask.title);
expect(userPrompt).toContain(testTask.description);
expect(userPrompt).toContain(testTask.details);
expect(userPrompt).toContain('Parent Task:');
expect(userPrompt).toContain('ID: 1');
});
test('complexity-report variant includes task context', () => {
const params = {
...baseParams,
expansionPrompt: 'Focus on security best practices',
complexityReasoningContext: 'High complexity due to security requirements'
};
const { userPrompt } = promptManager.loadPrompt(
'expand-task',
params,
'complexity-report'
);
// The fix ensures task context is included
expect(userPrompt).toContain('Parent Task:');
expect(userPrompt).toContain(`ID: ${testTask.id}`);
expect(userPrompt).toContain(`Title: ${testTask.title}`);
expect(userPrompt).toContain(`Description: ${testTask.description}`);
expect(userPrompt).toContain(`Current details: ${testTask.details}`);
// Also includes the expansion prompt
expect(userPrompt).toContain('Expansion Guidance:');
expect(userPrompt).toContain(params.expansionPrompt);
expect(userPrompt).toContain(params.complexityReasoningContext);
});
test('all variants request JSON format with subtasks array', () => {
const variants = ['default', 'research', 'complexity-report'];
variants.forEach((variant) => {
const params =
variant === 'complexity-report'
? { ...baseParams, expansionPrompt: 'test' }
: baseParams;
const { systemPrompt, userPrompt } = promptManager.loadPrompt(
'expand-task',
params,
variant
);
const combined = systemPrompt + userPrompt;
expect(combined.toLowerCase()).toContain('subtasks');
expect(combined).toContain('JSON');
});
});
test('complexity-report variant fails without task context regression test', () => {
// This test ensures we don't regress to the old behavior where
// complexity-report variant only used expansionPrompt without task context
const params = {
...baseParams,
expansionPrompt: 'Generic expansion prompt'
};
const { userPrompt } = promptManager.loadPrompt(
'expand-task',
params,
'complexity-report'
);
// Count occurrences of task-specific content
const titleOccurrences = (
userPrompt.match(new RegExp(testTask.title, 'g')) || []
).length;
const descriptionOccurrences = (
userPrompt.match(new RegExp(testTask.description, 'g')) || []
).length;
// Should have at least one occurrence of title and description
expect(titleOccurrences).toBeGreaterThanOrEqual(1);
expect(descriptionOccurrences).toBeGreaterThanOrEqual(1);
// Should not be ONLY the expansion prompt
expect(userPrompt.length).toBeGreaterThan(
params.expansionPrompt.length + 100
);
});
});