2025-04-14 19:50:15 -04:00
import fs from 'fs' ;
import path from 'path' ;
import chalk from 'chalk' ;
2025-04-16 00:35:30 -04:00
import { fileURLToPath } from 'url' ;
chore: Remove unused imports across modules
Removes unused import statements identified after the major refactoring of the AI service layer and other components. This cleanup improves code clarity and removes unnecessary dependencies.
Unused imports removed from:
- **`mcp-server/src/core/direct-functions/analyze-task-complexity.js`:**
- Removed `path`
- **`mcp-server/src/core/direct-functions/complexity-report.js`:**
- Removed `path`
- **`mcp-server/src/core/direct-functions/expand-all-tasks.js`:**
- Removed `path`, `fs`
- **`mcp-server/src/core/direct-functions/generate-task-files.js`:**
- Removed `path`
- **`mcp-server/src/core/direct-functions/parse-prd.js`:**
- Removed `os`, `findTasksJsonPath`
- **`mcp-server/src/core/direct-functions/update-tasks.js`:**
- Removed `isSilentMode`
- **`mcp-server/src/tools/add-task.js`:**
- Removed `createContentResponse`, `executeTaskMasterCommand`
- **`mcp-server/src/tools/analyze.js`:**
- Removed `getProjectRootFromSession` (as `projectRoot` is now required in args)
- **`mcp-server/src/tools/expand-task.js`:**
- Removed `path`
- **`mcp-server/src/tools/initialize-project.js`:**
- Removed `createContentResponse`
- **`mcp-server/src/tools/parse-prd.js`:**
- Removed `findPRDDocumentPath`, `resolveTasksOutputPath` (logic moved or handled by `resolveProjectPaths`)
- **`mcp-server/src/tools/update.js`:**
- Removed `getProjectRootFromSession` (as `projectRoot` is now required in args)
- **`scripts/modules/commands.js`:**
- Removed `exec`, `readline`
- Removed AI config getters (`getMainModelId`, etc.)
- Removed MCP helpers (`getMcpApiKeyStatus`)
- **`scripts/modules/config-manager.js`:**
- Removed `ZodError`, `readJSON`, `writeJSON`
- **`scripts/modules/task-manager/analyze-task-complexity.js`:**
- Removed AI config getters (`getMainModelId`, etc.)
- **`scripts/modules/task-manager/expand-all-tasks.js`:**
- Removed `fs`, `path`, `writeJSON`
- **`scripts/modules/task-manager/models.js`:**
- Removed `VALID_PROVIDERS`
- **`scripts/modules/task-manager/update-subtask-by-id.js`:**
- Removed AI config getters (`getMainModelId`, etc.)
- **`scripts/modules/task-manager/update-tasks.js`:**
- Removed AI config getters (`getMainModelId`, etc.)
- **`scripts/modules/ui.js`:**
- Removed `getDebugFlag`
- **`scripts/modules/utils.js`:**
- Removed `ZodError`
2025-04-25 15:11:55 -04:00
import { log , resolveEnvVariable , findProjectRoot } from './utils.js' ;
2025-04-16 00:35:30 -04:00
// Calculate __dirname in ESM
const _ _filename = fileURLToPath ( import . meta . url ) ;
const _ _dirname = path . dirname ( _ _filename ) ;
// Load supported models from JSON file using the calculated __dirname
let MODEL _MAP ;
try {
const supportedModelsRaw = fs . readFileSync (
path . join ( _ _dirname , 'supported-models.json' ) ,
'utf-8'
) ;
MODEL _MAP = JSON . parse ( supportedModelsRaw ) ;
} catch ( error ) {
console . error (
chalk . red (
'FATAL ERROR: Could not load supported-models.json. Please ensure the file exists and is valid JSON.'
) ,
error
) ;
MODEL _MAP = { } ; // Default to empty map on error to avoid crashing, though functionality will be limited
process . exit ( 1 ) ; // Exit if models can't be loaded
}
2025-04-14 19:50:15 -04:00
const CONFIG _FILE _NAME = '.taskmasterconfig' ;
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
// Define valid providers dynamically from the loaded MODEL_MAP
2025-04-27 14:47:50 -04:00
const VALID _PROVIDERS = Object . keys ( MODEL _MAP || { } ) ;
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
// Default configuration values (used if .taskmasterconfig is missing or incomplete)
const DEFAULTS = {
models : {
main : {
provider : 'anthropic' ,
modelId : 'claude-3-7-sonnet-20250219' ,
maxTokens : 64000 ,
temperature : 0.2
} ,
research : {
provider : 'perplexity' ,
modelId : 'sonar-pro' ,
maxTokens : 8700 ,
temperature : 0.1
} ,
fallback : {
// No default fallback provider/model initially
provider : 'anthropic' ,
modelId : 'claude-3-5-sonnet' ,
maxTokens : 64000 , // Default parameters if fallback IS configured
temperature : 0.2
2025-04-14 19:50:15 -04:00
}
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
} ,
global : {
logLevel : 'info' ,
debug : false ,
defaultSubtasks : 5 ,
defaultPriority : 'medium' ,
projectName : 'Task Master' ,
ollamaBaseUrl : 'http://localhost:11434/api'
2025-04-14 19:50:15 -04:00
}
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
} ;
2025-04-14 19:50:15 -04:00
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
// --- Internal Config Loading ---
2025-04-24 13:34:51 -04:00
let loadedConfig = null ;
let loadedConfigRoot = null ; // Track which root loaded the config
2025-04-14 19:50:15 -04:00
2025-04-21 22:25:04 -04:00
// Custom Error for configuration issues
class ConfigurationError extends Error {
constructor ( message ) {
super ( message ) ;
this . name = 'ConfigurationError' ;
}
}
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
function _loadAndValidateConfig ( explicitRoot = null ) {
const defaults = DEFAULTS ; // Use the defined defaults
2025-04-27 01:23:18 -04:00
let rootToUse = explicitRoot ;
let configSource = explicitRoot
? ` explicit root ( ${ explicitRoot } ) `
: 'defaults (no root provided yet)' ;
// ---> If no explicit root, TRY to find it <---
if ( ! rootToUse ) {
rootToUse = findProjectRoot ( ) ;
if ( rootToUse ) {
configSource = ` found root ( ${ rootToUse } ) ` ;
} else {
// No root found, return defaults immediately
return defaults ;
}
2025-04-14 19:50:15 -04:00
}
2025-04-27 01:23:18 -04:00
// ---> End find project root logic <---
2025-04-21 22:25:04 -04:00
2025-04-27 01:23:18 -04:00
// --- Proceed with loading from the determined rootToUse ---
const configPath = path . join ( rootToUse , CONFIG _FILE _NAME ) ;
2025-04-24 13:34:51 -04:00
let config = { ... defaults } ; // Start with a deep copy of defaults
let configExists = false ;
2025-04-14 19:50:15 -04:00
2025-04-24 13:34:51 -04:00
if ( fs . existsSync ( configPath ) ) {
2025-04-21 22:25:04 -04:00
configExists = true ;
2025-04-14 19:50:15 -04:00
try {
const rawData = fs . readFileSync ( configPath , 'utf-8' ) ;
const parsedConfig = JSON . parse ( rawData ) ;
2025-04-21 22:25:04 -04:00
// Deep merge parsed config onto defaults
config = {
2025-04-14 19:50:15 -04:00
models : {
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
main : { ... defaults . models . main , ... parsedConfig ? . models ? . main } ,
2025-04-14 19:50:15 -04:00
research : {
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
... defaults . models . research ,
... parsedConfig ? . models ? . research
2025-04-16 00:35:30 -04:00
} ,
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
fallback :
parsedConfig ? . models ? . fallback ? . provider &&
parsedConfig ? . models ? . fallback ? . modelId
? { ... defaults . models . fallback , ... parsedConfig . models . fallback }
2025-04-21 22:25:04 -04:00
: { ... defaults . models . fallback }
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
} ,
global : { ... defaults . global , ... parsedConfig ? . global }
2025-04-14 19:50:15 -04:00
} ;
2025-04-27 01:23:18 -04:00
configSource = ` file ( ${ configPath } ) ` ; // Update source info
2025-04-14 19:50:15 -04:00
2025-04-24 13:34:51 -04:00
// --- Validation (Warn if file content is invalid) ---
2025-04-27 01:23:18 -04:00
// Use log.warn for consistency
2025-04-14 19:50:15 -04:00
if ( ! validateProvider ( config . models . main . provider ) ) {
console . warn (
chalk . yellow (
2025-04-24 13:34:51 -04:00
` Warning: Invalid main provider " ${ config . models . main . provider } " in ${ configPath } . Falling back to default. `
2025-04-14 19:50:15 -04:00
)
) ;
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
config . models . main = { ... defaults . models . main } ;
2025-04-14 19:50:15 -04:00
}
if ( ! validateProvider ( config . models . research . provider ) ) {
console . warn (
chalk . yellow (
2025-04-24 13:34:51 -04:00
` Warning: Invalid research provider " ${ config . models . research . provider } " in ${ configPath } . Falling back to default. `
2025-04-14 19:50:15 -04:00
)
) ;
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
config . models . research = { ... defaults . models . research } ;
2025-04-14 19:50:15 -04:00
}
2025-04-16 00:35:30 -04:00
if (
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
config . models . fallback ? . provider &&
2025-04-16 00:35:30 -04:00
! validateProvider ( config . models . fallback . provider )
) {
console . warn (
chalk . yellow (
2025-04-24 13:34:51 -04:00
` Warning: Invalid fallback provider " ${ config . models . fallback . provider } " in ${ configPath } . Fallback model configuration will be ignored. `
2025-04-16 00:35:30 -04:00
)
) ;
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
config . models . fallback . provider = undefined ;
config . models . fallback . modelId = undefined ;
2025-04-16 00:35:30 -04:00
}
2025-04-14 19:50:15 -04:00
} catch ( error ) {
2025-04-24 13:34:51 -04:00
// Use console.error for actual errors during parsing
2025-04-14 19:50:15 -04:00
console . error (
chalk . red (
` Error reading or parsing ${ configPath } : ${ error . message } . Using default configuration. `
)
) ;
2025-04-24 13:34:51 -04:00
config = { ... defaults } ; // Reset to defaults on parse error
2025-04-27 01:23:18 -04:00
configSource = ` defaults (parse error at ${ configPath } ) ` ;
2025-04-14 19:50:15 -04:00
}
} else {
2025-04-27 01:23:18 -04:00
// Config file doesn't exist at the determined rootToUse.
if ( explicitRoot ) {
// Only warn if an explicit root was *expected*.
console . warn (
chalk . yellow (
` Warning: ${ CONFIG _FILE _NAME } not found at provided project root ( ${ explicitRoot } ). Using default configuration. Run 'task-master models --setup' to configure. `
)
) ;
} else {
console . warn (
chalk . yellow (
` Warning: ${ CONFIG _FILE _NAME } not found at derived root ( ${ rootToUse } ). Using defaults. `
)
) ;
}
2025-04-24 13:34:51 -04:00
// Keep config as defaults
config = { ... defaults } ;
2025-04-27 01:23:18 -04:00
configSource = ` defaults (file not found at ${ configPath } ) ` ;
2025-04-14 19:50:15 -04:00
}
2025-04-21 22:25:04 -04:00
return config ;
2025-04-14 19:50:15 -04:00
}
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
/ * *
* Gets the current configuration , loading it if necessary .
2025-04-24 13:34:51 -04:00
* Handles MCP initialization context gracefully .
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
* @ param { string | null } explicitRoot - Optional explicit path to the project root .
* @ param { boolean } forceReload - Force reloading the config file .
* @ returns { object } The loaded configuration object .
* /
function getConfig ( explicitRoot = null , forceReload = false ) {
2025-04-24 13:34:51 -04:00
// Determine if a reload is necessary
const needsLoad =
! loadedConfig ||
forceReload ||
( explicitRoot && explicitRoot !== loadedConfigRoot ) ;
if ( needsLoad ) {
const newConfig = _loadAndValidateConfig ( explicitRoot ) ; // _load handles null explicitRoot
// Only update the global cache if loading was forced or if an explicit root
// was provided (meaning we attempted to load a specific project's config).
// We avoid caching the initial default load triggered without an explicitRoot.
if ( forceReload || explicitRoot ) {
loadedConfig = newConfig ;
loadedConfigRoot = explicitRoot ; // Store the root used for this loaded config
}
return newConfig ; // Return the newly loaded/default config
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
}
2025-04-24 13:34:51 -04:00
// If no load was needed, return the cached config
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
return loadedConfig ;
}
2025-04-14 19:50:15 -04:00
/ * *
* Validates if a provider name is in the list of supported providers .
* @ param { string } providerName The name of the provider .
* @ returns { boolean } True if the provider is valid , false otherwise .
* /
function validateProvider ( providerName ) {
return VALID _PROVIDERS . includes ( providerName ) ;
}
/ * *
* Optional : Validates if a modelId is known for a given provider based on MODEL _MAP .
* This is a non - strict validation ; an unknown model might still be valid .
* @ param { string } providerName The name of the provider .
* @ param { string } modelId The model ID .
* @ returns { boolean } True if the modelId is in the map for the provider , false otherwise .
* /
function validateProviderModelCombination ( providerName , modelId ) {
// If provider isn't even in our map, we can't validate the model
if ( ! MODEL _MAP [ providerName ] ) {
return true ; // Allow unknown providers or those without specific model lists
}
// If the provider is known, check if the model is in its list OR if the list is empty (meaning accept any)
return (
MODEL _MAP [ providerName ] . length === 0 ||
2025-04-16 00:35:30 -04:00
// Use .some() to check the 'id' property of objects in the array
MODEL _MAP [ providerName ] . some ( ( modelObj ) => modelObj . id === modelId )
2025-04-14 19:50:15 -04:00
) ;
}
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
// --- Role-Specific Getters ---
function getModelConfigForRole ( role , explicitRoot = null ) {
const config = getConfig ( explicitRoot ) ;
const roleConfig = config ? . models ? . [ role ] ;
if ( ! roleConfig ) {
2025-04-21 22:25:04 -04:00
log (
'warn' ,
` No model configuration found for role: ${ role } . Returning default. `
) ;
return DEFAULTS . models [ role ] || { } ;
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
}
return roleConfig ;
}
2025-04-14 19:50:15 -04:00
function getMainProvider ( explicitRoot = null ) {
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
return getModelConfigForRole ( 'main' , explicitRoot ) . provider ;
2025-04-14 19:50:15 -04:00
}
function getMainModelId ( explicitRoot = null ) {
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
return getModelConfigForRole ( 'main' , explicitRoot ) . modelId ;
}
function getMainMaxTokens ( explicitRoot = null ) {
2025-04-21 22:25:04 -04:00
// Directly return value from config (which includes defaults)
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
return getModelConfigForRole ( 'main' , explicitRoot ) . maxTokens ;
}
function getMainTemperature ( explicitRoot = null ) {
2025-04-21 22:25:04 -04:00
// Directly return value from config
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
return getModelConfigForRole ( 'main' , explicitRoot ) . temperature ;
2025-04-14 19:50:15 -04:00
}
function getResearchProvider ( explicitRoot = null ) {
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
return getModelConfigForRole ( 'research' , explicitRoot ) . provider ;
2025-04-14 19:50:15 -04:00
}
function getResearchModelId ( explicitRoot = null ) {
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
return getModelConfigForRole ( 'research' , explicitRoot ) . modelId ;
}
function getResearchMaxTokens ( explicitRoot = null ) {
2025-04-21 22:25:04 -04:00
// Directly return value from config
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
return getModelConfigForRole ( 'research' , explicitRoot ) . maxTokens ;
}
function getResearchTemperature ( explicitRoot = null ) {
2025-04-21 22:25:04 -04:00
// Directly return value from config
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
return getModelConfigForRole ( 'research' , explicitRoot ) . temperature ;
2025-04-14 19:50:15 -04:00
}
2025-04-16 00:35:30 -04:00
function getFallbackProvider ( explicitRoot = null ) {
2025-04-21 22:25:04 -04:00
// Directly return value from config (will be undefined if not set)
return getModelConfigForRole ( 'fallback' , explicitRoot ) . provider ;
2025-04-16 00:35:30 -04:00
}
function getFallbackModelId ( explicitRoot = null ) {
2025-04-21 22:25:04 -04:00
// Directly return value from config
return getModelConfigForRole ( 'fallback' , explicitRoot ) . modelId ;
2025-04-16 00:35:30 -04:00
}
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
function getFallbackMaxTokens ( explicitRoot = null ) {
2025-04-21 22:25:04 -04:00
// Directly return value from config
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
return getModelConfigForRole ( 'fallback' , explicitRoot ) . maxTokens ;
}
2025-04-16 00:35:30 -04:00
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
function getFallbackTemperature ( explicitRoot = null ) {
2025-04-21 22:25:04 -04:00
// Directly return value from config
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
return getModelConfigForRole ( 'fallback' , explicitRoot ) . temperature ;
}
2025-04-16 00:35:30 -04:00
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
// --- Global Settings Getters ---
2025-04-14 19:50:15 -04:00
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
function getGlobalConfig ( explicitRoot = null ) {
const config = getConfig ( explicitRoot ) ;
2025-04-21 22:25:04 -04:00
// Ensure global defaults are applied if global section is missing
return { ... DEFAULTS . global , ... ( config ? . global || { } ) } ;
2025-04-14 19:50:15 -04:00
}
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
function getLogLevel ( explicitRoot = null ) {
2025-04-21 22:25:04 -04:00
// Directly return value from config
return getGlobalConfig ( explicitRoot ) . logLevel . toLowerCase ( ) ;
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
}
2025-04-16 00:35:30 -04:00
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
function getDebugFlag ( explicitRoot = null ) {
2025-04-21 22:25:04 -04:00
// Directly return value from config, ensure boolean
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
return getGlobalConfig ( explicitRoot ) . debug === true ;
}
2025-04-16 00:35:30 -04:00
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
function getDefaultSubtasks ( explicitRoot = null ) {
2025-04-21 22:25:04 -04:00
// Directly return value from config, ensure integer
const val = getGlobalConfig ( explicitRoot ) . defaultSubtasks ;
const parsedVal = parseInt ( val , 10 ) ;
return isNaN ( parsedVal ) ? DEFAULTS . global . defaultSubtasks : parsedVal ;
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
}
2025-04-16 00:35:30 -04:00
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
function getDefaultPriority ( explicitRoot = null ) {
2025-04-21 22:25:04 -04:00
// Directly return value from config
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
return getGlobalConfig ( explicitRoot ) . defaultPriority ;
}
2025-04-16 00:35:30 -04:00
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
function getProjectName ( explicitRoot = null ) {
2025-04-21 22:25:04 -04:00
// Directly return value from config
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
return getGlobalConfig ( explicitRoot ) . projectName ;
}
2025-04-14 19:50:15 -04:00
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
function getOllamaBaseUrl ( explicitRoot = null ) {
2025-04-21 22:25:04 -04:00
// Directly return value from config
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
return getGlobalConfig ( explicitRoot ) . ollamaBaseUrl ;
2025-04-14 19:50:15 -04:00
}
2025-04-22 02:42:04 -04:00
/ * *
2025-04-27 03:56:23 -04:00
* Gets model parameters ( maxTokens , temperature ) for a specific role ,
* considering model - specific overrides from supported - models . json .
2025-04-22 02:42:04 -04:00
* @ param { string } role - The role ( 'main' , 'research' , 'fallback' ) .
* @ param { string | null } explicitRoot - Optional explicit path to the project root .
* @ returns { { maxTokens : number , temperature : number } }
* /
function getParametersForRole ( role , explicitRoot = null ) {
const roleConfig = getModelConfigForRole ( role , explicitRoot ) ;
2025-04-27 03:56:23 -04:00
const roleMaxTokens = roleConfig . maxTokens ;
const roleTemperature = roleConfig . temperature ;
const modelId = roleConfig . modelId ;
const providerName = roleConfig . provider ;
let effectiveMaxTokens = roleMaxTokens ; // Start with the role's default
try {
// Find the model definition in MODEL_MAP
const providerModels = MODEL _MAP [ providerName ] ;
if ( providerModels && Array . isArray ( providerModels ) ) {
const modelDefinition = providerModels . find ( ( m ) => m . id === modelId ) ;
// Check if a model-specific max_tokens is defined and valid
if (
modelDefinition &&
typeof modelDefinition . max _tokens === 'number' &&
modelDefinition . max _tokens > 0
) {
const modelSpecificMaxTokens = modelDefinition . max _tokens ;
// Use the minimum of the role default and the model specific limit
effectiveMaxTokens = Math . min ( roleMaxTokens , modelSpecificMaxTokens ) ;
log (
'debug' ,
` Applying model-specific max_tokens ( ${ modelSpecificMaxTokens } ) for ${ modelId } . Effective limit: ${ effectiveMaxTokens } `
) ;
} else {
log (
'debug' ,
` No valid model-specific max_tokens override found for ${ modelId } . Using role default: ${ roleMaxTokens } `
) ;
}
} else {
log (
'debug' ,
` No model definitions found for provider ${ providerName } in MODEL_MAP. Using role default maxTokens: ${ roleMaxTokens } `
) ;
}
} catch ( lookupError ) {
log (
'warn' ,
` Error looking up model-specific max_tokens for ${ modelId } : ${ lookupError . message } . Using role default: ${ roleMaxTokens } `
) ;
// Fallback to role default on error
effectiveMaxTokens = roleMaxTokens ;
}
2025-04-22 02:42:04 -04:00
return {
2025-04-27 03:56:23 -04:00
maxTokens : effectiveMaxTokens ,
temperature : roleTemperature
2025-04-22 02:42:04 -04:00
} ;
}
2025-04-16 00:35:30 -04:00
/ * *
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
* Checks if the API key for a given provider is set in the environment .
* Checks process . env first , then session . env if session is provided .
* @ param { string } providerName - The name of the provider ( e . g . , 'openai' , 'anthropic' ) .
* @ param { object | null } [ session = null ] - The MCP session object ( optional ) .
* @ returns { boolean } True if the API key is set , false otherwise .
2025-04-16 00:35:30 -04:00
* /
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
function isApiKeySet ( providerName , session = null ) {
// Define the expected environment variable name for each provider
2025-04-27 03:56:23 -04:00
if ( providerName ? . toLowerCase ( ) === 'ollama' ) {
return true ; // Indicate key status is effectively "OK"
}
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
const keyMap = {
openai : 'OPENAI_API_KEY' ,
anthropic : 'ANTHROPIC_API_KEY' ,
google : 'GOOGLE_API_KEY' ,
perplexity : 'PERPLEXITY_API_KEY' ,
mistral : 'MISTRAL_API_KEY' ,
2025-04-27 03:56:23 -04:00
azure : 'AZURE_OPENAI_API_KEY' ,
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
openrouter : 'OPENROUTER_API_KEY' ,
2025-04-27 03:56:23 -04:00
xai : 'XAI_API_KEY'
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
// Add other providers as needed
} ;
2025-04-16 00:35:30 -04:00
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
const providerKey = providerName ? . toLowerCase ( ) ;
if ( ! providerKey || ! keyMap [ providerKey ] ) {
log ( 'warn' , ` Unknown provider name: ${ providerName } in isApiKeySet check. ` ) ;
2025-04-14 19:50:15 -04:00
return false ;
}
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
const envVarName = keyMap [ providerKey ] ;
2025-04-27 03:56:23 -04:00
const apiKeyValue = resolveEnvVariable ( envVarName , session ) ;
// Check if the key exists, is not empty, and is not a placeholder
return (
apiKeyValue &&
apiKeyValue . trim ( ) !== '' &&
! /YOUR_.*_API_KEY_HERE/ . test ( apiKeyValue ) && // General placeholder check
! apiKeyValue . includes ( 'KEY_HERE' )
) ; // Another common placeholder pattern
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
}
/ * *
* Checks the API key status within . cursor / mcp . json for a given provider .
* Reads the mcp . json file , finds the taskmaster - ai server config , and checks the relevant env var .
* @ param { string } providerName The name of the provider .
2025-04-27 01:23:18 -04:00
* @ param { string | null } projectRoot - Optional explicit path to the project root .
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
* @ returns { boolean } True if the key exists and is not a placeholder , false otherwise .
* /
2025-04-27 01:23:18 -04:00
function getMcpApiKeyStatus ( providerName , projectRoot = null ) {
const rootDir = projectRoot || findProjectRoot ( ) ; // Use existing root finding
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
if ( ! rootDir ) {
2025-04-16 00:35:30 -04:00
console . warn (
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
chalk . yellow ( 'Warning: Could not find project root to check mcp.json.' )
2025-04-16 00:35:30 -04:00
) ;
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
return false ; // Cannot check without root
2025-04-16 00:35:30 -04:00
}
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
const mcpConfigPath = path . join ( rootDir , '.cursor' , 'mcp.json' ) ;
2025-04-16 00:35:30 -04:00
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
if ( ! fs . existsSync ( mcpConfigPath ) ) {
// console.warn(chalk.yellow('Warning: .cursor/mcp.json not found.'));
return false ; // File doesn't exist
2025-04-16 00:35:30 -04:00
}
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
try {
const mcpConfigRaw = fs . readFileSync ( mcpConfigPath , 'utf-8' ) ;
const mcpConfig = JSON . parse ( mcpConfigRaw ) ;
const mcpEnv = mcpConfig ? . mcpServers ? . [ 'taskmaster-ai' ] ? . env ;
if ( ! mcpEnv ) {
// console.warn(chalk.yellow('Warning: Could not find taskmaster-ai env in mcp.json.'));
return false ; // Structure missing
}
let apiKeyToCheck = null ;
let placeholderValue = null ;
2025-04-16 00:35:30 -04:00
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
switch ( providerName ) {
case 'anthropic' :
apiKeyToCheck = mcpEnv . ANTHROPIC _API _KEY ;
placeholderValue = 'YOUR_ANTHROPIC_API_KEY_HERE' ;
break ;
case 'openai' :
apiKeyToCheck = mcpEnv . OPENAI _API _KEY ;
placeholderValue = 'YOUR_OPENAI_API_KEY_HERE' ; // Assuming placeholder matches OPENAI
break ;
docs: Update documentation for new AI/config architecture and finalize cleanup
This commit updates all relevant documentation (READMEs, docs/*, .cursor/rules) to accurately reflect the finalized unified AI service architecture and the new configuration system (.taskmasterconfig + .env/mcp.json). It also includes the final code cleanup steps related to the refactoring.
Key Changes:
1. **Documentation Updates:**
* Revised `README.md`, `README-task-master.md`, `assets/scripts_README.md`, `docs/configuration.md`, and `docs/tutorial.md` to explain the new configuration split (.taskmasterconfig vs .env/mcp.json).
* Updated MCP configuration examples in READMEs and tutorials to only include API keys in the `env` block.
* Added/updated examples for using the `--research` flag in `docs/command-reference.md`, `docs/examples.md`, and `docs/tutorial.md`.
* Updated `.cursor/rules/ai_services.mdc`, `.cursor/rules/architecture.mdc`, `.cursor/rules/dev_workflow.mdc`, `.cursor/rules/mcp.mdc`, `.cursor/rules/taskmaster.mdc`, `.cursor/rules/utilities.mdc`, and `.cursor/rules/new_features.mdc` to align with the new architecture, removing references to old patterns/files.
* Removed internal rule links from user-facing rules (`taskmaster.mdc`, `dev_workflow.mdc`, `self_improve.mdc`).
* Deleted outdated example file `docs/ai-client-utils-example.md`.
2. **Final Code Refactor & Cleanup:**
* Corrected `update-task-by-id.js` by removing the last import from the old `ai-services.js`.
* Refactored `update-subtask-by-id.js` to correctly use the unified service and logger patterns.
* Removed the obsolete export block from `mcp-server/src/core/task-master-core.js`.
* Corrected logger implementation in `update-tasks.js` for CLI context.
* Updated API key mapping in `config-manager.js` and `ai-services-unified.js`.
3. **Configuration Files:**
* Updated API keys in `.cursor/mcp.json`, replacing `GROK_API_KEY` with `XAI_API_KEY`.
* Updated `.env.example` with current API key names.
* Added `azureOpenaiBaseUrl` to `.taskmasterconfig` example.
4. **Task Management:**
* Marked documentation subtask 61.10 as 'done'.
* Includes various other task content/status updates from the diff summary.
5. **Changeset:**
* Added `.changeset/cuddly-zebras-matter.md` for user-facing `expand`/`expand-all` improvements.
This commit concludes the major architectural refactoring (Task 61) and ensures the documentation accurately reflects the current system.
2025-04-25 14:43:12 -04:00
case 'openrouter' :
apiKeyToCheck = mcpEnv . OPENROUTER _API _KEY ;
placeholderValue = 'YOUR_OPENROUTER_API_KEY_HERE' ;
break ;
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
case 'google' :
apiKeyToCheck = mcpEnv . GOOGLE _API _KEY ;
placeholderValue = 'YOUR_GOOGLE_API_KEY_HERE' ;
break ;
case 'perplexity' :
apiKeyToCheck = mcpEnv . PERPLEXITY _API _KEY ;
placeholderValue = 'YOUR_PERPLEXITY_API_KEY_HERE' ;
break ;
case 'xai' :
docs: Update documentation for new AI/config architecture and finalize cleanup
This commit updates all relevant documentation (READMEs, docs/*, .cursor/rules) to accurately reflect the finalized unified AI service architecture and the new configuration system (.taskmasterconfig + .env/mcp.json). It also includes the final code cleanup steps related to the refactoring.
Key Changes:
1. **Documentation Updates:**
* Revised `README.md`, `README-task-master.md`, `assets/scripts_README.md`, `docs/configuration.md`, and `docs/tutorial.md` to explain the new configuration split (.taskmasterconfig vs .env/mcp.json).
* Updated MCP configuration examples in READMEs and tutorials to only include API keys in the `env` block.
* Added/updated examples for using the `--research` flag in `docs/command-reference.md`, `docs/examples.md`, and `docs/tutorial.md`.
* Updated `.cursor/rules/ai_services.mdc`, `.cursor/rules/architecture.mdc`, `.cursor/rules/dev_workflow.mdc`, `.cursor/rules/mcp.mdc`, `.cursor/rules/taskmaster.mdc`, `.cursor/rules/utilities.mdc`, and `.cursor/rules/new_features.mdc` to align with the new architecture, removing references to old patterns/files.
* Removed internal rule links from user-facing rules (`taskmaster.mdc`, `dev_workflow.mdc`, `self_improve.mdc`).
* Deleted outdated example file `docs/ai-client-utils-example.md`.
2. **Final Code Refactor & Cleanup:**
* Corrected `update-task-by-id.js` by removing the last import from the old `ai-services.js`.
* Refactored `update-subtask-by-id.js` to correctly use the unified service and logger patterns.
* Removed the obsolete export block from `mcp-server/src/core/task-master-core.js`.
* Corrected logger implementation in `update-tasks.js` for CLI context.
* Updated API key mapping in `config-manager.js` and `ai-services-unified.js`.
3. **Configuration Files:**
* Updated API keys in `.cursor/mcp.json`, replacing `GROK_API_KEY` with `XAI_API_KEY`.
* Updated `.env.example` with current API key names.
* Added `azureOpenaiBaseUrl` to `.taskmasterconfig` example.
4. **Task Management:**
* Marked documentation subtask 61.10 as 'done'.
* Includes various other task content/status updates from the diff summary.
5. **Changeset:**
* Added `.changeset/cuddly-zebras-matter.md` for user-facing `expand`/`expand-all` improvements.
This commit concludes the major architectural refactoring (Task 61) and ensures the documentation accurately reflects the current system.
2025-04-25 14:43:12 -04:00
apiKeyToCheck = mcpEnv . XAI _API _KEY ;
placeholderValue = 'YOUR_XAI_API_KEY_HERE' ;
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
break ;
case 'ollama' :
return true ; // No key needed
docs: Update documentation for new AI/config architecture and finalize cleanup
This commit updates all relevant documentation (READMEs, docs/*, .cursor/rules) to accurately reflect the finalized unified AI service architecture and the new configuration system (.taskmasterconfig + .env/mcp.json). It also includes the final code cleanup steps related to the refactoring.
Key Changes:
1. **Documentation Updates:**
* Revised `README.md`, `README-task-master.md`, `assets/scripts_README.md`, `docs/configuration.md`, and `docs/tutorial.md` to explain the new configuration split (.taskmasterconfig vs .env/mcp.json).
* Updated MCP configuration examples in READMEs and tutorials to only include API keys in the `env` block.
* Added/updated examples for using the `--research` flag in `docs/command-reference.md`, `docs/examples.md`, and `docs/tutorial.md`.
* Updated `.cursor/rules/ai_services.mdc`, `.cursor/rules/architecture.mdc`, `.cursor/rules/dev_workflow.mdc`, `.cursor/rules/mcp.mdc`, `.cursor/rules/taskmaster.mdc`, `.cursor/rules/utilities.mdc`, and `.cursor/rules/new_features.mdc` to align with the new architecture, removing references to old patterns/files.
* Removed internal rule links from user-facing rules (`taskmaster.mdc`, `dev_workflow.mdc`, `self_improve.mdc`).
* Deleted outdated example file `docs/ai-client-utils-example.md`.
2. **Final Code Refactor & Cleanup:**
* Corrected `update-task-by-id.js` by removing the last import from the old `ai-services.js`.
* Refactored `update-subtask-by-id.js` to correctly use the unified service and logger patterns.
* Removed the obsolete export block from `mcp-server/src/core/task-master-core.js`.
* Corrected logger implementation in `update-tasks.js` for CLI context.
* Updated API key mapping in `config-manager.js` and `ai-services-unified.js`.
3. **Configuration Files:**
* Updated API keys in `.cursor/mcp.json`, replacing `GROK_API_KEY` with `XAI_API_KEY`.
* Updated `.env.example` with current API key names.
* Added `azureOpenaiBaseUrl` to `.taskmasterconfig` example.
4. **Task Management:**
* Marked documentation subtask 61.10 as 'done'.
* Includes various other task content/status updates from the diff summary.
5. **Changeset:**
* Added `.changeset/cuddly-zebras-matter.md` for user-facing `expand`/`expand-all` improvements.
This commit concludes the major architectural refactoring (Task 61) and ensures the documentation accurately reflects the current system.
2025-04-25 14:43:12 -04:00
case 'mistral' :
apiKeyToCheck = mcpEnv . MISTRAL _API _KEY ;
placeholderValue = 'YOUR_MISTRAL_API_KEY_HERE' ;
break ;
case 'azure' :
apiKeyToCheck = mcpEnv . AZURE _OPENAI _API _KEY ;
placeholderValue = 'YOUR_AZURE_OPENAI_API_KEY_HERE' ;
2025-04-27 14:47:50 -04:00
break ;
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
default :
return false ; // Unknown provider
}
2025-04-27 03:56:23 -04:00
return ! ! apiKeyToCheck && ! /KEY_HERE$/ . test ( apiKeyToCheck ) ;
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
} catch ( error ) {
console . error (
chalk . red ( ` Error reading or parsing .cursor/mcp.json: ${ error . message } ` )
) ;
return false ;
}
2025-04-16 00:35:30 -04:00
}
/ * *
* Gets a list of available models based on the MODEL _MAP .
* @ returns { Array < { id : string , name : string , provider : string , swe _score : number | null , cost _per _1m _tokens : { input : number | null , output : number | null } | null , allowed _roles : string [ ] } > }
* /
function getAvailableModels ( ) {
const available = [ ] ;
for ( const [ provider , models ] of Object . entries ( MODEL _MAP ) ) {
if ( models . length > 0 ) {
models . forEach ( ( modelObj ) => {
// Basic name generation - can be improved
const modelId = modelObj . id ;
const sweScore = modelObj . swe _score ;
const cost = modelObj . cost _per _1m _tokens ;
const allowedRoles = modelObj . allowed _roles || [ 'main' , 'fallback' ] ;
const nameParts = modelId
. split ( '-' )
. map ( ( p ) => p . charAt ( 0 ) . toUpperCase ( ) + p . slice ( 1 ) ) ;
// Handle specific known names better if needed
let name = nameParts . join ( ' ' ) ;
if ( modelId === 'claude-3.5-sonnet-20240620' )
name = 'Claude 3.5 Sonnet' ;
if ( modelId === 'claude-3-7-sonnet-20250219' )
name = 'Claude 3.7 Sonnet' ;
if ( modelId === 'gpt-4o' ) name = 'GPT-4o' ;
if ( modelId === 'gpt-4-turbo' ) name = 'GPT-4 Turbo' ;
if ( modelId === 'sonar-pro' ) name = 'Perplexity Sonar Pro' ;
if ( modelId === 'sonar-mini' ) name = 'Perplexity Sonar Mini' ;
available . push ( {
id : modelId ,
name : name ,
provider : provider ,
swe _score : sweScore ,
cost _per _1m _tokens : cost ,
allowed _roles : allowedRoles
} ) ;
} ) ;
} else {
// For providers with empty lists (like ollama), maybe add a placeholder or skip
available . push ( {
id : ` [ ${ provider } -any] ` ,
name : ` Any ( ${ provider } ) ` ,
provider : provider
} ) ;
}
}
return available ;
}
/ * *
* Writes the configuration object to the file .
* @ param { Object } config The configuration object to write .
* @ param { string | null } explicitRoot - Optional explicit path to the project root .
* @ returns { boolean } True if successful , false otherwise .
* /
function writeConfig ( config , explicitRoot = null ) {
2025-04-30 22:02:02 -04:00
// ---> Determine root path reliably <---
let rootPath = explicitRoot ;
if ( explicitRoot === null || explicitRoot === undefined ) {
// Logic matching _loadAndValidateConfig
const foundRoot = findProjectRoot ( ) ; // *** Explicitly call findProjectRoot ***
if ( ! foundRoot ) {
console . error (
chalk . red (
'Error: Could not determine project root. Configuration not saved.'
)
) ;
return false ;
}
rootPath = foundRoot ;
2025-04-14 19:50:15 -04:00
}
2025-04-30 22:02:02 -04:00
// ---> End determine root path logic <---
2025-04-16 00:35:30 -04:00
const configPath =
path . basename ( rootPath ) === CONFIG _FILE _NAME
? rootPath
: path . join ( rootPath , CONFIG _FILE _NAME ) ;
2025-04-14 19:50:15 -04:00
try {
2025-04-16 00:35:30 -04:00
fs . writeFileSync ( configPath , JSON . stringify ( config , null , 2 ) ) ;
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
loadedConfig = config ; // Update the cache after successful write
2025-04-14 19:50:15 -04:00
return true ;
} catch ( error ) {
console . error (
2025-04-16 00:35:30 -04:00
chalk . red (
` Error writing configuration to ${ configPath } : ${ error . message } `
)
) ;
return false ;
}
}
2025-04-22 16:09:33 -04:00
/ * *
* Checks if the . taskmasterconfig file exists at the project root
* @ param { string | null } explicitRoot - Optional explicit path to the project root
* @ returns { boolean } True if the file exists , false otherwise
* /
function isConfigFilePresent ( explicitRoot = null ) {
2025-04-30 22:02:02 -04:00
// ---> Determine root path reliably <---
let rootPath = explicitRoot ;
if ( explicitRoot === null || explicitRoot === undefined ) {
// Logic matching _loadAndValidateConfig
const foundRoot = findProjectRoot ( ) ; // *** Explicitly call findProjectRoot ***
if ( ! foundRoot ) {
return false ; // Cannot check if root doesn't exist
}
rootPath = foundRoot ;
2025-04-22 16:09:33 -04:00
}
2025-04-30 22:02:02 -04:00
// ---> End determine root path logic <---
2025-04-22 16:09:33 -04:00
const configPath = path . join ( rootPath , CONFIG _FILE _NAME ) ;
return fs . existsSync ( configPath ) ;
}
2025-04-27 03:56:23 -04:00
/ * *
* Gets a list of all provider names defined in the MODEL _MAP .
* @ returns { string [ ] } An array of provider names .
* /
function getAllProviders ( ) {
return Object . keys ( MODEL _MAP || { } ) ;
}
2025-04-14 19:50:15 -04:00
export {
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
// Core config access
2025-04-21 22:25:04 -04:00
getConfig ,
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
writeConfig ,
2025-04-21 22:25:04 -04:00
ConfigurationError , // Export custom error type
2025-04-22 16:09:33 -04:00
isConfigFilePresent , // Add the new function export
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
// Validation
2025-04-14 19:50:15 -04:00
validateProvider ,
validateProviderModelCombination ,
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
VALID _PROVIDERS ,
MODEL _MAP ,
getAvailableModels ,
2025-04-21 22:25:04 -04:00
// Role-specific getters (No env var overrides)
2025-04-14 19:50:15 -04:00
getMainProvider ,
getMainModelId ,
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
getMainMaxTokens ,
getMainTemperature ,
2025-04-14 19:50:15 -04:00
getResearchProvider ,
getResearchModelId ,
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
getResearchMaxTokens ,
getResearchTemperature ,
2025-04-16 00:35:30 -04:00
getFallbackProvider ,
getFallbackModelId ,
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
getFallbackMaxTokens ,
getFallbackTemperature ,
2025-04-21 22:25:04 -04:00
// Global setting getters (No env var overrides)
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
getLogLevel ,
getDebugFlag ,
getDefaultSubtasks ,
getDefaultPriority ,
getProjectName ,
getOllamaBaseUrl ,
2025-04-22 02:42:04 -04:00
getParametersForRole ,
feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35.
2025-04-20 01:09:30 -04:00
// API Key Checkers (still relevant)
isApiKeySet ,
2025-04-27 03:56:23 -04:00
getMcpApiKeyStatus ,
// ADD: Function to get all provider names
getAllProviders
2025-04-14 19:50:15 -04:00
} ;