diff --git a/.changeset/many-wasps-sell.md b/.changeset/many-wasps-sell.md new file mode 100644 index 00000000..75631311 --- /dev/null +++ b/.changeset/many-wasps-sell.md @@ -0,0 +1,5 @@ +--- +'task-master-ai': patch +--- + +Task Master no longer tells you to update when you're already up to date diff --git a/.changeset/pre.json b/.changeset/pre.json index 0d16f4e6..e8be1d58 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -1,8 +1,8 @@ { - "mode": "pre", + "mode": "exit", "tag": "rc", "initialVersions": { - "task-master-ai": "0.13.1" + "task-master-ai": "0.13.2" }, "changesets": [ "beige-doodles-type", diff --git a/package-lock.json b/package-lock.json index 342dd287..ff03b4e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "task-master-ai", - "version": "0.13.2-rc.1", + "version": "0.12", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "task-master-ai", - "version": "0.13.2-rc.1", + "version": "0.12", "license": "MIT WITH Commons-Clause", "dependencies": { "@ai-sdk/anthropic": "^1.2.10", diff --git a/package.json b/package.json index a9ef850d..039bcf41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "task-master-ai", - "version": "0.13.2-rc.1", + "version": "0.13.2", "description": "A task management system for ambitious AI-driven development that doesn't overwhelm and confuse Cursor.", "main": "index.js", "type": "module", diff --git a/scripts/modules/commands.js b/scripts/modules/commands.js index 5d62b5e7..78c9c9de 100644 --- a/scripts/modules/commands.js +++ b/scripts/modules/commands.js @@ -73,7 +73,7 @@ import { getApiKeyStatusReport } from './task-manager/models.js'; import { findProjectRoot } from './utils.js'; - +import { getTaskMasterVersion } from '../../src/utils/getVersion.js'; /** * Runs the interactive setup process for model configuration. * @param {string|null} projectRoot - The resolved project root directory. @@ -1273,10 +1273,6 @@ function registerCommands(programInstance) { '--details
', 'Implementation details (for manual task creation)' ) - .option( - '--test-strategy ', - 'Test strategy (for manual task creation)' - ) .option( '--dependencies ', 'Comma-separated list of task IDs this task depends on' @@ -1658,6 +1654,7 @@ function registerCommands(programInstance) { } } catch (error) { console.error(chalk.red(`Error: ${error.message}`)); + showAddSubtaskHelp(); process.exit(1); } }) @@ -2381,28 +2378,7 @@ function setupCLI() { */ async function checkForUpdate() { // Get current version from package.json ONLY - let currentVersion = 'unknown'; // Initialize with a default - try { - // Try to get the version from the installed package (if applicable) or current dir - let packageJsonPath = path.join( - process.cwd(), - 'node_modules', - 'task-master-ai', - 'package.json' - ); - // Fallback to current directory package.json if not found in node_modules - if (!fs.existsSync(packageJsonPath)) { - packageJsonPath = path.join(process.cwd(), 'package.json'); - } - - if (fs.existsSync(packageJsonPath)) { - const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')); - currentVersion = packageJson.version; - } - } catch (error) { - // Silently fail and use default - log('debug', `Error reading current package version: ${error.message}`); - } + const currentVersion = getTaskMasterVersion(); return new Promise((resolve) => { // Get the latest version from npm registry diff --git a/scripts/modules/ui.js b/scripts/modules/ui.js index 975a9055..e6ea4c54 100644 --- a/scripts/modules/ui.js +++ b/scripts/modules/ui.js @@ -16,10 +16,10 @@ import { truncate, isSilentMode } from './utils.js'; -import path from 'path'; import fs from 'fs'; import { findNextTask, analyzeTaskComplexity } from './task-manager.js'; import { getProjectName, getDefaultSubtasks } from './config-manager.js'; +import { getTaskMasterVersion } from '../../src/utils/getVersion.js'; // Create a color gradient for the banner const coolGradient = gradient(['#00b4d8', '#0077b6', '#03045e']); @@ -46,17 +46,7 @@ function displayBanner() { ); // Read version directly from package.json - let version = 'unknown'; // Initialize with a default - try { - const packageJsonPath = path.join(process.cwd(), 'package.json'); - if (fs.existsSync(packageJsonPath)) { - const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')); - version = packageJson.version; - } - } catch (error) { - // Silently fall back to default version - log('warn', 'Could not read package.json for version info.'); - } + const version = getTaskMasterVersion(); console.log( boxen( @@ -809,12 +799,7 @@ async function displayNextTask(tasksPath) { 'padding-bottom': 0, compact: true }, - chars: { - mid: '', - 'left-mid': '', - 'mid-mid': '', - 'right-mid': '' - }, + chars: { mid: '', 'left-mid': '', 'mid-mid': '', 'right-mid': '' }, colWidths: [15, Math.min(75, process.stdout.columns - 20 || 60)], wordWrap: true }); @@ -902,12 +887,7 @@ async function displayNextTask(tasksPath) { 'padding-bottom': 0, compact: true }, - chars: { - mid: '', - 'left-mid': '', - 'mid-mid': '', - 'right-mid': '' - }, + chars: { mid: '', 'left-mid': '', 'mid-mid': '', 'right-mid': '' }, wordWrap: true }); diff --git a/src/utils/getVersion.js b/src/utils/getVersion.js new file mode 100644 index 00000000..55a64f40 --- /dev/null +++ b/src/utils/getVersion.js @@ -0,0 +1,35 @@ +import fs from 'fs'; +import path from 'path'; +import { fileURLToPath } from 'url'; +import { log } from '../../scripts/modules/utils.js'; + +/** + * Reads the version from the nearest package.json relative to this file. + * Returns 'unknown' if not found or on error. + * @returns {string} The version string or 'unknown'. + */ +export function getTaskMasterVersion() { + let version = 'unknown'; + try { + // Get the directory of the current module (getPackageVersion.js) + const currentModuleFilename = fileURLToPath(import.meta.url); + const currentModuleDirname = path.dirname(currentModuleFilename); + // Construct the path to package.json relative to this file (../../package.json) + const packageJsonPath = path.join( + currentModuleDirname, + '..', + '..', + 'package.json' + ); + + if (fs.existsSync(packageJsonPath)) { + const packageJsonContent = fs.readFileSync(packageJsonPath, 'utf8'); + const packageJson = JSON.parse(packageJsonContent); + version = packageJson.version; + } + } catch (error) { + // Silently fall back to default version + log('warn', 'Could not read own package.json for version info.', error); + } + return version; +}