taskgraph-ai 0.52.2 → 0.52.6

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.
Files changed (41) hide show
  1. package/README.md +32 -10
  2. package/dist/ai-services-unified-BbSRBK0N.js +3 -0
  3. package/dist/ai-services-unified-CQMZv2X-.js +1 -0
  4. package/dist/assets/AGENTS.md +12 -31
  5. package/dist/assets/example_prd_rpg.txt +1 -4
  6. package/dist/assets/scripts_README.md +12 -14
  7. package/dist/commands-DOZyxFfM.js +231 -0
  8. package/dist/config-manager-BsUS_HoV.js +1 -0
  9. package/dist/config-manager-CKzRb4tZ.js +1 -0
  10. package/dist/dependency-manager-BcQJdp1Y.js +971 -0
  11. package/dist/git-utils--i2q96hv.js +1 -0
  12. package/dist/git-utils-BezpEZd4.js +1 -0
  13. package/dist/{init-BkYF2xYP.js → init-S96FNSm7.js} +47 -47
  14. package/dist/mcp-server.js +4 -4
  15. package/dist/research-cdWIHSpn.js +1 -0
  16. package/dist/response-language-Bjbf2_9z.js +1 -0
  17. package/dist/{response-language-Dnr7IBrP.js → response-language-Ln6H6G2z.js} +1 -1
  18. package/dist/src-Cio2Sps9.js +207 -0
  19. package/dist/tag-management-BzAE-dVv.js +1 -0
  20. package/dist/task-manager-Utma-ZPy.js +1 -0
  21. package/dist/taskgraph.js +1 -1
  22. package/dist/update-subtask-by-id-UcjCRJbf.js +1 -0
  23. package/dist/update-task-by-id-98Q5zy74.js +1 -0
  24. package/dist/utils-BzS6gmZZ.js +1 -0
  25. package/package.json +12 -26
  26. package/dist/ai-services-unified-CQGTT-i4.js +0 -3
  27. package/dist/ai-services-unified-i_GZ3WhA.js +0 -1
  28. package/dist/commands-D4fCcXpl.js +0 -230
  29. package/dist/config-manager-CMb8CR7Q.js +0 -1
  30. package/dist/config-manager-CvMw_24E.js +0 -1
  31. package/dist/dependency-manager-B9utPujC.js +0 -961
  32. package/dist/git-utils-BFUgMf2g.js +0 -1
  33. package/dist/git-utils-CrYiSKu0.js +0 -1
  34. package/dist/research-Bol2O66r.js +0 -1
  35. package/dist/response-language-BKY-k633.js +0 -1
  36. package/dist/src-O6Nu6TVe.js +0 -203
  37. package/dist/tag-management-Du0gQ3h8.js +0 -1
  38. package/dist/task-manager-CAZrTo7j.js +0 -1
  39. package/dist/update-subtask-by-id-D2oia6KG.js +0 -1
  40. package/dist/update-task-by-id-BvEvVUjJ.js +0 -1
  41. package/dist/utils-Bdg3bcKY.js +0 -1
