@hhsw2015/task-master-ai 0.43.13 → 0.43.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-services-unified-BImUXDJx.js +1 -0
- package/dist/ai-services-unified-DHz7C__S.js +7 -0
- package/dist/{commands-Dz0lboMw.js → commands-CihjssvR.js} +25 -25
- package/dist/config-manager-DWjTTpDf.js +1 -0
- package/dist/config-manager-DofXOeM1.js +273 -0
- package/dist/{dependency-manager-CvhwFgTc.js → dependency-manager-CLIfRcBA.js} +176 -104
- package/dist/mcp-server.js +3 -3
- package/dist/{profiles-7bbMp9Tz.js → profiles-B1UFupgI.js} +2 -2
- package/dist/research-DPPDWpmB.js +1 -0
- package/dist/response-language-Dll9UAYo.js +1 -0
- package/dist/{response-language-DpiGaJZK.js → response-language-Sn-WtY_I.js} +1 -1
- package/dist/{sentry-DP3nr70b.js → sentry-RGpmJbg4.js} +1 -1
- package/dist/tag-management-Dt_M130x.js +1 -0
- package/dist/{task-manager-H0H_vNIg.js → task-manager-BpjUWPiJ.js} +1 -1
- package/dist/task-master.js +1 -1
- package/dist/update-subtask-by-id-DdOI7HgG.js +1 -0
- package/dist/update-task-by-id-Cqbnf0ZF.js +1 -0
- package/dist/{utils-CEHCzNvD.js → utils-BZ8Kv4nm.js} +1 -1
- package/package.json +1 -1
- package/dist/ai-services-unified-BPC7geqj.js +0 -1
- package/dist/ai-services-unified-DRuFwL_e.js +0 -7
- package/dist/config-manager-ClruewMP.js +0 -273
- package/dist/config-manager-DbOMSXgZ.js +0 -1
- package/dist/research-Dk2DpbPy.js +0 -1
- package/dist/response-language-DOZ-CzdZ.js +0 -1
- package/dist/tag-management-CFQqYS7R.js +0 -1
- package/dist/update-subtask-by-id-r9mGhUE1.js +0 -1
- package/dist/update-task-by-id-B9n9vQcI.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"./ai-services-unified-DHz7C__S.js";import"./config-manager-DofXOeM1.js";import"./git-utils-DllbRE35.js";import"./sentry-RGpmJbg4.js";export{i as generateObjectService,n as generateTextService,r as logAiUsage,t as streamObjectService,e as streamTextService};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{C as e,E as t,Et as n,F as r,H as i,I as a,J as o,L as s,M as c,N as l,O as u,P as d,a as f,f as p,ht as m,j as h,l as g,m as _,o as ee,s as te,ut as v,v as y,w as b,x,y as S,yt as C}from"./config-manager-DofXOeM1.js";import{n as w,t as T}from"./sentry-RGpmJbg4.js";import{createRequire as E}from"node:module";import D,{promises as O}from"fs";import k,{join as A}from"path";import{homedir as j}from"os";import{execSync as M,spawn as N}from"child_process";import*as P from"ai";import{jsonrepair as F}from"jsonrepair";import{EnvHttpProxyAgent as I}from"undici";import{createAnthropic as ne}from"@ai-sdk/anthropic";import{createPerplexity as re}from"@ai-sdk/perplexity";import{createGoogleGenerativeAI as ie}from"@ai-sdk/google";import{createOpenAI as ae}from"@ai-sdk/openai";import{createXai as oe}from"@ai-sdk/xai";import{createGroq as se}from"@ai-sdk/groq";import{createOpenRouter as ce}from"@openrouter/ai-sdk-provider";import{createOllama as le}from"ollama-ai-provider-v2";import{createAmazonBedrock as ue}from"@ai-sdk/amazon-bedrock";import{fromNodeProviderChain as de}from"@aws-sdk/credential-providers";import{createAzure as fe}from"@ai-sdk/azure";import{createVertex as pe}from"@ai-sdk/google-vertex";import{createClaudeCode as me}from"ai-sdk-provider-claude-code";import{createGeminiProvider as he}from"ai-sdk-provider-gemini-cli";import{APICallError as L,LoadAPIKeyError as ge,NoSuchModelError as R}from"@ai-sdk/provider";import{generateId as z}from"@ai-sdk/provider-utils";import{parse as _e}from"jsonc-parser";import{createCodexCli as ve}from"ai-sdk-provider-codex-cli";import{createOpenAICompatible as ye}from"@ai-sdk/openai-compatible";var be=Object.defineProperty,xe=e=>{let t={};for(var n in e)be(t,n,{get:e[n],enumerable:!0});return t},B=E(import.meta.url);let V=null;var H=class e{constructor(){this._providers=new Map,this._initialized=!1}static getInstance(){return V||=new e,V}initialize(){return this._initialized||=!0,this}registerProvider(e,t,n={}){if(!e||typeof e!=`string`)throw Error(`Provider name must be a non-empty string`);if(!t)throw Error(`Provider instance is required`);if(typeof t.generateText!=`function`||typeof t.streamText!=`function`||typeof t.generateObject!=`function`)throw Error(`Provider must implement BaseAIProvider interface`);return this._providers.set(e,{instance:t,options:n,registeredAt:new Date}),this}hasProvider(e){return this._providers.has(e)}getProvider(e){let t=this._providers.get(e);return t?t.instance:null}getAllProviders(){return new Map(this._providers)}unregisterProvider(e){return this._providers.has(e)?(this._providers.delete(e),!0):!1}reset(){this._providers.clear(),this._initialized=!1}};H.getInstance().initialize();var U=H;const{JSONParseError:Se,NoObjectGeneratedError:Ce,generateObject:we,generateText:Te,streamObject:Ee,streamText:De,zodSchema:Oe}=P,W=P.jsonSchema,ke=new Set([`minimum`,`maximum`,`exclusiveMinimum`,`exclusiveMaximum`]),Ae=[`additionalProperties`,`contains`,`if`,`then`,`else`,`not`,`propertyNames`],je=[`allOf`,`anyOf`,`oneOf`,`prefixItems`],Me=[`definitions`,`$defs`,`dependentSchemas`,`patternProperties`,`properties`],Ne=e=>e?Array.isArray(e)?e.includes(`integer`):e===`integer`:!1,G=e=>{if(!e||typeof e!=`object`)return e;if(Array.isArray(e))return e.map(G);let t={...e};if(Ne(t.type))for(let e of ke)e in t&&delete t[e];for(let e of Ae)t[e]&&(t[e]=G(t[e]));for(let e of je)Array.isArray(t[e])&&(t[e]=t[e].map(G));for(let e of Me)if(t[e]&&typeof t[e]==`object`){let n={};for(let[r,i]of Object.entries(t[e]))n[r]=G(i);t[e]=n}return t.items&&=G(t.items),t},K=e=>{if(!e||typeof e!=`object`)return e;if(Array.isArray(e))return e.map(K);let t={};for(let[n,r]of Object.entries(e))t[n]=K(r);let n=t.type===`object`,r=t.properties&&typeof t.properties==`object`&&!Array.isArray(t.properties),i=Object.prototype.hasOwnProperty.call(t,`additionalProperties`),a=r?Object.keys(t.properties):[],o=Array.isArray(t.required),s=o?new Set(t.required):new Set,c=o&&a.every(e=>s.has(e))&&t.required.length===a.length;return n&&r&&!i&&(t.additionalProperties=!1),n&&r&&!c&&(t.required=a),t},q=e=>{let t=Oe(e);if(!t||typeof t!=`object`||!t.jsonSchema)return t;let n=K(G(t.jsonSchema));return typeof W==`function`?W(n,{validate:t.validate}):{...t,jsonSchema:n}};var J=class e{constructor(){if(this.constructor===e)throw Error(`BaseAIProvider cannot be instantiated directly`);this.name=this.constructor.name,this._proxyAgent=null,this.needsExplicitJsonSchema=!1,this.supportsTemperature=!0}validateAuth(e){if(!e.apiKey)throw Error(`${this.name} API key is required`)}createProxyFetch(){this._projectRoot||=v();let e=this._projectRoot;if(i(null,e))return this._proxyAgent||=new I,(e,t={})=>fetch(e,{...t,dispatcher:this._proxyAgent})}validateParams(e){if(this.validateAuth(e),!e.modelId)throw Error(`${this.name} Model ID is required`);this.validateOptionalParams(e)}validateOptionalParams(e){if(e.temperature!==void 0&&(e.temperature<0||e.temperature>1))throw Error(`Temperature must be between 0 and 1`);if(e.maxTokens!==void 0){let t=Number(e.maxTokens);if(!Number.isFinite(t)||t<=0)throw Error(`maxTokens must be a finite number greater than 0`)}}validateMessages(e){if(!e||!Array.isArray(e)||e.length===0)throw Error(`Invalid or empty messages array provided`);for(let t of e)if(!t.role||!t.content)throw Error(`Invalid message format. Each message must have role and content`)}handleError(e,t){let n=t.message||`Unknown error occurred`;throw C(`error`,`${this.name} ${e} failed: ${n}`,{error:t}),Error(`${this.name} API error during ${e}: ${n}`)}getClient(e){throw Error(`getClient must be implemented by provider`)}isRequiredApiKey(){return!0}getRequiredApiKeyName(){throw Error(`getRequiredApiKeyName must be implemented by provider`)}prepareTokenParam(e,t){return t===void 0?{}:{maxOutputTokens:Math.floor(Number(t))}}async generateText(e){try{this.validateParams(e),this.validateMessages(e.messages),C(`debug`,`Generating ${this.name} text with model: ${e.modelId}`);let t=await this.getClient(e),n=e.commandName||`unknown`,r=T(`${this.name}.${e.modelId}.${n}.generateText`,{command:n,outputType:e.outputType,tag:e.tag,projectHash:w(e.projectRoot),userId:e.userId,briefId:e.briefId}),i=await Te({model:t(e.modelId),messages:e.messages,...this.prepareTokenParam(e.modelId,e.maxTokens),...this.supportsTemperature&&e.temperature!==void 0?{temperature:e.temperature}:{},...r&&{experimental_telemetry:r}});C(`debug`,`${this.name} generateText completed successfully for model: ${e.modelId}`);let a=i.usage?.inputTokens??i.usage?.promptTokens??0,o=i.usage?.outputTokens??i.usage?.completionTokens??0,s=i.usage?.totalTokens??a+o;return{text:i.text,usage:{inputTokens:a,outputTokens:o,totalTokens:s}}}catch(e){this.handleError(`text generation`,e)}}async streamText(e){try{this.validateParams(e),this.validateMessages(e.messages),C(`debug`,`Streaming ${this.name} text with model: ${e.modelId}`);let t=await this.getClient(e),n=e.commandName||`unknown`,r=T(`${this.name}.${e.modelId}.${n}.streamText`,{command:n,outputType:e.outputType,tag:e.tag,projectHash:w(e.projectRoot),userId:e.userId,briefId:e.briefId}),i=await De({model:t(e.modelId),messages:e.messages,...this.prepareTokenParam(e.modelId,e.maxTokens),...this.supportsTemperature&&e.temperature!==void 0?{temperature:e.temperature}:{},...r&&{experimental_telemetry:r},...e.experimental_transform&&{experimental_transform:e.experimental_transform}});return C(`debug`,`${this.name} streamText initiated successfully for model: ${e.modelId}`),i}catch(e){this.handleError(`text streaming`,e)}}async streamObject(e){try{if(this.validateParams(e),this.validateMessages(e.messages),!e.schema)throw Error(`Schema is required for object streaming`);C(`debug`,`Streaming ${this.name} object with model: ${e.modelId}`);let t=await this.getClient(e),n=e.commandName||`unknown`,r=T(`${this.name}.${e.modelId}.${n}.streamObject`,{command:n,outputType:e.outputType,tag:e.tag,projectHash:w(e.projectRoot),userId:e.userId,briefId:e.briefId}),i=q(e.schema),a=await Ee({model:t(e.modelId),messages:e.messages,schema:i,mode:e.mode||`auto`,maxOutputTokens:e.maxTokens,...this.supportsTemperature&&e.temperature!==void 0?{temperature:e.temperature}:{},...r&&{experimental_telemetry:r}});return C(`debug`,`${this.name} streamObject initiated successfully for model: ${e.modelId}`),a}catch(e){this.handleError(`object streaming`,e)}}async generateObject(e){try{if(this.validateParams(e),this.validateMessages(e.messages),!e.schema)throw Error(`Schema is required for object generation`);if(!e.objectName)throw Error(`Object name is required for object generation`);C(`debug`,`Generating ${this.name} object ('${e.objectName}') with model: ${e.modelId}`);let t=await this.getClient(e),n=e.commandName||`unknown`,r=T(`${this.name}.${e.modelId}.${n}.generateObject.${e.objectName}`,{command:n,outputType:e.outputType,tag:e.tag,projectHash:w(e.projectRoot),userId:e.userId,briefId:e.briefId}),i=q(e.schema),a=await we({model:t(e.modelId),messages:e.messages,schema:i,mode:this.needsExplicitJsonSchema?`json`:`auto`,schemaName:e.objectName,schemaDescription:`Generate a valid JSON object for ${e.objectName}`,maxTokens:e.maxTokens,...this.supportsTemperature&&e.temperature!==void 0?{temperature:e.temperature}:{},...r&&{experimental_telemetry:r}});C(`debug`,`${this.name} generateObject completed successfully for model: ${e.modelId}`);let o=a.usage?.inputTokens??a.usage?.promptTokens??0,s=a.usage?.outputTokens??a.usage?.completionTokens??0,c=a.usage?.totalTokens??o+s;return{object:a.object,usage:{inputTokens:o,outputTokens:s,totalTokens:c}}}catch(e){if(Ce.isInstance(e)&&e.cause instanceof Se&&e.cause.text){C(`warn`,`${this.name} generated malformed JSON, attempting to repair...`);try{let t=F(e.cause.text),n=JSON.parse(t);return C(`info`,`Successfully repaired ${this.name} JSON output`),{object:n,usage:{inputTokens:e.usage?.promptTokens||e.usage?.inputTokens||0,outputTokens:e.usage?.completionTokens||e.usage?.outputTokens||0,totalTokens:e.usage?.totalTokens||0}}}catch(e){C(`error`,`Failed to repair ${this.name} JSON: ${e.message}`)}}this.handleError(`object generation`,e)}}},Pe=class extends J{constructor(){super(),this.name=`Anthropic`}getRequiredApiKeyName(){return`ANTHROPIC_API_KEY`}getClient(e){try{let{apiKey:t,baseURL:n}=e,r=this.createProxyFetch();return ne({apiKey:t,...n&&{baseURL:n},headers:{"anthropic-beta":`output-128k-2025-02-19`},...r&&{fetch:r}})}catch(e){this.handleError(`client initialization`,e)}}},Fe=class extends J{constructor(){super(),this.name=`Perplexity`}getRequiredApiKeyName(){return`PERPLEXITY_API_KEY`}getClient(e){try{let{apiKey:t,baseURL:n}=e,r=this.createProxyFetch();return re({apiKey:t,baseURL:n||`https://api.perplexity.ai`,...r&&{fetch:r}})}catch(e){this.handleError(`client initialization`,e)}}async generateObject(e){return super.generateObject({...e,mode:`json`})}},Ie=class extends J{constructor(){super(),this.name=`Google`}getRequiredApiKeyName(){return`GOOGLE_API_KEY`}getClient(e){try{let{apiKey:t,baseURL:n}=e,r=this.createProxyFetch();return ie({apiKey:t,...n&&{baseURL:n},...r&&{fetch:r}})}catch(e){this.handleError(`client initialization`,e)}}},Le=class extends J{constructor(){super(),this.name=`OpenAI`}getRequiredApiKeyName(){return`OPENAI_API_KEY`}getClient(e){try{let{apiKey:t,baseURL:n}=e,r=this.createProxyFetch();return ae({apiKey:t,...n&&{baseURL:n},...r&&{fetch:r}})}catch(e){this.handleError(`client initialization`,e)}}},Re=class extends J{constructor(){super(),this.name=`xAI`}getRequiredApiKeyName(){return`XAI_API_KEY`}getClient(e){try{let{apiKey:t,baseURL:n}=e;return oe({apiKey:t,baseURL:n||`https://api.x.ai/v1`})}catch(e){this.handleError(`client initialization`,e)}}},ze=class extends J{constructor(){super(),this.name=`Groq`}getRequiredApiKeyName(){return`GROQ_API_KEY`}getClient(e){try{let{apiKey:t,baseURL:n}=e;return se({apiKey:t,...n&&{baseURL:n}})}catch(e){this.handleError(`client initialization`,e)}}},Be=class extends J{constructor(){super(),this.name=`OpenRouter`}getRequiredApiKeyName(){return`OPENROUTER_API_KEY`}getClient(e){try{let{apiKey:t,baseURL:n}=e;return ce({apiKey:t,...n&&{baseURL:n}})}catch(e){this.handleError(`client initialization`,e)}}},Ve=class extends J{constructor(){super(),this.name=`Ollama`}validateAuth(e){}getClient(e){try{let{baseURL:t}=e;return le({...t&&{baseURL:t}})}catch(e){this.handleError(`client initialization`,e)}}isRequiredApiKey(){return!1}getRequiredApiKeyName(){return`OLLAMA_API_KEY`}},He=class extends J{constructor(){super(),this.name=`Bedrock`}isRequiredApiKey(){return!1}getRequiredApiKeyName(){return`AWS_ACCESS_KEY_ID`}validateAuth(e){}getClient(e){try{let e=de(),t=this.createProxyFetch();return ue({credentialProvider:e,...t&&{fetch:t}})}catch(e){this.handleError(`client initialization`,e)}}},Ue=class extends J{constructor(){super(),this.name=`Azure OpenAI`}getRequiredApiKeyName(){return`AZURE_OPENAI_API_KEY`}validateAuth(e){if(!e.apiKey)throw Error(`Azure API key is required`);if(!e.baseURL)throw Error(`Azure endpoint URL is required. Set it in .taskmasterconfig global.azureBaseURL or models.[role].baseURL`)}normalizeBaseURL(e){if(!e)return e;try{let t=new URL(e),n=t.pathname.replace(/\/+$/,``);return n.endsWith(`/openai`)||(n=`${n}/openai`),t.pathname=n,t.toString()}catch{let t=e.replace(/\/+$/,``);return t.endsWith(`/openai`)?t:`${t}/openai`}}getClient(e){try{let{apiKey:t,baseURL:n}=e,r=this.normalizeBaseURL(n),i=this.createProxyFetch();return fe({apiKey:t,baseURL:r,...i&&{fetch:i}})}catch(e){this.handleError(`client initialization`,e)}}},Y=class extends Error{constructor(e){super(e),this.name=`VertexAuthError`,this.code=`vertex_auth_error`}},X=class extends Error{constructor(e){super(e),this.name=`VertexConfigError`,this.code=`vertex_config_error`}},We=class extends Error{constructor(e,t){super(e),this.name=`VertexApiError`,this.code=`vertex_api_error`,this.statusCode=t}},Ge=class extends J{constructor(){super(),this.name=`Google Vertex AI`}getRequiredApiKeyName(){return`GOOGLE_API_KEY`}isRequiredApiKey(){return!1}isAuthenticationRequired(){return!0}isValidCredential(e){return e?typeof e==`string`?e.trim().length>0:typeof e==`object`:!1}validateAuth(e){let{apiKey:t,projectId:n,location:r,credentials:i}=e,a=this.isValidCredential(t),o=this.isValidCredential(i);if(!a&&!o)throw new Y(`Vertex AI requires authentication. Provide one of the following:
|
|
2
|
+
• GOOGLE_API_KEY environment variable (typical for API-based auth), OR
|
|
3
|
+
• GOOGLE_APPLICATION_CREDENTIALS pointing to a service account JSON file (recommended for production)`);if(!n||typeof n==`string`&&n.trim().length===0)throw new X(`Google Cloud project ID is required for Vertex AI. Set VERTEX_PROJECT_ID environment variable.`);if(!r||typeof r==`string`&&r.trim().length===0)throw new X(`Google Cloud location is required for Vertex AI. Set VERTEX_LOCATION environment variable (e.g., "us-central1").`)}getClient(e){try{let{apiKey:t,projectId:n,location:r,credentials:i,baseURL:a}=e,o=this.createProxyFetch(),s={};return t?s.googleAuthOptions={...i,apiKey:t}:i&&(s.googleAuthOptions=i),pe({...s,project:n,location:r,...a&&{baseURL:a},...o&&{fetch:o}})}catch(e){this.handleError(`client initialization`,e)}}handleError(e,t){if(C(`error`,`Vertex AI ${e} error:`,t),t.name===`VertexAuthError`||t.name===`VertexConfigError`||t.name===`VertexApiError`)throw t;if(t.response){let e=t.response.status,n=t.response.data?.error?.message||t.message;throw e===401||e===403?new Y(`Authentication failed: ${n}`):e===400?new X(`Invalid request: ${n}`):new We(`API error (${e}): ${n}`,e)}throw Error(`Vertex AI ${e} failed: ${t.message}`)}};let Ke=!1;var qe=class extends J{constructor(){super(),this.name=`Claude Code`,this.supportedModels=d(`claude-code`),this.supportedModels.length===0&&C(`warn`,`No supported models found for claude-code provider. Check supported-models.json configuration.`),this.needsExplicitJsonSchema=!0,this.supportsTemperature=!1}getRequiredApiKeyName(){return`CLAUDE_CODE_API_KEY`}isRequiredApiKey(){return!1}validateAuth(e){if(process.env.NODE_ENV!==`test`&&!Ke&&!process.env.CLAUDE_CODE_OAUTH_TOKEN)try{M(`claude --version`,{stdio:`pipe`,timeout:1e3})}catch{C(`warn`,`Claude Code CLI not detected. Install it with: npm install -g @anthropic-ai/claude-code`)}finally{Ke=!0}}getClient(e={}){try{let t=g(e.commandName)||{},n=process.env.ANTHROPIC_API_KEY,r=process.env.CLAUDE_CODE_API_KEY;try{return r?process.env.ANTHROPIC_API_KEY=r:n&&delete process.env.ANTHROPIC_API_KEY,me({defaultSettings:{systemPrompt:{type:`preset`,preset:`claude_code`},settingSources:[`user`,`project`,`local`],...t}})}finally{n?process.env.ANTHROPIC_API_KEY=n:delete process.env.ANTHROPIC_API_KEY}}catch(e){let t=String(e?.message||``);if(e?.code===`ENOENT`||/claude/i.test(t)){let t=Error(`Claude Code CLI not available. Please install Claude Code CLI first. Original error: ${e.message}`);t.cause=e,this.handleError(`Claude Code CLI initialization`,t)}else this.handleError(`client initialization`,e)}}getSupportedModels(){return this.supportedModels}isModelSupported(e){return e?this.supportedModels.includes(String(e).toLowerCase()):!1}},Je=class extends J{constructor(){super(),this.name=`Gemini CLI`,this.supportsTemperature=!1}validateAuth(e){}async getClient(e){try{let t={};return t=e.apiKey&&e.apiKey!==`gemini-cli-no-key-required`?{authType:`api-key`,apiKey:e.apiKey}:{authType:`oauth-personal`},e.baseURL&&(t.baseURL=e.baseURL),he(t)}catch(e){this.handleError(`client initialization`,e)}}getRequiredApiKeyName(){return`GEMINI_API_KEY`}isRequiredApiKey(){return!1}};function Z({message:e,code:t,exitCode:n,stderr:r,stdout:i,promptExcerpt:a,isRetryable:o=!1}){return new L({message:e,isRetryable:o,url:`grok-cli://command`,requestBodyValues:a?{prompt:a}:void 0,data:{code:t,exitCode:n,stderr:r,stdout:i,promptExcerpt:a}})}function Ye({message:e}){return new ge({message:e||`Authentication failed. Please ensure Grok CLI is properly configured with API key.`})}function Xe({message:e,promptExcerpt:t,timeoutMs:n}){return new L({message:e,isRetryable:!0,url:`grok-cli://command`,requestBodyValues:t?{prompt:t}:void 0,data:{code:`TIMEOUT`,promptExcerpt:t,timeoutMs:n}})}function Ze({message:e}){return new L({message:e||`Grok CLI is not installed or not found in PATH. Please install with: npm install -g @vibe-kit/grok-cli`,isRetryable:!1,url:`grok-cli://installation`,requestBodyValues:void 0})}function Qe(e){let t=e.trim(),n=/```(?:json)?\s*([\s\S]*?)\s*```/i.exec(t);n&&(t=n[1]);let r=/^\s*(?:const|let|var)\s+\w+\s*=\s*([\s\S]*)/i.exec(t);r&&(t=r[1],t.trim().endsWith(`;`)&&(t=t.trim().slice(0,-1)));let i=t.indexOf(`{`),a=t.indexOf(`[`);if(i===-1&&a===-1)return e;let o=a===-1?i:i===-1?a:Math.min(i,a);t=t.slice(o);let s=e=>{let t=[];try{let n=_e(e,t,{allowTrailingComma:!0});if(t.length===0)return JSON.stringify(n,null,2)}catch{}},c=s(t);if(c!==void 0)return c;let l=t[0],u=l===`{`?`}`:`]`,d=[],f=0,p=!1,m=!1;for(let e=0;e<t.length;e++){let n=t[e];if(m){m=!1;continue}if(n===`\\`){m=!0;continue}if(n===`"`&&!p){p=!0;continue}if(n===`"`&&p){p=!1;continue}p||(n===l?f++:n===u&&(f--,f===0&&d.push(e+1)))}for(let e=d.length-1;e>=0;e--){let n=s(t.slice(0,d[e]));if(n!==void 0)return n}let h=Math.max(0,t.length-1e3);for(let e=t.length-1;e>h;e--){let n=s(t.slice(0,e));if(n!==void 0)return n}return e}function $e(e){return e.map(e=>{let t=``;return typeof e.content==`string`?t=e.content:Array.isArray(e.content)?t=e.content.filter(e=>e.type===`text`).map(e=>e.text||``).join(`
|
|
4
|
+
`):e.content&&typeof e.content==`object`&&(t=e.content.text||JSON.stringify(e.content)),{role:e.role,content:t.trim()}})}function et(e){try{let t=e.trim().split(`
|
|
5
|
+
`).filter(e=>e.trim()),n=[];for(let e of t)try{let t=JSON.parse(e);n.push(t)}catch{continue}let r=n.filter(e=>e.role===`assistant`).pop();return r&&r.content?{text:r.content,usage:r.usage?{promptTokens:r.usage.prompt_tokens||0,completionTokens:r.usage.completion_tokens||0,totalTokens:r.usage.total_tokens||0}:void 0}:{text:e.trim(),usage:void 0}}catch{return{text:e.trim(),usage:void 0}}}function tt(e){return $e(e).map(e=>{switch(e.role){case`system`:return`System: ${e.content}`;case`user`:return`User: ${e.content}`;case`assistant`:return`Assistant: ${e.content}`;default:return`${e.role}: ${e.content}`}}).join(`
|
|
6
|
+
|
|
7
|
+
`)}function nt(e){return typeof e!=`string`&&(e=String(e)),`'`+e.replace(/'/g,`'\\''`)+`'`}var rt=class{specificationVersion=`v2`;defaultObjectGenerationMode=`json`;supportsImageUrls=!1;supportsStructuredOutputs=!1;supportedUrls={};modelId;settings;constructor(e){if(this.modelId=e.id,this.settings=e.settings??{},!this.modelId||typeof this.modelId!=`string`||this.modelId.trim()===``)throw new R({modelId:this.modelId,modelType:`languageModel`})}get provider(){return`grok-cli`}async checkGrokCliInstallation(){return new Promise(e=>{let t=N(`grok`,[`--version`],{stdio:`pipe`});t.on(`error`,()=>e(!1)),t.on(`exit`,t=>e(t===0))})}async getApiKey(){if(this.settings.apiKey)return this.settings.apiKey;if(process.env.GROK_CLI_API_KEY)return process.env.GROK_CLI_API_KEY;try{let e=A(j(),`.grok`,`user-settings.json`),t=await O.readFile(e,`utf8`);return JSON.parse(t).apiKey||null}catch{return null}}async executeGrokCli(e,t={}){let n=12e4;this.modelId.includes(`grok-4`)&&(n=6e5);let r=t.timeout??this.settings.timeout??n;return new Promise((n,i)=>{let a=N(`grok`,e,{stdio:`pipe`,cwd:this.settings.workingDirectory||process.cwd(),env:t.apiKey===void 0?process.env:{...process.env,GROK_CLI_API_KEY:t.apiKey}}),o=``,s=``,c;r>0&&(c=setTimeout(()=>{a.kill(`SIGTERM`),i(Xe({message:`Grok CLI command timed out after ${r}ms`,timeoutMs:r,promptExcerpt:e.join(` `).substring(0,200)}))},r)),a.stdout?.on(`data`,e=>{let t=e.toString();o+=t}),a.stderr?.on(`data`,e=>{let t=e.toString();s+=t}),a.on(`error`,e=>{c&&clearTimeout(c),e.code===`ENOENT`?i(Ze({})):i(Z({message:`Failed to execute Grok CLI: ${e.message}`,code:e.code,stderr:e.message,isRetryable:!1}))}),a.on(`exit`,e=>{c&&clearTimeout(c),n({stdout:o.trim(),stderr:s.trim(),exitCode:e||0})})})}generateAllWarnings(e,t){let n=[],r=[];if(e.temperature!==void 0&&r.push(`temperature`),e.topP!==void 0&&r.push(`topP`),e.topK!==void 0&&r.push(`topK`),e.presencePenalty!==void 0&&r.push(`presencePenalty`),e.frequencyPenalty!==void 0&&r.push(`frequencyPenalty`),e.stopSequences!==void 0&&e.stopSequences.length>0&&r.push(`stopSequences`),e.seed!==void 0&&r.push(`seed`),r.length>0)for(let e of r)n.push({type:`unsupported-setting`,setting:e,details:`Grok CLI does not support the ${e} parameter. It will be ignored.`});return(!this.modelId||this.modelId.trim()===``)&&n.push({type:`other`,message:`Model ID is empty or invalid`}),(!t||t.trim()===``)&&n.push({type:`other`,message:`Prompt is empty`}),n}async doGenerate(e){if(e.abortSignal?.aborted)throw e.abortSignal.reason||Error(`Request aborted`);if(!await this.checkGrokCliInstallation())throw Ze({});let t=await this.getApiKey();if(!t)throw Ye({message:`Grok CLI API key not found. Set GROK_CLI_API_KEY environment variable or configure grok-cli.`});let n=tt(e.prompt),r=this.generateAllWarnings(e,n),i=[`--prompt`,nt(n)];this.modelId&&this.modelId!==`default`&&i.push(`--model`,this.modelId),this.settings.baseURL&&i.push(`--base-url`,this.settings.baseURL),this.settings.workingDirectory&&i.push(`--directory`,this.settings.workingDirectory);try{let a=await this.executeGrokCli(i,{apiKey:t});if(a.exitCode!==0)throw a.stderr.toLowerCase().includes(`unauthorized`)||a.stderr.toLowerCase().includes(`authentication`)?Ye({message:`Grok CLI authentication failed: ${a.stderr}`}):Z({message:`Grok CLI failed with exit code ${a.exitCode}: ${a.stderr||`Unknown error`}`,exitCode:a.exitCode,stderr:a.stderr,stdout:a.stdout,promptExcerpt:n.substring(0,200),isRetryable:!1});let o=et(a.stdout),s=o.text||``;return(e=>!!e&&typeof e==`object`&&`mode`in e&&e.mode?.type===`object-json`)(e)&&s&&(s=Qe(s)),{content:[{type:`text`,text:s||``}],usage:o.usage?{inputTokens:o.usage.promptTokens,outputTokens:o.usage.completionTokens,totalTokens:o.usage.totalTokens}:{inputTokens:0,outputTokens:0,totalTokens:0},finishReason:`stop`,rawCall:{rawPrompt:n,rawSettings:i},warnings:r,response:{id:z(),timestamp:new Date,modelId:this.modelId},request:{body:n},providerMetadata:{"grok-cli":{exitCode:a.exitCode,...a.stderr&&{stderr:a.stderr}}}}}catch(e){throw e.name===`APICallError`||e.name===`LoadAPIKeyError`?e:Z({message:`Grok CLI execution failed: ${e.message}`,code:e.code,promptExcerpt:n.substring(0,200),isRetryable:!1})}}async doStream(e){let t=tt(e.prompt),n=this.generateAllWarnings(e,t);return{stream:new ReadableStream({start:async t=>{let r;try{if(e.abortSignal?.aborted)throw e.abortSignal.reason||Error(`Request aborted`);e.abortSignal&&(r=()=>{t.enqueue({type:`error`,error:e.abortSignal?.reason||Error(`Request aborted`)}),t.close()},e.abortSignal.addEventListener(`abort`,r,{once:!0})),t.enqueue({type:`stream-start`,warnings:n});let i=await this.doGenerate(e);t.enqueue({type:`response-metadata`,id:i.response.id,timestamp:i.response.timestamp,modelId:i.response.modelId});let a=i.content||[],o=a.length>0&&a[0].type===`text`?a[0].text:``,s;o.length>0&&(s=z(),t.enqueue({type:`text-start`,id:s}));for(let n=0;n<o.length;n+=50){if(e.abortSignal?.aborted)throw e.abortSignal.reason||Error(`Request aborted`);let r=o.slice(n,n+50);t.enqueue({type:`text-delta`,id:s,delta:r}),await new Promise(e=>setTimeout(e,20))}s&&t.enqueue({type:`text-end`,id:s}),t.enqueue({type:`finish`,finishReason:i.finishReason,usage:i.usage,providerMetadata:i.providerMetadata}),t.close()}catch(e){t.enqueue({type:`error`,error:e}),t.close()}finally{e.abortSignal&&r&&e.abortSignal.removeEventListener(`abort`,r)}},cancel:()=>{}}),request:{body:t}}}};function it(e={}){let t=(t,n={})=>new rt({id:t,settings:{...e.defaultSettings,...n}}),n=function(e,n){if(new.target)throw Error(`The Grok CLI model function cannot be called with the new keyword.`);return t(e,n)};return n.languageModel=t,n.chat=t,n.textEmbeddingModel=e=>{throw new R({modelId:e,modelType:`textEmbeddingModel`})},n.imageModel=e=>{throw new R({modelId:e,modelType:`imageModel`})},n}it();var at=class extends J{constructor(){super(),this.name=`Grok CLI`,this.needsExplicitJsonSchema=!0,this.supportsTemperature=!1}getRequiredApiKeyName(){return`GROK_CLI_API_KEY`}isRequiredApiKey(){return!1}validateAuth(e){}getClient(e){try{let{apiKey:t,baseURL:n,workingDirectory:r,timeout:i,commandName:a}=e,o=x(a);return it({defaultSettings:{apiKey:t,baseURL:n,workingDirectory:r||o.workingDirectory,timeout:i||o.timeout,defaultModel:o.defaultModel}})}catch(e){this.handleError(`client initialization`,e)}}};const ot={"gpt-5.1":[`none`,`low`,`medium`,`high`],"gpt-5.1-codex-max":[`none`,`low`,`medium`,`high`,`xhigh`],"gpt-5.2":[`none`,`low`,`medium`,`high`,`xhigh`],"gpt-5.3-codex":[`none`,`low`,`medium`,`high`,`xhigh`],"gpt-5.2-pro":[`medium`,`high`,`xhigh`],"gpt-5":[`none`,`low`,`medium`,`high`,`xhigh`]},st=[`none`,`low`,`medium`,`high`],ct=[`none`,`low`,`medium`,`high`,`xhigh`];var lt=class extends J{constructor(){super(),this.name=`Codex CLI`,this.needsExplicitJsonSchema=!1,this.supportsTemperature=!1,this.supportedModels=d(`codex-cli`),this.supportedModels.length===0&&C(`warn`,`No supported models found for codex-cli provider. Check supported-models.json configuration.`),this._codexCliChecked=!1,this._codexCliAvailable=null,this._preferredCodexPath=null}isRequiredApiKey(){return!1}getRequiredApiKeyName(){return`OPENAI_CODEX_API_KEY`}validateAuth(){if(process.env.NODE_ENV!==`test`&&!this._codexCliChecked)try{M(`codex --version`,{stdio:`pipe`,timeout:1e3}),this._codexCliAvailable=!0,this._preferredCodexPath=this._detectSystemCodexPath()}catch{this._codexCliAvailable=!1,this._preferredCodexPath=null,C(`warn`,`Codex CLI not detected. Install with: npm i -g @openai/codex or enable fallback with allowNpx.`)}finally{this._codexCliChecked=!0}}_detectSystemCodexPath(){try{let e=M(`npm root -g`,{stdio:[`ignore`,`pipe`,`ignore`],timeout:1e3}).toString().trim(),t=k.join(e,`@openai`,`codex`,`bin`,`codex.js`);if(D.existsSync(t))return t}catch{}try{let e=M(`command -v codex`,{stdio:[`ignore`,`pipe`,`ignore`],timeout:1e3}).toString().trim();if(e.endsWith(`.js`)&&D.existsSync(e))return e}catch{}return null}_resolveExecutableSettings(e){if(e?.codexPath)return e;if(this._codexCliChecked||this.validateAuth(),this._codexCliAvailable){let t=this._preferredCodexPath||this._detectSystemCodexPath();if(t)return this._preferredCodexPath=t,{...e,codexPath:t}}return e}_getValidatedReasoningEffort(e,t){let n=ot[e]||st,r=n.reduce((e,t)=>ct.indexOf(t)>ct.indexOf(e)?t:e,n[0]);return t?n.includes(t)?t:(C(`warn`,`Reasoning effort '${t}' not supported by ${e}. Using '${r}' instead.`),r):(C(`debug`,`No reasoning effort specified for ${e}. Using '${r}'.`),r)}getClient(e={}){try{let t=p(e.commandName)||{},n=this._resolveExecutableSettings(t),r=this._getValidatedReasoningEffort(e.modelId,n.reasoningEffort);return ve({defaultSettings:{...n,reasoningEffort:r,...e.apiKey?{env:{...n.env||{},OPENAI_API_KEY:e.apiKey}}:{}}})}catch(e){let t=String(e?.message||``);if(e?.code===`ENOENT`||/codex/i.test(t)){let t=Error(`Codex CLI not available. Please install Codex CLI first. Original error: ${e.message}`);t.cause=e,this.handleError(`Codex CLI initialization`,t)}else this.handleError(`client initialization`,e)}}},Q=class extends J{constructor(e){if(super(),!e.name)throw Error(`Provider name is required`);if(!e.apiKeyEnvVar)throw Error(`API key environment variable name is required`);this.name=e.name,this.apiKeyEnvVar=e.apiKeyEnvVar,this.requiresApiKey=e.requiresApiKey!==!1,this.defaultBaseURL=e.defaultBaseURL,this.getBaseURLFromParams=e.getBaseURL,this.supportsStructuredOutputs=e.supportsStructuredOutputs}getRequiredApiKeyName(){return this.apiKeyEnvVar}isRequiredApiKey(){return this.requiresApiKey}validateAuth(e){if(this.requiresApiKey&&!e.apiKey)throw Error(`${this.name} API key is required`)}getBaseURL(e){return e.baseURL?e.baseURL:this.getBaseURLFromParams?this.getBaseURLFromParams(e):this.defaultBaseURL}getClient(e){try{let{apiKey:t}=e,n=this.createProxyFetch(),r=this.getBaseURL(e),i={name:this.name.toLowerCase().replace(/[^a-z0-9]/g,`-`)};return this.requiresApiKey&&t&&(i.apiKey=t),r&&(i.baseURL=r),this.supportsStructuredOutputs!==void 0&&(i.supportsStructuredOutputs=this.supportsStructuredOutputs),n&&(i.fetch=n),ye(i)}catch(e){this.handleError(`client initialization`,e)}}},ut=class extends Q{constructor(){super({name:`Z.ai`,apiKeyEnvVar:`ZAI_API_KEY`,requiresApiKey:!0,defaultBaseURL:`https://api.z.ai/api/paas/v4/`,supportsStructuredOutputs:!0})}prepareTokenParam(){return{}}findArrayPropertyInSchema(e){try{let t=e._zod.def;if(!(t?.type===`object`||t?.typeName===`ZodObject`))return null;let n=t.shape;if(typeof n==`function`&&(n=n()),!n||typeof n!=`object`)return null;for(let[e,t]of Object.entries(n)){let n=t._zod.def;if(n?.type===`array`||n?.typeName===`ZodArray`)return e}return null}catch(e){return console.warn(`Failed to introspect Zod schema:`,e.message),null}}async generateObject(e){let t=await super.generateObject(e);if(Array.isArray(t.object)){let n=this.findArrayPropertyInSchema(e.schema);return n?{...t,object:{[n]:t.object}}:(console.warn(`GLM returned a bare array for '${e.objectName}' but could not determine wrapper property from schema. Using objectName as fallback.`),{...t,object:{[e.objectName]:t.object}})}return t}},dt=class extends ut{constructor(){super(),this.name=`Z.ai (Coding Plan)`,this.defaultBaseURL=`https://api.z.ai/api/coding/paas/v4/`}},ft=class extends Q{constructor(){super({name:`LM Studio`,apiKeyEnvVar:`LMSTUDIO_API_KEY`,requiresApiKey:!1,defaultBaseURL:`http://localhost:1234/v1`,supportsStructuredOutputs:!0})}};const pt={anthropic:new Pe,perplexity:new Fe,google:new Ie,zai:new ut,"zai-coding":new dt,lmstudio:new ft,openai:new Le,xai:new Re,groq:new ze,openrouter:new Be,ollama:new Ve,"openai-compatible":new Q({name:`OpenAI Compatible`,apiKeyEnvVar:`OPENAI_COMPATIBLE_API_KEY`,requiresApiKey:!0}),bedrock:new He,azure:new Ue,vertex:new Ge,"claude-code":new qe,"codex-cli":new lt,"gemini-cli":new Je,"grok-cli":new at};function mt(e){if(pt[e])return pt[e];let t=U.getInstance();return t.hasProvider(e)?(C(`debug`,`Provider "${e}" found in dynamic registry`),t.getProvider(e)):null}function ht(e,t){let n={inputCost:0,outputCost:0,currency:`USD`,isUnknown:!1};if(!o||!o[e])return C(`warn`,`Provider "${e}" not found in MODEL_MAP. Cannot determine cost for model ${t}.`),{...n,isUnknown:!0};let r=o[e].find(e=>e.id===t);if(!r)return C(`debug`,`Model "${t}" not found under provider "${e}". Assuming unknown cost.`),{...n,isUnknown:!0};if(r.cost_per_1m_tokens===null)return C(`debug`,`Cost data is null for model "${t}" under provider "${e}". Pricing unknown.`),{...n,isUnknown:!0};if(r.cost_per_1m_tokens===void 0)return C(`debug`,`Cost data not found for model "${t}" under provider "${e}". Pricing unknown.`),{...n,isUnknown:!0};let i=r.cost_per_1m_tokens;return{inputCost:i.input||0,outputCost:i.output||0,currency:i.currency||`USD`,isUnknown:!1}}function gt(e,t,n,r){let i=(e||0)/1e6*n+(t||0)/1e6*r;return parseFloat(i.toFixed(6))}function _t(e){let t={currentTag:`master`,availableTags:[`master`]};try{return e?{currentTag:m(e)||`master`,availableTags:vt(e)}:t}catch(e){return _()&&C(`debug`,`Error getting tag information: ${e.message}`),t}}function vt(e){let t=[`master`];try{let n=B(`path`),r=B(`fs`),i=n.join(e,`.taskmaster`,`tasks`,`tasks.json`);if(!r.existsSync(i))return t;let a=JSON.parse(r.readFileSync(i,`utf8`));if(!a||typeof a!=`object`)return t;let o=Object.keys(a).filter(e=>yt(a[e]));return o.length>0?o:t}catch(e){return _()&&C(`debug`,`Could not read tasks file for available tags: ${e.message}`),t}}function yt(e){return e&&typeof e==`object`&&Array.isArray(e.tasks)}function bt(e){let t=e.message?.toLowerCase()||``;return t.includes(`rate limit`)||t.includes(`overloaded`)||t.includes(`service temporarily unavailable`)||t.includes(`timeout`)||t.includes(`network error`)||e.status===429||e.status>=500}function xt(e){try{if(e?.data?.error?.message)return e.data.error.message;if(e?.error?.message)return e.error.message;if(typeof e?.responseBody==`string`)try{let t=JSON.parse(e.responseBody);if(t?.error?.message)return t.error.message}catch{}return typeof e?.message==`string`&&e.message?e.message:typeof e==`string`?e:`An unknown AI service error occurred.`}catch{return`Failed to extract error message.`}}function St(t,n){return{main:{provider:b(n),modelId:e(n)},research:{provider:c(n),modelId:h(n)},fallback:{provider:S(n),modelId:y(n)}}[t]||null}function Ct(e,t){let r=s(e)||n(`VERTEX_PROJECT_ID`,t,e),i=a(e)||n(`VERTEX_LOCATION`,t,e)||`us-central1`,o=n(`GOOGLE_APPLICATION_CREDENTIALS`,t,e);C(`debug`,`Using Vertex AI configuration: Project ID=${r}, Location=${i}`);let c=o?{keyFile:o}:void 0;return{projectId:r,location:i,...c&&{credentials:c}}}function wt(e,t,r=null){let i=mt(e);if(!i)throw Error(`Unknown provider '${e}' for API key resolution.`);let a=i.getRequiredApiKeyName();if(a===null)return null;let o=n(a,t,r);if(!i.isRequiredApiKey())return o||null;if(!o)throw Error(`Required API key ${a} for provider '${e}' is not set in environment, session, or .env file.`);return o}async function Tt(e,t,n,r,i,a){let o=0,s=t;for(;o<=2;)try{_()&&C(`info`,`Attempt ${o+1}/3 calling ${s} (Provider: ${r}, Model: ${i}, Role: ${a})`);let c=await e[t](n);return _()&&C(`info`,`${s} succeeded for role ${a} (Provider: ${r}) on attempt ${o+1}`),c}catch(e){if(C(`warn`,`Attempt ${o+1} failed for role ${a} (${s} / ${r}): ${e.message}`),bt(e)&&o<2){o++;let e=1e3*2**(o-1);C(`info`,`Something went wrong on the provider side. Retrying in ${e/1e3}s...`),await new Promise(t=>setTimeout(t,e))}else throw C(`error`,`Something went wrong on the provider side. Max retries reached for role ${a} (${s} / ${r}).`),e}throw Error(`Exhausted all retries for role ${a} (${s} / ${r})`)}async function $(e,n){let{role:i,session:a,projectRoot:o,systemPrompt:s,prompt:c,schema:d,objectName:p,commandName:m,outputType:h,experimental_transform:g,...y}=n;_()&&C(`info`,`${e}Service called`,{role:i,commandName:m,outputType:h,projectRoot:o});let b=o||v(),x=r(b),S=a?.user?.id||a?.userId,w=a?.context?.briefId||a?.briefId,T;i===`main`?T=[`main`,`fallback`,`research`]:i===`research`?T=[`research`,`fallback`,`main`]:i===`fallback`?T=[`fallback`,`main`,`research`]:(C(`warn`,`Unknown initial role: ${i}. Defaulting to main -> fallback -> research sequence.`),T=[`main`,`fallback`,`research`]);let E=null,D=`AI service call failed for all configured roles.`;for(let n of T){let r,i,_,v,T,O,k,A=null;try{C(`debug`,`New AI service call with role: ${n}`);let D=St(n,b);if(!D){C(`error`,`Unknown role encountered in _unifiedServiceRunner: ${n}`),E||=Error(`Unknown AI role specified: ${n}`);continue}if(r=D.provider,i=D.modelId,!r||!i){C(`warn`,`Skipping role '${n}': Provider or Model ID not configured.`),E||=Error(`Configuration missing for role '${n}'. Provider: ${r}, Model: ${i}`);continue}if(T=mt(r?.toLowerCase()),!T){C(`warn`,`Skipping role '${n}': Provider '${r}' not supported.`),E||=Error(`Unsupported provider configured: ${r}`);continue}O=ee(n,b),r?.toLowerCase()===`azure`&&!O?(O=f(b),C(`debug`,`Using global Azure base URL: ${O}`)):r?.toLowerCase()===`ollama`&&!O?(O=t(b),C(`debug`,`Using global Ollama base URL: ${O}`)):r?.toLowerCase()===`bedrock`&&!O&&(O=te(b),C(`debug`,`Using global Bedrock base URL: ${O}`)),v=u(n,b),_=wt(r?.toLowerCase(),a,b);let j={};r?.toLowerCase()===`vertex`&&(j=Ct(b,a));let M=[],N=`${s} \n\n Always respond in ${l(b)}.`;if(M.push({role:`system`,content:N.trim()}),c)M.push({role:`user`,content:c});else throw Error(`User prompt content is missing.`);let P={apiKey:_,modelId:i,maxTokens:v.maxTokens,temperature:v.temperature,messages:M,...O&&{baseURL:O},...(e===`generateObject`||e===`streamObject`)&&{schema:d,objectName:p},...m&&{commandName:m},...h&&{outputType:h},...o&&{projectRoot:o},...S&&{userId:S},...w&&{briefId:w},...g&&{experimental_transform:g},...j,...y};if(k=await Tt(T,e,P,r,i,n),x&&k&&k.usage)try{A=await At({userId:x,commandName:m,providerName:r,modelId:i,inputTokens:k.usage.inputTokens,outputTokens:k.usage.outputTokens,outputType:h})}catch{}else x&&k&&!k.usage&&C(`warn`,`Cannot log telemetry for ${m} (${r}/${i}): AI result missing 'usage' data. (May be expected for streams)`);let F;e===`generateText`?F=k.text:e===`generateObject`?F=k.object:(e===`streamText`||e===`streamObject`||C(`error`,`Unknown serviceType in _unifiedServiceRunner: ${e}`),F=k);let I=_t(b);return{mainResult:F,telemetryData:A,tagInfo:I,providerName:r,modelId:i}}catch(t){let a=xt(t);if(C(`error`,`Service call failed for role ${n} (Provider: ${r||`unknown`}, Model: ${i||`unknown`}): ${a}`),E=t,D=a,e===`generateObject`){let e=a.toLowerCase();if(e.includes(`no endpoints found that support tool use`)||e.includes(`does not support tool_use`)||e.includes(`tool use is not supported`)||e.includes(`tools are not supported`)||e.includes(`function calling is not supported`)||e.includes(`tool use is not supported`)){let e=`Model '${i||`unknown`}' via provider '${r||`unknown`}' does not support the 'tool use' required by generateObjectService. Please configure a model that supports tool/function calling for the '${n}' role, or use generateTextService if structured output is not strictly required.`;throw C(`error`,`[Tool Support Error] ${e}`),Error(e)}}}}throw C(`error`,`All roles in the sequence [${T.join(`, `)}] failed.`),Error(D)}async function Et(e){return $(`generateText`,{outputType:`cli`,...e})}async function Dt(e){return $(`streamText`,{outputType:`cli`,...e})}async function Ot(e){let t={outputType:`cli`,...e};if(!t.schema)throw Error(`streamObjectService requires a schema parameter`);return $(`streamObject`,t)}async function kt(e){return $(`generateObject`,{objectName:`generated_object`,maxRetries:3,outputType:`cli`,...e})}async function At({userId:e,commandName:t,providerName:n,modelId:r,inputTokens:i,outputTokens:a,outputType:o}){try{let o=new Date().toISOString(),s=(i||0)+(a||0),{inputCost:c,outputCost:l,currency:u,isUnknown:d}=ht(n,r),f=gt(i,a,c,l),p={timestamp:o,userId:e,commandName:t,modelUsed:r,providerName:n,inputTokens:i||0,outputTokens:a||0,totalTokens:s,totalCost:f,currency:u,isUnknownCost:d};return _()&&C(`info`,`AI Usage Telemetry:`,p),p}catch(e){return C(`error`,`Failed to log AI usage telemetry: ${e.message}`,{error:e}),null}}export{Dt as a,xe as c,Ot as i,B as l,Et as n,J as o,At as r,U as s,kt as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./ai-services-unified-
|
|
1
|
+
import"./ai-services-unified-DHz7C__S.js";import{B as e,Bt as t,D as n,Ht as r,Kt as i,Lt as a,Nt as o,On as s,Q as c,Rt as l,Tt as u,U as d,Ut as f,Vt as p,dt as m,h,hn as g,ln as ee,m as _,mn as te,p as v,t as y,ut as ne,yt as b,z as x}from"./config-manager-DofXOeM1.js";import"./git-utils-DllbRE35.js";import"./sentry-RGpmJbg4.js";import{$ as S,C,D as w,F as T,I as E,J as re,L as ie,M as ae,N as oe,O as se,P as ce,Q as le,S as ue,St as de,X as D,Y as fe,Z as pe,_ as me,_t as he,a as ge,at as O,b as _e,bt as ve,c as ye,ct as be,d as k,dt as xe,et as A,f as Se,g as Ce,h as we,ht as Te,i as Ee,it as De,j as Oe,k as j,l as ke,m as Ae,n as je,nt as Me,o as Ne,ot as Pe,p as M,r as Fe,rt as Ie,s as Le,st as Re,t as ze,tt as Be,u as Ve,ut as He,v as N,vt as Ue,w as We,wt as Ge,xt as Ke,y as qe,yt as Je}from"./dependency-manager-CLIfRcBA.js";import{t as Ye}from"./response-language-Sn-WtY_I.js";import{_ as Xe,a as Ze,c as Qe,d as $e,f as et,g as tt,h as nt,i as rt,l as P,m as it,n as at,o as F,p as ot,r as st,s as I,t as L,u as R,v as z}from"./profiles-B1UFupgI.js";import B from"chalk";import V from"fs";import H from"path";import U from"boxen";import{Command as ct}from"commander";import W from"inquirer";const G={AUTHENTICATION:`authentication`,VALIDATION:`validation`,NETWORK:`network`,API:`api`,FILE_SYSTEM:`file_system`,TASK:`task`,PERMISSION:`permission`,TIMEOUT:`timeout`,GENERIC:`generic`},lt=[/\b[A-Za-z0-9_-]{20,}\b/g,/sk-[A-Za-z0-9]{32,}/g,/api[_-]?key[:\s=]+[^\s]+/gi,/bearer\s+[^\s]+/gi,/token[:\s=]+[^\s]+/gi,/\/Users\/[^/]+/g,/C:\\Users\\[^\\]+/g,/\/home\/[^/]+/g,/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,/https?:\/\/[^:]+:[^@]+@/g];function K(e){if(!e||typeof e!=`string`)return e;let t=e;for(let e of lt)t=t.replace(e,`***REDACTED***`);return t}function ut(e){if(!e)return G.GENERIC;let t=(e.message||``).toLowerCase(),n=(e.code||``).toLowerCase();return t.includes(`auth`)||t.includes(`unauthorized`)||t.includes(`forbidden`)||t.includes(`api key`)||t.includes(`token`)||n.includes(`auth`)?G.AUTHENTICATION:t.includes(`invalid`)||t.includes(`validation`)||t.includes(`required`)||t.includes(`must be`)||n.includes(`validation`)?G.VALIDATION:t.includes(`network`)||t.includes(`connection`)||t.includes(`econnrefused`)||t.includes(`enotfound`)||n.includes(`network`)||n.includes(`econnrefused`)||n.includes(`enotfound`)?G.NETWORK:t.includes(`timeout`)||t.includes(`timed out`)||n.includes(`timeout`)?G.TIMEOUT:t.includes(`api`)||t.includes(`rate limit`)||t.includes(`quota`)||n.includes(`api`)?G.API:t.includes(`enoent`)||t.includes(`eacces`)||t.includes(`file`)||t.includes(`directory`)||n.includes(`enoent`)||n.includes(`eacces`)?G.FILE_SYSTEM:t.includes(`permission`)||t.includes(`access denied`)||n.includes(`eperm`)?G.PERMISSION:t.includes(`task`)||t.includes(`subtask`)?G.TASK:G.GENERIC}function dt(e,t,n){let r=[],i=(t.message||``).toLowerCase();switch(e){case G.AUTHENTICATION:i.includes(`api key`)?(r.push(`Check that your API key is correctly set in the .env file`),r.push(`Verify the API key has not expired or been revoked`)):i.includes(`token`)?(r.push(`Your authentication token may have expired`),r.push(`Try running: tm auth refresh`)):(r.push(`Verify your credentials are correctly configured`),r.push(`Check the authentication status with: tm auth status`));break;case G.VALIDATION:i.includes(`brief id`)?(r.push(`Brief IDs are case-insensitive (e.g., "ham32" = "HAM-32")`),r.push(`Check the brief ID format: usually LETTERS-NUMBERS`)):i.includes(`task id`)||i.includes(`invalid id`)?(r.push(`Task IDs should be numbers (e.g., 1, 2, 3)`),r.push(`Subtask IDs use dot notation (e.g., 1.1, 2.3)`)):(r.push(`Check that all required parameters are provided`),r.push(`Verify parameter values match expected formats`));break;case G.NETWORK:i.includes(`econnrefused`)?(r.push(`Could not connect to the server`),r.push(`Check your internet connection`),r.push(`Verify the API endpoint URL is correct`)):i.includes(`enotfound`)?(r.push(`Could not resolve the server hostname`),r.push(`Check your internet connection`)):(r.push(`Check your network connection`),r.push(`Verify firewall settings are not blocking the request`));break;case G.TIMEOUT:r.push(`The operation took too long to complete`),r.push(`Try again with a simpler request`),r.push(`Check your network speed and stability`);break;case G.API:i.includes(`rate limit`)?(r.push(`You have exceeded the API rate limit`),r.push(`Wait a few minutes before trying again`)):i.includes(`quota`)?(r.push(`You have reached your API quota`),r.push(`Check your account usage and limits`)):(r.push(`The API returned an error`),r.push(`Try again in a few moments`));break;case G.FILE_SYSTEM:i.includes(`enoent`)?(r.push(`The specified file or directory does not exist`),r.push(`Check the file path and ensure it is correct`),n.includes(`tasks.json`)&&r.push(`Initialize the project with: tm init`)):i.includes(`eacces`)?(r.push(`Permission denied to access the file`),r.push(`Check file permissions or run with appropriate privileges`)):r.push(`Check that the file or directory exists and is accessible`);break;case G.PERMISSION:r.push(`You do not have permission to perform this operation`),r.push(`Check file/directory permissions`),r.push(`You may need elevated privileges (sudo)`);break;case G.TASK:i.includes(`not found`)?(r.push(`The specified task does not exist`),r.push(`Use: tm list to see all available tasks`)):i.includes(`dependency`)||i.includes(`circular`)?(r.push(`Task dependencies form a circular reference`),r.push(`Use: tm validate-dependencies to identify issues`)):(r.push(`Check that the task ID is correct`),r.push(`Use: tm show <id> to view task details`));break;default:r.push(`Check the error message for specific details`),n&&r.push(`Operation failed while: ${n}`)}return r.slice(0,2)}function ft(e,t={}){let{context:n=``,debug:r=!1,command:i=``}=t;typeof e==`string`&&(e=Error(e)),(!e||typeof e!=`object`)&&(e=Error(`An unknown error occurred`));let a=K(e.message||`Unknown error`),o=ut(e),s=dt(o,e,n);return{type:o,message:a,context:n||`Unknown operation`,hints:s,command:i||null,code:e.code||null,stack:r?K(e.stack):null}}function q(e,t={}){let n=ft(e,t),r=B.red.bold(`✗ Error
|
|
2
2
|
|
|
3
3
|
`);r+=B.white(n.message)+`
|
|
4
4
|
|
|
@@ -12,7 +12,7 @@ import"./ai-services-unified-DRuFwL_e.js";import{B as e,Bt as t,E as n,Ht as r,K
|
|
|
12
12
|
`+U(r.trim(),{padding:{top:1,bottom:1,left:2,right:2},borderStyle:`round`,borderColor:`red`})+`
|
|
13
13
|
`),t.debug&&n.stack&&(console.log(B.gray(`Stack Trace:`)),console.log(B.dim(n.stack)),console.log())}function pt(e,t=`Info`){let n=B.blue.bold(`ℹ ${t}\n\n`);n+=B.white(e),console.log(`
|
|
14
14
|
`+U(n.trim(),{padding:{top:1,bottom:1,left:2,right:2},borderStyle:`round`,borderColor:`blue`})+`
|
|
15
|
-
`)}var mt=class{#e;#t;constructor(e,t){this.#e=Object.freeze({...e}),this.#t=t}getProjectRoot(){return this.#e.projectRoot}getTaskMasterDir(){return this.#e.taskMasterDir}getTasksPath(){return this.#e.tasksPath}getPrdPath(){return this.#e.prdPath}getComplexityReportPath(){if(this.#e.complexityReportPath)return this.#e.complexityReportPath;let e=this.getCurrentTag()===`master`?o:o.replace(`.json`,`_${this.getCurrentTag()}.json`);return H.join(this.#e.projectRoot,e)}getConfigPath(){return this.#e.configPath}getStatePath(){return this.#e.statePath}getAllPaths(){return this.#e}getCurrentTag(){if(this.#t)return this.#t;try{if(V.existsSync(this.#e.statePath)){let e=V.readFileSync(this.#e.statePath,`utf8`),t=JSON.parse(e);if(t&&t.currentTag)return t.currentTag}}catch{}try{if(V.existsSync(this.#e.configPath)){let e=V.readFileSync(this.#e.configPath,`utf8`),t=JSON.parse(e);if(t&&t.global&&t.global.defaultTag)return t.global.defaultTag}}catch{}return`master`}};function J(e={}){let n=(e,t,n=[],r=null,i=!1)=>{if(typeof t==`string`){let n=H.isAbsolute(t)?t:H.resolve(r||process.cwd(),t);if(i){let t=H.dirname(n);if(!V.existsSync(t))try{V.mkdirSync(t,{recursive:!0})}catch(n){throw Error(`Could not create directory for ${e}: ${t}. Error: ${n.message}`)}}else if(!V.existsSync(n))throw Error(`${e} override path does not exist: ${n}`);return n}if(t===!0){for(let e of n){let t=H.isAbsolute(e)?e:H.join(r||process.cwd(),e);if(V.existsSync(t))return t}throw Error(`Required ${e} not found. Searched: ${n.join(`, `)}`)}for(let e of n){let t=H.isAbsolute(e)?e:H.join(r||process.cwd(),e);if(V.existsSync(t))return t}return null},o={};if(e.projectRoot){let t=H.resolve(e.projectRoot);if(!V.existsSync(t))throw Error(`Project root override path does not exist: ${t}`);let n=V.existsSync(H.join(t,
|
|
15
|
+
`)}var mt=class{#e;#t;constructor(e,t){this.#e=Object.freeze({...e}),this.#t=t}getProjectRoot(){return this.#e.projectRoot}getTaskMasterDir(){return this.#e.taskMasterDir}getTasksPath(){return this.#e.tasksPath}getPrdPath(){return this.#e.prdPath}getComplexityReportPath(){if(this.#e.complexityReportPath)return this.#e.complexityReportPath;let e=this.getCurrentTag()===`master`?o:o.replace(`.json`,`_${this.getCurrentTag()}.json`);return H.join(this.#e.projectRoot,e)}getConfigPath(){return this.#e.configPath}getStatePath(){return this.#e.statePath}getAllPaths(){return this.#e}getCurrentTag(){if(this.#t)return this.#t;try{if(V.existsSync(this.#e.statePath)){let e=V.readFileSync(this.#e.statePath,`utf8`),t=JSON.parse(e);if(t&&t.currentTag)return t.currentTag}}catch{}try{if(V.existsSync(this.#e.configPath)){let e=V.readFileSync(this.#e.configPath,`utf8`),t=JSON.parse(e);if(t&&t.global&&t.global.defaultTag)return t.global.defaultTag}}catch{}return`master`}};function J(e={}){let n=(e,t,n=[],r=null,i=!1)=>{if(typeof t==`string`){let n=H.isAbsolute(t)?t:H.resolve(r||process.cwd(),t);if(i){let t=H.dirname(n);if(!V.existsSync(t))try{V.mkdirSync(t,{recursive:!0})}catch(n){throw Error(`Could not create directory for ${e}: ${t}. Error: ${n.message}`)}}else if(!V.existsSync(n))throw Error(`${e} override path does not exist: ${n}`);return n}if(t===!0){for(let e of n){let t=H.isAbsolute(e)?e:H.join(r||process.cwd(),e);if(V.existsSync(t))return t}throw Error(`Required ${e} not found. Searched: ${n.join(`, `)}`)}for(let e of n){let t=H.isAbsolute(e)?e:H.join(r||process.cwd(),e);if(V.existsSync(t))return t}return null},o={};if(e.projectRoot){let t=H.resolve(e.projectRoot);if(!V.existsSync(t))throw Error(`Project root override path does not exist: ${t}`);let n=V.existsSync(H.join(t,p)),r=V.existsSync(H.join(t,a));if(!n&&!r)throw Error(`Project root override is not a valid taskmaster project: ${t}`);o.projectRoot=t}else o.projectRoot=c();return`taskMasterDir`in e?o.taskMasterDir=n(`taskmaster directory`,e.taskMasterDir,[p],o.projectRoot):o.taskMasterDir=n(`taskmaster directory`,!1,[p],o.projectRoot),o.configPath=H.join(o.projectRoot,t),o.statePath=H.join(o.taskMasterDir||H.join(o.projectRoot,p),`state.json`),o.tasksPath=H.join(o.projectRoot,i),`configPath`in e&&(o.configPath=n(`config file`,e.configPath,[t,a],o.projectRoot)),`statePath`in e&&(o.statePath=n(`state file`,e.statePath,[`state.json`],o.taskMasterDir)),`tasksPath`in e&&(o.tasksPath=n(`tasks file`,e.tasksPath,[i,l],o.projectRoot)),`prdPath`in e&&(o.prdPath=n(`PRD file`,e.prdPath,[H.join(r,`PRD.md`),H.join(r,`prd.md`),H.join(r,`PRD.txt`),H.join(r,`prd.txt`),H.join(`scripts`,`PRD.md`),H.join(`scripts`,`prd.md`),H.join(`scripts`,`PRD.txt`),H.join(`scripts`,`prd.txt`),`PRD.md`,`prd.md`,`PRD.txt`,`prd.txt`],o.projectRoot)),`complexityReportPath`in e&&(o.complexityReportPath=n(`complexity report`,e.complexityReportPath,[H.join(f,`task-complexity-report.json`),H.join(f,`complexity-report.json`),H.join(`scripts`,`task-complexity-report.json`),H.join(`scripts`,`complexity-report.json`),`task-complexity-report.json`,`complexity-report.json`],o.projectRoot,!0)),new mt(o,e.tag)}async function ht(e){let t=e.map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(`, `);console.log(U(B.yellow(`WARNING: This will selectively remove Task Master components for: ${t}.
|
|
16
16
|
|
|
17
17
|
What will be removed:
|
|
18
18
|
• Task Master specific rule files (e.g., cursor_rules.mdc, taskmaster.mdc, etc.)
|
|
@@ -28,7 +28,7 @@ The .[profile] directory will only be removed if ALL of the following are true:
|
|
|
28
28
|
• No other files or folders exist in the profile directory
|
|
29
29
|
• The MCP configuration was completely removed (no other servers)
|
|
30
30
|
|
|
31
|
-
Are you sure you want to proceed?`),{padding:1,borderColor:`yellow`,borderStyle:`round`}));let{confirm:n}=await(await import(`inquirer`)).default.prompt([{type:`confirm`,name:`confirm`,message:`Type y to confirm selective removal, or n to abort:`,default:!1}]);return n}async function gt(e,t){let n=e.map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(`, `);console.log(U(B.red.bold(`⚠️ CRITICAL WARNING: REMOVING ALL TASK MASTER RULE PROFILES ⚠️\n\nYou are about to remove Task Master components for: ${n}\nThis will leave your project with NO Task Master rule profiles remaining!\n\nWhat will be removed:\n• All Task Master specific rule files\n• Task Master MCP server configurations\n• Profile directories (only if completely empty after removal)\n\nWhat will be preserved:\n• Your existing custom rule files\n• Other MCP server configurations\n• Profile directories with custom content\n\nThis could impact Task Master functionality but will preserve your custom configurations.\n\nAre you absolutely sure you want to proceed?`),{padding:1,borderColor:`red`,borderStyle:`double`,title:`🚨 CRITICAL OPERATION`,titleAlignment:`center`}));let{confirm:r}=await(await import(`inquirer`)).default.prompt([{type:`confirm`,name:`confirm`,message:`Type y to confirm removing ALL Task Master rule profiles, or n to abort:`,default:!1}]);return r}function Y(){try{let e=
|
|
31
|
+
Are you sure you want to proceed?`),{padding:1,borderColor:`yellow`,borderStyle:`round`}));let{confirm:n}=await(await import(`inquirer`)).default.prompt([{type:`confirm`,name:`confirm`,message:`Type y to confirm selective removal, or n to abort:`,default:!1}]);return n}async function gt(e,t){let n=e.map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(`, `);console.log(U(B.red.bold(`⚠️ CRITICAL WARNING: REMOVING ALL TASK MASTER RULE PROFILES ⚠️\n\nYou are about to remove Task Master components for: ${n}\nThis will leave your project with NO Task Master rule profiles remaining!\n\nWhat will be removed:\n• All Task Master specific rule files\n• Task Master MCP server configurations\n• Profile directories (only if completely empty after removal)\n\nWhat will be preserved:\n• Your existing custom rule files\n• Other MCP server configurations\n• Profile directories with custom content\n\nThis could impact Task Master functionality but will preserve your custom configurations.\n\nAre you absolutely sure you want to proceed?`),{padding:1,borderColor:`red`,borderStyle:`double`,title:`🚨 CRITICAL OPERATION`,titleAlignment:`center`}));let{confirm:r}=await(await import(`inquirer`)).default.prompt([{type:`confirm`,name:`confirm`,message:`Type y to confirm removing ALL Task Master rule profiles, or n to abort:`,default:!1}]);return r}function Y(){try{let e=g.getInstance().getContext();if(e&&e.briefId)return!0;d(!0);try{if(v(null,!1,{storageType:`api`})?.storage?.type===`api`)return!0}catch{}finally{d(!1)}return!1}catch{return!1}}async function _t(){if(!process.stdin.isTTY)return`local`;console.log(`
|
|
32
32
|
`+B.bold.white(`Your tasks are only as good as the context behind them.`)+`
|
|
33
33
|
|
|
34
34
|
`+B.dim(`Parse locally and tasks will be stored in a JSON file. Bring it to Hamster and your brief
|
|
@@ -42,9 +42,9 @@ Now your entire team can go as fast as you can with Taskmaster.`)+`
|
|
|
42
42
|
`));return}let r=600*1e3,o=null,s=e=>{let n=Date.now()+e;i=t({text:`Waiting for authentication... ${B.cyan(`10:00`)} remaining`,spinner:`dots`}).start(),o=setInterval(()=>{let e=Math.max(0,n-Date.now()),t=`${Math.floor(e/6e4)}:${Math.floor(e%6e4/1e3).toString().padStart(2,`0`)}`;i&&(i.text=`Waiting for authentication... ${B.cyan(t)} remaining`),e<=0&&o&&clearInterval(o)},1e3)},c=e=>{o&&=(clearInterval(o),null),i&&=(e?i.succeed(`Authentication successful!`):i.fail(`Authentication failed`),null)};try{await a.authenticateWithOAuth({openBrowser:async e=>{await n(e)},timeout:r,onAuthUrl:e=>{console.log(B.blue.bold(`
|
|
43
43
|
[auth] Browser Authentication
|
|
44
44
|
`)),console.log(B.white(` Opening your browser to authenticate...`)),console.log(B.gray(` If the browser doesn't open, visit:`)),console.log(B.cyan.underline(` ${e}\n`))},onWaitingForAuth:()=>{console.log(B.dim(` If you signed up, check your email to confirm your account.`)),console.log(B.dim(` The CLI will automatically detect when you log in.
|
|
45
|
-
`)),s(r)},onSuccess:()=>{c(!0)},onError:()=>{c(!1)}})}catch(e){c(!1),console.error(B.red(`\n Authentication failed: ${e.message||`Unknown error`}\n`));return}}let o=
|
|
45
|
+
`)),s(r)},onSuccess:()=>{c(!0)},onError:()=>{c(!1)}})}catch(e){c(!1),console.error(B.red(`\n Authentication failed: ${e.message||`Unknown error`}\n`));return}}let o=g.getInstance(),s=await de(o,{promptMessage:`Select an organization to create the brief in:`,forceSelection:!0});if(!s.success){console.error(B.red(`\n ${s.message||`Organization selection cancelled.`}\n`));return}let c=V.readFileSync(e,`utf-8`);if(!c.trim()){console.error(B.red(`
|
|
46
46
|
PRD file is empty.
|
|
47
|
-
`));return}let l=await ee({projectPath:ne()||process.cwd()}),u=[],{wantsToInvite:d}=await W.prompt([{type:`confirm`,name:`wantsToInvite`,message:`Want to invite teammates to collaborate on this brief?`,default:!1}]);if(d){let{emails:e}=await W.prompt([{type:`input`,name:`emails`,message:`Enter email addresses to invite (comma-separated, max 10):`,validate:e=>e.trim()&&e.split(`,`).map(e=>e.trim()).filter(Boolean).length>10?`Maximum 10 email addresses allowed`:!0}]);u=e.split(`,`).map(e=>e.trim()).filter(Boolean).slice(0,10)}r=t(`Creating brief from your PRD...`).start();let f=await l.integration.generateBriefFromPrd({prdContent:c,options:{generateTitle:!0,generateDescription:!0}});if(!f.success||!f.brief){r.fail(`Failed to create brief`);let e=f.error?.message||`Unknown error occurred`;console.error(B.red(`\n ${e}\n`));return}r.succeed(`Brief created!`),console.log(``),console.log(B.green(` ✓ `)+B.white.bold(f.brief.title||`New Brief`)),console.log(``);let p=f.brief.url,m=`\x1b]8;;${p}\x07${B.cyan.underline(p)}\x1b]8;;\x07`;console.log(` ${m}`),console.log(``);let h=f.brief.url.match(/^(https?:\/\/[^/]+)\/home\/([^/]+)\/briefs\//),
|
|
47
|
+
`));return}let l=await ee({projectPath:ne()||process.cwd()}),u=[],{wantsToInvite:d}=await W.prompt([{type:`confirm`,name:`wantsToInvite`,message:`Want to invite teammates to collaborate on this brief?`,default:!1}]);if(d){let{emails:e}=await W.prompt([{type:`input`,name:`emails`,message:`Enter email addresses to invite (comma-separated, max 10):`,validate:e=>e.trim()&&e.split(`,`).map(e=>e.trim()).filter(Boolean).length>10?`Maximum 10 email addresses allowed`:!0}]);u=e.split(`,`).map(e=>e.trim()).filter(Boolean).slice(0,10)}r=t(`Creating brief from your PRD...`).start();let f=await l.integration.generateBriefFromPrd({prdContent:c,options:{generateTitle:!0,generateDescription:!0}});if(!f.success||!f.brief){r.fail(`Failed to create brief`);let e=f.error?.message||`Unknown error occurred`;console.error(B.red(`\n ${e}\n`));return}r.succeed(`Brief created!`),console.log(``),console.log(B.green(` ✓ `)+B.white.bold(f.brief.title||`New Brief`)),console.log(``);let p=f.brief.url,m=`\x1b]8;;${p}\x07${B.cyan.underline(p)}\x1b]8;;\x07`;console.log(` ${m}`),console.log(``);let h=f.brief.url.match(/^(https?:\/\/[^/]+)\/home\/([^/]+)\/briefs\//),_=h?h[2]:null;if(u.length>0&&_){let e=t(`Sending invitations...`).start();try{let t=await l.integration.sendTeamInvitations(_,u,`member`);if(t.success&&t.invitations){e.succeed(`Invitations sent!`),console.log(``),console.log(B.cyan(` Team Invitations:`));for(let e of t.invitations)e.status===`sent`?console.log(B.green(` ${e.email}: Invitation sent`)):e.status===`already_member`?console.log(B.gray(` ${e.email}: Already a team member`)):e.status===`failed`?console.log(B.red(` ${e.email}: Failed to send`)):e.status===`already_invited`&&console.log(B.gray(` ${e.email}: Already invited`));console.log(``)}else{e.fail(`Failed to send invitations`);let n=t.error?.message||`Unknown error occurred`;console.error(B.red(` ${n}`)),console.log(``)}}catch(t){e.fail(`Failed to send invitations`),console.error(B.red(` ${t.message}`)),console.log(``)}}r=t(`Generating tasks from your PRD...`).start();let v=f.brief.id,y=Date.now(),x=0,S=f.brief.status,C=e=>{if(!e)return 0;let t=e.phase||e.currentPhase||``,n=e.parentTasksGenerated||e.progress?.parentTasksGenerated||0,r=e.parentTasksProcessed||e.progress?.parentTasksProcessed||0,i=e.totalParentTasks||e.progress?.totalParentTasks||0;return t===`queued`?0:t===`analyzing`?5:t===`generating_tasks`&&i>0?10+Math.floor(n/i*40):t===`processing_tasks`&&i>0?50+Math.floor(r/i*40):t===`generating_subtasks`?90:t===`complete`?100:0},w=(e,t=30)=>{let n=Math.floor(e/100*t),r=t-n;return B.cyan(`█`.repeat(n))+B.gray(`░`.repeat(r))},T=e=>e===`generating`||e===`pending`||e===`pending_plan`;for(;T(S)&&Date.now()-y<18e4;){await new Promise(e=>setTimeout(e,3e3));try{let e=await l.integration.getBriefStatus(v);if(e.success&&e.status){let t=e.status;if(S=t.status,t.progress){let e=t.progress,n=e.parentTasksGenerated||e.progress?.parentTasksGenerated||0,i=e.parentTasksProcessed||e.progress?.parentTasksProcessed||0,a=e.totalParentTasks||e.progress?.totalParentTasks||0,o=e.subtasksGenerated||e.progress?.subtasksGenerated||0;x=n+o;let s=C(e),c=w(s),l=e.phase||e.currentPhase||`generating`,u=`${c} ${s}%`;l===`generating_tasks`&&a>0?u+=` • Generating tasks (${n}/${a})`:l===`processing_tasks`&&a>0?(u+=` • Processing (${i}/${a})`,o>0&&(u+=` • ${o} subtasks`)):l===`generating_subtasks`?u+=` • ${o} subtasks generated`:e.message&&(u+=` • ${e.message}`),r.text=u}if(t.status===`ready`||t.status===`completed`)break;if(t.status===`failed`){r.fail(`Task generation failed`);let e=t.error||`Task generation failed on Hamster.`;console.error(B.red(`\n ${e}\n`));return}}}catch{}}if(T(S)?(r.warn(`Task generation is still in progress`),console.log(``),console.log(B.yellow(` Tasks are still being generated in the background.`)),console.log(B.white(` Check the brief URL above for progress.`))):r.succeed(x>0?`Done! ${x} tasks generated`:`Task generation complete`),console.log(``),_){let e=f.brief.url.match(/^(https?:\/\/[^/]+)/),t=`${e?e[1]:``}/home/${_}/members`,n=`\x1b]8;;${t}\x07${B.cyan.underline(t)}\x1b]8;;\x07`;console.log(B.gray(` Invite more teammates: `)+n),console.log(``)}try{let e=await l.tasks.resolveBrief(f.brief.url),t=e.document?.title||`Brief ${e.id.slice(0,8)}`,n;try{n=(await o.getOrganization(e.accountId))?.name}catch{}await o.updateContext({orgId:e.accountId,orgName:n,orgSlug:_,briefId:e.id,briefName:t,briefStatus:e.status,briefUpdatedAt:e.updatedAt}),console.log(B.green(` ✓ `)+B.white(`Context set! Run `)+B.cyan(`tm list`)+B.white(` to see your tasks.`))}catch(e){b(`debug`,`Context auto-set failed: ${e.message}`),console.log(B.yellow(` Could not auto-set context. Run `)+B.cyan(`tm context ${f.brief.url}`)+B.yellow(` to connect.`))}console.log(``)}catch(e){r?.isSpinning&&r.fail(`Failed`),console.error(B.red(`\n Error: ${e.message}\n`))}}function X(e,t,n=` `){let r=Math.max(1,47-n.length-e.length);return B.cyan(n+e)+` `.repeat(r)+B.gray(t)}function Z(){let e=process.stdout.columns||80,t=Math.min(120,Math.max(80,Math.floor(e*.9)));console.log(U(B.cyan.bold(`Taskmaster CLI - Connected to Hamster
|
|
48
48
|
|
|
49
49
|
`)+B.white(`Taskmaster syncs tasks from your Hamster brief and provides a CLI
|
|
50
50
|
`)+B.white(`interface to execute the plan. Commands can be used by humans or AI agents.
|
|
@@ -86,7 +86,7 @@ Now your entire team can go as fast as you can with Taskmaster.`)+`
|
|
|
86
86
|
`,` `).replace(B.cyan(` tm`),B.dim(` tm`))+X(`tm briefs`,`View briefs and select one
|
|
87
87
|
|
|
88
88
|
`,` `).replace(B.cyan(` tm`),B.dim(` tm`))+B.white.bold(`» Need more commands?
|
|
89
|
-
`)+B.gray(`Advanced features (models, tags, PRD parsing) are managed in Hamster Studio.`),{padding:1,margin:{top:1},borderStyle:`round`,borderColor:`cyan`,width:t}))}function Q(t){t.on(`option:unknown`,function(e){let t=this._name||`unknown`;q(Error(`Unknown option '${e}'`),{context:`Running command: ${t}`,command:`task-master ${t}`,debug:
|
|
89
|
+
`)+B.gray(`Advanced features (models, tags, PRD parsing) are managed in Hamster Studio.`),{padding:1,margin:{top:1},borderStyle:`round`,borderColor:`cyan`,width:t}))}function Q(t){t.on(`option:unknown`,function(e){let t=this._name||`unknown`;q(Error(`Unknown option '${e}'`),{context:`Running command: ${t}`,command:`task-master ${t}`,debug:_()}),process.exit(1)}),t.command(`help`).description(`Show help information (Hamster-aware)`).action(()=>{Y()?Z():t.help()}),t.configureHelp({helpWidth:120,sortSubcommands:!1});let r=t.help.bind(t);t.help=function(){Y()?Z():r()},t.hook(`preAction`,async(e,t)=>{let n=t.name();s.includes(n)&&await Ke(n,J(t.opts()).getProjectRoot())&&process.exit(1)}),t.command(`parse-prd`).description(`Parse a PRD file and generate tasks`).argument(`[file]`,`Path to the PRD file`).option(`-i, --input <file>`,`Path to the PRD file (alternative to positional argument)`).option(`-o, --output <file>`,`Output file path`).option(`-n, --num-tasks <number>`,`Number of tasks to generate`,h()).option(`-f, --force`,`Skip confirmation when overwriting existing tasks`).option(`--append`,`Append new tasks to existing tasks.json instead of overwriting`).option(`-r, --research`,`Use Perplexity AI for research-backed task generation, providing more comprehensive and accurate task breakdown`).option(`--tag <tag>`,`Specify tag context for task operations`).action(async(e,t)=>{let n=t.input||e,r;try{let e={prdPath:n||!0,tag:t.tag};t.output&&(e.tasksPath=t.output),r=J(e)}catch(e){q(e,{context:`Initializing Task Master for PRD parsing`,command:`task-master parse-prd`,debug:_()}),pt(`${B.cyan(`Usage:`)}\n task-master parse-prd <prd-file.txt> [options]\n\n${B.cyan(`Options:`)}\n -i, --input <file> Path to the PRD file\n -o, --output <file> Output file path\n -n, --num-tasks <number> Number of tasks to generate\n -f, --force Skip confirmation\n --append Append to existing tasks\n -r, --research Use Perplexity AI\n\n${B.cyan(`Examples:`)}\n task-master parse-prd requirements.txt --num-tasks 15\n task-master parse-prd --input=requirements.txt\n task-master parse-prd requirements.txt --research`,`Parse PRD Help`),process.exit(1)}let a=parseInt(t.numTasks,10),o=t.force||!1,s=t.append||!1,c=t.research||!1,l=o,u=s,d=r.getCurrentTag();if(await k(d),await _t()===`hamster`){await vt(r.getPrdPath());return}async function f(){let e=!1,t=r.getTasksPath();if(V.existsSync(t))try{let n=V.readFileSync(t,`utf8`),r=JSON.parse(n);r[d]&&Array.isArray(r[d].tasks)&&r[d].tasks.length>0&&(e=!0)}catch{e=!1}if(e&&!l&&!u){if(!await ge(t))return b(`info`,`Operation cancelled.`),!1;l=!0}return!0}try{if(!await f())return;console.log(B.blue(`Parsing PRD file: ${r.getPrdPath()}`)),console.log(B.blue(`Generating ${a} tasks...`)),s&&console.log(B.blue(`Appending to existing tasks...`)),c&&console.log(B.blue(`Using Perplexity AI for research-backed task generation`));let e=r.getTasksPath()||H.join(r.getProjectRoot(),i);await ce(r.getPrdPath(),e,a,{append:u,force:l,research:c,projectRoot:r.getProjectRoot(),tag:d})}catch(e){console.error(B.red(`Error parsing PRD: ${e.message}`)),process.exit(1)}}),t.command(`update`).description(`Update multiple tasks with ID >= "from" based on new information or implementation changes`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`--from <id>`,`Task ID to start updating from (tasks with ID >= this value will be updated)`,`1`).option(`-p, --prompt <text>`,`Prompt explaining the changes or new context (required)`).option(`-r, --research`,`Use Perplexity AI for research-backed task updates`).option(`--tag <tag>`,`Specify tag context for task operations`).action(async e=>{let t=J({tasksPath:e.file||!0,tag:e.tag}),n=parseInt(e.from,10),r=e.prompt,i=e.research||!1,a=t.getTasksPath(),o=t.getCurrentTag();await k(o),(process.argv.includes(`--id`)||process.argv.some(e=>e.startsWith(`--id=`)))&&(console.error(B.red(`Error: The update command uses --from=<id>, not --id=<id>`)),console.log(B.yellow(`
|
|
90
90
|
To update multiple tasks:`)),console.log(` task-master update --from=${n} --prompt="Your prompt here"`),console.log(B.yellow(`
|
|
91
91
|
To update a single specific task, use the update-task command instead:`)),console.log(` task-master update-task --id=<id> --prompt="Your prompt here"`),process.exit(1)),r||(console.error(B.red(`Error: --prompt parameter is required. Please provide information about the changes.`)),process.exit(1)),console.log(B.blue(`Updating tasks from ID >= ${n} with prompt: "${r}"`)),Y()||console.log(B.blue(`Tasks file: ${a}`)),i&&console.log(B.blue(`Using Perplexity AI for research-backed task updates`)),await ue(t.getTasksPath(),n,r,i,{projectRoot:t.getProjectRoot(),tag:o})}),t.command(`update-task`).description(`Update a single specific task by ID with new information`).argument(`[id]`,`Task ID to update (e.g., 1, 1.1, TAS-123)`).argument(`[prompt...]`,`Update prompt - multiple words, no quotes needed`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`-i, --id <id>`,`Task ID to update (fallback if not using positional)`).option(`-p, --prompt <text>`,`Prompt (fallback if not using positional)`).option(`-r, --research`,`Use Perplexity AI for research-backed task updates`).option(`--append`,`Append timestamped information to task details instead of full update`).option(`--tag <tag>`,`Specify tag context for task operations`).action(async(e,t,n)=>{try{let r=J({tasksPath:n.file||!0,tag:n.tag}),a=r.getTasksPath(),o=r.getCurrentTag();await k(o);let s=e||n.id,c=t.length>0?t.join(` `):n.prompt;s||(console.error(B.red(`Error: Task ID is required`)),console.log(B.yellow(`Usage examples:
|
|
92
92
|
tm update-task 1 Added implementation details
|
|
@@ -95,15 +95,15 @@ To update a single specific task, use the update-task command instead:`)),consol
|
|
|
95
95
|
tm update-task 1 Added implementation details
|
|
96
96
|
tm update-task TAS-123 Fixed the auth bug`)),process.exit(1)),c||(console.error(B.red(`Error: Prompt is required. Please provide information about the changes.`)),console.log(B.yellow(`Usage examples:
|
|
97
97
|
tm update-task 1 Added implementation details
|
|
98
|
-
tm update-task 23 "Update with new information"`)),process.exit(1));let
|
|
98
|
+
tm update-task 23 "Update with new information"`)),process.exit(1));let l=n.research||!1;V.existsSync(a)||(console.error(B.red(`Error: Tasks file not found at path: ${a}`)),a===i?console.log(B.yellow(`Hint: Run task-master init or task-master parse-prd to create tasks.json first`)):console.log(B.yellow(`Hint: Check if the file path is correct: ${a}`)),process.exit(1)),console.log(B.blue(`Updating task ${s} with prompt: "${c}"`)),Y()||console.log(B.blue(`Tasks file: ${a}`)),l&&(x(`perplexity`)?console.log(B.blue(`Using Perplexity AI for research-backed task update`)):(console.log(B.yellow(`Warning: PERPLEXITY_API_KEY environment variable is missing. Research-backed updates will not be available.`)),console.log(B.yellow(`Falling back to Claude AI for task update.`))));let u=Y()?!0:n.append||!1;await C(r.getTasksPath(),s,c,l,{projectRoot:r.getProjectRoot(),tag:o},`text`,u)||console.log(B.yellow(`
|
|
99
99
|
Task update was not completed. Review the messages above for details.`))}catch(e){console.error(B.red(`Error: ${e.message}`)),e.message.includes(`task`)&&e.message.includes(`not found`)?(console.log(B.yellow(`
|
|
100
100
|
To fix this issue:`)),console.log(` 1. Run task-master list to see all available task IDs`),console.log(` 2. Use a valid task ID with the --id parameter`)):e.message.includes(`API key`)&&console.log(B.yellow(`
|
|
101
|
-
This error is related to API keys. Check your environment variables.`)),
|
|
101
|
+
This error is related to API keys. Check your environment variables.`)),_()&&console.error(e),process.exit(1)}}),t.command(`update-subtask`).description(`Update a subtask by appending additional timestamped information`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`-i, --id <id>`,`Subtask ID to update (required)`).option(`-p, --prompt <text>`,`Prompt explaining what information to add (required)`).option(`-r, --research`,`Use Perplexity AI for research-backed updates`).option(`--tag <tag>`,`Specify tag context for task operations`).action(async e=>{try{let t=J({tasksPath:e.file||!0,tag:e.tag}),n=t.getTasksPath(),r=t.getCurrentTag();await k(r),e.id||(console.error(B.red(`Error: --id parameter is required`)),console.log(B.yellow(`Usage example: task-master update-subtask --id=5.2 --prompt="Add more details about the API endpoint"`)),process.exit(1));let a=e.id;e.prompt||(console.error(B.red(`Error: --prompt parameter is required. Please provide information to add to the subtask.`)),console.log(B.yellow(`Usage example: task-master update-subtask --id=5.2 --prompt="Add more details about the API endpoint"`)),process.exit(1));let o=e.prompt,s=e.research||!1;V.existsSync(n)||(console.error(B.red(`Error: Tasks file not found at path: ${n}`)),n===i?console.log(B.yellow(`Hint: Run task-master init or task-master parse-prd to create tasks.json first`)):console.log(B.yellow(`Hint: Check if the file path is correct: ${n}`)),process.exit(1)),console.log(B.blue(`Updating subtask ${a} with prompt: "${o}"`)),Y()||console.log(B.blue(`Tasks file: ${n}`)),s&&(x(`perplexity`)?console.log(B.blue(`Using Perplexity AI for research-backed subtask update`)):(console.log(B.yellow(`Warning: PERPLEXITY_API_KEY environment variable is missing. Research-backed updates will not be available.`)),console.log(B.yellow(`Falling back to Claude AI for subtask update.`)))),await We(t.getTasksPath(),a,o,s,{projectRoot:t.getProjectRoot(),tag:r})||console.log(B.yellow(`
|
|
102
102
|
Subtask update was not completed. Review the messages above for details.`))}catch(e){console.error(B.red(`Error: ${e.message}`)),e.message.includes(`subtask`)&&e.message.includes(`not found`)?(console.log(B.yellow(`
|
|
103
103
|
To fix this issue:`)),console.log(` 1. Run task-master list --with-subtasks to see all available subtask IDs`),console.log(` 2. Use a valid subtask ID with the --id parameter in format "parentId.subtaskId"`)):e.message.includes(`API key`)&&console.log(B.yellow(`
|
|
104
|
-
This error is related to API keys. Check your environment variables.`)),
|
|
105
|
-
To fix this issue:`)),console.log(` 1. Run task-master list to see all available task IDs`),console.log(` 2. Use valid task IDs with the --id parameter`)),
|
|
106
|
-
To fix this issue:`)),console.log(` 1. Run task-master list to see all available task IDs`),console.log(` 2. Use valid task IDs with the --id parameter`)),
|
|
104
|
+
This error is related to API keys. Check your environment variables.`)),_()&&console.error(e),process.exit(1)}}),t.command(`scope-up`).description(`Increase task complexity with AI assistance`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`-i, --id <ids>`,`Comma-separated task/subtask IDs to scope up (required)`).option(`-s, --strength <level>`,`Complexity increase strength: light, regular, heavy`,`regular`).option(`-p, --prompt <text>`,`Custom instructions for targeted scope adjustments`).option(`-r, --research`,`Use research AI for more informed adjustments`).option(`--tag <tag>`,`Specify tag context for task operations`).action(async e=>{try{let t=J({tasksPath:e.file||!0,tag:e.tag}),n=t.getTasksPath(),r=t.getCurrentTag();await k(r),e.id||(console.error(B.red(`Error: --id parameter is required`)),console.log(B.yellow(`Usage example: task-master scope-up --id=1,2,3 --strength=regular`)),process.exit(1));let i=e.id.split(`,`).map(e=>{let t=parseInt(e.trim(),10);return(Number.isNaN(t)||t<=0)&&(console.error(B.red(`Error: Invalid task ID: ${e.trim()}`)),process.exit(1)),t});j(e.strength)||(console.error(B.red(`Error: Invalid strength level: ${e.strength}. Must be one of: light, regular, heavy`)),process.exit(1)),V.existsSync(n)||(console.error(B.red(`Error: Tasks file not found at path: ${n}`)),process.exit(1)),console.log(B.blue(`Scoping up ${i.length} task(s): ${i.join(`, `)}`)),console.log(B.blue(`Strength level: ${e.strength}`)),e.prompt&&console.log(B.blue(`Custom instructions: ${e.prompt}`));let a={projectRoot:t.getProjectRoot(),tag:r,commandName:`scope-up`,outputType:`cli`,research:e.research||!1},o=await se(n,i,e.strength,e.prompt||null,a,`text`);console.log(B.green(`✅ Successfully scoped up ${o.updatedTasks.length} task(s)`))}catch(e){console.error(B.red(`Error: ${e.message}`)),e.message.includes(`not found`)&&(console.log(B.yellow(`
|
|
105
|
+
To fix this issue:`)),console.log(` 1. Run task-master list to see all available task IDs`),console.log(` 2. Use valid task IDs with the --id parameter`)),_()&&console.error(e),process.exit(1)}}),t.command(`scope-down`).description(`Decrease task complexity with AI assistance`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`-i, --id <ids>`,`Comma-separated task/subtask IDs to scope down (required)`).option(`-s, --strength <level>`,`Complexity decrease strength: light, regular, heavy`,`regular`).option(`-p, --prompt <text>`,`Custom instructions for targeted scope adjustments`).option(`-r, --research`,`Use research AI for more informed adjustments`).option(`--tag <tag>`,`Specify tag context for task operations`).action(async e=>{try{let t=J({tasksPath:e.file||!0,tag:e.tag}),n=t.getTasksPath(),r=t.getCurrentTag();await k(r),e.id||(console.error(B.red(`Error: --id parameter is required`)),console.log(B.yellow(`Usage example: task-master scope-down --id=1,2,3 --strength=regular`)),process.exit(1));let i=e.id.split(`,`).map(e=>{let t=parseInt(e.trim(),10);return(Number.isNaN(t)||t<=0)&&(console.error(B.red(`Error: Invalid task ID: ${e.trim()}`)),process.exit(1)),t});j(e.strength)||(console.error(B.red(`Error: Invalid strength level: ${e.strength}. Must be one of: light, regular, heavy`)),process.exit(1)),V.existsSync(n)||(console.error(B.red(`Error: Tasks file not found at path: ${n}`)),process.exit(1)),console.log(B.blue(`Scoping down ${i.length} task(s): ${i.join(`, `)}`)),console.log(B.blue(`Strength level: ${e.strength}`)),e.prompt&&console.log(B.blue(`Custom instructions: ${e.prompt}`));let a={projectRoot:t.getProjectRoot(),tag:r,commandName:`scope-down`,outputType:`cli`,research:e.research||!1},o=await w(n,i,e.strength,e.prompt||null,a,`text`);console.log(B.green(`✅ Successfully scoped down ${o.updatedTasks.length} task(s)`))}catch(e){console.error(B.red(`Error: ${e.message}`)),e.message.includes(`not found`)&&(console.log(B.yellow(`
|
|
106
|
+
To fix this issue:`)),console.log(` 1. Run task-master list to see all available task IDs`),console.log(` 2. Use valid task IDs with the --id parameter`)),_()&&console.error(e),process.exit(1)}}),Pe(t),t.command(`expand`).description(`Expand a task into subtasks using AI`).option(`-i, --id <id>`,`ID of the task to expand`).option(`-a, --all`,`Expand all pending tasks based on complexity analysis`).option(`-n, --num <number>`,`Number of subtasks to generate (uses complexity analysis by default if available)`).option(`-r, --research`,`Enable research-backed generation (e.g., using Perplexity)`,!1).option(`-p, --prompt <text>`,`Additional context for subtask generation`).option(`-f, --force`,`Force expansion even if subtasks exist`,!1).option(`--file <file>`,`Path to the tasks file (relative to project root)`,i).option(`-cr, --complexity-report <file>`,`Path to the complexity report file (use this to specify the complexity report, not --file)`).option(`--tag <tag>`,`Specify tag context for task operations`).action(async e=>{let n={tasksPath:e.file||!0,tag:e.tag};e.complexityReport&&(n.complexityReportPath=e.complexityReport);let r=J(n),i=r.getCurrentTag();if(await k(i),e.all){console.log(B.blue(`Expanding all pending tasks...`));try{await re(r.getTasksPath(),e.num,e.research,e.prompt,e.force,{projectRoot:r.getProjectRoot(),tag:i,complexityReportPath:r.getComplexityReportPath()})}catch(e){console.error(B.red(`Error expanding all tasks: ${e.message}`)),process.exit(1)}}else if(e.id){e.id||(console.error(B.red(`Error: Task ID is required unless using --all.`)),process.exit(1)),console.log(B.blue(`Expanding task ${e.id}...`));try{await fe(r.getTasksPath(),e.id,e.num,e.research,e.prompt,{projectRoot:r.getProjectRoot(),tag:i,complexityReportPath:r.getComplexityReportPath()},e.force)}catch(t){console.error(B.red(`Error expanding task ${e.id}: ${t.message}`)),process.exit(1)}}else console.error(B.red(`Error: You must specify either a task ID (--id) or --all.`)),t.help()}),t.command(`analyze-complexity`).description(`Analyze tasks and generate expansion recommendations${B.reset(``)}`).option(`-o, --output <file>`,`Output file path for the report`).option(`-m, --model <model>`,`LLM model to use for analysis (defaults to configured model)`).option(`-t, --threshold <number>`,`Minimum complexity score to recommend expansion (1-10)`,`5`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`-r, --research`,`Use configured research model for research-backed complexity analysis`).option(`-i, --id <ids>`,`Comma-separated list of specific task IDs to analyze (e.g., "1,3,5")`).option(`--from <id>`,`Starting task ID in a range to analyze`).option(`--to <id>`,`Ending task ID in a range to analyze`).option(`--tag <tag>`,`Specify tag context for task operations`).action(async e=>{let t={tasksPath:e.file||!0,tag:e.tag};e.output&&(t.complexityReportPath=e.output);let n=J(t);e.model,parseFloat(e.threshold);let r=e.research||!1,i=n.getCurrentTag();await k(i);let a=n.getComplexityReportPath();if(console.log(B.blue(`Analyzing task complexity from: ${n.getTasksPath()}`)),console.log(B.blue(`Output report will be saved to: ${a}`)),e.id)console.log(B.blue(`Analyzing specific task IDs: ${e.id}`));else if(e.from||e.to){let t=e.from?e.from:`first`,n=e.to?e.to:`last`;console.log(B.blue(`Analyzing tasks in range: ${t} to ${n}`))}r&&console.log(B.blue(`Using Perplexity AI for research-backed complexity analysis`)),await pe({...e,output:a,tag:i,projectRoot:n.getProjectRoot(),file:n.getTasksPath()})}),t.command(`research`).description(`Perform AI-powered research queries with project context`).argument(`[prompt]`,`Research prompt to investigate`).option(`--file <file>`,`Path to the tasks file`).option(`-i, --id <ids>`,`Comma-separated task/subtask IDs to include as context (e.g., "15,16.2")`).option(`-f, --files <paths>`,`Comma-separated file paths to include as context`).option(`-c, --context <text>`,`Additional custom context to include in the research prompt`).option(`-t, --tree`,`Include project file tree structure in the research context`).option(`-s, --save <file>`,`Save research results to the specified task/subtask(s)`).option(`-d, --detail <level>`,`Output detail level: low, medium, high`,`medium`).option(`--save-to <id>`,`Automatically save research results to specified task/subtask ID (e.g., "15" or "15.2")`).option(`--save-file`,`Save research results to .taskmaster/docs/research/ directory`).option(`--tag <tag>`,`Specify tag context for task operations`).action(async(e,t)=>{let n=J({tasksPath:t.file||!0,tag:t.tag});(!e||typeof e!=`string`||e.trim().length===0)&&(console.error(B.red(`Error: Research prompt is required and cannot be empty`)),p(),process.exit(1));let r=[`low`,`medium`,`high`];t.detail&&!r.includes(t.detail.toLowerCase())&&(console.error(B.red(`Error: Detail level must be one of: ${r.join(`, `)}`)),process.exit(1));let i=[];if(t.id)try{i=t.id.split(`,`).map(e=>{let t=e.trim();if(!/^\d+(\.\d+)?$/.test(t))throw Error(`Invalid task ID format: "${t}". Expected format: "15" or "15.2"`);return t})}catch(e){console.error(B.red(`Error parsing task IDs: ${e.message}`)),process.exit(1)}let a=[];if(t.files)try{a=t.files.split(`,`).map(e=>{let t=e.trim();if(t.length===0)throw Error(`Empty file path provided`);return t})}catch(e){console.error(B.red(`Error parsing file paths: ${e.message}`)),process.exit(1)}if(t.saveTo){let e=t.saveTo.trim();e.length===0&&(console.error(B.red(`Error: Save-to ID cannot be empty`)),process.exit(1)),/^\d+(\.\d+)?$/.test(e)||(console.error(B.red(`Error: Save-to ID must be in format "15" for task or "15.2" for subtask`)),process.exit(1))}if(t.save){let e=t.save.trim();e.length===0&&(console.error(B.red(`Error: Save target cannot be empty`)),process.exit(1)),(e.includes(`..`)||e.startsWith(`/`))&&(console.error(B.red(`Error: Save path must be relative and cannot contain ".."`)),process.exit(1))}let o=n.getCurrentTag();if(await k(o),i.length>0)try{let e=u(n.getTasksPath(),n.getProjectRoot(),o);(!e||!e.tasks)&&(console.error(B.red(`Error: No valid tasks found in ${n.getTasksPath()} for tag '${o}'`)),process.exit(1))}catch(e){console.error(B.red(`Error reading tasks file: ${e.message}`)),process.exit(1)}if(a.length>0)for(let e of a){let t=H.isAbsolute(e)?e:H.join(n.getProjectRoot(),e);V.existsSync(t)||(console.error(B.red(`Error: File not found: ${e}`)),process.exit(1))}let s={prompt:e.trim(),taskIds:i,filePaths:a,customContext:t.context?t.context.trim():null,includeProjectTree:!!t.tree,saveTarget:t.save?t.save.trim():null,saveToId:t.saveTo?t.saveTo.trim():null,allowFollowUp:!0,detailLevel:t.detail?t.detail.toLowerCase():`medium`,tasksPath:n.getTasksPath(),projectRoot:n.getProjectRoot()};console.log(B.blue(`Researching: "${s.prompt}"`)),s.taskIds.length>0&&console.log(B.gray(`Task context: ${s.taskIds.join(`, `)}`)),s.filePaths.length>0&&console.log(B.gray(`File context: ${s.filePaths.join(`, `)}`)),s.customContext&&console.log(B.gray(`Custom context: ${s.customContext.substring(0,50)}${s.customContext.length>50?`...`:``}`)),s.includeProjectTree&&console.log(B.gray(`Including project file tree`)),console.log(B.gray(`Detail level: ${s.detailLevel}`));try{let{performResearch:e}=await import(`./research-DPPDWpmB.js`),n={taskIds:s.taskIds,filePaths:s.filePaths,customContext:s.customContext||``,includeProjectTree:s.includeProjectTree,detailLevel:s.detailLevel,projectRoot:s.projectRoot,saveToFile:!!t.saveFile,tag:o},r=await e(s.prompt,n,{commandName:`research`,outputType:`cli`,tag:o},`text`,s.allowFollowUp);if(s.saveToId&&!r.interactiveSaveOccurred)try{let e=s.saveToId.includes(`.`),t=`## Research Query: ${s.prompt}
|
|
107
107
|
|
|
108
108
|
**Detail Level:** ${r.detailLevel}
|
|
109
109
|
**Context Size:** ${r.contextSize} characters
|
|
@@ -111,7 +111,7 @@ To fix this issue:`)),console.log(` 1. Run task-master list to see all availabl
|
|
|
111
111
|
|
|
112
112
|
### Results
|
|
113
113
|
|
|
114
|
-
${r.result}`;if(e){let{updateSubtaskById:e}=await import(`./update-subtask-by-id-
|
|
114
|
+
${r.result}`;if(e){let{updateSubtaskById:e}=await import(`./update-subtask-by-id-DdOI7HgG.js`);await e(s.tasksPath,s.saveToId,t,!1,{commandName:`research-save`,outputType:`cli`,projectRoot:s.projectRoot,tag:o},`text`),console.log(B.green(`✅ Research saved to subtask ${s.saveToId}`))}else{let e=(await import(`./update-task-by-id-Cqbnf0ZF.js`)).default,n=parseInt(s.saveToId,10);await e(s.tasksPath,n,t,!1,{commandName:`research-save`,outputType:`cli`,projectRoot:s.projectRoot,tag:o},`text`,!0),console.log(B.green(`✅ Research saved to task ${s.saveToId}`))}}catch(e){console.log(B.red(`❌ Error saving to task/subtask: ${e.message}`))}if(s.saveTarget){let e=`# Research Query: ${s.prompt}
|
|
115
115
|
|
|
116
116
|
**Detail Level:** ${r.detailLevel}
|
|
117
117
|
**Context Size:** ${r.contextSize} characters
|
|
@@ -120,7 +120,7 @@ ${r.result}`;if(e){let{updateSubtaskById:e}=await import(`./update-subtask-by-id
|
|
|
120
120
|
## Results
|
|
121
121
|
|
|
122
122
|
${r.result}
|
|
123
|
-
`;V.writeFileSync(s.saveTarget,e,`utf-8`),console.log(B.green(`\n💾 Results saved to: ${s.saveTarget}`))}}catch(e){console.error(B.red(`\n❌ Research failed: ${e.message}`)),process.exit(1)}}),t.command(`clear-subtasks`).description(`Clear subtasks from specified tasks`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`-i, --id <ids>`,`Task IDs (comma-separated) to clear subtasks from`).option(`--all`,`Clear subtasks from all tasks`).option(`--tag <tag>`,`Specify tag context for task operations`).action(async e=>{let t=e.id,n=e.all,r=J({tasksPath:e.file||!0,tag:e.tag}),i=r.getCurrentTag();if(await k(i),!t&&!n&&(console.error(B.red(`Error: Please specify task IDs with --id=<ids> or use --all to clear all tasks`)),process.exit(1)),n){let e=
|
|
123
|
+
`;V.writeFileSync(s.saveTarget,e,`utf-8`),console.log(B.green(`\n💾 Results saved to: ${s.saveTarget}`))}}catch(e){console.error(B.red(`\n❌ Research failed: ${e.message}`)),process.exit(1)}}),t.command(`clear-subtasks`).description(`Clear subtasks from specified tasks`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`-i, --id <ids>`,`Task IDs (comma-separated) to clear subtasks from`).option(`--all`,`Clear subtasks from all tasks`).option(`--tag <tag>`,`Specify tag context for task operations`).action(async e=>{let t=e.id,n=e.all,r=J({tasksPath:e.file||!0,tag:e.tag}),i=r.getCurrentTag();if(await k(i),!t&&!n&&(console.error(B.red(`Error: Please specify task IDs with --id=<ids> or use --all to clear all tasks`)),process.exit(1)),n){let e=u(r.getTasksPath(),r.getProjectRoot(),i);(!e||!e.tasks)&&(console.error(B.red(`Error: No valid tasks found`)),process.exit(1));let t=e.tasks.map(e=>e.id).join(`,`);D(r.getTasksPath(),t,{projectRoot:r.getProjectRoot(),tag:i})}else D(r.getTasksPath(),t,{projectRoot:r.getProjectRoot(),tag:i})}),t.command(`add-task`).description(`Add a new task using AI, optionally providing manual details`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`-p, --prompt <prompt>`,`Description of the task to add (required if not using manual fields)`).option(`-t, --title <title>`,`Task title (for manual task creation)`).option(`-d, --description <description>`,`Task description (for manual task creation)`).option(`--details <details>`,`Implementation details (for manual task creation)`).option(`--dependencies <dependencies>`,`Comma-separated list of task IDs this task depends on`).option(`--priority <priority>`,`Task priority (high, medium, low)`,`medium`).option(`-r, --research`,`Whether to use research capabilities for task creation`).option(`--tag <tag>`,`Specify tag context for task operations`).action(async e=>{let t=e.title&&e.description;!e.prompt&&!t&&(console.error(B.red(`Error: Either --prompt or both --title and --description must be provided`)),process.exit(1));let n=e.file||i;V.existsSync(n)||(console.error(`❌ No tasks.json file found. Please run "task-master init" or create a tasks.json file at ${i}`),process.exit(1));let r=J({tasksPath:e.file||!0,tag:e.tag}),a=r.getProjectRoot(),o=r.getCurrentTag();await k(o);let s=null;t?(s={title:e.title,description:e.description,details:e.details||``,testStrategy:e.testStrategy||``},console.log(B.blue(`Creating task manually with title: "${e.title}"`))):console.log(B.blue(`Creating task with AI using prompt: "${e.prompt}"`));let c=e.dependencies?e.dependencies.split(`,`).map(e=>e.trim()):[];c.length>0&&console.log(B.blue(`Dependencies: [${c.join(`, `)}]`)),e.priority&&console.log(B.blue(`Priority: ${e.priority}`));let l={projectRoot:a,tag:o,commandName:`add-task`,outputType:`cli`};try{let{newTaskId:t,telemetryData:n}=await le(r.getTasksPath(),e.prompt,c,e.priority,l,`text`,s,e.research)}catch(e){console.error(B.red(`Error adding task: ${e.message}`)),e.details&&console.error(B.red(e.details)),process.exit(1)}}),t.command(`add-dependency`).description(`Add a dependency to a task`).option(`-i, --id <id>`,`Task ID to add dependency to`).option(`-d, --depends-on <id>`,`Task ID that will become a dependency`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`--tag <tag>`,`Specify tag context for task operations`).action(async e=>{let t=J({tasksPath:e.file||!0,tag:e.tag}),n=e.id,r=e.dependsOn,i=t.getCurrentTag();await k(i),(!n||!r)&&(console.error(B.red(`Error: Both --id and --depends-on are required`)),process.exit(1));let a=n.includes(`.`)?n:parseInt(n,10),o=r.includes(`.`)?r:parseInt(r,10);await ze(t.getTasksPath(),a,o,{projectRoot:t.getProjectRoot(),tag:i})}),t.command(`remove-dependency`).description(`Remove a dependency from a task`).option(`-i, --id <id>`,`Task ID to remove dependency from`).option(`-d, --depends-on <id>`,`Task ID to remove as a dependency`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`--tag <tag>`,`Specify tag context for task operations`).action(async e=>{let t=J({tasksPath:e.file||!0,tag:e.tag}),n=e.id,r=e.dependsOn,i=t.getCurrentTag();await k(i),(!n||!r)&&(console.error(B.red(`Error: Both --id and --depends-on are required`)),process.exit(1));let a=n.includes(`.`)?n:parseInt(n,10),o=r.includes(`.`)?r:parseInt(r,10);await Fe(t.getTasksPath(),a,o,{projectRoot:t.getProjectRoot(),tag:i})}),t.command(`validate-dependencies`).description(`Identify invalid dependencies without fixing them${B.reset(``)}`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`--tag <tag>`,`Specify tag context for task operations`).action(async e=>{let t=J({tasksPath:e.file||!0,tag:e.tag}),n=t.getCurrentTag();await k(n),await Ee(t.getTasksPath(),{context:{projectRoot:t.getProjectRoot(),tag:n}})}),t.command(`fix-dependencies`).description(`Fix invalid dependencies automatically${B.reset(``)}`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`--tag <tag>`,`Specify tag context for task operations`).action(async e=>{let t=J({tasksPath:e.file||!0,tag:e.tag}),n=t.getCurrentTag();await k(n),await je(t.getTasksPath(),{context:{projectRoot:t.getProjectRoot(),tag:n}})}),t.command(`complexity-report`).description(`Display the complexity analysis report${B.reset(``)}`).option(`-f, --file <file>`,`Path to the report file`,o).option(`--tag <tag>`,`Specify tag context for task operations`).action(async e=>{let t={tag:e.tag};e.file&&e.file!==o&&(t.complexityReportPath=e.file);let n=J(t);await k(n.getCurrentTag()),await ke(n.getComplexityReportPath())}),t.command(`add-subtask`).description(`Add a subtask to an existing task`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`-p, --parent <id>`,`Parent task ID (required)`).option(`-i, --task-id <id>`,`Existing task ID to convert to subtask`).option(`-t, --title <title>`,`Title for the new subtask (when creating a new subtask)`).option(`-d, --description <text>`,`Description for the new subtask`).option(`--details <text>`,`Implementation details for the new subtask`).option(`--dependencies <ids>`,`Comma-separated list of dependency IDs for the new subtask`).option(`-s, --status <status>`,`Status for the new subtask`,`pending`).option(`--generate`,`Regenerate task files after adding subtask`).option(`--tag <tag>`,`Specify tag context for task operations`).action(async e=>{let t=J({tasksPath:e.file||!0,tag:e.tag}),n=e.parent,r=e.taskId,i=e.generate||!1,o=t.getCurrentTag();await k(o),n||(console.error(B.red(`Error: --parent parameter is required. Please provide a parent task ID.`)),a(),process.exit(1));let s=[];e.dependencies&&(s=e.dependencies.split(`,`).map(e=>e.includes(`.`)?e.trim():parseInt(e.trim(),10)));try{if(r)console.log(B.blue(`Converting task ${r} to a subtask of ${n}...`)),await S(t.getTasksPath(),n,r,null,i,{projectRoot:t.getProjectRoot(),tag:o}),console.log(B.green(`✓ Task ${r} successfully converted to a subtask of task ${n}`));else if(e.title){console.log(B.blue(`Creating new subtask for parent task ${n}...`));let r={title:e.title,description:e.description||``,details:e.details||``,status:e.status||`pending`,dependencies:s},a=await S(t.getTasksPath(),n,null,r,i,{projectRoot:t.getProjectRoot(),tag:o});console.log(B.green(`✓ New subtask ${n}.${a.id} successfully created`)),console.log(U(B.white.bold(`Subtask ${n}.${a.id} Added Successfully`)+`
|
|
124
124
|
|
|
125
125
|
`+B.white(`Title: ${a.title}`)+`
|
|
126
126
|
`+B.white(`Status: ${N(a.status)}`)+`
|
|
@@ -160,7 +160,7 @@ ${r.result}
|
|
|
160
160
|
`+B.cyan(`Examples:`)+`
|
|
161
161
|
task-master remove-subtask --id=5.2
|
|
162
162
|
task-master remove-subtask --id=5.2,6.3,7.1
|
|
163
|
-
task-master remove-subtask --id=5.2 --convert`,{padding:1,borderColor:`blue`,borderStyle:`round`}))}function
|
|
163
|
+
task-master remove-subtask --id=5.2 --convert`,{padding:1,borderColor:`blue`,borderStyle:`round`}))}function l(){console.log(U(B.white.bold(`Add Tag Command Help`)+`
|
|
164
164
|
|
|
165
165
|
`+B.cyan(`Usage:`)+`
|
|
166
166
|
task-master add-tag <tagName> [options]
|
|
@@ -175,7 +175,7 @@ ${r.result}
|
|
|
175
175
|
task-master add-tag feature-xyz
|
|
176
176
|
task-master add-tag feature-xyz --copy-from-current
|
|
177
177
|
task-master add-tag feature-xyz --copy-from master
|
|
178
|
-
task-master add-tag feature-xyz -d "Feature XYZ development"`,{padding:1,borderColor:`blue`,borderStyle:`round`}))}function
|
|
178
|
+
task-master add-tag feature-xyz -d "Feature XYZ development"`,{padding:1,borderColor:`blue`,borderStyle:`round`}))}function d(){console.log(U(B.white.bold(`Delete Tag Command Help`)+`
|
|
179
179
|
|
|
180
180
|
`+B.cyan(`Usage:`)+`
|
|
181
181
|
task-master delete-tag <tagName> [options]
|
|
@@ -189,7 +189,7 @@ ${r.result}
|
|
|
189
189
|
task-master delete-tag feature-xyz --yes
|
|
190
190
|
|
|
191
191
|
`+B.yellow(`Warning:`)+`
|
|
192
|
-
This will permanently delete the tag and all its tasks!`,{padding:1,borderColor:`blue`,borderStyle:`round`}))}function
|
|
192
|
+
This will permanently delete the tag and all its tasks!`,{padding:1,borderColor:`blue`,borderStyle:`round`}))}function f(){console.log(U(B.white.bold(`Use Tag Command Help`)+`
|
|
193
193
|
|
|
194
194
|
`+B.cyan(`Usage:`)+`
|
|
195
195
|
task-master use-tag <tagName> [options]
|
|
@@ -203,7 +203,7 @@ ${r.result}
|
|
|
203
203
|
|
|
204
204
|
`+B.cyan(`Related Commands:`)+`
|
|
205
205
|
task-master tags List all available tags
|
|
206
|
-
task-master add-tag <name> Create a new tag`,{padding:1,borderColor:`blue`,borderStyle:`round`}))}function
|
|
206
|
+
task-master add-tag <name> Create a new tag`,{padding:1,borderColor:`blue`,borderStyle:`round`}))}function p(){console.log(U(B.white.bold(`Research Command Help`)+`
|
|
207
207
|
|
|
208
208
|
`+B.cyan(`Usage:`)+`
|
|
209
209
|
task-master research "<query>" [options]
|
|
@@ -226,7 +226,7 @@ ${r.result}
|
|
|
226
226
|
task-master research "How should I implement user authentication?"
|
|
227
227
|
task-master research "What's the best approach?" --id=15,23.2
|
|
228
228
|
task-master research "How does auth work?" --files=src/auth.js --tree
|
|
229
|
-
task-master research "Implementation steps?" --save-to=15.2 --detail=high`,{padding:1,borderColor:`blue`,borderStyle:`round`}))}return t.command(`remove-task`).description(`Remove one or more tasks or subtasks permanently`).option(`-i, --id <ids>`,`ID(s) of the task(s) or subtask(s) to remove (e.g., "5", "5.2", or "5,6.1,7")`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`-y, --yes`,`Skip confirmation prompt`,!1).option(`--tag <tag>`,`Specify tag context for task operations`).action(async e=>{let t=J({tasksPath:e.file||!0,tag:e.tag}),n=e.id,r=t.getCurrentTag();await k(r),n||(console.error(B.red(`Error: Task ID(s) are required`)),console.error(B.yellow(`Usage: task-master remove-task --id=<taskId1,taskId2...>`)),process.exit(1));let i=n.split(`,`).map(e=>e.trim()).filter(Boolean);i.length===0&&(console.error(B.red(`Error: No valid task IDs provided.`)),process.exit(1));try{let n=t.getTasksPath(),a=
|
|
229
|
+
task-master research "Implementation steps?" --save-to=15.2 --detail=high`,{padding:1,borderColor:`blue`,borderStyle:`round`}))}return t.command(`remove-task`).description(`Remove one or more tasks or subtasks permanently`).option(`-i, --id <ids>`,`ID(s) of the task(s) or subtask(s) to remove (e.g., "5", "5.2", or "5,6.1,7")`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`-y, --yes`,`Skip confirmation prompt`,!1).option(`--tag <tag>`,`Specify tag context for task operations`).action(async e=>{let t=J({tasksPath:e.file||!0,tag:e.tag}),n=e.id,r=t.getCurrentTag();await k(r),n||(console.error(B.red(`Error: Task ID(s) are required`)),console.error(B.yellow(`Usage: task-master remove-task --id=<taskId1,taskId2...>`)),process.exit(1));let i=n.split(`,`).map(e=>e.trim()).filter(Boolean);i.length===0&&(console.error(B.red(`Error: No valid task IDs provided.`)),process.exit(1));try{let n=t.getTasksPath(),a=u(n,t.getProjectRoot(),r);(!a||!a.tasks)&&(console.error(B.red(`Error: No valid tasks found in ${n}`)),process.exit(1));let o=[],s=[],c=0,l=[];for(let e of i)if(!ae(a.tasks,e))s.push(e);else{let t=m(a.tasks,e).task;if(t){if(o.push({id:e,task:t}),!t.isSubtask){t.subtasks&&t.subtasks.length>0&&(c+=t.subtasks.length);let n=a.tasks.filter(t=>t.dependencies&&t.dependencies.includes(parseInt(e,10)));n.length>0&&l.push(` - Task ${e}: ${n.length} dependent tasks (${n.map(e=>e.id).join(`, `)})`)}}else s.push(`${e} (error finding details)`)}if(s.length>0&&console.warn(B.yellow(`Warning: The following task IDs were not found: ${s.join(`, `)}`)),o.length===0&&(console.log(B.blue(`No existing tasks found to remove.`)),process.exit(0)),!e.yes){console.log(),console.log(B.red.bold(`⚠️ WARNING: This will permanently delete the following ${o.length} item(s):`)),console.log(),o.forEach(({id:e,task:t})=>{t&&(t.isSubtask?(console.log(B.white(` Subtask ${e}: ${t.title||`(no title)`}`)),t.parentTask&&console.log(B.gray(` (Parent: ${t.parentTask.id} - ${t.parentTask.title||`(no title)`})`))):console.log(B.white.bold(` Task ${e}: ${t.title||`(no title)`}`)))}),c>0&&console.log(B.yellow(`⚠️ This will also delete ${c} subtasks associated with the selected main tasks!`)),l.length>0&&(console.log(B.yellow(`⚠️ Warning: Dependencies on the following tasks will be removed:`)),l.forEach(e=>console.log(B.yellow(e)))),console.log();let{confirm:e}=await W.prompt([{type:`confirm`,name:`confirm`,message:B.red.bold(`Are you sure you want to permanently delete these ${o.length} item(s)?`),default:!1}]);e||(console.log(B.blue(`Task deletion cancelled.`)),process.exit(0))}let d=qe(`Removing ${o.length} task(s)/subtask(s)...`),f=o.map(({id:e})=>e).join(`,`),p=await Oe(t.getTasksPath(),f,{projectRoot:t.getProjectRoot(),tag:r});_e(d),p.success?console.log(U(B.green(`Successfully removed ${p.removedTasks.length} task(s)/subtask(s).`)+(p.message?`\n\nDetails:\n${p.message}`:``)+(p.error?`\n\nWarnings:\n${B.yellow(p.error)}`:``),{padding:1,borderColor:`green`,borderStyle:`round`})):(console.error(U(B.red(`Operation completed with errors. Removed ${p.removedTasks.length} task(s)/subtask(s).`)+(p.message?`\n\nDetails:\n${p.message}`:``)+(p.error?`\n\nErrors:\n${B.red(p.error)}`:``),{padding:1,borderColor:`red`,borderStyle:`round`})),process.exit(1)),s.length>0&&(console.warn(B.yellow(`Note: The following IDs were not found initially and were skipped: ${s.join(`, `)}`)),p.removedTasks.length===0&&process.exit(1))}catch(e){console.error(B.red(`Error: ${e.message||`An unknown error occurred`}`)),process.exit(1)}}),t.command(`init`).description(`Initialize a new project with Task Master structure`).option(`-y, --yes`,`Skip prompts and use default values`).option(`-n, --name <name>`,`Project name`).option(`-d, --description <description>`,`Project description`).option(`-v, --version <version>`,`Project version`,`0.1.0`).option(`-a, --author <author>`,`Author name`).option(`-r, --rules <rules...>`,`List of rules to add (roo, windsurf, cursor, ...). Accepts comma or space separated values.`).option(`--skip-install`,`Skip installing dependencies`).option(`--dry-run`,`Show what would be done without making changes`).option(`--aliases`,`Add shell aliases (tm, taskmaster, hamster, ham)`).option(`--no-aliases`,`Skip shell aliases (tm, taskmaster, hamster, ham)`).option(`--git`,`Initialize Git repository`).option(`--no-git`,`Skip Git repository initialization`).option(`--git-tasks`,`Store tasks in Git`).option(`--no-git-tasks`,`No Git storage of tasks`).action(async e=>{let t=z,n=!1;if(e.rules&&Array.isArray(e.rules)){let r=e.rules.flatMap(e=>e.split(`,`)).map(e=>e.trim()).filter(Boolean);r.length>0&&(t=r,n=!0)}e.rules=t,e.rulesExplicitlyProvided=n;try{await et(e)}catch(e){console.error(B.red(`Error during initialization: ${e.message}`)),process.exit(1)}}),t.command(`models`).description(`Manage AI model configurations`).option(`--set-main <model_id>`,`Set the primary model for task generation/updates`).option(`--set-research <model_id>`,`Set the model for research-backed operations`).option(`--set-fallback <model_id>`,`Set the model to use if the primary fails`).option(`--setup`,`Run interactive setup to configure models`).option(`--openrouter`,`Allow setting a custom OpenRouter model ID (use with --set-*) `).option(`--ollama`,`Allow setting a custom Ollama model ID (use with --set-*) `).option(`--bedrock`,`Allow setting a custom Bedrock model ID (use with --set-*) `).option(`--claude-code`,`Allow setting a Claude Code model ID (use with --set-*)`).option(`--azure`,`Allow setting a custom Azure OpenAI model ID (use with --set-*) `).option(`--vertex`,`Allow setting a custom Vertex AI model ID (use with --set-*) `).option(`--gemini-cli`,`Allow setting a Gemini CLI model ID (use with --set-*)`).option(`--codex-cli`,`Allow setting a Codex CLI model ID (use with --set-*)`).option(`--lmstudio`,`Allow setting a custom LM Studio model ID (use with --set-*)`).option(`--openai-compatible`,`Allow setting a custom OpenAI-compatible model ID (use with --set-*)`).option(`--baseURL <url>`,`Custom base URL for openai-compatible, lmstudio, or ollama providers (e.g., http://localhost:8000/v1)`).addHelpText(`after`,`
|
|
230
230
|
Examples:
|
|
231
231
|
$ task-master models # View current configuration
|
|
232
232
|
$ task-master models --set-main gpt-4o # Set main model (provider inferred)
|
|
@@ -278,12 +278,12 @@ No model configuration changes were made (or errors occurred).`));return}console
|
|
|
278
278
|
`+B.white(` • Invalid tags: Check available tags with task-master tags`)+`
|
|
279
279
|
|
|
280
280
|
`+B.gray(`For more help, run: task-master move --help`))}async function n(e,n){let{sourceId:r,sourceTag:i,toTag:a,taskMaster:o}=e;r||(console.error(B.red(`Error: --from parameter is required for cross-tag moves`)),t(),process.exit(1));let s=r.split(`,`).map(e=>e.trim()),c={withDependencies:n.withDependencies||!1,ignoreDependencies:n.ignoreDependencies||!1};console.log(B.blue(`Moving tasks ${s.join(`, `)} from "${i}" to "${a}"...`));let l=await T(o.getTasksPath(),s,i,a,c,{projectRoot:o.getProjectRoot()});console.log(B.green(`✓ ${l.message}`)),Array.isArray(l.tips)&&l.tips.length>0&&(console.log(`
|
|
281
|
-
`+B.yellow.bold(`Next Steps:`)),l.tips.forEach(e=>console.log(B.white(` • ${e}`))))}async function r(e){let{sourceId:t,destinationId:n,tag:r,taskMaster:i}=e;(!t||!n)&&(console.error(B.red(`Error: Both --from and --to parameters are required for within-tag moves`)),console.log(B.yellow(`Usage: task-master move --from=<sourceId> --to=<destinationId>`)),process.exit(1));let a=t.split(`,`).map(e=>e.trim()),o=n.split(`,`).map(e=>e.trim());if(a.length!==o.length&&(console.error(B.red(`Error: The number of source and destination IDs must match`)),console.log(B.yellow(`Example: task-master move --from=5,6,7 --to=10,11,12`)),process.exit(1)),a.length>1){console.log(B.blue(`Moving multiple tasks: ${a.join(`, `)} to ${o.join(`, `)}...`));let e=
|
|
281
|
+
`+B.yellow.bold(`Next Steps:`)),l.tips.forEach(e=>console.log(B.white(` • ${e}`))))}async function r(e){let{sourceId:t,destinationId:n,tag:r,taskMaster:i}=e;(!t||!n)&&(console.error(B.red(`Error: Both --from and --to parameters are required for within-tag moves`)),console.log(B.yellow(`Usage: task-master move --from=<sourceId> --to=<destinationId>`)),process.exit(1));let a=t.split(`,`).map(e=>e.trim()),o=n.split(`,`).map(e=>e.trim());if(a.length!==o.length&&(console.error(B.red(`Error: The number of source and destination IDs must match`)),console.log(B.yellow(`Example: task-master move --from=5,6,7 --to=10,11,12`)),process.exit(1)),a.length>1){console.log(B.blue(`Moving multiple tasks: ${a.join(`, `)} to ${o.join(`, `)}...`));let e=u(i.getTasksPath(),i.getProjectRoot(),r);(!e||!e.tasks)&&(console.error(B.red(`Error: Invalid or missing tasks file at ${i.getTasksPath()}`)),process.exit(1));let t=[],n=[];for(let e=0;e<a.length;e++){let s=a[e],c=o[e];if(s===c){console.log(B.yellow(`Skipping ${s} -> ${c} (same ID)`));continue}console.log(B.blue(`Moving task/subtask ${s} to ${c}...`));try{await E(i.getTasksPath(),s,c,e===a.length-1,{projectRoot:i.getProjectRoot(),tag:r}),console.log(B.green(`✓ Successfully moved task/subtask ${s} to ${c}`)),n.push({fromId:s,toId:c})}catch(e){let n={fromId:s,toId:c,error:e.message};t.push(n),console.error(B.red(`Error moving ${s} to ${c}: ${e.message}`))}}t.length>0?(console.log(B.yellow(`
|
|
282
282
|
--- Move Operation Summary ---`)),console.log(B.green(`✓ Successfully moved: ${n.length} tasks`)),console.log(B.red(`✗ Failed to move: ${t.length} tasks`)),n.length>0&&(console.log(B.cyan(`
|
|
283
283
|
Successful moves:`)),n.forEach(({fromId:e,toId:t})=>{console.log(B.cyan(` ${e} → ${t}`))})),console.log(B.red(`
|
|
284
284
|
Failed moves:`)),t.forEach(({fromId:e,toId:t,error:n})=>{console.log(B.red(` ${e} → ${t}: ${n}`))}),console.log(B.yellow(`
|
|
285
285
|
Note: Some tasks were moved successfully. Check the errors above for failed moves.`))):console.log(B.green(`
|
|
286
|
-
✓ All tasks moved successfully!`))}else console.log(B.blue(`Moving task/subtask ${t} to ${n}...`)),await E(i.getTasksPath(),t,n,!0,{projectRoot:i.getProjectRoot(),tag:r}),console.log(B.green(`✓ Successfully moved task/subtask ${t} to ${n}`))}function i(e,t){if(console.error(B.red(`Error: ${e.message}`)),e.code===`CROSS_TAG_DEPENDENCY_CONFLICTS`){let n=e.data.conflicts||[],r=e.data.taskIds||[];Ve(n,t.sourceTag,t.toTag,r.join(`, `))}else e.code===`CANNOT_MOVE_SUBTASK`?Ce(e.data.taskId||t.sourceId?.split(`,`)[0],t.sourceTag,t.toTag):e.code===`SOURCE_TARGET_TAGS_SAME`||e.code===`SAME_SOURCE_TARGET_TAG`?Ae(t.sourceTag,t.toTag,`Source and target tags are identical`):Se(`after-error`);process.exit(1)}let a=J({tasksPath:e.file||!0,tag:e.tag}),o=e.from,s=e.to,c=e.fromTag,l=e.toTag,
|
|
286
|
+
✓ All tasks moved successfully!`))}else console.log(B.blue(`Moving task/subtask ${t} to ${n}...`)),await E(i.getTasksPath(),t,n,!0,{projectRoot:i.getProjectRoot(),tag:r}),console.log(B.green(`✓ Successfully moved task/subtask ${t} to ${n}`))}function i(e,t){if(console.error(B.red(`Error: ${e.message}`)),e.code===`CROSS_TAG_DEPENDENCY_CONFLICTS`){let n=e.data.conflicts||[],r=e.data.taskIds||[];Ve(n,t.sourceTag,t.toTag,r.join(`, `))}else e.code===`CANNOT_MOVE_SUBTASK`?Ce(e.data.taskId||t.sourceId?.split(`,`)[0],t.sourceTag,t.toTag):e.code===`SOURCE_TARGET_TAGS_SAME`||e.code===`SAME_SOURCE_TARGET_TAG`?Ae(t.sourceTag,t.toTag,`Source and target tags are identical`):Se(`after-error`);process.exit(1)}let a=J({tasksPath:e.file||!0,tag:e.tag}),o=e.from,s=e.to,c=e.fromTag,l=e.toTag,d=a.getCurrentTag(),f=c||a.getCurrentTag(),p=f&&l&&f!==l,m={sourceId:o,destinationId:s,sourceTag:f,toTag:l,tag:d,taskMaster:a};try{p?await n(m,e):await r(m)}catch(e){let t=String(e&&(e.message||e));t.includes(`already exists in target tag`)&&(console.error(B.red(`Error: ${t}`)),console.log(`
|
|
287
287
|
`+B.yellow.bold(`Conflict: ID already exists in target tag`)+`
|
|
288
288
|
`+B.white(` • Choose a different target tag without conflicting IDs`)+`
|
|
289
289
|
`+B.white(` • Move a different set of IDs (avoid existing ones)`)+`
|
|
@@ -306,14 +306,14 @@ Or specify profiles directly:
|
|
|
306
306
|
`));for(let e of t)console.log(` • ${e.displayName} ${B.gray(`(${e.markerPath})`)}`);console.log(``),e=t.map(e=>e.profileName)}else e=await I(i);if(!e||e.length===0){console.log(B.yellow(`No profiles selected. Exiting.`));return}console.log(B.blue(`Installing ${e.length} selected profile(s)...`));let{allSuccessfulProfiles:t,totalSuccess:n,totalFailed:a}=L(await F(e,i,r.mode));console.log(B.green(`\n✓ Successfully installed ${t.length} profile(s)`)),n>0&&console.log(B.gray(` ${n} files processed, ${a} failed`));return}(!t||t.length===0)&&(console.error(`Please specify at least one rule profile (e.g., windsurf, roo).`),process.exit(1));let a=t.flatMap(e=>e.split(`,`).map(e=>e.trim())).filter(Boolean);if(e===P.REMOVE){let e=!0;if(r.force||(e=Qe(i,a)?await gt(a,Ze(i)):await ht(a)),!e){console.log(B.yellow(`Aborted: No rules were removed.`));return}}let o=[],s=[];for(let t of a){if(!nt(t)){console.warn(`Rule profile for "${t}" not found. Valid profiles: ${z.join(`, `)}. Skipping.`);continue}let a=it(t);if(e===P.ADD){console.log(B.blue(`Adding rules for profile: ${t}...`));let e=ot(i,a,{mode:await n(r.mode)});console.log(B.blue(`Completed adding rules for profile: ${t}`)),s.push({profileName:t,success:e.success,failed:e.failed}),console.log(B.green(rt(t,e)))}else if(e===P.REMOVE){console.log(B.blue(`Removing rules for profile: ${t}...`));let e=tt(i,a);o.push(e),console.log(B.green(st(t,e)))}else console.error(`Unknown action. Use "${P.ADD}" or "${P.REMOVE}".`),process.exit(1)}if(e===P.ADD&&s.length>0){let{allSuccessfulProfiles:e,totalSuccess:t,totalFailed:n}=L(s);e.length>0&&(console.log(B.green(`\nSuccessfully processed profiles: ${e.join(`, `)}`)),t>0?console.log(B.green(`Total: ${t} files processed, ${n} failed.`)):console.log(B.green(`Total: ${e.length} profile(s) set up successfully.`)))}if(e===P.REMOVE&&o.length>0){let{successfulRemovals:e,skippedRemovals:t,failedRemovals:n,removalsWithNotices:r}=at(o);e.length>0&&console.log(B.green(`\nSuccessfully removed profiles for: ${e.join(`, `)}`)),t.length>0&&console.log(B.yellow(`Skipped (default or protected): ${t.join(`, `)}`)),n.length>0&&(console.log(B.red(`
|
|
307
307
|
Errors occurred:`)),n.forEach(e=>{console.log(B.red(` ${e.profileName}: ${e.error}`))})),r.length>0&&(console.log(B.cyan(`
|
|
308
308
|
Notices:`)),r.forEach(e=>{console.log(B.cyan(` ${e.profileName}: ${e.notice}`))}));let i=o.length,a=e.length,s=t.length,c=n.length;console.log(B.blue(`\nTotal: ${i} profile(s) processed - ${a} removed, ${s} skipped, ${c} failed.`))}}),t.command(`migrate`).description(`Migrate existing project to use the new .taskmaster directory structure`).option(`-f, --force`,`Force migration even if .taskmaster directory already exists`).option(`--backup`,`Create backup of old files before migration (default: false)`,!1).option(`--cleanup`,`Remove old files after successful migration (default: true)`,!0).option(`-y, --yes`,`Skip confirmation prompts`).option(`--dry-run`,`Show what would be migrated without actually moving files`).action(async e=>{try{await ie(e)}catch(e){console.error(B.red(`Error during migration:`),e.message),process.exit(1)}}),t.command(`sync-readme`).description(`Sync the current task list to README.md in the project root`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`--with-subtasks`,`Include subtasks in the README output`).option(`-s, --status <status>`,`Show only tasks matching this status (e.g., pending, done)`).option(`-t, --tag <tag>`,`Tag to use for the task list (default: master)`).action(async e=>{let t=J({tasksPath:e.file||!0,tag:e.tag}),n=e.withSubtasks||!1,r=e.status||null,i=t.getCurrentTag();console.log(B.blue(`📝 Syncing tasks to README.md${n?` (with subtasks)`:``}${r?` (status: ${r})`:``}...`)),await syncTasksToReadme(t.getProjectRoot(),{withSubtasks:n,status:r,tasksPath:t.getTasksPath(),tag:i})||(console.error(B.red(`❌ Failed to sync tasks to README.md`)),process.exit(1))}),t.command(`add-tag`).description(`[DEPRECATED] Create a new tag context for organizing tasks (use "tm tags add" instead)`).argument(`[tagName]`,`Name of the new tag to create (optional when using --from-branch)`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`--copy-from-current`,`Copy tasks from the current tag to the new tag`).option(`--copy-from <tag>`,`Copy tasks from the specified tag to the new tag`).option(`--from-branch`,`Create tag name from current git branch (ignores tagName argument)`).option(`-d, --description <text>`,`Optional description for the tag`).action(async(e,t)=>{console.warn(B.yellow(`⚠ Warning: "tm add-tag" is deprecated. Use "tm tags add" instead.`)),console.log(B.gray(` This command will be removed in a future version.
|
|
309
|
-
`));try{let n=J({tasksPath:t.file||!0}),r=n.getTasksPath();V.existsSync(r)||(console.error(B.red(`Error: Tasks file not found at path: ${r}`)),console.log(B.yellow(`Hint: Run task-master init or task-master parse-prd to create tasks.json first`)),process.exit(1)),!e&&!t.fromBranch&&(console.error(B.red(`Error: Either tagName argument or --from-branch option is required.`)),console.log(B.yellow(`Usage examples:`)),console.log(B.cyan(` task-master add-tag my-tag`)),console.log(B.cyan(` task-master add-tag --from-branch`)),process.exit(1));let i={projectRoot:n.getProjectRoot(),commandName:`add-tag`,outputType:`cli`};if(t.fromBranch){let{createTagFromBranch:e}=await import(`./tag-management-
|
|
310
|
-
`));try{let n=J({tasksPath:t.file||!0}),r=n.getTasksPath();V.existsSync(r)||(console.error(B.red(`Error: Tasks file not found at path: ${r}`)),process.exit(1));let i={yes:t.yes||!1},a={projectRoot:n.getProjectRoot(),commandName:`delete-tag`,outputType:`cli`};await He(n.getTasksPath(),e,i,a,`text`)}catch(e){console.error(B.red(`Error deleting tag: ${e.message}`)),
|
|
311
|
-
`));try{let n=J({tasksPath:t.file||!0}),r=n.getTasksPath();V.existsSync(r)||(console.error(B.red(`Error: Tasks file not found at path: ${r}`)),process.exit(1));let i={projectRoot:n.getProjectRoot(),commandName:`use-tag`,outputType:`cli`};await Te(n.getTasksPath(),e,{},i,`text`)}catch(e){console.error(B.red(`Error switching tag: ${e.message}`)),
|
|
309
|
+
`));try{let n=J({tasksPath:t.file||!0}),r=n.getTasksPath();V.existsSync(r)||(console.error(B.red(`Error: Tasks file not found at path: ${r}`)),console.log(B.yellow(`Hint: Run task-master init or task-master parse-prd to create tasks.json first`)),process.exit(1)),!e&&!t.fromBranch&&(console.error(B.red(`Error: Either tagName argument or --from-branch option is required.`)),console.log(B.yellow(`Usage examples:`)),console.log(B.cyan(` task-master add-tag my-tag`)),console.log(B.cyan(` task-master add-tag --from-branch`)),process.exit(1));let i={projectRoot:n.getProjectRoot(),commandName:`add-tag`,outputType:`cli`};if(t.fromBranch){let{createTagFromBranch:e}=await import(`./tag-management-Dt_M130x.js`),r=await import(`./git-utils-PBP1PRVP.js`);await r.isGitRepository(i.projectRoot)||(console.error(B.red(`Error: Not in a git repository. Cannot use --from-branch option.`)),process.exit(1));let a=await r.getCurrentBranch(i.projectRoot);a||(console.error(B.red(`Error: Could not determine current git branch.`)),process.exit(1));let o={copyFromCurrent:t.copyFromCurrent||!1,copyFromTag:t.copyFrom,description:t.description||`Tag created from git branch "${a}"`};await e(n.getTasksPath(),a,o,i,`text`)}else{let r={copyFromCurrent:t.copyFromCurrent||!1,copyFromTag:t.copyFrom,description:t.description};await be(n.getTasksPath(),e,r,i,`text`)}if(t.autoSwitch){let{useTag:r}=await import(`./tag-management-Dt_M130x.js`),a=t.fromBranch?(await import(`./git-utils-PBP1PRVP.js`)).sanitizeBranchNameForTag(await(await import(`./git-utils-PBP1PRVP.js`)).getCurrentBranch(projectRoot)):e;await r(n.getTasksPath(),a,{},i,`text`)}}catch(e){console.error(B.red(`Error creating tag: ${e.message}`)),l(),process.exit(1)}}).on(`error`,function(e){console.error(B.red(`Error: ${e.message}`)),l(),process.exit(1)}),t.command(`delete-tag`).description(`[DEPRECATED] Delete an existing tag and all its tasks (use "tm tags remove" instead)`).argument(`<tagName>`,`Name of the tag to delete`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`-y, --yes`,`Skip confirmation prompts`).action(async(e,t)=>{console.warn(B.yellow(`⚠ Warning: "tm delete-tag" is deprecated. Use "tm tags remove" instead.`)),console.log(B.gray(` This command will be removed in a future version.
|
|
310
|
+
`));try{let n=J({tasksPath:t.file||!0}),r=n.getTasksPath();V.existsSync(r)||(console.error(B.red(`Error: Tasks file not found at path: ${r}`)),process.exit(1));let i={yes:t.yes||!1},a={projectRoot:n.getProjectRoot(),commandName:`delete-tag`,outputType:`cli`};await He(n.getTasksPath(),e,i,a,`text`)}catch(e){console.error(B.red(`Error deleting tag: ${e.message}`)),d(),process.exit(1)}}).on(`error`,function(e){console.error(B.red(`Error: ${e.message}`)),d(),process.exit(1)}),t.command(`use-tag`).description(`[DEPRECATED] Switch to a different tag context (use "tm tags use" instead)`).argument(`<tagName>`,`Name of the tag to switch to`).option(`-f, --file <file>`,`Path to the tasks file`,i).action(async(e,t)=>{console.warn(B.yellow(`⚠ Warning: "tm use-tag" is deprecated. Use "tm tags use" instead.`)),console.log(B.gray(` This command will be removed in a future version.
|
|
311
|
+
`));try{let n=J({tasksPath:t.file||!0}),r=n.getTasksPath();V.existsSync(r)||(console.error(B.red(`Error: Tasks file not found at path: ${r}`)),process.exit(1));let i={projectRoot:n.getProjectRoot(),commandName:`use-tag`,outputType:`cli`};await Te(n.getTasksPath(),e,{},i,`text`)}catch(e){console.error(B.red(`Error switching tag: ${e.message}`)),f(),process.exit(1)}}).on(`error`,function(e){console.error(B.red(`Error: ${e.message}`)),f(),process.exit(1)}),t.command(`rename-tag`).description(`[DEPRECATED] Rename an existing tag (use "tm tags rename" instead)`).argument(`<oldName>`,`Current name of the tag`).argument(`<newName>`,`New name for the tag`).option(`-f, --file <file>`,`Path to the tasks file`,i).action(async(e,t,n)=>{console.warn(B.yellow(`⚠ Warning: "tm rename-tag" is deprecated. Use "tm tags rename" instead.`)),console.log(B.gray(` This command will be removed in a future version.
|
|
312
312
|
`));try{let r=J({tasksPath:n.file||!0}),i=r.getTasksPath();V.existsSync(i)||(console.error(B.red(`Error: Tasks file not found at path: ${i}`)),process.exit(1));let a={projectRoot:r.getProjectRoot(),commandName:`rename-tag`,outputType:`cli`};await xe(r.getTasksPath(),e,t,{},a,`text`)}catch(e){console.error(B.red(`Error renaming tag: ${e.message}`)),process.exit(1)}}).on(`error`,function(e){console.error(B.red(`Error: ${e.message}`)),process.exit(1)}),t.command(`copy-tag`).description(`[DEPRECATED] Copy an existing tag to create a new tag with the same tasks (use "tm tags copy" instead)`).argument(`<sourceName>`,`Name of the source tag to copy from`).argument(`<targetName>`,`Name of the new tag to create`).option(`-f, --file <file>`,`Path to the tasks file`,i).option(`-d, --description <text>`,`Optional description for the new tag`).action(async(e,t,n)=>{console.warn(B.yellow(`⚠ Warning: "tm copy-tag" is deprecated. Use "tm tags copy" instead.`)),console.log(B.gray(` This command will be removed in a future version.
|
|
313
313
|
`));try{let r=J({tasksPath:n.file||!0}),i=r.getTasksPath();V.existsSync(i)||(console.error(B.red(`Error: Tasks file not found at path: ${i}`)),process.exit(1)),await Re(i,e,t,{description:n.description},{projectRoot:r.getProjectRoot(),commandName:`copy-tag`,outputType:`cli`},`text`)}catch(e){console.error(B.red(`Error copying tag: ${e.message}`)),process.exit(1)}}).on(`error`,function(e){console.error(B.red(`Error: ${e.message}`)),process.exit(1)}),t.command(`tui`).alias(`repl`).description(`Launch the interactive TUI/REPL mode`).action(async()=>{await $()}),t}async function yt(){return null}async function $(){let e=await import(`react`),t=await yt();if(!t){console.log(B.yellow(`TUI mode coming soon!`)),console.log(B.dim(`Showing help instead...
|
|
314
|
-
`)),Y()?Z():M();return}let{render:n,Shell:r}=t,i=`master`,a=`local`,o,s={isAuthenticated:!1},c=process.cwd();try{let e=J({});i=e.getCurrentTag(),c=e.getProjectRoot()||process.cwd();let t=
|
|
314
|
+
`)),Y()?Z():M();return}let{render:n,Shell:r}=t,i=`master`,a=`local`,o,s={isAuthenticated:!1},c=process.cwd();try{let e=J({});i=e.getCurrentTag(),c=e.getProjectRoot()||process.cwd();let t=g.getInstance(),n=t.getContext(),r=t.getStoredContext();r&&r.email&&(s={isAuthenticated:!0,email:r.email,userId:r.userId}),n&&n.briefId&&(a=`api`,o={id:n.briefId,name:n.briefName||i})}catch{}let l=process.stdin.isTTY&&typeof process.stdin.setRawMode==`function`;console.clear();let u={showBanner:!0,showSplash:l,initialTag:i,storageType:a,brief:o,authState:s,isInteractive:l,projectRoot:c,onExit:()=>{console.log(B.dim(`
|
|
315
315
|
Goodbye! 👋`)),process.exit(0)}},d=n(e.createElement(r,u));l||setTimeout(()=>{d.unmount(),console.log(B.dim(`
|
|
316
|
-
💡 Run in an interactive terminal for full REPL mode.`)),process.exit(0)},200)}function bt(){let e=new ct().name(`task-master`).description(`AI-driven development task management`).version(A()).helpOption(`-h, --help`,`Display help`).addHelpCommand(!1),t=e.helpInformation.bind(e);return e.helpInformation=function(){return this.parent&&this.parent!==e?t():(Y()?Z():M(),``)},Q(e),e}async function xt(e=process.argv){try{if(e.length<=2){await $();return}let t=e.includes(`init`),n=e.includes(`tui`)||e.includes(`repl`),r=e.includes(`--no-banner`);process.stdout.isTTY&&!t&&!n&&!r&&Le();let i=process.env.TASKMASTER_SKIP_AUTO_UPDATE===`1`||process.env.CI||process.env.NODE_ENV===`test`,a=A(),o=i?{currentVersion:a,latestVersion:a,needsUpdate:!1}:await ve(a);if(o.needsUpdate&&(Je(o.currentVersion,o.latestVersion,o.highlights),await Ue(o.latestVersion))){he(e);return}let s=bt(),c=e.filter(e=>e!==`--no-banner`);await s.parseAsync(c);try{let e=J({}),t=e.getTasksPath(),n=e.getStatePath();if(t&&V.existsSync(t)){let e=V.readFileSync(t,`utf8`),r=JSON.parse(e);if(r&&r.master){let e={migrationNoticeShown:!1};if(n&&V.existsSync(n)){let t=V.readFileSync(n,`utf8`);e=JSON.parse(t)||e}e.migrationNoticeShown||(me({_migrationHappened:!0}),e.migrationNoticeShown=!0,n&&V.writeFileSync(n,JSON.stringify(e,null,2)))}}}catch{}}catch(e){e instanceof
|
|
316
|
+
💡 Run in an interactive terminal for full REPL mode.`)),process.exit(0)},200)}function bt(){let e=new ct().name(`task-master`).description(`AI-driven development task management`).version(A()).helpOption(`-h, --help`,`Display help`).addHelpCommand(!1),t=e.helpInformation.bind(e);return e.helpInformation=function(){return this.parent&&this.parent!==e?t():(Y()?Z():M(),``)},Q(e),e}async function xt(e=process.argv){try{if(e.length<=2){await $();return}let t=e.includes(`init`),n=e.includes(`tui`)||e.includes(`repl`),r=e.includes(`--no-banner`);process.stdout.isTTY&&!t&&!n&&!r&&Le();let i=process.env.TASKMASTER_SKIP_AUTO_UPDATE===`1`||process.env.CI||process.env.NODE_ENV===`test`,a=A(),o=i?{currentVersion:a,latestVersion:a,needsUpdate:!1}:await ve(a);if(o.needsUpdate&&(Je(o.currentVersion,o.latestVersion,o.highlights),await Ue(o.latestVersion))){he(e);return}let s=bt(),c=e.filter(e=>e!==`--no-banner`);await s.parseAsync(c);try{let e=J({}),t=e.getTasksPath(),n=e.getStatePath();if(t&&V.existsSync(t)){let e=V.readFileSync(t,`utf8`),r=JSON.parse(e);if(r&&r.master){let e={migrationNoticeShown:!1};if(n&&V.existsSync(n)){let t=V.readFileSync(n,`utf8`);e=JSON.parse(t)||e}e.migrationNoticeShown||(me({_migrationHappened:!0}),e.migrationNoticeShown=!0,n&&V.writeFileSync(n,JSON.stringify(e,null,2)))}}}catch{}}catch(e){e instanceof y?console.error(U(B.red.bold(`Configuration Update Required!`)+`
|
|
317
317
|
|
|
318
318
|
`+B.white(`Taskmaster now uses a `)+B.yellow.bold(`configuration file`)+B.white(` in your project for AI model choices and settings.
|
|
319
319
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as e,B as t,C as n,Cn as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,R as _,S as v,T as y,U as b,V as x,W as S,_ as C,a as w,b as T,bn as E,c as D,d as O,f as k,g as A,h as j,i as M,j as N,k as P,l as F,m as I,n as L,o as R,p as z,q as B,r as V,s as H,t as U,u as W,v as G,w as K,x as q,xn as J,y as Y,z as X}from"./config-manager-DofXOeM1.js";import"./git-utils-DllbRE35.js";export{E as ALL_PROVIDERS,J as CUSTOM_PROVIDERS,U as ConfigurationError,u as MODEL_MAP,r as VALIDATED_PROVIDERS,L as getAllProviders,V as getAnonymousTelemetryEnabled,M as getAvailableModels,w as getAzureBaseURL,R as getBaseUrlForRole,H as getBedrockBaseURL,D as getClaudeCodeSettings,F as getClaudeCodeSettingsForCommand,W as getCodebaseAnalysisMode,O as getCodexCliSettings,k as getCodexCliSettingsForCommand,z as getConfig,I as getDebugFlag,j as getDefaultNumTasks,A as getDefaultPriority,C as getDefaultSubtasks,G as getFallbackModelId,Y as getFallbackProvider,T as getGrokCliSettings,q as getGrokCliSettingsForCommand,v as getLogLevel,n as getMainModelId,K as getMainProvider,y as getMcpApiKeyStatus,a as getOllamaBaseURL,i as getOperatingMode,h as getParametersForRole,P as getProjectName,e as getProxyEnabled,N as getResearchModelId,p as getResearchProvider,m as getResponseLanguage,g as getSupportedModelsForProvider,o as getUserId,l as getVertexLocation,f as getVertexProjectId,_ as hasCodebaseAnalysis,X as isApiKeySet,t as isConfigFilePresent,x as isConfigWarningSuppressed,c as isProxyEnabled,b as setSuppressConfigWarnings,S as validateClaudeCodeSettings,s as validateCodexCliSettings,d as validateProvider,B as writeConfig};
|