@@ -0,0 +1 @@
1
+ import"path";import{exec as e,execSync as t}from"child_process";import{promisify as n}from"util";import"fs";const r=n(e);async function i(e){if(!e)throw Error(`projectRoot is required for isGitRepository`);try{return await r(`git rev-parse --git-dir`,{cwd:e}),!0}catch{return!1}}async function a(e){if(!e)throw Error(`projectRoot is required for getCurrentBranch`);try{let{stdout:t}=await r(`git rev-parse --abbrev-ref HEAD`,{cwd:e});return t.trim()}catch{return null}}function o(e){return!e||typeof e!=`string`?`unknown-branch`:e.replace(/[^a-zA-Z0-9_-]/g,`-`).replace(/^-+|-+$/g,``).replace(/-+/g,`-`).toLowerCase().substring(0,50)}function s(e){if(!e||typeof e!=`string`||[`main`,`master`,`develop`,`dev`,`HEAD`].includes(e.toLowerCase()))return!1;let t=o(e);return t.length>0&&t!==`unknown-branch`}function c(e,t){}function l(){try{return t(`git rev-parse --is-inside-work-tree`,{stdio:`ignore`,cwd:process.cwd()}),!0}catch{return!1}}export{s as a,i,a as n,o,l as r,c as t};
@@ -0,0 +1 @@
1
+ export{n as getCurrentBranch,i as isGitRepository,a as isValidBranchForTag,o as sanitizeBranchNameForTag}from"./git-utils--i2q96hv.js";
@@ -1,13 +1,13 @@
1
- import{o as e}from"./ai-services-unified-CQGTT-i4.js";import{At as t,Ct as n,Dt as r,Mt as i,Ot as a,Pt as o,Tt as s,j as c,jt as l,kt as u,nt as d,tt as f,wt as ee,xt as p}from"./config-manager-CMb8CR7Q.js";import{r as m}from"./git-utils-CrYiSKu0.js";import{a as h,dt as g}from"./dependency-manager-B9utPujC.js";import _ from"chalk";import*as v from"node:path";import y from"path";import*as b from"node:fs";import{execSync as x}from"child_process";import S from"fs";import{fileURLToPath as C}from"url";import w from"boxen";import T from"readline";import te from"figlet";import ne from"gradient-string";import re from"ora";import ie from"os";import{randomUUID as ae}from"crypto";const E=[`claude`];function D(e){return e.filter(e=>!O(e))}function O(e){return E.includes(e)}const k=`# Task files`,A=`tasks.json`,j=`tasks/`;function M(e){return e.trim().replace(/^#/,``).trim()}function N(e){let t=M(e);return t===A||t===j}function oe(e,t){return e.map(e=>{if(N(e)){let n=M(e),r=e.match(/\s*$/)[0];return t?`# ${n}${r}`:`${n}${r}`}return e})}function se(e){let t=[],n=!1;for(let r of e){if(r.trim()===k){n=!0;continue}N(r)||n&&!r.trim()||(n&&r.trim()&&!N(r)&&(n=!1),n||t.push(r))}return t}function ce(e,t){return e.filter(e=>{let n=e.trim();return!n||N(e)||n===k?!1:!t.has(n)})}function le(e){let t=[k];return e?t.push(`# ${A}`,`# ${j} `):t.push(A,`${j} `),t}function P(e){if(e.some(e=>e.trim())){let t=e[e.length-1];t&&t.trim()&&e.push(``)}}function ue(e,t,n){if(!e||typeof e!=`string`)throw Error(`targetPath must be a non-empty string`);if(!e.endsWith(`.gitignore`))throw Error(`targetPath must end with .gitignore`);if(!t||typeof t!=`string`)throw Error(`content must be a non-empty string`);if(typeof n!=`boolean`)throw Error(`storeTasksInGit must be a boolean`)}function de(e,t,n){try{S.writeFileSync(e,t.join(`
1
+ import{o as e}from"./ai-services-unified-BbSRBK0N.js";import{At as t,Ct as n,Dt as r,Mt as i,Ot as a,Pt as o,Tt as s,j as c,jt as l,kt as u,nt as d,tt as f,wt as ee,xt as p}from"./config-manager-CKzRb4tZ.js";import{r as m}from"./git-utils--i2q96hv.js";import{a as te,ft as h}from"./dependency-manager-BcQJdp1Y.js";import g from"chalk";import*as _ from"node:path";import v from"path";import{execSync as y}from"child_process";import*as b from"node:fs";import x from"fs";import{fileURLToPath as S}from"url";import C from"boxen";import w from"readline";import T from"figlet";import"gradient-string";import"ora";import E from"os";import{randomUUID as D}from"crypto";const O=[`claude`];function ne(e){return e.filter(e=>!re(e))}function re(e){return O.includes(e)}const k=`tasks.json`,A=`tasks/`;function j(e){return e.trim().replace(/^#/,``).trim()}function M(e){let t=j(e);return t===`tasks.json`||t===`tasks/`}function ie(e,t){return e.map(e=>{if(M(e)){let n=j(e),r=e.match(/\s*$/)[0];return t?`# ${n}${r}`:`${n}${r}`}return e})}function ae(e){let t=[],n=!1;for(let r of e)r.trim()===`# Task files`?n=!0:M(r)||(!n||r.trim())&&(n&&r.trim()&&!M(r)&&(n=!1),n||t.push(r));return t}function oe(e,t){return e.filter(e=>{let n=e.trim();return!n||M(e)||n===`# Task files`?!1:!t.has(n)})}function se(e){let t=[`# Task files`];return e?t.push(`# ${k}`,`# ${A} `):t.push(k,`${A} `),t}function N(e){if(e.some(e=>e.trim())){let t=e[e.length-1];t&&t.trim()&&e.push(``)}}function ce(e,t,n){if(!e||typeof e!=`string`)throw Error(`targetPath must be a non-empty string`);if(!e.endsWith(`.gitignore`))throw Error(`targetPath must end with .gitignore`);if(!t||typeof t!=`string`)throw Error(`content must be a non-empty string`);if(typeof n!=`boolean`)throw Error(`storeTasksInGit must be a boolean`)}function le(e,t,n){try{x.writeFileSync(e,t.join(`
2
2
  `)+`
3
- `),typeof n==`function`&&n(`success`,`Created ${e} with full template`)}catch(t){throw typeof n==`function`&&n(`error`,`Failed to create ${e}: ${t.message}`),t}}function fe(e,t,n,r){try{let i=se(S.readFileSync(e,`utf8`).split(`
4
- `)),a=ce(t,new Set(i.map(e=>e.trim()).filter(e=>e))),o=[...i];a.length>0&&(P(o),o.push(...a)),P(o),o.push(...le(n)),S.writeFileSync(e,o.join(`
3
+ `),typeof n==`function`&&n(`success`,`Created ${e} with full template`)}catch(t){throw typeof n==`function`&&n(`error`,`Failed to create ${e}: ${t.message}`),t}}function ue(e,t,n,r){try{let i=ae(x.readFileSync(e,`utf8`).split(`
4
+ `)),a=oe(t,new Set(i.map(e=>e.trim()).filter(e=>e))),o=[...i];a.length>0&&(N(o),o.push(...a)),N(o),o.push(...se(n)),x.writeFileSync(e,o.join(`
5
5
  `)+`
6
- `),typeof r==`function`&&r(`debug`,`Updated ${e} according to user preference${a.length>0?` and merged new content`:``}`)}catch(t){throw typeof r==`function`&&r(`error`,`Failed to merge content with ${e}: ${t.message}`),t}}function pe(e,t,n=!0,r=null){ue(e,t,n);let i=oe(t.split(`
7
- `),n);S.existsSync(e)?fe(e,i,n,r):de(e,i,r)}const me=C(import.meta.url),F=y.dirname(me);function I(){let e=[y.join(F,`assets`),y.join(F,`..`,`assets`),y.join(F,`..`,`..`,`public`,`assets`),y.join(process.cwd(),`assets`),y.join(process.cwd(),`node_modules`,`taskgraph-ai`,`dist`,`assets`),y.join(process.cwd(),`node_modules`,`taskgraph-ai`,`assets`)];for(let t of e)if(S.existsSync(t)){let e=y.join(t,`AGENTS.md`);if(S.existsSync(e))return t}throw Error(`Assets directory not found. This is likely a packaging issue.`)}function L(e){let t=I();return y.join(t,e)}function R(e){try{let t=L(e);return S.existsSync(t)}catch{return!1}}function z(e,t=`utf8`){let n=L(e);return S.readFileSync(n,t)}const B=`taskgraph-ai`;function he(e){return Array.isArray(e?.args)&&e.args.some(e=>typeof e==`string`&&e.includes(B))}function V(e){let t=JSON.stringify(e,null,` `);return t=t.replace(/(\[\n\t+)([^[\]]+?)(\n\t+\])/g,(e,t,n,r)=>!n.includes(`{`)&&!n.includes(`[`)?`[${n.replace(/\n\t+/g,` `).replace(/\s+/g,` `).trim()}]`:e),t}function ge(e,t){if(!t){d(`debug`,`[MCP Config] No mcpConfigPath provided, skipping MCP configuration setup`);return}let n=y.join(e,t),r=y.dirname(n);d(`info`,`Setting up MCP configuration at ${n}...`);let i={[B]:{command:`npx`,args:[`-y`,B],env:{TASKGRAPH_TOOLS:`core`}}};if(S.existsSync(r)||S.mkdirSync(r,{recursive:!0}),S.existsSync(n)){d(`info`,`MCP configuration file already exists, checking for existing taskgraph-ai...`);try{let e=JSON.parse(S.readFileSync(n,`utf8`));if(e.mcpServers||={},Object.values(e.mcpServers).some(he)){d(`info`,`Found existing taskgraph-ai MCP configuration in mcp.json, leaving untouched`);return}e.mcpServers[B]?d(`info`,`taskgraph-ai server already configured in mcp.json`):(e.mcpServers[B]=i[B],d(`info`,`Added taskgraph-ai server to existing MCP configuration`)),S.writeFileSync(n,V(e)+`
8
- `),d(`success`,`Updated MCP configuration file`)}catch(e){d(`error`,`Failed to update MCP configuration: ${e.message}`);let t=`${n}.backup-${Date.now()}`;S.existsSync(n)&&(S.copyFileSync(n,t),d(`info`,`Created backup of existing mcp.json at ${t}`));let r={mcpServers:i};S.writeFileSync(n,V(r)+`
9
- `),d(`warn`,`Created new MCP configuration file (backup of original file was created if it existed)`)}}else{let e={mcpServers:i};S.writeFileSync(n,V(e)+`
10
- `),d(`success`,`Created MCP configuration file at ${n}`)}d(`info`,`MCP server will use the installed taskgraph-ai package`)}function H(e){let{name:t,description:n,content:r,argumentHint:i}=e;return{type:`static`,metadata:{name:t,description:n,...i&&{argumentHint:i}},content:r}}function U(e,t,n,r){if(!r.includes(`$ARGUMENTS`))throw Error(`Dynamic slash command "${e}" must contain $ARGUMENTS placeholder`);return{type:`dynamic`,metadata:{name:e,description:t,argumentHint:n},content:r}}const _e=U(`parse-prd`,`Parse PRD`,`<prd-file>`,`Parse a PRD document to generate tasks.
6
+ `),typeof r==`function`&&r(`debug`,`Updated ${e} according to user preference${a.length>0?` and merged new content`:``}`)}catch(t){throw typeof r==`function`&&r(`error`,`Failed to merge content with ${e}: ${t.message}`),t}}function de(e,t,n=!0,r=null){ce(e,t,n);let i=ie(t.split(`
7
+ `),n);x.existsSync(e)?ue(e,i,n,r):le(e,i,r)}const fe=S(import.meta.url),P=v.dirname(fe);function F(){let e=[v.join(P,`assets`),v.join(P,`..`,`assets`),v.join(P,`..`,`..`,`public`,`assets`),v.join(process.cwd(),`assets`),v.join(process.cwd(),`node_modules`,`taskgraph-ai`,`dist`,`assets`),v.join(process.cwd(),`node_modules`,`taskgraph-ai`,`assets`)];for(let t of e)if(x.existsSync(t)){let e=v.join(t,`AGENTS.md`);if(x.existsSync(e))return t}throw Error(`Assets directory not found. This is likely a packaging issue.`)}function I(e){let t=F();return v.join(t,e)}function L(e){try{let t=I(e);return x.existsSync(t)}catch{return!1}}function R(e,t=`utf8`){let n=I(e);return x.readFileSync(n,t)}const z=`taskgraph-ai`;function B(e){return Array.isArray(e?.args)&&e.args.some(e=>typeof e==`string`&&e.includes(`taskgraph-ai`))}function V(e){let t=JSON.stringify(e,null,` `);return t=t.replace(/(\[\n\t+)([^[\]]+?)(\n\t+\])/g,(e,t,n,r)=>!n.includes(`{`)&&!n.includes(`[`)?`[${n.replace(/\n\t+/g,` `).replace(/\s+/g,` `).trim()}]`:e),t}function pe(e,t){if(!t){d(`debug`,`[MCP Config] No mcpConfigPath provided, skipping MCP configuration setup`);return}let n=v.join(e,t),r=v.dirname(n);d(`info`,`Setting up MCP configuration at ${n}...`);let i={[z]:{command:`npx`,args:[`-y`,z],env:{TASKGRAPH_TOOLS:`core`}}};if(x.existsSync(r)||x.mkdirSync(r,{recursive:!0}),x.existsSync(n)){d(`info`,`MCP configuration file already exists, checking for existing taskgraph-ai...`);try{let e=JSON.parse(x.readFileSync(n,`utf8`));if(e.mcpServers||={},Object.values(e.mcpServers).some(B)){d(`info`,`Found existing taskgraph-ai MCP configuration in mcp.json, leaving untouched`);return}e.mcpServers[`taskgraph-ai`]?d(`info`,`taskgraph-ai server already configured in mcp.json`):(e.mcpServers[z]=i[z],d(`info`,`Added taskgraph-ai server to existing MCP configuration`)),x.writeFileSync(n,V(e)+`
8
+ `),d(`success`,`Updated MCP configuration file`)}catch(e){d(`error`,`Failed to update MCP configuration: ${e.message}`);let t=`${n}.backup-${Date.now()}`;x.existsSync(n)&&(x.copyFileSync(n,t),d(`info`,`Created backup of existing mcp.json at ${t}`));let r={mcpServers:i};x.writeFileSync(n,V(r)+`
9
+ `),d(`warn`,`Created new MCP configuration file (backup of original file was created if it existed)`)}}else{let e={mcpServers:i};x.writeFileSync(n,V(e)+`
10
+ `),d(`success`,`Created MCP configuration file at ${n}`)}d(`info`,`MCP server will use the installed taskgraph-ai package`)}function H(e){let{name:t,description:n,content:r,argumentHint:i}=e;return{type:`static`,metadata:{name:t,description:n,...i&&{argumentHint:i}},content:r}}function U(e,t,n,r){if(!r.includes(`$ARGUMENTS`))throw Error(`Dynamic slash command "${e}" must contain $ARGUMENTS placeholder`);return{type:`dynamic`,metadata:{name:e,description:t,argumentHint:n},content:r}}const me=U(`parse-prd`,`Parse PRD`,`<prd-file>`,`Parse a PRD document to generate tasks.
11
11
 
12
12
  Arguments: $ARGUMENTS (PRD file path)
13
13
 
@@ -55,7 +55,7 @@ After parsing:
55
55
  1. Display task summary
56
56
  2. Show dependency graph
57
57
  3. Suggest task expansion for complex items
58
- 4. Recommend sprint planning`),ve=U(`parse-prd-with-research`,`Parse PRD With Research`,`<prd-file>`,`Parse PRD with enhanced research mode for better task generation.
58
+ 4. Recommend sprint planning`),he=U(`parse-prd-with-research`,`Parse PRD With Research`,`<prd-file>`,`Parse PRD with enhanced research mode for better task generation.
59
59
 
60
60
  Arguments: $ARGUMENTS (PRD file path)
61
61
 
@@ -102,7 +102,7 @@ Research mode typically:
102
102
  - New technology domains
103
103
  - Complex requirements
104
104
  - Regulatory compliance needed
105
- - Best practices crucial`),ye=U(`analyze-complexity`,`Analyze Complexity`,`[options]`,`Analyze task complexity and generate expansion recommendations.
105
+ - Best practices crucial`),ge=U(`analyze-complexity`,`Analyze Complexity`,`[options]`,`Analyze task complexity and generate expansion recommendations.
106
106
 
107
107
  Arguments: $ARGUMENTS
108
108
 
@@ -222,7 +222,7 @@ After analysis:
222
222
  /taskgraph:expand 5 # Expand specific task
223
223
  /taskgraph:expand-all # Expand all recommended
224
224
  /taskgraph:complexity-report # View detailed report
225
- \`\`\``),be=U(`complexity-report`,`Complexity Report`,`[--file=<path>]`,`Display the task complexity analysis report.
225
+ \`\`\``),_e=U(`complexity-report`,`Complexity Report`,`[--file=<path>]`,`Display the task complexity analysis report.
226
226
 
227
227
  Arguments: $ARGUMENTS
228
228
 
@@ -338,7 +338,7 @@ Use report for:
338
338
  After viewing:
339
339
  /taskgraph:expand 5
340
340
  → Expand high-complexity task
341
- \`\`\``),xe=U(`expand-task`,`Expand Task`,`<task-id>`,`Break down a complex task into subtasks.
341
+ \`\`\``),ve=U(`expand-task`,`Expand Task`,`<task-id>`,`Break down a complex task into subtasks.
342
342
 
343
343
  Arguments: $ARGUMENTS (task ID)
344
344
 
@@ -386,7 +386,7 @@ After expansion:
386
386
  1. Show subtask hierarchy
387
387
  2. Update time estimates
388
388
  3. Suggest implementation order
389
- 4. Highlight critical path`),Se=H({name:`expand-all-tasks`,description:`Expand All Tasks`,content:`Expand all pending tasks that need subtasks.
389
+ 4. Highlight critical path`),ye=H({name:`expand-all-tasks`,description:`Expand All Tasks`,content:`Expand all pending tasks that need subtasks.
390
390
 
391
391
  ## Bulk Task Expansion
392
392
 
@@ -436,7 +436,7 @@ After bulk expansion:
436
436
  - Summary of tasks expanded
437
437
  - New subtask count
438
438
  - Updated complexity metrics
439
- - Suggested task order`}),Ce=U(`add-task`,`Add Task`,`<description>`,`Add new tasks with intelligent parsing and context awareness.
439
+ - Suggested task order`}),be=U(`add-task`,`Add Task`,`<description>`,`Add new tasks with intelligent parsing and context awareness.
440
440
 
441
441
  Arguments: $ARGUMENTS
442
442
 
@@ -513,7 +513,7 @@ Intelligent defaults based on:
513
513
  - Historical data
514
514
  - Current sprint/phase
515
515
 
516
- Result: High-quality tasks from minimal input.`),we=U(`add-subtask`,`Add Subtask`,`<parent-id> <title>`,`Add a subtask to a parent task.
516
+ Result: High-quality tasks from minimal input.`),xe=U(`add-subtask`,`Add Subtask`,`<parent-id> <title>`,`Add a subtask to a parent task.
517
517
 
518
518
  Arguments: $ARGUMENTS
519
519
 
@@ -588,7 +588,7 @@ taskgraph add-subtask --parent=<id> --task-id=<existing-id>
588
588
  - Show updated task hierarchy
589
589
  - Suggest logical next subtasks
590
590
  - Update complexity estimates
591
- - Recommend subtask order`),Te=U(`remove-task`,`Remove Task`,`<task-id>`,`Remove a task permanently from the project.
591
+ - Recommend subtask order`),Se=U(`remove-task`,`Remove Task`,`<task-id>`,`Remove a task permanently from the project.
592
592
 
593
593
  Arguments: $ARGUMENTS (task ID)
594
594
 
@@ -694,7 +694,7 @@ Remove anyway? (y/n)
694
694
  - Impact preview
695
695
  - Removal logging
696
696
  - Suggest alternatives
697
- - No cascade delete of dependents`),Ee=U(`remove-subtask`,`Remove Subtask`,`<subtask-id>`,`Remove a subtask from its parent task.
697
+ - No cascade delete of dependents`),Ce=U(`remove-subtask`,`Remove Subtask`,`<subtask-id>`,`Remove a subtask from its parent task.
698
698
 
699
699
  Arguments: $ARGUMENTS
700
700
 
@@ -777,7 +777,7 @@ Confirm deletion? (y/n)
777
777
  - Update parent task status
778
778
  - Recalculate estimates
779
779
  - Show updated hierarchy
780
- - Suggest next actions`),De=U(`remove-subtasks`,`Remove Subtasks`,`<task-id>`,`Clear all subtasks from a specific task.
780
+ - Suggest next actions`),we=U(`remove-subtasks`,`Remove Subtasks`,`<task-id>`,`Clear all subtasks from a specific task.
781
781
 
782
782
  Arguments: $ARGUMENTS (task ID)
783
783
 
@@ -862,7 +862,7 @@ Suggest alternatives:
862
862
  → Cleared all subtasks from task #5
863
863
  → Updated parent task estimates
864
864
  → Suggestion: Consider re-expanding with better breakdown
865
- \`\`\``),Oe=H({name:`remove-all-subtasks`,description:`Remove All Subtasks`,content:`Clear all subtasks from all tasks globally.
865
+ \`\`\``),Te=H({name:`remove-all-subtasks`,description:`Remove All Subtasks`,content:`Clear all subtasks from all tasks globally.
866
866
 
867
867
  ## Global Subtask Clearing
868
868
 
@@ -954,7 +954,7 @@ Next steps:
954
954
  - Review updated task list
955
955
  - Re-expand complex tasks as needed
956
956
  - Check project timeline
957
- \`\`\``}),ke=U(`convert-task-to-subtask`,`Convert Task To Subtask`,`<parent-id> <task-id>`,`Convert an existing task into a subtask.
957
+ \`\`\``}),Ee=U(`convert-task-to-subtask`,`Convert Task To Subtask`,`<parent-id> <task-id>`,`Convert an existing task into a subtask.
958
958
 
959
959
  Arguments: $ARGUMENTS
960
960
 
@@ -1024,7 +1024,7 @@ After: #5.1 "Implement validation" (subtask of #5)
1024
1024
  - Show new task hierarchy
1025
1025
  - List updated dependencies
1026
1026
  - Verify project integrity
1027
- - Suggest related conversions`),Ae=U(`add-dependency`,`Add Dependency`,`<task-id> <depends-on-id>`,`Add a dependency between tasks.
1027
+ - Suggest related conversions`),De=U(`add-dependency`,`Add Dependency`,`<task-id> <depends-on-id>`,`Add a dependency between tasks.
1028
1028
 
1029
1029
  Arguments: $ARGUMENTS
1030
1030
 
@@ -1078,7 +1078,7 @@ After adding dependency:
1078
1078
  → Task #5 now depends on Task #3
1079
1079
  → Task #5 is now blocked until #3 completes
1080
1080
  → Suggested: Also consider if #5 needs #4
1081
- \`\`\``),je=U(`remove-dependency`,`Remove Dependency`,`<task-id> <depends-on-id>`,`Remove a dependency between tasks.
1081
+ \`\`\``),Oe=U(`remove-dependency`,`Remove Dependency`,`<task-id> <depends-on-id>`,`Remove a dependency between tasks.
1082
1082
 
1083
1083
  Arguments: $ARGUMENTS
1084
1084
 
@@ -1139,7 +1139,7 @@ After removing:
1139
1139
  → Removed: Task #5 no longer depends on #3
1140
1140
  → Task #5 is now UNBLOCKED and ready to start
1141
1141
  → Warning: Consider if #5 still needs #2 completed first
1142
- \`\`\``),Me=H({name:`fix-dependencies`,description:`Fix Dependencies`,content:`Automatically fix dependency issues found during validation.
1142
+ \`\`\``),ke=H({name:`fix-dependencies`,description:`Fix Dependencies`,content:`Automatically fix dependency issues found during validation.
1143
1143
 
1144
1144
  ## Automatic Dependency Repair
1145
1145
 
@@ -1219,7 +1219,7 @@ Run '/taskgraph:validate-dependencies' to verify fixes
1219
1219
  - Preview mode available
1220
1220
  - Rollback capability
1221
1221
  - Change logging
1222
- - No data loss`}),Ne=H({name:`validate-dependencies`,description:`Validate Dependencies`,content:`Validate all task dependencies for issues.
1222
+ - No data loss`}),Ae=H({name:`validate-dependencies`,description:`Validate Dependencies`,content:`Validate all task dependencies for issues.
1223
1223
 
1224
1224
  ## Dependency Validation
1225
1225
 
@@ -1289,7 +1289,7 @@ For each issue found:
1289
1289
  After validation:
1290
1290
  - Run \`/taskgraph:fix-dependencies\` to auto-fix
1291
1291
  - Manually adjust problematic dependencies
1292
- - Rerun to verify fixes`}),Pe=H({name:`setup-models`,description:`Setup Models`,content:`Run interactive setup to configure AI models.
1292
+ - Rerun to verify fixes`}),je=H({name:`setup-models`,description:`Setup Models`,content:`Run interactive setup to configure AI models.
1293
1293
 
1294
1294
  ## Interactive Model Configuration
1295
1295
 
@@ -1330,7 +1330,7 @@ Model choices are saved in \`.taskgraph/config.json\`.
1330
1330
  After configuration:
1331
1331
  - Show usage examples
1332
1332
  - Suggest next steps
1333
- - Verify parse-prd works`}),Fe=H({name:`view-models`,description:`View Models`,content:`View current AI model configuration.
1333
+ - Verify parse-prd works`}),Me=H({name:`view-models`,description:`View Models`,content:`View current AI model configuration.
1334
1334
 
1335
1335
  ## Model Configuration Display
1336
1336
 
@@ -1376,7 +1376,7 @@ Available Models:
1376
1376
  Based on configuration:
1377
1377
  - If Claude Code is missing → Suggest installing and signing in
1378
1378
  - If no research model → Explain benefits
1379
- - If all configured → Show usage tips`}),Ie=H({name:`install-taskgraph`,description:`Install TaskGraph`,content:`Check if TaskGraph is installed and install it if needed.
1379
+ - If all configured → Show usage tips`}),Ne=H({name:`install-taskgraph`,description:`Install TaskGraph`,content:`Check if TaskGraph is installed and install it if needed.
1380
1380
 
1381
1381
  This command helps you get TaskGraph set up globally on your system.
1382
1382
 
@@ -1487,7 +1487,7 @@ Try: /taskgraph:init your-prd.md
1487
1487
  After installation:
1488
1488
  1. Run \`/taskgraph:status\` to verify setup
1489
1489
  2. Configure AI providers with \`/taskgraph:setup-models\`
1490
- 3. Start using TaskGraph commands!`}),Le=H({name:`quick-install-taskgraph`,description:`Quick Install TaskGraph`,content:`Quick install TaskGraph globally if not already installed.
1490
+ 3. Start using TaskGraph commands!`}),Pe=H({name:`quick-install-taskgraph`,description:`Quick Install TaskGraph`,content:`Quick install TaskGraph globally if not already installed.
1491
1491
 
1492
1492
  Execute this streamlined installation:
1493
1493
 
@@ -1508,7 +1508,7 @@ If you see "command not found" after installation, you may need to:
1508
1508
 
1509
1509
  Once installed, you can use all the TaskGraph commands!
1510
1510
 
1511
- Quick test: Run \`/taskgraph:help\` to see all available commands.`}),Re=U(`to-review`,`To Review`,`<task-id>`,`Set a task's status to review.
1511
+ Quick test: Run \`/taskgraph:help\` to see all available commands.`}),Fe=U(`to-review`,`To Review`,`<task-id>`,`Set a task's status to review.
1512
1512
 
1513
1513
  Arguments: $ARGUMENTS (task ID)
1514
1514
 
@@ -1547,7 +1547,7 @@ When setting to review:
1547
1547
  - Create review reminders
1548
1548
  - Track review duration
1549
1549
  - Suggest reviewers based on expertise
1550
- - Prepare rollback plan if needed`),ze=U(`to-deferred`,`To Deferred`,`<task-id>`,`Defer a task for later consideration.
1550
+ - Prepare rollback plan if needed`),Ie=U(`to-deferred`,`To Deferred`,`<task-id>`,`Defer a task for later consideration.
1551
1551
 
1552
1552
  Arguments: $ARGUMENTS (task ID)
1553
1553
 
@@ -1593,7 +1593,7 @@ When deferring:
1593
1593
  - Monitor deferral duration
1594
1594
  - Alert when criteria met
1595
1595
  - Prevent scope creep
1596
- - Regular review cycles`),Be=U(`to-cancelled`,`To Cancelled`,`<task-id>`,`Cancel a task permanently.
1596
+ - Regular review cycles`),Le=U(`to-cancelled`,`To Cancelled`,`<task-id>`,`Cancel a task permanently.
1597
1597
 
1598
1598
  Arguments: $ARGUMENTS (task ID)
1599
1599
 
@@ -1647,7 +1647,7 @@ When cancelling:
1647
1647
  - Keep for reference
1648
1648
  - Tag with cancellation reason
1649
1649
  - Link to replacement if any
1650
- - Maintain audit trail`),Ve=U(`init-project`,`Init Project`,`[prd-file]`,`Initialize a new TaskGraph project.
1650
+ - Maintain audit trail`),Re=U(`init-project`,`Init Project`,`[prd-file]`,`Initialize a new TaskGraph project.
1651
1651
 
1652
1652
  Arguments: $ARGUMENTS
1653
1653
 
@@ -1696,7 +1696,7 @@ If PRD file provided:
1696
1696
  \`\`\`
1697
1697
  /taskgraph:init my-prd.md
1698
1698
  → Automatically runs parse-prd after init
1699
- \`\`\``),He=U(`init-project-quick`,`Init Project Quick`,`[prd-file]`,`Quick initialization with auto-confirmation.
1699
+ \`\`\``),ze=U(`init-project-quick`,`Init Project Quick`,`[prd-file]`,`Quick initialization with auto-confirmation.
1700
1700
 
1701
1701
  Arguments: $ARGUMENTS
1702
1702
 
@@ -1853,7 +1853,7 @@ Ready for:
1853
1853
  - Easy task sharing
1854
1854
  - AI tool compatibility
1855
1855
  - Offline task access
1856
- - Backup redundancy`});const Ue=[_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He,U(`show-task`,`Show Task`,`<task-id>`,`Show detailed task information with rich context and insights.
1856
+ - Backup redundancy`});const Be=[me,he,ge,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,U(`show-task`,`Show Task`,`<task-id>`,`Show detailed task information with rich context and insights.
1857
1857
 
1858
1858
  Arguments: $ARGUMENTS
1859
1859
 
@@ -3115,22 +3115,22 @@ Works well with:
3115
3115
  - CI/CD pipelines
3116
3116
  - Project documentation
3117
3117
  - Team updates
3118
- - Client reports`)];var We=class{supportsNestedCommands=!0;get supportsCommands(){return this.commandsDir!==``}formatAll(e){return e.map(e=>this.format(e))}getFilename(e){return this.supportsNestedCommands?`${e}${this.extension}`:`tm-${e}${this.extension}`}transformArgumentPlaceholder(e){return e}postProcess(e){return e}getCommandsPath(e){return this.supportsNestedCommands?v.join(e,this.commandsDir,`tm`):v.join(e,this.commandsDir)}addSlashCommands(e,t){let n=this.getCommandsPath(e),r=[];if(!this.supportsCommands)return{success:!1,count:0,directory:n,files:[],error:`Profile "${this.name}" does not support slash commands`};try{b.existsSync(n)||b.mkdirSync(n,{recursive:!0});let e=this.formatAll(t);for(let t of e){let e=v.join(n,t.filename);b.writeFileSync(e,t.content),r.push(t.filename)}return{success:!0,count:r.length,directory:n,files:r}}catch(e){return{success:!1,count:0,directory:n,files:[],error:e instanceof Error?e.message:String(e)}}}removeSlashCommands(e,t,n=!0){let r=this.getCommandsPath(e),i=[];if(!this.supportsCommands)return{success:!1,count:0,directory:r,files:[],error:`Profile "${this.name}" does not support slash commands`};if(!b.existsSync(r))return{success:!0,count:0,directory:r,files:[]};try{let e=new Set(t.map(e=>{let t=e.metadata.name.toLowerCase();return this.supportsNestedCommands?t:`tm-${t}`})),a=b.readdirSync(r);for(let t of a){let n=v.basename(t,v.extname(t)).toLowerCase();if(e.has(n)){let e=v.join(r,t);b.rmSync(e,{force:!0}),i.push(t)}}return n&&b.readdirSync(r).length===0&&b.rmSync(r,{recursive:!0,force:!0}),{success:!0,count:i.length,directory:r,files:i}}catch(e){return{success:!1,count:i.length,directory:r,files:i,error:e instanceof Error?e.message:String(e)}}}};const Ge={claude:new class extends We{name=`claude`;displayName=`Claude Code`;commandsDir=`.claude/commands`;extension=`.md`;format(e){let t=this.buildHeader(e),n=this.transformArgumentPlaceholder(e.content);return{filename:this.getFilename(e.metadata.name),content:`${t}${n}`}}buildHeader(e){let t=[e.metadata.description,``];return e.metadata.argumentHint&&(t.push(`Arguments: $ARGUMENTS`),t.push(``)),t.join(`
3119
- `)}}};function Ke(e){return Ge[e.toLowerCase()]}function qe(){let e=ie.homedir(),t=process.env.SHELL||``;if(t.includes(`zsh`))return y.join(e,`.zshrc`);if(t.includes(`bash`)){let t=y.join(e,`.bash_profile`);return process.platform===`darwin`?t:y.join(e,`.bashrc`)}if(t.includes(`fish`))return y.join(e,`.config`,`fish`,`config.fish`);if(process.platform===`win32`){if(process.env.PSModulePath){let t=process.env.PROFILE||y.join(e,`Documents`,`WindowsPowerShell`,`Microsoft.PowerShell_profile.ps1`),n=y.join(e,`Documents`,`PowerShell`,`Microsoft.PowerShell_profile.ps1`);return S.existsSync(n)?n:S.existsSync(t)?t:n}let t=y.join(e,`.bashrc`);if(S.existsSync(t))return t}let n=y.join(e,`.zshrc`);if(S.existsSync(n))return n;let r=y.join(e,`.bashrc`);return S.existsSync(r)?r:null}function W(e){return e.endsWith(`.ps1`)}function G(e){return e.includes(`config.fish`)}function Je(e,t,n){if(!/^[A-Z_][A-Z0-9_]*$/i.test(e))return{success:!1,message:`Invalid environment variable name: ${e}. Must start with a letter or underscore and contain only alphanumeric characters and underscores.`};if(typeof t!=`string`||t.includes(`
3120
- `)||t.includes(`\r`))return{success:!1,message:`Invalid value: must be a single-line string without newlines`};let r=qe();if(!r)return{success:!1,message:`Could not determine shell type (zsh, bash, fish, or PowerShell)`};try{let i=y.dirname(r);if(S.existsSync(i)||S.mkdirSync(i,{recursive:!0}),!S.existsSync(r)){let e=process.platform===`darwin`&&r.endsWith(`.bash_profile`);if(W(r)||e)S.writeFileSync(r,``);else return{success:!1,shellConfigFile:r,message:`Shell config file ${r} not found`}}let a=S.readFileSync(r,`utf8`),o;if(o=W(r)?RegExp(`^\\s*\\$env:${e}\\s*=`,`m`).test(a):G(r)?RegExp(`^\\s*set\\s+-[gux]*x[gux]*\\s+${e}\\s+`,`m`).test(a):RegExp(`^\\s*export\\s+${e}\\s*=`,`m`).test(a),o)return{success:!0,shellConfigFile:r,message:`${e} already configured`,alreadyExists:!0};let s,c;W(r)?(s=`$env:${e} = "${t.replace(/["`$]/g,"`$&")}"`,c=`#`):G(r)?(s=`set -gx ${e} '${t.replace(/'/g,`'\\''`)}'`,c=`#`):(s=`export ${e}='${t.replace(/'/g,`'\\''`)}'`,c=`#`);let l=`\n${n?`${c} ${n}\n`:``}${s}\n`;return S.appendFileSync(r,l),{success:!0,shellConfigFile:r,message:`Added ${e} to ${r}`}}catch(e){return{success:!1,shellConfigFile:r,message:`Failed to modify shell config: ${e.message}`}}}function Ye(){return Je(`ENABLE_EXPERIMENTAL_MCP_CLI`,`true`,`Claude Code deferred MCP loading (added by TaskGraph)`)}function Xe(e){let{name:t,displayName:n=t,profileDir:r=`.${t.toLowerCase()}`,rulesDir:i=`${r}/rules`,mcpConfig:a=!0,mcpConfigName:o=a?`mcp.json`:null,fileMap:s={},onAdd:c,onPostConvert:l}=e,u=o?y.join(r,o):null,f=null;try{let e=Ke(t);e?.supportsCommands&&(f={profile:e,commands:Ue})}catch(e){d(`debug`,`[${n}] Slash command profile lookup failed: ${e.message}`)}return{profileName:t,displayName:n,profileDir:r,rulesDir:i,mcpConfig:a,mcpConfigName:o,mcpConfigPath:u,fileMap:s,slashCommands:f,...c&&{onAddRulesProfile:c},...l&&{onPostConvertRulesProfile:l}}}function Ze(e,t){d(`info`,`[Claude] Commands and agents are now available via the TaskGraph plugin`),d(`info`,`[Claude] Install with: /plugin marketplace add taskgraph`),d(`info`,`[Claude] Then: /plugin install taskgraph@taskgraph`);let n=y.join(t,`AGENTS.md`),r=y.join(e,`CLAUDE.md`),i=y.join(e,`.taskgraph`,`CLAUDE.md`),a=`@./.taskgraph/CLAUDE.md`,o=`\n## TaskGraph Instructions\n**Import TaskGraph's development workflow commands and guidelines, treat as if import is in the main CLAUDE.md file.**\n${a}`;if(S.existsSync(n))try{let t=y.join(e,`.taskgraph`);if(S.existsSync(t)||S.mkdirSync(t,{recursive:!0}),S.copyFileSync(n,i),d(`debug`,`[Claude] Created TaskGraph instructions at ${i}`),S.existsSync(r)){let e=S.readFileSync(r,`utf8`);if(e.includes(a))d(`info`,`[Claude] TaskGraph import already present in ${r}`);else{let t=e.trim()+`
3118
+ - Client reports`)];var Ve=class{supportsNestedCommands=!0;get supportsCommands(){return this.commandsDir!==``}formatAll(e){return e.map(e=>this.format(e))}getFilename(e){return this.supportsNestedCommands?`${e}${this.extension}`:`tm-${e}${this.extension}`}transformArgumentPlaceholder(e){return e}postProcess(e){return e}getCommandsPath(e){return this.supportsNestedCommands?_.join(e,this.commandsDir,`tm`):_.join(e,this.commandsDir)}addSlashCommands(e,t){let n=this.getCommandsPath(e),r=[];if(!this.supportsCommands)return{success:!1,count:0,directory:n,files:[],error:`Profile "${this.name}" does not support slash commands`};try{b.existsSync(n)||b.mkdirSync(n,{recursive:!0});let e=this.formatAll(t);for(let t of e){let e=_.join(n,t.filename);b.writeFileSync(e,t.content),r.push(t.filename)}return{success:!0,count:r.length,directory:n,files:r}}catch(e){return{success:!1,count:0,directory:n,files:[],error:e instanceof Error?e.message:String(e)}}}removeSlashCommands(e,t,n=!0){let r=this.getCommandsPath(e),i=[];if(!this.supportsCommands)return{success:!1,count:0,directory:r,files:[],error:`Profile "${this.name}" does not support slash commands`};if(!b.existsSync(r))return{success:!0,count:0,directory:r,files:[]};try{let e=new Set(t.map(e=>{let t=e.metadata.name.toLowerCase();return this.supportsNestedCommands?t:`tm-${t}`})),a=b.readdirSync(r);for(let t of a){let n=_.basename(t,_.extname(t)).toLowerCase();if(e.has(n)){let e=_.join(r,t);b.rmSync(e,{force:!0}),i.push(t)}}return n&&b.readdirSync(r).length===0&&b.rmSync(r,{recursive:!0,force:!0}),{success:!0,count:i.length,directory:r,files:i}}catch(e){return{success:!1,count:i.length,directory:r,files:i,error:e instanceof Error?e.message:String(e)}}}};const He={claude:new class extends Ve{name=`claude`;displayName=`Claude Code`;commandsDir=`.claude/commands`;extension=`.md`;format(e){let t=this.buildHeader(e),n=this.transformArgumentPlaceholder(e.content);return{filename:this.getFilename(e.metadata.name),content:`${t}${n}`}}buildHeader(e){let t=[e.metadata.description,``];return e.metadata.argumentHint&&(t.push(`Arguments: $ARGUMENTS`),t.push(``)),t.join(`
3119
+ `)}}};function Ue(e){return He[e.toLowerCase()]}function We(){let e=E.homedir(),t=process.env.SHELL||``;if(t.includes(`zsh`))return v.join(e,`.zshrc`);if(t.includes(`bash`)){let t=v.join(e,`.bash_profile`);return process.platform===`darwin`?t:v.join(e,`.bashrc`)}if(t.includes(`fish`))return v.join(e,`.config`,`fish`,`config.fish`);if(process.platform===`win32`){if(process.env.PSModulePath){let t=process.env.PROFILE||v.join(e,`Documents`,`WindowsPowerShell`,`Microsoft.PowerShell_profile.ps1`),n=v.join(e,`Documents`,`PowerShell`,`Microsoft.PowerShell_profile.ps1`);return x.existsSync(n)?n:x.existsSync(t)?t:n}let t=v.join(e,`.bashrc`);if(x.existsSync(t))return t}let n=v.join(e,`.zshrc`);if(x.existsSync(n))return n;let r=v.join(e,`.bashrc`);return x.existsSync(r)?r:null}function W(e){return e.endsWith(`.ps1`)}function G(e){return e.includes(`config.fish`)}function Ge(e,t,n){if(!/^[A-Z_][A-Z0-9_]*$/i.test(e))return{success:!1,message:`Invalid environment variable name: ${e}. Must start with a letter or underscore and contain only alphanumeric characters and underscores.`};if(typeof t!=`string`||t.includes(`
3120
+ `)||t.includes(`\r`))return{success:!1,message:`Invalid value: must be a single-line string without newlines`};let r=We();if(!r)return{success:!1,message:`Could not determine shell type (zsh, bash, fish, or PowerShell)`};try{let i=v.dirname(r);if(x.existsSync(i)||x.mkdirSync(i,{recursive:!0}),!x.existsSync(r)){let e=process.platform===`darwin`&&r.endsWith(`.bash_profile`);if(W(r)||e)x.writeFileSync(r,``);else return{success:!1,shellConfigFile:r,message:`Shell config file ${r} not found`}}let a=x.readFileSync(r,`utf8`),o;if(o=W(r)?RegExp(`^\\s*\\$env:${e}\\s*=`,`m`).test(a):G(r)?RegExp(`^\\s*set\\s+-[gux]*x[gux]*\\s+${e}\\s+`,`m`).test(a):RegExp(`^\\s*export\\s+${e}\\s*=`,`m`).test(a),o)return{success:!0,shellConfigFile:r,message:`${e} already configured`,alreadyExists:!0};let s,c;W(r)?(s=`$env:${e} = "${t.replace(/["`$]/g,"`$&")}"`,c=`#`):G(r)?(s=`set -gx ${e} '${t.replace(/'/g,`'\\''`)}'`,c=`#`):(s=`export ${e}='${t.replace(/'/g,`'\\''`)}'`,c=`#`);let l=`\n${n?`${c} ${n}\n`:``}${s}\n`;return x.appendFileSync(r,l),{success:!0,shellConfigFile:r,message:`Added ${e} to ${r}`}}catch(e){return{success:!1,shellConfigFile:r,message:`Failed to modify shell config: ${e.message}`}}}function Ke(){return Ge(`ENABLE_EXPERIMENTAL_MCP_CLI`,`true`,`Claude Code deferred MCP loading (added by TaskGraph)`)}function qe(e){let{name:t,displayName:n=t,profileDir:r=`.${t.toLowerCase()}`,rulesDir:i=`${r}/rules`,mcpConfig:a=!0,mcpConfigName:o=a?`mcp.json`:null,fileMap:s={},onAdd:c,onPostConvert:l}=e,u=o?v.join(r,o):null,f=null;try{let e=Ue(t);e?.supportsCommands&&(f={profile:e,commands:Be})}catch(e){d(`debug`,`[${n}] Slash command profile lookup failed: ${e.message}`)}return{profileName:t,displayName:n,profileDir:r,rulesDir:i,mcpConfig:a,mcpConfigName:o,mcpConfigPath:u,fileMap:s,slashCommands:f,...c&&{onAddRulesProfile:c},...l&&{onPostConvertRulesProfile:l}}}function Je(e,t){d(`info`,`[Claude] Commands and agents are now available via the TaskGraph plugin`),d(`info`,`[Claude] Install with: /plugin marketplace add taskgraph`),d(`info`,`[Claude] Then: /plugin install taskgraph@taskgraph`);let n=v.join(t,`AGENTS.md`),r=v.join(e,`CLAUDE.md`),i=v.join(e,`.taskgraph`,`CLAUDE.md`),a=`@./.taskgraph/CLAUDE.md`,o=`\n## TaskGraph Instructions\n**Import TaskGraph's development workflow commands and guidelines, treat as if import is in the main CLAUDE.md file.**\n${a}`;if(x.existsSync(n))try{let t=v.join(e,`.taskgraph`);if(x.existsSync(t)||x.mkdirSync(t,{recursive:!0}),x.copyFileSync(n,i),d(`debug`,`[Claude] Created TaskGraph instructions at ${i}`),x.existsSync(r)){let e=x.readFileSync(r,`utf8`);if(e.includes(a))d(`info`,`[Claude] TaskGraph import already present in ${r}`);else{let t=e.trim()+`
3121
3121
  `+o+`
3122
- `;S.writeFileSync(r,t),d(`info`,`[Claude] Added TaskGraph import to existing ${r}`)}}else{let e=`# Claude Code Instructions\n${o}\n`;S.writeFileSync(r,e),d(`info`,`[Claude] Created ${r} with TaskGraph import`)}}catch(e){d(`error`,`[Claude] Failed to set up Claude instructions: ${e.message}`)}let s=Ye();s.success?s.alreadyExists?d(`debug`,`[Claude] Deferred MCP loading already configured`):(d(`info`,`[Claude] Enabled deferred MCP loading in ${s.shellConfigFile}`),d(`info`,`[Claude] Restart your terminal for changes to take effect`)):d(`debug`,`[Claude] Could not configure deferred loading: ${s.message}`)}function Qe(e){let t={};if(e.mcpServers){t.mcpServers={};for(let[n,r]of Object.entries(e.mcpServers)){let e={};e.type=`stdio`,r.command&&(e.command=r.command),r.args&&(e.args=r.args),r.env&&(e.env=r.env),Object.keys(r).forEach(t=>{[`command`,`args`,`env`,`type`].includes(t)||(e[t]=r[t])}),t.mcpServers[n]=e}}return t}function $e(e,t){let n=y.join(e,`.mcp.json`);if(S.existsSync(n))try{let e=Qe(JSON.parse(S.readFileSync(n,`utf8`)));S.writeFileSync(n,JSON.stringify(e,null,` `)+`
3123
- `),d(`debug`,`[Claude] Transformed MCP configuration to Claude format at ${n}`)}catch(e){d(`error`,`[Claude] Failed to transform MCP configuration: ${e.message}`)}}const et=Xe({name:`claude`,displayName:`Claude Code`,profileDir:`.`,rulesDir:`.`,mcpConfigName:`.mcp.json`,fileMap:{"AGENTS.md":`.taskgraph/CLAUDE.md`},onAdd:Ze,onPostConvert:$e});var tt=e({claudeProfile:()=>et});function nt(e){return E.includes(e)}function rt(e){if(!nt(e))return null;let t=tt[`${e}Profile`];if(!t)throw Error(`Profile not found: static import missing for '${e}'. Valid profiles: ${E.join(`, `)}`);return t}function it(e,t){let n=y.join(e,t.rulesDir),r=0;if(typeof t.onAddRulesProfile==`function`)try{t.onAddRulesProfile(n,I()),d(`debug`,`[Rule Transformer] Called onAddRulesProfile for ${t.profileName}`)}catch(e){d(`error`,`[Rule Transformer] onAddRulesProfile failed for ${t.profileName}: ${e.message}`),r++}if(t.mcpConfig!==!1)try{ge(e,t.mcpConfigPath),d(`debug`,`[Rule Transformer] Setup MCP configuration for ${t.profileName}`)}catch(e){d(`error`,`[Rule Transformer] MCP setup failed for ${t.profileName}: ${e.message}`)}if(typeof t.onPostConvertRulesProfile==`function`)try{t.onPostConvertRulesProfile(n,I()),d(`debug`,`[Rule Transformer] Called onPostConvertRulesProfile for ${t.profileName}`)}catch(e){d(`error`,`[Rule Transformer] onPostConvertRulesProfile failed for ${t.profileName}: ${e.message}`)}if(t.slashCommands)try{let n=t.slashCommands.profile.addSlashCommands(e,t.slashCommands.commands);n.success?d(`debug`,`[Rule Transformer] Created ${n.count} slash commands in ${n.directory}`):d(`error`,`[Rule Transformer] Failed to add slash commands for ${t.profileName}: ${n.error}`)}catch(e){d(`error`,`[Rule Transformer] Slash commands failed for ${t.profileName}: ${e.message}`)}return{success:1,failed:r}}function at(){let e=(e,t)=>`${p.text(`${e}. `)}${_.yellow(t)}`,t=(e,t)=>`${p.text(e?` └─ `:` ├─ `)}${t}`,n=e=>`${_.dim(`CLI: `)}${_.cyan(e)}`,r=[e(1,`Choose your AI models (optional)`),t(!1,`${_.dim(`Models: Use `)}${_.cyan(`taskgraph models --setup`)}`),t(!0,_.dim("AI calls run through your signed-in Claude Code (run `claude` once to sign in)")),e(2,`Discuss your idea with AI and create a PRD`),t(!1,`${_.dim(`Simple projects: Use `)}${_.cyan(`example_prd.txt`)}${_.dim(` template`)}`),t(!0,`${_.dim(`Complex systems: Use `)}${_.cyan(`example_prd_rpg.txt`)}${_.dim(` template`)}`),e(3,`Parse your PRD to generate initial tasks`),t(!0,n(`taskgraph parse-prd .taskgraph/docs/prd.md`)),e(4,`Analyze task complexity`),t(!0,n(`taskgraph analyze-complexity --research`)),e(5,`Expand tasks into subtasks`),t(!0,n(`taskgraph expand --all --research`)),e(6,`Start working on tasks`),t(!0,n(`taskgraph next`)),`${p.text(`7. `)}${_.green.bold(`Ship it!`)}`],i=`${_.dim(`* Run `)}${_.cyan(`taskgraph --help`)}${_.dim(` to see all available commands`)}`;return`${_.cyan.bold(`Things you should do next:`)}\n\n${r.join(`
3124
- `)}\n\n${i}`}function ot(e){try{let t=JSON.parse(S.readFileSync(e,`utf-8`));for(let e of[`main`,`research`,`fallback`])if(t.models&&t.models[e]){let n=t.models[e].provider,r=t.models[e].modelId;if(c[n]){let i=c[n].find(e=>e.id===r);i&&i.max_tokens&&(t.models[e].maxTokens=i.max_tokens)}}return S.writeFileSync(e,JSON.stringify(t,null,2)),!0}catch(e){return console.error(`Error updating config maxTokens:`,e.message),!1}}const K={debug:0,info:1,warn:2,error:3,success:4},st=process.env.TASKGRAPH_LOG_LEVEL?K[process.env.TASKGRAPH_LOG_LEVEL.toLowerCase()]:K.info;function q(){f()||g()}function J(e,...t){let n={debug:p.muted(`•`),info:p.brand(`→`),warn:_.yellow(`!`),error:_.red(`✗`),success:_.green(`✓`)};if(K[e]>=st){let r=n[e]||``;f()||(e===`error`?console.error(r,_.red(...t)):e===`warn`?console.warn(r,_.yellow(...t)):e===`success`?console.log(r,_.green(...t)):e===`info`?console.log(r,p.brand(...t)):console.log(r,...t))}if(process.env.DEBUG===`true`){let n=`[${e.toUpperCase()}] ${t.join(` `)}\n`;S.appendFileSync(`init-debug.log`,n)}}function Y(e){S.existsSync(e)||(S.mkdirSync(e,{recursive:!0}),J(`info`,`Created directory: ${e}`))}function X(){let e=process.env.HOME||process.env.USERPROFILE,t;if(process.env.SHELL?.includes(`zsh`))t=y.join(e,`.zshrc`);else if(process.env.SHELL?.includes(`bash`))t=y.join(e,`.bashrc`);else return J(`debug`,`Could not determine shell type. Aliases not added.`),!1;try{if(!S.existsSync(t))return J(`debug`,`Shell config file ${t} not found.`),!1;let e=S.readFileSync(t,`utf8`),n=[{name:`tm`,line:`alias tm='taskgraph'`},{name:`taskgraph`,line:`alias taskgraph='taskgraph'`}].filter(t=>!e.includes(t.line));if(n.length===0)return J(`debug`,`All TaskGraph aliases already exist.`),!0;let r=n.map(e=>e.line).join(`
3122
+ `;x.writeFileSync(r,t),d(`info`,`[Claude] Added TaskGraph import to existing ${r}`)}}else{let e=`# Claude Code Instructions\n${o}\n`;x.writeFileSync(r,e),d(`info`,`[Claude] Created ${r} with TaskGraph import`)}}catch(e){d(`error`,`[Claude] Failed to set up Claude instructions: ${e.message}`)}let s=Ke();s.success?s.alreadyExists?d(`debug`,`[Claude] Deferred MCP loading already configured`):(d(`info`,`[Claude] Enabled deferred MCP loading in ${s.shellConfigFile}`),d(`info`,`[Claude] Restart your terminal for changes to take effect`)):d(`debug`,`[Claude] Could not configure deferred loading: ${s.message}`)}function Ye(e){let t={};if(e.mcpServers){t.mcpServers={};for(let[n,r]of Object.entries(e.mcpServers)){let e={};e.type=`stdio`,r.command&&(e.command=r.command),r.args&&(e.args=r.args),r.env&&(e.env=r.env),Object.keys(r).forEach(t=>{[`command`,`args`,`env`,`type`].includes(t)||(e[t]=r[t])}),t.mcpServers[n]=e}}return t}function Xe(e,t){let n=v.join(e,`.mcp.json`);if(x.existsSync(n))try{let e=Ye(JSON.parse(x.readFileSync(n,`utf8`)));x.writeFileSync(n,JSON.stringify(e,null,` `)+`
3123
+ `),d(`debug`,`[Claude] Transformed MCP configuration to Claude format at ${n}`)}catch(e){d(`error`,`[Claude] Failed to transform MCP configuration: ${e.message}`)}}const Ze=qe({name:`claude`,displayName:`Claude Code`,profileDir:`.`,rulesDir:`.`,mcpConfigName:`.mcp.json`,fileMap:{"AGENTS.md":`.taskgraph/CLAUDE.md`},onAdd:Je,onPostConvert:Xe});var Qe=/* @__PURE__ */ e({claudeProfile:()=>Ze});function $e(e){return O.includes(e)}function et(e){if(!$e(e))return null;let t=Qe[`${e}Profile`];if(!t)throw Error(`Profile not found: static import missing for '${e}'. Valid profiles: ${O.join(`, `)}`);return t}function tt(e,t){let n=v.join(e,t.rulesDir),r=0;if(typeof t.onAddRulesProfile==`function`)try{t.onAddRulesProfile(n,F()),d(`debug`,`[Rule Transformer] Called onAddRulesProfile for ${t.profileName}`)}catch(e){d(`error`,`[Rule Transformer] onAddRulesProfile failed for ${t.profileName}: ${e.message}`),r++}if(t.mcpConfig!==!1)try{pe(e,t.mcpConfigPath),d(`debug`,`[Rule Transformer] Setup MCP configuration for ${t.profileName}`)}catch(e){d(`error`,`[Rule Transformer] MCP setup failed for ${t.profileName}: ${e.message}`)}if(typeof t.onPostConvertRulesProfile==`function`)try{t.onPostConvertRulesProfile(n,F()),d(`debug`,`[Rule Transformer] Called onPostConvertRulesProfile for ${t.profileName}`)}catch(e){d(`error`,`[Rule Transformer] onPostConvertRulesProfile failed for ${t.profileName}: ${e.message}`)}if(t.slashCommands)try{let n=t.slashCommands.profile.addSlashCommands(e,t.slashCommands.commands);n.success?d(`debug`,`[Rule Transformer] Created ${n.count} slash commands in ${n.directory}`):d(`error`,`[Rule Transformer] Failed to add slash commands for ${t.profileName}: ${n.error}`)}catch(e){d(`error`,`[Rule Transformer] Slash commands failed for ${t.profileName}: ${e.message}`)}return{success:1,failed:r}}function K(){let e=(e,t)=>`${p.text(`${e}. `)}${g.yellow(t)}`,t=(e,t)=>`${p.text(e?` └─ `:` ├─ `)}${t}`,n=e=>`${g.dim(`CLI: `)}${g.cyan(e)}`,r=[e(1,`Choose your AI models (optional)`),t(!1,`${g.dim(`Models: Use `)}${g.cyan(`taskgraph models --setup`)}`),t(!0,g.dim("AI calls run through your signed-in Claude Code (run `claude` once to sign in)")),e(2,`Discuss your idea with AI and create a PRD`),t(!1,`${g.dim(`Simple projects: Use `)}${g.cyan(`example_prd.txt`)}${g.dim(` template`)}`),t(!0,`${g.dim(`Complex systems: Use `)}${g.cyan(`example_prd_rpg.txt`)}${g.dim(` template`)}`),e(3,`Parse your PRD to generate initial tasks`),t(!0,n(`taskgraph parse-prd .taskgraph/docs/prd.md`)),e(4,`Analyze task complexity`),t(!0,n(`taskgraph analyze-complexity --research`)),e(5,`Expand tasks into subtasks`),t(!0,n(`taskgraph expand --all --research`)),e(6,`Start working on tasks`),t(!0,n(`taskgraph next`)),`${p.text(`7. `)}${g.green.bold(`Ship it!`)}`],i=`${g.dim(`* Run `)}${g.cyan(`taskgraph --help`)}${g.dim(` to see all available commands`)}`;return`${g.cyan.bold(`Things you should do next:`)}\n\n${r.join(`
3124
+ `)}\n\n${i}`}function nt(e){try{let t=JSON.parse(x.readFileSync(e,`utf-8`));for(let e of[`main`,`research`,`fallback`])if(t.models&&t.models[e]){let n=t.models[e].provider,r=t.models[e].modelId;if(c[n]){let i=c[n].find(e=>e.id===r);i&&i.max_tokens&&(t.models[e].maxTokens=i.max_tokens)}}return x.writeFileSync(e,JSON.stringify(t,null,2)),!0}catch(e){return console.error(`Error updating config maxTokens:`,e.message),!1}}const q={debug:0,info:1,warn:2,error:3,success:4},rt=process.env.TASKGRAPH_LOG_LEVEL?q[process.env.TASKGRAPH_LOG_LEVEL.toLowerCase()]:q.info;function it(){f()||h()}function J(e,...t){let n={debug:p.muted(`•`),info:p.brand(`→`),warn:g.yellow(`!`),error:g.red(`✗`),success:g.green(`✓`)};if(q[e]>=rt){let r=n[e]||``;f()||(e===`error`?console.error(r,g.red(...t)):e===`warn`?console.warn(r,g.yellow(...t)):e===`success`?console.log(r,g.green(...t)):e===`info`?console.log(r,p.brand(...t)):console.log(r,...t))}if(process.env.DEBUG===`true`){let n=`[${e.toUpperCase()}] ${t.join(` `)}\n`;x.appendFileSync(`init-debug.log`,n)}}function Y(e){x.existsSync(e)||(x.mkdirSync(e,{recursive:!0}),J(`info`,`Created directory: ${e}`))}function X(){let e=process.env.HOME||process.env.USERPROFILE,t;if(process.env.SHELL?.includes(`zsh`))t=v.join(e,`.zshrc`);else if(process.env.SHELL?.includes(`bash`))t=v.join(e,`.bashrc`);else return J(`debug`,`Could not determine shell type. Aliases not added.`),!1;try{if(!x.existsSync(t))return J(`debug`,`Shell config file ${t} not found.`),!1;let e=x.readFileSync(t,`utf8`),n=[{name:`tm`,line:`alias tm='taskgraph'`},{name:`taskgraph`,line:`alias taskgraph='taskgraph'`}].filter(t=>!e.includes(t.line));if(n.length===0)return J(`debug`,`All TaskGraph aliases already exist.`),!0;let r=n.map(e=>e.line).join(`
3125
3125
  `),i=`
3126
- # TaskGraph aliases added on ${new Date().toLocaleDateString()}
3126
+ # TaskGraph aliases added on ${(/* @__PURE__ */ new Date()).toLocaleDateString()}
3127
3127
  ${r}
3128
- `;return S.appendFileSync(t,i),J(`debug`,`Added ${n.length} alias(es): ${n.map(e=>e.name).join(`, `)}`),!0}catch(e){return J(`debug`,`Failed to add aliases: ${e.message}`),!1}}function ct(e){let t=y.join(e,l);if(S.existsSync(t)){J(`debug`,`State file already exists, preserving current configuration`);return}let n={currentTag:`master`,lastSwitched:new Date().toISOString(),branchTagMapping:{},migrationNoticeShown:!1};try{S.writeFileSync(t,JSON.stringify(n,null,2)),J(`success`,`Created initial state file: ${t}`),J(`info`,`Default tag set to "master" for task organization`)}catch(e){J(`error`,`Failed to create state file: ${e.message}`)}}function Z(e,t,n={}){if(!R(e)){J(`error`,`Source file not found: ${e}`);return}let r=z(e,`utf8`);if(Object.entries(n).forEach(([e,t])=>{let n=RegExp(`\\{\\{${e}\\}\\}`,`g`);r=r.replace(n,t)}),S.existsSync(t)){let e=y.basename(t);if(e===`.gitignore`){J(`info`,`${t} already exists, merging content...`);let e=S.readFileSync(t,`utf8`),n=new Set(e.split(`
3128
+ `;return x.appendFileSync(t,i),J(`debug`,`Added ${n.length} alias(es): ${n.map(e=>e.name).join(`, `)}`),!0}catch(e){return J(`debug`,`Failed to add aliases: ${e.message}`),!1}}function at(e){let t=v.join(e,l);if(x.existsSync(t)){J(`debug`,`State file already exists, preserving current configuration`);return}let n={currentTag:`master`,lastSwitched:(/* @__PURE__ */ new Date()).toISOString(),branchTagMapping:{},migrationNoticeShown:!1};try{x.writeFileSync(t,JSON.stringify(n,null,2)),J(`success`,`Created initial state file: ${t}`),J(`info`,`Default tag set to "master" for task organization`)}catch(e){J(`error`,`Failed to create state file: ${e.message}`)}}function Z(e,t,n={}){if(!L(e)){J(`error`,`Source file not found: ${e}`);return}let r=R(e,`utf8`);if(Object.entries(n).forEach(([e,t])=>{let n=RegExp(`\\{\\{${e}\\}\\}`,`g`);r=r.replace(n,t)}),x.existsSync(t)){let e=v.basename(t);if(e===`.gitignore`){J(`info`,`${t} already exists, merging content...`);let e=x.readFileSync(t,`utf8`),n=new Set(e.split(`
3129
3129
  `).map(e=>e.trim())),i=r.split(`
3130
3130
  `).filter(e=>!n.has(e.trim()));if(i.length>0){let n=`${e.trim()}\n\n# Added by TaskGraph\n${i.join(`
3131
- `)}`;S.writeFileSync(t,n),J(`success`,`Updated ${t} with additional entries`)}else J(`info`,`No new content to add to ${t}`);return}if(e===`README-taskgraph.md`){J(`info`,`${t} already exists`);let e=y.join(y.dirname(t),`README-taskgraph.md`);S.writeFileSync(e,r),J(`success`,`Created ${e} (preserved original README-taskgraph.md)`);return}J(`debug`,`${t} already exists, skipping.`);return}S.writeFileSync(t,r),J(`info`,`Created file: ${t}`)}async function lt(e={}){f()||q(),e.git===!0?e.initGit=!0:e.git===!1&&(e.initGit=!1),e.gitTasks===!0?e.storeTasksInGit=!0:e.gitTasks===!1&&(e.storeTasksInGit=!1);let t=e.yes||e.name&&e.description,n;if(n=e.rulesExplicitlyProvided?e.rules:[],t){f()||console.log(`SKIPPING PROMPTS - Using defaults or provided values`),e.name,e.description,e.version,e.author;let t=e.dryRun||!1,r=e.initGit===void 0?!0:e.initGit,i=e.storeTasksInGit===void 0?!0:e.storeTasksInGit;if(t)return J(`info`,`DRY RUN MODE: No files will be modified`),J(`info`,`Would initialize TaskGraph project`),J(`info`,`Would create/update necessary project files`),J(`info`,`${r?`Would initialize Git repository`:`Would skip Git initialization`}`),J(`info`,`${i?`Would store tasks in Git`:`Would exclude tasks from Git`}`),{dryRun:!0};await $(!0,r,i,t,{...e,preferredLanguage:`English`},n)}else{J(`debug`,`Required options not provided, proceeding with prompts.`);let t;try{J(`debug`,`Init started - taskgraph_id: ${ut()}`),t=T.createInterface({input:process.stdin,output:process.stdout});let r=!0,i=!0;r=e.initGit===void 0?(await Q(t,_.cyan(`Initialize a Git repository in project root? (Y/n): `),e=>{let t=e.trim().toLowerCase()!==`n`,n=t?_.green(`✓`):_.red(`✗`);return _.cyan(`Initialize a Git repository in project root?`)+` `+n+` `+_.dim(t?`Yes`:`No`)})).trim().toLowerCase()!==`n`:e.initGit,i=e.storeTasksInGit===void 0?(await Q(t,_.cyan(`Store tasks in Git (tasks.json and tasks/ directory)? (Y/n): `),e=>{let t=e.trim().toLowerCase()!==`n`,n=t?_.green(`✓`):_.red(`✗`);return _.cyan(`Store tasks in Git (tasks.json and tasks/ directory)?`)+` `+n+` `+_.dim(t?`Yes`:`No`)})).trim().toLowerCase()!==`n`:e.storeTasksInGit;let a=!1;e.rulesExplicitlyProvided?J(`info`,`Using rule profiles provided via command line: ${n.join(`, `)}`):a=(await Q(t,_.cyan(`Set up Claude Code integration (CLAUDE.md import)? (y/N): `),e=>{let t=e.trim().toLowerCase()===`y`,n=t?_.green(`✓`):_.red(`✗`);return _.cyan(`Set up Claude Code integration?`)+` `+n+` `+_.dim(t?`Yes`:`No`)})).trim().toLowerCase()===`y`;let o=(await Q(t,_.cyan(`Preferred response language (English): `))).trim()||`English`;console.log(`
3132
- `+_.bold(`TaskGraph Project Settings:`)),console.log(_.dim(`─`.repeat(50)));let s=a?_.green(`✓`):_.dim(`✗`);console.log(` `+_.dim(`Claude Code integration:`.padEnd(32)),s+` `+_.dim(a?`Yes`:`No`)),console.log(` `+_.dim(`Response language:`.padEnd(32)),p.text(o));let c=r?_.green(`✓`):_.dim(`✗`);console.log(` `+_.dim(`Initialize Git repository:`.padEnd(32)),c+` `+_.dim(r?`Yes`:`No`));let l=i?_.green(`✓`):_.dim(`✗`);if(console.log(` `+_.dim(`Store tasks in Git:`.padEnd(32)),l+` `+_.dim(i?`Yes`:`No`)),console.log(_.dim(`─`.repeat(50))),(await Q(t,_.yellow(`
3133
- Do you want to continue with these settings? (Y/n): `))).trim().toLowerCase()===`n`){t.close(),J(`info`,`Project initialization cancelled by user`),process.exit(0);return}let u=e.dryRun||!1;if(u)return J(`info`,`DRY RUN MODE: No files will be modified`),J(`info`,`Would initialize TaskGraph project`),J(`info`,`Would create/update necessary project files`),J(`info`,`${r?`Would initialize Git repository`:`Would skip Git initialization`}`),J(`info`,`${i?`Would store tasks in Git`:`Would exclude tasks from Git`}`),{dryRun:!0};await $(!0,r,i,u,{...e,shouldSetupRules:a,preferredLanguage:o},a?E:n),t.close()}catch(e){t&&t.close(),J(`error`,`Error during initialization process: ${e.message}`),process.exit(1)}}}function Q(e,t,n){return new Promise(r=>{e.question(t,e=>{T.moveCursor(process.stdout,0,-1),T.cursorTo(process.stdout,0),T.clearLine(process.stdout,0),n&&process.stdout.write(n(e)+`
3134
- `),r(e)})})}function ut(){return ae()}function dt(e){try{if(!S.existsSync(e)){J(`warn`,`Config file does not exist, skipping storage configuration`);return}let t=S.readFileSync(e,`utf8`),n=JSON.parse(t);n.storage||={},n.storage.type=`file`,n.storage.operatingMode=`solo`,J(`debug`,`Configured storage for local file storage`),S.writeFileSync(e,JSON.stringify(n,null,2)),J(`debug`,`Storage configuration updated in config.json`)}catch(e){J(`error`,`Failed to update storage configuration: ${e.message}`)}}async function $(e,c,l,d,p,g=E){let v=process.cwd();J(`debug`,`Initializing project in ${v}`),Y(y.join(v,a)),Y(y.join(v,i)),Y(y.join(v,u)),Y(y.join(v,t)),Y(y.join(v,o)),ct(v);let b={year:new Date().getFullYear()};function S(e){let t=rt(e);t?it(v,t):J(`warn`,`Unknown rule profile: ${e}`)}Z(`env.example`,y.join(v,n),b),Z(`config.json`,y.join(v,r),{...b});let C=y.join(v,r);ot(C)?J(`debug`,`Updated config with correct maxTokens values`):J(`debug`,`Could not update maxTokens in config`),dt(C);try{let e=z(`gitignore`,`utf8`);pe(y.join(v,s),e,l,J)}catch(e){J(`error`,`Failed to create .gitignore: ${e.message}`)}Z(`example_prd.txt`,y.join(v,ee)),Z(`example_prd_rpg.txt`,y.join(v,o,`example_prd_rpg.txt`));try{c===!1?J(`info`,`Git initialization skipped due to --no-git flag.`):c===!0?m()?J(`debug`,`Existing Git repository detected – skipping git init despite --git flag.`):(J(`info`,`Initializing Git repository due to --git flag...`),x(`git init`,{cwd:v,stdio:`ignore`}),J(`success`,`Git repository initialized`)):m()?J(`debug`,`Existing Git repository detected – skipping git init.`):(J(`info`,`No Git repository detected. Initializing one in project root...`),x(`git init`,{cwd:v,stdio:`ignore`}),J(`success`,`Git repository initialized`))}catch{J(`warn`,`Git not available, skipping repository initialization`)}if(g.length>0){J(`info`,`Setting up Claude Code integration...`);for(let e of g)S(e)}e&&X();let T={cwd:v,stdio:`inherit`};if(f()&&(T.stdio=`ignore`,J(`info`,`Running npm install silently...`)),p.preferredLanguage&&!d)try{let e=(await import(`./response-language-BKY-k633.js`)).default;e(p.preferredLanguage,{projectRoot:v,silent:!0}),J(`debug`,`Response language set to: ${p.preferredLanguage}`)}catch(e){J(`warn`,`Failed to set response language: ${e.message}`)}else f()&&!d?J(`debug`,`Skipping response language setup in silent (MCP) mode.`):d&&J(`debug`,`DRY RUN: Skipping response language setup.`);if(!f()&&!d&&!p?.yes){console.log(w(_.cyan(`Configuring AI Models...`),{padding:.5,margin:{top:1,bottom:.5},borderStyle:`round`,borderColor:`cyan`,width:60})),J(`info`,`Running interactive model setup. Please select your preferred AI models.`);try{x(`npx taskgraph models --setup`,{stdio:`inherit`,cwd:v}),J(`success`,`AI Models configured.`)}catch(e){J(`error`,`Failed to configure AI models:`,e.message),J(`warn`,`You may need to run "taskgraph models --setup" manually.`)}}else f()&&!d?(J(`info`,`Skipping interactive model setup in silent (MCP) mode.`),J(`warn`,`Please configure AI models using "taskgraph models --set-..." or the "models" MCP tool.`)):d?J(`info`,`DRY RUN: Skipping interactive model setup.`):p?.yes&&(J(`info`,`Skipping interactive model setup due to --yes flag.`),J(`info`,`Default AI models will be used. You can configure different models later using "taskgraph models --setup" or "taskgraph models --set-..." commands.`));if(e&&!d?(J(`debug`,`Adding shell aliases...`),X()&&J(`debug`,`Shell aliases added successfully`)):e&&d&&J(`debug`,`DRY RUN: Would add shell aliases (tm, taskgraph)`),f()||console.log(w(`${h.multiline(te.textSync(`Success!`,{font:`Standard`}))}\n${_.green(`Project initialized successfully!`)}`,{padding:1,margin:1,borderStyle:`double`,borderColor:`green`,width:60})),!f()){let e=at();console.log(w(_.yellow.bold(`Workflow
3131
+ `)}`;x.writeFileSync(t,n),J(`success`,`Updated ${t} with additional entries`)}else J(`info`,`No new content to add to ${t}`);return}if(e===`README-taskgraph.md`){J(`info`,`${t} already exists`);let e=v.join(v.dirname(t),`README-taskgraph.md`);x.writeFileSync(e,r),J(`success`,`Created ${e} (preserved original README-taskgraph.md)`);return}J(`debug`,`${t} already exists, skipping.`)}else x.writeFileSync(t,r),J(`info`,`Created file: ${t}`)}async function ot(e={}){f()||it(),e.git===!0?e.initGit=!0:e.git===!1&&(e.initGit=!1),e.gitTasks===!0?e.storeTasksInGit=!0:e.gitTasks===!1&&(e.storeTasksInGit=!1);let t=e.yes||e.name&&e.description,n;if(n=e.rulesExplicitlyProvided?e.rules:[],t){f()||console.log(`SKIPPING PROMPTS - Using defaults or provided values`),e.name,e.description,e.version,e.author;let t=e.dryRun||!1,r=e.initGit===void 0||e.initGit,i=e.storeTasksInGit===void 0||e.storeTasksInGit;if(t)return J(`info`,`DRY RUN MODE: No files will be modified`),J(`info`,`Would initialize TaskGraph project`),J(`info`,`Would create/update necessary project files`),J(`info`,`${r?`Would initialize Git repository`:`Would skip Git initialization`}`),J(`info`,`${i?`Would store tasks in Git`:`Would exclude tasks from Git`}`),{dryRun:!0};await $(!0,r,i,t,{...e,preferredLanguage:`English`},n)}else{J(`debug`,`Required options not provided, proceeding with prompts.`);let t;try{J(`debug`,`Init started - taskgraph_id: ${st()}`),t=w.createInterface({input:process.stdin,output:process.stdout});let r=!0,i=!0;r=e.initGit===void 0?(await Q(t,g.cyan(`Initialize a Git repository in project root? (Y/n): `),e=>{let t=e.trim().toLowerCase()!==`n`,n=t?g.green(`✓`):g.red(`✗`);return g.cyan(`Initialize a Git repository in project root?`)+` `+n+` `+g.dim(t?`Yes`:`No`)})).trim().toLowerCase()!==`n`:e.initGit,i=e.storeTasksInGit===void 0?(await Q(t,g.cyan(`Store tasks in Git (tasks.json and tasks/ directory)? (Y/n): `),e=>{let t=e.trim().toLowerCase()!==`n`,n=t?g.green(`✓`):g.red(`✗`);return g.cyan(`Store tasks in Git (tasks.json and tasks/ directory)?`)+` `+n+` `+g.dim(t?`Yes`:`No`)})).trim().toLowerCase()!==`n`:e.storeTasksInGit;let a=!1;e.rulesExplicitlyProvided?J(`info`,`Using rule profiles provided via command line: ${n.join(`, `)}`):a=(await Q(t,g.cyan(`Set up Claude Code integration (CLAUDE.md import)? (y/N): `),e=>{let t=e.trim().toLowerCase()===`y`,n=t?g.green(`✓`):g.red(`✗`);return g.cyan(`Set up Claude Code integration?`)+` `+n+` `+g.dim(t?`Yes`:`No`)})).trim().toLowerCase()===`y`;let o=(await Q(t,g.cyan(`Preferred response language (English): `))).trim()||`English`;console.log(`
3132
+ `+g.bold(`TaskGraph Project Settings:`)),console.log(g.dim(`─`.repeat(50)));let s=a?g.green(`✓`):g.dim(`✗`);console.log(` `+g.dim(`Claude Code integration:`.padEnd(32)),s+` `+g.dim(a?`Yes`:`No`)),console.log(` `+g.dim(`Response language:`.padEnd(32)),p.text(o));let c=r?g.green(`✓`):g.dim(`✗`);console.log(` `+g.dim(`Initialize Git repository:`.padEnd(32)),c+` `+g.dim(r?`Yes`:`No`));let l=i?g.green(`✓`):g.dim(`✗`);if(console.log(` `+g.dim(`Store tasks in Git:`.padEnd(32)),l+` `+g.dim(i?`Yes`:`No`)),console.log(g.dim(`─`.repeat(50))),(await Q(t,g.yellow(`
3133
+ Do you want to continue with these settings? (Y/n): `))).trim().toLowerCase()===`n`){t.close(),J(`info`,`Project initialization cancelled by user`),process.exit(0);return}let u=e.dryRun||!1;if(u)return J(`info`,`DRY RUN MODE: No files will be modified`),J(`info`,`Would initialize TaskGraph project`),J(`info`,`Would create/update necessary project files`),J(`info`,`${r?`Would initialize Git repository`:`Would skip Git initialization`}`),J(`info`,`${i?`Would store tasks in Git`:`Would exclude tasks from Git`}`),{dryRun:!0};await $(!0,r,i,u,{...e,shouldSetupRules:a,preferredLanguage:o},a?O:n),t.close()}catch(e){t&&t.close(),J(`error`,`Error during initialization process: ${e.message}`),process.exit(1)}}}function Q(e,t,n){return new Promise(r=>{e.question(t,e=>{w.moveCursor(process.stdout,0,-1),w.cursorTo(process.stdout,0),w.clearLine(process.stdout,0),n&&process.stdout.write(n(e)+`
3134
+ `),r(e)})})}function st(){return D()}function ct(e){try{if(!x.existsSync(e)){J(`warn`,`Config file does not exist, skipping storage configuration`);return}let t=x.readFileSync(e,`utf8`),n=JSON.parse(t);n.storage||={},n.storage.type=`file`,n.storage.operatingMode=`solo`,J(`debug`,`Configured storage for local file storage`),x.writeFileSync(e,JSON.stringify(n,null,2)),J(`debug`,`Storage configuration updated in config.json`)}catch(e){J(`error`,`Failed to update storage configuration: ${e.message}`)}}async function $(e,c,l,d,p,h=O){let _=process.cwd();J(`debug`,`Initializing project in ${_}`),Y(v.join(_,a)),Y(v.join(_,i)),Y(v.join(_,u)),Y(v.join(_,t)),Y(v.join(_,o)),at(_);let b={year:(/* @__PURE__ */ new Date()).getFullYear()};function x(e){let t=et(e);t?tt(_,t):J(`warn`,`Unknown rule profile: ${e}`)}Z(`env.example`,v.join(_,n),b),Z(`config.json`,v.join(_,r),{...b});let S=v.join(_,r);nt(S)?J(`debug`,`Updated config with correct maxTokens values`):J(`debug`,`Could not update maxTokens in config`),ct(S);try{let e=R(`gitignore`,`utf8`);de(v.join(_,s),e,l,J)}catch(e){J(`error`,`Failed to create .gitignore: ${e.message}`)}Z(`example_prd.txt`,v.join(_,ee)),Z(`example_prd_rpg.txt`,v.join(_,o,`example_prd_rpg.txt`));try{c===!1?J(`info`,`Git initialization skipped due to --no-git flag.`):c===!0?m()?J(`debug`,`Existing Git repository detected – skipping git init despite --git flag.`):(J(`info`,`Initializing Git repository due to --git flag...`),y(`git init`,{cwd:_,stdio:`ignore`}),J(`success`,`Git repository initialized`)):m()?J(`debug`,`Existing Git repository detected – skipping git init.`):(J(`info`,`No Git repository detected. Initializing one in project root...`),y(`git init`,{cwd:_,stdio:`ignore`}),J(`success`,`Git repository initialized`))}catch{J(`warn`,`Git not available, skipping repository initialization`)}if(h.length>0){J(`info`,`Setting up Claude Code integration...`);for(let e of h)x(e)}if(e&&X(),f()&&J(`info`,`Running npm install silently...`),p.preferredLanguage&&!d)try{let e=(await import(`./response-language-Bjbf2_9z.js`)).default;e(p.preferredLanguage,{projectRoot:_,silent:!0}),J(`debug`,`Response language set to: ${p.preferredLanguage}`)}catch(e){J(`warn`,`Failed to set response language: ${e.message}`)}else f()&&!d?J(`debug`,`Skipping response language setup in silent (MCP) mode.`):d&&J(`debug`,`DRY RUN: Skipping response language setup.`);if(!f()&&!d&&!p?.yes){console.log(C(g.cyan(`Configuring AI Models...`),{padding:.5,margin:{top:1,bottom:.5},borderStyle:`round`,borderColor:`cyan`,width:60})),J(`info`,`Running interactive model setup. Please select your preferred AI models.`);try{y(`npx taskgraph models --setup`,{stdio:`inherit`,cwd:_}),J(`success`,`AI Models configured.`)}catch(e){J(`error`,`Failed to configure AI models:`,e.message),J(`warn`,`You may need to run "taskgraph models --setup" manually.`)}}else f()&&!d?(J(`info`,`Skipping interactive model setup in silent (MCP) mode.`),J(`warn`,`Please configure AI models using "taskgraph models --set-..." or the "models" MCP tool.`)):d?J(`info`,`DRY RUN: Skipping interactive model setup.`):p?.yes&&(J(`info`,`Skipping interactive model setup due to --yes flag.`),J(`info`,`Default AI models will be used. You can configure different models later using "taskgraph models --setup" or "taskgraph models --set-..." commands.`));if(e&&!d?(J(`debug`,`Adding shell aliases...`),X()&&J(`debug`,`Shell aliases added successfully`)):e&&d&&J(`debug`,`DRY RUN: Would add shell aliases (tm, taskgraph)`),f()||console.log(C(`${te.multiline(T.textSync(`Success!`,{font:`Standard`}))}\n${g.green(`Project initialized successfully!`)}`,{padding:1,margin:1,borderStyle:`double`,borderColor:`green`,width:60})),!f()){let e=K();console.log(C(g.yellow.bold(`Workflow
3135
3135
  `)+`
3136
- `+e,{padding:1,margin:{top:0,bottom:1,left:0,right:0},borderStyle:`round`,borderColor:`yellow`,width:60}))}}export{E as n,D as r,lt as t};
3136
+ `+e,{padding:1,margin:{top:0,bottom:1,left:0,right:0},borderStyle:`round`,borderColor:`yellow`,width:60}))}}export{O as n,ne as r,ot as t};