Compare commits
488 Commits
changeset-
...
chore/upda
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ddc521757 | ||
|
|
e7087cf88f | ||
|
|
08f86f19c3 | ||
|
|
f272748965 | ||
|
|
15e15a1f17 | ||
|
|
3a30e9acd4 | ||
|
|
15286c029d | ||
|
|
c39e5158b4 | ||
|
|
4bda8f4d76 | ||
|
|
49976e864b | ||
|
|
30b873a7da | ||
|
|
ab37859a7e | ||
|
|
e704ba12fd | ||
|
|
64b2d8f79e | ||
|
|
bbb4bbcc11 | ||
|
|
8e38348203 | ||
|
|
01b651bddc | ||
|
|
0840ad8316 | ||
|
|
5c726dc542 | ||
|
|
21d988691b | ||
|
|
21839b1cd6 | ||
|
|
6160089b8e | ||
|
|
82bb50619f | ||
|
|
898f15e699 | ||
|
|
1a157567dc | ||
|
|
eb8a3a85a1 | ||
|
|
59a4ec9e1a | ||
|
|
ef1deec947 | ||
|
|
b40139ca05 | ||
|
|
403d7b00ca | ||
|
|
b78614b44e | ||
|
|
19d795d63f | ||
|
|
07ec89ab17 | ||
|
|
eaa7f24280 | ||
|
|
b3d43c5992 | ||
|
|
c5de4f8b68 | ||
|
|
b9299c5af0 | ||
|
|
122a0465d8 | ||
|
|
cf2c06697a | ||
|
|
727f1ec4eb | ||
|
|
648353794e | ||
|
|
a2a3229fd0 | ||
|
|
b592dff8bc | ||
|
|
e9d1bc2385 | ||
|
|
030694bb96 | ||
|
|
3e0f696c49 | ||
|
|
4b0c9d9af6 | ||
|
|
3fa91f56e5 | ||
|
|
e69ac5d5cf | ||
|
|
c60c9354a4 | ||
|
|
30b895be2c | ||
|
|
9995075093 | ||
|
|
b62cb1bbe7 | ||
|
|
7defcba465 | ||
|
|
3e838ed34b | ||
|
|
1b8c320c57 | ||
|
|
5da5b59bde | ||
|
|
04f44a2d3d | ||
|
|
36fe838fd5 | ||
|
|
415b1835d4 | ||
|
|
78112277b3 | ||
|
|
2bb4260966 | ||
|
|
3a2325a963 | ||
|
|
1bd6d4f246 | ||
|
|
a09a2d0967 | ||
|
|
02e0db09df | ||
|
|
3bcce8d70e | ||
|
|
8852831807 | ||
|
|
661d3e04ba | ||
|
|
0dba2cb2da | ||
|
|
9ee7a94056 | ||
|
|
636fb3f680 | ||
|
|
8cde6c2708 | ||
|
|
246acd1035 | ||
|
|
de5acbc6c9 | ||
|
|
664eb5b896 | ||
|
|
dbaf492bdb | ||
|
|
0c8a0b81a0 | ||
|
|
46d4f273f5 | ||
|
|
aa7396d65e | ||
|
|
5119cd2d8e | ||
|
|
44eba3f7d1 | ||
|
|
e82b093dce | ||
|
|
ad3acd874d | ||
|
|
52022d370b | ||
|
|
957af5253b | ||
|
|
c0b3f432a6 | ||
|
|
12bed2b307 | ||
|
|
d76bea49b3 | ||
|
|
0849c0c2ce | ||
|
|
5ec1f61c13 | ||
|
|
292c2caf7f | ||
|
|
526d64fb8a | ||
|
|
1b86ce6c83 | ||
|
|
8a86ec538e | ||
|
|
9e7387952d | ||
|
|
ab05f550b3 | ||
|
|
cf01fbedcf | ||
|
|
d2bcbee0c2 | ||
|
|
72171bd4ba | ||
|
|
9ad517231a | ||
|
|
7db3b47a47 | ||
|
|
3de785a99c | ||
|
|
8188fdd832 | ||
|
|
3fadc2f1ef | ||
|
|
dd36111367 | ||
|
|
c58ab8963c | ||
|
|
3eeb4721aa | ||
|
|
7ea905f2c5 | ||
|
|
51dd4f625b | ||
|
|
2e55757b26 | ||
|
|
54bfc72baa | ||
|
|
faae0b419d | ||
|
|
27edbd8f3f | ||
|
|
b1390e4ddf | ||
|
|
cc04d53720 | ||
|
|
bfd86eb9cc | ||
|
|
9eb3842f04 | ||
|
|
bf2053e140 | ||
|
|
ee0be04302 | ||
|
|
c0707fc399 | ||
|
|
1ece6f1904 | ||
|
|
f4a9ad1095 | ||
|
|
cba86510d3 | ||
|
|
86ea6d1dbc | ||
|
|
a22d2a45b5 | ||
|
|
d73c8e17ec | ||
|
|
4f23751d25 | ||
|
|
7d5c028ca0 | ||
|
|
f18df6da19 | ||
|
|
1754a31372 | ||
|
|
3096ccdfb3 | ||
|
|
6464bb11e5 | ||
|
|
edaa5fe0d5 | ||
|
|
41d9dbbe6d | ||
|
|
6e0d866756 | ||
|
|
926aa61a4e | ||
|
|
9b4168bb4e | ||
|
|
ad612763ff | ||
|
|
293b59bac6 | ||
|
|
1809c4ed7b | ||
|
|
6e406958c1 | ||
|
|
074b7ec0bc | ||
|
|
e0438c8fb8 | ||
|
|
1f6694fb3d | ||
|
|
b0dfcf345e | ||
|
|
3f64202c9f | ||
|
|
669b744ced | ||
|
|
f058543888 | ||
|
|
acd5c1ea3d | ||
|
|
682b54e103 | ||
|
|
6a8a68e1a3 | ||
|
|
80735f9e60 | ||
|
|
48732d5423 | ||
|
|
2d520de269 | ||
|
|
b60e1cf835 | ||
|
|
d1e45ff50e | ||
|
|
1513858da4 | ||
|
|
59dcf4bd64 | ||
|
|
a09ba021c5 | ||
|
|
e906166141 | ||
|
|
231e569e84 | ||
|
|
09add37423 | ||
|
|
91fc779714 | ||
|
|
8c69c0aafd | ||
|
|
43ad75c7fa | ||
|
|
a59dd037cf | ||
|
|
3293c7858b | ||
|
|
b371808524 | ||
|
|
86d8f00af8 | ||
|
|
0c55ce0165 | ||
|
|
5a91941913 | ||
|
|
04af16de27 | ||
|
|
edf0f23005 | ||
|
|
e0e1155260 | ||
|
|
70f4054f26 | ||
|
|
34c769bcd0 | ||
|
|
34df2c8bbd | ||
|
|
5e9bc28abe | ||
|
|
d2e64318e2 | ||
|
|
4c835264ac | ||
|
|
c882f89a8c | ||
|
|
20e1b72a17 | ||
|
|
db631f43a5 | ||
|
|
3b9402f1f8 | ||
|
|
c8c0fc2a57 | ||
|
|
60b8e97a1c | ||
|
|
3a6d6dd671 | ||
|
|
f4a83ec047 | ||
|
|
0699f64299 | ||
|
|
60b8f5faa3 | ||
|
|
cd6e42249e | ||
|
|
fcd80623b6 | ||
|
|
026815353f | ||
|
|
8a3b611fc2 | ||
|
|
6ba42b53dc | ||
|
|
3e304232ab | ||
|
|
70fa5b0031 | ||
|
|
314c0de8c4 | ||
|
|
58b417a8ce | ||
|
|
a8dabf4485 | ||
|
|
bc19bc7927 | ||
|
|
da317f2607 | ||
|
|
ed17cb0e0a | ||
|
|
e96734a6cc | ||
|
|
17294ff259 | ||
|
|
a96215a359 | ||
|
|
0a611843b5 | ||
|
|
a1f8d52474 | ||
|
|
da636f6681 | ||
|
|
ca5ec03cd8 | ||
|
|
c47deeb869 | ||
|
|
dd90c9cb5d | ||
|
|
c7042845d6 | ||
|
|
79a41543d5 | ||
|
|
efce37469b | ||
|
|
4117f71c18 | ||
|
|
9f4bac8d6a | ||
|
|
e53d5e1577 | ||
|
|
59230c4d91 | ||
|
|
04b6a3cb21 | ||
|
|
37178ff1b9 | ||
|
|
bbc8b9cc1f | ||
|
|
c955431753 | ||
|
|
21c3cb8cda | ||
|
|
ab84afd036 | ||
|
|
f89d2aacc0 | ||
|
|
0288311965 | ||
|
|
8ae772086d | ||
|
|
2b3ae8bf89 | ||
|
|
245c3cb398 | ||
|
|
09d839fff5 | ||
|
|
90068348d3 | ||
|
|
02e347d2d7 | ||
|
|
0527c363e3 | ||
|
|
735135efe9 | ||
|
|
4fee667a05 | ||
|
|
01963af2cb | ||
|
|
0633895f3b | ||
|
|
10442c1119 | ||
|
|
734a4fdcfc | ||
|
|
8dace2186c | ||
|
|
095e373843 | ||
|
|
0bc9bac392 | ||
|
|
0a45f4329c | ||
|
|
c4b2f7e514 | ||
|
|
9684beafc3 | ||
|
|
302b916045 | ||
|
|
e7f18f65b9 | ||
|
|
655c7c225a | ||
|
|
e1218b3747 | ||
|
|
ffa621a37c | ||
|
|
cd32fd9edf | ||
|
|
590e4bd66d | ||
|
|
70d3f2f103 | ||
|
|
424aae10ed | ||
|
|
a48d1f13e2 | ||
|
|
25ca1a45a0 | ||
|
|
2e17437da3 | ||
|
|
1f44ea5299 | ||
|
|
d63964a10e | ||
|
|
33559e368c | ||
|
|
9f86306766 | ||
|
|
8f8a3dc45d | ||
|
|
d18351dc38 | ||
|
|
9d437f8594 | ||
|
|
ad89253e31 | ||
|
|
70c5097553 | ||
|
|
c9e4558a19 | ||
|
|
cd4d8e335f | ||
|
|
16297058bb | ||
|
|
ae2d43de29 | ||
|
|
f5585e6c31 | ||
|
|
303b13e3d4 | ||
|
|
1862ca2360 | ||
|
|
ad1c234b4e | ||
|
|
d07f8fddc5 | ||
|
|
c7158d4910 | ||
|
|
2a07d366be | ||
|
|
40df57f969 | ||
|
|
d4a2e34b3b | ||
|
|
d67b21fd43 | ||
|
|
b1beae3042 | ||
|
|
d2f761c652 | ||
|
|
4cf7e8a74a | ||
|
|
5f504fafb8 | ||
|
|
e69a47d382 | ||
|
|
89bb62d44b | ||
|
|
5aea93d4c0 | ||
|
|
66ac9ab9f6 | ||
|
|
ca7b0457f1 | ||
|
|
87d97bba00 | ||
|
|
3516efdc3b | ||
|
|
c8722b0a7a | ||
|
|
ed79d4f473 | ||
|
|
2517bc112c | ||
|
|
842eaf7224 | ||
|
|
96aeeffc19 | ||
|
|
5a2371b7cc | ||
|
|
b47f189cc2 | ||
|
|
36d559db26 | ||
|
|
afb47584bd | ||
|
|
3721359782 | ||
|
|
ef782ff5bd | ||
|
|
99b1a0ad7a | ||
|
|
70cc15bc87 | ||
|
|
ce51b0d3ef | ||
|
|
a82284a2db | ||
|
|
205a11e82c | ||
|
|
be3f68e777 | ||
|
|
90c6c1e587 | ||
|
|
6cb213ebbd | ||
|
|
bd0ee1b6e3 | ||
|
|
8ed651c165 | ||
|
|
2829194d3c | ||
|
|
2acba945c0 | ||
|
|
78a5376796 | ||
|
|
b3b424be93 | ||
|
|
c90578b6da | ||
|
|
3a3ad9f4fe | ||
|
|
abdc15eab2 | ||
|
|
515dcae965 | ||
|
|
a40805adf7 | ||
|
|
4a9f6cd5f5 | ||
|
|
d46547a80f | ||
|
|
bcb885e0ba | ||
|
|
ddf0947710 | ||
|
|
3a6bc43778 | ||
|
|
73aa7ac32e | ||
|
|
538b874582 | ||
|
|
0300582b46 | ||
|
|
3aee9bc840 | ||
|
|
11b8d1bda5 | ||
|
|
ff8e75cded | ||
|
|
3e872f8afb | ||
|
|
0eb16d5ecb | ||
|
|
c17d912237 | ||
|
|
41b979c239 | ||
|
|
d99fa00980 | ||
|
|
b2ccd60526 | ||
|
|
454a1d9d37 | ||
|
|
d181c40a95 | ||
|
|
1ab836f191 | ||
|
|
d84c2486e4 | ||
|
|
329839aeb8 | ||
|
|
c7fefb0549 | ||
|
|
cde23946e9 | ||
|
|
1ceb545d86 | ||
|
|
9a482789f7 | ||
|
|
4c57537157 | ||
|
|
6599cb0bf9 | ||
|
|
48a8d952bc | ||
|
|
94601f1e11 | ||
|
|
9f834f5a27 | ||
|
|
f5c4eda132 | ||
|
|
9122e516b6 | ||
|
|
04de6d9698 | ||
|
|
3530e28ee3 | ||
|
|
08f0319058 | ||
|
|
6f2cda0a6f | ||
|
|
cb720ca298 | ||
|
|
c6b8783bce | ||
|
|
9c0ed3c799 | ||
|
|
d3d9dc6ebe | ||
|
|
30e6d47577 | ||
|
|
140bd3d265 | ||
|
|
5ed2120ee6 | ||
|
|
34c980ee51 | ||
|
|
e88682f881 | ||
|
|
59208ab7a9 | ||
|
|
a86e9affc5 | ||
|
|
6403e96ef9 | ||
|
|
51919950f1 | ||
|
|
39efd11979 | ||
|
|
65e7886506 | ||
|
|
b8e55dd612 | ||
|
|
819fc5d2f7 | ||
|
|
6ec892b2c1 | ||
|
|
08589b2796 | ||
|
|
d2a5f0e6a9 | ||
|
|
e1e3e31998 | ||
|
|
c414d50bdf | ||
|
|
2c63742a85 | ||
|
|
729e033fef | ||
|
|
69e0b3c393 | ||
|
|
da95466ee1 | ||
|
|
4f68bf3b47 | ||
|
|
12519946b4 | ||
|
|
709ea63350 | ||
|
|
ca3d54f7d6 | ||
|
|
8c5d609c9c | ||
|
|
b78535ac19 | ||
|
|
cfe3ba91e8 | ||
|
|
34501878b2 | ||
|
|
af9421b9ae | ||
|
|
42bf897f81 | ||
|
|
5e01399dca | ||
|
|
e6fe5dac85 | ||
|
|
66f16870c6 | ||
|
|
01a5be25a8 | ||
|
|
4386e74ed2 | ||
|
|
5d3d66ee64 | ||
|
|
bf38baf858 | ||
|
|
ab6746a0c0 | ||
|
|
c02483bc41 | ||
|
|
3148b57f1b | ||
|
|
47b79c0e29 | ||
|
|
0dfecec1b3 | ||
|
|
4386d01bf1 | ||
|
|
9a66db0309 | ||
|
|
b7580e038d | ||
|
|
b3e7ebefd9 | ||
|
|
189d9288c1 | ||
|
|
1a547fac91 | ||
|
|
3f1f96076c | ||
|
|
0f9bc3378d | ||
|
|
bdd582b9cb | ||
|
|
693369128d | ||
|
|
2b5fab5cb5 | ||
|
|
e6c062d061 | ||
|
|
689e2de94e | ||
|
|
ab5025e204 | ||
|
|
268577fd20 | ||
|
|
141e8a8585 | ||
|
|
76ecfc086a | ||
|
|
33bb596c01 | ||
|
|
8e478f9e5e | ||
|
|
bad16b200f | ||
|
|
1582fe32c1 | ||
|
|
87b1eb61ee | ||
|
|
f11e00a026 | ||
|
|
feddeafd6e | ||
|
|
d71e7872ea | ||
|
|
01bd121de2 | ||
|
|
cdd87ccc5e | ||
|
|
6442bf5ee1 | ||
|
|
f16a574ad8 | ||
|
|
6393f9f7fb | ||
|
|
74b67830ac | ||
|
|
a49a77d19f | ||
|
|
1a74b50658 | ||
|
|
e04c16cec6 | ||
|
|
3af469b35f | ||
|
|
d5ecca25db | ||
|
|
65f56978b2 | ||
|
|
5e22c8b4ba | ||
|
|
bdd0035fc0 | ||
|
|
c98b0cea11 | ||
|
|
f9ef0c1887 | ||
|
|
0e16d27294 | ||
|
|
3bfbe19fe3 | ||
|
|
087de784fa | ||
|
|
f76b69c935 | ||
|
|
6a6d06766b | ||
|
|
9f430ca48b | ||
|
|
ca87476919 | ||
|
|
fec9e12f49 | ||
|
|
d06e45bf12 | ||
|
|
535fb5be71 | ||
|
|
fba6131db7 | ||
|
|
7f0cdf9046 | ||
|
|
eecad5bfe0 | ||
|
|
fb4a8b6cb7 | ||
|
|
00e01d1d93 | ||
|
|
995e95263c | ||
|
|
0b7b395aa4 | ||
|
|
1679075b6b | ||
|
|
1908c4a337 | ||
|
|
43022d7010 | ||
|
|
04c2dee593 | ||
|
|
d0092a6e6f | ||
|
|
729ae4d2d5 | ||
|
|
219b40b516 | ||
|
|
05950ef318 | ||
|
|
9582c0a91f | ||
|
|
6d01ae3d47 | ||
|
|
d4f92858c2 | ||
|
|
e02ee96aff | ||
|
|
38f9e4deaa | ||
|
|
71410629ba | ||
|
|
450549d875 | ||
|
|
a49f5a117b | ||
|
|
bc9707f813 | ||
|
|
a56a3628b3 | ||
|
|
9dc5e75760 | ||
|
|
16f4d4b932 | ||
|
|
7fef5ab488 | ||
|
|
38e416ef33 |
12
.changeset/bright-llamas-enter.md
Normal file
12
.changeset/bright-llamas-enter.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
"task-master-ai": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix expand command preserving tagged task structure and preventing data corruption
|
||||||
|
|
||||||
|
- Enhance E2E tests with comprehensive tag-aware expand testing to verify tag corruption fix
|
||||||
|
- Add new test section for feature-expand tag creation and testing during expand operations
|
||||||
|
- Verify tag preservation during expand, force expand, and expand --all operations
|
||||||
|
- Test that master tag remains intact while feature-expand tag receives subtasks correctly
|
||||||
|
- Fix file path references to use correct .taskmaster/config.json and .taskmaster/tasks/tasks.json locations
|
||||||
|
- All tag corruption verification tests pass successfully, confirming the expand command tag corruption bug fix works as expected
|
||||||
5
.changeset/chatty-rats-talk.md
Normal file
5
.changeset/chatty-rats-talk.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"task-master-ai": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix Cursor deeplink installation by providing copy-paste instructions for GitHub compatibility
|
||||||
8
.changeset/huge-moose-prove.md
Normal file
8
.changeset/huge-moose-prove.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
"task-master-ai": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Can now configure baseURL of provider with `<PROVIDER>_BASE_URL`
|
||||||
|
|
||||||
|
- For example:
|
||||||
|
- `OPENAI_BASE_URL`
|
||||||
5
.changeset/icy-dryers-hunt.md
Normal file
5
.changeset/icy-dryers-hunt.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"task-master-ai": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Call rules interactive setup during init
|
||||||
5
.changeset/large-wolves-strive.md
Normal file
5
.changeset/large-wolves-strive.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"task-master-ai": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Update o3 model price
|
||||||
17
.changeset/lemon-deer-hide.md
Normal file
17
.changeset/lemon-deer-hide.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
'task-master-ai': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Added comprehensive rule profile management:
|
||||||
|
|
||||||
|
**New Profile Support**: Added comprehensive IDE profile support with eight specialized profiles: Claude Code, Cline, Codex, Cursor, Roo, Trae, VS Code, and Windsurf. Each profile is optimized for its respective IDE with appropriate mappings and configuration.
|
||||||
|
**Initialization**: You can now specify which rule profiles to include at project initialization using `--rules <profiles>` or `-r <profiles>` (e.g., `task-master init -r cursor,roo`). Only the selected profiles and configuration are included.
|
||||||
|
**Add/Remove Commands**: `task-master rules add <profiles>` and `task-master rules remove <profiles>` let you manage specific rule profiles and MCP config after initialization, supporting multiple profiles at once.
|
||||||
|
**Interactive Setup**: `task-master rules setup` launches an interactive prompt to select which rule profiles to add to your project. This does **not** re-initialize your project or affect shell aliases; it only manages rules.
|
||||||
|
**Selective Removal**: Rules removal intelligently preserves existing non-Task Master rules and files and only removes Task Master-specific rules. Profile directories are only removed when completely empty and all conditions are met (no existing rules, no other files/folders, MCP config completely removed).
|
||||||
|
**Safety Features**: Confirmation messages clearly explain that only Task Master-specific rules and MCP configurations will be removed, while preserving existing custom rules and other files.
|
||||||
|
**Robust Validation**: Includes comprehensive checks for array types in MCP config processing and error handling throughout the rules management system.
|
||||||
|
|
||||||
|
This enables more flexible, rule-specific project setups with intelligent cleanup that preserves user customizations while safely managing Task Master components.
|
||||||
|
|
||||||
|
- Resolves #338
|
||||||
5
.changeset/mean-papayas-share.md
Normal file
5
.changeset/mean-papayas-share.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"task-master-ai": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Default to Cursor profile for MCP init when no rules specified
|
||||||
5
.changeset/modern-cats-pick.md
Normal file
5
.changeset/modern-cats-pick.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"task-master-ai": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Improves Amazon Bedrock support
|
||||||
5
.changeset/nasty-berries-tan.md
Normal file
5
.changeset/nasty-berries-tan.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"task-master-ai": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix issues with task creation/update where subtasks are being created like id: <parent_task>.<subtask> instead if just id: <subtask>
|
||||||
8
.changeset/nasty-chefs-add.md
Normal file
8
.changeset/nasty-chefs-add.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
"task-master-ai": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixes issue with expand CLI command "Complexity report not found"
|
||||||
|
|
||||||
|
- Closes #735
|
||||||
|
- Closes #728
|
||||||
10
.changeset/petite-friends-arrive.md
Normal file
10
.changeset/petite-friends-arrive.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
"task-master-ai": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Make task-master more compatible with the "o" family models of OpenAI
|
||||||
|
|
||||||
|
Now works well with:
|
||||||
|
- o3
|
||||||
|
- o3-mini
|
||||||
|
- etc.
|
||||||
23
.changeset/pre.json
Normal file
23
.changeset/pre.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"mode": "exit",
|
||||||
|
"tag": "rc",
|
||||||
|
"initialVersions": {
|
||||||
|
"task-master-ai": "0.17.1"
|
||||||
|
},
|
||||||
|
"changesets": [
|
||||||
|
"bright-llamas-enter",
|
||||||
|
"huge-moose-prove",
|
||||||
|
"icy-dryers-hunt",
|
||||||
|
"lemon-deer-hide",
|
||||||
|
"modern-cats-pick",
|
||||||
|
"nasty-berries-tan",
|
||||||
|
"shy-groups-fly",
|
||||||
|
"sour-lions-check",
|
||||||
|
"spicy-teams-travel",
|
||||||
|
"stale-cameras-sin",
|
||||||
|
"swift-squids-sip",
|
||||||
|
"tiny-dogs-change",
|
||||||
|
"vast-plants-exist",
|
||||||
|
"wet-berries-dress"
|
||||||
|
]
|
||||||
|
}
|
||||||
5
.changeset/shy-groups-fly.md
Normal file
5
.changeset/shy-groups-fly.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"task-master-ai": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Add better support for python projects by adding `pyproject.toml` as a projectRoot marker
|
||||||
5
.changeset/sour-lions-check.md
Normal file
5
.changeset/sour-lions-check.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"task-master-ai": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Store tasks in Git by default
|
||||||
11
.changeset/spicy-teams-travel.md
Normal file
11
.changeset/spicy-teams-travel.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
"task-master-ai": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Improve provider validation system with clean constants structure
|
||||||
|
|
||||||
|
- **Fixed "Invalid provider hint" errors**: Resolved validation failures for Azure, Vertex, and Bedrock providers
|
||||||
|
- **Improved search UX**: Integrated search for better model discovery with real-time filtering
|
||||||
|
- **Better organization**: Moved custom provider options to bottom of model selection with clear section separators
|
||||||
|
|
||||||
|
This change ensures all custom providers (Azure, Vertex, Bedrock, OpenRouter, Ollama) work correctly in `task-master models --setup`
|
||||||
5
.changeset/stale-cameras-sin.md
Normal file
5
.changeset/stale-cameras-sin.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"task-master-ai": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix weird `task-master init` bug when using in certain environments
|
||||||
5
.changeset/swift-squids-sip.md
Normal file
5
.changeset/swift-squids-sip.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"task-master-ai": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Rename Roo Code Boomerang role to Orchestrator
|
||||||
5
.changeset/tiny-dogs-change.md
Normal file
5
.changeset/tiny-dogs-change.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"task-master-ai": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Improve mcp keys check in cursor
|
||||||
22
.changeset/vast-plants-exist.md
Normal file
22
.changeset/vast-plants-exist.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
"task-master-ai": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
- **Git Worktree Detection:**
|
||||||
|
- Now properly skips Git initialization when inside existing Git worktree
|
||||||
|
- Prevents accidental nested repository creation
|
||||||
|
- **Flag System Overhaul:**
|
||||||
|
- `--git`/`--no-git` controls repository initialization
|
||||||
|
- `--aliases`/`--no-aliases` consistently manages shell alias creation
|
||||||
|
- `--git-tasks`/`--no-git-tasks` controls whether task files are stored in Git
|
||||||
|
- `--dry-run` accurately previews all initialization behaviors
|
||||||
|
- **GitTasks Functionality:**
|
||||||
|
- New `--git-tasks` flag includes task files in Git (comments them out in .gitignore)
|
||||||
|
- New `--no-git-tasks` flag excludes task files from Git (default behavior)
|
||||||
|
- Supports both CLI and MCP interfaces with proper parameter passing
|
||||||
|
|
||||||
|
**Implementation Details:**
|
||||||
|
- Added explicit Git worktree detection before initialization
|
||||||
|
- Refactored flag processing to ensure consistent behavior
|
||||||
|
|
||||||
|
- Fixes #734
|
||||||
22
.changeset/wet-berries-dress.md
Normal file
22
.changeset/wet-berries-dress.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
"task-master-ai": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Add Claude Code provider support
|
||||||
|
|
||||||
|
Introduces a new provider that enables using Claude models (Opus and Sonnet) through the Claude Code CLI without requiring an API key.
|
||||||
|
|
||||||
|
Key features:
|
||||||
|
- New claude-code provider with support for opus and sonnet models
|
||||||
|
- No API key required - uses local Claude Code CLI installation
|
||||||
|
- Optional dependency - won't affect users who don't need Claude Code
|
||||||
|
- Lazy loading ensures the provider only loads when requested
|
||||||
|
- Full integration with existing Task Master commands and workflows
|
||||||
|
- Comprehensive test coverage for reliability
|
||||||
|
- New --claude-code flag for the models command
|
||||||
|
|
||||||
|
Users can now configure Claude Code models with:
|
||||||
|
task-master models --set-main sonnet --claude-code
|
||||||
|
task-master models --set-research opus --claude-code
|
||||||
|
|
||||||
|
The @anthropic-ai/claude-code package is optional and won't be installed unless explicitly needed.
|
||||||
147
.claude/TM_COMMANDS_GUIDE.md
Normal file
147
.claude/TM_COMMANDS_GUIDE.md
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
# Task Master Commands for Claude Code
|
||||||
|
|
||||||
|
Complete guide to using Task Master through Claude Code's slash commands.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
All Task Master functionality is available through the `/project:tm/` namespace with natural language support and intelligent features.
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install Task Master
|
||||||
|
/project:tm/setup/quick-install
|
||||||
|
|
||||||
|
# Initialize project
|
||||||
|
/project:tm/init/quick
|
||||||
|
|
||||||
|
# Parse requirements
|
||||||
|
/project:tm/parse-prd requirements.md
|
||||||
|
|
||||||
|
# Start working
|
||||||
|
/project:tm/next
|
||||||
|
```
|
||||||
|
|
||||||
|
## Command Structure
|
||||||
|
|
||||||
|
Commands are organized hierarchically to match Task Master's CLI:
|
||||||
|
- Main commands at `/project:tm/[command]`
|
||||||
|
- Subcommands for specific operations `/project:tm/[command]/[subcommand]`
|
||||||
|
- Natural language arguments accepted throughout
|
||||||
|
|
||||||
|
## Complete Command Reference
|
||||||
|
|
||||||
|
### Setup & Configuration
|
||||||
|
- `/project:tm/setup/install` - Full installation guide
|
||||||
|
- `/project:tm/setup/quick-install` - One-line install
|
||||||
|
- `/project:tm/init` - Initialize project
|
||||||
|
- `/project:tm/init/quick` - Quick init with -y
|
||||||
|
- `/project:tm/models` - View AI config
|
||||||
|
- `/project:tm/models/setup` - Configure AI
|
||||||
|
|
||||||
|
### Task Generation
|
||||||
|
- `/project:tm/parse-prd` - Generate from PRD
|
||||||
|
- `/project:tm/parse-prd/with-research` - Enhanced parsing
|
||||||
|
- `/project:tm/generate` - Create task files
|
||||||
|
|
||||||
|
### Task Management
|
||||||
|
- `/project:tm/list` - List with natural language filters
|
||||||
|
- `/project:tm/list/with-subtasks` - Hierarchical view
|
||||||
|
- `/project:tm/list/by-status <status>` - Filter by status
|
||||||
|
- `/project:tm/show <id>` - Task details
|
||||||
|
- `/project:tm/add-task` - Create task
|
||||||
|
- `/project:tm/update` - Update tasks
|
||||||
|
- `/project:tm/remove-task` - Delete task
|
||||||
|
|
||||||
|
### Status Management
|
||||||
|
- `/project:tm/set-status/to-pending <id>`
|
||||||
|
- `/project:tm/set-status/to-in-progress <id>`
|
||||||
|
- `/project:tm/set-status/to-done <id>`
|
||||||
|
- `/project:tm/set-status/to-review <id>`
|
||||||
|
- `/project:tm/set-status/to-deferred <id>`
|
||||||
|
- `/project:tm/set-status/to-cancelled <id>`
|
||||||
|
|
||||||
|
### Task Analysis
|
||||||
|
- `/project:tm/analyze-complexity` - AI analysis
|
||||||
|
- `/project:tm/complexity-report` - View report
|
||||||
|
- `/project:tm/expand <id>` - Break down task
|
||||||
|
- `/project:tm/expand/all` - Expand all complex
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
- `/project:tm/add-dependency` - Add dependency
|
||||||
|
- `/project:tm/remove-dependency` - Remove dependency
|
||||||
|
- `/project:tm/validate-dependencies` - Check issues
|
||||||
|
- `/project:tm/fix-dependencies` - Auto-fix
|
||||||
|
|
||||||
|
### Workflows
|
||||||
|
- `/project:tm/workflows/smart-flow` - Adaptive workflows
|
||||||
|
- `/project:tm/workflows/pipeline` - Chain commands
|
||||||
|
- `/project:tm/workflows/auto-implement` - AI implementation
|
||||||
|
|
||||||
|
### Utilities
|
||||||
|
- `/project:tm/status` - Project dashboard
|
||||||
|
- `/project:tm/next` - Next task recommendation
|
||||||
|
- `/project:tm/utils/analyze` - Project analysis
|
||||||
|
- `/project:tm/learn` - Interactive help
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
### Natural Language Support
|
||||||
|
All commands understand natural language:
|
||||||
|
```
|
||||||
|
/project:tm/list pending high priority
|
||||||
|
/project:tm/update mark 23 as done
|
||||||
|
/project:tm/add-task implement OAuth login
|
||||||
|
```
|
||||||
|
|
||||||
|
### Smart Context
|
||||||
|
Commands analyze project state and provide intelligent suggestions based on:
|
||||||
|
- Current task status
|
||||||
|
- Dependencies
|
||||||
|
- Team patterns
|
||||||
|
- Project phase
|
||||||
|
|
||||||
|
### Visual Enhancements
|
||||||
|
- Progress bars and indicators
|
||||||
|
- Status badges
|
||||||
|
- Organized displays
|
||||||
|
- Clear hierarchies
|
||||||
|
|
||||||
|
## Common Workflows
|
||||||
|
|
||||||
|
### Daily Development
|
||||||
|
```
|
||||||
|
/project:tm/workflows/smart-flow morning
|
||||||
|
/project:tm/next
|
||||||
|
/project:tm/set-status/to-in-progress <id>
|
||||||
|
/project:tm/set-status/to-done <id>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Task Breakdown
|
||||||
|
```
|
||||||
|
/project:tm/show <id>
|
||||||
|
/project:tm/expand <id>
|
||||||
|
/project:tm/list/with-subtasks
|
||||||
|
```
|
||||||
|
|
||||||
|
### Sprint Planning
|
||||||
|
```
|
||||||
|
/project:tm/analyze-complexity
|
||||||
|
/project:tm/workflows/pipeline init → expand/all → status
|
||||||
|
```
|
||||||
|
|
||||||
|
## Migration from Old Commands
|
||||||
|
|
||||||
|
| Old | New |
|
||||||
|
|-----|-----|
|
||||||
|
| `/project:task-master:list` | `/project:tm/list` |
|
||||||
|
| `/project:task-master:complete` | `/project:tm/set-status/to-done` |
|
||||||
|
| `/project:workflows:auto-implement` | `/project:tm/workflows/auto-implement` |
|
||||||
|
|
||||||
|
## Tips
|
||||||
|
|
||||||
|
1. Use `/project:tm/` + Tab for command discovery
|
||||||
|
2. Natural language is supported everywhere
|
||||||
|
3. Commands provide smart defaults
|
||||||
|
4. Chain commands for automation
|
||||||
|
5. Check `/project:tm/learn` for interactive help
|
||||||
55
.claude/commands/tm/add-dependency/index.md
Normal file
55
.claude/commands/tm/add-dependency/index.md
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
Add a dependency between tasks.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
Parse the task IDs to establish dependency relationship.
|
||||||
|
|
||||||
|
## Adding Dependencies
|
||||||
|
|
||||||
|
Creates a dependency where one task must be completed before another can start.
|
||||||
|
|
||||||
|
## Argument Parsing
|
||||||
|
|
||||||
|
Parse natural language or IDs:
|
||||||
|
- "make 5 depend on 3" → task 5 depends on task 3
|
||||||
|
- "5 needs 3" → task 5 depends on task 3
|
||||||
|
- "5 3" → task 5 depends on task 3
|
||||||
|
- "5 after 3" → task 5 depends on task 3
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master add-dependency --id=<task-id> --depends-on=<dependency-id>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Validation
|
||||||
|
|
||||||
|
Before adding:
|
||||||
|
1. **Verify both tasks exist**
|
||||||
|
2. **Check for circular dependencies**
|
||||||
|
3. **Ensure dependency makes logical sense**
|
||||||
|
4. **Warn if creating complex chains**
|
||||||
|
|
||||||
|
## Smart Features
|
||||||
|
|
||||||
|
- Detect if dependency already exists
|
||||||
|
- Suggest related dependencies
|
||||||
|
- Show impact on task flow
|
||||||
|
- Update task priorities if needed
|
||||||
|
|
||||||
|
## Post-Addition
|
||||||
|
|
||||||
|
After adding dependency:
|
||||||
|
1. Show updated dependency graph
|
||||||
|
2. Identify any newly blocked tasks
|
||||||
|
3. Suggest task order changes
|
||||||
|
4. Update project timeline
|
||||||
|
|
||||||
|
## Example Flows
|
||||||
|
|
||||||
|
```
|
||||||
|
/project:tm/add-dependency 5 needs 3
|
||||||
|
→ Task #5 now depends on Task #3
|
||||||
|
→ Task #5 is now blocked until #3 completes
|
||||||
|
→ Suggested: Also consider if #5 needs #4
|
||||||
|
```
|
||||||
71
.claude/commands/tm/add-subtask/from-task.md
Normal file
71
.claude/commands/tm/add-subtask/from-task.md
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
Convert an existing task into a subtask.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
Parse parent ID and task ID to convert.
|
||||||
|
|
||||||
|
## Task Conversion
|
||||||
|
|
||||||
|
Converts an existing standalone task into a subtask of another task.
|
||||||
|
|
||||||
|
## Argument Parsing
|
||||||
|
|
||||||
|
- "move task 8 under 5"
|
||||||
|
- "make 8 a subtask of 5"
|
||||||
|
- "nest 8 in 5"
|
||||||
|
- "5 8" → make task 8 a subtask of task 5
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master add-subtask --parent=<parent-id> --task-id=<task-to-convert>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Pre-Conversion Checks
|
||||||
|
|
||||||
|
1. **Validation**
|
||||||
|
- Both tasks exist and are valid
|
||||||
|
- No circular parent relationships
|
||||||
|
- Task isn't already a subtask
|
||||||
|
- Logical hierarchy makes sense
|
||||||
|
|
||||||
|
2. **Impact Analysis**
|
||||||
|
- Dependencies that will be affected
|
||||||
|
- Tasks that depend on converting task
|
||||||
|
- Priority alignment needed
|
||||||
|
- Status compatibility
|
||||||
|
|
||||||
|
## Conversion Process
|
||||||
|
|
||||||
|
1. Change task ID from "8" to "5.1" (next available)
|
||||||
|
2. Update all dependency references
|
||||||
|
3. Inherit parent's context where appropriate
|
||||||
|
4. Adjust priorities if needed
|
||||||
|
5. Update time estimates
|
||||||
|
|
||||||
|
## Smart Features
|
||||||
|
|
||||||
|
- Preserve task history
|
||||||
|
- Maintain dependencies
|
||||||
|
- Update all references
|
||||||
|
- Create conversion log
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```
|
||||||
|
/project:tm/add-subtask/from-task 5 8
|
||||||
|
→ Converting: Task #8 becomes subtask #5.1
|
||||||
|
→ Updated: 3 dependency references
|
||||||
|
→ Parent task #5 now has 1 subtask
|
||||||
|
→ Note: Subtask inherits parent's priority
|
||||||
|
|
||||||
|
Before: #8 "Implement validation" (standalone)
|
||||||
|
After: #5.1 "Implement validation" (subtask of #5)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Post-Conversion
|
||||||
|
|
||||||
|
- Show new task hierarchy
|
||||||
|
- List updated dependencies
|
||||||
|
- Verify project integrity
|
||||||
|
- Suggest related conversions
|
||||||
76
.claude/commands/tm/add-subtask/index.md
Normal file
76
.claude/commands/tm/add-subtask/index.md
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
Add a subtask to a parent task.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
Parse arguments to create a new subtask or convert existing task.
|
||||||
|
|
||||||
|
## Adding Subtasks
|
||||||
|
|
||||||
|
Creates subtasks to break down complex parent tasks into manageable pieces.
|
||||||
|
|
||||||
|
## Argument Parsing
|
||||||
|
|
||||||
|
Flexible natural language:
|
||||||
|
- "add subtask to 5: implement login form"
|
||||||
|
- "break down 5 with: setup, implement, test"
|
||||||
|
- "subtask for 5: handle edge cases"
|
||||||
|
- "5: validate user input" → adds subtask to task 5
|
||||||
|
|
||||||
|
## Execution Modes
|
||||||
|
|
||||||
|
### 1. Create New Subtask
|
||||||
|
```bash
|
||||||
|
task-master add-subtask --parent=<id> --title="<title>" --description="<desc>"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Convert Existing Task
|
||||||
|
```bash
|
||||||
|
task-master add-subtask --parent=<id> --task-id=<existing-id>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Smart Features
|
||||||
|
|
||||||
|
1. **Automatic Subtask Generation**
|
||||||
|
- If title contains "and" or commas, create multiple
|
||||||
|
- Suggest common subtask patterns
|
||||||
|
- Inherit parent's context
|
||||||
|
|
||||||
|
2. **Intelligent Defaults**
|
||||||
|
- Priority based on parent
|
||||||
|
- Appropriate time estimates
|
||||||
|
- Logical dependencies between subtasks
|
||||||
|
|
||||||
|
3. **Validation**
|
||||||
|
- Check parent task complexity
|
||||||
|
- Warn if too many subtasks
|
||||||
|
- Ensure subtask makes sense
|
||||||
|
|
||||||
|
## Creation Process
|
||||||
|
|
||||||
|
1. Parse parent task context
|
||||||
|
2. Generate subtask with ID like "5.1"
|
||||||
|
3. Set appropriate defaults
|
||||||
|
4. Link to parent task
|
||||||
|
5. Update parent's time estimate
|
||||||
|
|
||||||
|
## Example Flows
|
||||||
|
|
||||||
|
```
|
||||||
|
/project:tm/add-subtask to 5: implement user authentication
|
||||||
|
→ Created subtask #5.1: "implement user authentication"
|
||||||
|
→ Parent task #5 now has 1 subtask
|
||||||
|
→ Suggested next subtasks: tests, documentation
|
||||||
|
|
||||||
|
/project:tm/add-subtask 5: setup, implement, test
|
||||||
|
→ Created 3 subtasks:
|
||||||
|
#5.1: setup
|
||||||
|
#5.2: implement
|
||||||
|
#5.3: test
|
||||||
|
```
|
||||||
|
|
||||||
|
## Post-Creation
|
||||||
|
|
||||||
|
- Show updated task hierarchy
|
||||||
|
- Suggest logical next subtasks
|
||||||
|
- Update complexity estimates
|
||||||
|
- Recommend subtask order
|
||||||
78
.claude/commands/tm/add-task/index.md
Normal file
78
.claude/commands/tm/add-task/index.md
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
Add new tasks with intelligent parsing and context awareness.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
## Smart Task Addition
|
||||||
|
|
||||||
|
Parse natural language to create well-structured tasks.
|
||||||
|
|
||||||
|
### 1. **Input Understanding**
|
||||||
|
|
||||||
|
I'll intelligently parse your request:
|
||||||
|
- Natural language → Structured task
|
||||||
|
- Detect priority from keywords (urgent, ASAP, important)
|
||||||
|
- Infer dependencies from context
|
||||||
|
- Suggest complexity based on description
|
||||||
|
- Determine task type (feature, bug, refactor, test, docs)
|
||||||
|
|
||||||
|
### 2. **Smart Parsing Examples**
|
||||||
|
|
||||||
|
**"Add urgent task to fix login bug"**
|
||||||
|
→ Title: Fix login bug
|
||||||
|
→ Priority: high
|
||||||
|
→ Type: bug
|
||||||
|
→ Suggested complexity: medium
|
||||||
|
|
||||||
|
**"Create task for API documentation after task 23 is done"**
|
||||||
|
→ Title: API documentation
|
||||||
|
→ Dependencies: [23]
|
||||||
|
→ Type: documentation
|
||||||
|
→ Priority: medium
|
||||||
|
|
||||||
|
**"Need to refactor auth module - depends on 12 and 15, high complexity"**
|
||||||
|
→ Title: Refactor auth module
|
||||||
|
→ Dependencies: [12, 15]
|
||||||
|
→ Complexity: high
|
||||||
|
→ Type: refactor
|
||||||
|
|
||||||
|
### 3. **Context Enhancement**
|
||||||
|
|
||||||
|
Based on current project state:
|
||||||
|
- Suggest related existing tasks
|
||||||
|
- Warn about potential conflicts
|
||||||
|
- Recommend dependencies
|
||||||
|
- Propose subtasks if complex
|
||||||
|
|
||||||
|
### 4. **Interactive Refinement**
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Task Preview:
|
||||||
|
─────────────
|
||||||
|
Title: [Extracted title]
|
||||||
|
Priority: [Inferred priority]
|
||||||
|
Dependencies: [Detected dependencies]
|
||||||
|
Complexity: [Estimated complexity]
|
||||||
|
|
||||||
|
Suggestions:
|
||||||
|
- Similar task #34 exists, consider as dependency?
|
||||||
|
- This seems complex, break into subtasks?
|
||||||
|
- Tasks #45-47 work on same module
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. **Validation & Creation**
|
||||||
|
|
||||||
|
Before creating:
|
||||||
|
- Validate dependencies exist
|
||||||
|
- Check for duplicates
|
||||||
|
- Ensure logical ordering
|
||||||
|
- Verify task completeness
|
||||||
|
|
||||||
|
### 6. **Smart Defaults**
|
||||||
|
|
||||||
|
Intelligent defaults based on:
|
||||||
|
- Task type patterns
|
||||||
|
- Team conventions
|
||||||
|
- Historical data
|
||||||
|
- Current sprint/phase
|
||||||
|
|
||||||
|
Result: High-quality tasks from minimal input.
|
||||||
121
.claude/commands/tm/analyze-complexity/index.md
Normal file
121
.claude/commands/tm/analyze-complexity/index.md
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
Analyze task complexity and generate expansion recommendations.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
Perform deep analysis of task complexity across the project.
|
||||||
|
|
||||||
|
## Complexity Analysis
|
||||||
|
|
||||||
|
Uses AI to analyze tasks and recommend which ones need breakdown.
|
||||||
|
|
||||||
|
## Execution Options
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master analyze-complexity [--research] [--threshold=5]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Analysis Parameters
|
||||||
|
|
||||||
|
- `--research` → Use research AI for deeper analysis
|
||||||
|
- `--threshold=5` → Only flag tasks above complexity 5
|
||||||
|
- Default: Analyze all pending tasks
|
||||||
|
|
||||||
|
## Analysis Process
|
||||||
|
|
||||||
|
### 1. **Task Evaluation**
|
||||||
|
For each task, AI evaluates:
|
||||||
|
- Technical complexity
|
||||||
|
- Time requirements
|
||||||
|
- Dependency complexity
|
||||||
|
- Risk factors
|
||||||
|
- Knowledge requirements
|
||||||
|
|
||||||
|
### 2. **Complexity Scoring**
|
||||||
|
Assigns score 1-10 based on:
|
||||||
|
- Implementation difficulty
|
||||||
|
- Integration challenges
|
||||||
|
- Testing requirements
|
||||||
|
- Unknown factors
|
||||||
|
- Technical debt risk
|
||||||
|
|
||||||
|
### 3. **Recommendations**
|
||||||
|
For complex tasks:
|
||||||
|
- Suggest expansion approach
|
||||||
|
- Recommend subtask breakdown
|
||||||
|
- Identify risk areas
|
||||||
|
- Propose mitigation strategies
|
||||||
|
|
||||||
|
## Smart Analysis Features
|
||||||
|
|
||||||
|
1. **Pattern Recognition**
|
||||||
|
- Similar task comparisons
|
||||||
|
- Historical complexity accuracy
|
||||||
|
- Team velocity consideration
|
||||||
|
- Technology stack factors
|
||||||
|
|
||||||
|
2. **Contextual Factors**
|
||||||
|
- Team expertise
|
||||||
|
- Available resources
|
||||||
|
- Timeline constraints
|
||||||
|
- Business criticality
|
||||||
|
|
||||||
|
3. **Risk Assessment**
|
||||||
|
- Technical risks
|
||||||
|
- Timeline risks
|
||||||
|
- Dependency risks
|
||||||
|
- Knowledge gaps
|
||||||
|
|
||||||
|
## Output Format
|
||||||
|
|
||||||
|
```
|
||||||
|
Task Complexity Analysis Report
|
||||||
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
|
||||||
|
High Complexity Tasks (>7):
|
||||||
|
📍 #5 "Implement real-time sync" - Score: 9/10
|
||||||
|
Factors: WebSocket complexity, state management, conflict resolution
|
||||||
|
Recommendation: Expand into 5-7 subtasks
|
||||||
|
Risks: Performance, data consistency
|
||||||
|
|
||||||
|
📍 #12 "Migrate database schema" - Score: 8/10
|
||||||
|
Factors: Data migration, zero downtime, rollback strategy
|
||||||
|
Recommendation: Expand into 4-5 subtasks
|
||||||
|
Risks: Data loss, downtime
|
||||||
|
|
||||||
|
Medium Complexity Tasks (5-7):
|
||||||
|
📍 #23 "Add export functionality" - Score: 6/10
|
||||||
|
Consider expansion if timeline tight
|
||||||
|
|
||||||
|
Low Complexity Tasks (<5):
|
||||||
|
✅ 15 tasks - No expansion needed
|
||||||
|
|
||||||
|
Summary:
|
||||||
|
- Expand immediately: 2 tasks
|
||||||
|
- Consider expanding: 5 tasks
|
||||||
|
- Keep as-is: 15 tasks
|
||||||
|
```
|
||||||
|
|
||||||
|
## Actionable Output
|
||||||
|
|
||||||
|
For each high-complexity task:
|
||||||
|
1. Complexity score with reasoning
|
||||||
|
2. Specific expansion suggestions
|
||||||
|
3. Risk mitigation approaches
|
||||||
|
4. Recommended subtask structure
|
||||||
|
|
||||||
|
## Integration
|
||||||
|
|
||||||
|
Results are:
|
||||||
|
- Saved to `.taskmaster/reports/complexity-analysis.md`
|
||||||
|
- Used by expand command
|
||||||
|
- Inform sprint planning
|
||||||
|
- Guide resource allocation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
After analysis:
|
||||||
|
```
|
||||||
|
/project:tm/expand 5 # Expand specific task
|
||||||
|
/project:tm/expand/all # Expand all recommended
|
||||||
|
/project:tm/complexity-report # View detailed report
|
||||||
|
```
|
||||||
93
.claude/commands/tm/clear-subtasks/all.md
Normal file
93
.claude/commands/tm/clear-subtasks/all.md
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
Clear all subtasks from all tasks globally.
|
||||||
|
|
||||||
|
## Global Subtask Clearing
|
||||||
|
|
||||||
|
Remove all subtasks across the entire project. Use with extreme caution.
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master clear-subtasks --all
|
||||||
|
```
|
||||||
|
|
||||||
|
## Pre-Clear Analysis
|
||||||
|
|
||||||
|
1. **Project-Wide Summary**
|
||||||
|
```
|
||||||
|
Global Subtask Summary
|
||||||
|
━━━━━━━━━━━━━━━━━━━━
|
||||||
|
Total parent tasks: 12
|
||||||
|
Total subtasks: 47
|
||||||
|
- Completed: 15
|
||||||
|
- In-progress: 8
|
||||||
|
- Pending: 24
|
||||||
|
|
||||||
|
Work at risk: ~120 hours
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Critical Warnings**
|
||||||
|
- In-progress subtasks that will lose work
|
||||||
|
- Completed subtasks with valuable history
|
||||||
|
- Complex dependency chains
|
||||||
|
- Integration test results
|
||||||
|
|
||||||
|
## Double Confirmation
|
||||||
|
|
||||||
|
```
|
||||||
|
⚠️ DESTRUCTIVE OPERATION WARNING ⚠️
|
||||||
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
This will remove ALL 47 subtasks from your project
|
||||||
|
Including 8 in-progress and 15 completed subtasks
|
||||||
|
|
||||||
|
This action CANNOT be undone
|
||||||
|
|
||||||
|
Type 'CLEAR ALL SUBTASKS' to confirm:
|
||||||
|
```
|
||||||
|
|
||||||
|
## Smart Safeguards
|
||||||
|
|
||||||
|
- Require explicit confirmation phrase
|
||||||
|
- Create automatic backup
|
||||||
|
- Log all removed data
|
||||||
|
- Option to export first
|
||||||
|
|
||||||
|
## Use Cases
|
||||||
|
|
||||||
|
Valid reasons for global clear:
|
||||||
|
- Project restructuring
|
||||||
|
- Major pivot in approach
|
||||||
|
- Starting fresh breakdown
|
||||||
|
- Switching to different task organization
|
||||||
|
|
||||||
|
## Process
|
||||||
|
|
||||||
|
1. Full project analysis
|
||||||
|
2. Create backup file
|
||||||
|
3. Show detailed impact
|
||||||
|
4. Require confirmation
|
||||||
|
5. Execute removal
|
||||||
|
6. Generate summary report
|
||||||
|
|
||||||
|
## Alternative Suggestions
|
||||||
|
|
||||||
|
Before clearing all:
|
||||||
|
- Export subtasks to file
|
||||||
|
- Clear only pending subtasks
|
||||||
|
- Clear by task category
|
||||||
|
- Archive instead of delete
|
||||||
|
|
||||||
|
## Post-Clear Report
|
||||||
|
|
||||||
|
```
|
||||||
|
Global Subtask Clear Complete
|
||||||
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
Removed: 47 subtasks from 12 tasks
|
||||||
|
Backup saved: .taskmaster/backup/subtasks-20240115.json
|
||||||
|
Parent tasks updated: 12
|
||||||
|
Time estimates adjusted: Yes
|
||||||
|
|
||||||
|
Next steps:
|
||||||
|
- Review updated task list
|
||||||
|
- Re-expand complex tasks as needed
|
||||||
|
- Check project timeline
|
||||||
|
```
|
||||||
86
.claude/commands/tm/clear-subtasks/index.md
Normal file
86
.claude/commands/tm/clear-subtasks/index.md
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
Clear all subtasks from a specific task.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS (task ID)
|
||||||
|
|
||||||
|
Remove all subtasks from a parent task at once.
|
||||||
|
|
||||||
|
## Clearing Subtasks
|
||||||
|
|
||||||
|
Bulk removal of all subtasks from a parent task.
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master clear-subtasks --id=<task-id>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Pre-Clear Analysis
|
||||||
|
|
||||||
|
1. **Subtask Summary**
|
||||||
|
- Number of subtasks
|
||||||
|
- Completion status of each
|
||||||
|
- Work already done
|
||||||
|
- Dependencies affected
|
||||||
|
|
||||||
|
2. **Impact Assessment**
|
||||||
|
- Data that will be lost
|
||||||
|
- Dependencies to be removed
|
||||||
|
- Effect on project timeline
|
||||||
|
- Parent task implications
|
||||||
|
|
||||||
|
## Confirmation Required
|
||||||
|
|
||||||
|
```
|
||||||
|
Clear Subtasks Confirmation
|
||||||
|
━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
Parent Task: #5 "Implement user authentication"
|
||||||
|
Subtasks to remove: 4
|
||||||
|
- #5.1 "Setup auth framework" (done)
|
||||||
|
- #5.2 "Create login form" (in-progress)
|
||||||
|
- #5.3 "Add validation" (pending)
|
||||||
|
- #5.4 "Write tests" (pending)
|
||||||
|
|
||||||
|
⚠️ This will permanently delete all subtask data
|
||||||
|
Continue? (y/n)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Smart Features
|
||||||
|
|
||||||
|
- Option to convert to standalone tasks
|
||||||
|
- Backup task data before clearing
|
||||||
|
- Preserve completed work history
|
||||||
|
- Update parent task appropriately
|
||||||
|
|
||||||
|
## Process
|
||||||
|
|
||||||
|
1. List all subtasks for confirmation
|
||||||
|
2. Check for in-progress work
|
||||||
|
3. Remove all subtasks
|
||||||
|
4. Update parent task
|
||||||
|
5. Clean up dependencies
|
||||||
|
|
||||||
|
## Alternative Options
|
||||||
|
|
||||||
|
Suggest alternatives:
|
||||||
|
- Convert important subtasks to tasks
|
||||||
|
- Keep completed subtasks
|
||||||
|
- Archive instead of delete
|
||||||
|
- Export subtask data first
|
||||||
|
|
||||||
|
## Post-Clear
|
||||||
|
|
||||||
|
- Show updated parent task
|
||||||
|
- Recalculate time estimates
|
||||||
|
- Update task complexity
|
||||||
|
- Suggest next steps
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```
|
||||||
|
/project:tm/clear-subtasks 5
|
||||||
|
→ Found 4 subtasks to remove
|
||||||
|
→ Warning: Subtask #5.2 is in-progress
|
||||||
|
→ Cleared all subtasks from task #5
|
||||||
|
→ Updated parent task estimates
|
||||||
|
→ Suggestion: Consider re-expanding with better breakdown
|
||||||
|
```
|
||||||
117
.claude/commands/tm/complexity-report/index.md
Normal file
117
.claude/commands/tm/complexity-report/index.md
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
Display the task complexity analysis report.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
View the detailed complexity analysis generated by analyze-complexity command.
|
||||||
|
|
||||||
|
## Viewing Complexity Report
|
||||||
|
|
||||||
|
Shows comprehensive task complexity analysis with actionable insights.
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master complexity-report [--file=<path>]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Report Location
|
||||||
|
|
||||||
|
Default: `.taskmaster/reports/complexity-analysis.md`
|
||||||
|
Custom: Specify with --file parameter
|
||||||
|
|
||||||
|
## Report Contents
|
||||||
|
|
||||||
|
### 1. **Executive Summary**
|
||||||
|
```
|
||||||
|
Complexity Analysis Summary
|
||||||
|
━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
Analysis Date: 2024-01-15
|
||||||
|
Tasks Analyzed: 32
|
||||||
|
High Complexity: 5 (16%)
|
||||||
|
Medium Complexity: 12 (37%)
|
||||||
|
Low Complexity: 15 (47%)
|
||||||
|
|
||||||
|
Critical Findings:
|
||||||
|
- 5 tasks need immediate expansion
|
||||||
|
- 3 tasks have high technical risk
|
||||||
|
- 2 tasks block critical path
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. **Detailed Task Analysis**
|
||||||
|
For each complex task:
|
||||||
|
- Complexity score breakdown
|
||||||
|
- Contributing factors
|
||||||
|
- Specific risks identified
|
||||||
|
- Expansion recommendations
|
||||||
|
- Similar completed tasks
|
||||||
|
|
||||||
|
### 3. **Risk Matrix**
|
||||||
|
Visual representation:
|
||||||
|
```
|
||||||
|
Risk vs Complexity Matrix
|
||||||
|
━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
High Risk | #5(9) #12(8) | #23(6)
|
||||||
|
Med Risk | #34(7) | #45(5) #67(5)
|
||||||
|
Low Risk | #78(8) | [15 tasks]
|
||||||
|
| High Complex | Med Complex
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. **Recommendations**
|
||||||
|
|
||||||
|
**Immediate Actions:**
|
||||||
|
1. Expand task #5 - Critical path + high complexity
|
||||||
|
2. Expand task #12 - High risk + dependencies
|
||||||
|
3. Review task #34 - Consider splitting
|
||||||
|
|
||||||
|
**Sprint Planning:**
|
||||||
|
- Don't schedule multiple high-complexity tasks together
|
||||||
|
- Ensure expertise available for complex tasks
|
||||||
|
- Build in buffer time for unknowns
|
||||||
|
|
||||||
|
## Interactive Features
|
||||||
|
|
||||||
|
When viewing report:
|
||||||
|
1. **Quick Actions**
|
||||||
|
- Press 'e' to expand a task
|
||||||
|
- Press 'd' for task details
|
||||||
|
- Press 'r' to refresh analysis
|
||||||
|
|
||||||
|
2. **Filtering**
|
||||||
|
- View by complexity level
|
||||||
|
- Filter by risk factors
|
||||||
|
- Show only actionable items
|
||||||
|
|
||||||
|
3. **Export Options**
|
||||||
|
- Markdown format
|
||||||
|
- CSV for spreadsheets
|
||||||
|
- JSON for tools
|
||||||
|
|
||||||
|
## Report Intelligence
|
||||||
|
|
||||||
|
- Compares with historical data
|
||||||
|
- Shows complexity trends
|
||||||
|
- Identifies patterns
|
||||||
|
- Suggests process improvements
|
||||||
|
|
||||||
|
## Integration
|
||||||
|
|
||||||
|
Use report for:
|
||||||
|
- Sprint planning sessions
|
||||||
|
- Resource allocation
|
||||||
|
- Risk assessment
|
||||||
|
- Team discussions
|
||||||
|
- Client updates
|
||||||
|
|
||||||
|
## Example Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
/project:tm/complexity-report
|
||||||
|
→ Opens latest analysis
|
||||||
|
|
||||||
|
/project:tm/complexity-report --file=archived/2024-01-01.md
|
||||||
|
→ View historical analysis
|
||||||
|
|
||||||
|
After viewing:
|
||||||
|
/project:tm/expand 5
|
||||||
|
→ Expand high-complexity task
|
||||||
|
```
|
||||||
51
.claude/commands/tm/expand/all.md
Normal file
51
.claude/commands/tm/expand/all.md
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
Expand all pending tasks that need subtasks.
|
||||||
|
|
||||||
|
## Bulk Task Expansion
|
||||||
|
|
||||||
|
Intelligently expands all tasks that would benefit from breakdown.
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master expand --all
|
||||||
|
```
|
||||||
|
|
||||||
|
## Smart Selection
|
||||||
|
|
||||||
|
Only expands tasks that:
|
||||||
|
- Are marked as pending
|
||||||
|
- Have high complexity (>5)
|
||||||
|
- Lack existing subtasks
|
||||||
|
- Would benefit from breakdown
|
||||||
|
|
||||||
|
## Expansion Process
|
||||||
|
|
||||||
|
1. **Analysis Phase**
|
||||||
|
- Identify expansion candidates
|
||||||
|
- Group related tasks
|
||||||
|
- Plan expansion strategy
|
||||||
|
|
||||||
|
2. **Batch Processing**
|
||||||
|
- Expand tasks in logical order
|
||||||
|
- Maintain consistency
|
||||||
|
- Preserve relationships
|
||||||
|
- Optimize for parallelism
|
||||||
|
|
||||||
|
3. **Quality Control**
|
||||||
|
- Ensure subtask quality
|
||||||
|
- Avoid over-decomposition
|
||||||
|
- Maintain task coherence
|
||||||
|
- Update dependencies
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
- Add `force` to expand all regardless of complexity
|
||||||
|
- Add `research` for enhanced AI analysis
|
||||||
|
|
||||||
|
## Results
|
||||||
|
|
||||||
|
After bulk expansion:
|
||||||
|
- Summary of tasks expanded
|
||||||
|
- New subtask count
|
||||||
|
- Updated complexity metrics
|
||||||
|
- Suggested task order
|
||||||
49
.claude/commands/tm/expand/index.md
Normal file
49
.claude/commands/tm/expand/index.md
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
Break down a complex task into subtasks.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS (task ID)
|
||||||
|
|
||||||
|
## Intelligent Task Expansion
|
||||||
|
|
||||||
|
Analyzes a task and creates detailed subtasks for better manageability.
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master expand --id=$ARGUMENTS
|
||||||
|
```
|
||||||
|
|
||||||
|
## Expansion Process
|
||||||
|
|
||||||
|
1. **Task Analysis**
|
||||||
|
- Review task complexity
|
||||||
|
- Identify components
|
||||||
|
- Detect technical challenges
|
||||||
|
- Estimate time requirements
|
||||||
|
|
||||||
|
2. **Subtask Generation**
|
||||||
|
- Create 3-7 subtasks typically
|
||||||
|
- Each subtask 1-4 hours
|
||||||
|
- Logical implementation order
|
||||||
|
- Clear acceptance criteria
|
||||||
|
|
||||||
|
3. **Smart Breakdown**
|
||||||
|
- Setup/configuration tasks
|
||||||
|
- Core implementation
|
||||||
|
- Testing components
|
||||||
|
- Integration steps
|
||||||
|
- Documentation updates
|
||||||
|
|
||||||
|
## Enhanced Features
|
||||||
|
|
||||||
|
Based on task type:
|
||||||
|
- **Feature**: Setup → Implement → Test → Integrate
|
||||||
|
- **Bug Fix**: Reproduce → Diagnose → Fix → Verify
|
||||||
|
- **Refactor**: Analyze → Plan → Refactor → Validate
|
||||||
|
|
||||||
|
## Post-Expansion
|
||||||
|
|
||||||
|
After expansion:
|
||||||
|
1. Show subtask hierarchy
|
||||||
|
2. Update time estimates
|
||||||
|
3. Suggest implementation order
|
||||||
|
4. Highlight critical path
|
||||||
81
.claude/commands/tm/fix-dependencies/index.md
Normal file
81
.claude/commands/tm/fix-dependencies/index.md
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
Automatically fix dependency issues found during validation.
|
||||||
|
|
||||||
|
## Automatic Dependency Repair
|
||||||
|
|
||||||
|
Intelligently fixes common dependency problems while preserving project logic.
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master fix-dependencies
|
||||||
|
```
|
||||||
|
|
||||||
|
## What Gets Fixed
|
||||||
|
|
||||||
|
### 1. **Auto-Fixable Issues**
|
||||||
|
- Remove references to deleted tasks
|
||||||
|
- Break simple circular dependencies
|
||||||
|
- Remove self-dependencies
|
||||||
|
- Clean up duplicate dependencies
|
||||||
|
|
||||||
|
### 2. **Smart Resolutions**
|
||||||
|
- Reorder dependencies to maintain logic
|
||||||
|
- Suggest task merging for over-dependent tasks
|
||||||
|
- Flatten unnecessary dependency chains
|
||||||
|
- Remove redundant transitive dependencies
|
||||||
|
|
||||||
|
### 3. **Manual Review Required**
|
||||||
|
- Complex circular dependencies
|
||||||
|
- Critical path modifications
|
||||||
|
- Business logic dependencies
|
||||||
|
- High-impact changes
|
||||||
|
|
||||||
|
## Fix Process
|
||||||
|
|
||||||
|
1. **Analysis Phase**
|
||||||
|
- Run validation check
|
||||||
|
- Categorize issues by type
|
||||||
|
- Determine fix strategy
|
||||||
|
|
||||||
|
2. **Execution Phase**
|
||||||
|
- Apply automatic fixes
|
||||||
|
- Log all changes made
|
||||||
|
- Preserve task relationships
|
||||||
|
|
||||||
|
3. **Verification Phase**
|
||||||
|
- Re-validate after fixes
|
||||||
|
- Show before/after comparison
|
||||||
|
- Highlight manual fixes needed
|
||||||
|
|
||||||
|
## Smart Features
|
||||||
|
|
||||||
|
- Preserves intended task flow
|
||||||
|
- Minimal disruption approach
|
||||||
|
- Creates fix history/log
|
||||||
|
- Suggests manual interventions
|
||||||
|
|
||||||
|
## Output Example
|
||||||
|
|
||||||
|
```
|
||||||
|
Dependency Auto-Fix Report
|
||||||
|
━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
Fixed Automatically:
|
||||||
|
✅ Removed 2 references to deleted tasks
|
||||||
|
✅ Resolved 1 self-dependency
|
||||||
|
✅ Cleaned 3 redundant dependencies
|
||||||
|
|
||||||
|
Manual Review Needed:
|
||||||
|
⚠️ Complex circular dependency: #12 → #15 → #18 → #12
|
||||||
|
Suggestion: Make #15 not depend on #12
|
||||||
|
⚠️ Task #45 has 8 dependencies
|
||||||
|
Suggestion: Break into subtasks
|
||||||
|
|
||||||
|
Run '/project:tm/validate-dependencies' to verify fixes
|
||||||
|
```
|
||||||
|
|
||||||
|
## Safety
|
||||||
|
|
||||||
|
- Preview mode available
|
||||||
|
- Rollback capability
|
||||||
|
- Change logging
|
||||||
|
- No data loss
|
||||||
121
.claude/commands/tm/generate/index.md
Normal file
121
.claude/commands/tm/generate/index.md
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
Generate individual task files from tasks.json.
|
||||||
|
|
||||||
|
## Task File Generation
|
||||||
|
|
||||||
|
Creates separate markdown files for each task, perfect for AI agents or documentation.
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master generate
|
||||||
|
```
|
||||||
|
|
||||||
|
## What It Creates
|
||||||
|
|
||||||
|
For each task, generates a file like `task_001.txt`:
|
||||||
|
|
||||||
|
```
|
||||||
|
Task ID: 1
|
||||||
|
Title: Implement user authentication
|
||||||
|
Status: pending
|
||||||
|
Priority: high
|
||||||
|
Dependencies: []
|
||||||
|
Created: 2024-01-15
|
||||||
|
Complexity: 7
|
||||||
|
|
||||||
|
## Description
|
||||||
|
Create a secure user authentication system with login, logout, and session management.
|
||||||
|
|
||||||
|
## Details
|
||||||
|
- Use JWT tokens for session management
|
||||||
|
- Implement secure password hashing
|
||||||
|
- Add remember me functionality
|
||||||
|
- Include password reset flow
|
||||||
|
|
||||||
|
## Test Strategy
|
||||||
|
- Unit tests for auth functions
|
||||||
|
- Integration tests for login flow
|
||||||
|
- Security testing for vulnerabilities
|
||||||
|
- Performance tests for concurrent logins
|
||||||
|
|
||||||
|
## Subtasks
|
||||||
|
1.1 Setup authentication framework (pending)
|
||||||
|
1.2 Create login endpoints (pending)
|
||||||
|
1.3 Implement session management (pending)
|
||||||
|
1.4 Add password reset (pending)
|
||||||
|
```
|
||||||
|
|
||||||
|
## File Organization
|
||||||
|
|
||||||
|
Creates structure:
|
||||||
|
```
|
||||||
|
.taskmaster/
|
||||||
|
└── tasks/
|
||||||
|
├── task_001.txt
|
||||||
|
├── task_002.txt
|
||||||
|
├── task_003.txt
|
||||||
|
└── ...
|
||||||
|
```
|
||||||
|
|
||||||
|
## Smart Features
|
||||||
|
|
||||||
|
1. **Consistent Formatting**
|
||||||
|
- Standardized structure
|
||||||
|
- Clear sections
|
||||||
|
- AI-readable format
|
||||||
|
- Markdown compatible
|
||||||
|
|
||||||
|
2. **Contextual Information**
|
||||||
|
- Full task details
|
||||||
|
- Related task references
|
||||||
|
- Progress indicators
|
||||||
|
- Implementation notes
|
||||||
|
|
||||||
|
3. **Incremental Updates**
|
||||||
|
- Only regenerate changed tasks
|
||||||
|
- Preserve custom additions
|
||||||
|
- Track generation timestamp
|
||||||
|
- Version control friendly
|
||||||
|
|
||||||
|
## Use Cases
|
||||||
|
|
||||||
|
- **AI Context**: Provide task context to AI assistants
|
||||||
|
- **Documentation**: Standalone task documentation
|
||||||
|
- **Archival**: Task history preservation
|
||||||
|
- **Sharing**: Send specific tasks to team members
|
||||||
|
- **Review**: Easier task review process
|
||||||
|
|
||||||
|
## Generation Options
|
||||||
|
|
||||||
|
Based on arguments:
|
||||||
|
- Filter by status
|
||||||
|
- Include/exclude completed
|
||||||
|
- Custom templates
|
||||||
|
- Different formats
|
||||||
|
|
||||||
|
## Post-Generation
|
||||||
|
|
||||||
|
```
|
||||||
|
Task File Generation Complete
|
||||||
|
━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
Generated: 45 task files
|
||||||
|
Location: .taskmaster/tasks/
|
||||||
|
Total size: 156 KB
|
||||||
|
|
||||||
|
New files: 5
|
||||||
|
Updated files: 12
|
||||||
|
Unchanged: 28
|
||||||
|
|
||||||
|
Ready for:
|
||||||
|
- AI agent consumption
|
||||||
|
- Version control
|
||||||
|
- Team distribution
|
||||||
|
```
|
||||||
|
|
||||||
|
## Integration Benefits
|
||||||
|
|
||||||
|
- Git-trackable task history
|
||||||
|
- Easy task sharing
|
||||||
|
- AI tool compatibility
|
||||||
|
- Offline task access
|
||||||
|
- Backup redundancy
|
||||||
81
.claude/commands/tm/help.md
Normal file
81
.claude/commands/tm/help.md
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
Show help for Task Master commands.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
Display help for Task Master commands. If arguments provided, show specific command help.
|
||||||
|
|
||||||
|
## Task Master Command Help
|
||||||
|
|
||||||
|
### Quick Navigation
|
||||||
|
|
||||||
|
Type `/project:tm/` and use tab completion to explore all commands.
|
||||||
|
|
||||||
|
### Command Categories
|
||||||
|
|
||||||
|
#### 🚀 Setup & Installation
|
||||||
|
- `/project:tm/setup/install` - Comprehensive installation guide
|
||||||
|
- `/project:tm/setup/quick-install` - One-line global install
|
||||||
|
|
||||||
|
#### 📋 Project Setup
|
||||||
|
- `/project:tm/init` - Initialize new project
|
||||||
|
- `/project:tm/init/quick` - Quick setup with auto-confirm
|
||||||
|
- `/project:tm/models` - View AI configuration
|
||||||
|
- `/project:tm/models/setup` - Configure AI providers
|
||||||
|
|
||||||
|
#### 🎯 Task Generation
|
||||||
|
- `/project:tm/parse-prd` - Generate tasks from PRD
|
||||||
|
- `/project:tm/parse-prd/with-research` - Enhanced parsing
|
||||||
|
- `/project:tm/generate` - Create task files
|
||||||
|
|
||||||
|
#### 📝 Task Management
|
||||||
|
- `/project:tm/list` - List tasks (natural language filters)
|
||||||
|
- `/project:tm/show <id>` - Display task details
|
||||||
|
- `/project:tm/add-task` - Create new task
|
||||||
|
- `/project:tm/update` - Update tasks naturally
|
||||||
|
- `/project:tm/next` - Get next task recommendation
|
||||||
|
|
||||||
|
#### 🔄 Status Management
|
||||||
|
- `/project:tm/set-status/to-pending <id>`
|
||||||
|
- `/project:tm/set-status/to-in-progress <id>`
|
||||||
|
- `/project:tm/set-status/to-done <id>`
|
||||||
|
- `/project:tm/set-status/to-review <id>`
|
||||||
|
- `/project:tm/set-status/to-deferred <id>`
|
||||||
|
- `/project:tm/set-status/to-cancelled <id>`
|
||||||
|
|
||||||
|
#### 🔍 Analysis & Breakdown
|
||||||
|
- `/project:tm/analyze-complexity` - Analyze task complexity
|
||||||
|
- `/project:tm/expand <id>` - Break down complex task
|
||||||
|
- `/project:tm/expand/all` - Expand all eligible tasks
|
||||||
|
|
||||||
|
#### 🔗 Dependencies
|
||||||
|
- `/project:tm/add-dependency` - Add task dependency
|
||||||
|
- `/project:tm/remove-dependency` - Remove dependency
|
||||||
|
- `/project:tm/validate-dependencies` - Check for issues
|
||||||
|
|
||||||
|
#### 🤖 Workflows
|
||||||
|
- `/project:tm/workflows/smart-flow` - Intelligent workflows
|
||||||
|
- `/project:tm/workflows/pipeline` - Command chaining
|
||||||
|
- `/project:tm/workflows/auto-implement` - Auto-implementation
|
||||||
|
|
||||||
|
#### 📊 Utilities
|
||||||
|
- `/project:tm/utils/analyze` - Project analysis
|
||||||
|
- `/project:tm/status` - Project dashboard
|
||||||
|
- `/project:tm/learn` - Interactive learning
|
||||||
|
|
||||||
|
### Natural Language Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
/project:tm/list pending high priority
|
||||||
|
/project:tm/update mark all API tasks as done
|
||||||
|
/project:tm/add-task create login system with OAuth
|
||||||
|
/project:tm/show current
|
||||||
|
```
|
||||||
|
|
||||||
|
### Getting Started
|
||||||
|
|
||||||
|
1. Install: `/project:tm/setup/quick-install`
|
||||||
|
2. Initialize: `/project:tm/init/quick`
|
||||||
|
3. Learn: `/project:tm/learn start`
|
||||||
|
4. Work: `/project:tm/workflows/smart-flow`
|
||||||
|
|
||||||
|
For detailed command info: `/project:tm/help <command-name>`
|
||||||
130
.claude/commands/tm/index.md
Normal file
130
.claude/commands/tm/index.md
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
# Task Master Command Reference
|
||||||
|
|
||||||
|
Comprehensive command structure for Task Master integration with Claude Code.
|
||||||
|
|
||||||
|
## Command Organization
|
||||||
|
|
||||||
|
Commands are organized hierarchically to match Task Master's CLI structure while providing enhanced Claude Code integration.
|
||||||
|
|
||||||
|
## Project Setup & Configuration
|
||||||
|
|
||||||
|
### `/project:tm/init`
|
||||||
|
- `index` - Initialize new project (handles PRD files intelligently)
|
||||||
|
- `quick` - Quick setup with auto-confirmation (-y flag)
|
||||||
|
|
||||||
|
### `/project:tm/models`
|
||||||
|
- `index` - View current AI model configuration
|
||||||
|
- `setup` - Interactive model configuration
|
||||||
|
- `set-main` - Set primary generation model
|
||||||
|
- `set-research` - Set research model
|
||||||
|
- `set-fallback` - Set fallback model
|
||||||
|
|
||||||
|
## Task Generation
|
||||||
|
|
||||||
|
### `/project:tm/parse-prd`
|
||||||
|
- `index` - Generate tasks from PRD document
|
||||||
|
- `with-research` - Enhanced parsing with research mode
|
||||||
|
|
||||||
|
### `/project:tm/generate`
|
||||||
|
- Create individual task files from tasks.json
|
||||||
|
|
||||||
|
## Task Management
|
||||||
|
|
||||||
|
### `/project:tm/list`
|
||||||
|
- `index` - Smart listing with natural language filters
|
||||||
|
- `with-subtasks` - Include subtasks in hierarchical view
|
||||||
|
- `by-status` - Filter by specific status
|
||||||
|
|
||||||
|
### `/project:tm/set-status`
|
||||||
|
- `to-pending` - Reset task to pending
|
||||||
|
- `to-in-progress` - Start working on task
|
||||||
|
- `to-done` - Mark task complete
|
||||||
|
- `to-review` - Submit for review
|
||||||
|
- `to-deferred` - Defer task
|
||||||
|
- `to-cancelled` - Cancel task
|
||||||
|
|
||||||
|
### `/project:tm/sync-readme`
|
||||||
|
- Export tasks to README.md with formatting
|
||||||
|
|
||||||
|
### `/project:tm/update`
|
||||||
|
- `index` - Update tasks with natural language
|
||||||
|
- `from-id` - Update multiple tasks from a starting point
|
||||||
|
- `single` - Update specific task
|
||||||
|
|
||||||
|
### `/project:tm/add-task`
|
||||||
|
- `index` - Add new task with AI assistance
|
||||||
|
|
||||||
|
### `/project:tm/remove-task`
|
||||||
|
- `index` - Remove task with confirmation
|
||||||
|
|
||||||
|
## Subtask Management
|
||||||
|
|
||||||
|
### `/project:tm/add-subtask`
|
||||||
|
- `index` - Add new subtask to parent
|
||||||
|
- `from-task` - Convert existing task to subtask
|
||||||
|
|
||||||
|
### `/project:tm/remove-subtask`
|
||||||
|
- Remove subtask (with optional conversion)
|
||||||
|
|
||||||
|
### `/project:tm/clear-subtasks`
|
||||||
|
- `index` - Clear subtasks from specific task
|
||||||
|
- `all` - Clear all subtasks globally
|
||||||
|
|
||||||
|
## Task Analysis & Breakdown
|
||||||
|
|
||||||
|
### `/project:tm/analyze-complexity`
|
||||||
|
- Analyze and generate expansion recommendations
|
||||||
|
|
||||||
|
### `/project:tm/complexity-report`
|
||||||
|
- Display complexity analysis report
|
||||||
|
|
||||||
|
### `/project:tm/expand`
|
||||||
|
- `index` - Break down specific task
|
||||||
|
- `all` - Expand all eligible tasks
|
||||||
|
- `with-research` - Enhanced expansion
|
||||||
|
|
||||||
|
## Task Navigation
|
||||||
|
|
||||||
|
### `/project:tm/next`
|
||||||
|
- Intelligent next task recommendation
|
||||||
|
|
||||||
|
### `/project:tm/show`
|
||||||
|
- Display detailed task information
|
||||||
|
|
||||||
|
### `/project:tm/status`
|
||||||
|
- Comprehensive project dashboard
|
||||||
|
|
||||||
|
## Dependency Management
|
||||||
|
|
||||||
|
### `/project:tm/add-dependency`
|
||||||
|
- Add task dependency
|
||||||
|
|
||||||
|
### `/project:tm/remove-dependency`
|
||||||
|
- Remove task dependency
|
||||||
|
|
||||||
|
### `/project:tm/validate-dependencies`
|
||||||
|
- Check for dependency issues
|
||||||
|
|
||||||
|
### `/project:tm/fix-dependencies`
|
||||||
|
- Automatically fix dependency problems
|
||||||
|
|
||||||
|
## Usage Patterns
|
||||||
|
|
||||||
|
### Natural Language
|
||||||
|
Most commands accept natural language arguments:
|
||||||
|
```
|
||||||
|
/project:tm/add-task create user authentication system
|
||||||
|
/project:tm/update mark all API tasks as high priority
|
||||||
|
/project:tm/list show blocked tasks
|
||||||
|
```
|
||||||
|
|
||||||
|
### ID-Based Commands
|
||||||
|
Commands requiring IDs intelligently parse from $ARGUMENTS:
|
||||||
|
```
|
||||||
|
/project:tm/show 45
|
||||||
|
/project:tm/expand 23
|
||||||
|
/project:tm/set-status/to-done 67
|
||||||
|
```
|
||||||
|
|
||||||
|
### Smart Defaults
|
||||||
|
Commands provide intelligent defaults and suggestions based on context.
|
||||||
50
.claude/commands/tm/init/index.md
Normal file
50
.claude/commands/tm/init/index.md
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
Initialize a new Task Master project.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
Parse arguments to determine initialization preferences.
|
||||||
|
|
||||||
|
## Initialization Process
|
||||||
|
|
||||||
|
1. **Parse Arguments**
|
||||||
|
- PRD file path (if provided)
|
||||||
|
- Project name
|
||||||
|
- Auto-confirm flag (-y)
|
||||||
|
|
||||||
|
2. **Project Setup**
|
||||||
|
```bash
|
||||||
|
task-master init
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Smart Initialization**
|
||||||
|
- Detect existing project files
|
||||||
|
- Suggest project name from directory
|
||||||
|
- Check for git repository
|
||||||
|
- Verify AI provider configuration
|
||||||
|
|
||||||
|
## Configuration Options
|
||||||
|
|
||||||
|
Based on arguments:
|
||||||
|
- `quick` / `-y` → Skip confirmations
|
||||||
|
- `<file.md>` → Use as PRD after init
|
||||||
|
- `--name=<name>` → Set project name
|
||||||
|
- `--description=<desc>` → Set description
|
||||||
|
|
||||||
|
## Post-Initialization
|
||||||
|
|
||||||
|
After successful init:
|
||||||
|
1. Show project structure created
|
||||||
|
2. Verify AI models configured
|
||||||
|
3. Suggest next steps:
|
||||||
|
- Parse PRD if available
|
||||||
|
- Configure AI providers
|
||||||
|
- Set up git hooks
|
||||||
|
- Create first tasks
|
||||||
|
|
||||||
|
## Integration
|
||||||
|
|
||||||
|
If PRD file provided:
|
||||||
|
```
|
||||||
|
/project:tm/init my-prd.md
|
||||||
|
→ Automatically runs parse-prd after init
|
||||||
|
```
|
||||||
46
.claude/commands/tm/init/quick.md
Normal file
46
.claude/commands/tm/init/quick.md
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
Quick initialization with auto-confirmation.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
Initialize a Task Master project without prompts, accepting all defaults.
|
||||||
|
|
||||||
|
## Quick Setup
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master init -y
|
||||||
|
```
|
||||||
|
|
||||||
|
## What It Does
|
||||||
|
|
||||||
|
1. Creates `.taskmaster/` directory structure
|
||||||
|
2. Initializes empty `tasks.json`
|
||||||
|
3. Sets up default configuration
|
||||||
|
4. Uses directory name as project name
|
||||||
|
5. Skips all confirmation prompts
|
||||||
|
|
||||||
|
## Smart Defaults
|
||||||
|
|
||||||
|
- Project name: Current directory name
|
||||||
|
- Description: "Task Master Project"
|
||||||
|
- Model config: Existing environment vars
|
||||||
|
- Task structure: Standard format
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
After quick init:
|
||||||
|
1. Configure AI models if needed:
|
||||||
|
```
|
||||||
|
/project:tm/models/setup
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Parse PRD if available:
|
||||||
|
```
|
||||||
|
/project:tm/parse-prd <file>
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Or create first task:
|
||||||
|
```
|
||||||
|
/project:tm/add-task create initial setup
|
||||||
|
```
|
||||||
|
|
||||||
|
Perfect for rapid project setup!
|
||||||
103
.claude/commands/tm/learn.md
Normal file
103
.claude/commands/tm/learn.md
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
Learn about Task Master capabilities through interactive exploration.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
## Interactive Task Master Learning
|
||||||
|
|
||||||
|
Based on your input, I'll help you discover capabilities:
|
||||||
|
|
||||||
|
### 1. **What are you trying to do?**
|
||||||
|
|
||||||
|
If $ARGUMENTS contains:
|
||||||
|
- "start" / "begin" → Show project initialization workflows
|
||||||
|
- "manage" / "organize" → Show task management commands
|
||||||
|
- "automate" / "auto" → Show automation workflows
|
||||||
|
- "analyze" / "report" → Show analysis tools
|
||||||
|
- "fix" / "problem" → Show troubleshooting commands
|
||||||
|
- "fast" / "quick" → Show efficiency shortcuts
|
||||||
|
|
||||||
|
### 2. **Intelligent Suggestions**
|
||||||
|
|
||||||
|
Based on your project state:
|
||||||
|
|
||||||
|
**No tasks yet?**
|
||||||
|
```
|
||||||
|
You'll want to start with:
|
||||||
|
1. /project:task-master:init <prd-file>
|
||||||
|
→ Creates tasks from requirements
|
||||||
|
|
||||||
|
2. /project:task-master:parse-prd <file>
|
||||||
|
→ Alternative task generation
|
||||||
|
|
||||||
|
Try: /project:task-master:init demo-prd.md
|
||||||
|
```
|
||||||
|
|
||||||
|
**Have tasks?**
|
||||||
|
Let me analyze what you might need...
|
||||||
|
- Many pending tasks? → Learn sprint planning
|
||||||
|
- Complex tasks? → Learn task expansion
|
||||||
|
- Daily work? → Learn workflow automation
|
||||||
|
|
||||||
|
### 3. **Command Discovery**
|
||||||
|
|
||||||
|
**By Category:**
|
||||||
|
- 📋 Task Management: list, show, add, update, complete
|
||||||
|
- 🔄 Workflows: auto-implement, sprint-plan, daily-standup
|
||||||
|
- 🛠️ Utilities: check-health, complexity-report, sync-memory
|
||||||
|
- 🔍 Analysis: validate-deps, show dependencies
|
||||||
|
|
||||||
|
**By Scenario:**
|
||||||
|
- "I want to see what to work on" → `/project:task-master:next`
|
||||||
|
- "I need to break this down" → `/project:task-master:expand <id>`
|
||||||
|
- "Show me everything" → `/project:task-master:status`
|
||||||
|
- "Just do it for me" → `/project:workflows:auto-implement`
|
||||||
|
|
||||||
|
### 4. **Power User Patterns**
|
||||||
|
|
||||||
|
**Command Chaining:**
|
||||||
|
```
|
||||||
|
/project:task-master:next
|
||||||
|
/project:task-master:start <id>
|
||||||
|
/project:workflows:auto-implement
|
||||||
|
```
|
||||||
|
|
||||||
|
**Smart Filters:**
|
||||||
|
```
|
||||||
|
/project:task-master:list pending high
|
||||||
|
/project:task-master:list blocked
|
||||||
|
/project:task-master:list 1-5 tree
|
||||||
|
```
|
||||||
|
|
||||||
|
**Automation:**
|
||||||
|
```
|
||||||
|
/project:workflows:pipeline init → expand-all → sprint-plan
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. **Learning Path**
|
||||||
|
|
||||||
|
Based on your experience level:
|
||||||
|
|
||||||
|
**Beginner Path:**
|
||||||
|
1. init → Create project
|
||||||
|
2. status → Understand state
|
||||||
|
3. next → Find work
|
||||||
|
4. complete → Finish task
|
||||||
|
|
||||||
|
**Intermediate Path:**
|
||||||
|
1. expand → Break down complex tasks
|
||||||
|
2. sprint-plan → Organize work
|
||||||
|
3. complexity-report → Understand difficulty
|
||||||
|
4. validate-deps → Ensure consistency
|
||||||
|
|
||||||
|
**Advanced Path:**
|
||||||
|
1. pipeline → Chain operations
|
||||||
|
2. smart-flow → Context-aware automation
|
||||||
|
3. Custom commands → Extend the system
|
||||||
|
|
||||||
|
### 6. **Try This Now**
|
||||||
|
|
||||||
|
Based on what you asked about, try:
|
||||||
|
[Specific command suggestion based on $ARGUMENTS]
|
||||||
|
|
||||||
|
Want to learn more about a specific command?
|
||||||
|
Type: /project:help <command-name>
|
||||||
39
.claude/commands/tm/list/by-status.md
Normal file
39
.claude/commands/tm/list/by-status.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
List tasks filtered by a specific status.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
Parse the status from arguments and list only tasks matching that status.
|
||||||
|
|
||||||
|
## Status Options
|
||||||
|
- `pending` - Not yet started
|
||||||
|
- `in-progress` - Currently being worked on
|
||||||
|
- `done` - Completed
|
||||||
|
- `review` - Awaiting review
|
||||||
|
- `deferred` - Postponed
|
||||||
|
- `cancelled` - Cancelled
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
Based on $ARGUMENTS, run:
|
||||||
|
```bash
|
||||||
|
task-master list --status=$ARGUMENTS
|
||||||
|
```
|
||||||
|
|
||||||
|
## Enhanced Display
|
||||||
|
|
||||||
|
For the filtered results:
|
||||||
|
- Group by priority within the status
|
||||||
|
- Show time in current status
|
||||||
|
- Highlight tasks approaching deadlines
|
||||||
|
- Display blockers and dependencies
|
||||||
|
- Suggest next actions for each status group
|
||||||
|
|
||||||
|
## Intelligent Insights
|
||||||
|
|
||||||
|
Based on the status filter:
|
||||||
|
- **Pending**: Show recommended start order
|
||||||
|
- **In-Progress**: Display idle time warnings
|
||||||
|
- **Done**: Show newly unblocked tasks
|
||||||
|
- **Review**: Indicate review duration
|
||||||
|
- **Deferred**: Show reactivation criteria
|
||||||
|
- **Cancelled**: Display impact analysis
|
||||||
43
.claude/commands/tm/list/index.md
Normal file
43
.claude/commands/tm/list/index.md
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
List tasks with intelligent argument parsing.
|
||||||
|
|
||||||
|
Parse arguments to determine filters and display options:
|
||||||
|
- Status: pending, in-progress, done, review, deferred, cancelled
|
||||||
|
- Priority: high, medium, low (or priority:high)
|
||||||
|
- Special: subtasks, tree, dependencies, blocked
|
||||||
|
- IDs: Direct numbers (e.g., "1,3,5" or "1-5")
|
||||||
|
- Complex: "pending high" = pending AND high priority
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
Let me parse your request intelligently:
|
||||||
|
|
||||||
|
1. **Detect Filter Intent**
|
||||||
|
- If arguments contain status keywords → filter by status
|
||||||
|
- If arguments contain priority → filter by priority
|
||||||
|
- If arguments contain "subtasks" → include subtasks
|
||||||
|
- If arguments contain "tree" → hierarchical view
|
||||||
|
- If arguments contain numbers → show specific tasks
|
||||||
|
- If arguments contain "blocked" → show blocked tasks only
|
||||||
|
|
||||||
|
2. **Smart Combinations**
|
||||||
|
Examples of what I understand:
|
||||||
|
- "pending high" → pending tasks with high priority
|
||||||
|
- "done today" → tasks completed today
|
||||||
|
- "blocked" → tasks with unmet dependencies
|
||||||
|
- "1-5" → tasks 1 through 5
|
||||||
|
- "subtasks tree" → hierarchical view with subtasks
|
||||||
|
|
||||||
|
3. **Execute Appropriate Query**
|
||||||
|
Based on parsed intent, run the most specific task-master command
|
||||||
|
|
||||||
|
4. **Enhanced Display**
|
||||||
|
- Group by relevant criteria
|
||||||
|
- Show most important information first
|
||||||
|
- Use visual indicators for quick scanning
|
||||||
|
- Include relevant metrics
|
||||||
|
|
||||||
|
5. **Intelligent Suggestions**
|
||||||
|
Based on what you're viewing, suggest next actions:
|
||||||
|
- Many pending? → Suggest priority order
|
||||||
|
- Many blocked? → Show dependency resolution
|
||||||
|
- Looking at specific tasks? → Show related tasks
|
||||||
29
.claude/commands/tm/list/with-subtasks.md
Normal file
29
.claude/commands/tm/list/with-subtasks.md
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
List all tasks including their subtasks in a hierarchical view.
|
||||||
|
|
||||||
|
This command shows all tasks with their nested subtasks, providing a complete project overview.
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
Run the Task Master list command with subtasks flag:
|
||||||
|
```bash
|
||||||
|
task-master list --with-subtasks
|
||||||
|
```
|
||||||
|
|
||||||
|
## Enhanced Display
|
||||||
|
|
||||||
|
I'll organize the output to show:
|
||||||
|
- Parent tasks with clear indicators
|
||||||
|
- Nested subtasks with proper indentation
|
||||||
|
- Status badges for quick scanning
|
||||||
|
- Dependencies and blockers highlighted
|
||||||
|
- Progress indicators for tasks with subtasks
|
||||||
|
|
||||||
|
## Smart Filtering
|
||||||
|
|
||||||
|
Based on the task hierarchy:
|
||||||
|
- Show completion percentage for parent tasks
|
||||||
|
- Highlight blocked subtask chains
|
||||||
|
- Group by functional areas
|
||||||
|
- Indicate critical path items
|
||||||
|
|
||||||
|
This gives you a complete tree view of your project structure.
|
||||||
51
.claude/commands/tm/models/index.md
Normal file
51
.claude/commands/tm/models/index.md
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
View current AI model configuration.
|
||||||
|
|
||||||
|
## Model Configuration Display
|
||||||
|
|
||||||
|
Shows the currently configured AI providers and models for Task Master.
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master models
|
||||||
|
```
|
||||||
|
|
||||||
|
## Information Displayed
|
||||||
|
|
||||||
|
1. **Main Provider**
|
||||||
|
- Model ID and name
|
||||||
|
- API key status (configured/missing)
|
||||||
|
- Usage: Primary task generation
|
||||||
|
|
||||||
|
2. **Research Provider**
|
||||||
|
- Model ID and name
|
||||||
|
- API key status
|
||||||
|
- Usage: Enhanced research mode
|
||||||
|
|
||||||
|
3. **Fallback Provider**
|
||||||
|
- Model ID and name
|
||||||
|
- API key status
|
||||||
|
- Usage: Backup when main fails
|
||||||
|
|
||||||
|
## Visual Status
|
||||||
|
|
||||||
|
```
|
||||||
|
Task Master AI Model Configuration
|
||||||
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
Main: ✅ claude-3-5-sonnet (configured)
|
||||||
|
Research: ✅ perplexity-sonar (configured)
|
||||||
|
Fallback: ⚠️ Not configured (optional)
|
||||||
|
|
||||||
|
Available Models:
|
||||||
|
- claude-3-5-sonnet
|
||||||
|
- gpt-4-turbo
|
||||||
|
- gpt-3.5-turbo
|
||||||
|
- perplexity-sonar
|
||||||
|
```
|
||||||
|
|
||||||
|
## Next Actions
|
||||||
|
|
||||||
|
Based on configuration:
|
||||||
|
- If missing API keys → Suggest setup
|
||||||
|
- If no research model → Explain benefits
|
||||||
|
- If all configured → Show usage tips
|
||||||
51
.claude/commands/tm/models/setup.md
Normal file
51
.claude/commands/tm/models/setup.md
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
Run interactive setup to configure AI models.
|
||||||
|
|
||||||
|
## Interactive Model Configuration
|
||||||
|
|
||||||
|
Guides you through setting up AI providers for Task Master.
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master models --setup
|
||||||
|
```
|
||||||
|
|
||||||
|
## Setup Process
|
||||||
|
|
||||||
|
1. **Environment Check**
|
||||||
|
- Detect existing API keys
|
||||||
|
- Show current configuration
|
||||||
|
- Identify missing providers
|
||||||
|
|
||||||
|
2. **Provider Selection**
|
||||||
|
- Choose main provider (required)
|
||||||
|
- Select research provider (recommended)
|
||||||
|
- Configure fallback (optional)
|
||||||
|
|
||||||
|
3. **API Key Configuration**
|
||||||
|
- Prompt for missing keys
|
||||||
|
- Validate key format
|
||||||
|
- Test connectivity
|
||||||
|
- Save configuration
|
||||||
|
|
||||||
|
## Smart Recommendations
|
||||||
|
|
||||||
|
Based on your needs:
|
||||||
|
- **For best results**: Claude + Perplexity
|
||||||
|
- **Budget conscious**: GPT-3.5 + Perplexity
|
||||||
|
- **Maximum capability**: GPT-4 + Perplexity + Claude fallback
|
||||||
|
|
||||||
|
## Configuration Storage
|
||||||
|
|
||||||
|
Keys can be stored in:
|
||||||
|
1. Environment variables (recommended)
|
||||||
|
2. `.env` file in project
|
||||||
|
3. Global `.taskmaster/config`
|
||||||
|
|
||||||
|
## Post-Setup
|
||||||
|
|
||||||
|
After configuration:
|
||||||
|
- Test each provider
|
||||||
|
- Show usage examples
|
||||||
|
- Suggest next steps
|
||||||
|
- Verify parse-prd works
|
||||||
66
.claude/commands/tm/next/index.md
Normal file
66
.claude/commands/tm/next/index.md
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
Intelligently determine and prepare the next action based on comprehensive context.
|
||||||
|
|
||||||
|
This enhanced version of 'next' considers:
|
||||||
|
- Current task states
|
||||||
|
- Recent activity
|
||||||
|
- Time constraints
|
||||||
|
- Dependencies
|
||||||
|
- Your working patterns
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
## Intelligent Next Action
|
||||||
|
|
||||||
|
### 1. **Context Gathering**
|
||||||
|
Let me analyze the current situation:
|
||||||
|
- Active tasks (in-progress)
|
||||||
|
- Recently completed tasks
|
||||||
|
- Blocked tasks
|
||||||
|
- Time since last activity
|
||||||
|
- Arguments provided: $ARGUMENTS
|
||||||
|
|
||||||
|
### 2. **Smart Decision Tree**
|
||||||
|
|
||||||
|
**If you have an in-progress task:**
|
||||||
|
- Has it been idle > 2 hours? → Suggest resuming or switching
|
||||||
|
- Near completion? → Show remaining steps
|
||||||
|
- Blocked? → Find alternative task
|
||||||
|
|
||||||
|
**If no in-progress tasks:**
|
||||||
|
- Unblocked high-priority tasks? → Start highest
|
||||||
|
- Complex tasks need breakdown? → Suggest expansion
|
||||||
|
- All tasks blocked? → Show dependency resolution
|
||||||
|
|
||||||
|
**Special arguments handling:**
|
||||||
|
- "quick" → Find task < 2 hours
|
||||||
|
- "easy" → Find low complexity task
|
||||||
|
- "important" → Find high priority regardless of complexity
|
||||||
|
- "continue" → Resume last worked task
|
||||||
|
|
||||||
|
### 3. **Preparation Workflow**
|
||||||
|
|
||||||
|
Based on selected task:
|
||||||
|
1. Show full context and history
|
||||||
|
2. Set up development environment
|
||||||
|
3. Run relevant tests
|
||||||
|
4. Open related files
|
||||||
|
5. Show similar completed tasks
|
||||||
|
6. Estimate completion time
|
||||||
|
|
||||||
|
### 4. **Alternative Suggestions**
|
||||||
|
|
||||||
|
Always provide options:
|
||||||
|
- Primary recommendation
|
||||||
|
- Quick alternative (< 1 hour)
|
||||||
|
- Strategic option (unblocks most tasks)
|
||||||
|
- Learning option (new technology/skill)
|
||||||
|
|
||||||
|
### 5. **Workflow Integration**
|
||||||
|
|
||||||
|
Seamlessly connect to:
|
||||||
|
- `/project:task-master:start [selected]`
|
||||||
|
- `/project:workflows:auto-implement`
|
||||||
|
- `/project:task-master:expand` (if complex)
|
||||||
|
- `/project:utils:complexity-report` (if unsure)
|
||||||
|
|
||||||
|
The goal: Zero friction from decision to implementation.
|
||||||
49
.claude/commands/tm/parse-prd/index.md
Normal file
49
.claude/commands/tm/parse-prd/index.md
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
Parse a PRD document to generate tasks.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS (PRD file path)
|
||||||
|
|
||||||
|
## Intelligent PRD Parsing
|
||||||
|
|
||||||
|
Analyzes your requirements document and generates a complete task breakdown.
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master parse-prd --input=$ARGUMENTS
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parsing Process
|
||||||
|
|
||||||
|
1. **Document Analysis**
|
||||||
|
- Extract key requirements
|
||||||
|
- Identify technical components
|
||||||
|
- Detect dependencies
|
||||||
|
- Estimate complexity
|
||||||
|
|
||||||
|
2. **Task Generation**
|
||||||
|
- Create 10-15 tasks by default
|
||||||
|
- Include implementation tasks
|
||||||
|
- Add testing tasks
|
||||||
|
- Include documentation tasks
|
||||||
|
- Set logical dependencies
|
||||||
|
|
||||||
|
3. **Smart Enhancements**
|
||||||
|
- Group related functionality
|
||||||
|
- Set appropriate priorities
|
||||||
|
- Add acceptance criteria
|
||||||
|
- Include test strategies
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
Parse arguments for modifiers:
|
||||||
|
- Number after filename → `--num-tasks`
|
||||||
|
- `research` → Use research mode
|
||||||
|
- `comprehensive` → Generate more tasks
|
||||||
|
|
||||||
|
## Post-Generation
|
||||||
|
|
||||||
|
After parsing:
|
||||||
|
1. Display task summary
|
||||||
|
2. Show dependency graph
|
||||||
|
3. Suggest task expansion for complex items
|
||||||
|
4. Recommend sprint planning
|
||||||
48
.claude/commands/tm/parse-prd/with-research.md
Normal file
48
.claude/commands/tm/parse-prd/with-research.md
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
Parse PRD with enhanced research mode for better task generation.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS (PRD file path)
|
||||||
|
|
||||||
|
## Research-Enhanced Parsing
|
||||||
|
|
||||||
|
Uses the research AI provider (typically Perplexity) for more comprehensive task generation with current best practices.
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master parse-prd --input=$ARGUMENTS --research
|
||||||
|
```
|
||||||
|
|
||||||
|
## Research Benefits
|
||||||
|
|
||||||
|
1. **Current Best Practices**
|
||||||
|
- Latest framework patterns
|
||||||
|
- Security considerations
|
||||||
|
- Performance optimizations
|
||||||
|
- Accessibility requirements
|
||||||
|
|
||||||
|
2. **Technical Deep Dive**
|
||||||
|
- Implementation approaches
|
||||||
|
- Library recommendations
|
||||||
|
- Architecture patterns
|
||||||
|
- Testing strategies
|
||||||
|
|
||||||
|
3. **Comprehensive Coverage**
|
||||||
|
- Edge cases consideration
|
||||||
|
- Error handling tasks
|
||||||
|
- Monitoring setup
|
||||||
|
- Deployment tasks
|
||||||
|
|
||||||
|
## Enhanced Output
|
||||||
|
|
||||||
|
Research mode typically:
|
||||||
|
- Generates more detailed tasks
|
||||||
|
- Includes industry standards
|
||||||
|
- Adds compliance considerations
|
||||||
|
- Suggests modern tooling
|
||||||
|
|
||||||
|
## When to Use
|
||||||
|
|
||||||
|
- New technology domains
|
||||||
|
- Complex requirements
|
||||||
|
- Regulatory compliance needed
|
||||||
|
- Best practices crucial
|
||||||
62
.claude/commands/tm/remove-dependency/index.md
Normal file
62
.claude/commands/tm/remove-dependency/index.md
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
Remove a dependency between tasks.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
Parse the task IDs to remove dependency relationship.
|
||||||
|
|
||||||
|
## Removing Dependencies
|
||||||
|
|
||||||
|
Removes a dependency relationship, potentially unblocking tasks.
|
||||||
|
|
||||||
|
## Argument Parsing
|
||||||
|
|
||||||
|
Parse natural language or IDs:
|
||||||
|
- "remove dependency between 5 and 3"
|
||||||
|
- "5 no longer needs 3"
|
||||||
|
- "unblock 5 from 3"
|
||||||
|
- "5 3" → remove dependency of 5 on 3
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master remove-dependency --id=<task-id> --depends-on=<dependency-id>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Pre-Removal Checks
|
||||||
|
|
||||||
|
1. **Verify dependency exists**
|
||||||
|
2. **Check impact on task flow**
|
||||||
|
3. **Warn if it breaks logical sequence**
|
||||||
|
4. **Show what will be unblocked**
|
||||||
|
|
||||||
|
## Smart Analysis
|
||||||
|
|
||||||
|
Before removing:
|
||||||
|
- Show why dependency might have existed
|
||||||
|
- Check if removal makes tasks executable
|
||||||
|
- Verify no critical path disruption
|
||||||
|
- Suggest alternative dependencies
|
||||||
|
|
||||||
|
## Post-Removal
|
||||||
|
|
||||||
|
After removing:
|
||||||
|
1. Show updated task status
|
||||||
|
2. List newly unblocked tasks
|
||||||
|
3. Update project timeline
|
||||||
|
4. Suggest next actions
|
||||||
|
|
||||||
|
## Safety Features
|
||||||
|
|
||||||
|
- Confirm if removing critical dependency
|
||||||
|
- Show tasks that become immediately actionable
|
||||||
|
- Warn about potential issues
|
||||||
|
- Keep removal history
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```
|
||||||
|
/project:tm/remove-dependency 5 from 3
|
||||||
|
→ Removed: Task #5 no longer depends on #3
|
||||||
|
→ Task #5 is now UNBLOCKED and ready to start
|
||||||
|
→ Warning: Consider if #5 still needs #2 completed first
|
||||||
|
```
|
||||||
84
.claude/commands/tm/remove-subtask/index.md
Normal file
84
.claude/commands/tm/remove-subtask/index.md
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
Remove a subtask from its parent task.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
Parse subtask ID to remove, with option to convert to standalone task.
|
||||||
|
|
||||||
|
## Removing Subtasks
|
||||||
|
|
||||||
|
Remove a subtask and optionally convert it back to a standalone task.
|
||||||
|
|
||||||
|
## Argument Parsing
|
||||||
|
|
||||||
|
- "remove subtask 5.1"
|
||||||
|
- "delete 5.1"
|
||||||
|
- "convert 5.1 to task" → remove and convert
|
||||||
|
- "5.1 standalone" → convert to standalone
|
||||||
|
|
||||||
|
## Execution Options
|
||||||
|
|
||||||
|
### 1. Delete Subtask
|
||||||
|
```bash
|
||||||
|
task-master remove-subtask --id=<parentId.subtaskId>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Convert to Standalone
|
||||||
|
```bash
|
||||||
|
task-master remove-subtask --id=<parentId.subtaskId> --convert
|
||||||
|
```
|
||||||
|
|
||||||
|
## Pre-Removal Checks
|
||||||
|
|
||||||
|
1. **Validate Subtask**
|
||||||
|
- Verify subtask exists
|
||||||
|
- Check completion status
|
||||||
|
- Review dependencies
|
||||||
|
|
||||||
|
2. **Impact Analysis**
|
||||||
|
- Other subtasks that depend on it
|
||||||
|
- Parent task implications
|
||||||
|
- Data that will be lost
|
||||||
|
|
||||||
|
## Removal Process
|
||||||
|
|
||||||
|
### For Deletion:
|
||||||
|
1. Confirm if subtask has work done
|
||||||
|
2. Update parent task estimates
|
||||||
|
3. Remove subtask and its data
|
||||||
|
4. Clean up dependencies
|
||||||
|
|
||||||
|
### For Conversion:
|
||||||
|
1. Assign new standalone task ID
|
||||||
|
2. Preserve all task data
|
||||||
|
3. Update dependency references
|
||||||
|
4. Maintain task history
|
||||||
|
|
||||||
|
## Smart Features
|
||||||
|
|
||||||
|
- Warn if subtask is in-progress
|
||||||
|
- Show impact on parent task
|
||||||
|
- Preserve important data
|
||||||
|
- Update related estimates
|
||||||
|
|
||||||
|
## Example Flows
|
||||||
|
|
||||||
|
```
|
||||||
|
/project:tm/remove-subtask 5.1
|
||||||
|
→ Warning: Subtask #5.1 is in-progress
|
||||||
|
→ This will delete all subtask data
|
||||||
|
→ Parent task #5 will be updated
|
||||||
|
Confirm deletion? (y/n)
|
||||||
|
|
||||||
|
/project:tm/remove-subtask 5.1 convert
|
||||||
|
→ Converting subtask #5.1 to standalone task #89
|
||||||
|
→ Preserved: All task data and history
|
||||||
|
→ Updated: 2 dependency references
|
||||||
|
→ New task #89 is now independent
|
||||||
|
```
|
||||||
|
|
||||||
|
## Post-Removal
|
||||||
|
|
||||||
|
- Update parent task status
|
||||||
|
- Recalculate estimates
|
||||||
|
- Show updated hierarchy
|
||||||
|
- Suggest next actions
|
||||||
107
.claude/commands/tm/remove-task/index.md
Normal file
107
.claude/commands/tm/remove-task/index.md
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
Remove a task permanently from the project.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS (task ID)
|
||||||
|
|
||||||
|
Delete a task and handle all its relationships properly.
|
||||||
|
|
||||||
|
## Task Removal
|
||||||
|
|
||||||
|
Permanently removes a task while maintaining project integrity.
|
||||||
|
|
||||||
|
## Argument Parsing
|
||||||
|
|
||||||
|
- "remove task 5"
|
||||||
|
- "delete 5"
|
||||||
|
- "5" → remove task 5
|
||||||
|
- Can include "-y" for auto-confirm
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master remove-task --id=<id> [-y]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Pre-Removal Analysis
|
||||||
|
|
||||||
|
1. **Task Details**
|
||||||
|
- Current status
|
||||||
|
- Work completed
|
||||||
|
- Time invested
|
||||||
|
- Associated data
|
||||||
|
|
||||||
|
2. **Relationship Check**
|
||||||
|
- Tasks that depend on this
|
||||||
|
- Dependencies this task has
|
||||||
|
- Subtasks that will be removed
|
||||||
|
- Blocking implications
|
||||||
|
|
||||||
|
3. **Impact Assessment**
|
||||||
|
```
|
||||||
|
Task Removal Impact
|
||||||
|
━━━━━━━━━━━━━━━━━━
|
||||||
|
Task: #5 "Implement authentication" (in-progress)
|
||||||
|
Status: 60% complete (~8 hours work)
|
||||||
|
|
||||||
|
Will affect:
|
||||||
|
- 3 tasks depend on this (will be blocked)
|
||||||
|
- Has 4 subtasks (will be deleted)
|
||||||
|
- Part of critical path
|
||||||
|
|
||||||
|
⚠️ This action cannot be undone
|
||||||
|
```
|
||||||
|
|
||||||
|
## Smart Warnings
|
||||||
|
|
||||||
|
- Warn if task is in-progress
|
||||||
|
- Show dependent tasks that will be blocked
|
||||||
|
- Highlight if part of critical path
|
||||||
|
- Note any completed work being lost
|
||||||
|
|
||||||
|
## Removal Process
|
||||||
|
|
||||||
|
1. Show comprehensive impact
|
||||||
|
2. Require confirmation (unless -y)
|
||||||
|
3. Update dependent task references
|
||||||
|
4. Remove task and subtasks
|
||||||
|
5. Clean up orphaned dependencies
|
||||||
|
6. Log removal with timestamp
|
||||||
|
|
||||||
|
## Alternative Actions
|
||||||
|
|
||||||
|
Suggest before deletion:
|
||||||
|
- Mark as cancelled instead
|
||||||
|
- Convert to documentation
|
||||||
|
- Archive task data
|
||||||
|
- Transfer work to another task
|
||||||
|
|
||||||
|
## Post-Removal
|
||||||
|
|
||||||
|
- List affected tasks
|
||||||
|
- Show broken dependencies
|
||||||
|
- Update project statistics
|
||||||
|
- Suggest dependency fixes
|
||||||
|
- Recalculate timeline
|
||||||
|
|
||||||
|
## Example Flows
|
||||||
|
|
||||||
|
```
|
||||||
|
/project:tm/remove-task 5
|
||||||
|
→ Task #5 is in-progress with 8 hours logged
|
||||||
|
→ 3 other tasks depend on this
|
||||||
|
→ Suggestion: Mark as cancelled instead?
|
||||||
|
Remove anyway? (y/n)
|
||||||
|
|
||||||
|
/project:tm/remove-task 5 -y
|
||||||
|
→ Removed: Task #5 and 4 subtasks
|
||||||
|
→ Updated: 3 task dependencies
|
||||||
|
→ Warning: Tasks #7, #8, #9 now have missing dependency
|
||||||
|
→ Run /project:tm/fix-dependencies to resolve
|
||||||
|
```
|
||||||
|
|
||||||
|
## Safety Features
|
||||||
|
|
||||||
|
- Confirmation required
|
||||||
|
- Impact preview
|
||||||
|
- Removal logging
|
||||||
|
- Suggest alternatives
|
||||||
|
- No cascade delete of dependents
|
||||||
55
.claude/commands/tm/set-status/to-cancelled.md
Normal file
55
.claude/commands/tm/set-status/to-cancelled.md
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
Cancel a task permanently.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS (task ID)
|
||||||
|
|
||||||
|
## Cancelling a Task
|
||||||
|
|
||||||
|
This status indicates a task is no longer needed and won't be completed.
|
||||||
|
|
||||||
|
## Valid Reasons for Cancellation
|
||||||
|
|
||||||
|
- Requirements changed
|
||||||
|
- Feature deprecated
|
||||||
|
- Duplicate of another task
|
||||||
|
- Strategic pivot
|
||||||
|
- Technical approach invalidated
|
||||||
|
|
||||||
|
## Pre-Cancellation Checks
|
||||||
|
|
||||||
|
1. Confirm no critical dependencies
|
||||||
|
2. Check for partial implementation
|
||||||
|
3. Verify cancellation rationale
|
||||||
|
4. Document lessons learned
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master set-status --id=$ARGUMENTS --status=cancelled
|
||||||
|
```
|
||||||
|
|
||||||
|
## Cancellation Impact
|
||||||
|
|
||||||
|
When cancelling:
|
||||||
|
1. **Dependency Updates**
|
||||||
|
- Notify dependent tasks
|
||||||
|
- Update project scope
|
||||||
|
- Recalculate timelines
|
||||||
|
|
||||||
|
2. **Clean-up Actions**
|
||||||
|
- Remove related branches
|
||||||
|
- Archive any work done
|
||||||
|
- Update documentation
|
||||||
|
- Close related issues
|
||||||
|
|
||||||
|
3. **Learning Capture**
|
||||||
|
- Document why cancelled
|
||||||
|
- Note what was learned
|
||||||
|
- Update estimation models
|
||||||
|
- Prevent future duplicates
|
||||||
|
|
||||||
|
## Historical Preservation
|
||||||
|
|
||||||
|
- Keep for reference
|
||||||
|
- Tag with cancellation reason
|
||||||
|
- Link to replacement if any
|
||||||
|
- Maintain audit trail
|
||||||
47
.claude/commands/tm/set-status/to-deferred.md
Normal file
47
.claude/commands/tm/set-status/to-deferred.md
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
Defer a task for later consideration.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS (task ID)
|
||||||
|
|
||||||
|
## Deferring a Task
|
||||||
|
|
||||||
|
This status indicates a task is valid but not currently actionable or prioritized.
|
||||||
|
|
||||||
|
## Valid Reasons for Deferral
|
||||||
|
|
||||||
|
- Waiting for external dependencies
|
||||||
|
- Reprioritized for future sprint
|
||||||
|
- Blocked by technical limitations
|
||||||
|
- Resource constraints
|
||||||
|
- Strategic timing considerations
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master set-status --id=$ARGUMENTS --status=deferred
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deferral Management
|
||||||
|
|
||||||
|
When deferring:
|
||||||
|
1. **Document Reason**
|
||||||
|
- Capture why it's being deferred
|
||||||
|
- Set reactivation criteria
|
||||||
|
- Note any partial work completed
|
||||||
|
|
||||||
|
2. **Impact Analysis**
|
||||||
|
- Check dependent tasks
|
||||||
|
- Update project timeline
|
||||||
|
- Notify affected stakeholders
|
||||||
|
|
||||||
|
3. **Future Planning**
|
||||||
|
- Set review reminders
|
||||||
|
- Tag for specific milestone
|
||||||
|
- Preserve context for reactivation
|
||||||
|
- Link to blocking issues
|
||||||
|
|
||||||
|
## Smart Tracking
|
||||||
|
|
||||||
|
- Monitor deferral duration
|
||||||
|
- Alert when criteria met
|
||||||
|
- Prevent scope creep
|
||||||
|
- Regular review cycles
|
||||||
44
.claude/commands/tm/set-status/to-done.md
Normal file
44
.claude/commands/tm/set-status/to-done.md
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
Mark a task as completed.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS (task ID)
|
||||||
|
|
||||||
|
## Completing a Task
|
||||||
|
|
||||||
|
This command validates task completion and updates project state intelligently.
|
||||||
|
|
||||||
|
## Pre-Completion Checks
|
||||||
|
|
||||||
|
1. Verify test strategy was followed
|
||||||
|
2. Check if all subtasks are complete
|
||||||
|
3. Validate acceptance criteria met
|
||||||
|
4. Ensure code is committed
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master set-status --id=$ARGUMENTS --status=done
|
||||||
|
```
|
||||||
|
|
||||||
|
## Post-Completion Actions
|
||||||
|
|
||||||
|
1. **Update Dependencies**
|
||||||
|
- Identify newly unblocked tasks
|
||||||
|
- Update sprint progress
|
||||||
|
- Recalculate project timeline
|
||||||
|
|
||||||
|
2. **Documentation**
|
||||||
|
- Generate completion summary
|
||||||
|
- Update CLAUDE.md with learnings
|
||||||
|
- Log implementation approach
|
||||||
|
|
||||||
|
3. **Next Steps**
|
||||||
|
- Show newly available tasks
|
||||||
|
- Suggest logical next task
|
||||||
|
- Update velocity metrics
|
||||||
|
|
||||||
|
## Celebration & Learning
|
||||||
|
|
||||||
|
- Show impact of completion
|
||||||
|
- Display unblocked work
|
||||||
|
- Recognize achievement
|
||||||
|
- Capture lessons learned
|
||||||
36
.claude/commands/tm/set-status/to-in-progress.md
Normal file
36
.claude/commands/tm/set-status/to-in-progress.md
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
Start working on a task by setting its status to in-progress.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS (task ID)
|
||||||
|
|
||||||
|
## Starting Work on Task
|
||||||
|
|
||||||
|
This command does more than just change status - it prepares your environment for productive work.
|
||||||
|
|
||||||
|
## Pre-Start Checks
|
||||||
|
|
||||||
|
1. Verify dependencies are met
|
||||||
|
2. Check if another task is already in-progress
|
||||||
|
3. Ensure task details are complete
|
||||||
|
4. Validate test strategy exists
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master set-status --id=$ARGUMENTS --status=in-progress
|
||||||
|
```
|
||||||
|
|
||||||
|
## Environment Setup
|
||||||
|
|
||||||
|
After setting to in-progress:
|
||||||
|
1. Create/checkout appropriate git branch
|
||||||
|
2. Open relevant documentation
|
||||||
|
3. Set up test watchers if applicable
|
||||||
|
4. Display task details and acceptance criteria
|
||||||
|
5. Show similar completed tasks for reference
|
||||||
|
|
||||||
|
## Smart Suggestions
|
||||||
|
|
||||||
|
- Estimated completion time based on complexity
|
||||||
|
- Related files from similar tasks
|
||||||
|
- Potential blockers to watch for
|
||||||
|
- Recommended first steps
|
||||||
32
.claude/commands/tm/set-status/to-pending.md
Normal file
32
.claude/commands/tm/set-status/to-pending.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
Set a task's status to pending.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS (task ID)
|
||||||
|
|
||||||
|
## Setting Task to Pending
|
||||||
|
|
||||||
|
This moves a task back to the pending state, useful for:
|
||||||
|
- Resetting erroneously started tasks
|
||||||
|
- Deferring work that was prematurely begun
|
||||||
|
- Reorganizing sprint priorities
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master set-status --id=$ARGUMENTS --status=pending
|
||||||
|
```
|
||||||
|
|
||||||
|
## Validation
|
||||||
|
|
||||||
|
Before setting to pending:
|
||||||
|
- Warn if task is currently in-progress
|
||||||
|
- Check if this will block other tasks
|
||||||
|
- Suggest documenting why it's being reset
|
||||||
|
- Preserve any work already done
|
||||||
|
|
||||||
|
## Smart Actions
|
||||||
|
|
||||||
|
After setting to pending:
|
||||||
|
- Update sprint planning if needed
|
||||||
|
- Notify about freed resources
|
||||||
|
- Suggest priority reassessment
|
||||||
|
- Log the status change with context
|
||||||
40
.claude/commands/tm/set-status/to-review.md
Normal file
40
.claude/commands/tm/set-status/to-review.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
Set a task's status to review.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS (task ID)
|
||||||
|
|
||||||
|
## Marking Task for Review
|
||||||
|
|
||||||
|
This status indicates work is complete but needs verification before final approval.
|
||||||
|
|
||||||
|
## When to Use Review Status
|
||||||
|
|
||||||
|
- Code complete but needs peer review
|
||||||
|
- Implementation done but needs testing
|
||||||
|
- Documentation written but needs proofreading
|
||||||
|
- Design complete but needs stakeholder approval
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master set-status --id=$ARGUMENTS --status=review
|
||||||
|
```
|
||||||
|
|
||||||
|
## Review Preparation
|
||||||
|
|
||||||
|
When setting to review:
|
||||||
|
1. **Generate Review Checklist**
|
||||||
|
- Link to PR/MR if applicable
|
||||||
|
- Highlight key changes
|
||||||
|
- Note areas needing attention
|
||||||
|
- Include test results
|
||||||
|
|
||||||
|
2. **Documentation**
|
||||||
|
- Update task with review notes
|
||||||
|
- Link relevant artifacts
|
||||||
|
- Specify reviewers if known
|
||||||
|
|
||||||
|
3. **Smart Actions**
|
||||||
|
- Create review reminders
|
||||||
|
- Track review duration
|
||||||
|
- Suggest reviewers based on expertise
|
||||||
|
- Prepare rollback plan if needed
|
||||||
117
.claude/commands/tm/setup/install.md
Normal file
117
.claude/commands/tm/setup/install.md
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
Check if Task Master is installed and install it if needed.
|
||||||
|
|
||||||
|
This command helps you get Task Master set up globally on your system.
|
||||||
|
|
||||||
|
## Detection and Installation Process
|
||||||
|
|
||||||
|
1. **Check Current Installation**
|
||||||
|
```bash
|
||||||
|
# Check if task-master command exists
|
||||||
|
which task-master || echo "Task Master not found"
|
||||||
|
|
||||||
|
# Check npm global packages
|
||||||
|
npm list -g task-master-ai
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **System Requirements Check**
|
||||||
|
```bash
|
||||||
|
# Verify Node.js is installed
|
||||||
|
node --version
|
||||||
|
|
||||||
|
# Verify npm is installed
|
||||||
|
npm --version
|
||||||
|
|
||||||
|
# Check Node version (need 16+)
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Install Task Master Globally**
|
||||||
|
If not installed, run:
|
||||||
|
```bash
|
||||||
|
npm install -g task-master-ai
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Verify Installation**
|
||||||
|
```bash
|
||||||
|
# Check version
|
||||||
|
task-master --version
|
||||||
|
|
||||||
|
# Verify command is available
|
||||||
|
which task-master
|
||||||
|
```
|
||||||
|
|
||||||
|
5. **Initial Setup**
|
||||||
|
```bash
|
||||||
|
# Initialize in current directory
|
||||||
|
task-master init
|
||||||
|
```
|
||||||
|
|
||||||
|
6. **Configure AI Provider**
|
||||||
|
Ensure you have at least one AI provider API key set:
|
||||||
|
```bash
|
||||||
|
# Check current configuration
|
||||||
|
task-master models --status
|
||||||
|
|
||||||
|
# If no API keys found, guide setup
|
||||||
|
echo "You'll need at least one API key:"
|
||||||
|
echo "- ANTHROPIC_API_KEY for Claude"
|
||||||
|
echo "- OPENAI_API_KEY for GPT models"
|
||||||
|
echo "- PERPLEXITY_API_KEY for research"
|
||||||
|
echo ""
|
||||||
|
echo "Set them in your shell profile or .env file"
|
||||||
|
```
|
||||||
|
|
||||||
|
7. **Quick Test**
|
||||||
|
```bash
|
||||||
|
# Create a test PRD
|
||||||
|
echo "Build a simple hello world API" > test-prd.txt
|
||||||
|
|
||||||
|
# Try parsing it
|
||||||
|
task-master parse-prd test-prd.txt -n 3
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
If installation fails:
|
||||||
|
|
||||||
|
**Permission Errors:**
|
||||||
|
```bash
|
||||||
|
# Try with sudo (macOS/Linux)
|
||||||
|
sudo npm install -g task-master-ai
|
||||||
|
|
||||||
|
# Or fix npm permissions
|
||||||
|
npm config set prefix ~/.npm-global
|
||||||
|
export PATH=~/.npm-global/bin:$PATH
|
||||||
|
```
|
||||||
|
|
||||||
|
**Network Issues:**
|
||||||
|
```bash
|
||||||
|
# Use different registry
|
||||||
|
npm install -g task-master-ai --registry https://registry.npmjs.org/
|
||||||
|
```
|
||||||
|
|
||||||
|
**Node Version Issues:**
|
||||||
|
```bash
|
||||||
|
# Install Node 18+ via nvm
|
||||||
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
|
||||||
|
nvm install 18
|
||||||
|
nvm use 18
|
||||||
|
```
|
||||||
|
|
||||||
|
## Success Confirmation
|
||||||
|
|
||||||
|
Once installed, you should see:
|
||||||
|
```
|
||||||
|
✅ Task Master v0.16.2 (or higher) installed
|
||||||
|
✅ Command 'task-master' available globally
|
||||||
|
✅ AI provider configured
|
||||||
|
✅ Ready to use slash commands!
|
||||||
|
|
||||||
|
Try: /project:task-master:init your-prd.md
|
||||||
|
```
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
After installation:
|
||||||
|
1. Run `/project:utils:check-health` to verify setup
|
||||||
|
2. Configure AI providers with `/project:task-master:models`
|
||||||
|
3. Start using Task Master commands!
|
||||||
22
.claude/commands/tm/setup/quick-install.md
Normal file
22
.claude/commands/tm/setup/quick-install.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
Quick install Task Master globally if not already installed.
|
||||||
|
|
||||||
|
Execute this streamlined installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Check and install in one command
|
||||||
|
task-master --version 2>/dev/null || npm install -g task-master-ai
|
||||||
|
|
||||||
|
# Verify installation
|
||||||
|
task-master --version
|
||||||
|
|
||||||
|
# Quick setup check
|
||||||
|
task-master models --status || echo "Note: You'll need to set up an AI provider API key"
|
||||||
|
```
|
||||||
|
|
||||||
|
If you see "command not found" after installation, you may need to:
|
||||||
|
1. Restart your terminal
|
||||||
|
2. Or add npm global bin to PATH: `export PATH=$(npm bin -g):$PATH`
|
||||||
|
|
||||||
|
Once installed, you can use all the Task Master commands!
|
||||||
|
|
||||||
|
Quick test: Run `/project:help` to see all available commands.
|
||||||
82
.claude/commands/tm/show/index.md
Normal file
82
.claude/commands/tm/show/index.md
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
Show detailed task information with rich context and insights.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
## Enhanced Task Display
|
||||||
|
|
||||||
|
Parse arguments to determine what to show and how.
|
||||||
|
|
||||||
|
### 1. **Smart Task Selection**
|
||||||
|
|
||||||
|
Based on $ARGUMENTS:
|
||||||
|
- Number → Show specific task with full context
|
||||||
|
- "current" → Show active in-progress task(s)
|
||||||
|
- "next" → Show recommended next task
|
||||||
|
- "blocked" → Show all blocked tasks with reasons
|
||||||
|
- "critical" → Show critical path tasks
|
||||||
|
- Multiple IDs → Comparative view
|
||||||
|
|
||||||
|
### 2. **Contextual Information**
|
||||||
|
|
||||||
|
For each task, intelligently include:
|
||||||
|
|
||||||
|
**Core Details**
|
||||||
|
- Full task information (id, title, description, details)
|
||||||
|
- Current status with history
|
||||||
|
- Test strategy and acceptance criteria
|
||||||
|
- Priority and complexity analysis
|
||||||
|
|
||||||
|
**Relationships**
|
||||||
|
- Dependencies (what it needs)
|
||||||
|
- Dependents (what needs it)
|
||||||
|
- Parent/subtask hierarchy
|
||||||
|
- Related tasks (similar work)
|
||||||
|
|
||||||
|
**Time Intelligence**
|
||||||
|
- Created/updated timestamps
|
||||||
|
- Time in current status
|
||||||
|
- Estimated vs actual time
|
||||||
|
- Historical completion patterns
|
||||||
|
|
||||||
|
### 3. **Visual Enhancements**
|
||||||
|
|
||||||
|
```
|
||||||
|
📋 Task #45: Implement User Authentication
|
||||||
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
Status: 🟡 in-progress (2 hours)
|
||||||
|
Priority: 🔴 High | Complexity: 73/100
|
||||||
|
|
||||||
|
Dependencies: ✅ #41, ✅ #42, ⏳ #43 (blocked)
|
||||||
|
Blocks: #46, #47, #52
|
||||||
|
|
||||||
|
Progress: ████████░░ 80% complete
|
||||||
|
|
||||||
|
Recent Activity:
|
||||||
|
- 2h ago: Status changed to in-progress
|
||||||
|
- 4h ago: Dependency #42 completed
|
||||||
|
- Yesterday: Task expanded with 3 subtasks
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. **Intelligent Insights**
|
||||||
|
|
||||||
|
Based on task analysis:
|
||||||
|
- **Risk Assessment**: Complexity vs time remaining
|
||||||
|
- **Bottleneck Analysis**: Is this blocking critical work?
|
||||||
|
- **Recommendation**: Suggested approach or concerns
|
||||||
|
- **Similar Tasks**: How others completed similar work
|
||||||
|
|
||||||
|
### 5. **Action Suggestions**
|
||||||
|
|
||||||
|
Context-aware next steps:
|
||||||
|
- If blocked → Show how to unblock
|
||||||
|
- If complex → Suggest expansion
|
||||||
|
- If in-progress → Show completion checklist
|
||||||
|
- If done → Show dependent tasks ready to start
|
||||||
|
|
||||||
|
### 6. **Multi-Task View**
|
||||||
|
|
||||||
|
When showing multiple tasks:
|
||||||
|
- Common dependencies
|
||||||
|
- Optimal completion order
|
||||||
|
- Parallel work opportunities
|
||||||
|
- Combined complexity analysis
|
||||||
64
.claude/commands/tm/status/index.md
Normal file
64
.claude/commands/tm/status/index.md
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
Enhanced status command with comprehensive project insights.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
## Intelligent Status Overview
|
||||||
|
|
||||||
|
### 1. **Executive Summary**
|
||||||
|
Quick dashboard view:
|
||||||
|
- 🏃 Active work (in-progress tasks)
|
||||||
|
- 📊 Progress metrics (% complete, velocity)
|
||||||
|
- 🚧 Blockers and risks
|
||||||
|
- ⏱️ Time analysis (estimated vs actual)
|
||||||
|
- 🎯 Sprint/milestone progress
|
||||||
|
|
||||||
|
### 2. **Contextual Analysis**
|
||||||
|
|
||||||
|
Based on $ARGUMENTS, focus on:
|
||||||
|
- "sprint" → Current sprint progress and burndown
|
||||||
|
- "blocked" → Dependency chains and resolution paths
|
||||||
|
- "team" → Task distribution and workload
|
||||||
|
- "timeline" → Schedule adherence and projections
|
||||||
|
- "risk" → High complexity or overdue items
|
||||||
|
|
||||||
|
### 3. **Smart Insights**
|
||||||
|
|
||||||
|
**Workflow Health:**
|
||||||
|
- Idle tasks (in-progress > 24h without updates)
|
||||||
|
- Bottlenecks (multiple tasks waiting on same dependency)
|
||||||
|
- Quick wins (low complexity, high impact)
|
||||||
|
|
||||||
|
**Predictive Analytics:**
|
||||||
|
- Completion projections based on velocity
|
||||||
|
- Risk of missing deadlines
|
||||||
|
- Recommended task order for optimal flow
|
||||||
|
|
||||||
|
### 4. **Visual Intelligence**
|
||||||
|
|
||||||
|
Dynamic visualization based on data:
|
||||||
|
```
|
||||||
|
Sprint Progress: ████████░░ 80% (16/20 tasks)
|
||||||
|
Velocity Trend: ↗️ +15% this week
|
||||||
|
Blocked Tasks: 🔴 3 critical path items
|
||||||
|
|
||||||
|
Priority Distribution:
|
||||||
|
High: ████████ 8 tasks (2 blocked)
|
||||||
|
Medium: ████░░░░ 4 tasks
|
||||||
|
Low: ██░░░░░░ 2 tasks
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. **Actionable Recommendations**
|
||||||
|
|
||||||
|
Based on analysis:
|
||||||
|
1. **Immediate actions** (unblock critical path)
|
||||||
|
2. **Today's focus** (optimal task sequence)
|
||||||
|
3. **Process improvements** (recurring patterns)
|
||||||
|
4. **Resource needs** (skills, time, dependencies)
|
||||||
|
|
||||||
|
### 6. **Historical Context**
|
||||||
|
|
||||||
|
Compare to previous periods:
|
||||||
|
- Velocity changes
|
||||||
|
- Pattern recognition
|
||||||
|
- Improvement areas
|
||||||
|
- Success patterns to repeat
|
||||||
117
.claude/commands/tm/sync-readme/index.md
Normal file
117
.claude/commands/tm/sync-readme/index.md
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
Export tasks to README.md with professional formatting.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
Generate a well-formatted README with current task information.
|
||||||
|
|
||||||
|
## README Synchronization
|
||||||
|
|
||||||
|
Creates or updates README.md with beautifully formatted task information.
|
||||||
|
|
||||||
|
## Argument Parsing
|
||||||
|
|
||||||
|
Optional filters:
|
||||||
|
- "pending" → Only pending tasks
|
||||||
|
- "with-subtasks" → Include subtask details
|
||||||
|
- "by-priority" → Group by priority
|
||||||
|
- "sprint" → Current sprint only
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master sync-readme [--with-subtasks] [--status=<status>]
|
||||||
|
```
|
||||||
|
|
||||||
|
## README Generation
|
||||||
|
|
||||||
|
### 1. **Project Header**
|
||||||
|
```markdown
|
||||||
|
# Project Name
|
||||||
|
|
||||||
|
## 📋 Task Progress
|
||||||
|
|
||||||
|
Last Updated: 2024-01-15 10:30 AM
|
||||||
|
|
||||||
|
### Summary
|
||||||
|
- Total Tasks: 45
|
||||||
|
- Completed: 15 (33%)
|
||||||
|
- In Progress: 5 (11%)
|
||||||
|
- Pending: 25 (56%)
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. **Task Sections**
|
||||||
|
Organized by status or priority:
|
||||||
|
- Progress indicators
|
||||||
|
- Task descriptions
|
||||||
|
- Dependencies noted
|
||||||
|
- Time estimates
|
||||||
|
|
||||||
|
### 3. **Visual Elements**
|
||||||
|
- Progress bars
|
||||||
|
- Status badges
|
||||||
|
- Priority indicators
|
||||||
|
- Completion checkmarks
|
||||||
|
|
||||||
|
## Smart Features
|
||||||
|
|
||||||
|
1. **Intelligent Grouping**
|
||||||
|
- By feature area
|
||||||
|
- By sprint/milestone
|
||||||
|
- By assigned developer
|
||||||
|
- By priority
|
||||||
|
|
||||||
|
2. **Progress Tracking**
|
||||||
|
- Overall completion
|
||||||
|
- Sprint velocity
|
||||||
|
- Burndown indication
|
||||||
|
- Time tracking
|
||||||
|
|
||||||
|
3. **Formatting Options**
|
||||||
|
- GitHub-flavored markdown
|
||||||
|
- Task checkboxes
|
||||||
|
- Collapsible sections
|
||||||
|
- Table format available
|
||||||
|
|
||||||
|
## Example Output
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
## 🚀 Current Sprint
|
||||||
|
|
||||||
|
### In Progress
|
||||||
|
- [ ] 🔄 #5 **Implement user authentication** (60% complete)
|
||||||
|
- Dependencies: API design (#3 ✅)
|
||||||
|
- Subtasks: 4 (2 completed)
|
||||||
|
- Est: 8h / Spent: 5h
|
||||||
|
|
||||||
|
### Pending (High Priority)
|
||||||
|
- [ ] ⚡ #8 **Create dashboard UI**
|
||||||
|
- Blocked by: #5
|
||||||
|
- Complexity: High
|
||||||
|
- Est: 12h
|
||||||
|
```
|
||||||
|
|
||||||
|
## Customization
|
||||||
|
|
||||||
|
Based on arguments:
|
||||||
|
- Include/exclude sections
|
||||||
|
- Detail level control
|
||||||
|
- Custom grouping
|
||||||
|
- Filter by criteria
|
||||||
|
|
||||||
|
## Post-Sync
|
||||||
|
|
||||||
|
After generation:
|
||||||
|
1. Show diff preview
|
||||||
|
2. Backup existing README
|
||||||
|
3. Write new content
|
||||||
|
4. Commit reminder
|
||||||
|
5. Update timestamp
|
||||||
|
|
||||||
|
## Integration
|
||||||
|
|
||||||
|
Works well with:
|
||||||
|
- Git workflows
|
||||||
|
- CI/CD pipelines
|
||||||
|
- Project documentation
|
||||||
|
- Team updates
|
||||||
|
- Client reports
|
||||||
108
.claude/commands/tm/update/from-id.md
Normal file
108
.claude/commands/tm/update/from-id.md
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
Update multiple tasks starting from a specific ID.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
Parse starting task ID and update context.
|
||||||
|
|
||||||
|
## Bulk Task Updates
|
||||||
|
|
||||||
|
Update multiple related tasks based on new requirements or context changes.
|
||||||
|
|
||||||
|
## Argument Parsing
|
||||||
|
|
||||||
|
- "from 5: add security requirements"
|
||||||
|
- "5 onwards: update API endpoints"
|
||||||
|
- "starting at 5: change to use new framework"
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master update --from=<id> --prompt="<context>"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Update Process
|
||||||
|
|
||||||
|
### 1. **Task Selection**
|
||||||
|
Starting from specified ID:
|
||||||
|
- Include the task itself
|
||||||
|
- Include all dependent tasks
|
||||||
|
- Include related subtasks
|
||||||
|
- Smart boundary detection
|
||||||
|
|
||||||
|
### 2. **Context Application**
|
||||||
|
AI analyzes the update context and:
|
||||||
|
- Identifies what needs changing
|
||||||
|
- Maintains consistency
|
||||||
|
- Preserves completed work
|
||||||
|
- Updates related information
|
||||||
|
|
||||||
|
### 3. **Intelligent Updates**
|
||||||
|
- Modify descriptions appropriately
|
||||||
|
- Update test strategies
|
||||||
|
- Adjust time estimates
|
||||||
|
- Revise dependencies if needed
|
||||||
|
|
||||||
|
## Smart Features
|
||||||
|
|
||||||
|
1. **Scope Detection**
|
||||||
|
- Find natural task groupings
|
||||||
|
- Identify related features
|
||||||
|
- Stop at logical boundaries
|
||||||
|
- Avoid over-updating
|
||||||
|
|
||||||
|
2. **Consistency Maintenance**
|
||||||
|
- Keep naming conventions
|
||||||
|
- Preserve relationships
|
||||||
|
- Update cross-references
|
||||||
|
- Maintain task flow
|
||||||
|
|
||||||
|
3. **Change Preview**
|
||||||
|
```
|
||||||
|
Bulk Update Preview
|
||||||
|
━━━━━━━━━━━━━━━━━━
|
||||||
|
Starting from: Task #5
|
||||||
|
Tasks to update: 8 tasks + 12 subtasks
|
||||||
|
|
||||||
|
Context: "add security requirements"
|
||||||
|
|
||||||
|
Changes will include:
|
||||||
|
- Add security sections to descriptions
|
||||||
|
- Update test strategies for security
|
||||||
|
- Add security-related subtasks where needed
|
||||||
|
- Adjust time estimates (+20% average)
|
||||||
|
|
||||||
|
Continue? (y/n)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example Updates
|
||||||
|
|
||||||
|
```
|
||||||
|
/project:tm/update/from-id 5: change database to PostgreSQL
|
||||||
|
→ Analyzing impact starting from task #5
|
||||||
|
→ Found 6 related tasks to update
|
||||||
|
→ Updates will maintain consistency
|
||||||
|
→ Preview changes? (y/n)
|
||||||
|
|
||||||
|
Applied updates:
|
||||||
|
✓ Task #5: Updated connection logic references
|
||||||
|
✓ Task #6: Changed migration approach
|
||||||
|
✓ Task #7: Updated query syntax notes
|
||||||
|
✓ Task #8: Revised testing strategy
|
||||||
|
✓ Task #9: Updated deployment steps
|
||||||
|
✓ Task #12: Changed backup procedures
|
||||||
|
```
|
||||||
|
|
||||||
|
## Safety Features
|
||||||
|
|
||||||
|
- Preview all changes
|
||||||
|
- Selective confirmation
|
||||||
|
- Rollback capability
|
||||||
|
- Change logging
|
||||||
|
- Validation checks
|
||||||
|
|
||||||
|
## Post-Update
|
||||||
|
|
||||||
|
- Summary of changes
|
||||||
|
- Consistency verification
|
||||||
|
- Suggest review tasks
|
||||||
|
- Update timeline if needed
|
||||||
72
.claude/commands/tm/update/index.md
Normal file
72
.claude/commands/tm/update/index.md
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
Update tasks with intelligent field detection and bulk operations.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
## Intelligent Task Updates
|
||||||
|
|
||||||
|
Parse arguments to determine update intent and execute smartly.
|
||||||
|
|
||||||
|
### 1. **Natural Language Processing**
|
||||||
|
|
||||||
|
Understand update requests like:
|
||||||
|
- "mark 23 as done" → Update status to done
|
||||||
|
- "increase priority of 45" → Set priority to high
|
||||||
|
- "add dependency on 12 to task 34" → Add dependency
|
||||||
|
- "tasks 20-25 need review" → Bulk status update
|
||||||
|
- "all API tasks high priority" → Pattern-based update
|
||||||
|
|
||||||
|
### 2. **Smart Field Detection**
|
||||||
|
|
||||||
|
Automatically detect what to update:
|
||||||
|
- Status keywords: done, complete, start, pause, review
|
||||||
|
- Priority changes: urgent, high, low, deprioritize
|
||||||
|
- Dependency updates: depends on, blocks, after
|
||||||
|
- Assignment: assign to, owner, responsible
|
||||||
|
- Time: estimate, spent, deadline
|
||||||
|
|
||||||
|
### 3. **Bulk Operations**
|
||||||
|
|
||||||
|
Support for multiple task updates:
|
||||||
|
```
|
||||||
|
Examples:
|
||||||
|
- "complete tasks 12, 15, 18"
|
||||||
|
- "all pending auth tasks to in-progress"
|
||||||
|
- "increase priority for tasks blocking 45"
|
||||||
|
- "defer all documentation tasks"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. **Contextual Validation**
|
||||||
|
|
||||||
|
Before updating, check:
|
||||||
|
- Status transitions are valid
|
||||||
|
- Dependencies don't create cycles
|
||||||
|
- Priority changes make sense
|
||||||
|
- Bulk updates won't break project flow
|
||||||
|
|
||||||
|
Show preview:
|
||||||
|
```
|
||||||
|
Update Preview:
|
||||||
|
─────────────────
|
||||||
|
Tasks to update: #23, #24, #25
|
||||||
|
Change: status → in-progress
|
||||||
|
Impact: Will unblock tasks #30, #31
|
||||||
|
Warning: Task #24 has unmet dependencies
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. **Smart Suggestions**
|
||||||
|
|
||||||
|
Based on update:
|
||||||
|
- Completing task? → Show newly unblocked tasks
|
||||||
|
- Changing priority? → Show impact on sprint
|
||||||
|
- Adding dependency? → Check for conflicts
|
||||||
|
- Bulk update? → Show summary of changes
|
||||||
|
|
||||||
|
### 6. **Workflow Integration**
|
||||||
|
|
||||||
|
After updates:
|
||||||
|
- Auto-update dependent task states
|
||||||
|
- Trigger status recalculation
|
||||||
|
- Update sprint/milestone progress
|
||||||
|
- Log changes with context
|
||||||
|
|
||||||
|
Result: Flexible, intelligent task updates with safety checks.
|
||||||
119
.claude/commands/tm/update/single.md
Normal file
119
.claude/commands/tm/update/single.md
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
Update a single specific task with new information.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
Parse task ID and update details.
|
||||||
|
|
||||||
|
## Single Task Update
|
||||||
|
|
||||||
|
Precisely update one task with AI assistance to maintain consistency.
|
||||||
|
|
||||||
|
## Argument Parsing
|
||||||
|
|
||||||
|
Natural language updates:
|
||||||
|
- "5: add caching requirement"
|
||||||
|
- "update 5 to include error handling"
|
||||||
|
- "task 5 needs rate limiting"
|
||||||
|
- "5 change priority to high"
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master update-task --id=<id> --prompt="<context>"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Update Types
|
||||||
|
|
||||||
|
### 1. **Content Updates**
|
||||||
|
- Enhance description
|
||||||
|
- Add requirements
|
||||||
|
- Clarify details
|
||||||
|
- Update acceptance criteria
|
||||||
|
|
||||||
|
### 2. **Metadata Updates**
|
||||||
|
- Change priority
|
||||||
|
- Adjust time estimates
|
||||||
|
- Update complexity
|
||||||
|
- Modify dependencies
|
||||||
|
|
||||||
|
### 3. **Strategic Updates**
|
||||||
|
- Revise approach
|
||||||
|
- Change test strategy
|
||||||
|
- Update implementation notes
|
||||||
|
- Adjust subtask needs
|
||||||
|
|
||||||
|
## AI-Powered Updates
|
||||||
|
|
||||||
|
The AI:
|
||||||
|
1. **Understands Context**
|
||||||
|
- Reads current task state
|
||||||
|
- Identifies update intent
|
||||||
|
- Maintains consistency
|
||||||
|
- Preserves important info
|
||||||
|
|
||||||
|
2. **Applies Changes**
|
||||||
|
- Updates relevant fields
|
||||||
|
- Keeps style consistent
|
||||||
|
- Adds without removing
|
||||||
|
- Enhances clarity
|
||||||
|
|
||||||
|
3. **Validates Results**
|
||||||
|
- Checks coherence
|
||||||
|
- Verifies completeness
|
||||||
|
- Maintains relationships
|
||||||
|
- Suggests related updates
|
||||||
|
|
||||||
|
## Example Updates
|
||||||
|
|
||||||
|
```
|
||||||
|
/project:tm/update/single 5: add rate limiting
|
||||||
|
→ Updating Task #5: "Implement API endpoints"
|
||||||
|
|
||||||
|
Current: Basic CRUD endpoints
|
||||||
|
Adding: Rate limiting requirements
|
||||||
|
|
||||||
|
Updated sections:
|
||||||
|
✓ Description: Added rate limiting mention
|
||||||
|
✓ Details: Added specific limits (100/min)
|
||||||
|
✓ Test Strategy: Added rate limit tests
|
||||||
|
✓ Complexity: Increased from 5 to 6
|
||||||
|
✓ Time Estimate: Increased by 2 hours
|
||||||
|
|
||||||
|
Suggestion: Also update task #6 (API Gateway) for consistency?
|
||||||
|
```
|
||||||
|
|
||||||
|
## Smart Features
|
||||||
|
|
||||||
|
1. **Incremental Updates**
|
||||||
|
- Adds without overwriting
|
||||||
|
- Preserves work history
|
||||||
|
- Tracks what changed
|
||||||
|
- Shows diff view
|
||||||
|
|
||||||
|
2. **Consistency Checks**
|
||||||
|
- Related task alignment
|
||||||
|
- Subtask compatibility
|
||||||
|
- Dependency validity
|
||||||
|
- Timeline impact
|
||||||
|
|
||||||
|
3. **Update History**
|
||||||
|
- Timestamp changes
|
||||||
|
- Track who/what updated
|
||||||
|
- Reason for update
|
||||||
|
- Previous versions
|
||||||
|
|
||||||
|
## Field-Specific Updates
|
||||||
|
|
||||||
|
Quick syntax for specific fields:
|
||||||
|
- "5 priority:high" → Update priority only
|
||||||
|
- "5 add-time:4h" → Add to time estimate
|
||||||
|
- "5 status:review" → Change status
|
||||||
|
- "5 depends:3,4" → Add dependencies
|
||||||
|
|
||||||
|
## Post-Update
|
||||||
|
|
||||||
|
- Show updated task
|
||||||
|
- Highlight changes
|
||||||
|
- Check related tasks
|
||||||
|
- Update suggestions
|
||||||
|
- Timeline adjustments
|
||||||
97
.claude/commands/tm/utils/analyze.md
Normal file
97
.claude/commands/tm/utils/analyze.md
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
Advanced project analysis with actionable insights and recommendations.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
## Comprehensive Project Analysis
|
||||||
|
|
||||||
|
Multi-dimensional analysis based on requested focus area.
|
||||||
|
|
||||||
|
### 1. **Analysis Modes**
|
||||||
|
|
||||||
|
Based on $ARGUMENTS:
|
||||||
|
- "velocity" → Sprint velocity and trends
|
||||||
|
- "quality" → Code quality metrics
|
||||||
|
- "risk" → Risk assessment and mitigation
|
||||||
|
- "dependencies" → Dependency graph analysis
|
||||||
|
- "team" → Workload and skill distribution
|
||||||
|
- "architecture" → System design coherence
|
||||||
|
- Default → Full spectrum analysis
|
||||||
|
|
||||||
|
### 2. **Velocity Analytics**
|
||||||
|
|
||||||
|
```
|
||||||
|
📊 Velocity Analysis
|
||||||
|
━━━━━━━━━━━━━━━━━━━
|
||||||
|
Current Sprint: 24 points/week ↗️ +20%
|
||||||
|
Rolling Average: 20 points/week
|
||||||
|
Efficiency: 85% (17/20 tasks on time)
|
||||||
|
|
||||||
|
Bottlenecks Detected:
|
||||||
|
- Code review delays (avg 4h wait)
|
||||||
|
- Test environment availability
|
||||||
|
- Dependency on external team
|
||||||
|
|
||||||
|
Recommendations:
|
||||||
|
1. Implement parallel review process
|
||||||
|
2. Add staging environment
|
||||||
|
3. Mock external dependencies
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. **Risk Assessment**
|
||||||
|
|
||||||
|
**Technical Risks**
|
||||||
|
- High complexity tasks without backup assignee
|
||||||
|
- Single points of failure in architecture
|
||||||
|
- Insufficient test coverage in critical paths
|
||||||
|
- Technical debt accumulation rate
|
||||||
|
|
||||||
|
**Project Risks**
|
||||||
|
- Critical path dependencies
|
||||||
|
- Resource availability gaps
|
||||||
|
- Deadline feasibility analysis
|
||||||
|
- Scope creep indicators
|
||||||
|
|
||||||
|
### 4. **Dependency Intelligence**
|
||||||
|
|
||||||
|
Visual dependency analysis:
|
||||||
|
```
|
||||||
|
Critical Path:
|
||||||
|
#12 → #15 → #23 → #45 → #50 (20 days)
|
||||||
|
↘ #24 → #46 ↗
|
||||||
|
|
||||||
|
Optimization: Parallelize #15 and #24
|
||||||
|
Time Saved: 3 days
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. **Quality Metrics**
|
||||||
|
|
||||||
|
**Code Quality**
|
||||||
|
- Test coverage trends
|
||||||
|
- Complexity scores
|
||||||
|
- Technical debt ratio
|
||||||
|
- Review feedback patterns
|
||||||
|
|
||||||
|
**Process Quality**
|
||||||
|
- Rework frequency
|
||||||
|
- Bug introduction rate
|
||||||
|
- Time to resolution
|
||||||
|
- Knowledge distribution
|
||||||
|
|
||||||
|
### 6. **Predictive Insights**
|
||||||
|
|
||||||
|
Based on patterns:
|
||||||
|
- Completion probability by deadline
|
||||||
|
- Resource needs projection
|
||||||
|
- Risk materialization likelihood
|
||||||
|
- Suggested interventions
|
||||||
|
|
||||||
|
### 7. **Executive Dashboard**
|
||||||
|
|
||||||
|
High-level summary with:
|
||||||
|
- Health score (0-100)
|
||||||
|
- Top 3 risks
|
||||||
|
- Top 3 opportunities
|
||||||
|
- Recommended actions
|
||||||
|
- Success probability
|
||||||
|
|
||||||
|
Result: Data-driven decisions with clear action paths.
|
||||||
71
.claude/commands/tm/validate-dependencies/index.md
Normal file
71
.claude/commands/tm/validate-dependencies/index.md
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
Validate all task dependencies for issues.
|
||||||
|
|
||||||
|
## Dependency Validation
|
||||||
|
|
||||||
|
Comprehensive check for dependency problems across the entire project.
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
```bash
|
||||||
|
task-master validate-dependencies
|
||||||
|
```
|
||||||
|
|
||||||
|
## Validation Checks
|
||||||
|
|
||||||
|
1. **Circular Dependencies**
|
||||||
|
- A depends on B, B depends on A
|
||||||
|
- Complex circular chains
|
||||||
|
- Self-dependencies
|
||||||
|
|
||||||
|
2. **Missing Dependencies**
|
||||||
|
- References to non-existent tasks
|
||||||
|
- Deleted task references
|
||||||
|
- Invalid task IDs
|
||||||
|
|
||||||
|
3. **Logical Issues**
|
||||||
|
- Completed tasks depending on pending
|
||||||
|
- Cancelled tasks in dependency chains
|
||||||
|
- Impossible sequences
|
||||||
|
|
||||||
|
4. **Complexity Warnings**
|
||||||
|
- Over-complex dependency chains
|
||||||
|
- Too many dependencies per task
|
||||||
|
- Bottleneck tasks
|
||||||
|
|
||||||
|
## Smart Analysis
|
||||||
|
|
||||||
|
The validation provides:
|
||||||
|
- Visual dependency graph
|
||||||
|
- Critical path analysis
|
||||||
|
- Bottleneck identification
|
||||||
|
- Suggested optimizations
|
||||||
|
|
||||||
|
## Report Format
|
||||||
|
|
||||||
|
```
|
||||||
|
Dependency Validation Report
|
||||||
|
━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
✅ No circular dependencies found
|
||||||
|
⚠️ 2 warnings found:
|
||||||
|
- Task #23 has 7 dependencies (consider breaking down)
|
||||||
|
- Task #45 blocks 5 other tasks (potential bottleneck)
|
||||||
|
❌ 1 error found:
|
||||||
|
- Task #67 depends on deleted task #66
|
||||||
|
|
||||||
|
Critical Path: #1 → #5 → #23 → #45 → #50 (15 days)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Actionable Output
|
||||||
|
|
||||||
|
For each issue found:
|
||||||
|
- Clear description
|
||||||
|
- Impact assessment
|
||||||
|
- Suggested fix
|
||||||
|
- Command to resolve
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
After validation:
|
||||||
|
- Run `/project:tm/fix-dependencies` to auto-fix
|
||||||
|
- Manually adjust problematic dependencies
|
||||||
|
- Rerun to verify fixes
|
||||||
97
.claude/commands/tm/workflows/auto-implement.md
Normal file
97
.claude/commands/tm/workflows/auto-implement.md
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
Enhanced auto-implementation with intelligent code generation and testing.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
## Intelligent Auto-Implementation
|
||||||
|
|
||||||
|
Advanced implementation with context awareness and quality checks.
|
||||||
|
|
||||||
|
### 1. **Pre-Implementation Analysis**
|
||||||
|
|
||||||
|
Before starting:
|
||||||
|
- Analyze task complexity and requirements
|
||||||
|
- Check codebase patterns and conventions
|
||||||
|
- Identify similar completed tasks
|
||||||
|
- Assess test coverage needs
|
||||||
|
- Detect potential risks
|
||||||
|
|
||||||
|
### 2. **Smart Implementation Strategy**
|
||||||
|
|
||||||
|
Based on task type and context:
|
||||||
|
|
||||||
|
**Feature Tasks**
|
||||||
|
1. Research existing patterns
|
||||||
|
2. Design component architecture
|
||||||
|
3. Implement with tests
|
||||||
|
4. Integrate with system
|
||||||
|
5. Update documentation
|
||||||
|
|
||||||
|
**Bug Fix Tasks**
|
||||||
|
1. Reproduce issue
|
||||||
|
2. Identify root cause
|
||||||
|
3. Implement minimal fix
|
||||||
|
4. Add regression tests
|
||||||
|
5. Verify side effects
|
||||||
|
|
||||||
|
**Refactoring Tasks**
|
||||||
|
1. Analyze current structure
|
||||||
|
2. Plan incremental changes
|
||||||
|
3. Maintain test coverage
|
||||||
|
4. Refactor step-by-step
|
||||||
|
5. Verify behavior unchanged
|
||||||
|
|
||||||
|
### 3. **Code Intelligence**
|
||||||
|
|
||||||
|
**Pattern Recognition**
|
||||||
|
- Learn from existing code
|
||||||
|
- Follow team conventions
|
||||||
|
- Use preferred libraries
|
||||||
|
- Match style guidelines
|
||||||
|
|
||||||
|
**Test-Driven Approach**
|
||||||
|
- Write tests first when possible
|
||||||
|
- Ensure comprehensive coverage
|
||||||
|
- Include edge cases
|
||||||
|
- Performance considerations
|
||||||
|
|
||||||
|
### 4. **Progressive Implementation**
|
||||||
|
|
||||||
|
Step-by-step with validation:
|
||||||
|
```
|
||||||
|
Step 1/5: Setting up component structure ✓
|
||||||
|
Step 2/5: Implementing core logic ✓
|
||||||
|
Step 3/5: Adding error handling ⚡ (in progress)
|
||||||
|
Step 4/5: Writing tests ⏳
|
||||||
|
Step 5/5: Integration testing ⏳
|
||||||
|
|
||||||
|
Current: Adding try-catch blocks and validation...
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. **Quality Assurance**
|
||||||
|
|
||||||
|
Automated checks:
|
||||||
|
- Linting and formatting
|
||||||
|
- Test execution
|
||||||
|
- Type checking
|
||||||
|
- Dependency validation
|
||||||
|
- Performance analysis
|
||||||
|
|
||||||
|
### 6. **Smart Recovery**
|
||||||
|
|
||||||
|
If issues arise:
|
||||||
|
- Diagnostic analysis
|
||||||
|
- Suggestion generation
|
||||||
|
- Fallback strategies
|
||||||
|
- Manual intervention points
|
||||||
|
- Learning from failures
|
||||||
|
|
||||||
|
### 7. **Post-Implementation**
|
||||||
|
|
||||||
|
After completion:
|
||||||
|
- Generate PR description
|
||||||
|
- Update documentation
|
||||||
|
- Log lessons learned
|
||||||
|
- Suggest follow-up tasks
|
||||||
|
- Update task relationships
|
||||||
|
|
||||||
|
Result: High-quality, production-ready implementations.
|
||||||
77
.claude/commands/tm/workflows/pipeline.md
Normal file
77
.claude/commands/tm/workflows/pipeline.md
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
Execute a pipeline of commands based on a specification.
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
## Command Pipeline Execution
|
||||||
|
|
||||||
|
Parse pipeline specification from arguments. Supported formats:
|
||||||
|
|
||||||
|
### Simple Pipeline
|
||||||
|
`init → expand-all → sprint-plan`
|
||||||
|
|
||||||
|
### Conditional Pipeline
|
||||||
|
`status → if:pending>10 → sprint-plan → else → next`
|
||||||
|
|
||||||
|
### Iterative Pipeline
|
||||||
|
`for:pending-tasks → expand → complexity-check`
|
||||||
|
|
||||||
|
### Smart Pipeline Patterns
|
||||||
|
|
||||||
|
**1. Project Setup Pipeline**
|
||||||
|
```
|
||||||
|
init [prd] →
|
||||||
|
expand-all →
|
||||||
|
complexity-report →
|
||||||
|
sprint-plan →
|
||||||
|
show first-sprint
|
||||||
|
```
|
||||||
|
|
||||||
|
**2. Daily Work Pipeline**
|
||||||
|
```
|
||||||
|
standup →
|
||||||
|
if:in-progress → continue →
|
||||||
|
else → next → start
|
||||||
|
```
|
||||||
|
|
||||||
|
**3. Task Completion Pipeline**
|
||||||
|
```
|
||||||
|
complete [id] →
|
||||||
|
git-commit →
|
||||||
|
if:blocked-tasks-freed → show-freed →
|
||||||
|
next
|
||||||
|
```
|
||||||
|
|
||||||
|
**4. Quality Check Pipeline**
|
||||||
|
```
|
||||||
|
list in-progress →
|
||||||
|
for:each → check-idle-time →
|
||||||
|
if:idle>1day → prompt-update
|
||||||
|
```
|
||||||
|
|
||||||
|
### Pipeline Features
|
||||||
|
|
||||||
|
**Variables**
|
||||||
|
- Store results: `status → $count=pending-count`
|
||||||
|
- Use in conditions: `if:$count>10`
|
||||||
|
- Pass between commands: `expand $high-priority-tasks`
|
||||||
|
|
||||||
|
**Error Handling**
|
||||||
|
- On failure: `try:complete → catch:show-blockers`
|
||||||
|
- Skip on error: `optional:test-run`
|
||||||
|
- Retry logic: `retry:3:commit`
|
||||||
|
|
||||||
|
**Parallel Execution**
|
||||||
|
- Parallel branches: `[analyze | test | lint]`
|
||||||
|
- Join results: `parallel → join:report`
|
||||||
|
|
||||||
|
### Execution Flow
|
||||||
|
|
||||||
|
1. Parse pipeline specification
|
||||||
|
2. Validate command sequence
|
||||||
|
3. Execute with state passing
|
||||||
|
4. Handle conditions and loops
|
||||||
|
5. Aggregate results
|
||||||
|
6. Show summary
|
||||||
|
|
||||||
|
This enables complex workflows like:
|
||||||
|
`parse-prd → expand-all → filter:complex>70 → assign:senior → sprint-plan:weighted`
|
||||||
55
.claude/commands/tm/workflows/smart-flow.md
Normal file
55
.claude/commands/tm/workflows/smart-flow.md
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
Execute an intelligent workflow based on current project state and recent commands.
|
||||||
|
|
||||||
|
This command analyzes:
|
||||||
|
1. Recent commands you've run
|
||||||
|
2. Current project state
|
||||||
|
3. Time of day / day of week
|
||||||
|
4. Your working patterns
|
||||||
|
|
||||||
|
Arguments: $ARGUMENTS
|
||||||
|
|
||||||
|
## Intelligent Workflow Selection
|
||||||
|
|
||||||
|
Based on context, I'll determine the best workflow:
|
||||||
|
|
||||||
|
### Context Analysis
|
||||||
|
- Previous command executed
|
||||||
|
- Current task states
|
||||||
|
- Unfinished work from last session
|
||||||
|
- Your typical patterns
|
||||||
|
|
||||||
|
### Smart Execution
|
||||||
|
|
||||||
|
If last command was:
|
||||||
|
- `status` → Likely starting work → Run daily standup
|
||||||
|
- `complete` → Task finished → Find next task
|
||||||
|
- `list pending` → Planning → Suggest sprint planning
|
||||||
|
- `expand` → Breaking down work → Show complexity analysis
|
||||||
|
- `init` → New project → Show onboarding workflow
|
||||||
|
|
||||||
|
If no recent commands:
|
||||||
|
- Morning? → Daily standup workflow
|
||||||
|
- Many pending tasks? → Sprint planning
|
||||||
|
- Tasks blocked? → Dependency resolution
|
||||||
|
- Friday? → Weekly review
|
||||||
|
|
||||||
|
### Workflow Composition
|
||||||
|
|
||||||
|
I'll chain appropriate commands:
|
||||||
|
1. Analyze current state
|
||||||
|
2. Execute primary workflow
|
||||||
|
3. Suggest follow-up actions
|
||||||
|
4. Prepare environment for coding
|
||||||
|
|
||||||
|
### Learning Mode
|
||||||
|
|
||||||
|
This command learns from your patterns:
|
||||||
|
- Track command sequences
|
||||||
|
- Note time preferences
|
||||||
|
- Remember common workflows
|
||||||
|
- Adapt to your style
|
||||||
|
|
||||||
|
Example flows detected:
|
||||||
|
- Morning: standup → next → start
|
||||||
|
- After lunch: status → continue task
|
||||||
|
- End of day: complete → commit → status
|
||||||
@@ -1,10 +1,20 @@
|
|||||||
{
|
{
|
||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"taskmaster-ai": {
|
"task-master-ai": {
|
||||||
"command": "node",
|
"command": "node",
|
||||||
"args": [
|
"args": ["./mcp-server/server.js"],
|
||||||
"./mcp-server/server.js"
|
"env": {
|
||||||
]
|
"ANTHROPIC_API_KEY": "ANTHROPIC_API_KEY_HERE",
|
||||||
}
|
"PERPLEXITY_API_KEY": "PERPLEXITY_API_KEY_HERE",
|
||||||
}
|
"OPENAI_API_KEY": "OPENAI_API_KEY_HERE",
|
||||||
}
|
"GOOGLE_API_KEY": "GOOGLE_API_KEY_HERE",
|
||||||
|
"XAI_API_KEY": "XAI_API_KEY_HERE",
|
||||||
|
"OPENROUTER_API_KEY": "OPENROUTER_API_KEY_HERE",
|
||||||
|
"MISTRAL_API_KEY": "MISTRAL_API_KEY_HERE",
|
||||||
|
"AZURE_OPENAI_API_KEY": "AZURE_OPENAI_API_KEY_HERE",
|
||||||
|
"OLLAMA_API_KEY": "OLLAMA_API_KEY_HERE",
|
||||||
|
"GITHUB_API_KEY": "GITHUB_API_KEY_HERE"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
155
.cursor/rules/ai_providers.mdc
Normal file
155
.cursor/rules/ai_providers.mdc
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
---
|
||||||
|
description: Guidelines for managing Task Master AI providers and models.
|
||||||
|
globs:
|
||||||
|
alwaysApply: false
|
||||||
|
---
|
||||||
|
# Task Master AI Provider Management
|
||||||
|
|
||||||
|
This rule guides AI assistants on how to view, configure, and interact with the different AI providers and models supported by Task Master. For internal implementation details of the service layer, see [`ai_services.mdc`](mdc:.cursor/rules/ai_services.mdc).
|
||||||
|
|
||||||
|
- **Primary Interaction:**
|
||||||
|
- Use the `models` MCP tool or the `task-master models` CLI command to manage AI configurations. See [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc) for detailed command/tool usage.
|
||||||
|
|
||||||
|
- **Configuration Roles:**
|
||||||
|
- Task Master uses three roles for AI models:
|
||||||
|
- `main`: Primary model for general tasks (generation, updates).
|
||||||
|
- `research`: Model used when the `--research` flag or `research: true` parameter is used (typically models with web access or specialized knowledge).
|
||||||
|
- `fallback`: Model used if the primary (`main`) model fails.
|
||||||
|
- Each role is configured with a specific `provider:modelId` pair (e.g., `openai:gpt-4o`).
|
||||||
|
|
||||||
|
- **Viewing Configuration & Available Models:**
|
||||||
|
- To see the current model assignments for each role and list all models available for assignment:
|
||||||
|
- **MCP Tool:** `models` (call with no arguments or `listAvailableModels: true`)
|
||||||
|
- **CLI Command:** `task-master models`
|
||||||
|
- The output will show currently assigned models and a list of others, prefixed with their provider (e.g., `google:gemini-2.5-pro-exp-03-25`).
|
||||||
|
|
||||||
|
- **Setting Models for Roles:**
|
||||||
|
- To assign a model to a role:
|
||||||
|
- **MCP Tool:** `models` with `setMain`, `setResearch`, or `setFallback` parameters.
|
||||||
|
- **CLI Command:** `task-master models` with `--set-main`, `--set-research`, or `--set-fallback` flags.
|
||||||
|
- **Crucially:** When providing the model ID to *set*, **DO NOT include the `provider:` prefix**. Use only the model ID itself.
|
||||||
|
- ✅ **DO:** `models(setMain='gpt-4o')` or `task-master models --set-main=gpt-4o`
|
||||||
|
- ❌ **DON'T:** `models(setMain='openai:gpt-4o')` or `task-master models --set-main=openai:gpt-4o`
|
||||||
|
- The tool/command will automatically determine the provider based on the model ID.
|
||||||
|
|
||||||
|
- **Setting Custom Models (Ollama/OpenRouter):**
|
||||||
|
- To set a model ID not in the internal list for Ollama or OpenRouter:
|
||||||
|
- **MCP Tool:** Use `models` with `set<Role>` and **also** `ollama: true` or `openrouter: true`.
|
||||||
|
- Example: `models(setMain='my-custom-ollama-model', ollama=true)`
|
||||||
|
- Example: `models(setMain='some-openrouter-model', openrouter=true)`
|
||||||
|
- **CLI Command:** Use `task-master models` with `--set-<role>` and **also** `--ollama` or `--openrouter`.
|
||||||
|
- Example: `task-master models --set-main=my-custom-ollama-model --ollama`
|
||||||
|
- Example: `task-master models --set-main=some-openrouter-model --openrouter`
|
||||||
|
- **Interactive Setup:** Use `task-master models --setup` and select the `Ollama (Enter Custom ID)` or `OpenRouter (Enter Custom ID)` options.
|
||||||
|
- **OpenRouter Validation:** When setting a custom OpenRouter model, Taskmaster attempts to validate the ID against the live OpenRouter API.
|
||||||
|
- **Ollama:** No live validation occurs for custom Ollama models; ensure the model is available on your Ollama server.
|
||||||
|
|
||||||
|
- **Supported Providers & Required API Keys:**
|
||||||
|
- Task Master integrates with various providers via the Vercel AI SDK.
|
||||||
|
- **API keys are essential** for most providers and must be configured correctly.
|
||||||
|
- **Key Locations** (See [`dev_workflow.mdc`](mdc:.cursor/rules/dev_workflow.mdc) - Configuration Management):
|
||||||
|
- **MCP/Cursor:** Set keys in the `env` section of `.cursor/mcp.json`.
|
||||||
|
- **CLI:** Set keys in a `.env` file in the project root.
|
||||||
|
- **Provider List & Keys:**
|
||||||
|
- **`anthropic`**: Requires `ANTHROPIC_API_KEY`.
|
||||||
|
- **`google`**: Requires `GOOGLE_API_KEY`.
|
||||||
|
- **`openai`**: Requires `OPENAI_API_KEY`.
|
||||||
|
- **`perplexity`**: Requires `PERPLEXITY_API_KEY`.
|
||||||
|
- **`xai`**: Requires `XAI_API_KEY`.
|
||||||
|
- **`mistral`**: Requires `MISTRAL_API_KEY`.
|
||||||
|
- **`azure`**: Requires `AZURE_OPENAI_API_KEY` and `AZURE_OPENAI_ENDPOINT`.
|
||||||
|
- **`openrouter`**: Requires `OPENROUTER_API_KEY`.
|
||||||
|
- **`ollama`**: Might require `OLLAMA_API_KEY` (not currently supported) *and* `OLLAMA_BASE_URL` (default: `http://localhost:11434/api`). *Check specific setup.*
|
||||||
|
|
||||||
|
- **Troubleshooting:**
|
||||||
|
- If AI commands fail (especially in MCP context):
|
||||||
|
1. **Verify API Key:** Ensure the correct API key for the *selected provider* (check `models` output) exists in the appropriate location (`.cursor/mcp.json` env or `.env`).
|
||||||
|
2. **Check Model ID:** Ensure the model ID set for the role is valid (use `models` listAvailableModels/`task-master models`).
|
||||||
|
3. **Provider Status:** Check the status of the external AI provider's service.
|
||||||
|
4. **Restart MCP:** If changes were made to configuration or provider code, restart the MCP server.
|
||||||
|
|
||||||
|
## Adding a New AI Provider (Vercel AI SDK Method)
|
||||||
|
|
||||||
|
Follow these steps to integrate a new AI provider that has an official Vercel AI SDK adapter (`@ai-sdk/<provider>`):
|
||||||
|
|
||||||
|
1. **Install Dependency:**
|
||||||
|
- Install the provider-specific package:
|
||||||
|
```bash
|
||||||
|
npm install @ai-sdk/<provider-name>
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Create Provider Module:**
|
||||||
|
- Create a new file in `src/ai-providers/` named `<provider-name>.js`.
|
||||||
|
- Use existing modules (`openai.js`, `anthropic.js`, etc.) as a template.
|
||||||
|
- **Import:**
|
||||||
|
- Import the provider's `create<ProviderName>` function from `@ai-sdk/<provider-name>`.
|
||||||
|
- Import `generateText`, `streamText`, `generateObject` from the core `ai` package.
|
||||||
|
- Import the `log` utility from `../../scripts/modules/utils.js`.
|
||||||
|
- **Implement Core Functions:**
|
||||||
|
- `generate<ProviderName>Text(params)`:
|
||||||
|
- Accepts `params` (apiKey, modelId, messages, etc.).
|
||||||
|
- Instantiate the client: `const client = create<ProviderName>({ apiKey });`
|
||||||
|
- Call `generateText({ model: client(modelId), ... })`.
|
||||||
|
- Return `result.text`.
|
||||||
|
- Include basic validation and try/catch error handling.
|
||||||
|
- `stream<ProviderName>Text(params)`:
|
||||||
|
- Similar structure to `generateText`.
|
||||||
|
- Call `streamText({ model: client(modelId), ... })`.
|
||||||
|
- Return the full stream result object.
|
||||||
|
- Include basic validation and try/catch.
|
||||||
|
- `generate<ProviderName>Object(params)`:
|
||||||
|
- Similar structure.
|
||||||
|
- Call `generateObject({ model: client(modelId), schema, messages, ... })`.
|
||||||
|
- Return `result.object`.
|
||||||
|
- Include basic validation and try/catch.
|
||||||
|
- **Export Functions:** Export the three implemented functions (`generate<ProviderName>Text`, `stream<ProviderName>Text`, `generate<ProviderName>Object`).
|
||||||
|
|
||||||
|
3. **Integrate with Unified Service:**
|
||||||
|
- Open `scripts/modules/ai-services-unified.js`.
|
||||||
|
- **Import:** Add `import * as <providerName> from '../../src/ai-providers/<provider-name>.js';`
|
||||||
|
- **Map:** Add an entry to the `PROVIDER_FUNCTIONS` map:
|
||||||
|
```javascript
|
||||||
|
'<provider-name>': {
|
||||||
|
generateText: <providerName>.generate<ProviderName>Text,
|
||||||
|
streamText: <providerName>.stream<ProviderName>Text,
|
||||||
|
generateObject: <providerName>.generate<ProviderName>Object
|
||||||
|
},
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Update Configuration Management:**
|
||||||
|
- Open `scripts/modules/config-manager.js`.
|
||||||
|
- **`MODEL_MAP`:** Add the new `<provider-name>` key to the `MODEL_MAP` loaded from `supported-models.json` (or ensure the loading handles new providers dynamically if `supported-models.json` is updated first).
|
||||||
|
- **`VALID_PROVIDERS`:** Ensure the new `<provider-name>` is included in the `VALID_PROVIDERS` array (this should happen automatically if derived from `MODEL_MAP` keys).
|
||||||
|
- **API Key Handling:**
|
||||||
|
- Update the `keyMap` in `_resolveApiKey` and `isApiKeySet` with the correct environment variable name (e.g., `PROVIDER_API_KEY`).
|
||||||
|
- Update the `switch` statement in `getMcpApiKeyStatus` to check the corresponding key in `mcp.json` and its placeholder value.
|
||||||
|
- Add a case to the `switch` statement in `getMcpApiKeyStatus` for the new provider, including its placeholder string if applicable.
|
||||||
|
- **Ollama Exception:** If adding Ollama or another provider *not* requiring an API key, add a specific check at the beginning of `isApiKeySet` and `getMcpApiKeyStatus` to return `true` immediately for that provider.
|
||||||
|
|
||||||
|
5. **Update Supported Models List:**
|
||||||
|
- Edit `scripts/modules/supported-models.json`.
|
||||||
|
- Add a new key for the `<provider-name>`.
|
||||||
|
- Add an array of model objects under the provider key, each including:
|
||||||
|
- `id`: The specific model identifier (e.g., `claude-3-opus-20240229`).
|
||||||
|
- `name`: A user-friendly name (optional).
|
||||||
|
- `swe_score`, `cost_per_1m_tokens`: (Optional) Add performance/cost data if available.
|
||||||
|
- `allowed_roles`: An array of roles (`"main"`, `"research"`, `"fallback"`) the model is suitable for.
|
||||||
|
- `max_tokens`: (Optional but recommended) The maximum token limit for the model.
|
||||||
|
|
||||||
|
6. **Update Environment Examples:**
|
||||||
|
- Add the new `PROVIDER_API_KEY` to `.env.example`.
|
||||||
|
- Add the new `PROVIDER_API_KEY` with its placeholder (`YOUR_PROVIDER_API_KEY_HERE`) to the `env` section for `taskmaster-ai` in `.cursor/mcp.json.example` (if it exists) or update instructions.
|
||||||
|
|
||||||
|
7. **Add Unit Tests:**
|
||||||
|
- Create `tests/unit/ai-providers/<provider-name>.test.js`.
|
||||||
|
- Mock the `@ai-sdk/<provider-name>` module and the core `ai` module functions (`generateText`, `streamText`, `generateObject`).
|
||||||
|
- Write tests for each exported function (`generate<ProviderName>Text`, etc.) to verify:
|
||||||
|
- Correct client instantiation.
|
||||||
|
- Correct parameters passed to the mocked Vercel AI SDK functions.
|
||||||
|
- Correct handling of results.
|
||||||
|
- Error handling (missing API key, SDK errors).
|
||||||
|
|
||||||
|
8. **Documentation:**
|
||||||
|
- Update any relevant documentation (like `README.md` or other rules) mentioning supported providers or configuration.
|
||||||
|
|
||||||
|
*(Note: For providers **without** an official Vercel AI SDK adapter, the process would involve directly using the provider's own SDK or API within the `src/ai-providers/<provider-name>.js` module and manually constructing responses compatible with the unified service layer, which is significantly more complex.)*
|
||||||
102
.cursor/rules/ai_services.mdc
Normal file
102
.cursor/rules/ai_services.mdc
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
---
|
||||||
|
description: Guidelines for interacting with the unified AI service layer.
|
||||||
|
globs: scripts/modules/ai-services-unified.js, scripts/modules/task-manager/*.js, scripts/modules/commands.js
|
||||||
|
---
|
||||||
|
|
||||||
|
# AI Services Layer Guidelines
|
||||||
|
|
||||||
|
This document outlines the architecture and usage patterns for interacting with Large Language Models (LLMs) via Task Master's unified AI service layer (`ai-services-unified.js`). The goal is to centralize configuration, provider selection, API key management, fallback logic, and error handling.
|
||||||
|
|
||||||
|
**Core Components:**
|
||||||
|
|
||||||
|
* **Configuration (`.taskmasterconfig` & [`config-manager.js`](mdc:scripts/modules/config-manager.js)):**
|
||||||
|
* Defines the AI provider and model ID for different **roles** (`main`, `research`, `fallback`).
|
||||||
|
* Stores parameters like `maxTokens` and `temperature` per role.
|
||||||
|
* Managed via the `task-master models --setup` CLI command.
|
||||||
|
* [`config-manager.js`](mdc:scripts/modules/config-manager.js) provides **getters** (e.g., `getMainProvider()`, `getParametersForRole()`) to access these settings. Core logic should **only** use these getters for *non-AI related application logic* (e.g., `getDefaultSubtasks`). The unified service fetches necessary AI parameters internally based on the `role`.
|
||||||
|
* **API keys** are **NOT** stored here; they are resolved via `resolveEnvVariable` (in [`utils.js`](mdc:scripts/modules/utils.js)) from `.env` (for CLI) or the MCP `session.env` object (for MCP calls). See [`utilities.mdc`](mdc:.cursor/rules/utilities.mdc) and [`dev_workflow.mdc`](mdc:.cursor/rules/dev_workflow.mdc).
|
||||||
|
|
||||||
|
* **Unified Service (`ai-services-unified.js`):**
|
||||||
|
* Exports primary interaction functions: `generateTextService`, `generateObjectService`. (Note: `streamTextService` exists but has known reliability issues with some providers/payloads).
|
||||||
|
* Contains the core `_unifiedServiceRunner` logic.
|
||||||
|
* Internally uses `config-manager.js` getters to determine the provider/model/parameters based on the requested `role`.
|
||||||
|
* Implements the **fallback sequence** (e.g., main -> fallback -> research) if the primary provider/model fails.
|
||||||
|
* Constructs the `messages` array required by the Vercel AI SDK.
|
||||||
|
* Implements **retry logic** for specific API errors (`_attemptProviderCallWithRetries`).
|
||||||
|
* Resolves API keys automatically via `_resolveApiKey` (using `resolveEnvVariable`).
|
||||||
|
* Maps requests to the correct provider implementation (in `src/ai-providers/`) via `PROVIDER_FUNCTIONS`.
|
||||||
|
* Returns a structured object containing the primary AI result (`mainResult`) and telemetry data (`telemetryData`). See [`telemetry.mdc`](mdc:.cursor/rules/telemetry.mdc) for details on how this telemetry data is propagated and handled.
|
||||||
|
|
||||||
|
* **Provider Implementations (`src/ai-providers/*.js`):**
|
||||||
|
* Contain provider-specific wrappers around Vercel AI SDK functions (`generateText`, `generateObject`).
|
||||||
|
|
||||||
|
**Usage Pattern (from Core Logic like `task-manager/*.js`):**
|
||||||
|
|
||||||
|
1. **Import Service:** Import `generateTextService` or `generateObjectService` from `../ai-services-unified.js`.
|
||||||
|
```javascript
|
||||||
|
// Preferred for most tasks (especially with complex JSON)
|
||||||
|
import { generateTextService } from '../ai-services-unified.js';
|
||||||
|
|
||||||
|
// Use if structured output is reliable for the specific use case
|
||||||
|
// import { generateObjectService } from '../ai-services-unified.js';
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Prepare Parameters:** Construct the parameters object for the service call.
|
||||||
|
* `role`: **Required.** `'main'`, `'research'`, or `'fallback'`. Determines the initial provider/model/parameters used by the unified service.
|
||||||
|
* `session`: **Required if called from MCP context.** Pass the `session` object received by the direct function wrapper. The unified service uses `session.env` to find API keys.
|
||||||
|
* `systemPrompt`: Your system instruction string.
|
||||||
|
* `prompt`: The user message string (can be long, include stringified data, etc.).
|
||||||
|
* (For `generateObjectService` only): `schema` (Zod schema), `objectName`.
|
||||||
|
|
||||||
|
3. **Call Service:** Use `await` to call the service function.
|
||||||
|
```javascript
|
||||||
|
// Example using generateTextService (most common)
|
||||||
|
try {
|
||||||
|
const resultText = await generateTextService({
|
||||||
|
role: useResearch ? 'research' : 'main', // Determine role based on logic
|
||||||
|
session: context.session, // Pass session from context object
|
||||||
|
systemPrompt: "You are...",
|
||||||
|
prompt: userMessageContent
|
||||||
|
});
|
||||||
|
// Process the raw text response (e.g., parse JSON, use directly)
|
||||||
|
// ...
|
||||||
|
} catch (error) {
|
||||||
|
// Handle errors thrown by the unified service (if all fallbacks/retries fail)
|
||||||
|
report('error', `Unified AI service call failed: ${error.message}`);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Example using generateObjectService (use cautiously)
|
||||||
|
try {
|
||||||
|
const resultObject = await generateObjectService({
|
||||||
|
role: 'main',
|
||||||
|
session: context.session,
|
||||||
|
schema: myZodSchema,
|
||||||
|
objectName: 'myDataObject',
|
||||||
|
systemPrompt: "You are...",
|
||||||
|
prompt: userMessageContent
|
||||||
|
});
|
||||||
|
// resultObject is already a validated JS object
|
||||||
|
// ...
|
||||||
|
} catch (error) {
|
||||||
|
report('error', `Unified AI service call failed: ${error.message}`);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Handle Results/Errors:** Process the returned text/object or handle errors thrown by the unified service layer.
|
||||||
|
|
||||||
|
**Key Implementation Rules & Gotchas:**
|
||||||
|
|
||||||
|
* ✅ **DO**: Centralize **all** LLM calls through `generateTextService` or `generateObjectService`.
|
||||||
|
* ✅ **DO**: Determine the appropriate `role` (`main`, `research`, `fallback`) in your core logic and pass it to the service.
|
||||||
|
* ✅ **DO**: Pass the `session` object (received in the `context` parameter, especially from direct function wrappers) to the service call when in MCP context.
|
||||||
|
* ✅ **DO**: Ensure API keys are correctly configured in `.env` (for CLI) or `.cursor/mcp.json` (for MCP).
|
||||||
|
* ✅ **DO**: Ensure `.taskmasterconfig` exists and has valid provider/model IDs for the roles you intend to use (manage via `task-master models --setup`).
|
||||||
|
* ✅ **DO**: Use `generateTextService` and implement robust manual JSON parsing (with Zod validation *after* parsing) when structured output is needed, as `generateObjectService` has shown unreliability with some providers/schemas.
|
||||||
|
* ❌ **DON'T**: Import or call anything from the old `ai-services.js`, `ai-client-factory.js`, or `ai-client-utils.js` files.
|
||||||
|
* ❌ **DON'T**: Initialize AI clients (Anthropic, Perplexity, etc.) directly within core logic (`task-manager/`) or MCP direct functions.
|
||||||
|
* ❌ **DON'T**: Fetch AI-specific parameters (model ID, max tokens, temp) using `config-manager.js` getters *for the AI call*. Pass the `role` instead.
|
||||||
|
* ❌ **DON'T**: Implement fallback or retry logic outside `ai-services-unified.js`.
|
||||||
|
* ❌ **DON'T**: Handle API key resolution outside the service layer (it uses `utils.js` internally).
|
||||||
|
* ⚠️ **generateObjectService Caution**: Be aware of potential reliability issues with `generateObjectService` across different providers and complex schemas. Prefer `generateTextService` + manual parsing as a more robust alternative for structured data needs.
|
||||||
@@ -3,7 +3,6 @@ description: Describes the high-level architecture of the Task Master CLI applic
|
|||||||
globs: scripts/modules/*.js
|
globs: scripts/modules/*.js
|
||||||
alwaysApply: false
|
alwaysApply: false
|
||||||
---
|
---
|
||||||
|
|
||||||
# Application Architecture Overview
|
# Application Architecture Overview
|
||||||
|
|
||||||
- **Modular Structure**: The Task Master CLI is built using a modular architecture, with distinct modules responsible for different aspects of the application. This promotes separation of concerns, maintainability, and testability.
|
- **Modular Structure**: The Task Master CLI is built using a modular architecture, with distinct modules responsible for different aspects of the application. This promotes separation of concerns, maintainability, and testability.
|
||||||
@@ -14,114 +13,213 @@ alwaysApply: false
|
|||||||
- **Purpose**: Defines and registers all CLI commands using Commander.js.
|
- **Purpose**: Defines and registers all CLI commands using Commander.js.
|
||||||
- **Responsibilities** (See also: [`commands.mdc`](mdc:.cursor/rules/commands.mdc)):
|
- **Responsibilities** (See also: [`commands.mdc`](mdc:.cursor/rules/commands.mdc)):
|
||||||
- Parses command-line arguments and options.
|
- Parses command-line arguments and options.
|
||||||
- Invokes appropriate functions from other modules to execute commands.
|
- Invokes appropriate core logic functions from `scripts/modules/`.
|
||||||
- Handles user input and output related to command execution.
|
- Handles user input/output for CLI.
|
||||||
- Implements input validation and error handling for CLI commands.
|
- Implements CLI-specific validation.
|
||||||
- **Key Components**:
|
|
||||||
- `programInstance` (Commander.js `Command` instance): Manages command definitions.
|
|
||||||
- `registerCommands(programInstance)`: Function to register all application commands.
|
|
||||||
- Command action handlers: Functions executed when a specific command is invoked.
|
|
||||||
|
|
||||||
- **[`task-manager.js`](mdc:scripts/modules/task-manager.js): Task Data Management**
|
- **[`task-manager.js`](mdc:scripts/modules/task-manager.js) & `task-manager/` directory: Task Data & Core Logic**
|
||||||
- **Purpose**: Manages task data, including loading, saving, creating, updating, deleting, and querying tasks.
|
- **Purpose**: Contains core functions for task data manipulation (CRUD), AI interactions, and related logic.
|
||||||
- **Responsibilities**:
|
- **Responsibilities**:
|
||||||
- Reads and writes task data to `tasks.json` file.
|
- Reading/writing `tasks.json` with tagged task lists support.
|
||||||
- Implements functions for task CRUD operations (Create, Read, Update, Delete).
|
- Implementing functions for task CRUD, parsing PRDs, expanding tasks, updating status, etc.
|
||||||
- Handles task parsing from PRD documents using AI.
|
- **Tagged Task Lists**: Handles task organization across multiple contexts (tags) like "master", branch names, or project phases.
|
||||||
- Manages task expansion and subtask generation.
|
- **Tag Resolution**: Provides backward compatibility by resolving tagged format to legacy format transparently.
|
||||||
- Updates task statuses and properties.
|
- **Delegating AI interactions** to the `ai-services-unified.js` layer.
|
||||||
- Implements task listing and display logic.
|
- Accessing non-AI configuration via `config-manager.js` getters.
|
||||||
- Performs task complexity analysis using AI.
|
- **Key Files**: Individual files within `scripts/modules/task-manager/` handle specific actions (e.g., `add-task.js`, `expand-task.js`).
|
||||||
- **Key Functions**:
|
|
||||||
- `readTasks(tasksPath)` / `writeTasks(tasksPath, tasksData)`: Load and save task data.
|
|
||||||
- `parsePRD(prdFilePath, outputPath, numTasks)`: Parses PRD document to create tasks.
|
|
||||||
- `expandTask(taskId, numSubtasks, useResearch, prompt, force)`: Expands a task into subtasks.
|
|
||||||
- `setTaskStatus(tasksPath, taskIdInput, newStatus)`: Updates task status.
|
|
||||||
- `listTasks(tasksPath, statusFilter, withSubtasks)`: Lists tasks with filtering and subtask display options.
|
|
||||||
- `analyzeComplexity(tasksPath, reportPath, useResearch, thresholdScore)`: Analyzes task complexity.
|
|
||||||
|
|
||||||
- **[`dependency-manager.js`](mdc:scripts/modules/dependency-manager.js): Dependency Management**
|
- **[`dependency-manager.js`](mdc:scripts/modules/dependency-manager.js): Dependency Management**
|
||||||
- **Purpose**: Manages task dependencies, including adding, removing, validating, and fixing dependency relationships.
|
- **Purpose**: Manages task dependencies.
|
||||||
- **Responsibilities**:
|
- **Responsibilities**: Add/remove/validate/fix dependencies across tagged task contexts.
|
||||||
- Adds and removes task dependencies.
|
|
||||||
- Validates dependency relationships to prevent circular dependencies and invalid references.
|
|
||||||
- Fixes invalid dependencies by removing non-existent or self-referential dependencies.
|
|
||||||
- Provides functions to check for circular dependencies.
|
|
||||||
- **Key Functions**:
|
|
||||||
- `addDependency(tasksPath, taskId, dependencyId)`: Adds a dependency between tasks.
|
|
||||||
- `removeDependency(tasksPath, taskId, dependencyId)`: Removes a dependency.
|
|
||||||
- `validateDependencies(tasksPath)`: Validates task dependencies.
|
|
||||||
- `fixDependencies(tasksPath)`: Fixes invalid task dependencies.
|
|
||||||
- `isCircularDependency(tasks, taskId, dependencyChain)`: Detects circular dependencies.
|
|
||||||
|
|
||||||
- **[`ui.js`](mdc:scripts/modules/ui.js): User Interface Components**
|
- **[`ui.js`](mdc:scripts/modules/ui.js): User Interface Components**
|
||||||
- **Purpose**: Handles all user interface elements, including displaying information, formatting output, and providing user feedback.
|
- **Purpose**: Handles CLI output formatting (tables, colors, boxes, spinners).
|
||||||
- **Responsibilities**:
|
- **Responsibilities**: Displaying tasks, reports, progress, suggestions, and migration notices for tagged systems.
|
||||||
- Displays task lists, task details, and command outputs in a formatted way.
|
|
||||||
- Uses `chalk` for colored output and `boxen` for boxed messages.
|
|
||||||
- Implements table display using `cli-table3`.
|
|
||||||
- Shows loading indicators using `ora`.
|
|
||||||
- Provides helper functions for status formatting, dependency display, and progress reporting.
|
|
||||||
- Suggests next actions to the user after command execution.
|
|
||||||
- **Key Functions**:
|
|
||||||
- `displayTaskList(tasks, statusFilter, withSubtasks)`: Displays a list of tasks in a table.
|
|
||||||
- `displayTaskDetails(task)`: Displays detailed information for a single task.
|
|
||||||
- `displayComplexityReport(reportPath)`: Displays the task complexity report.
|
|
||||||
- `startLoadingIndicator(message)` / `stopLoadingIndicator(indicator)`: Manages loading indicators.
|
|
||||||
- `getStatusWithColor(status)`: Returns status string with color formatting.
|
|
||||||
- `formatDependenciesWithStatus(dependencies, allTasks, inTable)`: Formats dependency list with status indicators.
|
|
||||||
|
|
||||||
- **[`ai-services.js`](mdc:scripts/modules/ai-services.js) (Conceptual): AI Integration**
|
- **[`ai-services-unified.js`](mdc:scripts/modules/ai-services-unified.js): Unified AI Service Layer**
|
||||||
- **Purpose**: Abstracts interactions with AI models (like Anthropic Claude and Perplexity AI) for various features. *Note: This module might be implicitly implemented within `task-manager.js` and `utils.js` or could be explicitly created for better organization as the project evolves.*
|
- **Purpose**: Centralized interface for all LLM interactions using Vercel AI SDK.
|
||||||
- **Responsibilities**:
|
- **Responsibilities** (See also: [`ai_services.mdc`](mdc:.cursor/rules/ai_services.mdc)):
|
||||||
- Handles API calls to AI services.
|
- Exports `generateTextService`, `generateObjectService`.
|
||||||
- Manages prompts and parameters for AI requests.
|
- Handles provider/model selection based on `role` and `.taskmasterconfig`.
|
||||||
- Parses AI responses and extracts relevant information.
|
- Resolves API keys (from `.env` or `session.env`).
|
||||||
- Implements logic for task complexity analysis, task expansion, and PRD parsing using AI.
|
- Implements fallback and retry logic.
|
||||||
- **Potential Functions**:
|
- Orchestrates calls to provider-specific implementations (`src/ai-providers/`).
|
||||||
- `getAIResponse(prompt, model, maxTokens, temperature)`: Generic function to interact with AI model.
|
- Telemetry data generated by the AI service layer is propagated upwards through core logic, direct functions, and MCP tools. See [`telemetry.mdc`](mdc:.cursor/rules/telemetry.mdc) for the detailed integration pattern.
|
||||||
- `analyzeTaskComplexityWithAI(taskDescription)`: Sends task description to AI for complexity analysis.
|
|
||||||
- `expandTaskWithAI(taskDescription, numSubtasks, researchContext)`: Generates subtasks using AI.
|
|
||||||
- `parsePRDWithAI(prdContent)`: Extracts tasks from PRD content using AI.
|
|
||||||
|
|
||||||
- **[`utils.js`](mdc:scripts/modules/utils.js): Utility Functions and Configuration**
|
- **[`src/ai-providers/*.js`](mdc:src/ai-providers/): Provider-Specific Implementations**
|
||||||
- **Purpose**: Provides reusable utility functions and global configuration settings used across the application.
|
- **Purpose**: Provider-specific wrappers for Vercel AI SDK functions.
|
||||||
|
- **Responsibilities**: Interact directly with Vercel AI SDK adapters.
|
||||||
|
|
||||||
|
- **[`config-manager.js`](mdc:scripts/modules/config-manager.js): Configuration Management**
|
||||||
|
- **Purpose**: Loads, validates, and provides access to configuration.
|
||||||
- **Responsibilities** (See also: [`utilities.mdc`](mdc:.cursor/rules/utilities.mdc)):
|
- **Responsibilities** (See also: [`utilities.mdc`](mdc:.cursor/rules/utilities.mdc)):
|
||||||
- Manages global configuration settings loaded from environment variables and defaults.
|
- Reads and merges `.taskmasterconfig` with defaults.
|
||||||
- Implements logging utility with different log levels and output formatting.
|
- Provides getters (e.g., `getMainProvider`, `getLogLevel`, `getDefaultSubtasks`) for accessing settings.
|
||||||
- Provides file system operation utilities (read/write JSON files).
|
- **Tag Configuration**: Manages `global.defaultTag` and `tags` section for tag system settings.
|
||||||
- Includes string manipulation utilities (e.g., `truncate`, `sanitizePrompt`).
|
- **Note**: Does **not** store or directly handle API keys (keys are in `.env` or MCP `session.env`).
|
||||||
- Offers task-specific utility functions (e.g., `formatTaskId`, `findTaskById`, `taskExists`).
|
|
||||||
- Implements graph algorithms like cycle detection for dependency management.
|
- **[`utils.js`](mdc:scripts/modules/utils.js): Core Utility Functions**
|
||||||
- **Key Components**:
|
- **Purpose**: Low-level, reusable CLI utilities.
|
||||||
- `CONFIG`: Global configuration object.
|
- **Responsibilities** (See also: [`utilities.mdc`](mdc:.cursor/rules/utilities.mdc)):
|
||||||
- `log(level, ...args)`: Logging function.
|
- Logging (`log` function), File I/O (`readJSON`, `writeJSON`), String utils (`truncate`).
|
||||||
- `readJSON(filepath)` / `writeJSON(filepath, data)`: File I/O utilities for JSON files.
|
- Task utils (`findTaskById`), Dependency utils (`findCycles`).
|
||||||
- `truncate(text, maxLength)`: String truncation utility.
|
- API Key Resolution (`resolveEnvVariable`).
|
||||||
- `formatTaskId(id)` / `findTaskById(tasks, taskId)`: Task ID and search utilities.
|
- Silent Mode Control (`enableSilentMode`, `disableSilentMode`).
|
||||||
- `findCycles(subtaskId, dependencyMap)`: Cycle detection algorithm.
|
- **Tagged Task Lists**: Silent migration system, tag resolution, current tag management.
|
||||||
|
- **Migration System**: `performCompleteTagMigration`, `migrateConfigJson`, `createStateJson`.
|
||||||
|
|
||||||
- **[`mcp-server/`](mdc:mcp-server/): MCP Server Integration**
|
- **[`mcp-server/`](mdc:mcp-server/): MCP Server Integration**
|
||||||
- **Purpose**: Provides an MCP (Model Context Protocol) interface for Task Master, allowing integration with external tools like Cursor. Uses FastMCP framework.
|
- **Purpose**: Provides MCP interface using FastMCP.
|
||||||
- **Responsibilities** (See also: [`mcp.mdc`](mdc:.cursor/rules/mcp.mdc)):
|
- **Responsibilities** (See also: [`mcp.mdc`](mdc:.cursor/rules/mcp.mdc)):
|
||||||
- Registers Task Master functionalities as tools consumable via MCP.
|
- Registers tools (`mcp-server/src/tools/*.js`). Tool `execute` methods **should be wrapped** with the `withNormalizedProjectRoot` HOF (from `tools/utils.js`) to ensure consistent path handling.
|
||||||
- Handles MCP requests and translates them into calls to the Task Master core logic.
|
- The HOF provides a normalized `args.projectRoot` to the `execute` method.
|
||||||
- Prefers direct function calls to core modules via [`task-master-core.js`](mdc:mcp-server/src/core/task-master-core.js) for performance.
|
- Tool `execute` methods call **direct function wrappers** (`mcp-server/src/core/direct-functions/*.js`), passing the normalized `projectRoot` and other args.
|
||||||
- Uses CLI execution via `executeTaskMasterCommand` as a fallback.
|
- Direct functions use path utilities (`mcp-server/src/core/utils/`) to resolve paths based on `projectRoot` from session.
|
||||||
- **Implements Caching**: Utilizes a caching layer (`ContextManager` with `lru-cache`) invoked via `getCachedOrExecute` within direct function wrappers ([`task-master-core.js`](mdc:mcp-server/src/core/task-master-core.js)) to optimize performance for specific read operations (e.g., listing tasks).
|
- Direct functions implement silent mode, logger wrappers, and call core logic functions from `scripts/modules/`.
|
||||||
- Standardizes response formatting for MCP clients using utilities in [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js).
|
- **Tagged Task Lists**: MCP tools fully support the tagged format with complete tag management capabilities.
|
||||||
- **Key Components**:
|
- Manages MCP caching and response formatting.
|
||||||
- `mcp-server/src/server.js`: Main server setup and initialization.
|
|
||||||
- `mcp-server/src/tools/`: Directory containing individual tool definitions, each registering a specific Task Master command for MCP.
|
|
||||||
|
|
||||||
- **Data Flow and Module Dependencies**:
|
- **[`init.js`](mdc:scripts/init.js): Project Initialization Logic**
|
||||||
|
- **Purpose**: Sets up new Task Master project structure.
|
||||||
|
- **Responsibilities**: Creates directories, copies templates, manages `package.json`, sets up `.cursor/mcp.json`, initializes state.json for tagged system.
|
||||||
|
|
||||||
- **Commands Initiate Actions**: User commands entered via the CLI (handled by [`commands.js`](mdc:scripts/modules/commands.js)) are the entry points for most operations.
|
## Tagged Task Lists System Architecture
|
||||||
- **Command Handlers Delegate to Managers**: Command handlers in [`commands.js`](mdc:scripts/modules/commands.js) call functions in [`task-manager.js`](mdc:scripts/modules/task-manager.js) and [`dependency-manager.js`](mdc:scripts/modules/dependency-manager.js) to perform core task and dependency management logic.
|
|
||||||
- **UI for Presentation**: [`ui.js`](mdc:scripts/modules/ui.js) is used by command handlers and task/dependency managers to display information to the user. UI functions primarily consume data and format it for output, without modifying core application state.
|
**Data Structure**: Task Master now uses a tagged task lists system where the `tasks.json` file contains multiple named task lists as top-level keys:
|
||||||
- **Utilities for Common Tasks**: [`utils.js`](mdc:scripts/modules/utils.js) provides helper functions used by all other modules for configuration, logging, file operations, and common data manipulations.
|
|
||||||
- **AI Services Integration**: AI functionalities (complexity analysis, task expansion, PRD parsing) are invoked from [`task-manager.js`](mdc:scripts/modules/task-manager.js) and potentially [`commands.js`](mdc:scripts/modules/commands.js), likely using functions that would reside in a dedicated `ai-services.js` module or be integrated within `utils.js` or `task-manager.js`.
|
```json
|
||||||
- **MCP Server Interaction**: External tools interact with the `mcp-server`, which then calls direct function wrappers in `task-master-core.js` or falls back to `executeTaskMasterCommand`. Responses are formatted by `mcp-server/src/tools/utils.js`. See [`mcp.mdc`](mdc:.cursor/rules/mcp.mdc) for details.
|
{
|
||||||
|
"master": {
|
||||||
|
"tasks": [/* standard task objects */]
|
||||||
|
},
|
||||||
|
"feature-branch": {
|
||||||
|
"tasks": [/* separate task context */]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Key Components:**
|
||||||
|
|
||||||
|
- **Silent Migration**: Automatically transforms legacy `{"tasks": [...]}` format to tagged format `{"master": {"tasks": [...]}}` on first read
|
||||||
|
- **Tag Resolution Layer**: Provides 100% backward compatibility by intercepting tagged format and returning legacy format to existing code
|
||||||
|
- **Configuration Integration**: `global.defaultTag` and `tags` section in config.json manage tag system settings
|
||||||
|
- **State Management**: `.taskmaster/state.json` tracks current tag, migration status, and tag-branch mappings
|
||||||
|
- **Migration Notice**: User-friendly notification system for seamless migration experience
|
||||||
|
|
||||||
|
**Backward Compatibility**: All existing CLI commands and MCP tools continue to work unchanged. The tag resolution layer ensures that existing code receives the expected legacy format while the underlying storage uses the new tagged structure.
|
||||||
|
|
||||||
|
- **Data Flow and Module Dependencies (Updated)**:
|
||||||
|
|
||||||
|
- **CLI**: `bin/task-master.js` -> `scripts/dev.js` (loads `.env`) -> `scripts/modules/commands.js` -> Core Logic (`scripts/modules/*`) -> **Tag Resolution Layer** -> Unified AI Service (`ai-services-unified.js`) -> Provider Adapters -> LLM API.
|
||||||
|
- **MCP**: External Tool -> `mcp-server/server.js` -> Tool (`mcp-server/src/tools/*`) -> Direct Function (`mcp-server/src/core/direct-functions/*`) -> Core Logic (`scripts/modules/*`) -> **Tag Resolution Layer** -> Unified AI Service (`ai-services-unified.js`) -> Provider Adapters -> LLM API.
|
||||||
|
- **Configuration**: Core logic needing non-AI settings calls `config-manager.js` getters (passing `session.env` via `explicitRoot` if from MCP). Unified AI Service internally calls `config-manager.js` getters (using `role`) for AI params and `utils.js` (`resolveEnvVariable` with `session.env`) for API keys.
|
||||||
|
|
||||||
|
## Silent Mode Implementation Pattern in MCP Direct Functions
|
||||||
|
|
||||||
|
Direct functions (the `*Direct` functions in `mcp-server/src/core/direct-functions/`) need to carefully implement silent mode to prevent console logs from interfering with the structured JSON responses required by MCP. This involves both using `enableSilentMode`/`disableSilentMode` around core function calls AND passing the MCP logger via the standard wrapper pattern (see mcp.mdc). Here's the standard pattern for correct implementation:
|
||||||
|
|
||||||
|
1. **Import Silent Mode Utilities**:
|
||||||
|
```javascript
|
||||||
|
import { enableSilentMode, disableSilentMode, isSilentMode } from '../../../../scripts/modules/utils.js';
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Parameter Matching with Core Functions**:
|
||||||
|
- ✅ **DO**: Ensure direct function parameters match the core function parameters
|
||||||
|
- ✅ **DO**: Check the original core function signature before implementing
|
||||||
|
- ❌ **DON'T**: Add parameters to direct functions that don't exist in core functions
|
||||||
|
```javascript
|
||||||
|
// Example: Core function signature
|
||||||
|
// async function expandTask(tasksPath, taskId, numSubtasks, useResearch, additionalContext, options)
|
||||||
|
|
||||||
|
// Direct function implementation - extract only parameters that exist in core
|
||||||
|
export async function expandTaskDirect(args, log, context = {}) {
|
||||||
|
// Extract parameters that match the core function
|
||||||
|
const taskId = parseInt(args.id, 10);
|
||||||
|
const numSubtasks = args.num ? parseInt(args.num, 10) : undefined;
|
||||||
|
const useResearch = args.research === true;
|
||||||
|
const additionalContext = args.prompt || '';
|
||||||
|
|
||||||
|
// Later pass these parameters in the correct order to the core function
|
||||||
|
const result = await expandTask(
|
||||||
|
tasksPath,
|
||||||
|
taskId,
|
||||||
|
numSubtasks,
|
||||||
|
useResearch,
|
||||||
|
additionalContext,
|
||||||
|
{ mcpLog: log, session: context.session }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Checking Silent Mode State**:
|
||||||
|
- ✅ **DO**: Always use `isSilentMode()` function to check current status
|
||||||
|
- ❌ **DON'T**: Directly access the global `silentMode` variable or `global.silentMode`
|
||||||
|
```javascript
|
||||||
|
// CORRECT: Use the function to check current state
|
||||||
|
if (!isSilentMode()) {
|
||||||
|
// Only create a loading indicator if not in silent mode
|
||||||
|
loadingIndicator = startLoadingIndicator('Processing...');
|
||||||
|
}
|
||||||
|
|
||||||
|
// INCORRECT: Don't access global variables directly
|
||||||
|
if (!silentMode) { // ❌ WRONG
|
||||||
|
loadingIndicator = startLoadingIndicator('Processing...');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Wrapping Core Function Calls**:
|
||||||
|
- ✅ **DO**: Use a try/finally block pattern to ensure silent mode is always restored
|
||||||
|
- ✅ **DO**: Enable silent mode before calling core functions that produce console output
|
||||||
|
- ✅ **DO**: Disable silent mode in a finally block to ensure it runs even if errors occur
|
||||||
|
- ❌ **DON'T**: Enable silent mode without ensuring it gets disabled
|
||||||
|
```javascript
|
||||||
|
export async function someDirectFunction(args, log) {
|
||||||
|
try {
|
||||||
|
// Argument preparation
|
||||||
|
const tasksPath = findTasksJsonPath(args, log);
|
||||||
|
const someArg = args.someArg;
|
||||||
|
|
||||||
|
// Enable silent mode to prevent console logs
|
||||||
|
enableSilentMode();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Call core function which might produce console output
|
||||||
|
const result = await someCoreFunction(tasksPath, someArg);
|
||||||
|
|
||||||
|
// Return standardized result object
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: result,
|
||||||
|
fromCache: false
|
||||||
|
};
|
||||||
|
} finally {
|
||||||
|
// ALWAYS disable silent mode in finally block
|
||||||
|
disableSilentMode();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// Standard error handling
|
||||||
|
log.error(`Error in direct function: ${error.message}`);
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error: { code: 'OPERATION_ERROR', message: error.message },
|
||||||
|
fromCache: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
5. **Mixed Parameter and Global Silent Mode Handling**:
|
||||||
|
- For functions that need to handle both a passed `silentMode` parameter and check global state:
|
||||||
|
```javascript
|
||||||
|
// Check both the function parameter and global state
|
||||||
|
const isSilent = options.silentMode || (typeof options.silentMode === 'undefined' && isSilentMode());
|
||||||
|
|
||||||
|
if (!isSilent) {
|
||||||
|
console.log('Operation starting...');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
By following these patterns consistently, direct functions will properly manage console output suppression while ensuring that silent mode is always properly reset, even when errors occur. This creates a more robust system that helps prevent unexpected silent mode states that could cause logging problems in subsequent operations.
|
||||||
|
|
||||||
- **Testing Architecture**:
|
- **Testing Architecture**:
|
||||||
|
|
||||||
@@ -130,6 +228,7 @@ alwaysApply: false
|
|||||||
- **Integration Tests**: Located in `tests/integration/`, test interactions between modules
|
- **Integration Tests**: Located in `tests/integration/`, test interactions between modules
|
||||||
- **End-to-End Tests**: Located in `tests/e2e/`, test complete workflows from a user perspective
|
- **End-to-End Tests**: Located in `tests/e2e/`, test complete workflows from a user perspective
|
||||||
- **Test Fixtures**: Located in `tests/fixtures/`, provide reusable test data
|
- **Test Fixtures**: Located in `tests/fixtures/`, provide reusable test data
|
||||||
|
- **Tagged System Tests**: Test migration, tag resolution, and multi-context functionality
|
||||||
|
|
||||||
- **Module Design for Testability**:
|
- **Module Design for Testability**:
|
||||||
- **Explicit Dependencies**: Functions accept their dependencies as parameters rather than using globals
|
- **Explicit Dependencies**: Functions accept their dependencies as parameters rather than using globals
|
||||||
@@ -138,12 +237,14 @@ alwaysApply: false
|
|||||||
- **Clear Module Interfaces**: Each module has well-defined exports that can be mocked in tests
|
- **Clear Module Interfaces**: Each module has well-defined exports that can be mocked in tests
|
||||||
- **Callback Isolation**: Callbacks are defined as separate functions for easier testing
|
- **Callback Isolation**: Callbacks are defined as separate functions for easier testing
|
||||||
- **Stateless Design**: Modules avoid maintaining internal state where possible
|
- **Stateless Design**: Modules avoid maintaining internal state where possible
|
||||||
|
- **Tag Resolution Testing**: Test both tagged and legacy format handling
|
||||||
|
|
||||||
- **Mock Integration Patterns**:
|
- **Mock Integration Patterns**:
|
||||||
- **External Libraries**: Libraries like `fs`, `commander`, and `@anthropic-ai/sdk` are mocked at module level
|
- **External Libraries**: Libraries like `fs`, `commander`, and `@anthropic-ai/sdk` are mocked at module level
|
||||||
- **Internal Modules**: Application modules are mocked with appropriate spy functions
|
- **Internal Modules**: Application modules are mocked with appropriate spy functions
|
||||||
- **Testing Function Callbacks**: Callbacks are extracted from mock call arguments and tested in isolation
|
- **Testing Function Callbacks**: Callbacks are extracted from mock call arguments and tested in isolation
|
||||||
- **UI Elements**: Output functions from `ui.js` are mocked to verify display calls
|
- **UI Elements**: Output functions from `ui.js` are mocked to verify display calls
|
||||||
|
- **Tagged Data Mocking**: Test both legacy and tagged task data structures
|
||||||
|
|
||||||
- **Testing Flow**:
|
- **Testing Flow**:
|
||||||
- Module dependencies are mocked (following Jest's hoisting behavior)
|
- Module dependencies are mocked (following Jest's hoisting behavior)
|
||||||
@@ -151,6 +252,7 @@ alwaysApply: false
|
|||||||
- Spy functions are set up on module methods
|
- Spy functions are set up on module methods
|
||||||
- Tests call the functions under test and verify behavior
|
- Tests call the functions under test and verify behavior
|
||||||
- Mocks are reset between test cases to maintain isolation
|
- Mocks are reset between test cases to maintain isolation
|
||||||
|
- Tagged system behavior is tested for both migration and normal operation
|
||||||
|
|
||||||
- **Benefits of this Architecture**:
|
- **Benefits of this Architecture**:
|
||||||
|
|
||||||
@@ -159,8 +261,61 @@ alwaysApply: false
|
|||||||
- **Mocking Support**: The clear dependency boundaries make mocking straightforward
|
- **Mocking Support**: The clear dependency boundaries make mocking straightforward
|
||||||
- **Test Isolation**: Each component can be tested without affecting others
|
- **Test Isolation**: Each component can be tested without affecting others
|
||||||
- **Callback Testing**: Function callbacks can be extracted and tested independently
|
- **Callback Testing**: Function callbacks can be extracted and tested independently
|
||||||
|
- **Multi-Context Testing**: Tagged system enables testing different task contexts independently
|
||||||
- **Reusability**: Utility functions and UI components can be reused across different parts of the application.
|
- **Reusability**: Utility functions and UI components can be reused across different parts of the application.
|
||||||
- **Scalability**: New features can be added as new modules or by extending existing ones without significantly impacting other parts of the application.
|
- **Scalability**: New features can be added as new modules or by extending existing ones without significantly impacting other parts of the application.
|
||||||
|
- **Multi-Context Support**: Tagged task lists enable working across different contexts (branches, environments, phases) without conflicts.
|
||||||
|
- **Backward Compatibility**: Seamless migration and tag resolution ensure existing workflows continue unchanged.
|
||||||
- **Clarity**: The modular structure provides a clear separation of concerns, making the codebase easier to navigate and understand for developers.
|
- **Clarity**: The modular structure provides a clear separation of concerns, making the codebase easier to navigate and understand for developers.
|
||||||
|
|
||||||
This architectural overview should help AI models understand the structure and organization of the Task Master CLI codebase, enabling them to more effectively assist with code generation, modification, and understanding.
|
This architectural overview should help AI models understand the structure and organization of the Task Master CLI codebase, enabling them to more effectively assist with code generation, modification, and understanding.
|
||||||
|
|
||||||
|
## Implementing MCP Support for a Command
|
||||||
|
|
||||||
|
Follow these steps to add MCP support for an existing Task Master command (see [`new_features.mdc`](mdc:.cursor/rules/new_features.mdc) for more detail):
|
||||||
|
|
||||||
|
1. **Ensure Core Logic Exists**: Verify the core functionality is implemented and exported from the relevant module in `scripts/modules/`.
|
||||||
|
|
||||||
|
2. **Create Direct Function File in `mcp-server/src/core/direct-functions/`:**
|
||||||
|
- Create a new file (e.g., `your-command.js`) using **kebab-case** naming.
|
||||||
|
- Import necessary core functions, **`findTasksJsonPath` from `../utils/path-utils.js`**, and **silent mode utilities**.
|
||||||
|
- Implement `async function yourCommandDirect(args, log)` using **camelCase** with `Direct` suffix:
|
||||||
|
- **Path Resolution**: Obtain the tasks file path using `const tasksPath = findTasksJsonPath(args, log);`. This relies on `args.projectRoot` being provided.
|
||||||
|
- Parse other `args` and perform necessary validation.
|
||||||
|
- **Implement Silent Mode**: Wrap core function calls with `enableSilentMode()` and `disableSilentMode()`.
|
||||||
|
- Implement caching with `getCachedOrExecute` if applicable.
|
||||||
|
- Call core logic.
|
||||||
|
- Return `{ success: true/false, data/error, fromCache: boolean }`.
|
||||||
|
- Export the wrapper function.
|
||||||
|
- **Note**: Tag-aware MCP tools are fully implemented with complete tag management support.
|
||||||
|
|
||||||
|
3. **Update `task-master-core.js` with Import/Export**: Add imports/exports for the new `*Direct` function.
|
||||||
|
|
||||||
|
4. **Create MCP Tool (`mcp-server/src/tools/`)**:
|
||||||
|
- Create a new file (e.g., `your-command.js`) using **kebab-case**.
|
||||||
|
- Import `zod`, `handleApiResult`, **`getProjectRootFromSession`**, and your `yourCommandDirect` function.
|
||||||
|
- Implement `registerYourCommandTool(server)`.
|
||||||
|
- **Define parameters, making `projectRoot` optional**: `projectRoot: z.string().optional().describe(...)`.
|
||||||
|
- Consider if this operation should run in the background using `AsyncOperationManager`.
|
||||||
|
- Implement the standard `execute` method:
|
||||||
|
- Get `rootFolder` using `getProjectRootFromSession` (with fallback to `args.projectRoot`).
|
||||||
|
- Call `yourCommandDirect({ ...args, projectRoot: rootFolder }, log)` or use `asyncOperationManager.addOperation`.
|
||||||
|
- Pass the result to `handleApiResult`.
|
||||||
|
|
||||||
|
5. **Register Tool**: Import and call `registerYourCommandTool` in `mcp-server/src/tools/index.js`.
|
||||||
|
|
||||||
|
6. **Update `mcp.json`**: Add the new tool definition.
|
||||||
|
|
||||||
|
## Project Initialization
|
||||||
|
|
||||||
|
The `initialize_project` command provides a way to set up a new Task Master project:
|
||||||
|
|
||||||
|
- **CLI Command**: `task-master init`
|
||||||
|
- **MCP Tool**: `initialize_project`
|
||||||
|
- **Functionality**:
|
||||||
|
- Creates necessary directories and files for a new project
|
||||||
|
- Sets up `tasks.json` with tagged structure and initial task files
|
||||||
|
- Configures project metadata (name, description, version)
|
||||||
|
- Initializes state.json for tag system
|
||||||
|
- Handles shell alias creation if requested
|
||||||
|
- Works in both interactive and non-interactive modes
|
||||||
105
.cursor/rules/changeset.mdc
Normal file
105
.cursor/rules/changeset.mdc
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
---
|
||||||
|
description: Guidelines for using Changesets (npm run changeset) to manage versioning and changelogs.
|
||||||
|
alwaysApply: true
|
||||||
|
---
|
||||||
|
|
||||||
|
# Changesets Workflow Guidelines
|
||||||
|
|
||||||
|
Changesets is used to manage package versioning and generate accurate `CHANGELOG.md` files automatically. It's crucial to use it correctly after making meaningful changes that affect the package from an external perspective or significantly impact internal development workflow documented elsewhere.
|
||||||
|
|
||||||
|
## When to Run Changeset
|
||||||
|
|
||||||
|
- Run `npm run changeset` (or `npx changeset add`) **after** you have staged (`git add .`) a logical set of changes that should be communicated in the next release's `CHANGELOG.md`.
|
||||||
|
- This typically includes:
|
||||||
|
- **New Features** (Backward-compatible additions)
|
||||||
|
- **Bug Fixes** (Fixes to existing functionality)
|
||||||
|
- **Breaking Changes** (Changes that are not backward-compatible)
|
||||||
|
- **Performance Improvements** (Enhancements to speed or resource usage)
|
||||||
|
- **Significant Refactoring** (Major code restructuring, even if external behavior is unchanged, as it might affect stability or maintainability) - *Such as reorganizing the MCP server's direct function implementations into separate files*
|
||||||
|
- **User-Facing Documentation Updates** (Changes to README, usage guides, public API docs)
|
||||||
|
- **Dependency Updates** (Especially if they fix known issues or introduce significant changes)
|
||||||
|
- **Build/Tooling Changes** (If they affect how consumers might build or interact with the package)
|
||||||
|
- **Every Pull Request** containing one or more of the above change types **should include a changeset file**.
|
||||||
|
|
||||||
|
## What NOT to Add a Changeset For
|
||||||
|
|
||||||
|
Avoid creating changesets for changes that have **no impact or relevance to external consumers** of the `task-master` package or contributors following **public-facing documentation**. Examples include:
|
||||||
|
|
||||||
|
- **Internal Documentation Updates:** Changes *only* to files within `.cursor/rules/` that solely guide internal development practices for this specific repository.
|
||||||
|
- **Trivial Chores:** Very minor code cleanup, adding comments that don't clarify behavior, typo fixes in non-user-facing code or internal docs.
|
||||||
|
- **Non-Impactful Test Updates:** Minor refactoring of tests, adding tests for existing functionality without fixing bugs.
|
||||||
|
- **Local Configuration Changes:** Updates to personal editor settings, local `.env` files, etc.
|
||||||
|
|
||||||
|
**Rule of Thumb:** If a user installing or using the `task-master` package wouldn't care about the change, or if a contributor following the main README wouldn't need to know about it for their workflow, you likely don't need a changeset.
|
||||||
|
|
||||||
|
## How to Run and What It Asks
|
||||||
|
|
||||||
|
1. **Run the command**:
|
||||||
|
```bash
|
||||||
|
npm run changeset
|
||||||
|
# or
|
||||||
|
npx changeset add
|
||||||
|
```
|
||||||
|
2. **Select Packages**: It will prompt you to select the package(s) affected by your changes using arrow keys and spacebar. If this is not a monorepo, select the main package.
|
||||||
|
3. **Select Bump Type**: Choose the appropriate semantic version bump for **each** selected package:
|
||||||
|
* **`Major`**: For **breaking changes**. Use sparingly.
|
||||||
|
* **`Minor`**: For **new features**.
|
||||||
|
* **`Patch`**: For **bug fixes**, performance improvements, **user-facing documentation changes**, significant refactoring, relevant dependency updates, or impactful build/tooling changes.
|
||||||
|
4. **Enter Summary**: Provide a concise summary of the changes **for the `CHANGELOG.md`**.
|
||||||
|
* **Purpose**: This message is user-facing and explains *what* changed in the release.
|
||||||
|
* **Format**: Use the imperative mood (e.g., "Add feature X", "Fix bug Y", "Update README setup instructions"). Keep it brief, typically a single line.
|
||||||
|
* **Audience**: Think about users installing/updating the package or developers consuming its public API/CLI.
|
||||||
|
* **Not a Git Commit Message**: This summary is *different* from your detailed Git commit message.
|
||||||
|
|
||||||
|
## Changeset Summary vs. Git Commit Message
|
||||||
|
|
||||||
|
- **Changeset Summary**:
|
||||||
|
- **Audience**: Users/Consumers of the package (reads `CHANGELOG.md`).
|
||||||
|
- **Purpose**: Briefly describe *what* changed in the released version that is relevant to them.
|
||||||
|
- **Format**: Concise, imperative mood, single line usually sufficient.
|
||||||
|
- **Example**: `Fix dependency resolution bug in 'next' command.`
|
||||||
|
- **Git Commit Message**:
|
||||||
|
- **Audience**: Developers browsing the Git history of *this* repository.
|
||||||
|
- **Purpose**: Explain *why* the change was made, the context, and the implementation details (can include internal context).
|
||||||
|
- **Format**: Follows commit conventions (e.g., Conventional Commits), can be multi-line with a subject and body.
|
||||||
|
- **Example**:
|
||||||
|
```
|
||||||
|
fix(deps): Correct dependency lookup in 'next' command
|
||||||
|
|
||||||
|
The logic previously failed to account for subtask dependencies when
|
||||||
|
determining the next available task. This commit refactors the
|
||||||
|
dependency check in `findNextTask` within `task-manager.js` to
|
||||||
|
correctly traverse both direct and subtask dependencies. Added
|
||||||
|
unit tests to cover this specific scenario.
|
||||||
|
```
|
||||||
|
- ✅ **DO**: Provide *both* a concise changeset summary (when appropriate) *and* a detailed Git commit message.
|
||||||
|
- ❌ **DON'T**: Use your detailed Git commit message body as the changeset summary.
|
||||||
|
- ❌ **DON'T**: Skip running `changeset` for user-relevant changes just because you wrote a good commit message.
|
||||||
|
|
||||||
|
## The `.changeset` File
|
||||||
|
|
||||||
|
- Running the command creates a unique markdown file in the `.changeset/` directory (e.g., `.changeset/random-name.md`).
|
||||||
|
- This file contains the bump type information and the summary you provided.
|
||||||
|
- **This file MUST be staged and committed** along with your relevant code changes.
|
||||||
|
|
||||||
|
## Standard Workflow Sequence (When a Changeset is Needed)
|
||||||
|
|
||||||
|
1. Make your code or relevant documentation changes.
|
||||||
|
2. Stage your changes: `git add .`
|
||||||
|
3. Run changeset: `npm run changeset`
|
||||||
|
* Select package(s).
|
||||||
|
* Select bump type (`Patch`, `Minor`, `Major`).
|
||||||
|
* Enter the **concise summary** for the changelog.
|
||||||
|
4. Stage the generated changeset file: `git add .changeset/*.md`
|
||||||
|
5. Commit all staged changes (code + changeset file) using your **detailed Git commit message**:
|
||||||
|
```bash
|
||||||
|
git commit -m "feat(module): Add new feature X..."
|
||||||
|
```
|
||||||
|
|
||||||
|
## Release Process (Context)
|
||||||
|
|
||||||
|
- The generated `.changeset/*.md` files are consumed later during the release process.
|
||||||
|
- Commands like `changeset version` read these files, update `package.json` versions, update the `CHANGELOG.md`, and delete the individual changeset files.
|
||||||
|
- Commands like `changeset publish` then publish the new versions to npm.
|
||||||
|
|
||||||
|
Following this workflow ensures that versioning is consistent and changelogs are automatically and accurately generated based on the contributions made.
|
||||||
@@ -6,6 +6,16 @@ alwaysApply: false
|
|||||||
|
|
||||||
# Command-Line Interface Implementation Guidelines
|
# Command-Line Interface Implementation Guidelines
|
||||||
|
|
||||||
|
**Note on Interaction Method:**
|
||||||
|
|
||||||
|
While this document details the implementation of Task Master's **CLI commands**, the **preferred method for interacting with Task Master in integrated environments (like Cursor) is through the MCP server tools**.
|
||||||
|
|
||||||
|
- **Use MCP Tools First**: Always prefer using the MCP tools (e.g., `get_tasks`, `add_task`) when interacting programmatically or via an integrated tool. They offer better performance, structured data, and richer error handling. See [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc) for a comprehensive list of MCP tools and their corresponding CLI commands.
|
||||||
|
- **CLI as Fallback/User Interface**: The `task-master` CLI commands described here are primarily intended for:
|
||||||
|
- Direct user interaction in the terminal.
|
||||||
|
- A fallback mechanism if the MCP server is unavailable or a specific functionality is not exposed via an MCP tool.
|
||||||
|
- **Implementation Context**: This document (`commands.mdc`) focuses on the standards for *implementing* the CLI commands using Commander.js within the [`commands.js`](mdc:scripts/modules/commands.js) module.
|
||||||
|
|
||||||
## Command Structure Standards
|
## Command Structure Standards
|
||||||
|
|
||||||
- **Basic Command Template**:
|
- **Basic Command Template**:
|
||||||
@@ -14,7 +24,7 @@ alwaysApply: false
|
|||||||
programInstance
|
programInstance
|
||||||
.command('command-name')
|
.command('command-name')
|
||||||
.description('Clear, concise description of what the command does')
|
.description('Clear, concise description of what the command does')
|
||||||
.option('-s, --short-option <value>', 'Option description', 'default value')
|
.option('-o, --option <value>', 'Option description', 'default value')
|
||||||
.option('--long-option <value>', 'Option description')
|
.option('--long-option <value>', 'Option description')
|
||||||
.action(async (options) => {
|
.action(async (options) => {
|
||||||
// Command implementation
|
// Command implementation
|
||||||
@@ -24,9 +34,130 @@ alwaysApply: false
|
|||||||
- **Command Handler Organization**:
|
- **Command Handler Organization**:
|
||||||
- ✅ DO: Keep action handlers concise and focused
|
- ✅ DO: Keep action handlers concise and focused
|
||||||
- ✅ DO: Extract core functionality to appropriate modules
|
- ✅ DO: Extract core functionality to appropriate modules
|
||||||
- ✅ DO: Include validation for required parameters
|
- ✅ DO: Have the action handler import and call the relevant functions from core modules, like `task-manager.js` or `init.js`, passing the parsed `options`.
|
||||||
|
- ✅ DO: Perform basic parameter validation, such as checking for required options, within the action handler or at the start of the called core function.
|
||||||
- ❌ DON'T: Implement business logic in command handlers
|
- ❌ DON'T: Implement business logic in command handlers
|
||||||
|
|
||||||
|
## Best Practices for Removal/Delete Commands
|
||||||
|
|
||||||
|
When implementing commands that delete or remove data (like `remove-task` or `remove-subtask`), follow these specific guidelines:
|
||||||
|
|
||||||
|
- **Confirmation Prompts**:
|
||||||
|
- ✅ **DO**: Include a confirmation prompt by default for destructive operations
|
||||||
|
- ✅ **DO**: Provide a `--yes` or `-y` flag to skip confirmation, useful for scripting or automation
|
||||||
|
- ✅ **DO**: Show what will be deleted in the confirmation message
|
||||||
|
- ❌ **DON'T**: Perform destructive operations without user confirmation unless explicitly overridden
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Include confirmation for destructive operations
|
||||||
|
programInstance
|
||||||
|
.command('remove-task')
|
||||||
|
.description('Remove a task or subtask permanently')
|
||||||
|
.option('-i, --id <id>', 'ID of the task to remove')
|
||||||
|
.option('-y, --yes', 'Skip confirmation prompt', false)
|
||||||
|
.action(async (options) => {
|
||||||
|
// Validation code...
|
||||||
|
|
||||||
|
if (!options.yes) {
|
||||||
|
const confirm = await inquirer.prompt([{
|
||||||
|
type: 'confirm',
|
||||||
|
name: 'proceed',
|
||||||
|
message: `Are you sure you want to permanently delete task ${taskId}? This cannot be undone.`,
|
||||||
|
default: false
|
||||||
|
}]);
|
||||||
|
|
||||||
|
if (!confirm.proceed) {
|
||||||
|
console.log(chalk.yellow('Operation cancelled.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Proceed with removal...
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
- **File Path Handling**:
|
||||||
|
- ✅ **DO**: Use `path.join()` to construct file paths
|
||||||
|
- ✅ **DO**: Follow established naming conventions for tasks, like `task_001.txt`
|
||||||
|
- ✅ **DO**: Check if files exist before attempting to delete them
|
||||||
|
- ✅ **DO**: Handle file deletion errors gracefully
|
||||||
|
- ❌ **DON'T**: Construct paths with string concatenation
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Properly construct file paths
|
||||||
|
const taskFilePath = path.join(
|
||||||
|
path.dirname(tasksPath),
|
||||||
|
`task_${taskId.toString().padStart(3, '0')}.txt`
|
||||||
|
);
|
||||||
|
|
||||||
|
// ✅ DO: Check existence before deletion
|
||||||
|
if (fs.existsSync(taskFilePath)) {
|
||||||
|
try {
|
||||||
|
fs.unlinkSync(taskFilePath);
|
||||||
|
console.log(chalk.green(`Task file deleted: ${taskFilePath}`));
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(chalk.yellow(`Could not delete task file: ${error.message}`));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Clean Up References**:
|
||||||
|
- ✅ **DO**: Clean up references to the deleted item in other parts of the data
|
||||||
|
- ✅ **DO**: Handle both direct and indirect references
|
||||||
|
- ✅ **DO**: Explain what related data is being updated
|
||||||
|
- ❌ **DON'T**: Leave dangling references
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Clean up references when deleting items
|
||||||
|
console.log(chalk.blue('Cleaning up task dependencies...'));
|
||||||
|
let referencesRemoved = 0;
|
||||||
|
|
||||||
|
// Update dependencies in other tasks
|
||||||
|
data.tasks.forEach(task => {
|
||||||
|
if (task.dependencies && task.dependencies.includes(taskId)) {
|
||||||
|
task.dependencies = task.dependencies.filter(depId => depId !== taskId);
|
||||||
|
referencesRemoved++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (referencesRemoved > 0) {
|
||||||
|
console.log(chalk.green(`Removed ${referencesRemoved} references to task ${taskId} from other tasks`));
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Task File Regeneration**:
|
||||||
|
- ✅ **DO**: Regenerate task files after destructive operations
|
||||||
|
- ✅ **DO**: Pass all required parameters to generation functions
|
||||||
|
- ✅ **DO**: Provide an option to skip regeneration if needed
|
||||||
|
- ❌ **DON'T**: Assume default parameters will work
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Properly regenerate files after deletion
|
||||||
|
if (!options.skipGenerate) {
|
||||||
|
console.log(chalk.blue('Regenerating task files...'));
|
||||||
|
try {
|
||||||
|
// Note both parameters are explicitly provided
|
||||||
|
await generateTaskFiles(tasksPath, path.dirname(tasksPath));
|
||||||
|
console.log(chalk.green('Task files regenerated successfully'));
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(chalk.yellow(`Warning: Could not regenerate task files: ${error.message}`));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Alternative Suggestions**:
|
||||||
|
- ✅ **DO**: Suggest non-destructive alternatives when appropriate
|
||||||
|
- ✅ **DO**: Explain the difference between deletion and status changes
|
||||||
|
- ✅ **DO**: Include examples of alternative commands
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Suggest alternatives for destructive operations
|
||||||
|
console.log(chalk.yellow('Note: If you just want to exclude this task from active work, consider:'));
|
||||||
|
console.log(chalk.cyan(` task-master set-status --id='${taskId}' --status='cancelled'`));
|
||||||
|
console.log(chalk.cyan(` task-master set-status --id='${taskId}' --status='deferred'`));
|
||||||
|
console.log('This preserves the task and its history for reference.');
|
||||||
|
```
|
||||||
|
|
||||||
## Option Naming Conventions
|
## Option Naming Conventions
|
||||||
|
|
||||||
- **Command Names**:
|
- **Command Names**:
|
||||||
@@ -35,10 +166,10 @@ alwaysApply: false
|
|||||||
- ✅ DO: Use descriptive, action-oriented names
|
- ✅ DO: Use descriptive, action-oriented names
|
||||||
|
|
||||||
- **Option Names**:
|
- **Option Names**:
|
||||||
- ✅ DO: Use kebab-case for long-form option names (`--output-format`)
|
- ✅ DO: Use kebab-case for long-form option names, like `--output-format`
|
||||||
- ✅ DO: Provide single-letter shortcuts when appropriate (`-f, --file`)
|
- ✅ DO: Provide single-letter shortcuts when appropriate, like `-f, --file`
|
||||||
- ✅ DO: Use consistent option names across similar commands
|
- ✅ DO: Use consistent option names across similar commands
|
||||||
- ❌ DON'T: Use different names for the same concept (`--file` in one command, `--path` in another)
|
- ❌ DON'T: Use different names for the same concept, such as `--file` in one command and `--path` in another
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// ✅ DO: Use consistent option naming
|
// ✅ DO: Use consistent option naming
|
||||||
@@ -50,7 +181,7 @@ alwaysApply: false
|
|||||||
.option('-p, --path <dir>', 'Output directory') // Should be --output
|
.option('-p, --path <dir>', 'Output directory') // Should be --output
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Note**: Although options are defined with kebab-case (`--num-tasks`), Commander.js stores them internally as camelCase properties. Access them in code as `options.numTasks`, not `options['num-tasks']`.
|
> **Note**: Although options are defined with kebab-case, like `--num-tasks`, Commander.js stores them internally as camelCase properties. Access them in code as `options.numTasks`, not `options['num-tasks']`.
|
||||||
|
|
||||||
- **Boolean Flag Conventions**:
|
- **Boolean Flag Conventions**:
|
||||||
- ✅ DO: Use positive flags with `--skip-` prefix for disabling behavior
|
- ✅ DO: Use positive flags with `--skip-` prefix for disabling behavior
|
||||||
@@ -79,7 +210,7 @@ alwaysApply: false
|
|||||||
- **Required Parameters**:
|
- **Required Parameters**:
|
||||||
- ✅ DO: Check that required parameters are provided
|
- ✅ DO: Check that required parameters are provided
|
||||||
- ✅ DO: Provide clear error messages when parameters are missing
|
- ✅ DO: Provide clear error messages when parameters are missing
|
||||||
- ✅ DO: Use early returns with process.exit(1) for validation failures
|
- ✅ DO: Use early returns with `process.exit(1)` for validation failures
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// ✅ DO: Validate required parameters early
|
// ✅ DO: Validate required parameters early
|
||||||
@@ -90,7 +221,7 @@ alwaysApply: false
|
|||||||
```
|
```
|
||||||
|
|
||||||
- **Parameter Type Conversion**:
|
- **Parameter Type Conversion**:
|
||||||
- ✅ DO: Convert string inputs to appropriate types (numbers, booleans)
|
- ✅ DO: Convert string inputs to appropriate types, such as numbers or booleans
|
||||||
- ✅ DO: Handle conversion errors gracefully
|
- ✅ DO: Handle conversion errors gracefully
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
@@ -123,7 +254,7 @@ alwaysApply: false
|
|||||||
const taskId = parseInt(options.id, 10);
|
const taskId = parseInt(options.id, 10);
|
||||||
if (isNaN(taskId) || taskId <= 0) {
|
if (isNaN(taskId) || taskId <= 0) {
|
||||||
console.error(chalk.red(`Error: Invalid task ID: ${options.id}. Task ID must be a positive integer.`));
|
console.error(chalk.red(`Error: Invalid task ID: ${options.id}. Task ID must be a positive integer.`));
|
||||||
console.log(chalk.yellow('Usage example: task-master update-task --id=23 --prompt="Update with new information"'));
|
console.log(chalk.yellow("Usage example: task-master update-task --id='23' --prompt='Update with new information.\\nEnsure proper error handling.'"));
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,8 +300,8 @@ alwaysApply: false
|
|||||||
(dependencies.length > 0 ? chalk.white(`Dependencies: ${dependencies.join(', ')}`) + '\n' : '') +
|
(dependencies.length > 0 ? chalk.white(`Dependencies: ${dependencies.join(', ')}`) + '\n' : '') +
|
||||||
'\n' +
|
'\n' +
|
||||||
chalk.white.bold('Next Steps:') + '\n' +
|
chalk.white.bold('Next Steps:') + '\n' +
|
||||||
chalk.cyan(`1. Run ${chalk.yellow(`task-master show ${parentId}`)} to see the parent task with all subtasks`) + '\n' +
|
chalk.cyan(`1. Run ${chalk.yellow(`task-master show '${parentId}'`)} to see the parent task with all subtasks`) + '\n' +
|
||||||
chalk.cyan(`2. Run ${chalk.yellow(`task-master set-status --id=${parentId}.${subtask.id} --status=in-progress`)} to start working on it`),
|
chalk.cyan(`2. Run ${chalk.yellow(`task-master set-status --id='${parentId}.${subtask.id}' --status='in-progress'`)} to start working on it`),
|
||||||
{ padding: 1, borderColor: 'green', borderStyle: 'round', margin: { top: 1 } }
|
{ padding: 1, borderColor: 'green', borderStyle: 'round', margin: { top: 1 } }
|
||||||
));
|
));
|
||||||
```
|
```
|
||||||
@@ -198,6 +329,60 @@ alwaysApply: false
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Context-Aware Command Pattern
|
||||||
|
|
||||||
|
For AI-powered commands that benefit from project context, follow the research command pattern:
|
||||||
|
|
||||||
|
- **Context Integration**:
|
||||||
|
- ✅ DO: Use `ContextGatherer` utility for multi-source context extraction
|
||||||
|
- ✅ DO: Support task IDs, file paths, custom context, and project tree
|
||||||
|
- ✅ DO: Implement fuzzy search for automatic task discovery
|
||||||
|
- ✅ DO: Display detailed token breakdown for transparency
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Follow this pattern for context-aware commands
|
||||||
|
programInstance
|
||||||
|
.command('research')
|
||||||
|
.description('Perform AI-powered research queries with project context')
|
||||||
|
.argument('<prompt>', 'Research prompt to investigate')
|
||||||
|
.option('-i, --id <ids>', 'Comma-separated task/subtask IDs to include as context')
|
||||||
|
.option('-f, --files <paths>', 'Comma-separated file paths to include as context')
|
||||||
|
.option('-c, --context <text>', 'Additional custom context')
|
||||||
|
.option('--tree', 'Include project file tree structure')
|
||||||
|
.option('-d, --detail <level>', 'Output detail level: low, medium, high', 'medium')
|
||||||
|
.action(async (prompt, options) => {
|
||||||
|
// 1. Parameter validation and parsing
|
||||||
|
const taskIds = options.id ? parseTaskIds(options.id) : [];
|
||||||
|
const filePaths = options.files ? parseFilePaths(options.files) : [];
|
||||||
|
|
||||||
|
// 2. Initialize context gatherer
|
||||||
|
const projectRoot = findProjectRoot() || '.';
|
||||||
|
const gatherer = new ContextGatherer(projectRoot, tasksPath);
|
||||||
|
|
||||||
|
// 3. Auto-discover relevant tasks if none specified
|
||||||
|
if (taskIds.length === 0) {
|
||||||
|
const fuzzySearch = new FuzzyTaskSearch(tasksData.tasks, 'research');
|
||||||
|
const discoveredIds = fuzzySearch.getTaskIds(
|
||||||
|
fuzzySearch.findRelevantTasks(prompt)
|
||||||
|
);
|
||||||
|
taskIds.push(...discoveredIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. Gather context with token breakdown
|
||||||
|
const contextResult = await gatherer.gather({
|
||||||
|
tasks: taskIds,
|
||||||
|
files: filePaths,
|
||||||
|
customContext: options.context,
|
||||||
|
includeProjectTree: options.projectTree,
|
||||||
|
format: 'research',
|
||||||
|
includeTokenCounts: true
|
||||||
|
});
|
||||||
|
|
||||||
|
// 5. Display token breakdown and execute AI call
|
||||||
|
// Implementation continues...
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
## Error Handling
|
## Error Handling
|
||||||
|
|
||||||
- **Exception Management**:
|
- **Exception Management**:
|
||||||
@@ -245,7 +430,7 @@ alwaysApply: false
|
|||||||
' --option1 <value> Description of option1 (required)\n' +
|
' --option1 <value> Description of option1 (required)\n' +
|
||||||
' --option2 <value> Description of option2\n\n' +
|
' --option2 <value> Description of option2\n\n' +
|
||||||
chalk.cyan('Examples:') + '\n' +
|
chalk.cyan('Examples:') + '\n' +
|
||||||
' task-master command --option1=value --option2=value',
|
' task-master command --option1=\'value1\' --option2=\'value2\'',
|
||||||
{ padding: 1, borderColor: 'blue', borderStyle: 'round' }
|
{ padding: 1, borderColor: 'blue', borderStyle: 'round' }
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -261,9 +446,9 @@ alwaysApply: false
|
|||||||
process.on('uncaughtException', (err) => {
|
process.on('uncaughtException', (err) => {
|
||||||
// Handle Commander-specific errors
|
// Handle Commander-specific errors
|
||||||
if (err.code === 'commander.unknownOption') {
|
if (err.code === 'commander.unknownOption') {
|
||||||
const option = err.message.match(/'([^']+)'/)?.[1];
|
const option = err.message.match(/'([^']+)'/)?.[1]; // Safely extract option name
|
||||||
console.error(chalk.red(`Error: Unknown option '${option}'`));
|
console.error(chalk.red(`Error: Unknown option '${option}'`));
|
||||||
console.error(chalk.yellow(`Run 'task-master <command> --help' to see available options`));
|
console.error(chalk.yellow("Run 'task-master <command> --help' to see available options"));
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,7 +473,7 @@ alwaysApply: false
|
|||||||
// Provide more helpful error messages for common issues
|
// Provide more helpful error messages for common issues
|
||||||
if (error.message.includes('task') && error.message.includes('not found')) {
|
if (error.message.includes('task') && error.message.includes('not found')) {
|
||||||
console.log(chalk.yellow('\nTo fix this issue:'));
|
console.log(chalk.yellow('\nTo fix this issue:'));
|
||||||
console.log(' 1. Run task-master list to see all available task IDs');
|
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');
|
console.log(' 2. Use a valid task ID with the --id parameter');
|
||||||
} else if (error.message.includes('API key')) {
|
} else if (error.message.includes('API key')) {
|
||||||
console.log(chalk.yellow('\nThis error is related to API keys. Check your environment variables.'));
|
console.log(chalk.yellow('\nThis error is related to API keys. Check your environment variables.'));
|
||||||
@@ -333,9 +518,9 @@ alwaysApply: false
|
|||||||
.option('-f, --file <path>', 'Path to the tasks file', 'tasks/tasks.json')
|
.option('-f, --file <path>', 'Path to the tasks file', 'tasks/tasks.json')
|
||||||
.option('-p, --parent <id>', 'ID of the parent task (required)')
|
.option('-p, --parent <id>', 'ID of the parent task (required)')
|
||||||
.option('-i, --task-id <id>', 'Existing task ID to convert to subtask')
|
.option('-i, --task-id <id>', 'Existing task ID to convert to subtask')
|
||||||
.option('-t, --title <title>', 'Title for the new subtask (when not converting)')
|
.option('-t, --title <title>', 'Title for the new subtask, required if not converting')
|
||||||
.option('-d, --description <description>', 'Description for the new subtask (when not converting)')
|
.option('-d, --description <description>', 'Description for the new subtask, optional')
|
||||||
.option('--details <details>', 'Implementation details for the new subtask (when not converting)')
|
.option('--details <details>', 'Implementation details for the new subtask, optional')
|
||||||
.option('--dependencies <ids>', 'Comma-separated list of subtask IDs this subtask depends on')
|
.option('--dependencies <ids>', 'Comma-separated list of subtask IDs this subtask depends on')
|
||||||
.option('--status <status>', 'Initial status for the subtask', 'pending')
|
.option('--status <status>', 'Initial status for the subtask', 'pending')
|
||||||
.option('--skip-generate', 'Skip regenerating task files')
|
.option('--skip-generate', 'Skip regenerating task files')
|
||||||
@@ -358,8 +543,8 @@ alwaysApply: false
|
|||||||
.command('remove-subtask')
|
.command('remove-subtask')
|
||||||
.description('Remove a subtask from its parent task, optionally converting it to a standalone task')
|
.description('Remove a subtask from its parent task, optionally converting it to a standalone task')
|
||||||
.option('-f, --file <path>', 'Path to the tasks file', 'tasks/tasks.json')
|
.option('-f, --file <path>', 'Path to the tasks file', 'tasks/tasks.json')
|
||||||
.option('-i, --id <id>', 'ID of the subtask to remove in format "parentId.subtaskId" (required)')
|
.option('-i, --id <id>', 'ID of the subtask to remove in format parentId.subtaskId, required')
|
||||||
.option('-c, --convert', 'Convert the subtask to a standalone task')
|
.option('-c, --convert', 'Convert the subtask to a standalone task instead of deleting')
|
||||||
.option('--skip-generate', 'Skip regenerating task files')
|
.option('--skip-generate', 'Skip regenerating task files')
|
||||||
.action(async (options) => {
|
.action(async (options) => {
|
||||||
// Implementation with detailed error handling
|
// Implementation with detailed error handling
|
||||||
@@ -382,7 +567,8 @@ alwaysApply: false
|
|||||||
// ✅ DO: Implement version checking function
|
// ✅ DO: Implement version checking function
|
||||||
async function checkForUpdate() {
|
async function checkForUpdate() {
|
||||||
// Implementation details...
|
// Implementation details...
|
||||||
return { currentVersion, latestVersion, needsUpdate };
|
// Example return structure:
|
||||||
|
return { currentVersion, latestVersion, updateAvailable };
|
||||||
}
|
}
|
||||||
|
|
||||||
// ✅ DO: Implement semantic version comparison
|
// ✅ DO: Implement semantic version comparison
|
||||||
@@ -422,7 +608,7 @@ alwaysApply: false
|
|||||||
|
|
||||||
// After command execution, check if an update is available
|
// After command execution, check if an update is available
|
||||||
const updateInfo = await updateCheckPromise;
|
const updateInfo = await updateCheckPromise;
|
||||||
if (updateInfo.needsUpdate) {
|
if (updateInfo.updateAvailable) {
|
||||||
displayUpgradeNotification(updateInfo.currentVersion, updateInfo.latestVersion);
|
displayUpgradeNotification(updateInfo.currentVersion, updateInfo.latestVersion);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -431,4 +617,46 @@ alwaysApply: false
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Refer to [`commands.js`](mdc:scripts/modules/commands.js) for implementation examples and [`new_features.mdc`](mdc:.cursor/rules/new_features.mdc) for integration guidelines.
|
Refer to [`commands.js`](mdc:scripts/modules/commands.js) for implementation examples and [`new_features.mdc`](mdc:.cursor/rules/new_features.mdc) for integration guidelines.
|
||||||
|
// Helper function to show add-subtask command help
|
||||||
|
function showAddSubtaskHelp() {
|
||||||
|
console.log(boxen(
|
||||||
|
chalk.white.bold('Add Subtask Command Help') + '\n\n' +
|
||||||
|
chalk.cyan('Usage:') + '\n' +
|
||||||
|
` task-master add-subtask --parent=<id> [options]\n\n` +
|
||||||
|
chalk.cyan('Options:') + '\n' +
|
||||||
|
' -p, --parent <id> Parent task ID (required)\n' +
|
||||||
|
' -i, --task-id <id> Existing task ID to convert to subtask\n' +
|
||||||
|
' -t, --title <title> Title for the new subtask\n' +
|
||||||
|
' -d, --description <text> Description for the new subtask\n' +
|
||||||
|
' --details <text> Implementation details for the new subtask\n' +
|
||||||
|
' --dependencies <ids> Comma-separated list of dependency IDs\n' +
|
||||||
|
' -s, --status <status> Status for the new subtask (default: "pending")\n' +
|
||||||
|
' -f, --file <file> Path to the tasks file (default: "tasks/tasks.json")\n' +
|
||||||
|
' --skip-generate Skip regenerating task files\n\n' +
|
||||||
|
chalk.cyan('Examples:') + '\n' +
|
||||||
|
' task-master add-subtask --parent=\'5\' --task-id=\'8\'\n' +
|
||||||
|
' task-master add-subtask -p \'5\' -t \'Implement login UI\' -d \'Create the login form\'\n' +
|
||||||
|
' task-master add-subtask -p \'5\' -t \'Handle API Errors\' --details $\'Handle 401 Unauthorized.\nHandle 500 Server Error.\'',
|
||||||
|
{ padding: 1, borderColor: 'blue', borderStyle: 'round' }
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper function to show remove-subtask command help
|
||||||
|
function showRemoveSubtaskHelp() {
|
||||||
|
console.log(boxen(
|
||||||
|
chalk.white.bold('Remove Subtask Command Help') + '\n\n' +
|
||||||
|
chalk.cyan('Usage:') + '\n' +
|
||||||
|
` task-master remove-subtask --id=<parentId.subtaskId> [options]\n\n` +
|
||||||
|
chalk.cyan('Options:') + '\n' +
|
||||||
|
' -i, --id <id> Subtask ID(s) to remove in format "parentId.subtaskId" (can be comma-separated, required)\n' +
|
||||||
|
' -c, --convert Convert the subtask to a standalone task instead of deleting it\n' +
|
||||||
|
' -f, --file <file> Path to the tasks file (default: "tasks/tasks.json")\n' +
|
||||||
|
' --skip-generate Skip regenerating task files\n\n' +
|
||||||
|
chalk.cyan('Examples:') + '\n' +
|
||||||
|
' task-master remove-subtask --id=\'5.2\'\n' +
|
||||||
|
' task-master remove-subtask --id=\'5.2,6.3,7.1\'\n' +
|
||||||
|
' task-master remove-subtask --id=\'5.2\' --convert',
|
||||||
|
{ padding: 1, borderColor: 'blue', borderStyle: 'round' }
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|||||||
268
.cursor/rules/context_gathering.mdc
Normal file
268
.cursor/rules/context_gathering.mdc
Normal file
@@ -0,0 +1,268 @@
|
|||||||
|
---
|
||||||
|
description: Standardized patterns for gathering and processing context from multiple sources in Task Master commands, particularly for AI-powered features.
|
||||||
|
globs:
|
||||||
|
alwaysApply: false
|
||||||
|
---
|
||||||
|
# Context Gathering Patterns and Utilities
|
||||||
|
|
||||||
|
This document outlines the standardized patterns for gathering and processing context from multiple sources in Task Master commands, particularly for AI-powered features.
|
||||||
|
|
||||||
|
## Core Context Gathering Utility
|
||||||
|
|
||||||
|
The `ContextGatherer` class (`scripts/modules/utils/contextGatherer.js`) provides a centralized, reusable utility for extracting context from multiple sources:
|
||||||
|
|
||||||
|
### **Key Features**
|
||||||
|
- **Multi-source Context**: Tasks, files, custom text, project file tree
|
||||||
|
- **Token Counting**: Detailed breakdown using `gpt-tokens` library
|
||||||
|
- **Format Support**: Different output formats (research, chat, system-prompt)
|
||||||
|
- **Error Handling**: Graceful handling of missing files, invalid task IDs
|
||||||
|
- **Performance**: File size limits, depth limits for tree generation
|
||||||
|
|
||||||
|
### **Usage Pattern**
|
||||||
|
```javascript
|
||||||
|
import { ContextGatherer } from '../utils/contextGatherer.js';
|
||||||
|
|
||||||
|
// Initialize with project paths
|
||||||
|
const gatherer = new ContextGatherer(projectRoot, tasksPath);
|
||||||
|
|
||||||
|
// Gather context with detailed token breakdown
|
||||||
|
const result = await gatherer.gather({
|
||||||
|
tasks: ['15', '16.2'], // Task and subtask IDs
|
||||||
|
files: ['src/api.js', 'README.md'], // File paths
|
||||||
|
customContext: 'Additional context text',
|
||||||
|
includeProjectTree: true, // Include file tree
|
||||||
|
format: 'research', // Output format
|
||||||
|
includeTokenCounts: true // Get detailed token breakdown
|
||||||
|
});
|
||||||
|
|
||||||
|
// Access results
|
||||||
|
const contextString = result.context;
|
||||||
|
const tokenBreakdown = result.tokenBreakdown;
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Token Breakdown Structure**
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
customContext: { tokens: 150, characters: 800 },
|
||||||
|
tasks: [
|
||||||
|
{ id: '15', type: 'task', title: 'Task Title', tokens: 245, characters: 1200 },
|
||||||
|
{ id: '16.2', type: 'subtask', title: 'Subtask Title', tokens: 180, characters: 900 }
|
||||||
|
],
|
||||||
|
files: [
|
||||||
|
{ path: 'src/api.js', tokens: 890, characters: 4500, size: '4.5 KB' }
|
||||||
|
],
|
||||||
|
projectTree: { tokens: 320, characters: 1600 },
|
||||||
|
total: { tokens: 1785, characters: 8000 }
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Fuzzy Search Integration
|
||||||
|
|
||||||
|
The `FuzzyTaskSearch` class (`scripts/modules/utils/fuzzyTaskSearch.js`) provides intelligent task discovery:
|
||||||
|
|
||||||
|
### **Key Features**
|
||||||
|
- **Semantic Matching**: Uses Fuse.js for similarity scoring
|
||||||
|
- **Purpose Categories**: Pattern-based task categorization
|
||||||
|
- **Relevance Scoring**: High/medium/low relevance thresholds
|
||||||
|
- **Context-Aware**: Different search configurations for different use cases
|
||||||
|
|
||||||
|
### **Usage Pattern**
|
||||||
|
```javascript
|
||||||
|
import { FuzzyTaskSearch } from '../utils/fuzzyTaskSearch.js';
|
||||||
|
|
||||||
|
// Initialize with tasks data and context
|
||||||
|
const fuzzySearch = new FuzzyTaskSearch(tasksData.tasks, 'research');
|
||||||
|
|
||||||
|
// Find relevant tasks
|
||||||
|
const searchResults = fuzzySearch.findRelevantTasks(query, {
|
||||||
|
maxResults: 8,
|
||||||
|
includeRecent: true,
|
||||||
|
includeCategoryMatches: true
|
||||||
|
});
|
||||||
|
|
||||||
|
// Get task IDs for context gathering
|
||||||
|
const taskIds = fuzzySearch.getTaskIds(searchResults);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Implementation Patterns for Commands
|
||||||
|
|
||||||
|
### **1. Context-Aware Command Structure**
|
||||||
|
```javascript
|
||||||
|
// In command action handler
|
||||||
|
async function commandAction(prompt, options) {
|
||||||
|
// 1. Parameter validation and parsing
|
||||||
|
const taskIds = options.id ? parseTaskIds(options.id) : [];
|
||||||
|
const filePaths = options.files ? parseFilePaths(options.files) : [];
|
||||||
|
|
||||||
|
// 2. Initialize context gatherer
|
||||||
|
const projectRoot = findProjectRoot() || '.';
|
||||||
|
const tasksPath = path.join(projectRoot, 'tasks', 'tasks.json');
|
||||||
|
const gatherer = new ContextGatherer(projectRoot, tasksPath);
|
||||||
|
|
||||||
|
// 3. Auto-discover relevant tasks if none specified
|
||||||
|
if (taskIds.length === 0) {
|
||||||
|
const fuzzySearch = new FuzzyTaskSearch(tasksData.tasks, 'research');
|
||||||
|
const discoveredIds = fuzzySearch.getTaskIds(
|
||||||
|
fuzzySearch.findRelevantTasks(prompt)
|
||||||
|
);
|
||||||
|
taskIds.push(...discoveredIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. Gather context with token breakdown
|
||||||
|
const contextResult = await gatherer.gather({
|
||||||
|
tasks: taskIds,
|
||||||
|
files: filePaths,
|
||||||
|
customContext: options.context,
|
||||||
|
includeProjectTree: options.projectTree,
|
||||||
|
format: 'research',
|
||||||
|
includeTokenCounts: true
|
||||||
|
});
|
||||||
|
|
||||||
|
// 5. Display token breakdown (for CLI)
|
||||||
|
if (outputFormat === 'text') {
|
||||||
|
displayDetailedTokenBreakdown(contextResult.tokenBreakdown);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. Use context in AI call
|
||||||
|
const aiResult = await generateTextService(role, session, systemPrompt, userPrompt);
|
||||||
|
|
||||||
|
// 7. Display results with enhanced formatting
|
||||||
|
displayResults(aiResult, contextResult.tokenBreakdown);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### **2. Token Display Pattern**
|
||||||
|
```javascript
|
||||||
|
function displayDetailedTokenBreakdown(tokenBreakdown, systemTokens, userTokens) {
|
||||||
|
const sections = [];
|
||||||
|
|
||||||
|
// Build context breakdown
|
||||||
|
if (tokenBreakdown.tasks?.length > 0) {
|
||||||
|
const taskDetails = tokenBreakdown.tasks.map(task =>
|
||||||
|
`${task.type === 'subtask' ? ' ' : ''}${task.id}: ${task.tokens.toLocaleString()}`
|
||||||
|
).join('\n');
|
||||||
|
sections.push(`Tasks (${tokenBreakdown.tasks.reduce((sum, t) => sum + t.tokens, 0).toLocaleString()}):\n${taskDetails}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tokenBreakdown.files?.length > 0) {
|
||||||
|
const fileDetails = tokenBreakdown.files.map(file =>
|
||||||
|
` ${file.path}: ${file.tokens.toLocaleString()} (${file.size})`
|
||||||
|
).join('\n');
|
||||||
|
sections.push(`Files (${tokenBreakdown.files.reduce((sum, f) => sum + f.tokens, 0).toLocaleString()}):\n${fileDetails}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add prompts breakdown
|
||||||
|
sections.push(`Prompts: system ${systemTokens.toLocaleString()}, user ${userTokens.toLocaleString()}`);
|
||||||
|
|
||||||
|
// Display in clean box
|
||||||
|
const content = sections.join('\n\n');
|
||||||
|
console.log(boxen(content, {
|
||||||
|
title: chalk.cyan('Token Usage'),
|
||||||
|
padding: { top: 1, bottom: 1, left: 2, right: 2 },
|
||||||
|
borderStyle: 'round',
|
||||||
|
borderColor: 'cyan'
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### **3. Enhanced Result Display Pattern**
|
||||||
|
```javascript
|
||||||
|
function displayResults(result, query, detailLevel, tokenBreakdown) {
|
||||||
|
// Header with query info
|
||||||
|
const header = boxen(
|
||||||
|
chalk.green.bold('Research Results') + '\n\n' +
|
||||||
|
chalk.gray('Query: ') + chalk.white(query) + '\n' +
|
||||||
|
chalk.gray('Detail Level: ') + chalk.cyan(detailLevel),
|
||||||
|
{
|
||||||
|
padding: { top: 1, bottom: 1, left: 2, right: 2 },
|
||||||
|
margin: { top: 1, bottom: 0 },
|
||||||
|
borderStyle: 'round',
|
||||||
|
borderColor: 'green'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
console.log(header);
|
||||||
|
|
||||||
|
// Process and highlight code blocks
|
||||||
|
const processedResult = processCodeBlocks(result);
|
||||||
|
|
||||||
|
// Main content in clean box
|
||||||
|
const contentBox = boxen(processedResult, {
|
||||||
|
padding: { top: 1, bottom: 1, left: 2, right: 2 },
|
||||||
|
margin: { top: 0, bottom: 1 },
|
||||||
|
borderStyle: 'single',
|
||||||
|
borderColor: 'gray'
|
||||||
|
});
|
||||||
|
console.log(contentBox);
|
||||||
|
|
||||||
|
console.log(chalk.green('✓ Research complete'));
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Code Block Enhancement
|
||||||
|
|
||||||
|
### **Syntax Highlighting Pattern**
|
||||||
|
```javascript
|
||||||
|
import { highlight } from 'cli-highlight';
|
||||||
|
|
||||||
|
function processCodeBlocks(text) {
|
||||||
|
return text.replace(/```(\w+)?\n([\s\S]*?)```/g, (match, language, code) => {
|
||||||
|
try {
|
||||||
|
const highlighted = highlight(code.trim(), {
|
||||||
|
language: language || 'javascript',
|
||||||
|
theme: 'default'
|
||||||
|
});
|
||||||
|
return `\n${highlighted}\n`;
|
||||||
|
} catch (error) {
|
||||||
|
return `\n${code.trim()}\n`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Integration Guidelines
|
||||||
|
|
||||||
|
### **When to Use Context Gathering**
|
||||||
|
- ✅ **DO**: Use for AI-powered commands that benefit from project context
|
||||||
|
- ✅ **DO**: Use when users might want to reference specific tasks or files
|
||||||
|
- ✅ **DO**: Use for research, analysis, or generation commands
|
||||||
|
- ❌ **DON'T**: Use for simple CRUD operations that don't need AI context
|
||||||
|
|
||||||
|
### **Performance Considerations**
|
||||||
|
- ✅ **DO**: Set reasonable file size limits (50KB default)
|
||||||
|
- ✅ **DO**: Limit project tree depth (3-5 levels)
|
||||||
|
- ✅ **DO**: Provide token counts to help users understand context size
|
||||||
|
- ✅ **DO**: Allow users to control what context is included
|
||||||
|
|
||||||
|
### **Error Handling**
|
||||||
|
- ✅ **DO**: Gracefully handle missing files with warnings
|
||||||
|
- ✅ **DO**: Validate task IDs and provide helpful error messages
|
||||||
|
- ✅ **DO**: Continue processing even if some context sources fail
|
||||||
|
- ✅ **DO**: Provide fallback behavior when context gathering fails
|
||||||
|
|
||||||
|
### **Future Command Integration**
|
||||||
|
Commands that should consider adopting this pattern:
|
||||||
|
- `analyze-complexity` - Could benefit from file context
|
||||||
|
- `expand-task` - Could use related task context
|
||||||
|
- `update-task` - Could reference similar tasks for consistency
|
||||||
|
- `add-task` - Could use project context for better task generation
|
||||||
|
|
||||||
|
## Export Patterns
|
||||||
|
|
||||||
|
### **Context Gatherer Module**
|
||||||
|
```javascript
|
||||||
|
export {
|
||||||
|
ContextGatherer,
|
||||||
|
createContextGatherer // Factory function
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Fuzzy Search Module**
|
||||||
|
```javascript
|
||||||
|
export {
|
||||||
|
FuzzyTaskSearch,
|
||||||
|
PURPOSE_CATEGORIES,
|
||||||
|
RELEVANCE_THRESHOLDS
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
This context gathering system provides a foundation for building more intelligent, context-aware commands that can leverage project knowledge to provide better AI-powered assistance.
|
||||||
@@ -1,345 +1,424 @@
|
|||||||
---
|
---
|
||||||
description: Guide for using meta-development script (scripts/dev.js) to manage task-driven development workflows
|
description: Guide for using Taskmaster to manage task-driven development workflows
|
||||||
globs: **/*
|
globs: **/*
|
||||||
alwaysApply: true
|
alwaysApply: true
|
||||||
---
|
---
|
||||||
|
|
||||||
- **Global CLI Commands**
|
# Taskmaster Development Workflow
|
||||||
- Task Master now provides a global CLI through the `task-master` command (See [`commands.mdc`](mdc:.cursor/rules/commands.mdc) for details)
|
|
||||||
- All functionality from `scripts/dev.js` is available through this interface
|
|
||||||
- Install globally with `npm install -g claude-task-master` or use locally via `npx`
|
|
||||||
- Use `task-master <command>` instead of `node scripts/dev.js <command>`
|
|
||||||
- Examples:
|
|
||||||
- `task-master list`
|
|
||||||
- `task-master next`
|
|
||||||
- `task-master expand --id=3`
|
|
||||||
- All commands accept the same options as their script equivalents
|
|
||||||
- The CLI (`task-master`) is the **primary** way for users to interact with the application.
|
|
||||||
|
|
||||||
- **Development Workflow Process**
|
This guide outlines the standard process for using Taskmaster to manage software development projects. It is written as a set of instructions for you, the AI agent.
|
||||||
- Start new projects by running `task-master init` or `node scripts/dev.js parse-prd --input=<prd-file.txt>` to generate initial tasks.json
|
|
||||||
- Begin coding sessions with `task-master list` to see current tasks, status, and IDs
|
|
||||||
- Analyze task complexity with `task-master analyze-complexity --research` before breaking down tasks
|
|
||||||
- Select tasks based on dependencies (all marked 'done'), priority level, and ID order
|
|
||||||
- Clarify tasks by checking task files in tasks/ directory or asking for user input
|
|
||||||
- View specific task details using `task-master show <id>` to understand implementation requirements
|
|
||||||
- Break down complex tasks using `task-master expand --id=<id>` with appropriate flags
|
|
||||||
- Clear existing subtasks if needed using `task-master clear-subtasks --id=<id>` before regenerating
|
|
||||||
- Implement code following task details, dependencies, and project standards
|
|
||||||
- Verify tasks according to test strategies before marking as complete
|
|
||||||
- Mark completed tasks with `task-master set-status --id=<id> --status=done`
|
|
||||||
- Update dependent tasks when implementation differs from original plan
|
|
||||||
- Generate task files with `task-master generate` after updating tasks.json
|
|
||||||
- Maintain valid dependency structure with `task-master fix-dependencies` when needed
|
|
||||||
- Respect dependency chains and task priorities when selecting work
|
|
||||||
- **MCP Server**: For integrations (like Cursor), interact via the MCP server which prefers direct function calls. Restart the MCP server if core logic in `scripts/modules` changes. See [`mcp.mdc`](mdc:.cursor/rules/mcp.mdc).
|
|
||||||
- Report progress regularly using the list command
|
|
||||||
|
|
||||||
- **Task Complexity Analysis**
|
- **Your Default Stance**: For most projects, the user can work directly within the `master` task context. Your initial actions should operate on this default context unless a clear pattern for multi-context work emerges.
|
||||||
- Run `node scripts/dev.js analyze-complexity --research` for comprehensive analysis
|
- **Your Goal**: Your role is to elevate the user's workflow by intelligently introducing advanced features like **Tagged Task Lists** when you detect the appropriate context. Do not force tags on the user; suggest them as a helpful solution to a specific need.
|
||||||
- Review complexity report in scripts/task-complexity-report.json
|
|
||||||
- Or use `node scripts/dev.js complexity-report` for a formatted, readable version of the report
|
|
||||||
- Focus on tasks with highest complexity scores (8-10) for detailed breakdown
|
|
||||||
- Use analysis results to determine appropriate subtask allocation
|
|
||||||
- Note that reports are automatically used by the expand command
|
|
||||||
|
|
||||||
- **Task Breakdown Process**
|
## The Basic Loop
|
||||||
- For tasks with complexity analysis, use `node scripts/dev.js expand --id=<id>`
|
The fundamental development cycle you will facilitate is:
|
||||||
- Otherwise use `node scripts/dev.js expand --id=<id> --subtasks=<number>`
|
1. **`list`**: Show the user what needs to be done.
|
||||||
- Add `--research` flag to leverage Perplexity AI for research-backed expansion
|
2. **`next`**: Help the user decide what to work on.
|
||||||
- Use `--prompt="<context>"` to provide additional context when needed
|
3. **`show <id>`**: Provide details for a specific task.
|
||||||
- Review and adjust generated subtasks as necessary
|
4. **`expand <id>`**: Break down a complex task into smaller, manageable subtasks.
|
||||||
- Use `--all` flag to expand multiple pending tasks at once
|
5. **Implement**: The user writes the code and tests.
|
||||||
- If subtasks need regeneration, clear them first with `clear-subtasks` command (See Command Reference below)
|
6. **`update-subtask`**: Log progress and findings on behalf of the user.
|
||||||
|
7. **`set-status`**: Mark tasks and subtasks as `done` as work is completed.
|
||||||
|
8. **Repeat**.
|
||||||
|
|
||||||
- **Implementation Drift Handling**
|
All your standard command executions should operate on the user's current task context, which defaults to `master`.
|
||||||
- When implementation differs significantly from planned approach
|
|
||||||
- When future tasks need modification due to current implementation choices
|
|
||||||
- When new dependencies or requirements emerge
|
|
||||||
- Call `node scripts/dev.js update --from=<futureTaskId> --prompt="<explanation>"` to update tasks.json
|
|
||||||
|
|
||||||
- **Task Status Management**
|
---
|
||||||
- Use 'pending' for tasks ready to be worked on
|
|
||||||
- Use 'done' for completed and verified tasks
|
|
||||||
- Use 'deferred' for postponed tasks
|
|
||||||
- Add custom status values as needed for project-specific workflows
|
|
||||||
|
|
||||||
- **Task File Format Reference**
|
## Standard Development Workflow Process
|
||||||
```
|
|
||||||
# Task ID: <id>
|
|
||||||
# Title: <title>
|
|
||||||
# Status: <status>
|
|
||||||
# Dependencies: <comma-separated list of dependency IDs>
|
|
||||||
# Priority: <priority>
|
|
||||||
# Description: <brief description>
|
|
||||||
# Details:
|
|
||||||
<detailed implementation notes>
|
|
||||||
|
|
||||||
# Test Strategy:
|
|
||||||
<verification approach>
|
|
||||||
```
|
|
||||||
|
|
||||||
- **Command Reference: parse-prd**
|
### Simple Workflow (Default Starting Point)
|
||||||
- CLI Syntax: `task-master parse-prd --input=<prd-file.txt>`
|
|
||||||
- Description: Parses a PRD document and generates a `tasks.json` file with structured tasks
|
|
||||||
- Parameters:
|
|
||||||
- `--input=<file>`: Path to the PRD text file (default: sample-prd.txt)
|
|
||||||
- Example: `task-master parse-prd --input=requirements.txt`
|
|
||||||
- Notes: Will overwrite existing tasks.json file. Use with caution.
|
|
||||||
|
|
||||||
- **Command Reference: update**
|
For new projects or when users are getting started, operate within the `master` tag context:
|
||||||
- CLI Syntax: `task-master update --from=<id> --prompt="<prompt>"`
|
|
||||||
- Description: Updates tasks with ID >= specified ID based on the provided prompt
|
|
||||||
- Parameters:
|
|
||||||
- `--from=<id>`: Task ID from which to start updating (required)
|
|
||||||
- `--prompt="<text>"`: Explanation of changes or new context (required)
|
|
||||||
- Example: `task-master update --from=4 --prompt="Now we are using Express instead of Fastify."`
|
|
||||||
- Notes: Only updates tasks not marked as 'done'. Completed tasks remain unchanged.
|
|
||||||
|
|
||||||
- **Command Reference: update-task**
|
- Start new projects by running `initialize_project` tool / `task-master init` or `parse_prd` / `task-master parse-prd --input='<prd-file.txt>'` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) to generate initial tasks.json with tagged structure
|
||||||
- CLI Syntax: `task-master update-task --id=<id> --prompt="<prompt>"`
|
- Configure rule sets during initialization with `--rules` flag (e.g., `task-master init --rules cursor,windsurf`) or manage them later with `task-master rules add/remove` commands
|
||||||
- Description: Updates a single task by ID with new information
|
- Begin coding sessions with `get_tasks` / `task-master list` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) to see current tasks, status, and IDs
|
||||||
- Parameters:
|
- Determine the next task to work on using `next_task` / `task-master next` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc))
|
||||||
- `--id=<id>`: ID of the task to update (required)
|
- Analyze task complexity with `analyze_project_complexity` / `task-master analyze-complexity --research` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) before breaking down tasks
|
||||||
- `--prompt="<text>"`: New information or context to update the task (required)
|
- Review complexity report using `complexity_report` / `task-master complexity-report` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc))
|
||||||
- `--research`: Use Perplexity AI for research-backed updates
|
- Select tasks based on dependencies (all marked 'done'), priority level, and ID order
|
||||||
- Example: `task-master update-task --id=5 --prompt="Use JWT for authentication instead of sessions."`
|
- View specific task details using `get_task` / `task-master show <id>` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) to understand implementation requirements
|
||||||
- Notes: Only updates tasks not marked as 'done'. Preserves completed subtasks.
|
- Break down complex tasks using `expand_task` / `task-master expand --id=<id> --force --research` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) with appropriate flags like `--force` (to replace existing subtasks) and `--research`
|
||||||
|
- Implement code following task details, dependencies, and project standards
|
||||||
|
- Mark completed tasks with `set_task_status` / `task-master set-status --id=<id> --status=done` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc))
|
||||||
|
- Update dependent tasks when implementation differs from original plan using `update` / `task-master update --from=<id> --prompt="..."` or `update_task` / `task-master update-task --id=<id> --prompt="..."` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc))
|
||||||
|
|
||||||
- **Command Reference: update-subtask**
|
---
|
||||||
- CLI Syntax: `task-master update-subtask --id=<id> --prompt="<prompt>"`
|
|
||||||
- Description: Appends additional information to a specific subtask without replacing existing content
|
|
||||||
- Parameters:
|
|
||||||
- `--id=<id>`: ID of the subtask to update in format "parentId.subtaskId" (required)
|
|
||||||
- `--prompt="<text>"`: Information to add to the subtask (required)
|
|
||||||
- `--research`: Use Perplexity AI for research-backed updates
|
|
||||||
- Example: `task-master update-subtask --id=5.2 --prompt="Add details about API rate limiting."`
|
|
||||||
- Notes:
|
|
||||||
- Appends new information to subtask details with timestamp
|
|
||||||
- Does not replace existing content, only adds to it
|
|
||||||
- Uses XML-like tags to clearly mark added information
|
|
||||||
- Will not update subtasks marked as 'done' or 'completed'
|
|
||||||
|
|
||||||
- **Command Reference: generate**
|
## Leveling Up: Agent-Led Multi-Context Workflows
|
||||||
- CLI Syntax: `task-master generate`
|
|
||||||
- Description: Generates individual task files in tasks/ directory based on tasks.json
|
|
||||||
- Parameters:
|
|
||||||
- `--file=<path>, -f`: Use alternative tasks.json file (default: 'tasks/tasks.json')
|
|
||||||
- `--output=<dir>, -o`: Output directory (default: 'tasks')
|
|
||||||
- Example: `task-master generate`
|
|
||||||
- Notes: Overwrites existing task files. Creates tasks/ directory if needed.
|
|
||||||
|
|
||||||
- **Command Reference: set-status**
|
While the basic workflow is powerful, your primary opportunity to add value is by identifying when to introduce **Tagged Task Lists**. These patterns are your tools for creating a more organized and efficient development environment for the user, especially if you detect agentic or parallel development happening across the same session.
|
||||||
- CLI Syntax: `task-master set-status --id=<id> --status=<status>`
|
|
||||||
- Description: Updates the status of a specific task in tasks.json
|
|
||||||
- Parameters:
|
|
||||||
- `--id=<id>`: ID of the task to update (required)
|
|
||||||
- `--status=<status>`: New status value (required)
|
|
||||||
- Example: `task-master set-status --id=3 --status=done`
|
|
||||||
- Notes: Common values are 'done', 'pending', and 'deferred', but any string is accepted.
|
|
||||||
|
|
||||||
- **Command Reference: list**
|
**Critical Principle**: Most users should never see a difference in their experience. Only introduce advanced workflows when you detect clear indicators that the project has evolved beyond simple task management.
|
||||||
- CLI Syntax: `task-master list`
|
|
||||||
- Description: Lists all tasks in tasks.json with IDs, titles, and status
|
|
||||||
- Parameters:
|
|
||||||
- `--status=<status>, -s`: Filter by status
|
|
||||||
- `--with-subtasks`: Show subtasks for each task
|
|
||||||
- `--file=<path>, -f`: Use alternative tasks.json file (default: 'tasks/tasks.json')
|
|
||||||
- Example: `task-master list`
|
|
||||||
- Notes: Provides quick overview of project progress. Use at start of sessions.
|
|
||||||
|
|
||||||
- **Command Reference: expand**
|
### When to Introduce Tags: Your Decision Patterns
|
||||||
- CLI Syntax: `task-master expand --id=<id> [--num=<number>] [--research] [--prompt="<context>"]`
|
|
||||||
- Description: Expands a task with subtasks for detailed implementation
|
|
||||||
- Parameters:
|
|
||||||
- `--id=<id>`: ID of task to expand (required unless using --all)
|
|
||||||
- `--all`: Expand all pending tasks, prioritized by complexity
|
|
||||||
- `--num=<number>`: Number of subtasks to generate (default: from complexity report)
|
|
||||||
- `--research`: Use Perplexity AI for research-backed generation
|
|
||||||
- `--prompt="<text>"`: Additional context for subtask generation
|
|
||||||
- `--force`: Regenerate subtasks even for tasks that already have them
|
|
||||||
- Example: `task-master expand --id=3 --num=5 --research --prompt="Focus on security aspects"`
|
|
||||||
- Notes: Uses complexity report recommendations if available.
|
|
||||||
|
|
||||||
- **Command Reference: analyze-complexity**
|
Here are the patterns to look for. When you detect one, you should propose the corresponding workflow to the user.
|
||||||
- CLI Syntax: `task-master analyze-complexity [options]`
|
|
||||||
- Description: Analyzes task complexity and generates expansion recommendations
|
|
||||||
- Parameters:
|
|
||||||
- `--output=<file>, -o`: Output file path (default: scripts/task-complexity-report.json)
|
|
||||||
- `--model=<model>, -m`: Override LLM model to use
|
|
||||||
- `--threshold=<number>, -t`: Minimum score for expansion recommendation (default: 5)
|
|
||||||
- `--file=<path>, -f`: Use alternative tasks.json file
|
|
||||||
- `--research, -r`: Use Perplexity AI for research-backed analysis
|
|
||||||
- Example: `task-master analyze-complexity --research`
|
|
||||||
- Notes: Report includes complexity scores, recommended subtasks, and tailored prompts.
|
|
||||||
|
|
||||||
- **Command Reference: clear-subtasks**
|
#### Pattern 1: Simple Git Feature Branching
|
||||||
- CLI Syntax: `task-master clear-subtasks --id=<id>`
|
This is the most common and direct use case for tags.
|
||||||
- Description: Removes subtasks from specified tasks to allow regeneration
|
|
||||||
- Parameters:
|
|
||||||
- `--id=<id>`: ID or comma-separated IDs of tasks to clear subtasks from
|
|
||||||
- `--all`: Clear subtasks from all tasks
|
|
||||||
- Examples:
|
|
||||||
- `task-master clear-subtasks --id=3`
|
|
||||||
- `task-master clear-subtasks --id=1,2,3`
|
|
||||||
- `task-master clear-subtasks --all`
|
|
||||||
- Notes:
|
|
||||||
- Task files are automatically regenerated after clearing subtasks
|
|
||||||
- Can be combined with expand command to immediately generate new subtasks
|
|
||||||
- Works with both parent tasks and individual subtasks
|
|
||||||
|
|
||||||
- **Task Structure Fields**
|
- **Trigger**: The user creates a new git branch (e.g., `git checkout -b feature/user-auth`).
|
||||||
- **id**: Unique identifier for the task (Example: `1`)
|
- **Your Action**: Propose creating a new tag that mirrors the branch name to isolate the feature's tasks from `master`.
|
||||||
- **title**: Brief, descriptive title (Example: `"Initialize Repo"`)
|
- **Your Suggested Prompt**: *"I see you've created a new branch named 'feature/user-auth'. To keep all related tasks neatly organized and separate from your main list, I can create a corresponding task tag for you. This helps prevent merge conflicts in your `tasks.json` file later. Shall I create the 'feature-user-auth' tag?"*
|
||||||
- **description**: Concise summary of what the task involves (Example: `"Create a new repository, set up initial structure."`)
|
- **Tool to Use**: `task-master add-tag --from-branch`
|
||||||
- **status**: Current state of the task (Example: `"pending"`, `"done"`, `"deferred"`)
|
|
||||||
- **dependencies**: IDs of prerequisite tasks (Example: `[1, 2]`)
|
#### Pattern 2: Team Collaboration
|
||||||
|
- **Trigger**: The user mentions working with teammates (e.g., "My teammate Alice is handling the database schema," or "I need to review Bob's work on the API.").
|
||||||
|
- **Your Action**: Suggest creating a separate tag for the user's work to prevent conflicts with shared master context.
|
||||||
|
- **Your Suggested Prompt**: *"Since you're working with Alice, I can create a separate task context for your work to avoid conflicts. This way, Alice can continue working with the master list while you have your own isolated context. When you're ready to merge your work, we can coordinate the tasks back to master. Shall I create a tag for your current work?"*
|
||||||
|
- **Tool to Use**: `task-master add-tag my-work --copy-from-current --description="My tasks while collaborating with Alice"`
|
||||||
|
|
||||||
|
#### Pattern 3: Experiments or Risky Refactors
|
||||||
|
- **Trigger**: The user wants to try something that might not be kept (e.g., "I want to experiment with switching our state management library," or "Let's refactor the old API module, but I want to keep the current tasks as a reference.").
|
||||||
|
- **Your Action**: Propose creating a sandboxed tag for the experimental work.
|
||||||
|
- **Your Suggested Prompt**: *"This sounds like a great experiment. To keep these new tasks separate from our main plan, I can create a temporary 'experiment-zustand' tag for this work. If we decide not to proceed, we can simply delete the tag without affecting the main task list. Sound good?"*
|
||||||
|
- **Tool to Use**: `task-master add-tag experiment-zustand --description="Exploring Zustand migration"`
|
||||||
|
|
||||||
|
#### Pattern 4: Large Feature Initiatives (PRD-Driven)
|
||||||
|
This is a more structured approach for significant new features or epics.
|
||||||
|
|
||||||
|
- **Trigger**: The user describes a large, multi-step feature that would benefit from a formal plan.
|
||||||
|
- **Your Action**: Propose a comprehensive, PRD-driven workflow.
|
||||||
|
- **Your Suggested Prompt**: *"This sounds like a significant new feature. To manage this effectively, I suggest we create a dedicated task context for it. Here's the plan: I'll create a new tag called 'feature-xyz', then we can draft a Product Requirements Document (PRD) together to scope the work. Once the PRD is ready, I'll automatically generate all the necessary tasks within that new tag. How does that sound?"*
|
||||||
|
- **Your Implementation Flow**:
|
||||||
|
1. **Create an empty tag**: `task-master add-tag feature-xyz --description "Tasks for the new XYZ feature"`. You can also start by creating a git branch if applicable, and then create the tag from that branch.
|
||||||
|
2. **Collaborate & Create PRD**: Work with the user to create a detailed PRD file (e.g., `.taskmaster/docs/feature-xyz-prd.txt`).
|
||||||
|
3. **Parse PRD into the new tag**: `task-master parse-prd .taskmaster/docs/feature-xyz-prd.txt --tag feature-xyz`
|
||||||
|
4. **Prepare the new task list**: Follow up by suggesting `analyze-complexity` and `expand-all` for the newly created tasks within the `feature-xyz` tag.
|
||||||
|
|
||||||
|
#### Pattern 5: Version-Based Development
|
||||||
|
Tailor your approach based on the project maturity indicated by tag names.
|
||||||
|
|
||||||
|
- **Prototype/MVP Tags** (`prototype`, `mvp`, `poc`, `v0.x`):
|
||||||
|
- **Your Approach**: Focus on speed and functionality over perfection
|
||||||
|
- **Task Generation**: Create tasks that emphasize "get it working" over "get it perfect"
|
||||||
|
- **Complexity Level**: Lower complexity, fewer subtasks, more direct implementation paths
|
||||||
|
- **Research Prompts**: Include context like "This is a prototype - prioritize speed and basic functionality over optimization"
|
||||||
|
- **Example Prompt Addition**: *"Since this is for the MVP, I'll focus on tasks that get core functionality working quickly rather than over-engineering."*
|
||||||
|
|
||||||
|
- **Production/Mature Tags** (`v1.0+`, `production`, `stable`):
|
||||||
|
- **Your Approach**: Emphasize robustness, testing, and maintainability
|
||||||
|
- **Task Generation**: Include comprehensive error handling, testing, documentation, and optimization
|
||||||
|
- **Complexity Level**: Higher complexity, more detailed subtasks, thorough implementation paths
|
||||||
|
- **Research Prompts**: Include context like "This is for production - prioritize reliability, performance, and maintainability"
|
||||||
|
- **Example Prompt Addition**: *"Since this is for production, I'll ensure tasks include proper error handling, testing, and documentation."*
|
||||||
|
|
||||||
|
### Advanced Workflow (Tag-Based & PRD-Driven)
|
||||||
|
|
||||||
|
**When to Transition**: Recognize when the project has evolved (or has initiated a project which existing code) beyond simple task management. Look for these indicators:
|
||||||
|
- User mentions teammates or collaboration needs
|
||||||
|
- Project has grown to 15+ tasks with mixed priorities
|
||||||
|
- User creates feature branches or mentions major initiatives
|
||||||
|
- User initializes Taskmaster on an existing, complex codebase
|
||||||
|
- User describes large features that would benefit from dedicated planning
|
||||||
|
|
||||||
|
**Your Role in Transition**: Guide the user to a more sophisticated workflow that leverages tags for organization and PRDs for comprehensive planning.
|
||||||
|
|
||||||
|
#### Master List Strategy (High-Value Focus)
|
||||||
|
Once you transition to tag-based workflows, the `master` tag should ideally contain only:
|
||||||
|
- **High-level deliverables** that provide significant business value
|
||||||
|
- **Major milestones** and epic-level features
|
||||||
|
- **Critical infrastructure** work that affects the entire project
|
||||||
|
- **Release-blocking** items
|
||||||
|
|
||||||
|
**What NOT to put in master**:
|
||||||
|
- Detailed implementation subtasks (these go in feature-specific tags' parent tasks)
|
||||||
|
- Refactoring work (create dedicated tags like `refactor-auth`)
|
||||||
|
- Experimental features (use `experiment-*` tags)
|
||||||
|
- Team member-specific tasks (use person-specific tags)
|
||||||
|
|
||||||
|
#### PRD-Driven Feature Development
|
||||||
|
|
||||||
|
**For New Major Features**:
|
||||||
|
1. **Identify the Initiative**: When user describes a significant feature
|
||||||
|
2. **Create Dedicated Tag**: `add_tag feature-[name] --description="[Feature description]"`
|
||||||
|
3. **Collaborative PRD Creation**: Work with user to create comprehensive PRD in `.taskmaster/docs/feature-[name]-prd.txt`
|
||||||
|
4. **Parse & Prepare**:
|
||||||
|
- `parse_prd .taskmaster/docs/feature-[name]-prd.txt --tag=feature-[name]`
|
||||||
|
- `analyze_project_complexity --tag=feature-[name] --research`
|
||||||
|
- `expand_all --tag=feature-[name] --research`
|
||||||
|
5. **Add Master Reference**: Create a high-level task in `master` that references the feature tag
|
||||||
|
|
||||||
|
**For Existing Codebase Analysis**:
|
||||||
|
When users initialize Taskmaster on existing projects:
|
||||||
|
1. **Codebase Discovery**: Use your native tools for producing deep context about the code base. You may use `research` tool with `--tree` and `--files` to collect up to date information using the existing architecture as context.
|
||||||
|
2. **Collaborative Assessment**: Work with user to identify improvement areas, technical debt, or new features
|
||||||
|
3. **Strategic PRD Creation**: Co-author PRDs that include:
|
||||||
|
- Current state analysis (based on your codebase research)
|
||||||
|
- Proposed improvements or new features
|
||||||
|
- Implementation strategy considering existing code
|
||||||
|
4. **Tag-Based Organization**: Parse PRDs into appropriate tags (`refactor-api`, `feature-dashboard`, `tech-debt`, etc.)
|
||||||
|
5. **Master List Curation**: Keep only the most valuable initiatives in master
|
||||||
|
|
||||||
|
The parse-prd's `--append` flag enables the user to parse multple PRDs within tags or across tags. PRDs should be focused and the number of tasks they are parsed into should be strategically chosen relative to the PRD's complexity and level of detail.
|
||||||
|
|
||||||
|
### Workflow Transition Examples
|
||||||
|
|
||||||
|
**Example 1: Simple → Team-Based**
|
||||||
|
```
|
||||||
|
User: "Alice is going to help with the API work"
|
||||||
|
Your Response: "Great! To avoid conflicts, I'll create a separate task context for your work. Alice can continue with the master list while you work in your own context. When you're ready to merge, we can coordinate the tasks back together."
|
||||||
|
Action: add_tag my-api-work --copy-from-current --description="My API tasks while collaborating with Alice"
|
||||||
|
```
|
||||||
|
|
||||||
|
**Example 2: Simple → PRD-Driven**
|
||||||
|
```
|
||||||
|
User: "I want to add a complete user dashboard with analytics, user management, and reporting"
|
||||||
|
Your Response: "This sounds like a major feature that would benefit from detailed planning. Let me create a dedicated context for this work and we can draft a PRD together to ensure we capture all requirements."
|
||||||
|
Actions:
|
||||||
|
1. add_tag feature-dashboard --description="User dashboard with analytics and management"
|
||||||
|
2. Collaborate on PRD creation
|
||||||
|
3. parse_prd dashboard-prd.txt --tag=feature-dashboard
|
||||||
|
4. Add high-level "User Dashboard" task to master
|
||||||
|
```
|
||||||
|
|
||||||
|
**Example 3: Existing Project → Strategic Planning**
|
||||||
|
```
|
||||||
|
User: "I just initialized Taskmaster on my existing React app. It's getting messy and I want to improve it."
|
||||||
|
Your Response: "Let me research your codebase to understand the current architecture, then we can create a strategic plan for improvements."
|
||||||
|
Actions:
|
||||||
|
1. research "Current React app architecture and improvement opportunities" --tree --files=src/
|
||||||
|
2. Collaborate on improvement PRD based on findings
|
||||||
|
3. Create tags for different improvement areas (refactor-components, improve-state-management, etc.)
|
||||||
|
4. Keep only major improvement initiatives in master
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Primary Interaction: MCP Server vs. CLI
|
||||||
|
|
||||||
|
Taskmaster offers two primary ways to interact:
|
||||||
|
|
||||||
|
1. **MCP Server (Recommended for Integrated Tools)**:
|
||||||
|
- For AI agents and integrated development environments (like Cursor), interacting via the **MCP server is the preferred method**.
|
||||||
|
- The MCP server exposes Taskmaster functionality through a set of tools (e.g., `get_tasks`, `add_subtask`).
|
||||||
|
- This method offers better performance, structured data exchange, and richer error handling compared to CLI parsing.
|
||||||
|
- Refer to [`mcp.mdc`](mdc:.cursor/rules/mcp.mdc) for details on the MCP architecture and available tools.
|
||||||
|
- A comprehensive list and description of MCP tools and their corresponding CLI commands can be found in [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc).
|
||||||
|
- **Restart the MCP server** if core logic in `scripts/modules` or MCP tool/direct function definitions change.
|
||||||
|
- **Note**: MCP tools fully support tagged task lists with complete tag management capabilities.
|
||||||
|
|
||||||
|
2. **`task-master` CLI (For Users & Fallback)**:
|
||||||
|
- The global `task-master` command provides a user-friendly interface for direct terminal interaction.
|
||||||
|
- It can also serve as a fallback if the MCP server is inaccessible or a specific function isn't exposed via MCP.
|
||||||
|
- Install globally with `npm install -g task-master-ai` or use locally via `npx task-master-ai ...`.
|
||||||
|
- The CLI commands often mirror the MCP tools (e.g., `task-master list` corresponds to `get_tasks`).
|
||||||
|
- Refer to [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc) for a detailed command reference.
|
||||||
|
- **Tagged Task Lists**: CLI fully supports the new tagged system with seamless migration.
|
||||||
|
|
||||||
|
## How the Tag System Works (For Your Reference)
|
||||||
|
|
||||||
|
- **Data Structure**: Tasks are organized into separate contexts (tags) like "master", "feature-branch", or "v2.0".
|
||||||
|
- **Silent Migration**: Existing projects automatically migrate to use a "master" tag with zero disruption.
|
||||||
|
- **Context Isolation**: Tasks in different tags are completely separate. Changes in one tag do not affect any other tag.
|
||||||
|
- **Manual Control**: The user is always in control. There is no automatic switching. You facilitate switching by using `use-tag <name>`.
|
||||||
|
- **Full CLI & MCP Support**: All tag management commands are available through both the CLI and MCP tools for you to use. Refer to [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc) for a full command list.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Task Complexity Analysis
|
||||||
|
|
||||||
|
- Run `analyze_project_complexity` / `task-master analyze-complexity --research` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) for comprehensive analysis
|
||||||
|
- Review complexity report via `complexity_report` / `task-master complexity-report` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) for a formatted, readable version.
|
||||||
|
- Focus on tasks with highest complexity scores (8-10) for detailed breakdown
|
||||||
|
- Use analysis results to determine appropriate subtask allocation
|
||||||
|
- Note that reports are automatically used by the `expand_task` tool/command
|
||||||
|
|
||||||
|
## Task Breakdown Process
|
||||||
|
|
||||||
|
- Use `expand_task` / `task-master expand --id=<id>`. It automatically uses the complexity report if found, otherwise generates default number of subtasks.
|
||||||
|
- Use `--num=<number>` to specify an explicit number of subtasks, overriding defaults or complexity report recommendations.
|
||||||
|
- Add `--research` flag to leverage Perplexity AI for research-backed expansion.
|
||||||
|
- Add `--force` flag to clear existing subtasks before generating new ones (default is to append).
|
||||||
|
- Use `--prompt="<context>"` to provide additional context when needed.
|
||||||
|
- Review and adjust generated subtasks as necessary.
|
||||||
|
- Use `expand_all` tool or `task-master expand --all` to expand multiple pending tasks at once, respecting flags like `--force` and `--research`.
|
||||||
|
- If subtasks need complete replacement (regardless of the `--force` flag on `expand`), clear them first with `clear_subtasks` / `task-master clear-subtasks --id=<id>`.
|
||||||
|
|
||||||
|
## Implementation Drift Handling
|
||||||
|
|
||||||
|
- When implementation differs significantly from planned approach
|
||||||
|
- When future tasks need modification due to current implementation choices
|
||||||
|
- When new dependencies or requirements emerge
|
||||||
|
- Use `update` / `task-master update --from=<futureTaskId> --prompt='<explanation>\nUpdate context...' --research` to update multiple future tasks.
|
||||||
|
- Use `update_task` / `task-master update-task --id=<taskId> --prompt='<explanation>\nUpdate context...' --research` to update a single specific task.
|
||||||
|
|
||||||
|
## Task Status Management
|
||||||
|
|
||||||
|
- Use 'pending' for tasks ready to be worked on
|
||||||
|
- Use 'done' for completed and verified tasks
|
||||||
|
- Use 'deferred' for postponed tasks
|
||||||
|
- Add custom status values as needed for project-specific workflows
|
||||||
|
|
||||||
|
## Task Structure Fields
|
||||||
|
|
||||||
|
- **id**: Unique identifier for the task (Example: `1`, `1.1`)
|
||||||
|
- **title**: Brief, descriptive title (Example: `"Initialize Repo"`)
|
||||||
|
- **description**: Concise summary of what the task involves (Example: `"Create a new repository, set up initial structure."`)
|
||||||
|
- **status**: Current state of the task (Example: `"pending"`, `"done"`, `"deferred"`)
|
||||||
|
- **dependencies**: IDs of prerequisite tasks (Example: `[1, 2.1]`)
|
||||||
- Dependencies are displayed with status indicators (✅ for completed, ⏱️ for pending)
|
- Dependencies are displayed with status indicators (✅ for completed, ⏱️ for pending)
|
||||||
- This helps quickly identify which prerequisite tasks are blocking work
|
- This helps quickly identify which prerequisite tasks are blocking work
|
||||||
- **priority**: Importance level (Example: `"high"`, `"medium"`, `"low"`)
|
- **priority**: Importance level (Example: `"high"`, `"medium"`, `"low"`)
|
||||||
- **details**: In-depth implementation instructions (Example: `"Use GitHub client ID/secret, handle callback, set session token."`)
|
- **details**: In-depth implementation instructions (Example: `"Use GitHub client ID/secret, handle callback, set session token."`)
|
||||||
- **testStrategy**: Verification approach (Example: `"Deploy and call endpoint to confirm 'Hello World' response."`)
|
- **testStrategy**: Verification approach (Example: `"Deploy and call endpoint to confirm 'Hello World' response."`)
|
||||||
- **subtasks**: List of smaller, more specific tasks (Example: `[{"id": 1, "title": "Configure OAuth", ...}]`)
|
- **subtasks**: List of smaller, more specific tasks (Example: `[{"id": 1, "title": "Configure OAuth", ...}]`)
|
||||||
|
- Refer to task structure details (previously linked to `tasks.mdc`).
|
||||||
|
|
||||||
- **Environment Variables Configuration**
|
## Configuration Management (Updated)
|
||||||
- **ANTHROPIC_API_KEY** (Required): Your Anthropic API key for Claude (Example: `ANTHROPIC_API_KEY=sk-ant-api03-...`)
|
|
||||||
- **MODEL** (Default: `"claude-3-7-sonnet-20250219"`): Claude model to use (Example: `MODEL=claude-3-opus-20240229`)
|
|
||||||
- **MAX_TOKENS** (Default: `"4000"`): Maximum tokens for responses (Example: `MAX_TOKENS=8000`)
|
|
||||||
- **TEMPERATURE** (Default: `"0.7"`): Temperature for model responses (Example: `TEMPERATURE=0.5`)
|
|
||||||
- **DEBUG** (Default: `"false"`): Enable debug logging (Example: `DEBUG=true`)
|
|
||||||
- **LOG_LEVEL** (Default: `"info"`): Console output level (Example: `LOG_LEVEL=debug`)
|
|
||||||
- **DEFAULT_SUBTASKS** (Default: `"3"`): Default subtask count (Example: `DEFAULT_SUBTASKS=5`)
|
|
||||||
- **DEFAULT_PRIORITY** (Default: `"medium"`): Default priority (Example: `DEFAULT_PRIORITY=high`)
|
|
||||||
- **PROJECT_NAME** (Default: `"MCP SaaS MVP"`): Project name in metadata (Example: `PROJECT_NAME=My Awesome Project`)
|
|
||||||
- **PROJECT_VERSION** (Default: `"1.0.0"`): Version in metadata (Example: `PROJECT_VERSION=2.1.0`)
|
|
||||||
- **PERPLEXITY_API_KEY**: For research-backed features (Example: `PERPLEXITY_API_KEY=pplx-...`)
|
|
||||||
- **PERPLEXITY_MODEL** (Default: `"sonar-medium-online"`): Perplexity model (Example: `PERPLEXITY_MODEL=sonar-large-online`)
|
|
||||||
|
|
||||||
- **Determining the Next Task**
|
Taskmaster configuration is managed through two main mechanisms:
|
||||||
- Run `task-master next` to show the next task to work on
|
|
||||||
- The next command identifies tasks with all dependencies satisfied
|
1. **`.taskmaster/config.json` File (Primary):**
|
||||||
- Tasks are prioritized by priority level, dependency count, and ID
|
* Located in the project root directory.
|
||||||
- The command shows comprehensive task information including:
|
* Stores most configuration settings: AI model selections (main, research, fallback), parameters (max tokens, temperature), logging level, default subtasks/priority, project name, etc.
|
||||||
|
* **Tagged System Settings**: Includes `global.defaultTag` (defaults to "master") and `tags` section for tag management configuration.
|
||||||
|
* **Managed via `task-master models --setup` command.** Do not edit manually unless you know what you are doing.
|
||||||
|
* **View/Set specific models via `task-master models` command or `models` MCP tool.**
|
||||||
|
* Created automatically when you run `task-master models --setup` for the first time or during tagged system migration.
|
||||||
|
|
||||||
|
2. **Environment Variables (`.env` / `mcp.json`):**
|
||||||
|
* Used **only** for sensitive API keys and specific endpoint URLs.
|
||||||
|
* Place API keys (one per provider) in a `.env` file in the project root for CLI usage.
|
||||||
|
* For MCP/Cursor integration, configure these keys in the `env` section of `.cursor/mcp.json`.
|
||||||
|
* Available keys/variables: See `assets/env.example` or the Configuration section in the command reference (previously linked to `taskmaster.mdc`).
|
||||||
|
|
||||||
|
3. **`.taskmaster/state.json` File (Tagged System State):**
|
||||||
|
* Tracks current tag context and migration status.
|
||||||
|
* Automatically created during tagged system migration.
|
||||||
|
* Contains: `currentTag`, `lastSwitched`, `migrationNoticeShown`.
|
||||||
|
|
||||||
|
**Important:** Non-API key settings (like model selections, `MAX_TOKENS`, `TASKMASTER_LOG_LEVEL`) are **no longer configured via environment variables**. Use the `task-master models` command (or `--setup` for interactive configuration) or the `models` MCP tool.
|
||||||
|
**If AI commands FAIL in MCP** verify that the API key for the selected provider is present in the `env` section of `.cursor/mcp.json`.
|
||||||
|
**If AI commands FAIL in CLI** verify that the API key for the selected provider is present in the `.env` file in the root of the project.
|
||||||
|
|
||||||
|
## Rules Management
|
||||||
|
|
||||||
|
Taskmaster supports multiple AI coding assistant rule sets that can be configured during project initialization or managed afterward:
|
||||||
|
|
||||||
|
- **Available Profiles**: Claude Code, Cline, Codex, Cursor, Roo Code, Trae, Windsurf (claude, cline, codex, cursor, roo, trae, windsurf)
|
||||||
|
- **During Initialization**: Use `task-master init --rules cursor,windsurf` to specify which rule sets to include
|
||||||
|
- **After Initialization**: Use `task-master rules add <profiles>` or `task-master rules remove <profiles>` to manage rule sets
|
||||||
|
- **Interactive Setup**: Use `task-master rules setup` to launch an interactive prompt for selecting rule profiles
|
||||||
|
- **Default Behavior**: If no `--rules` flag is specified during initialization, all available rule profiles are included
|
||||||
|
- **Rule Structure**: Each profile creates its own directory (e.g., `.cursor/rules`, `.roo/rules`) with appropriate configuration files
|
||||||
|
|
||||||
|
## Determining the Next Task
|
||||||
|
|
||||||
|
- Run `next_task` / `task-master next` to show the next task to work on.
|
||||||
|
- The command identifies tasks with all dependencies satisfied
|
||||||
|
- Tasks are prioritized by priority level, dependency count, and ID
|
||||||
|
- The command shows comprehensive task information including:
|
||||||
- Basic task details and description
|
- Basic task details and description
|
||||||
- Implementation details
|
- Implementation details
|
||||||
- Subtasks (if they exist)
|
- Subtasks (if they exist)
|
||||||
- Contextual suggested actions
|
- Contextual suggested actions
|
||||||
- Recommended before starting any new development work
|
- Recommended before starting any new development work
|
||||||
- Respects your project's dependency structure
|
- Respects your project's dependency structure
|
||||||
- Ensures tasks are completed in the appropriate sequence
|
- Ensures tasks are completed in the appropriate sequence
|
||||||
- Provides ready-to-use commands for common task actions
|
- Provides ready-to-use commands for common task actions
|
||||||
|
|
||||||
- **Viewing Specific Task Details**
|
## Viewing Specific Task Details
|
||||||
- Run `task-master show <id>` or `task-master show --id=<id>` to view a specific task
|
|
||||||
- Use dot notation for subtasks: `task-master show 1.2` (shows subtask 2 of task 1)
|
|
||||||
- Displays comprehensive information similar to the next command, but for a specific task
|
|
||||||
- For parent tasks, shows all subtasks and their current status
|
|
||||||
- For subtasks, shows parent task information and relationship
|
|
||||||
- Provides contextual suggested actions appropriate for the specific task
|
|
||||||
- Useful for examining task details before implementation or checking status
|
|
||||||
|
|
||||||
- **Managing Task Dependencies**
|
- Run `get_task` / `task-master show <id>` to view a specific task.
|
||||||
- Use `task-master add-dependency --id=<id> --depends-on=<id>` to add a dependency
|
- Use dot notation for subtasks: `task-master show 1.2` (shows subtask 2 of task 1)
|
||||||
- Use `task-master remove-dependency --id=<id> --depends-on=<id>` to remove a dependency
|
- Displays comprehensive information similar to the next command, but for a specific task
|
||||||
- The system prevents circular dependencies and duplicate dependency entries
|
- For parent tasks, shows all subtasks and their current status
|
||||||
- Dependencies are checked for existence before being added or removed
|
- For subtasks, shows parent task information and relationship
|
||||||
- Task files are automatically regenerated after dependency changes
|
- Provides contextual suggested actions appropriate for the specific task
|
||||||
- Dependencies are visualized with status indicators in task listings and files
|
- Useful for examining task details before implementation or checking status
|
||||||
|
|
||||||
- **Command Reference: add-dependency**
|
## Managing Task Dependencies
|
||||||
- CLI Syntax: `task-master add-dependency --id=<id> --depends-on=<id>`
|
|
||||||
- Description: Adds a dependency relationship between two tasks
|
|
||||||
- Parameters:
|
|
||||||
- `--id=<id>`: ID of task that will depend on another task (required)
|
|
||||||
- `--depends-on=<id>`: ID of task that will become a dependency (required)
|
|
||||||
- Example: `task-master add-dependency --id=22 --depends-on=21`
|
|
||||||
- Notes: Prevents circular dependencies and duplicates; updates task files automatically
|
|
||||||
|
|
||||||
- **Command Reference: remove-dependency**
|
- Use `add_dependency` / `task-master add-dependency --id=<id> --depends-on=<id>` to add a dependency.
|
||||||
- CLI Syntax: `task-master remove-dependency --id=<id> --depends-on=<id>`
|
- Use `remove_dependency` / `task-master remove-dependency --id=<id> --depends-on=<id>` to remove a dependency.
|
||||||
- Description: Removes a dependency relationship between two tasks
|
- The system prevents circular dependencies and duplicate dependency entries
|
||||||
- Parameters:
|
- Dependencies are checked for existence before being added or removed
|
||||||
- `--id=<id>`: ID of task to remove dependency from (required)
|
- Task files are automatically regenerated after dependency changes
|
||||||
- `--depends-on=<id>`: ID of task to remove as a dependency (required)
|
- Dependencies are visualized with status indicators in task listings and files
|
||||||
- Example: `task-master remove-dependency --id=22 --depends-on=21`
|
|
||||||
- Notes: Checks if dependency actually exists; updates task files automatically
|
|
||||||
|
|
||||||
- **Command Reference: validate-dependencies**
|
## Task Reorganization
|
||||||
- CLI Syntax: `task-master validate-dependencies [options]`
|
|
||||||
- Description: Checks for and identifies invalid dependencies in tasks.json and task files
|
|
||||||
- Parameters:
|
|
||||||
- `--file=<path>, -f`: Use alternative tasks.json file (default: 'tasks/tasks.json')
|
|
||||||
- Example: `task-master validate-dependencies`
|
|
||||||
- Notes:
|
|
||||||
- Reports all non-existent dependencies and self-dependencies without modifying files
|
|
||||||
- Provides detailed statistics on task dependency state
|
|
||||||
- Use before fix-dependencies to audit your task structure
|
|
||||||
|
|
||||||
- **Command Reference: fix-dependencies**
|
- Use `move_task` / `task-master move --from=<id> --to=<id>` to move tasks or subtasks within the hierarchy
|
||||||
- CLI Syntax: `task-master fix-dependencies [options]`
|
- This command supports several use cases:
|
||||||
- Description: Finds and fixes all invalid dependencies in tasks.json and task files
|
- Moving a standalone task to become a subtask (e.g., `--from=5 --to=7`)
|
||||||
- Parameters:
|
- Moving a subtask to become a standalone task (e.g., `--from=5.2 --to=7`)
|
||||||
- `--file=<path>, -f`: Use alternative tasks.json file (default: 'tasks/tasks.json')
|
- Moving a subtask to a different parent (e.g., `--from=5.2 --to=7.3`)
|
||||||
- Example: `task-master fix-dependencies`
|
- Reordering subtasks within the same parent (e.g., `--from=5.2 --to=5.4`)
|
||||||
- Notes:
|
- Moving a task to a new, non-existent ID position (e.g., `--from=5 --to=25`)
|
||||||
- Removes references to non-existent tasks and subtasks
|
- Moving multiple tasks at once using comma-separated IDs (e.g., `--from=10,11,12 --to=16,17,18`)
|
||||||
- Eliminates self-dependencies (tasks depending on themselves)
|
- The system includes validation to prevent data loss:
|
||||||
- Regenerates task files with corrected dependencies
|
- Allows moving to non-existent IDs by creating placeholder tasks
|
||||||
- Provides detailed report of all fixes made
|
- Prevents moving to existing task IDs that have content (to avoid overwriting)
|
||||||
|
- Validates source tasks exist before attempting to move them
|
||||||
|
- The system maintains proper parent-child relationships and dependency integrity
|
||||||
|
- Task files are automatically regenerated after the move operation
|
||||||
|
- This provides greater flexibility in organizing and refining your task structure as project understanding evolves
|
||||||
|
- This is especially useful when dealing with potential merge conflicts arising from teams creating tasks on separate branches. Solve these conflicts very easily by moving your tasks and keeping theirs.
|
||||||
|
|
||||||
- **Command Reference: complexity-report**
|
## Iterative Subtask Implementation
|
||||||
- CLI Syntax: `task-master complexity-report [options]`
|
|
||||||
- Description: Displays the task complexity analysis report in a formatted, easy-to-read way
|
|
||||||
- Parameters:
|
|
||||||
- `--file=<path>, -f`: Path to the complexity report file (default: 'scripts/task-complexity-report.json')
|
|
||||||
- Example: `task-master complexity-report`
|
|
||||||
- Notes:
|
|
||||||
- Shows tasks organized by complexity score with recommended actions
|
|
||||||
- Provides complexity distribution statistics
|
|
||||||
- Displays ready-to-use expansion commands for complex tasks
|
|
||||||
- If no report exists, offers to generate one interactively
|
|
||||||
|
|
||||||
- **Command Reference: add-task**
|
Once a task has been broken down into subtasks using `expand_task` or similar methods, follow this iterative process for implementation:
|
||||||
- CLI Syntax: `task-master add-task [options]`
|
|
||||||
- Description: Add a new task to tasks.json using AI
|
|
||||||
- Parameters:
|
|
||||||
- `--file=<path>, -f`: Path to the tasks file (default: 'tasks/tasks.json')
|
|
||||||
- `--prompt=<text>, -p`: Description of the task to add (required)
|
|
||||||
- `--dependencies=<ids>, -d`: Comma-separated list of task IDs this task depends on
|
|
||||||
- `--priority=<priority>`: Task priority (high, medium, low) (default: 'medium')
|
|
||||||
- Example: `task-master add-task --prompt="Create user authentication using Auth0"`
|
|
||||||
- Notes: Uses AI to convert description into structured task with appropriate details
|
|
||||||
|
|
||||||
- **Command Reference: init**
|
1. **Understand the Goal (Preparation):**
|
||||||
- CLI Syntax: `task-master init`
|
* Use `get_task` / `task-master show <subtaskId>` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) to thoroughly understand the specific goals and requirements of the subtask.
|
||||||
- Description: Initialize a new project with Task Master structure
|
|
||||||
- Parameters: None
|
|
||||||
- Example: `task-master init`
|
|
||||||
- Notes:
|
|
||||||
- Creates initial project structure with required files
|
|
||||||
- Prompts for project settings if not provided
|
|
||||||
- Merges with existing files when appropriate
|
|
||||||
- Can be used to bootstrap a new Task Master project quickly
|
|
||||||
|
|
||||||
- **Code Analysis & Refactoring Techniques**
|
2. **Initial Exploration & Planning (Iteration 1):**
|
||||||
- **Top-Level Function Search**
|
* This is the first attempt at creating a concrete implementation plan.
|
||||||
- Use grep pattern matching to find all exported functions across the codebase
|
* Explore the codebase to identify the precise files, functions, and even specific lines of code that will need modification.
|
||||||
- Command: `grep -E "export (function|const) \w+|function \w+\(|const \w+ = \(|module\.exports" --include="*.js" -r ./`
|
* Determine the intended code changes (diffs) and their locations.
|
||||||
- Benefits:
|
* Gather *all* relevant details from this exploration phase.
|
||||||
- Quickly identify all public API functions without reading implementation details
|
|
||||||
- Compare functions between files during refactoring (e.g., monolithic to modular structure)
|
3. **Log the Plan:**
|
||||||
- Verify all expected functions exist in refactored modules
|
* Run `update_subtask` / `task-master update-subtask --id=<subtaskId> --prompt='<detailed plan>'`.
|
||||||
- Identify duplicate functionality or naming conflicts
|
* Provide the *complete and detailed* findings from the exploration phase in the prompt. Include file paths, line numbers, proposed diffs, reasoning, and any potential challenges identified. Do not omit details. The goal is to create a rich, timestamped log within the subtask's `details`.
|
||||||
- Usage examples:
|
|
||||||
- When migrating from `scripts/dev.js` to modular structure: `grep -E "function \w+\(" scripts/dev.js`
|
4. **Verify the Plan:**
|
||||||
- Check function exports in a directory: `grep -E "export (function|const)" scripts/modules/`
|
* Run `get_task` / `task-master show <subtaskId>` again to confirm that the detailed implementation plan has been successfully appended to the subtask's details.
|
||||||
- Find potential naming conflicts: `grep -E "function (get|set|create|update)\w+\(" -r ./`
|
|
||||||
- Variations:
|
5. **Begin Implementation:**
|
||||||
- Add `-n` flag to include line numbers
|
* Set the subtask status using `set_task_status` / `task-master set-status --id=<subtaskId> --status=in-progress`.
|
||||||
- Add `--include="*.ts"` to filter by file extension
|
* Start coding based on the logged plan.
|
||||||
- Use with `| sort` to alphabetize results
|
|
||||||
- Integration with refactoring workflow:
|
6. **Refine and Log Progress (Iteration 2+):**
|
||||||
- Start by mapping all functions in the source file
|
* As implementation progresses, you will encounter challenges, discover nuances, or confirm successful approaches.
|
||||||
- Create target module files based on function grouping
|
* **Before appending new information**: Briefly review the *existing* details logged in the subtask (using `get_task` or recalling from context) to ensure the update adds fresh insights and avoids redundancy.
|
||||||
- Verify all functions were properly migrated
|
* **Regularly** use `update_subtask` / `task-master update-subtask --id=<subtaskId> --prompt='<update details>\n- What worked...\n- What didn't work...'` to append new findings.
|
||||||
- Check for any unintentional duplications or omissions
|
* **Crucially, log:**
|
||||||
|
* What worked ("fundamental truths" discovered).
|
||||||
|
* What didn't work and why (to avoid repeating mistakes).
|
||||||
|
* Specific code snippets or configurations that were successful.
|
||||||
|
* Decisions made, especially if confirmed with user input.
|
||||||
|
* Any deviations from the initial plan and the reasoning.
|
||||||
|
* The objective is to continuously enrich the subtask's details, creating a log of the implementation journey that helps the AI (and human developers) learn, adapt, and avoid repeating errors.
|
||||||
|
|
||||||
|
7. **Review & Update Rules (Post-Implementation):**
|
||||||
|
* Once the implementation for the subtask is functionally complete, review all code changes and the relevant chat history.
|
||||||
|
* Identify any new or modified code patterns, conventions, or best practices established during the implementation.
|
||||||
|
* Create new or update existing rules following internal guidelines (previously linked to `cursor_rules.mdc` and `self_improve.mdc`).
|
||||||
|
|
||||||
|
8. **Mark Task Complete:**
|
||||||
|
* After verifying the implementation and updating any necessary rules, mark the subtask as completed: `set_task_status` / `task-master set-status --id=<subtaskId> --status=done`.
|
||||||
|
|
||||||
|
9. **Commit Changes (If using Git):**
|
||||||
|
* Stage the relevant code changes and any updated/new rule files (`git add .`).
|
||||||
|
* Craft a comprehensive Git commit message summarizing the work done for the subtask, including both code implementation and any rule adjustments.
|
||||||
|
* Execute the commit command directly in the terminal (e.g., `git commit -m 'feat(module): Implement feature X for subtask <subtaskId>\n\n- Details about changes...\n- Updated rule Y for pattern Z'`).
|
||||||
|
* Consider if a Changeset is needed according to internal versioning guidelines (previously linked to `changeset.mdc`). If so, run `npm run changeset`, stage the generated file, and amend the commit or create a new one.
|
||||||
|
|
||||||
|
10. **Proceed to Next Subtask:**
|
||||||
|
* Identify the next subtask (e.g., using `next_task` / `task-master next`).
|
||||||
|
|
||||||
|
## Code Analysis & Refactoring Techniques
|
||||||
|
|
||||||
|
- **Top-Level Function Search**:
|
||||||
|
- Useful for understanding module structure or planning refactors.
|
||||||
|
- Use grep/ripgrep to find exported functions/constants:
|
||||||
|
`rg "export (async function|function|const) \w+"` or similar patterns.
|
||||||
|
- Can help compare functions between files during migrations or identify potential naming conflicts.
|
||||||
|
|
||||||
|
---
|
||||||
|
*This workflow provides a general guideline. Adapt it based on your specific project needs and team practices.*
|
||||||
404
.cursor/rules/git_workflow.mdc
Normal file
404
.cursor/rules/git_workflow.mdc
Normal file
@@ -0,0 +1,404 @@
|
|||||||
|
---
|
||||||
|
description: Git workflow integrated with Task Master for feature development and collaboration
|
||||||
|
globs: "**/*"
|
||||||
|
alwaysApply: true
|
||||||
|
---
|
||||||
|
# Git Workflow with Task Master Integration
|
||||||
|
|
||||||
|
## **Branch Strategy**
|
||||||
|
|
||||||
|
### **Main Branch Protection**
|
||||||
|
- **main** branch contains production-ready code
|
||||||
|
- All feature development happens on task-specific branches
|
||||||
|
- Direct commits to main are prohibited
|
||||||
|
- All changes merge via Pull Requests
|
||||||
|
|
||||||
|
### **Task Branch Naming**
|
||||||
|
```bash
|
||||||
|
# ✅ DO: Use consistent task branch naming
|
||||||
|
task-001 # For Task 1
|
||||||
|
task-004 # For Task 4
|
||||||
|
task-015 # For Task 15
|
||||||
|
|
||||||
|
# ❌ DON'T: Use inconsistent naming
|
||||||
|
feature/user-auth
|
||||||
|
fix-database-issue
|
||||||
|
random-branch-name
|
||||||
|
```
|
||||||
|
|
||||||
|
## **Tagged Task Lists Integration**
|
||||||
|
|
||||||
|
Task Master's **tagged task lists system** provides significant benefits for Git workflows:
|
||||||
|
|
||||||
|
### **Multi-Context Development**
|
||||||
|
- **Branch-Specific Tasks**: Each branch can have its own task context using tags
|
||||||
|
- **Merge Conflict Prevention**: Tasks in different tags are completely isolated
|
||||||
|
- **Context Switching**: Seamlessly switch between different development contexts
|
||||||
|
- **Parallel Development**: Multiple team members can work on separate task contexts
|
||||||
|
|
||||||
|
### **Migration and Compatibility**
|
||||||
|
- **Seamless Migration**: Existing projects automatically migrate to use a "master" tag
|
||||||
|
- **Zero Disruption**: All existing Git workflows continue unchanged
|
||||||
|
- **Backward Compatibility**: Legacy projects work exactly as before
|
||||||
|
|
||||||
|
### **Manual Git Integration**
|
||||||
|
- **Manual Tag Creation**: Use `--from-branch` option to create tags from current git branch
|
||||||
|
- **Manual Context Switching**: Explicitly switch tag contexts as needed for different branches
|
||||||
|
- **Simplified Integration**: Focused on manual control rather than automatic workflows
|
||||||
|
|
||||||
|
## **Workflow Overview**
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart TD
|
||||||
|
A[Start: On main branch] --> B[Pull latest changes]
|
||||||
|
B --> C[Create task branch<br/>git checkout -b task-XXX]
|
||||||
|
C --> D[Set task status: in-progress]
|
||||||
|
D --> E[Get task context & expand if needed<br/>Tasks automatically use current tag]
|
||||||
|
E --> F[Identify next subtask]
|
||||||
|
|
||||||
|
F --> G[Set subtask: in-progress]
|
||||||
|
G --> H[Research & collect context<br/>update_subtask with findings]
|
||||||
|
H --> I[Implement subtask]
|
||||||
|
I --> J[Update subtask with completion]
|
||||||
|
J --> K[Set subtask: done]
|
||||||
|
K --> L[Git commit subtask]
|
||||||
|
|
||||||
|
L --> M{More subtasks?}
|
||||||
|
M -->|Yes| F
|
||||||
|
M -->|No| N[Run final tests]
|
||||||
|
|
||||||
|
N --> O[Commit tests if added]
|
||||||
|
O --> P[Push task branch]
|
||||||
|
P --> Q[Create Pull Request]
|
||||||
|
Q --> R[Human review & merge]
|
||||||
|
R --> S[Switch to main & pull]
|
||||||
|
S --> T[Delete task branch]
|
||||||
|
T --> U[Ready for next task]
|
||||||
|
|
||||||
|
style A fill:#e1f5fe
|
||||||
|
style C fill:#f3e5f5
|
||||||
|
style G fill:#fff3e0
|
||||||
|
style L fill:#e8f5e8
|
||||||
|
style Q fill:#fce4ec
|
||||||
|
style R fill:#f1f8e9
|
||||||
|
style U fill:#e1f5fe
|
||||||
|
```
|
||||||
|
|
||||||
|
## **Complete Task Development Workflow**
|
||||||
|
|
||||||
|
### **Phase 1: Task Preparation**
|
||||||
|
```bash
|
||||||
|
# 1. Ensure you're on main branch and pull latest
|
||||||
|
git checkout main
|
||||||
|
git pull origin main
|
||||||
|
|
||||||
|
# 2. Check current branch status
|
||||||
|
git branch # Verify you're on main
|
||||||
|
|
||||||
|
# 3. Create task-specific branch
|
||||||
|
git checkout -b task-004 # For Task 4
|
||||||
|
|
||||||
|
# 4. Set task status in Task Master (tasks automatically use current tag context)
|
||||||
|
# Use: set_task_status tool or `task-master set-status --id=4 --status=in-progress`
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Phase 2: Task Analysis & Planning**
|
||||||
|
```bash
|
||||||
|
# 5. Get task context and expand if needed (uses current tag automatically)
|
||||||
|
# Use: get_task tool or `task-master show 4`
|
||||||
|
# Use: expand_task tool or `task-master expand --id=4 --research --force` (if complex)
|
||||||
|
|
||||||
|
# 6. Identify next subtask to work on
|
||||||
|
# Use: next_task tool or `task-master next`
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Phase 3: Subtask Implementation Loop**
|
||||||
|
For each subtask, follow this pattern:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 7. Mark subtask as in-progress
|
||||||
|
# Use: set_task_status tool or `task-master set-status --id=4.1 --status=in-progress`
|
||||||
|
|
||||||
|
# 8. Gather context and research (if needed)
|
||||||
|
# Use: update_subtask tool with research flag or:
|
||||||
|
# `task-master update-subtask --id=4.1 --prompt="Research findings..." --research`
|
||||||
|
|
||||||
|
# 9. Collect code context through AI exploration
|
||||||
|
# Document findings in subtask using update_subtask
|
||||||
|
|
||||||
|
# 10. Implement the subtask
|
||||||
|
# Write code, tests, documentation
|
||||||
|
|
||||||
|
# 11. Update subtask with completion details
|
||||||
|
# Use: update_subtask tool or:
|
||||||
|
# `task-master update-subtask --id=4.1 --prompt="Implementation complete..."`
|
||||||
|
|
||||||
|
# 12. Mark subtask as done
|
||||||
|
# Use: set_task_status tool or `task-master set-status --id=4.1 --status=done`
|
||||||
|
|
||||||
|
# 13. Commit the subtask implementation
|
||||||
|
git add .
|
||||||
|
git commit -m "feat(task-4): Complete subtask 4.1 - [Subtask Title]
|
||||||
|
|
||||||
|
- Implementation details
|
||||||
|
- Key changes made
|
||||||
|
- Any important notes
|
||||||
|
|
||||||
|
Subtask 4.1: [Brief description of what was accomplished]
|
||||||
|
Relates to Task 4: [Main task title]"
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Phase 4: Task Completion**
|
||||||
|
```bash
|
||||||
|
# 14. When all subtasks are complete, run final testing
|
||||||
|
# Create test file if needed, ensure all tests pass
|
||||||
|
npm test # or jest, or manual testing
|
||||||
|
|
||||||
|
# 15. If tests were added/modified, commit them
|
||||||
|
git add .
|
||||||
|
git commit -m "test(task-4): Add comprehensive tests for Task 4
|
||||||
|
|
||||||
|
- Unit tests for core functionality
|
||||||
|
- Integration tests for API endpoints
|
||||||
|
- All tests passing
|
||||||
|
|
||||||
|
Task 4: [Main task title] - Testing complete"
|
||||||
|
|
||||||
|
# 16. Push the task branch
|
||||||
|
git push origin task-004
|
||||||
|
|
||||||
|
# 17. Create Pull Request
|
||||||
|
# Title: "Task 4: [Task Title]"
|
||||||
|
# Description should include:
|
||||||
|
# - Task overview
|
||||||
|
# - Subtasks completed
|
||||||
|
# - Testing approach
|
||||||
|
# - Any breaking changes or considerations
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Phase 5: PR Merge & Cleanup**
|
||||||
|
```bash
|
||||||
|
# 18. Human reviews and merges PR into main
|
||||||
|
|
||||||
|
# 19. Switch back to main and pull merged changes
|
||||||
|
git checkout main
|
||||||
|
git pull origin main
|
||||||
|
|
||||||
|
# 20. Delete the feature branch (optional cleanup)
|
||||||
|
git branch -d task-004
|
||||||
|
git push origin --delete task-004
|
||||||
|
```
|
||||||
|
|
||||||
|
## **Commit Message Standards**
|
||||||
|
|
||||||
|
### **Subtask Commits**
|
||||||
|
```bash
|
||||||
|
# ✅ DO: Consistent subtask commit format
|
||||||
|
git commit -m "feat(task-4): Complete subtask 4.1 - Initialize Express server
|
||||||
|
|
||||||
|
- Set up Express.js with TypeScript configuration
|
||||||
|
- Added CORS and body parsing middleware
|
||||||
|
- Implemented health check endpoints
|
||||||
|
- Basic error handling middleware
|
||||||
|
|
||||||
|
Subtask 4.1: Initialize project with npm and install dependencies
|
||||||
|
Relates to Task 4: Setup Express.js Server Project"
|
||||||
|
|
||||||
|
# ❌ DON'T: Vague or inconsistent commits
|
||||||
|
git commit -m "fixed stuff"
|
||||||
|
git commit -m "working on task"
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Test Commits**
|
||||||
|
```bash
|
||||||
|
# ✅ DO: Separate test commits when substantial
|
||||||
|
git commit -m "test(task-4): Add comprehensive tests for Express server setup
|
||||||
|
|
||||||
|
- Unit tests for middleware configuration
|
||||||
|
- Integration tests for health check endpoints
|
||||||
|
- Mock tests for database connection
|
||||||
|
- All tests passing with 95% coverage
|
||||||
|
|
||||||
|
Task 4: Setup Express.js Server Project - Testing complete"
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Commit Type Prefixes**
|
||||||
|
- `feat(task-X):` - New feature implementation
|
||||||
|
- `fix(task-X):` - Bug fixes
|
||||||
|
- `test(task-X):` - Test additions/modifications
|
||||||
|
- `docs(task-X):` - Documentation updates
|
||||||
|
- `refactor(task-X):` - Code refactoring
|
||||||
|
- `chore(task-X):` - Build/tooling changes
|
||||||
|
|
||||||
|
## **Task Master Commands Integration**
|
||||||
|
|
||||||
|
### **Essential Commands for Git Workflow**
|
||||||
|
```bash
|
||||||
|
# Task management (uses current tag context automatically)
|
||||||
|
task-master show <id> # Get task/subtask details
|
||||||
|
task-master next # Find next task to work on
|
||||||
|
task-master set-status --id=<id> --status=<status>
|
||||||
|
task-master update-subtask --id=<id> --prompt="..." --research
|
||||||
|
|
||||||
|
# Task expansion (for complex tasks)
|
||||||
|
task-master expand --id=<id> --research --force
|
||||||
|
|
||||||
|
# Progress tracking
|
||||||
|
task-master list # View all tasks and status
|
||||||
|
task-master list --status=in-progress # View active tasks
|
||||||
|
```
|
||||||
|
|
||||||
|
### **MCP Tool Equivalents**
|
||||||
|
When using Cursor or other MCP-integrated tools:
|
||||||
|
- `get_task` instead of `task-master show`
|
||||||
|
- `next_task` instead of `task-master next`
|
||||||
|
- `set_task_status` instead of `task-master set-status`
|
||||||
|
- `update_subtask` instead of `task-master update-subtask`
|
||||||
|
|
||||||
|
## **Branch Management Rules**
|
||||||
|
|
||||||
|
### **Branch Protection**
|
||||||
|
```bash
|
||||||
|
# ✅ DO: Always work on task branches
|
||||||
|
git checkout -b task-005
|
||||||
|
# Make changes
|
||||||
|
git commit -m "..."
|
||||||
|
git push origin task-005
|
||||||
|
|
||||||
|
# ❌ DON'T: Commit directly to main
|
||||||
|
git checkout main
|
||||||
|
git commit -m "..." # NEVER do this
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Keeping Branches Updated**
|
||||||
|
```bash
|
||||||
|
# ✅ DO: Regularly sync with main (for long-running tasks)
|
||||||
|
git checkout task-005
|
||||||
|
git fetch origin
|
||||||
|
git rebase origin/main # or merge if preferred
|
||||||
|
|
||||||
|
# Resolve any conflicts and continue
|
||||||
|
```
|
||||||
|
|
||||||
|
## **Pull Request Guidelines**
|
||||||
|
|
||||||
|
### **PR Title Format**
|
||||||
|
```
|
||||||
|
Task <ID>: <Task Title>
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
Task 4: Setup Express.js Server Project
|
||||||
|
Task 7: Implement User Authentication
|
||||||
|
Task 12: Add Stripe Payment Integration
|
||||||
|
```
|
||||||
|
|
||||||
|
### **PR Description Template**
|
||||||
|
```markdown
|
||||||
|
## Task Overview
|
||||||
|
Brief description of the main task objective.
|
||||||
|
|
||||||
|
## Subtasks Completed
|
||||||
|
- [x] 4.1: Initialize project with npm and install dependencies
|
||||||
|
- [x] 4.2: Configure TypeScript, ESLint and Prettier
|
||||||
|
- [x] 4.3: Create basic Express app with middleware and health check route
|
||||||
|
|
||||||
|
## Implementation Details
|
||||||
|
- Key architectural decisions made
|
||||||
|
- Important code changes
|
||||||
|
- Any deviations from original plan
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
- [ ] Unit tests added/updated
|
||||||
|
- [ ] Integration tests passing
|
||||||
|
- [ ] Manual testing completed
|
||||||
|
|
||||||
|
## Breaking Changes
|
||||||
|
List any breaking changes or migration requirements.
|
||||||
|
|
||||||
|
## Related Tasks
|
||||||
|
Mention any dependent tasks or follow-up work needed.
|
||||||
|
```
|
||||||
|
|
||||||
|
## **Conflict Resolution**
|
||||||
|
|
||||||
|
### **Task Conflicts with Tagged System**
|
||||||
|
```bash
|
||||||
|
# With tagged task lists, merge conflicts are significantly reduced:
|
||||||
|
# 1. Different branches can use different tag contexts
|
||||||
|
# 2. Tasks in separate tags are completely isolated
|
||||||
|
# 3. Use Task Master's move functionality to reorganize if needed
|
||||||
|
|
||||||
|
# Manual git integration available:
|
||||||
|
# - Use `task-master add-tag --from-branch` to create tags from current branch
|
||||||
|
# - Manually switch contexts with `task-master use-tag <name>`
|
||||||
|
# - Simple, predictable workflow without automatic behavior
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Code Conflicts**
|
||||||
|
```bash
|
||||||
|
# Standard Git conflict resolution
|
||||||
|
git fetch origin
|
||||||
|
git rebase origin/main
|
||||||
|
# Resolve conflicts in files
|
||||||
|
git add .
|
||||||
|
git rebase --continue
|
||||||
|
```
|
||||||
|
|
||||||
|
## **Emergency Procedures**
|
||||||
|
|
||||||
|
### **Hotfixes**
|
||||||
|
```bash
|
||||||
|
# For urgent production fixes:
|
||||||
|
git checkout main
|
||||||
|
git pull origin main
|
||||||
|
git checkout -b hotfix-urgent-issue
|
||||||
|
|
||||||
|
# Make minimal fix
|
||||||
|
git commit -m "hotfix: Fix critical production issue
|
||||||
|
|
||||||
|
- Specific fix description
|
||||||
|
- Minimal impact change
|
||||||
|
- Requires immediate deployment"
|
||||||
|
|
||||||
|
git push origin hotfix-urgent-issue
|
||||||
|
# Create emergency PR for immediate review
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Task Abandonment**
|
||||||
|
```bash
|
||||||
|
# If task needs to be abandoned or significantly changed:
|
||||||
|
# 1. Update task status
|
||||||
|
task-master set-status --id=<id> --status=cancelled
|
||||||
|
|
||||||
|
# 2. Clean up branch
|
||||||
|
git checkout main
|
||||||
|
git branch -D task-<id>
|
||||||
|
git push origin --delete task-<id>
|
||||||
|
|
||||||
|
# 3. Document reasoning in task
|
||||||
|
task-master update-task --id=<id> --prompt="Task cancelled due to..."
|
||||||
|
```
|
||||||
|
|
||||||
|
## **Tagged System Benefits for Git Workflows**
|
||||||
|
|
||||||
|
### **Multi-Team Development**
|
||||||
|
- **Isolated Contexts**: Different teams can work on separate tag contexts without conflicts
|
||||||
|
- **Feature Branches**: Each feature branch can have its own task context
|
||||||
|
- **Release Management**: Separate tags for different release versions or environments
|
||||||
|
|
||||||
|
### **Merge Conflict Prevention**
|
||||||
|
- **Context Separation**: Tasks in different tags don't interfere with each other
|
||||||
|
- **Clean Merges**: Reduced likelihood of task-related merge conflicts
|
||||||
|
- **Parallel Development**: Multiple developers can work simultaneously without task conflicts
|
||||||
|
|
||||||
|
### **Manual Git Integration**
|
||||||
|
- **Branch-Based Tag Creation**: Use `--from-branch` option to create tags from current git branch
|
||||||
|
- **Manual Context Management**: Explicitly switch tag contexts as needed
|
||||||
|
- **Predictable Workflow**: Simple, manual control without automatic behavior
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**References:**
|
||||||
|
- [Task Master Workflow](mdc:.cursor/rules/dev_workflow.mdc)
|
||||||
|
- [Architecture Guidelines](mdc:.cursor/rules/architecture.mdc)
|
||||||
|
- [Task Master Commands](mdc:.cursor/rules/taskmaster.mdc)
|
||||||
26
.cursor/rules/glossary.mdc
Normal file
26
.cursor/rules/glossary.mdc
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
description: Glossary of other Cursor rules
|
||||||
|
globs: **/*
|
||||||
|
alwaysApply: true
|
||||||
|
---
|
||||||
|
# Glossary of Task Master Cursor Rules
|
||||||
|
|
||||||
|
This file provides a quick reference to the purpose of each rule file located in the `.cursor/rules` directory.
|
||||||
|
|
||||||
|
- **[`architecture.mdc`](mdc:.cursor/rules/architecture.mdc)**: Describes the high-level architecture of the Task Master CLI application, including the new tagged task lists system.
|
||||||
|
- **[`changeset.mdc`](mdc:.cursor/rules/changeset.mdc)**: Guidelines for using Changesets (npm run changeset) to manage versioning and changelogs.
|
||||||
|
- **[`commands.mdc`](mdc:.cursor/rules/commands.mdc)**: Guidelines for implementing CLI commands using Commander.js.
|
||||||
|
- **[`cursor_rules.mdc`](mdc:.cursor/rules/cursor_rules.mdc)**: Guidelines for creating and maintaining Cursor rules to ensure consistency and effectiveness.
|
||||||
|
- **[`dependencies.mdc`](mdc:.cursor/rules/dependencies.mdc)**: Guidelines for managing task dependencies and relationships across tagged task contexts.
|
||||||
|
- **[`dev_workflow.mdc`](mdc:.cursor/rules/dev_workflow.mdc)**: Guide for using Task Master to manage task-driven development workflows with tagged task lists support.
|
||||||
|
- **[`glossary.mdc`](mdc:.cursor/rules/glossary.mdc)**: This file; provides a glossary of other Cursor rules.
|
||||||
|
- **[`mcp.mdc`](mdc:.cursor/rules/mcp.mdc)**: Guidelines for implementing and interacting with the Task Master MCP Server.
|
||||||
|
- **[`new_features.mdc`](mdc:.cursor/rules/new_features.mdc)**: Guidelines for integrating new features into the Task Master CLI with tagged system considerations.
|
||||||
|
- **[`self_improve.mdc`](mdc:.cursor/rules/self_improve.mdc)**: Guidelines for continuously improving Cursor rules based on emerging code patterns and best practices.
|
||||||
|
- **[`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)**: Comprehensive reference for Taskmaster MCP tools and CLI commands with tagged task lists information.
|
||||||
|
- **[`tasks.mdc`](mdc:.cursor/rules/tasks.mdc)**: Guidelines for implementing task management operations with tagged task lists system support.
|
||||||
|
- **[`tests.mdc`](mdc:.cursor/rules/tests.mdc)**: Guidelines for implementing and maintaining tests for Task Master CLI.
|
||||||
|
- **[`ui.mdc`](mdc:.cursor/rules/ui.mdc)**: Guidelines for implementing and maintaining user interface components.
|
||||||
|
- **[`utilities.mdc`](mdc:.cursor/rules/utilities.mdc)**: Guidelines for implementing utility functions including tagged task lists utilities.
|
||||||
|
- **[`telemetry.mdc`](mdc:.cursor/rules/telemetry.mdc)**: Guidelines for integrating AI usage telemetry across Task Master.
|
||||||
|
|
||||||
@@ -3,7 +3,6 @@ description: Guidelines for implementing and interacting with the Task Master MC
|
|||||||
globs: mcp-server/src/**/*, scripts/modules/**/*
|
globs: mcp-server/src/**/*, scripts/modules/**/*
|
||||||
alwaysApply: false
|
alwaysApply: false
|
||||||
---
|
---
|
||||||
|
|
||||||
# Task Master MCP Server Guidelines
|
# Task Master MCP Server Guidelines
|
||||||
|
|
||||||
This document outlines the architecture and implementation patterns for the Task Master Model Context Protocol (MCP) server, designed for integration with tools like Cursor.
|
This document outlines the architecture and implementation patterns for the Task Master Model Context Protocol (MCP) server, designed for integration with tools like Cursor.
|
||||||
@@ -12,76 +11,519 @@ This document outlines the architecture and implementation patterns for the Task
|
|||||||
|
|
||||||
The MCP server acts as a bridge between external tools (like Cursor) and the core Task Master CLI logic. It leverages FastMCP for the server framework.
|
The MCP server acts as a bridge between external tools (like Cursor) and the core Task Master CLI logic. It leverages FastMCP for the server framework.
|
||||||
|
|
||||||
- **Flow**: `External Tool (Cursor)` <-> `FastMCP Server` <-> `MCP Tools` (`mcp-server/src/tools/*.js`) <-> `Core Logic Wrappers` (`mcp-server/src/core/task-master-core.js`) <-> `Core Modules` (`scripts/modules/*.js`)
|
- **Flow**: `External Tool (Cursor)` <-> `FastMCP Server` <-> `MCP Tools` (`mcp-server/src/tools/*.js`) <-> `Core Logic Wrappers` (`mcp-server/src/core/direct-functions/*.js`, exported via `task-master-core.js`) <-> `Core Modules` (`scripts/modules/*.js`)
|
||||||
- **Goal**: Provide a performant and reliable way for external tools to interact with Task Master functionality without directly invoking the CLI for every operation.
|
- **Goal**: Provide a performant and reliable way for external tools to interact with Task Master functionality without directly invoking the CLI for every operation.
|
||||||
|
|
||||||
|
## Direct Function Implementation Best Practices
|
||||||
|
|
||||||
|
When implementing a new direct function in `mcp-server/src/core/direct-functions/`, follow these critical guidelines:
|
||||||
|
|
||||||
|
1. **Verify Function Dependencies**:
|
||||||
|
- ✅ **DO**: Check that all helper functions your direct function needs are properly exported from their source modules
|
||||||
|
- ✅ **DO**: Import these dependencies explicitly at the top of your file
|
||||||
|
- ❌ **DON'T**: Assume helper functions like `findTaskById` or `taskExists` are automatically available
|
||||||
|
- **Example**:
|
||||||
|
```javascript
|
||||||
|
// At top of direct-function file
|
||||||
|
import { removeTask, findTaskById, taskExists } from '../../../../scripts/modules/task-manager.js';
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Parameter Verification and Completeness**:
|
||||||
|
- ✅ **DO**: Verify the signature of core functions you're calling and ensure all required parameters are provided
|
||||||
|
- ✅ **DO**: Pass explicit values for required parameters rather than relying on defaults
|
||||||
|
- ✅ **DO**: Double-check parameter order against function definition
|
||||||
|
- ❌ **DON'T**: Omit parameters assuming they have default values
|
||||||
|
- **Example**:
|
||||||
|
```javascript
|
||||||
|
// Correct parameter handling in direct function
|
||||||
|
async function generateTaskFilesDirect(args, log) {
|
||||||
|
const tasksPath = findTasksJsonPath(args, log);
|
||||||
|
const outputDir = args.output || path.dirname(tasksPath);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Pass all required parameters
|
||||||
|
const result = await generateTaskFiles(tasksPath, outputDir);
|
||||||
|
return { success: true, data: result, fromCache: false };
|
||||||
|
} catch (error) {
|
||||||
|
// Error handling...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Consistent File Path Handling**:
|
||||||
|
- ✅ **DO**: Use `path.join()` instead of string concatenation for file paths
|
||||||
|
- ✅ **DO**: Follow established file naming conventions (`task_001.txt` not `1.md`)
|
||||||
|
- ✅ **DO**: Use `path.dirname()` and other path utilities for manipulating paths
|
||||||
|
- ✅ **DO**: When paths relate to task files, follow the standard format: `task_${id.toString().padStart(3, '0')}.txt`
|
||||||
|
- ❌ **DON'T**: Create custom file path handling logic that diverges from established patterns
|
||||||
|
- **Example**:
|
||||||
|
```javascript
|
||||||
|
// Correct file path handling
|
||||||
|
const taskFilePath = path.join(
|
||||||
|
path.dirname(tasksPath),
|
||||||
|
`task_${taskId.toString().padStart(3, '0')}.txt`
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Comprehensive Error Handling**:
|
||||||
|
- ✅ **DO**: Wrap core function calls *and AI calls* in try/catch blocks
|
||||||
|
- ✅ **DO**: Log errors with appropriate severity and context
|
||||||
|
- ✅ **DO**: Return standardized error objects with code and message (`{ success: false, error: { code: '...', message: '...' } }`)
|
||||||
|
- ✅ **DO**: Handle file system errors, AI client errors, AI processing errors, and core function errors distinctly with appropriate codes.
|
||||||
|
- **Example**:
|
||||||
|
```javascript
|
||||||
|
try {
|
||||||
|
// Core function call or AI logic
|
||||||
|
} catch (error) {
|
||||||
|
log.error(`Failed to execute direct function logic: ${error.message}`);
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error: {
|
||||||
|
code: error.code || 'DIRECT_FUNCTION_ERROR', // Use specific codes like AI_CLIENT_ERROR, etc.
|
||||||
|
message: error.message,
|
||||||
|
details: error.stack // Optional: Include stack in debug mode
|
||||||
|
},
|
||||||
|
fromCache: false // Ensure this is included if applicable
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
5. **Handling Logging Context (`mcpLog`)**:
|
||||||
|
- **Requirement**: Core functions (like those in `task-manager.js`) may accept an `options` object containing an optional `mcpLog` property. If provided, the core function expects this object to have methods like `mcpLog.info(...)`, `mcpLog.error(...)`.
|
||||||
|
- **Solution: The Logger Wrapper Pattern**: When calling a core function from a direct function, pass the `log` object provided by FastMCP *wrapped* in the standard `logWrapper` object. This ensures the core function receives a logger with the expected method structure.
|
||||||
|
```javascript
|
||||||
|
// Standard logWrapper pattern within a Direct Function
|
||||||
|
const logWrapper = {
|
||||||
|
info: (message, ...args) => log.info(message, ...args),
|
||||||
|
warn: (message, ...args) => log.warn(message, ...args),
|
||||||
|
error: (message, ...args) => log.error(message, ...args),
|
||||||
|
debug: (message, ...args) => log.debug && log.debug(message, ...args),
|
||||||
|
success: (message, ...args) => log.info(message, ...args)
|
||||||
|
};
|
||||||
|
|
||||||
|
// ... later when calling the core function ...
|
||||||
|
await coreFunction(
|
||||||
|
// ... other arguments ...
|
||||||
|
{
|
||||||
|
mcpLog: logWrapper, // Pass the wrapper object
|
||||||
|
session // Also pass session if needed by core logic or AI service
|
||||||
|
},
|
||||||
|
'json' // Pass 'json' output format if supported by core function
|
||||||
|
);
|
||||||
|
```
|
||||||
|
- **JSON Output**: Passing `mcpLog` (via the wrapper) often triggers the core function to use a JSON-friendly output format, suppressing spinners/boxes.
|
||||||
|
- ✅ **DO**: Implement this pattern in direct functions calling core functions that might use `mcpLog`.
|
||||||
|
|
||||||
|
6. **Silent Mode Implementation**:
|
||||||
|
- ✅ **DO**: Import silent mode utilities: `import { enableSilentMode, disableSilentMode, isSilentMode } from '../../../../scripts/modules/utils.js';`
|
||||||
|
- ✅ **DO**: Wrap core function calls *within direct functions* using `enableSilentMode()` / `disableSilentMode()` in a `try/finally` block if the core function might produce console output (spinners, boxes, direct `console.log`) that isn't reliably controlled by passing `{ mcpLog }` or an `outputFormat` parameter.
|
||||||
|
- ✅ **DO**: Always disable silent mode in the `finally` block.
|
||||||
|
- ❌ **DON'T**: Wrap calls to the unified AI service (`generateTextService`, `generateObjectService`) in silent mode; their logging is handled internally.
|
||||||
|
- **Example (Direct Function Guaranteeing Silence & using Log Wrapper)**:
|
||||||
|
```javascript
|
||||||
|
export async function coreWrapperDirect(args, log, context = {}) {
|
||||||
|
const { session } = context;
|
||||||
|
const tasksPath = findTasksJsonPath(args, log);
|
||||||
|
const logWrapper = { /* ... */ };
|
||||||
|
|
||||||
|
enableSilentMode(); // Ensure silence for direct console output
|
||||||
|
try {
|
||||||
|
const result = await coreFunction(
|
||||||
|
tasksPath,
|
||||||
|
args.param1,
|
||||||
|
{ mcpLog: logWrapper, session }, // Pass context
|
||||||
|
'json' // Request JSON format if supported
|
||||||
|
);
|
||||||
|
return { success: true, data: result };
|
||||||
|
} catch (error) {
|
||||||
|
log.error(`Error: ${error.message}`);
|
||||||
|
return { success: false, error: { /* ... */ } };
|
||||||
|
} finally {
|
||||||
|
disableSilentMode(); // Critical: Always disable in finally
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
7. **Debugging MCP/Core Logic Interaction**:
|
||||||
|
- ✅ **DO**: If an MCP tool fails with unclear errors (like JSON parsing failures), run the equivalent `task-master` CLI command in the terminal. The CLI often provides more detailed error messages originating from the core logic (e.g., `ReferenceError`, stack traces) that are obscured by the MCP layer.
|
||||||
|
|
||||||
|
## Tool Definition and Execution
|
||||||
|
|
||||||
|
### Tool Structure
|
||||||
|
|
||||||
|
MCP tools must follow a specific structure to properly interact with the FastMCP framework:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
server.addTool({
|
||||||
|
name: "tool_name", // Use snake_case for tool names
|
||||||
|
description: "Description of what the tool does",
|
||||||
|
parameters: z.object({
|
||||||
|
// Define parameters using Zod
|
||||||
|
param1: z.string().describe("Parameter description"),
|
||||||
|
param2: z.number().optional().describe("Optional parameter description"),
|
||||||
|
// IMPORTANT: For file operations, always include these optional parameters
|
||||||
|
file: z.string().optional().describe("Path to the tasks file"),
|
||||||
|
projectRoot: z.string().optional().describe("Root directory of the project (typically derived from session)")
|
||||||
|
}),
|
||||||
|
|
||||||
|
// The execute function is the core of the tool implementation
|
||||||
|
execute: async (args, context) => {
|
||||||
|
// Implementation goes here
|
||||||
|
// Return response in the appropriate format
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Execute Function Signature
|
||||||
|
|
||||||
|
The `execute` function receives validated arguments and the FastMCP context:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Destructured signature (recommended)
|
||||||
|
execute: async (args, { log, session }) => {
|
||||||
|
// Tool implementation
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- **args**: Validated parameters.
|
||||||
|
- **context**: Contains `{ log, session }` from FastMCP. (Removed `reportProgress`).
|
||||||
|
|
||||||
|
### Standard Tool Execution Pattern with Path Normalization (Updated)
|
||||||
|
|
||||||
|
To ensure consistent handling of project paths across different client environments (Windows, macOS, Linux, WSL) and input formats (e.g., `file:///...`, URI encoded paths), all MCP tool `execute` methods that require access to the project root **MUST** be wrapped with the `withNormalizedProjectRoot` Higher-Order Function (HOF).
|
||||||
|
|
||||||
|
This HOF, defined in [`mcp-server/src/tools/utils.js`](mdc:mcp-server/src/tools/utils.js), performs the following before calling the tool's core logic:
|
||||||
|
|
||||||
|
1. **Determines the Raw Root:** It prioritizes `args.projectRoot` if provided by the client, otherwise it calls `getRawProjectRootFromSession` to extract the path from the session.
|
||||||
|
2. **Normalizes the Path:** It uses the `normalizeProjectRoot` helper to decode URIs, strip `file://` prefixes, fix potential Windows drive letter prefixes (e.g., `/C:/`), convert backslashes (`\`) to forward slashes (`/`), and resolve the path to an absolute path suitable for the server's OS.
|
||||||
|
3. **Injects Normalized Path:** It updates the `args` object by replacing the original `projectRoot` (or adding it) with the normalized, absolute path.
|
||||||
|
4. **Executes Original Logic:** It calls the original `execute` function body, passing the updated `args` object.
|
||||||
|
|
||||||
|
**Implementation Example:**
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// In mcp-server/src/tools/your-tool.js
|
||||||
|
import {
|
||||||
|
handleApiResult,
|
||||||
|
createErrorResponse,
|
||||||
|
withNormalizedProjectRoot // <<< Import HOF
|
||||||
|
} from './utils.js';
|
||||||
|
import { yourDirectFunction } from '../core/task-master-core.js';
|
||||||
|
import { findTasksJsonPath } from '../core/utils/path-utils.js'; // If needed
|
||||||
|
|
||||||
|
export function registerYourTool(server) {
|
||||||
|
server.addTool({
|
||||||
|
name: "your_tool",
|
||||||
|
description: "...".
|
||||||
|
parameters: z.object({
|
||||||
|
// ... other parameters ...
|
||||||
|
projectRoot: z.string().optional().describe('...') // projectRoot is optional here, HOF handles fallback
|
||||||
|
}),
|
||||||
|
// Wrap the entire execute function
|
||||||
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
|
// args.projectRoot is now guaranteed to be normalized and absolute
|
||||||
|
const { /* other args */, projectRoot } = args;
|
||||||
|
|
||||||
|
try {
|
||||||
|
log.info(`Executing your_tool with normalized root: ${projectRoot}`);
|
||||||
|
|
||||||
|
// Resolve paths using the normalized projectRoot
|
||||||
|
let tasksPath = findTasksJsonPath({ projectRoot, file: args.file }, log);
|
||||||
|
|
||||||
|
// Call direct function, passing normalized projectRoot if needed by direct func
|
||||||
|
const result = await yourDirectFunction(
|
||||||
|
{
|
||||||
|
/* other args */,
|
||||||
|
projectRoot // Pass it if direct function needs it
|
||||||
|
},
|
||||||
|
log,
|
||||||
|
{ session }
|
||||||
|
);
|
||||||
|
|
||||||
|
return handleApiResult(result, log);
|
||||||
|
} catch (error) {
|
||||||
|
log.error(`Error in your_tool: ${error.message}`);
|
||||||
|
return createErrorResponse(error.message);
|
||||||
|
}
|
||||||
|
}) // End HOF wrap
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
By using this HOF, the core logic within the `execute` method and any downstream functions (like `findTasksJsonPath` or direct functions) can reliably expect `args.projectRoot` to be a clean, absolute path suitable for the server environment.
|
||||||
|
|
||||||
|
### Project Initialization Tool
|
||||||
|
|
||||||
|
The `initialize_project` tool allows integrated clients like Cursor to set up a new Task Master project:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// In initialize-project.js
|
||||||
|
import { z } from "zod";
|
||||||
|
import { initializeProjectDirect } from "../core/task-master-core.js";
|
||||||
|
import { handleApiResult, createErrorResponse } from "./utils.js";
|
||||||
|
|
||||||
|
export function registerInitializeProjectTool(server) {
|
||||||
|
server.addTool({
|
||||||
|
name: "initialize_project",
|
||||||
|
description: "Initialize a new Task Master project",
|
||||||
|
parameters: z.object({
|
||||||
|
projectName: z.string().optional().describe("The name for the new project"),
|
||||||
|
projectDescription: z.string().optional().describe("A brief description"),
|
||||||
|
projectVersion: z.string().optional().describe("Initial version (e.g., '0.1.0')"),
|
||||||
|
authorName: z.string().optional().describe("The author's name"),
|
||||||
|
skipInstall: z.boolean().optional().describe("Skip installing dependencies"),
|
||||||
|
addAliases: z.boolean().optional().describe("Add shell aliases"),
|
||||||
|
yes: z.boolean().optional().describe("Skip prompts and use defaults")
|
||||||
|
}),
|
||||||
|
execute: async (args, { log, reportProgress }) => {
|
||||||
|
try {
|
||||||
|
// Since we're initializing, we don't need project root
|
||||||
|
const result = await initializeProjectDirect(args, log);
|
||||||
|
return handleApiResult(result, log, 'Error initializing project');
|
||||||
|
} catch (error) {
|
||||||
|
log.error(`Error in initialize_project: ${error.message}`);
|
||||||
|
return createErrorResponse(`Failed to initialize project: ${error.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Logging Convention
|
||||||
|
|
||||||
|
The `log` object (destructured from `context`) provides standardized logging methods. Use it within both the `execute` method and the `*Direct` functions. **If progress indication is needed within a direct function, use `log.info()` instead of `reportProgress`**.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Proper logging usage
|
||||||
|
log.info(`Starting ${toolName} with parameters: ${JSON.stringify(sanitizedArgs)}`);
|
||||||
|
log.debug("Detailed operation info", { data });
|
||||||
|
log.warn("Potential issue detected");
|
||||||
|
log.error(`Error occurred: ${error.message}`, { stack: error.stack });
|
||||||
|
log.info('Progress: 50% - AI call initiated...'); // Example progress logging
|
||||||
|
```
|
||||||
|
|
||||||
|
## Session Usage Convention
|
||||||
|
|
||||||
|
The `session` object (destructured from `context`) contains authenticated session data and client information.
|
||||||
|
|
||||||
|
- **Authentication**: Access user-specific data (`session.userId`, etc.) if authentication is implemented.
|
||||||
|
- **Project Root**: The primary use in Task Master is accessing `session.roots` to determine the client's project root directory via the `getProjectRootFromSession` utility (from [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js)). See the Standard Tool Execution Pattern above.
|
||||||
|
- **Environment Variables**: The `session.env` object provides access to environment variables set in the MCP client configuration (e.g., `.cursor/mcp.json`). This is the **primary mechanism** for the unified AI service layer (`ai-services-unified.js`) to securely access **API keys** when called from MCP context.
|
||||||
|
- **Capabilities**: Can be used to check client capabilities (`session.clientCapabilities`).
|
||||||
|
|
||||||
|
## Direct Function Wrappers (`*Direct`)
|
||||||
|
|
||||||
|
These functions, located in `mcp-server/src/core/direct-functions/`, form the core logic execution layer for MCP tools.
|
||||||
|
|
||||||
|
- **Purpose**: Bridge MCP tools and core Task Master modules (`scripts/modules/*`). Handle AI interactions if applicable.
|
||||||
|
- **Responsibilities**:
|
||||||
|
- Receive `args` (including `projectRoot`), `log`, and optionally `{ session }` context.
|
||||||
|
- Find `tasks.json` using `findTasksJsonPath`.
|
||||||
|
- Validate arguments.
|
||||||
|
- **Implement Caching (if applicable)**: Use `getCachedOrExecute`.
|
||||||
|
- **Call Core Logic**: Invoke function from `scripts/modules/*`.
|
||||||
|
- Pass `outputFormat: 'json'` if applicable.
|
||||||
|
- Wrap with `enableSilentMode/disableSilentMode` if needed.
|
||||||
|
- Pass `{ mcpLog: logWrapper, session }` context if core logic needs it.
|
||||||
|
- Handle errors.
|
||||||
|
- Return standardized result object.
|
||||||
|
- ❌ **DON'T**: Call `reportProgress`.
|
||||||
|
- ❌ **DON'T**: Initialize AI clients or call AI services directly.
|
||||||
|
|
||||||
## Key Principles
|
## Key Principles
|
||||||
|
|
||||||
- **Prefer Direct Function Calls**: For optimal performance and error handling, MCP tools should utilize direct function wrappers defined in [`task-master-core.js`](mdc:mcp-server/src/core/task-master-core.js). These wrappers call the underlying logic from the core modules (e.g., [`task-manager.js`](mdc:scripts/modules/task-manager.js)).
|
- **Prefer Direct Function Calls**: MCP tools should always call `*Direct` wrappers instead of `executeTaskMasterCommand`.
|
||||||
- **Use `executeMCPToolAction`**: This utility function in [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js) is the standard wrapper for executing the main logic within an MCP tool's `execute` function. It handles common boilerplate like logging, argument processing, calling the core action (`*Direct` function), and formatting the response.
|
- **Standardized Execution Flow**: Follow the pattern: MCP Tool -> `getProjectRootFromSession` -> `*Direct` Function -> Core Logic / AI Logic.
|
||||||
- **CLI Execution as Fallback**: The `executeTaskMasterCommand` utility in [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js) allows executing commands via the CLI (`task-master ...`). This should **only** be used as a fallback if a direct function wrapper is not yet implemented or if a specific command intrinsically requires CLI execution.
|
- **Path Resolution via Direct Functions**: The `*Direct` function is responsible for finding the exact `tasks.json` path using `findTasksJsonPath`, relying on the `projectRoot` passed in `args`.
|
||||||
- **Centralized Utilities** (See also: [`utilities.mdc`](mdc:.cursor/rules/utilities.mdc)):
|
- **AI Logic in Core Modules**: AI interactions (prompt building, calling unified service) reside within the core logic functions (`scripts/modules/*`), not direct functions.
|
||||||
- Use `findTasksJsonPath` (in [`task-master-core.js`](mdc:mcp-server/src/core/task-master-core.js)) within direct function wrappers to locate the `tasks.json` file consistently.
|
- **Silent Mode in Direct Functions**: Wrap *core function* calls (from `scripts/modules`) with `enableSilentMode()` and `disableSilentMode()` if they produce console output not handled by `outputFormat`. Do not wrap AI calls.
|
||||||
- **Leverage MCP Utilities**: The file [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js) contains essential helpers for MCP tool implementation:
|
- **Selective Async Processing**: Use `AsyncOperationManager` in the *MCP Tool layer* for operations involving multiple steps or long waits beyond a single AI call (e.g., file processing + AI call + file writing). Simple AI calls handled entirely within the `*Direct` function (like `addTaskDirect`) may not need it at the tool layer.
|
||||||
- `getProjectRoot`: Normalizes project paths (used internally by other utils).
|
- **No `reportProgress` in Direct Functions**: Do not pass or use `reportProgress` within `*Direct` functions. Use `log.info()` for internal progress or report progress from the `AsyncOperationManager` callback in the MCP tool layer.
|
||||||
- `handleApiResult`: Standardizes handling results from direct function calls (success/error).
|
- **Output Formatting**: Ensure core functions called by `*Direct` functions can suppress CLI output, ideally via an `outputFormat` parameter.
|
||||||
- `createContentResponse`/`createErrorResponse`: Formats successful/error MCP responses.
|
- **Project Initialization**: Use the initialize_project tool for setting up new projects in integrated environments.
|
||||||
- `processMCPResponseData`: Filters/cleans data for MCP responses (e.g., removing `details`, `testStrategy`). This is the default processor used by `executeMCPToolAction`.
|
- **Centralized Utilities**: Use helpers from `mcp-server/src/tools/utils.js`, `mcp-server/src/core/utils/path-utils.js`, and `mcp-server/src/core/utils/ai-client-utils.js`. See [`utilities.mdc`](mdc:.cursor/rules/utilities.mdc).
|
||||||
- `executeMCPToolAction`: The primary wrapper function for tool execution logic.
|
- **Caching in Direct Functions**: Caching logic resides *within* the `*Direct` functions using `getCachedOrExecute`.
|
||||||
- `executeTaskMasterCommand`: Fallback for executing CLI commands.
|
|
||||||
- **Caching**: To improve performance for frequently called read operations (like `listTasks`), a caching layer using `lru-cache` is implemented.
|
## Resources and Resource Templates
|
||||||
- Caching logic should be added *inside* the direct function wrappers in [`task-master-core.js`](mdc:mcp-server/src/core/task-master-core.js) using the `getCachedOrExecute` utility from [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js).
|
|
||||||
- Generate unique cache keys based on function arguments that define a distinct call.
|
Resources provide LLMs with static or dynamic data without executing tools.
|
||||||
- Responses will include a `fromCache` flag.
|
|
||||||
- Cache statistics can be monitored using the `cacheStats` MCP tool (implemented via `getCacheStatsDirect`).
|
- **Implementation**: Use `@mcp.resource()` decorator pattern or `server.addResource`/`server.addResourceTemplate` in `mcp-server/src/core/resources/`.
|
||||||
|
- **Registration**: Register resources during server initialization in [`mcp-server/src/index.js`](mdc:mcp-server/src/index.js).
|
||||||
|
- **Best Practices**: Organize resources, validate parameters, use consistent URIs, handle errors. See [`fastmcp-core.txt`](docs/fastmcp-core.txt) for underlying SDK details.
|
||||||
|
|
||||||
|
*(Self-correction: Removed detailed Resource implementation examples as they were less relevant to the current user focus on tool execution flow and project roots. Kept the overview.)*
|
||||||
|
|
||||||
## Implementing MCP Support for a Command
|
## Implementing MCP Support for a Command
|
||||||
|
|
||||||
Follow these steps to add MCP support for an existing Task Master command (see [`new_features.mdc`](mdc:.cursor/rules/new_features.mdc) for more detail):
|
Follow these steps to add MCP support for an existing Task Master command (see [`new_features.mdc`](mdc:.cursor/rules/new_features.mdc) for more detail):
|
||||||
|
|
||||||
1. **Ensure Core Logic Exists**: Verify the core functionality is implemented and exported from the relevant module in `scripts/modules/`.
|
1. **Ensure Core Logic Exists**: Verify the core functionality is implemented and exported from the relevant module in `scripts/modules/`. Ensure the core function can suppress console output (e.g., via an `outputFormat` parameter).
|
||||||
2. **Create Direct Wrapper**: In [`task-master-core.js`](mdc:mcp-server/src/core/task-master-core.js):
|
|
||||||
- Import the core function.
|
2. **Create Direct Function File in `mcp-server/src/core/direct-functions/`**:
|
||||||
- Import `getCachedOrExecute` from `../tools/utils.js`.
|
- Create a new file (e.g., `your-command.js`) using **kebab-case** naming.
|
||||||
- Create an `async function yourCommandDirect(args, log)` wrapper.
|
- Import necessary core functions, `findTasksJsonPath`, silent mode utilities, and potentially AI client/prompt utilities.
|
||||||
- Inside the wrapper:
|
- Implement `async function yourCommandDirect(args, log, context = {})` using **camelCase** with `Direct` suffix. **Remember `context` should only contain `{ session }` if needed (for AI keys/config).**
|
||||||
- Determine arguments needed for both the core logic and the cache key (e.g., `tasksPath`, filters). Use `findTasksJsonPath(args, log)` if needed.
|
- **Path Resolution**: Obtain `tasksPath` using `findTasksJsonPath(args, log)`.
|
||||||
- **Generate a unique `cacheKey`** based on the arguments that define a distinct operation (e.g., `\`yourCommand:${tasksPath}:${filter}\``).
|
- Parse other `args` and perform necessary validation.
|
||||||
- **Define the `coreActionFn`**: An `async` function that contains the actual call to the imported core logic function, handling its specific errors and returning `{ success: true/false, data/error }`.
|
- **Handle AI (if applicable)**: Initialize clients using `get*ClientForMCP(session, log)`, build prompts, call AI, parse response. Handle AI-specific errors.
|
||||||
- **Call `getCachedOrExecute`**:
|
- **Implement Caching (if applicable)**: Use `getCachedOrExecute`.
|
||||||
```javascript
|
- **Call Core Logic**:
|
||||||
const result = await getCachedOrExecute({
|
- Wrap with `enableSilentMode/disableSilentMode` if necessary.
|
||||||
cacheKey,
|
- Pass `outputFormat: 'json'` (or similar) if applicable.
|
||||||
actionFn: coreActionFn, // The function wrapping the core logic call
|
- Handle errors from the core function.
|
||||||
log
|
- Format the return as `{ success: true/false, data/error, fromCache?: boolean }`.
|
||||||
});
|
- ❌ **DON'T**: Call `reportProgress`.
|
||||||
return result; // Returns { success, data/error, fromCache }
|
- Export the wrapper function.
|
||||||
```
|
|
||||||
- Export the wrapper function and add it to the `directFunctions` map.
|
3. **Update `task-master-core.js` with Import/Export**: Import and re-export your `*Direct` function and add it to the `directFunctions` map.
|
||||||
3. **Create MCP Tool**: In `mcp-server/src/tools/`:
|
|
||||||
- Create a new file (e.g., `yourCommand.js`).
|
4. **Create MCP Tool (`mcp-server/src/tools/`)**:
|
||||||
- Import `z` for parameter schema definition.
|
- Create a new file (e.g., `your-command.js`) using **kebab-case**.
|
||||||
- Import `executeMCPToolAction` from [`./utils.js`](mdc:mcp-server/src/tools/utils.js).
|
- Import `zod`, `handleApiResult`, `createErrorResponse`, `getProjectRootFromSession`, and your `yourCommandDirect` function. Import `AsyncOperationManager` if needed.
|
||||||
- Import the `yourCommandDirect` wrapper function from `../core/task-master-core.js`.
|
- Implement `registerYourCommandTool(server)`.
|
||||||
- Implement `registerYourCommandTool(server)`:
|
- Define the tool `name` using **snake_case** (e.g., `your_command`).
|
||||||
- Call `server.addTool`.
|
- Define the `parameters` using `zod`. Include `projectRoot: z.string().optional()`.
|
||||||
- Define `name`, `description`, and `parameters` using `zod`. Include `projectRoot` and `file` as optional parameters if relevant.
|
- Implement the `async execute(args, { log, session })` method (omitting `reportProgress` from destructuring).
|
||||||
- Define the `async execute(args, log)` function.
|
- Get `rootFolder` using `getProjectRootFromSession(session, log)`.
|
||||||
- Inside `execute`, call `executeMCPToolAction`:
|
- **Determine Execution Strategy**:
|
||||||
```javascript
|
- **If using `AsyncOperationManager`**: Create the operation, call the `*Direct` function from within the async task callback (passing `log` and `{ session }`), report progress *from the callback*, and return the initial `ACCEPTED` response.
|
||||||
return executeMCPToolAction({
|
- **If calling `*Direct` function synchronously** (like `add-task`): Call `await yourCommandDirect({ ...args, projectRoot }, log, { session });`. Handle the result with `handleApiResult`.
|
||||||
actionFn: yourCommandDirect, // The direct function wrapper
|
- ❌ **DON'T**: Pass `reportProgress` down to the direct function in either case.
|
||||||
args, // Arguments from the tool call
|
|
||||||
log, // MCP logger instance
|
5. **Register Tool**: Import and call `registerYourCommandTool` in `mcp-server/src/tools/index.js`.
|
||||||
actionName: 'Your Command Description', // For logging
|
|
||||||
// processResult: customProcessor // Optional: if default filtering isn't enough
|
6. **Update `mcp.json`**: Add the new tool definition to the `tools` array in `.cursor/mcp.json`.
|
||||||
});
|
|
||||||
```
|
|
||||||
4. **Register Tool**: Import and call `registerYourCommandTool` in [`mcp-server/src/tools/index.js`](mdc:mcp-server/src/tools/index.js).
|
|
||||||
5. **Update `mcp.json`**: Add the new tool definition to the `tools` array in `.cursor/mcp.json`.
|
|
||||||
|
|
||||||
## Handling Responses
|
## Handling Responses
|
||||||
|
|
||||||
- MCP tools should return data formatted by `createContentResponse` (which stringifies objects) or `createErrorResponse`.
|
- MCP tools should return the object generated by `handleApiResult`.
|
||||||
- The `processMCPResponseData` utility automatically removes potentially large fields like `details` and `testStrategy` from task objects before they are returned. This is the default behavior when using `executeMCPToolAction`. If specific fields need to be preserved or different fields removed, a custom `processResult` function can be passed to `executeMCPToolAction`.
|
- `handleApiResult` uses `createContentResponse` or `createErrorResponse` internally.
|
||||||
- The `handleApiResult` utility (used by `executeMCPToolAction`) now expects the result object from the direct function wrapper to include a `fromCache` boolean flag. This flag is included in the final JSON response sent to the MCP client, nested alongside the actual data (e.g., `{ "fromCache": true, "data": { ... } }`).
|
- `handleApiResult` also uses `processMCPResponseData` by default to filter potentially large fields (`details`, `testStrategy`) from task data. Provide a custom processor function to `handleApiResult` if different filtering is needed.
|
||||||
|
- The final JSON response sent to the MCP client will include the `fromCache` boolean flag (obtained from the `*Direct` function's result) alongside the actual data (e.g., `{ "fromCache": true, "data": { ... } }` or `{ "fromCache": false, "data": { ... } }`).
|
||||||
|
|
||||||
|
## Parameter Type Handling
|
||||||
|
|
||||||
|
- **Prefer Direct Function Calls**: For optimal performance and error handling, MCP tools should utilize direct function wrappers defined in [`task-master-core.js`](mdc:mcp-server/src/core/task-master-core.js). These wrappers call the underlying logic from the core modules (e.g., [`task-manager.js`](mdc:scripts/modules/task-manager.js)).
|
||||||
|
- **Standard Tool Execution Pattern**:
|
||||||
|
- The `execute` method within each MCP tool (in `mcp-server/src/tools/*.js`) should:
|
||||||
|
1. Call the corresponding `*Direct` function wrapper (e.g., `listTasksDirect`) from [`task-master-core.js`](mdc:mcp-server/src/core/task-master-core.js), passing necessary arguments and the logger.
|
||||||
|
2. Receive the result object (typically `{ success, data/error, fromCache }`).
|
||||||
|
3. Pass this result object to the `handleApiResult` utility (from [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js)) for standardized response formatting and error handling.
|
||||||
|
4. Return the formatted response object provided by `handleApiResult`.
|
||||||
|
- **CLI Execution as Fallback**: The `executeTaskMasterCommand` utility in [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js) allows executing commands via the CLI (`task-master ...`). This should **only** be used as a fallback if a direct function wrapper is not yet implemented or if a specific command intrinsically requires CLI execution.
|
||||||
|
- **Centralized Utilities** (See also: [`utilities.mdc`](mdc:.cursor/rules/utilities.mdc)):
|
||||||
|
- Use `findTasksJsonPath` (in [`task-master-core.js`](mdc:mcp-server/src/core/task-master-core.js)) *within direct function wrappers* to locate the `tasks.json` file consistently.
|
||||||
|
- **Leverage MCP Utilities**: The file [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js) contains essential helpers for MCP tool implementation:
|
||||||
|
- `getProjectRoot`: Normalizes project paths.
|
||||||
|
- `handleApiResult`: Takes the raw result from a `*Direct` function and formats it into a standard MCP success or error response, automatically handling data processing via `processMCPResponseData`. This is called by the tool's `execute` method.
|
||||||
|
- `createContentResponse`/`createErrorResponse`: Used by `handleApiResult` to format successful/error MCP responses.
|
||||||
|
- `processMCPResponseData`: Filters/cleans data (e.g., removing `details`, `testStrategy`) before it's sent in the MCP response. Called by `handleApiResult`.
|
||||||
|
- `getCachedOrExecute`: **Used inside `*Direct` functions** in `task-master-core.js` to implement caching logic.
|
||||||
|
- `executeTaskMasterCommand`: Fallback for executing CLI commands.
|
||||||
|
- **Caching**: To improve performance for frequently called read operations (like `listTasks`, `showTask`, `nextTask`), a caching layer using `lru-cache` is implemented.
|
||||||
|
- **Caching logic resides *within* the direct function wrappers** in [`task-master-core.js`](mdc:mcp-server/src/core/task-master-core.js) using the `getCachedOrExecute` utility from [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js).
|
||||||
|
- Generate unique cache keys based on function arguments that define a distinct call (e.g., file path, filters).
|
||||||
|
- The `getCachedOrExecute` utility handles checking the cache, executing the core logic function on a cache miss, storing the result, and returning the data along with a `fromCache` flag.
|
||||||
|
- Cache statistics can be monitored using the `cacheStats` MCP tool (implemented via `getCacheStatsDirect`).
|
||||||
|
- **Caching should generally be applied to read-only operations** that don't modify the `tasks.json` state. Commands like `set-status`, `add-task`, `update-task`, `parse-prd`, `add-dependency` should *not* be cached as they change the underlying data.
|
||||||
|
|
||||||
|
**MCP Tool Implementation Checklist**:
|
||||||
|
|
||||||
|
1. **Core Logic Verification**:
|
||||||
|
- [ ] Confirm the core function is properly exported from its module (e.g., `task-manager.js`)
|
||||||
|
- [ ] Identify all required parameters and their types
|
||||||
|
|
||||||
|
2. **Direct Function Wrapper**:
|
||||||
|
- [ ] Create the `*Direct` function in the appropriate file in `mcp-server/src/core/direct-functions/`
|
||||||
|
- [ ] Import silent mode utilities and implement them around core function calls
|
||||||
|
- [ ] Handle all parameter validations and type conversions
|
||||||
|
- [ ] Implement path resolving for relative paths
|
||||||
|
- [ ] Add appropriate error handling with standardized error codes
|
||||||
|
- [ ] Add to imports/exports in `task-master-core.js`
|
||||||
|
|
||||||
|
3. **MCP Tool Implementation**:
|
||||||
|
- [ ] Create new file in `mcp-server/src/tools/` with kebab-case naming
|
||||||
|
- [ ] Define zod schema for all parameters
|
||||||
|
- [ ] Implement the `execute` method following the standard pattern
|
||||||
|
- [ ] Consider using AsyncOperationManager for long-running operations
|
||||||
|
- [ ] Register tool in `mcp-server/src/tools/index.js`
|
||||||
|
|
||||||
|
4. **Testing**:
|
||||||
|
- [ ] Write unit tests for the direct function wrapper
|
||||||
|
- [ ] Write integration tests for the MCP tool
|
||||||
|
|
||||||
|
## Standard Error Codes
|
||||||
|
|
||||||
|
- **Standard Error Codes**: Use consistent error codes across direct function wrappers
|
||||||
|
- `INPUT_VALIDATION_ERROR`: For missing or invalid required parameters
|
||||||
|
- `FILE_NOT_FOUND_ERROR`: For file system path issues
|
||||||
|
- `CORE_FUNCTION_ERROR`: For errors thrown by the core function
|
||||||
|
- `UNEXPECTED_ERROR`: For all other unexpected errors
|
||||||
|
|
||||||
|
- **Error Object Structure**:
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
success: false,
|
||||||
|
error: {
|
||||||
|
code: 'ERROR_CODE',
|
||||||
|
message: 'Human-readable error message'
|
||||||
|
},
|
||||||
|
fromCache: false
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- **MCP Tool Logging Pattern**:
|
||||||
|
- ✅ DO: Log the start of execution with arguments (sanitized if sensitive)
|
||||||
|
- ✅ DO: Log successful completion with result summary
|
||||||
|
- ✅ DO: Log all error conditions with appropriate log levels
|
||||||
|
- ✅ DO: Include the cache status in result logs
|
||||||
|
- ❌ DON'T: Log entire large data structures or sensitive information
|
||||||
|
|
||||||
|
- The MCP server integrates with Task Master core functions through three layers:
|
||||||
|
1. Tool Definitions (`mcp-server/src/tools/*.js`) - Define parameters and validation
|
||||||
|
2. Direct Functions (`mcp-server/src/core/direct-functions/*.js`) - Handle core logic integration
|
||||||
|
3. Core Functions (`scripts/modules/*.js`) - Implement the actual functionality
|
||||||
|
|
||||||
|
- This layered approach provides:
|
||||||
|
- Clear separation of concerns
|
||||||
|
- Consistent parameter validation
|
||||||
|
- Centralized error handling
|
||||||
|
- Performance optimization through caching (for read operations)
|
||||||
|
- Standardized response formatting
|
||||||
|
|
||||||
|
## MCP Naming Conventions
|
||||||
|
|
||||||
|
- **Files and Directories**:
|
||||||
|
- ✅ DO: Use **kebab-case** for all file names: `list-tasks.js`, `set-task-status.js`
|
||||||
|
- ✅ DO: Use consistent directory structure: `mcp-server/src/tools/` for tool definitions, `mcp-server/src/core/direct-functions/` for direct function implementations
|
||||||
|
|
||||||
|
- **JavaScript Functions**:
|
||||||
|
- ✅ DO: Use **camelCase** with `Direct` suffix for direct function implementations: `listTasksDirect`, `setTaskStatusDirect`
|
||||||
|
- ✅ DO: Use **camelCase** with `Tool` suffix for tool registration functions: `registerListTasksTool`, `registerSetTaskStatusTool`
|
||||||
|
- ✅ DO: Use consistent action function naming inside direct functions: `coreActionFn` or similar descriptive name
|
||||||
|
|
||||||
|
- **MCP Tool Names**:
|
||||||
|
- ✅ DO: Use **snake_case** for tool names exposed to MCP clients: `list_tasks`, `set_task_status`, `parse_prd_document`
|
||||||
|
- ✅ DO: Include the core action in the tool name without redundant words: Use `list_tasks` instead of `list_all_tasks`
|
||||||
|
|
||||||
|
- **Examples**:
|
||||||
|
- File: `list-tasks.js`
|
||||||
|
- Direct Function: `listTasksDirect`
|
||||||
|
- Tool Registration: `registerListTasksTool`
|
||||||
|
- MCP Tool Name: `list_tasks`
|
||||||
|
|
||||||
|
- **Mapping**:
|
||||||
|
- The `directFunctions` map in `task-master-core.js` maps the core function name (in camelCase) to its direct implementation:
|
||||||
|
```javascript
|
||||||
|
export const directFunctions = {
|
||||||
|
list: listTasksDirect,
|
||||||
|
setStatus: setTaskStatusDirect,
|
||||||
|
// Add more functions as implemented
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
## Telemetry Integration
|
||||||
|
|
||||||
|
- Direct functions calling core logic that involves AI should receive and pass through `telemetryData` within their successful `data` payload. See [`telemetry.mdc`](mdc:.cursor/rules/telemetry.mdc) for the standard pattern.
|
||||||
|
- MCP tools use `handleApiResult`, which ensures the `data` object (potentially including `telemetryData`) from the direct function is correctly included in the final response.
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ description: Guidelines for integrating new features into the Task Master CLI
|
|||||||
globs: scripts/modules/*.js
|
globs: scripts/modules/*.js
|
||||||
alwaysApply: false
|
alwaysApply: false
|
||||||
---
|
---
|
||||||
|
|
||||||
# Task Master Feature Integration Guidelines
|
# Task Master Feature Integration Guidelines
|
||||||
|
|
||||||
## Feature Placement Decision Process
|
## Feature Placement Decision Process
|
||||||
@@ -25,11 +24,183 @@ alwaysApply: false
|
|||||||
The standard pattern for adding a feature follows this workflow:
|
The standard pattern for adding a feature follows this workflow:
|
||||||
|
|
||||||
1. **Core Logic**: Implement the business logic in the appropriate module (e.g., [`task-manager.js`](mdc:scripts/modules/task-manager.js)).
|
1. **Core Logic**: Implement the business logic in the appropriate module (e.g., [`task-manager.js`](mdc:scripts/modules/task-manager.js)).
|
||||||
2. **UI Components**: Add any display functions to [`ui.js`](mdc:scripts/modules/ui.js) following [`ui.mdc`](mdc:.cursor/rules/ui.mdc).
|
2. **Context Gathering (If Applicable)**:
|
||||||
3. **Command Integration**: Add the CLI command to [`commands.js`](mdc:scripts/modules/commands.js) following [`commands.mdc`](mdc:.cursor/rules/commands.mdc).
|
- For AI-powered commands that benefit from project context, use the standardized context gathering patterns from [`context_gathering.mdc`](mdc:.cursor/rules/context_gathering.mdc).
|
||||||
4. **Testing**: Write tests for all components of the feature (following [`tests.mdc`](mdc:.cursor/rules/tests.mdc))
|
- Import `ContextGatherer` and `FuzzyTaskSearch` utilities for reusable context extraction.
|
||||||
5. **Configuration**: Update any configuration in [`utils.js`](mdc:scripts/modules/utils.js) if needed, following [`utilities.mdc`](mdc:.cursor/rules/utilities.mdc).
|
- Support multiple context types: tasks, files, custom text, project tree.
|
||||||
6. **Documentation**: Update help text and documentation in [dev_workflow.mdc](mdc:scripts/modules/dev_workflow.mdc)
|
- Implement detailed token breakdown display for transparency.
|
||||||
|
3. **AI Integration (If Applicable)**:
|
||||||
|
- Import necessary service functions (e.g., `generateTextService`, `streamTextService`) from [`ai-services-unified.js`](mdc:scripts/modules/ai-services-unified.js).
|
||||||
|
- Prepare parameters (`role`, `session`, `systemPrompt`, `prompt`).
|
||||||
|
- Call the service function.
|
||||||
|
- Handle the response (direct text or stream object).
|
||||||
|
- **Important**: Prefer `generateTextService` for calls sending large context (like stringified JSON) where incremental display is not needed. See [`ai_services.mdc`](mdc:.cursor/rules/ai_services.mdc) for detailed usage patterns and cautions.
|
||||||
|
4. **UI Components**: Add any display functions to [`ui.js`](mdc:scripts/modules/ui.js) following [`ui.mdc`](mdc:.cursor/rules/ui.mdc). Consider enhanced formatting with syntax highlighting for code blocks.
|
||||||
|
5. **Command Integration**: Add the CLI command to [`commands.js`](mdc:scripts/modules/commands.js) following [`commands.mdc`](mdc:.cursor/rules/commands.mdc).
|
||||||
|
6. **Testing**: Write tests for all components of the feature (following [`tests.mdc`](mdc:.cursor/rules/tests.mdc))
|
||||||
|
7. **Configuration**: Update configuration settings or add new ones in [`config-manager.js`](mdc:scripts/modules/config-manager.js) and ensure getters/setters are appropriate. Update documentation in [`utilities.mdc`](mdc:.cursor/rules/utilities.mdc) and [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc). Update the `.taskmasterconfig` structure if needed.
|
||||||
|
8. **Documentation**: Update help text and documentation in [`dev_workflow.mdc`](mdc:.cursor/rules/dev_workflow.mdc) and [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc).
|
||||||
|
|
||||||
|
## Critical Checklist for New Features
|
||||||
|
|
||||||
|
- **Comprehensive Function Exports**:
|
||||||
|
- ✅ **DO**: Export **all core functions, helper functions (like `generateSubtaskPrompt`), and utility methods** needed by your new function or command from their respective modules.
|
||||||
|
- ✅ **DO**: **Explicitly review the module's `export { ... }` block** at the bottom of the file to ensure every required dependency (even seemingly minor helpers like `findTaskById`, `taskExists`, specific prompt generators, AI call handlers, etc.) is included.
|
||||||
|
- ❌ **DON'T**: Assume internal functions are already exported - **always verify**. A missing export will cause runtime errors (e.g., `ReferenceError: generateSubtaskPrompt is not defined`).
|
||||||
|
- **Example**: If implementing a feature that checks task existence, ensure the helper function is in exports:
|
||||||
|
```javascript
|
||||||
|
// At the bottom of your module file:
|
||||||
|
export {
|
||||||
|
// ... existing exports ...
|
||||||
|
yourNewFunction,
|
||||||
|
taskExists, // Helper function used by yourNewFunction
|
||||||
|
findTaskById, // Helper function used by yourNewFunction
|
||||||
|
generateSubtaskPrompt, // Helper needed by expand/add features
|
||||||
|
getSubtasksFromAI, // Helper needed by expand/add features
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Parameter Completeness and Matching**:
|
||||||
|
- ✅ **DO**: Pass all required parameters to functions you call within your implementation
|
||||||
|
- ✅ **DO**: Check function signatures before implementing calls to them
|
||||||
|
- ✅ **DO**: Verify that direct function parameters match their core function counterparts
|
||||||
|
- ✅ **DO**: When implementing a direct function for MCP, ensure it only accepts parameters that exist in the core function
|
||||||
|
- ✅ **DO**: Verify the expected *internal structure* of complex object parameters (like the `mcpLog` object, see mcp.mdc for the required logger wrapper pattern)
|
||||||
|
- ❌ **DON'T**: Add parameters to direct functions that don't exist in core functions
|
||||||
|
- ❌ **DON'T**: Assume default parameter values will handle missing arguments
|
||||||
|
- ❌ **DON'T**: Assume object parameters will work without verifying their required internal structure or methods.
|
||||||
|
- **Example**: When calling file generation, pass all required parameters:
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Pass all required parameters
|
||||||
|
await generateTaskFiles(tasksPath, path.dirname(tasksPath));
|
||||||
|
|
||||||
|
// ❌ DON'T: Omit required parameters
|
||||||
|
await generateTaskFiles(tasksPath); // Error - missing outputDir parameter
|
||||||
|
```
|
||||||
|
|
||||||
|
**Example**: Properly match direct function parameters to core function:
|
||||||
|
```javascript
|
||||||
|
// Core function signature
|
||||||
|
async function expandTask(tasksPath, taskId, numSubtasks, useResearch = false, additionalContext = '', options = {}) {
|
||||||
|
// Implementation...
|
||||||
|
}
|
||||||
|
|
||||||
|
// ✅ DO: Match direct function parameters to core function
|
||||||
|
export async function expandTaskDirect(args, log, context = {}) {
|
||||||
|
// Extract only parameters that exist in the core function
|
||||||
|
const taskId = parseInt(args.id, 10);
|
||||||
|
const numSubtasks = args.num ? parseInt(args.num, 10) : undefined;
|
||||||
|
const useResearch = args.research === true;
|
||||||
|
const additionalContext = args.prompt || '';
|
||||||
|
|
||||||
|
// Call core function with matched parameters
|
||||||
|
const result = await expandTask(
|
||||||
|
tasksPath,
|
||||||
|
taskId,
|
||||||
|
numSubtasks,
|
||||||
|
useResearch,
|
||||||
|
additionalContext,
|
||||||
|
{ mcpLog: log, session: context.session }
|
||||||
|
);
|
||||||
|
|
||||||
|
// Return result
|
||||||
|
return { success: true, data: result, fromCache: false };
|
||||||
|
}
|
||||||
|
|
||||||
|
// ❌ DON'T: Use parameters that don't exist in the core function
|
||||||
|
export async function expandTaskDirect(args, log, context = {}) {
|
||||||
|
// DON'T extract parameters that don't exist in the core function!
|
||||||
|
const force = args.force === true; // ❌ WRONG - 'force' doesn't exist in core function
|
||||||
|
|
||||||
|
// DON'T pass non-existent parameters to core functions
|
||||||
|
const result = await expandTask(
|
||||||
|
tasksPath,
|
||||||
|
args.id,
|
||||||
|
args.num,
|
||||||
|
args.research,
|
||||||
|
args.prompt,
|
||||||
|
force, // ❌ WRONG - this parameter doesn't exist in the core function
|
||||||
|
{ mcpLog: log }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Consistent File Path Handling**:
|
||||||
|
- ✅ DO: Use consistent file naming conventions: `task_${id.toString().padStart(3, '0')}.txt`
|
||||||
|
- ✅ DO: Use `path.join()` for composing file paths
|
||||||
|
- ✅ DO: Use appropriate file extensions (.txt for tasks, .json for data)
|
||||||
|
- ❌ DON'T: Hardcode path separators or inconsistent file extensions
|
||||||
|
- **Example**: Creating file paths for tasks:
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Use consistent file naming and path.join
|
||||||
|
const taskFileName = path.join(
|
||||||
|
path.dirname(tasksPath),
|
||||||
|
`task_${taskId.toString().padStart(3, '0')}.txt`
|
||||||
|
);
|
||||||
|
|
||||||
|
// ❌ DON'T: Use inconsistent naming or string concatenation
|
||||||
|
const taskFileName = path.dirname(tasksPath) + '/' + taskId + '.md';
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Error Handling and Reporting**:
|
||||||
|
- ✅ DO: Use structured error objects with code and message properties
|
||||||
|
- ✅ DO: Include clear error messages identifying the specific problem
|
||||||
|
- ✅ DO: Handle both function-specific errors and potential file system errors
|
||||||
|
- ✅ DO: Log errors at appropriate severity levels
|
||||||
|
- **Example**: Structured error handling in core functions:
|
||||||
|
```javascript
|
||||||
|
try {
|
||||||
|
// Implementation...
|
||||||
|
} catch (error) {
|
||||||
|
log('error', `Error removing task: ${error.message}`);
|
||||||
|
throw {
|
||||||
|
code: 'REMOVE_TASK_ERROR',
|
||||||
|
message: error.message,
|
||||||
|
details: error.stack
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Silent Mode Implementation**:
|
||||||
|
- ✅ **DO**: Import all silent mode utilities together:
|
||||||
|
```javascript
|
||||||
|
import { enableSilentMode, disableSilentMode, isSilentMode } from '../../../../scripts/modules/utils.js';
|
||||||
|
```
|
||||||
|
- ✅ **DO**: Always use `isSilentMode()` function to check global silent mode status, never reference global variables.
|
||||||
|
- ✅ **DO**: Wrap core function calls **within direct functions** using `enableSilentMode()` and `disableSilentMode()` in a `try/finally` block if the core function might produce console output (like banners, spinners, direct `console.log`s) that isn't reliably controlled by an `outputFormat` parameter.
|
||||||
|
```javascript
|
||||||
|
// Direct Function Example:
|
||||||
|
try {
|
||||||
|
// Prefer passing 'json' if the core function reliably handles it
|
||||||
|
const result = await coreFunction(...args, 'json');
|
||||||
|
// OR, if outputFormat is not enough/unreliable:
|
||||||
|
// enableSilentMode(); // Enable *before* the call
|
||||||
|
// const result = await coreFunction(...args);
|
||||||
|
// disableSilentMode(); // Disable *after* the call (typically in finally)
|
||||||
|
|
||||||
|
return { success: true, data: result };
|
||||||
|
} catch (error) {
|
||||||
|
log.error(`Error: ${error.message}`);
|
||||||
|
return { success: false, error: { message: error.message } };
|
||||||
|
} finally {
|
||||||
|
// If you used enable/disable, ensure disable is called here
|
||||||
|
// disableSilentMode();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- ✅ **DO**: Core functions themselves *should* ideally check `outputFormat === 'text'` before displaying UI elements (banners, spinners, boxes) and use internal logging (`log`/`report`) that respects silent mode. The `enable/disableSilentMode` wrapper in the direct function is a safety net.
|
||||||
|
- ✅ **DO**: Handle mixed parameter/global silent mode correctly for functions accepting both (less common now, prefer `outputFormat`):
|
||||||
|
```javascript
|
||||||
|
// Check both the passed parameter and global silent mode
|
||||||
|
const isSilent = silentMode || (typeof silentMode === 'undefined' && isSilentMode());
|
||||||
|
```
|
||||||
|
- ❌ **DON'T**: Forget to disable silent mode in a `finally` block if you enabled it.
|
||||||
|
- ❌ **DON'T**: Access the global `silentMode` flag directly.
|
||||||
|
|
||||||
|
- **Debugging Strategy**:
|
||||||
|
- ✅ **DO**: If an MCP tool fails with vague errors (e.g., JSON parsing issues like `Unexpected token ... is not valid JSON`), **try running the equivalent CLI command directly in the terminal** (e.g., `task-master expand --all`). CLI output often provides much more specific error messages (like missing function definitions or stack traces from the core logic) that pinpoint the root cause.
|
||||||
|
- ❌ **DON'T**: Rely solely on MCP logs if the error is unclear; use the CLI as a complementary debugging tool for core logic issues.
|
||||||
|
|
||||||
|
- **Telemetry Integration**: Ensure AI calls correctly handle and propagate `telemetryData` as described in [`telemetry.mdc`](mdc:.cursor/rules/telemetry.mdc).
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// 1. CORE LOGIC: Add function to appropriate module (example in task-manager.js)
|
// 1. CORE LOGIC: Add function to appropriate module (example in task-manager.js)
|
||||||
@@ -52,7 +223,29 @@ export {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// 2. UI COMPONENTS: Add display function to ui.js
|
// 2. AI Integration: Add import and use necessary service functions
|
||||||
|
import { generateTextService } from './ai-services-unified.js';
|
||||||
|
|
||||||
|
// Example usage:
|
||||||
|
async function handleAIInteraction() {
|
||||||
|
const role = 'user';
|
||||||
|
const session = 'exampleSession';
|
||||||
|
const systemPrompt = 'You are a helpful assistant.';
|
||||||
|
const prompt = 'What is the capital of France?';
|
||||||
|
|
||||||
|
const result = await generateTextService(role, session, systemPrompt, prompt);
|
||||||
|
console.log(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Export from the module
|
||||||
|
export {
|
||||||
|
// ... existing exports ...
|
||||||
|
handleAIInteraction,
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// 3. UI COMPONENTS: Add display function to ui.js
|
||||||
/**
|
/**
|
||||||
* Display archive operation results
|
* Display archive operation results
|
||||||
* @param {string} archivePath - Path to the archive file
|
* @param {string} archivePath - Path to the archive file
|
||||||
@@ -73,7 +266,7 @@ export {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// 3. COMMAND INTEGRATION: Add to commands.js
|
// 4. COMMAND INTEGRATION: Add to commands.js
|
||||||
import { archiveTasks } from './task-manager.js';
|
import { archiveTasks } from './task-manager.js';
|
||||||
import { displayArchiveResults } from './ui.js';
|
import { displayArchiveResults } from './ui.js';
|
||||||
|
|
||||||
@@ -293,7 +486,7 @@ npm test
|
|||||||
For each new feature:
|
For each new feature:
|
||||||
|
|
||||||
1. Add help text to the command definition
|
1. Add help text to the command definition
|
||||||
2. Update [`dev_workflow.mdc`](mdc:scripts/modules/dev_workflow.mdc) with command reference
|
2. Update [`dev_workflow.mdc`](mdc:.cursor/rules/dev_workflow.mdc) with command reference
|
||||||
3. Consider updating [`architecture.mdc`](mdc:.cursor/rules/architecture.mdc) if the feature significantly changes module responsibilities.
|
3. Consider updating [`architecture.mdc`](mdc:.cursor/rules/architecture.mdc) if the feature significantly changes module responsibilities.
|
||||||
|
|
||||||
Follow the existing command reference format:
|
Follow the existing command reference format:
|
||||||
@@ -312,48 +505,416 @@ For more information on module structure, see [`MODULE_PLAN.md`](mdc:scripts/mod
|
|||||||
|
|
||||||
## Adding MCP Server Support for Commands
|
## Adding MCP Server Support for Commands
|
||||||
|
|
||||||
Integrating Task Master commands with the MCP server (for use by tools like Cursor) follows a specific pattern distinct from the CLI command implementation.
|
Integrating Task Master commands with the MCP server (for use by tools like Cursor) follows a specific pattern distinct from the CLI command implementation, prioritizing performance and reliability.
|
||||||
|
|
||||||
- **Goal**: Leverage direct function calls for performance and reliability, avoiding CLI overhead.
|
- **Goal**: Leverage direct function calls to core logic, avoiding CLI overhead.
|
||||||
- **Reference**: See [`mcp.mdc`](mdc:.cursor/rules/mcp.mdc) for full details.
|
- **Reference**: See [`mcp.mdc`](mdc:.cursor/rules/mcp.mdc) for full details.
|
||||||
|
|
||||||
**MCP Integration Workflow**:
|
**MCP Integration Workflow**:
|
||||||
|
|
||||||
1. **Core Logic**: Ensure the command's core logic exists in the appropriate module (e.g., [`task-manager.js`](mdc:scripts/modules/task-manager.js)).
|
1. **Core Logic**: Ensure the command's core logic exists and is exported from the appropriate module (e.g., [`task-manager.js`](mdc:scripts/modules/task-manager.js)).
|
||||||
2. **Direct Function Wrapper**:
|
2. **Direct Function Wrapper (`mcp-server/src/core/direct-functions/`)**:
|
||||||
- In [`task-master-core.js`](mdc:mcp-server/src/core/task-master-core.js), create an `async function yourCommandDirect(args, log)`.
|
- Create a new file (e.g., `your-command.js`) in `mcp-server/src/core/direct-functions/` using **kebab-case** naming.
|
||||||
- This function imports and calls the core logic.
|
- Import the core logic function, necessary MCP utilities like **`findTasksJsonPath` from `../utils/path-utils.js`**, and **silent mode utilities**: `import { enableSilentMode, disableSilentMode } from '../../../../scripts/modules/utils.js';`
|
||||||
- It uses utilities like `findTasksJsonPath` if needed.
|
- Implement an `async function yourCommandDirect(args, log)` using **camelCase** with `Direct` suffix.
|
||||||
- It handles argument parsing and validation specific to the direct call.
|
- **Path Finding**: Inside this function, obtain the `tasksPath` by calling `const tasksPath = findTasksJsonPath(args, log);`. This relies on `args.projectRoot` (derived from the session) being passed correctly.
|
||||||
- **Implement Caching (if applicable)**: For read operations that benefit from caching, use the `getCachedOrExecute` utility here to wrap the core logic call. Generate a unique cache key based on relevant arguments.
|
- Perform validation on other arguments received in `args`.
|
||||||
- It returns a standard `{ success: true/false, data/error, fromCache: boolean }` object.
|
- **Implement Silent Mode**: Wrap core function calls with `enableSilentMode()` and `disableSilentMode()` to prevent logs from interfering with JSON responses.
|
||||||
- Export the function and add it to the `directFunctions` map.
|
- **If Caching**: Implement caching using `getCachedOrExecute` from `../../tools/utils.js`.
|
||||||
3. **MCP Tool File**:
|
- **If Not Caching**: Directly call the core logic function within a try/catch block.
|
||||||
- Create a new file in `mcp-server/src/tools/` (e.g., `yourCommand.js`).
|
- Format the return as `{ success: true/false, data/error, fromCache: boolean }`.
|
||||||
- Import `zod`, `executeMCPToolAction` from `./utils.js`, and your `yourCommandDirect` function.
|
- Export the wrapper function.
|
||||||
- Implement `registerYourCommandTool(server)` which calls `server.addTool`:
|
|
||||||
- Define the tool `name`, `description`, and `parameters` using `zod`. Include optional `projectRoot` and `file` if relevant, following patterns in existing tools.
|
|
||||||
- Define the `async execute(args, log)` method for the tool.
|
|
||||||
- **Crucially**, the `execute` method should primarily call `executeMCPToolAction`:
|
|
||||||
```javascript
|
|
||||||
// In mcp-server/src/tools/yourCommand.js
|
|
||||||
import { executeMCPToolAction } from "./utils.js";
|
|
||||||
import { yourCommandDirect } from "../core/task-master-core.js";
|
|
||||||
import { z } from "zod";
|
|
||||||
|
|
||||||
export function registerYourCommandTool(server) {
|
3. **Update `task-master-core.js` with Import/Export**: Import and re-export your `*Direct` function and add it to the `directFunctions` map.
|
||||||
server.addTool({
|
|
||||||
name: "yourCommand",
|
4. **Create MCP Tool (`mcp-server/src/tools/`)**:
|
||||||
description: "Description of your command.",
|
- Create a new file (e.g., `your-command.js`) using **kebab-case**.
|
||||||
parameters: z.object({ /* zod schema */ }),
|
- Import `zod`, `handleApiResult`, **`withNormalizedProjectRoot` HOF**, and your `yourCommandDirect` function.
|
||||||
async execute(args, log) {
|
- Implement `registerYourCommandTool(server)`.
|
||||||
return executeMCPToolAction({
|
- **Define parameters**: Make `projectRoot` optional (`z.string().optional().describe(...)`) as the HOF handles fallback.
|
||||||
actionFn: yourCommandDirect, // Pass the direct function wrapper
|
- Consider if this operation should run in the background using `AsyncOperationManager`.
|
||||||
args, log, actionName: "Your Command Description"
|
- Implement the standard `execute` method **wrapped with `withNormalizedProjectRoot`**:
|
||||||
});
|
```javascript
|
||||||
}
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
});
|
// args.projectRoot is now normalized
|
||||||
|
const { projectRoot /*, other args */ } = args;
|
||||||
|
// ... resolve tasks path if needed using normalized projectRoot ...
|
||||||
|
const result = await yourCommandDirect(
|
||||||
|
{ /* other args */, projectRoot /* if needed by direct func */ },
|
||||||
|
log,
|
||||||
|
{ session }
|
||||||
|
);
|
||||||
|
return handleApiResult(result, log);
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
5. **Register Tool**: Import and call `registerYourCommandTool` in `mcp-server/src/tools/index.js`.
|
||||||
|
|
||||||
|
6. **Update `mcp.json`**: Add the new tool definition to the `tools` array in `.cursor/mcp.json`.
|
||||||
|
|
||||||
|
## Implementing Background Operations
|
||||||
|
|
||||||
|
For long-running operations that should not block the client, use the AsyncOperationManager:
|
||||||
|
|
||||||
|
1. **Identify Background-Appropriate Operations**:
|
||||||
|
- ✅ **DO**: Use async operations for CPU-intensive tasks like task expansion or PRD parsing
|
||||||
|
- ✅ **DO**: Consider async operations for tasks that may take more than 1-2 seconds
|
||||||
|
- ❌ **DON'T**: Use async operations for quick read/status operations
|
||||||
|
- ❌ **DON'T**: Use async operations when immediate feedback is critical
|
||||||
|
|
||||||
|
2. **Use AsyncOperationManager in MCP Tools**:
|
||||||
|
```javascript
|
||||||
|
import { asyncOperationManager } from '../core/utils/async-manager.js';
|
||||||
|
|
||||||
|
// In execute method:
|
||||||
|
const operationId = asyncOperationManager.addOperation(
|
||||||
|
expandTaskDirect, // The direct function to run in background
|
||||||
|
{ ...args, projectRoot: rootFolder }, // Args to pass to the function
|
||||||
|
{ log, reportProgress, session } // Context to preserve for the operation
|
||||||
|
);
|
||||||
|
|
||||||
|
// Return immediate response with operation ID
|
||||||
|
return createContentResponse({
|
||||||
|
message: "Operation started successfully",
|
||||||
|
operationId,
|
||||||
|
status: "pending"
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Implement Progress Reporting**:
|
||||||
|
- ✅ **DO**: Use the reportProgress function in direct functions:
|
||||||
|
```javascript
|
||||||
|
// In your direct function:
|
||||||
|
if (reportProgress) {
|
||||||
|
await reportProgress({ progress: 50 }); // 50% complete
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- AsyncOperationManager will forward progress updates to the client
|
||||||
|
|
||||||
|
4. **Check Operation Status**:
|
||||||
|
- Implement a way for clients to check status using the `get_operation_status` MCP tool
|
||||||
|
- Return appropriate status codes and messages
|
||||||
|
|
||||||
|
## Project Initialization
|
||||||
|
|
||||||
|
When implementing project initialization commands:
|
||||||
|
|
||||||
|
1. **Support Programmatic Initialization**:
|
||||||
|
- ✅ **DO**: Design initialization to work with both CLI and MCP
|
||||||
|
- ✅ **DO**: Support non-interactive modes with sensible defaults
|
||||||
|
- ✅ **DO**: Handle project metadata like name, description, version
|
||||||
|
- ✅ **DO**: Create necessary files and directories
|
||||||
|
|
||||||
|
2. **In MCP Tool Implementation**:
|
||||||
|
```javascript
|
||||||
|
// In initialize-project.js MCP tool:
|
||||||
|
import { z } from "zod";
|
||||||
|
import { initializeProjectDirect } from "../core/task-master-core.js";
|
||||||
|
|
||||||
|
export function registerInitializeProjectTool(server) {
|
||||||
|
server.addTool({
|
||||||
|
name: "initialize_project",
|
||||||
|
description: "Initialize a new Task Master project",
|
||||||
|
parameters: z.object({
|
||||||
|
projectName: z.string().optional().describe("The name for the new project"),
|
||||||
|
projectDescription: z.string().optional().describe("A brief description"),
|
||||||
|
projectVersion: z.string().optional().describe("Initial version (e.g., '0.1.0')"),
|
||||||
|
// Add other parameters as needed
|
||||||
|
}),
|
||||||
|
execute: async (args, { log, reportProgress, session }) => {
|
||||||
|
try {
|
||||||
|
// No need for project root since we're creating a new project
|
||||||
|
const result = await initializeProjectDirect(args, log);
|
||||||
|
return handleApiResult(result, log, 'Error initializing project');
|
||||||
|
} catch (error) {
|
||||||
|
log.error(`Error in initialize_project: ${error.message}`);
|
||||||
|
return createErrorResponse(`Failed to initialize project: ${error.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Feature Planning
|
||||||
|
|
||||||
|
- **Core Logic First**:
|
||||||
|
- ✅ DO: Implement core logic in `scripts/modules/` before CLI or MCP interfaces
|
||||||
|
- ✅ DO: Consider tagged task lists system compatibility from the start
|
||||||
|
- ✅ DO: Design functions to work with both legacy and tagged data formats
|
||||||
|
- ✅ DO: Use tag resolution functions (`getTasksForTag`, `setTasksForTag`) for task data access
|
||||||
|
- ❌ DON'T: Directly manipulate tagged data structure in new features
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Design tagged-aware core functions
|
||||||
|
async function newFeatureCore(tasksPath, featureParams, options = {}) {
|
||||||
|
const tasksData = readJSON(tasksPath);
|
||||||
|
const currentTag = getCurrentTag() || 'master';
|
||||||
|
const tasks = getTasksForTag(tasksData, currentTag);
|
||||||
|
|
||||||
|
// Perform feature logic on tasks array
|
||||||
|
const result = performFeatureLogic(tasks, featureParams);
|
||||||
|
|
||||||
|
// Save back using tag resolution
|
||||||
|
setTasksForTag(tasksData, currentTag, tasks);
|
||||||
|
writeJSON(tasksPath, tasksData);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Backward Compatibility**:
|
||||||
|
- ✅ DO: Ensure new features work with existing projects seamlessly
|
||||||
|
- ✅ DO: Test with both legacy and tagged task data formats
|
||||||
|
- ✅ DO: Support silent migration during feature usage
|
||||||
|
- ❌ DON'T: Break existing workflows when adding tagged system features
|
||||||
|
|
||||||
|
## CLI Command Implementation
|
||||||
|
|
||||||
|
- **Command Structure**:
|
||||||
|
- ✅ DO: Follow the established pattern in [`commands.js`](mdc:scripts/modules/commands.js)
|
||||||
|
- ✅ DO: Use Commander.js for argument parsing
|
||||||
|
- ✅ DO: Include comprehensive help text and examples
|
||||||
|
- ✅ DO: Support tagged task context awareness
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Implement CLI commands with tagged system awareness
|
||||||
|
program
|
||||||
|
.command('new-feature')
|
||||||
|
.description('Description of the new feature with tagged task lists support')
|
||||||
|
.option('-t, --tag <tag>', 'Specify tag context (defaults to current tag)')
|
||||||
|
.option('-p, --param <value>', 'Feature-specific parameter')
|
||||||
|
.option('--force', 'Force operation without confirmation')
|
||||||
|
.action(async (options) => {
|
||||||
|
try {
|
||||||
|
const projectRoot = findProjectRoot();
|
||||||
|
if (!projectRoot) {
|
||||||
|
console.error('Not in a Task Master project directory');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use specified tag or current tag
|
||||||
|
const targetTag = options.tag || getCurrentTag() || 'master';
|
||||||
|
|
||||||
|
const result = await newFeatureCore(
|
||||||
|
path.join(projectRoot, '.taskmaster', 'tasks', 'tasks.json'),
|
||||||
|
{ param: options.param },
|
||||||
|
{
|
||||||
|
force: options.force,
|
||||||
|
targetTag: targetTag,
|
||||||
|
outputFormat: 'text'
|
||||||
}
|
}
|
||||||
```
|
);
|
||||||
4. **Register in Tool Index**: Import and call `registerYourCommandTool` in [`mcp-server/src/tools/index.js`](mdc:mcp-server/src/tools/index.js).
|
|
||||||
5. **Update `mcp.json`**: Add the tool definition to `.cursor/mcp.json`.
|
console.log('Feature executed successfully');
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Error: ${error.message}`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Error Handling**:
|
||||||
|
- ✅ DO: Provide clear error messages for common failures
|
||||||
|
- ✅ DO: Handle tagged system migration errors gracefully
|
||||||
|
- ✅ DO: Include suggestion for resolution when possible
|
||||||
|
- ✅ DO: Exit with appropriate codes for scripting
|
||||||
|
|
||||||
|
## MCP Tool Implementation
|
||||||
|
|
||||||
|
- **Direct Function Pattern**:
|
||||||
|
- ✅ DO: Create direct function wrappers in `mcp-server/src/core/direct-functions/`
|
||||||
|
- ✅ DO: Follow silent mode patterns to prevent console output interference
|
||||||
|
- ✅ DO: Use `findTasksJsonPath` for consistent path resolution
|
||||||
|
- ✅ DO: Ensure tagged system compatibility
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Implement MCP direct functions with tagged awareness
|
||||||
|
export async function newFeatureDirect(args, log, context = {}) {
|
||||||
|
try {
|
||||||
|
const tasksPath = findTasksJsonPath(args, log);
|
||||||
|
|
||||||
|
// Enable silent mode for clean MCP responses
|
||||||
|
enableSilentMode();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await newFeatureCore(
|
||||||
|
tasksPath,
|
||||||
|
{ param: args.param },
|
||||||
|
{
|
||||||
|
force: args.force,
|
||||||
|
targetTag: args.tag || 'master', // Support tag specification
|
||||||
|
mcpLog: log,
|
||||||
|
session: context.session,
|
||||||
|
outputFormat: 'json'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: result,
|
||||||
|
fromCache: false
|
||||||
|
};
|
||||||
|
} finally {
|
||||||
|
disableSilentMode();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
log.error(`Error in newFeatureDirect: ${error.message}`);
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error: { code: 'FEATURE_ERROR', message: error.message },
|
||||||
|
fromCache: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Tool Registration**:
|
||||||
|
- ✅ DO: Create tool definitions in `mcp-server/src/tools/`
|
||||||
|
- ✅ DO: Use Zod for parameter validation
|
||||||
|
- ✅ DO: Include optional tag parameter for multi-context support
|
||||||
|
- ✅ DO: Follow established naming conventions
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Register MCP tools with tagged system support
|
||||||
|
export function registerNewFeatureTool(server) {
|
||||||
|
server.addTool({
|
||||||
|
name: "new_feature",
|
||||||
|
description: "Description of the new feature with tagged task lists support",
|
||||||
|
inputSchema: z.object({
|
||||||
|
param: z.string().describe("Feature-specific parameter"),
|
||||||
|
tag: z.string().optional().describe("Target tag context (defaults to current tag)"),
|
||||||
|
force: z.boolean().optional().describe("Force operation without confirmation"),
|
||||||
|
projectRoot: z.string().optional().describe("Project root directory")
|
||||||
|
}),
|
||||||
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
|
try {
|
||||||
|
const result = await newFeatureDirect(
|
||||||
|
{ ...args, projectRoot: args.projectRoot },
|
||||||
|
log,
|
||||||
|
{ session }
|
||||||
|
);
|
||||||
|
return handleApiResult(result, log);
|
||||||
|
} catch (error) {
|
||||||
|
return handleApiResult({
|
||||||
|
success: false,
|
||||||
|
error: { code: 'EXECUTION_ERROR', message: error.message }
|
||||||
|
}, log);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing Strategy
|
||||||
|
|
||||||
|
- **Unit Tests**:
|
||||||
|
- ✅ DO: Test core logic independently with both data formats
|
||||||
|
- ✅ DO: Mock file system operations appropriately
|
||||||
|
- ✅ DO: Test tag resolution behavior
|
||||||
|
- ✅ DO: Verify migration compatibility
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Test new features with tagged system awareness
|
||||||
|
describe('newFeature', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
jest.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should work with legacy task format', async () => {
|
||||||
|
const legacyData = { tasks: [/* test data */] };
|
||||||
|
fs.readFileSync.mockReturnValue(JSON.stringify(legacyData));
|
||||||
|
|
||||||
|
const result = await newFeatureCore('/test/tasks.json', { param: 'test' });
|
||||||
|
|
||||||
|
expect(result).toBeDefined();
|
||||||
|
// Test legacy format handling
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should work with tagged task format', async () => {
|
||||||
|
const taggedData = {
|
||||||
|
master: { tasks: [/* test data */] },
|
||||||
|
feature: { tasks: [/* test data */] }
|
||||||
|
};
|
||||||
|
fs.readFileSync.mockReturnValue(JSON.stringify(taggedData));
|
||||||
|
|
||||||
|
const result = await newFeatureCore('/test/tasks.json', { param: 'test' });
|
||||||
|
|
||||||
|
expect(result).toBeDefined();
|
||||||
|
// Test tagged format handling
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle tag migration during feature usage', async () => {
|
||||||
|
const legacyData = { tasks: [/* test data */] };
|
||||||
|
fs.readFileSync.mockReturnValue(JSON.stringify(legacyData));
|
||||||
|
|
||||||
|
await newFeatureCore('/test/tasks.json', { param: 'test' });
|
||||||
|
|
||||||
|
// Verify migration occurred
|
||||||
|
expect(fs.writeFileSync).toHaveBeenCalledWith(
|
||||||
|
'/test/tasks.json',
|
||||||
|
expect.stringContaining('"master"')
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Integration Tests**:
|
||||||
|
- ✅ DO: Test CLI and MCP interfaces with real task data
|
||||||
|
- ✅ DO: Verify end-to-end workflows across tag contexts
|
||||||
|
- ✅ DO: Test error scenarios and recovery
|
||||||
|
|
||||||
|
## Documentation Updates
|
||||||
|
|
||||||
|
- **Rule Updates**:
|
||||||
|
- ✅ DO: Update relevant `.cursor/rules/*.mdc` files
|
||||||
|
- ✅ DO: Include tagged system considerations in architecture docs
|
||||||
|
- ✅ DO: Add examples showing multi-context usage
|
||||||
|
- ✅ DO: Update workflow documentation as needed
|
||||||
|
|
||||||
|
- **User Documentation**:
|
||||||
|
- ✅ DO: Add feature documentation to `/docs` folder
|
||||||
|
- ✅ DO: Include tagged system usage examples
|
||||||
|
- ✅ DO: Update command reference documentation
|
||||||
|
- ✅ DO: Provide migration notes if relevant
|
||||||
|
|
||||||
|
## Migration Considerations
|
||||||
|
|
||||||
|
- **Silent Migration Support**:
|
||||||
|
- ✅ DO: Ensure new features trigger migration when needed
|
||||||
|
- ✅ DO: Handle migration errors gracefully in feature code
|
||||||
|
- ✅ DO: Test feature behavior with pre-migration projects
|
||||||
|
- ❌ DON'T: Assume projects are already migrated
|
||||||
|
|
||||||
|
- **Tag Context Handling**:
|
||||||
|
- ✅ DO: Default to current tag when not specified
|
||||||
|
- ✅ DO: Support explicit tag selection in advanced features
|
||||||
|
- ✅ DO: Validate tag existence before operations
|
||||||
|
- ✅ DO: Provide clear messaging about tag context
|
||||||
|
|
||||||
|
## Performance Considerations
|
||||||
|
|
||||||
|
- **Efficient Tag Operations**:
|
||||||
|
- ✅ DO: Minimize file I/O operations per feature execution
|
||||||
|
- ✅ DO: Cache tag resolution results when appropriate
|
||||||
|
- ✅ DO: Use streaming for large task datasets
|
||||||
|
- ❌ DON'T: Load all tags when only one is needed
|
||||||
|
|
||||||
|
- **Memory Management**:
|
||||||
|
- ✅ DO: Process large task lists efficiently
|
||||||
|
- ✅ DO: Clean up temporary data structures
|
||||||
|
- ✅ DO: Avoid keeping all tag data in memory simultaneously
|
||||||
|
|
||||||
|
## Deployment and Versioning
|
||||||
|
|
||||||
|
- **Changesets**:
|
||||||
|
- ✅ DO: Create appropriate changesets for new features
|
||||||
|
- ✅ DO: Use semantic versioning (minor for new features)
|
||||||
|
- ✅ DO: Include tagged system information in release notes
|
||||||
|
- ✅ DO: Document breaking changes if any
|
||||||
|
|
||||||
|
- **Feature Flags**:
|
||||||
|
- ✅ DO: Consider feature flags for experimental functionality
|
||||||
|
- ✅ DO: Ensure tagged system features work with flags
|
||||||
|
- ✅ DO: Provide clear documentation about flag usage
|
||||||
|
|
||||||
|
By following these guidelines, new features will integrate smoothly with the Task Master ecosystem while supporting the enhanced tagged task lists system for multi-context development workflows.
|
||||||
|
|||||||
@@ -69,5 +69,4 @@ alwaysApply: true
|
|||||||
- Update references to external docs
|
- Update references to external docs
|
||||||
- Maintain links between related rules
|
- Maintain links between related rules
|
||||||
- Document breaking changes
|
- Document breaking changes
|
||||||
|
Follow [cursor_rules.mdc](mdc:.cursor/rules/cursor_rules.mdc) for proper rule formatting and structure.
|
||||||
Follow [cursor_rules.mdc](mdc:.cursor/rules/cursor_rules.mdc) for proper rule formatting and structure.
|
|
||||||
|
|||||||
229
.cursor/rules/tags.mdc
Normal file
229
.cursor/rules/tags.mdc
Normal file
@@ -0,0 +1,229 @@
|
|||||||
|
---
|
||||||
|
description:
|
||||||
|
globs: scripts/modules/*
|
||||||
|
alwaysApply: false
|
||||||
|
---
|
||||||
|
# Tagged Task Lists Command Patterns
|
||||||
|
|
||||||
|
This document outlines the standardized patterns that **ALL** Task Master commands must follow to properly support the tagged task lists system.
|
||||||
|
|
||||||
|
## Core Principles
|
||||||
|
|
||||||
|
- **Every command** that reads or writes tasks.json must be tag-aware
|
||||||
|
- **Consistent tag resolution** across all commands using `getCurrentTag(projectRoot)`
|
||||||
|
- **Proper context passing** to core functions with `{ projectRoot, tag }`
|
||||||
|
- **Standardized CLI options** with `--tag <tag>` flag
|
||||||
|
|
||||||
|
## Required Imports
|
||||||
|
|
||||||
|
All command files must import `getCurrentTag`:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Import getCurrentTag in commands.js
|
||||||
|
import {
|
||||||
|
log,
|
||||||
|
readJSON,
|
||||||
|
writeJSON,
|
||||||
|
findProjectRoot,
|
||||||
|
getCurrentTag
|
||||||
|
} from './utils.js';
|
||||||
|
|
||||||
|
// ✅ DO: Import getCurrentTag in task-manager files
|
||||||
|
import {
|
||||||
|
readJSON,
|
||||||
|
writeJSON,
|
||||||
|
getCurrentTag
|
||||||
|
} from '../utils.js';
|
||||||
|
```
|
||||||
|
|
||||||
|
## CLI Command Pattern
|
||||||
|
|
||||||
|
Every CLI command that operates on tasks must follow this exact pattern:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Standard tag-aware CLI command pattern
|
||||||
|
programInstance
|
||||||
|
.command('command-name')
|
||||||
|
.description('Command description')
|
||||||
|
.option('-f, --file <file>', 'Path to the tasks file', TASKMASTER_TASKS_FILE)
|
||||||
|
.option('--tag <tag>', 'Specify tag context for task operations') // REQUIRED
|
||||||
|
.action(async (options) => {
|
||||||
|
// 1. Find project root
|
||||||
|
const projectRoot = findProjectRoot();
|
||||||
|
if (!projectRoot) {
|
||||||
|
console.error(chalk.red('Error: Could not find project root.'));
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Resolve tag using standard pattern
|
||||||
|
const tag = options.tag || getCurrentTag(projectRoot) || 'master';
|
||||||
|
|
||||||
|
// 3. Call core function with proper context
|
||||||
|
await coreFunction(
|
||||||
|
tasksPath,
|
||||||
|
// ... other parameters ...
|
||||||
|
{ projectRoot, tag } // REQUIRED context object
|
||||||
|
);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Core Function Pattern
|
||||||
|
|
||||||
|
All core functions in `scripts/modules/task-manager/` must follow this pattern:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Standard tag-aware core function pattern
|
||||||
|
async function coreFunction(
|
||||||
|
tasksPath,
|
||||||
|
// ... other parameters ...
|
||||||
|
context = {} // REQUIRED context parameter
|
||||||
|
) {
|
||||||
|
const { projectRoot, tag } = context;
|
||||||
|
|
||||||
|
// Use tag-aware readJSON/writeJSON
|
||||||
|
const data = readJSON(tasksPath, projectRoot, tag);
|
||||||
|
|
||||||
|
// ... function logic ...
|
||||||
|
|
||||||
|
writeJSON(tasksPath, data, projectRoot, tag);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Tag Resolution Priority
|
||||||
|
|
||||||
|
The tag resolution follows this exact priority order:
|
||||||
|
|
||||||
|
1. **Explicit `--tag` flag**: `options.tag`
|
||||||
|
2. **Current active tag**: `getCurrentTag(projectRoot)`
|
||||||
|
3. **Default fallback**: `'master'`
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Standard tag resolution pattern
|
||||||
|
const tag = options.tag || getCurrentTag(projectRoot) || 'master';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Commands Requiring Updates
|
||||||
|
|
||||||
|
### High Priority (Core Task Operations)
|
||||||
|
- [x] `add-task` - ✅ Fixed
|
||||||
|
- [x] `list` - ✅ Fixed
|
||||||
|
- [x] `update-task` - ✅ Fixed
|
||||||
|
- [x] `update-subtask` - ✅ Fixed
|
||||||
|
- [x] `set-status` - ✅ Already correct
|
||||||
|
- [x] `remove-task` - ✅ Already correct
|
||||||
|
- [x] `remove-subtask` - ✅ Fixed
|
||||||
|
- [x] `add-subtask` - ✅ Already correct
|
||||||
|
- [x] `clear-subtasks` - ✅ Fixed
|
||||||
|
- [x] `move-task` - ✅ Already correct
|
||||||
|
|
||||||
|
### Medium Priority (Analysis & Expansion)
|
||||||
|
- [x] `expand` - ✅ Fixed
|
||||||
|
- [ ] `next` - ✅ Fixed
|
||||||
|
- [ ] `show` (get-task) - Needs checking
|
||||||
|
- [ ] `analyze-complexity` - Needs checking
|
||||||
|
- [ ] `generate` - ✅ Fixed
|
||||||
|
|
||||||
|
### Lower Priority (Utilities)
|
||||||
|
- [ ] `research` - Needs checking
|
||||||
|
- [ ] `complexity-report` - Needs checking
|
||||||
|
- [ ] `validate-dependencies` - ✅ Fixed
|
||||||
|
- [ ] `fix-dependencies` - ✅ Fixed
|
||||||
|
- [ ] `add-dependency` - ✅ Fixed
|
||||||
|
- [ ] `remove-dependency` - ✅ Fixed
|
||||||
|
|
||||||
|
## MCP Integration Pattern
|
||||||
|
|
||||||
|
MCP direct functions must also follow the tag-aware pattern:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Tag-aware MCP direct function
|
||||||
|
export async function coreActionDirect(args, log, context = {}) {
|
||||||
|
const { session } = context;
|
||||||
|
const { projectRoot, tag } = args; // MCP passes these in args
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await coreAction(
|
||||||
|
tasksPath,
|
||||||
|
// ... other parameters ...
|
||||||
|
{ projectRoot, tag, session, mcpLog: logWrapper }
|
||||||
|
);
|
||||||
|
|
||||||
|
return { success: true, data: result };
|
||||||
|
} catch (error) {
|
||||||
|
return { success: false, error: { code: 'ERROR_CODE', message: error.message } };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## File Generation Tag-Aware Naming
|
||||||
|
|
||||||
|
The `generate` command must use tag-aware file naming:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Tag-aware file naming
|
||||||
|
const taskFileName = targetTag === 'master'
|
||||||
|
? `task_${task.id.toString().padStart(3, '0')}.txt`
|
||||||
|
: `task_${task.id.toString().padStart(3, '0')}_${targetTag}.txt`;
|
||||||
|
```
|
||||||
|
|
||||||
|
**Examples:**
|
||||||
|
- Master tag: `task_001.txt`, `task_002.txt`
|
||||||
|
- Other tags: `task_001_feature.txt`, `task_002_feature.txt`
|
||||||
|
|
||||||
|
## Common Anti-Patterns
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ❌ DON'T: Missing getCurrentTag import
|
||||||
|
import { readJSON, writeJSON } from '../utils.js'; // Missing getCurrentTag
|
||||||
|
|
||||||
|
// ❌ DON'T: Hard-coded tag resolution
|
||||||
|
const tag = options.tag || 'master'; // Missing getCurrentTag
|
||||||
|
|
||||||
|
// ❌ DON'T: Missing --tag option
|
||||||
|
.option('-f, --file <file>', 'Path to tasks file') // Missing --tag option
|
||||||
|
|
||||||
|
// ❌ DON'T: Missing context parameter
|
||||||
|
await coreFunction(tasksPath, param1, param2); // Missing { projectRoot, tag }
|
||||||
|
|
||||||
|
// ❌ DON'T: Incorrect readJSON/writeJSON calls
|
||||||
|
const data = readJSON(tasksPath); // Missing projectRoot and tag
|
||||||
|
writeJSON(tasksPath, data); // Missing projectRoot and tag
|
||||||
|
```
|
||||||
|
|
||||||
|
## Validation Checklist
|
||||||
|
|
||||||
|
For each command, verify:
|
||||||
|
|
||||||
|
- [ ] Imports `getCurrentTag` from utils.js
|
||||||
|
- [ ] Has `--tag <tag>` CLI option
|
||||||
|
- [ ] Uses standard tag resolution: `options.tag || getCurrentTag(projectRoot) || 'master'`
|
||||||
|
- [ ] Finds `projectRoot` with error handling
|
||||||
|
- [ ] Passes `{ projectRoot, tag }` context to core functions
|
||||||
|
- [ ] Core functions accept and use context parameter
|
||||||
|
- [ ] Uses `readJSON(tasksPath, projectRoot, tag)` and `writeJSON(tasksPath, data, projectRoot, tag)`
|
||||||
|
|
||||||
|
## Testing Tag Resolution
|
||||||
|
|
||||||
|
Test each command with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Test with explicit tag
|
||||||
|
node bin/task-master command-name --tag test-tag
|
||||||
|
|
||||||
|
# Test with active tag (should use current active tag)
|
||||||
|
node bin/task-master use-tag test-tag
|
||||||
|
node bin/task-master command-name
|
||||||
|
|
||||||
|
# Test with master tag (default)
|
||||||
|
node bin/task-master use-tag master
|
||||||
|
node bin/task-master command-name
|
||||||
|
```
|
||||||
|
|
||||||
|
## Migration Strategy
|
||||||
|
|
||||||
|
1. **Audit Phase**: Systematically check each command against the checklist
|
||||||
|
2. **Fix Phase**: Apply the standard patterns to non-compliant commands
|
||||||
|
3. **Test Phase**: Verify tag resolution works correctly
|
||||||
|
4. **Document Phase**: Update command documentation with tag support
|
||||||
|
|
||||||
|
This ensures consistent, predictable behavior across all Task Master commands and prevents tag deletion bugs.
|
||||||
559
.cursor/rules/taskmaster.mdc
Normal file
559
.cursor/rules/taskmaster.mdc
Normal file
@@ -0,0 +1,559 @@
|
|||||||
|
---
|
||||||
|
description: Comprehensive reference for Taskmaster MCP tools and CLI commands.
|
||||||
|
globs: **/*
|
||||||
|
alwaysApply: true
|
||||||
|
---
|
||||||
|
# Taskmaster Tool & Command Reference
|
||||||
|
|
||||||
|
This document provides a detailed reference for interacting with Taskmaster, covering both the recommended MCP tools, suitable for integrations like Cursor, and the corresponding `task-master` CLI commands, designed for direct user interaction or fallback.
|
||||||
|
|
||||||
|
**Note:** For interacting with Taskmaster programmatically or via integrated tools, using the **MCP tools is strongly recommended** due to better performance, structured data, and error handling. The CLI commands serve as a user-friendly alternative and fallback.
|
||||||
|
|
||||||
|
**Important:** Several MCP tools involve AI processing... The AI-powered tools include `parse_prd`, `analyze_project_complexity`, `update_subtask`, `update_task`, `update`, `expand_all`, `expand_task`, and `add_task`.
|
||||||
|
|
||||||
|
**🏷️ Tagged Task Lists System:** Task Master now supports **tagged task lists** for multi-context task management. This allows you to maintain separate, isolated lists of tasks for different features, branches, or experiments. Existing projects are seamlessly migrated to use a default "master" tag. Most commands now support a `--tag <name>` flag to specify which context to operate on. If omitted, commands use the currently active tag.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Initialization & Setup
|
||||||
|
|
||||||
|
### 1. Initialize Project (`init`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `initialize_project`
|
||||||
|
* **CLI Command:** `task-master init [options]`
|
||||||
|
* **Description:** `Set up the basic Taskmaster file structure and configuration in the current directory for a new project.`
|
||||||
|
* **Key CLI Options:**
|
||||||
|
* `--name <name>`: `Set the name for your project in Taskmaster's configuration.`
|
||||||
|
* `--description <text>`: `Provide a brief description for your project.`
|
||||||
|
* `--version <version>`: `Set the initial version for your project, e.g., '0.1.0'.`
|
||||||
|
* `--no-git`: `Skip initializing a Git repository entirely.`
|
||||||
|
* `-y, --yes`: `Initialize Taskmaster quickly using default settings without interactive prompts.`
|
||||||
|
* **Usage:** Run this once at the beginning of a new project.
|
||||||
|
* **MCP Variant Description:** `Set up the basic Taskmaster file structure and configuration in the current directory for a new project by running the 'task-master init' command.`
|
||||||
|
* **Key MCP Parameters/Options:**
|
||||||
|
* `projectName`: `Set the name for your project.` (CLI: `--name <name>`)
|
||||||
|
* `projectDescription`: `Provide a brief description for your project.` (CLI: `--description <text>`)
|
||||||
|
* `projectVersion`: `Set the initial version for your project, e.g., '0.1.0'.` (CLI: `--version <version>`)
|
||||||
|
* `authorName`: `Author name.` (CLI: `--author <author>`)
|
||||||
|
* `skipInstall`: `Skip installing dependencies. Default is false.` (CLI: `--skip-install`)
|
||||||
|
* `addAliases`: `Add shell aliases tm and taskmaster. Default is false.` (CLI: `--aliases`)
|
||||||
|
* `noGit`: `Skip initializing a Git repository entirely. Default is false.` (CLI: `--no-git`)
|
||||||
|
* `yes`: `Skip prompts and use defaults/provided arguments. Default is false.` (CLI: `-y, --yes`)
|
||||||
|
* **Usage:** Run this once at the beginning of a new project, typically via an integrated tool like Cursor. Operates on the current working directory of the MCP server.
|
||||||
|
* **Important:** Once complete, you *MUST* parse a prd in order to generate tasks. There will be no tasks files until then. The next step after initializing should be to create a PRD using the example PRD in .taskmaster/templates/example_prd.txt.
|
||||||
|
* **Tagging:** Use the `--tag` option to parse the PRD into a specific, non-default tag context. If the tag doesn't exist, it will be created automatically. Example: `task-master parse-prd spec.txt --tag=new-feature`.
|
||||||
|
|
||||||
|
### 2. Parse PRD (`parse_prd`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `parse_prd`
|
||||||
|
* **CLI Command:** `task-master parse-prd [file] [options]`
|
||||||
|
* **Description:** `Parse a Product Requirements Document, PRD, or text file with Taskmaster to automatically generate an initial set of tasks in tasks.json.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `input`: `Path to your PRD or requirements text file that Taskmaster should parse for tasks.` (CLI: `[file]` positional or `-i, --input <file>`)
|
||||||
|
* `output`: `Specify where Taskmaster should save the generated 'tasks.json' file. Defaults to '.taskmaster/tasks/tasks.json'.` (CLI: `-o, --output <file>`)
|
||||||
|
* `numTasks`: `Approximate number of top-level tasks Taskmaster should aim to generate from the document.` (CLI: `-n, --num-tasks <number>`)
|
||||||
|
* `force`: `Use this to allow Taskmaster to overwrite an existing 'tasks.json' without asking for confirmation.` (CLI: `-f, --force`)
|
||||||
|
* **Usage:** Useful for bootstrapping a project from an existing requirements document.
|
||||||
|
* **Notes:** Task Master will strictly adhere to any specific requirements mentioned in the PRD, such as libraries, database schemas, frameworks, tech stacks, etc., while filling in any gaps where the PRD isn't fully specified. Tasks are designed to provide the most direct implementation path while avoiding over-engineering.
|
||||||
|
* **Important:** This MCP tool makes AI calls and can take up to a minute to complete. Please inform users to hang tight while the operation is in progress. If the user does not have a PRD, suggest discussing their idea and then use the example PRD in `.taskmaster/templates/example_prd.txt` as a template for creating the PRD based on their idea, for use with `parse-prd`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## AI Model Configuration
|
||||||
|
|
||||||
|
### 2. Manage Models (`models`)
|
||||||
|
* **MCP Tool:** `models`
|
||||||
|
* **CLI Command:** `task-master models [options]`
|
||||||
|
* **Description:** `View the current AI model configuration or set specific models for different roles (main, research, fallback). Allows setting custom model IDs for Ollama and OpenRouter.`
|
||||||
|
* **Key MCP Parameters/Options:**
|
||||||
|
* `setMain <model_id>`: `Set the primary model ID for task generation/updates.` (CLI: `--set-main <model_id>`)
|
||||||
|
* `setResearch <model_id>`: `Set the model ID for research-backed operations.` (CLI: `--set-research <model_id>`)
|
||||||
|
* `setFallback <model_id>`: `Set the model ID to use if the primary fails.` (CLI: `--set-fallback <model_id>`)
|
||||||
|
* `ollama <boolean>`: `Indicates the set model ID is a custom Ollama model.` (CLI: `--ollama`)
|
||||||
|
* `openrouter <boolean>`: `Indicates the set model ID is a custom OpenRouter model.` (CLI: `--openrouter`)
|
||||||
|
* `listAvailableModels <boolean>`: `If true, lists available models not currently assigned to a role.` (CLI: No direct equivalent; CLI lists available automatically)
|
||||||
|
* `projectRoot <string>`: `Optional. Absolute path to the project root directory.` (CLI: Determined automatically)
|
||||||
|
* **Key CLI Options:**
|
||||||
|
* `--set-main <model_id>`: `Set the primary model.`
|
||||||
|
* `--set-research <model_id>`: `Set the research model.`
|
||||||
|
* `--set-fallback <model_id>`: `Set the fallback model.`
|
||||||
|
* `--ollama`: `Specify that the provided model ID is for Ollama (use with --set-*).`
|
||||||
|
* `--openrouter`: `Specify that the provided model ID is for OpenRouter (use with --set-*). Validates against OpenRouter API.`
|
||||||
|
* `--bedrock`: `Specify that the provided model ID is for AWS Bedrock (use with --set-*).`
|
||||||
|
* `--setup`: `Run interactive setup to configure models, including custom Ollama/OpenRouter IDs.`
|
||||||
|
* **Usage (MCP):** Call without set flags to get current config. Use `setMain`, `setResearch`, or `setFallback` with a valid model ID to update the configuration. Use `listAvailableModels: true` to get a list of unassigned models. To set a custom model, provide the model ID and set `ollama: true` or `openrouter: true`.
|
||||||
|
* **Usage (CLI):** Run without flags to view current configuration and available models. Use set flags to update specific roles. Use `--setup` for guided configuration, including custom models. To set a custom model via flags, use `--set-<role>=<model_id>` along with either `--ollama` or `--openrouter`.
|
||||||
|
* **Notes:** Configuration is stored in `.taskmaster/config.json` in the project root. This command/tool modifies that file. Use `listAvailableModels` or `task-master models` to see internally supported models. OpenRouter custom models are validated against their live API. Ollama custom models are not validated live.
|
||||||
|
* **API note:** API keys for selected AI providers (based on their model) need to exist in the mcp.json file to be accessible in MCP context. The API keys must be present in the local .env file for the CLI to be able to read them.
|
||||||
|
* **Model costs:** The costs in supported models are expressed in dollars. An input/output value of 3 is $3.00. A value of 0.8 is $0.80.
|
||||||
|
* **Warning:** DO NOT MANUALLY EDIT THE .taskmaster/config.json FILE. Use the included commands either in the MCP or CLI format as needed. Always prioritize MCP tools when available and use the CLI as a fallback.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Task Listing & Viewing
|
||||||
|
|
||||||
|
### 3. Get Tasks (`get_tasks`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `get_tasks`
|
||||||
|
* **CLI Command:** `task-master list [options]`
|
||||||
|
* **Description:** `List your Taskmaster tasks, optionally filtering by status and showing subtasks.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `status`: `Show only Taskmaster tasks matching this status (or multiple statuses, comma-separated), e.g., 'pending' or 'done,in-progress'.` (CLI: `-s, --status <status>`)
|
||||||
|
* `withSubtasks`: `Include subtasks indented under their parent tasks in the list.` (CLI: `--with-subtasks`)
|
||||||
|
* `tag`: `Specify which tag context to list tasks from. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Get an overview of the project status, often used at the start of a work session.
|
||||||
|
|
||||||
|
### 4. Get Next Task (`next_task`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `next_task`
|
||||||
|
* **CLI Command:** `task-master next [options]`
|
||||||
|
* **Description:** `Ask Taskmaster to show the next available task you can work on, based on status and completed dependencies.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* `tag`: `Specify which tag context to use. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* **Usage:** Identify what to work on next according to the plan.
|
||||||
|
|
||||||
|
### 5. Get Task Details (`get_task`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `get_task`
|
||||||
|
* **CLI Command:** `task-master show [id] [options]`
|
||||||
|
* **Description:** `Display detailed information for one or more specific Taskmaster tasks or subtasks by ID.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `id`: `Required. The ID of the Taskmaster task (e.g., '15'), subtask (e.g., '15.2'), or a comma-separated list of IDs ('1,5,10.2') you want to view.` (CLI: `[id]` positional or `-i, --id <id>`)
|
||||||
|
* `tag`: `Specify which tag context to get the task(s) from. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Understand the full details for a specific task. When multiple IDs are provided, a summary table is shown.
|
||||||
|
* **CRITICAL INFORMATION** If you need to collect information from multiple tasks, use comma-separated IDs (i.e. 1,2,3) to receive an array of tasks. Do not needlessly get tasks one at a time if you need to get many as that is wasteful.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Task Creation & Modification
|
||||||
|
|
||||||
|
### 6. Add Task (`add_task`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `add_task`
|
||||||
|
* **CLI Command:** `task-master add-task [options]`
|
||||||
|
* **Description:** `Add a new task to Taskmaster by describing it; AI will structure it.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `prompt`: `Required. Describe the new task you want Taskmaster to create, e.g., "Implement user authentication using JWT".` (CLI: `-p, --prompt <text>`)
|
||||||
|
* `dependencies`: `Specify the IDs of any Taskmaster tasks that must be completed before this new one can start, e.g., '12,14'.` (CLI: `-d, --dependencies <ids>`)
|
||||||
|
* `priority`: `Set the priority for the new task: 'high', 'medium', or 'low'. Default is 'medium'.` (CLI: `--priority <priority>`)
|
||||||
|
* `research`: `Enable Taskmaster to use the research role for potentially more informed task creation.` (CLI: `-r, --research`)
|
||||||
|
* `tag`: `Specify which tag context to add the task to. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Quickly add newly identified tasks during development.
|
||||||
|
* **Important:** This MCP tool makes AI calls and can take up to a minute to complete. Please inform users to hang tight while the operation is in progress.
|
||||||
|
|
||||||
|
### 7. Add Subtask (`add_subtask`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `add_subtask`
|
||||||
|
* **CLI Command:** `task-master add-subtask [options]`
|
||||||
|
* **Description:** `Add a new subtask to a Taskmaster parent task, or convert an existing task into a subtask.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `id` / `parent`: `Required. The ID of the Taskmaster task that will be the parent.` (MCP: `id`, CLI: `-p, --parent <id>`)
|
||||||
|
* `taskId`: `Use this if you want to convert an existing top-level Taskmaster task into a subtask of the specified parent.` (CLI: `-i, --task-id <id>`)
|
||||||
|
* `title`: `Required if not using taskId. The title for the new subtask Taskmaster should create.` (CLI: `-t, --title <title>`)
|
||||||
|
* `description`: `A brief description for the new subtask.` (CLI: `-d, --description <text>`)
|
||||||
|
* `details`: `Provide implementation notes or details for the new subtask.` (CLI: `--details <text>`)
|
||||||
|
* `dependencies`: `Specify IDs of other tasks or subtasks, e.g., '15' or '16.1', that must be done before this new subtask.` (CLI: `--dependencies <ids>`)
|
||||||
|
* `status`: `Set the initial status for the new subtask. Default is 'pending'.` (CLI: `-s, --status <status>`)
|
||||||
|
* `skipGenerate`: `Prevent Taskmaster from automatically regenerating markdown task files after adding the subtask.` (CLI: `--skip-generate`)
|
||||||
|
* `tag`: `Specify which tag context to operate on. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Break down tasks manually or reorganize existing tasks.
|
||||||
|
|
||||||
|
### 8. Update Tasks (`update`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `update`
|
||||||
|
* **CLI Command:** `task-master update [options]`
|
||||||
|
* **Description:** `Update multiple upcoming tasks in Taskmaster based on new context or changes, starting from a specific task ID.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `from`: `Required. The ID of the first task Taskmaster should update. All tasks with this ID or higher that are not 'done' will be considered.` (CLI: `--from <id>`)
|
||||||
|
* `prompt`: `Required. Explain the change or new context for Taskmaster to apply to the tasks, e.g., "We are now using React Query instead of Redux Toolkit for data fetching".` (CLI: `-p, --prompt <text>`)
|
||||||
|
* `research`: `Enable Taskmaster to use the research role for more informed updates. Requires appropriate API key.` (CLI: `-r, --research`)
|
||||||
|
* `tag`: `Specify which tag context to operate on. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Handle significant implementation changes or pivots that affect multiple future tasks. Example CLI: `task-master update --from='18' --prompt='Switching to React Query.\nNeed to refactor data fetching...'`
|
||||||
|
* **Important:** This MCP tool makes AI calls and can take up to a minute to complete. Please inform users to hang tight while the operation is in progress.
|
||||||
|
|
||||||
|
### 9. Update Task (`update_task`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `update_task`
|
||||||
|
* **CLI Command:** `task-master update-task [options]`
|
||||||
|
* **Description:** `Modify a specific Taskmaster task by ID, incorporating new information or changes. By default, this replaces the existing task details.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `id`: `Required. The specific ID of the Taskmaster task, e.g., '15', you want to update.` (CLI: `-i, --id <id>`)
|
||||||
|
* `prompt`: `Required. Explain the specific changes or provide the new information Taskmaster should incorporate into this task.` (CLI: `-p, --prompt <text>`)
|
||||||
|
* `append`: `If true, appends the prompt content to the task's details with a timestamp, rather than replacing them. Behaves like update-subtask.` (CLI: `--append`)
|
||||||
|
* `research`: `Enable Taskmaster to use the research role for more informed updates. Requires appropriate API key.` (CLI: `-r, --research`)
|
||||||
|
* `tag`: `Specify which tag context the task belongs to. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Refine a specific task based on new understanding. Use `--append` to log progress without creating subtasks.
|
||||||
|
* **Important:** This MCP tool makes AI calls and can take up to a minute to complete. Please inform users to hang tight while the operation is in progress.
|
||||||
|
|
||||||
|
### 10. Update Subtask (`update_subtask`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `update_subtask`
|
||||||
|
* **CLI Command:** `task-master update-subtask [options]`
|
||||||
|
* **Description:** `Append timestamped notes or details to a specific Taskmaster subtask without overwriting existing content. Intended for iterative implementation logging.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `id`: `Required. The ID of the Taskmaster subtask, e.g., '5.2', to update with new information.` (CLI: `-i, --id <id>`)
|
||||||
|
* `prompt`: `Required. The information, findings, or progress notes to append to the subtask's details with a timestamp.` (CLI: `-p, --prompt <text>`)
|
||||||
|
* `research`: `Enable Taskmaster to use the research role for more informed updates. Requires appropriate API key.` (CLI: `-r, --research`)
|
||||||
|
* `tag`: `Specify which tag context the subtask belongs to. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Log implementation progress, findings, and discoveries during subtask development. Each update is timestamped and appended to preserve the implementation journey.
|
||||||
|
* **Important:** This MCP tool makes AI calls and can take up to a minute to complete. Please inform users to hang tight while the operation is in progress.
|
||||||
|
|
||||||
|
### 11. Set Task Status (`set_task_status`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `set_task_status`
|
||||||
|
* **CLI Command:** `task-master set-status [options]`
|
||||||
|
* **Description:** `Update the status of one or more Taskmaster tasks or subtasks, e.g., 'pending', 'in-progress', 'done'.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `id`: `Required. The ID(s) of the Taskmaster task(s) or subtask(s), e.g., '15', '15.2', or '16,17.1', to update.` (CLI: `-i, --id <id>`)
|
||||||
|
* `status`: `Required. The new status to set, e.g., 'done', 'pending', 'in-progress', 'review', 'cancelled'.` (CLI: `-s, --status <status>`)
|
||||||
|
* `tag`: `Specify which tag context to operate on. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Mark progress as tasks move through the development cycle.
|
||||||
|
|
||||||
|
### 12. Remove Task (`remove_task`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `remove_task`
|
||||||
|
* **CLI Command:** `task-master remove-task [options]`
|
||||||
|
* **Description:** `Permanently remove a task or subtask from the Taskmaster tasks list.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `id`: `Required. The ID of the Taskmaster task, e.g., '5', or subtask, e.g., '5.2', to permanently remove.` (CLI: `-i, --id <id>`)
|
||||||
|
* `yes`: `Skip the confirmation prompt and immediately delete the task.` (CLI: `-y, --yes`)
|
||||||
|
* `tag`: `Specify which tag context to operate on. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Permanently delete tasks or subtasks that are no longer needed in the project.
|
||||||
|
* **Notes:** Use with caution as this operation cannot be undone. Consider using 'blocked', 'cancelled', or 'deferred' status instead if you just want to exclude a task from active planning but keep it for reference. The command automatically cleans up dependency references in other tasks.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Task Structure & Breakdown
|
||||||
|
|
||||||
|
### 13. Expand Task (`expand_task`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `expand_task`
|
||||||
|
* **CLI Command:** `task-master expand [options]`
|
||||||
|
* **Description:** `Use Taskmaster's AI to break down a complex task into smaller, manageable subtasks. Appends subtasks by default.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `id`: `The ID of the specific Taskmaster task you want to break down into subtasks.` (CLI: `-i, --id <id>`)
|
||||||
|
* `num`: `Optional: Suggests how many subtasks Taskmaster should aim to create. Uses complexity analysis/defaults otherwise.` (CLI: `-n, --num <number>`)
|
||||||
|
* `research`: `Enable Taskmaster to use the research role for more informed subtask generation. Requires appropriate API key.` (CLI: `-r, --research`)
|
||||||
|
* `prompt`: `Optional: Provide extra context or specific instructions to Taskmaster for generating the subtasks.` (CLI: `-p, --prompt <text>`)
|
||||||
|
* `force`: `Optional: If true, clear existing subtasks before generating new ones. Default is false (append).` (CLI: `--force`)
|
||||||
|
* `tag`: `Specify which tag context the task belongs to. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Generate a detailed implementation plan for a complex task before starting coding. Automatically uses complexity report recommendations if available and `num` is not specified.
|
||||||
|
* **Important:** This MCP tool makes AI calls and can take up to a minute to complete. Please inform users to hang tight while the operation is in progress.
|
||||||
|
|
||||||
|
### 14. Expand All Tasks (`expand_all`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `expand_all`
|
||||||
|
* **CLI Command:** `task-master expand --all [options]` (Note: CLI uses the `expand` command with the `--all` flag)
|
||||||
|
* **Description:** `Tell Taskmaster to automatically expand all eligible pending/in-progress tasks based on complexity analysis or defaults. Appends subtasks by default.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `num`: `Optional: Suggests how many subtasks Taskmaster should aim to create per task.` (CLI: `-n, --num <number>`)
|
||||||
|
* `research`: `Enable research role for more informed subtask generation. Requires appropriate API key.` (CLI: `-r, --research`)
|
||||||
|
* `prompt`: `Optional: Provide extra context for Taskmaster to apply generally during expansion.` (CLI: `-p, --prompt <text>`)
|
||||||
|
* `force`: `Optional: If true, clear existing subtasks before generating new ones for each eligible task. Default is false (append).` (CLI: `--force`)
|
||||||
|
* `tag`: `Specify which tag context to expand. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Useful after initial task generation or complexity analysis to break down multiple tasks at once.
|
||||||
|
* **Important:** This MCP tool makes AI calls and can take up to a minute to complete. Please inform users to hang tight while the operation is in progress.
|
||||||
|
|
||||||
|
### 15. Clear Subtasks (`clear_subtasks`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `clear_subtasks`
|
||||||
|
* **CLI Command:** `task-master clear-subtasks [options]`
|
||||||
|
* **Description:** `Remove all subtasks from one or more specified Taskmaster parent tasks.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `id`: `The ID(s) of the Taskmaster parent task(s) whose subtasks you want to remove, e.g., '15' or '16,18'. Required unless using `all`.) (CLI: `-i, --id <ids>`)
|
||||||
|
* `all`: `Tell Taskmaster to remove subtasks from all parent tasks.` (CLI: `--all`)
|
||||||
|
* `tag`: `Specify which tag context to operate on. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Used before regenerating subtasks with `expand_task` if the previous breakdown needs replacement.
|
||||||
|
|
||||||
|
### 16. Remove Subtask (`remove_subtask`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `remove_subtask`
|
||||||
|
* **CLI Command:** `task-master remove-subtask [options]`
|
||||||
|
* **Description:** `Remove a subtask from its Taskmaster parent, optionally converting it into a standalone task.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `id`: `Required. The ID(s) of the Taskmaster subtask(s) to remove, e.g., '15.2' or '16.1,16.3'.` (CLI: `-i, --id <id>`)
|
||||||
|
* `convert`: `If used, Taskmaster will turn the subtask into a regular top-level task instead of deleting it.` (CLI: `-c, --convert`)
|
||||||
|
* `skipGenerate`: `Prevent Taskmaster from automatically regenerating markdown task files after removing the subtask.` (CLI: `--skip-generate`)
|
||||||
|
* `tag`: `Specify which tag context to operate on. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Delete unnecessary subtasks or promote a subtask to a top-level task.
|
||||||
|
|
||||||
|
### 17. Move Task (`move_task`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `move_task`
|
||||||
|
* **CLI Command:** `task-master move [options]`
|
||||||
|
* **Description:** `Move a task or subtask to a new position within the task hierarchy.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `from`: `Required. ID of the task/subtask to move (e.g., "5" or "5.2"). Can be comma-separated for multiple tasks.` (CLI: `--from <id>`)
|
||||||
|
* `to`: `Required. ID of the destination (e.g., "7" or "7.3"). Must match the number of source IDs if comma-separated.` (CLI: `--to <id>`)
|
||||||
|
* `tag`: `Specify which tag context to operate on. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Reorganize tasks by moving them within the hierarchy. Supports various scenarios like:
|
||||||
|
* Moving a task to become a subtask
|
||||||
|
* Moving a subtask to become a standalone task
|
||||||
|
* Moving a subtask to a different parent
|
||||||
|
* Reordering subtasks within the same parent
|
||||||
|
* Moving a task to a new, non-existent ID (automatically creates placeholders)
|
||||||
|
* Moving multiple tasks at once with comma-separated IDs
|
||||||
|
* **Validation Features:**
|
||||||
|
* Allows moving tasks to non-existent destination IDs (creates placeholder tasks)
|
||||||
|
* Prevents moving to existing task IDs that already have content (to avoid overwriting)
|
||||||
|
* Validates that source tasks exist before attempting to move them
|
||||||
|
* Maintains proper parent-child relationships
|
||||||
|
* **Example CLI:** `task-master move --from=5.2 --to=7.3` to move subtask 5.2 to become subtask 7.3.
|
||||||
|
* **Example Multi-Move:** `task-master move --from=10,11,12 --to=16,17,18` to move multiple tasks to new positions.
|
||||||
|
* **Common Use:** Resolving merge conflicts in tasks.json when multiple team members create tasks on different branches.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Dependency Management
|
||||||
|
|
||||||
|
### 18. Add Dependency (`add_dependency`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `add_dependency`
|
||||||
|
* **CLI Command:** `task-master add-dependency [options]`
|
||||||
|
* **Description:** `Define a dependency in Taskmaster, making one task a prerequisite for another.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `id`: `Required. The ID of the Taskmaster task that will depend on another.` (CLI: `-i, --id <id>`)
|
||||||
|
* `dependsOn`: `Required. The ID of the Taskmaster task that must be completed first, the prerequisite.` (CLI: `-d, --depends-on <id>`)
|
||||||
|
* `tag`: `Specify which tag context to operate on. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <path>`)
|
||||||
|
* **Usage:** Establish the correct order of execution between tasks.
|
||||||
|
|
||||||
|
### 19. Remove Dependency (`remove_dependency`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `remove_dependency`
|
||||||
|
* **CLI Command:** `task-master remove-dependency [options]`
|
||||||
|
* **Description:** `Remove a dependency relationship between two Taskmaster tasks.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `id`: `Required. The ID of the Taskmaster task you want to remove a prerequisite from.` (CLI: `-i, --id <id>`)
|
||||||
|
* `dependsOn`: `Required. The ID of the Taskmaster task that should no longer be a prerequisite.` (CLI: `-d, --depends-on <id>`)
|
||||||
|
* `tag`: `Specify which tag context to operate on. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Update task relationships when the order of execution changes.
|
||||||
|
|
||||||
|
### 20. Validate Dependencies (`validate_dependencies`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `validate_dependencies`
|
||||||
|
* **CLI Command:** `task-master validate-dependencies [options]`
|
||||||
|
* **Description:** `Check your Taskmaster tasks for dependency issues (like circular references or links to non-existent tasks) without making changes.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `tag`: `Specify which tag context to validate. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Audit the integrity of your task dependencies.
|
||||||
|
|
||||||
|
### 21. Fix Dependencies (`fix_dependencies`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `fix_dependencies`
|
||||||
|
* **CLI Command:** `task-master fix-dependencies [options]`
|
||||||
|
* **Description:** `Automatically fix dependency issues (like circular references or links to non-existent tasks) in your Taskmaster tasks.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `tag`: `Specify which tag context to fix dependencies in. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Clean up dependency errors automatically.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Analysis & Reporting
|
||||||
|
|
||||||
|
### 22. Analyze Project Complexity (`analyze_project_complexity`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `analyze_project_complexity`
|
||||||
|
* **CLI Command:** `task-master analyze-complexity [options]`
|
||||||
|
* **Description:** `Have Taskmaster analyze your tasks to determine their complexity and suggest which ones need to be broken down further.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `output`: `Where to save the complexity analysis report. Default is '.taskmaster/reports/task-complexity-report.json' (or '..._tagname.json' if a tag is used).` (CLI: `-o, --output <file>`)
|
||||||
|
* `threshold`: `The minimum complexity score (1-10) that should trigger a recommendation to expand a task.` (CLI: `-t, --threshold <number>`)
|
||||||
|
* `research`: `Enable research role for more accurate complexity analysis. Requires appropriate API key.` (CLI: `-r, --research`)
|
||||||
|
* `tag`: `Specify which tag context to analyze. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Used before breaking down tasks to identify which ones need the most attention.
|
||||||
|
* **Important:** This MCP tool makes AI calls and can take up to a minute to complete. Please inform users to hang tight while the operation is in progress.
|
||||||
|
|
||||||
|
### 23. View Complexity Report (`complexity_report`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `complexity_report`
|
||||||
|
* **CLI Command:** `task-master complexity-report [options]`
|
||||||
|
* **Description:** `Display the task complexity analysis report in a readable format.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `tag`: `Specify which tag context to show the report for. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to the complexity report (default: '.taskmaster/reports/task-complexity-report.json').` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Review and understand the complexity analysis results after running analyze-complexity.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## File Management
|
||||||
|
|
||||||
|
### 24. Generate Task Files (`generate`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `generate`
|
||||||
|
* **CLI Command:** `task-master generate [options]`
|
||||||
|
* **Description:** `Create or update individual Markdown files for each task based on your tasks.json.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `output`: `The directory where Taskmaster should save the task files (default: in a 'tasks' directory).` (CLI: `-o, --output <directory>`)
|
||||||
|
* `tag`: `Specify which tag context to generate files for. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* **Usage:** Run this after making changes to tasks.json to keep individual task files up to date. This command is now manual and no longer runs automatically.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## AI-Powered Research
|
||||||
|
|
||||||
|
### 25. Research (`research`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `research`
|
||||||
|
* **CLI Command:** `task-master research [options]`
|
||||||
|
* **Description:** `Perform AI-powered research queries with project context to get fresh, up-to-date information beyond the AI's knowledge cutoff.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `query`: `Required. Research query/prompt (e.g., "What are the latest best practices for React Query v5?").` (CLI: `[query]` positional or `-q, --query <text>`)
|
||||||
|
* `taskIds`: `Comma-separated list of task/subtask IDs from the current tag context (e.g., "15,16.2,17").` (CLI: `-i, --id <ids>`)
|
||||||
|
* `filePaths`: `Comma-separated list of file paths for context (e.g., "src/api.js,docs/readme.md").` (CLI: `-f, --files <paths>`)
|
||||||
|
* `customContext`: `Additional custom context text to include in the research.` (CLI: `-c, --context <text>`)
|
||||||
|
* `includeProjectTree`: `Include project file tree structure in context (default: false).` (CLI: `--tree`)
|
||||||
|
* `detailLevel`: `Detail level for the research response: 'low', 'medium', 'high' (default: medium).` (CLI: `--detail <level>`)
|
||||||
|
* `saveTo`: `Task or subtask ID (e.g., "15", "15.2") to automatically save the research conversation to.` (CLI: `--save-to <id>`)
|
||||||
|
* `saveFile`: `If true, saves the research conversation to a markdown file in '.taskmaster/docs/research/'.` (CLI: `--save-file`)
|
||||||
|
* `noFollowup`: `Disables the interactive follow-up question menu in the CLI.` (CLI: `--no-followup`)
|
||||||
|
* `tag`: `Specify which tag context to use for task-based context gathering. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
* `projectRoot`: `The directory of the project. Must be an absolute path.` (CLI: Determined automatically)
|
||||||
|
* **Usage:** **This is a POWERFUL tool that agents should use FREQUENTLY** to:
|
||||||
|
* Get fresh information beyond knowledge cutoff dates
|
||||||
|
* Research latest best practices, library updates, security patches
|
||||||
|
* Find implementation examples for specific technologies
|
||||||
|
* Validate approaches against current industry standards
|
||||||
|
* Get contextual advice based on project files and tasks
|
||||||
|
* **When to Consider Using Research:**
|
||||||
|
* **Before implementing any task** - Research current best practices
|
||||||
|
* **When encountering new technologies** - Get up-to-date implementation guidance (libraries, apis, etc)
|
||||||
|
* **For security-related tasks** - Find latest security recommendations
|
||||||
|
* **When updating dependencies** - Research breaking changes and migration guides
|
||||||
|
* **For performance optimization** - Get current performance best practices
|
||||||
|
* **When debugging complex issues** - Research known solutions and workarounds
|
||||||
|
* **Research + Action Pattern:**
|
||||||
|
* Use `research` to gather fresh information
|
||||||
|
* Use `update_subtask` to commit findings with timestamps
|
||||||
|
* Use `update_task` to incorporate research into task details
|
||||||
|
* Use `add_task` with research flag for informed task creation
|
||||||
|
* **Important:** This MCP tool makes AI calls and can take up to a minute to complete. The research provides FRESH data beyond the AI's training cutoff, making it invaluable for current best practices and recent developments.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Tag Management
|
||||||
|
|
||||||
|
This new suite of commands allows you to manage different task contexts (tags).
|
||||||
|
|
||||||
|
### 26. List Tags (`tags`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `list_tags`
|
||||||
|
* **CLI Command:** `task-master tags [options]`
|
||||||
|
* **Description:** `List all available tags with task counts, completion status, and other metadata.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
* `--show-metadata`: `Include detailed metadata in the output (e.g., creation date, description).` (CLI: `--show-metadata`)
|
||||||
|
|
||||||
|
### 27. Add Tag (`add_tag`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `add_tag`
|
||||||
|
* **CLI Command:** `task-master add-tag <tagName> [options]`
|
||||||
|
* **Description:** `Create a new, empty tag context, or copy tasks from another tag.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `tagName`: `Name of the new tag to create (alphanumeric, hyphens, underscores).` (CLI: `<tagName>` positional)
|
||||||
|
* `--from-branch`: `Creates a tag with a name derived from the current git branch, ignoring the <tagName> argument.` (CLI: `--from-branch`)
|
||||||
|
* `--copy-from-current`: `Copy tasks from the currently active tag to the new tag.` (CLI: `--copy-from-current`)
|
||||||
|
* `--copy-from <tag>`: `Copy tasks from a specific source tag to the new tag.` (CLI: `--copy-from <tag>`)
|
||||||
|
* `--description <text>`: `Provide an optional description for the new tag.` (CLI: `-d, --description <text>`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
|
||||||
|
### 28. Delete Tag (`delete_tag`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `delete_tag`
|
||||||
|
* **CLI Command:** `task-master delete-tag <tagName> [options]`
|
||||||
|
* **Description:** `Permanently delete a tag and all of its associated tasks.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `tagName`: `Name of the tag to delete.` (CLI: `<tagName>` positional)
|
||||||
|
* `--yes`: `Skip the confirmation prompt.` (CLI: `-y, --yes`)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
|
||||||
|
### 29. Use Tag (`use_tag`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `use_tag`
|
||||||
|
* **CLI Command:** `task-master use-tag <tagName>`
|
||||||
|
* **Description:** `Switch your active task context to a different tag.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `tagName`: `Name of the tag to switch to.` (CLI: `<tagName>` positional)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
|
||||||
|
### 30. Rename Tag (`rename_tag`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `rename_tag`
|
||||||
|
* **CLI Command:** `task-master rename-tag <oldName> <newName>`
|
||||||
|
* **Description:** `Rename an existing tag.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `oldName`: `The current name of the tag.` (CLI: `<oldName>` positional)
|
||||||
|
* `newName`: `The new name for the tag.` (CLI: `<newName>` positional)
|
||||||
|
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||||
|
|
||||||
|
### 31. Copy Tag (`copy_tag`)
|
||||||
|
|
||||||
|
* **MCP Tool:** `copy_tag`
|
||||||
|
* **CLI Command:** `task-master copy-tag <sourceName> <targetName> [options]`
|
||||||
|
* **Description:** `Copy an entire tag context, including all its tasks and metadata, to a new tag.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `sourceName`: `Name of the tag to copy from.` (CLI: `<sourceName>` positional)
|
||||||
|
* `targetName`: `Name of the new tag to create.` (CLI: `<targetName>` positional)
|
||||||
|
* `--description <text>`: `Optional description for the new tag.` (CLI: `-d, --description <text>`)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Miscellaneous
|
||||||
|
|
||||||
|
### 32. Sync Readme (`sync-readme`) -- experimental
|
||||||
|
|
||||||
|
* **MCP Tool:** N/A
|
||||||
|
* **CLI Command:** `task-master sync-readme [options]`
|
||||||
|
* **Description:** `Exports your task list to your project's README.md file, useful for showcasing progress.`
|
||||||
|
* **Key Parameters/Options:**
|
||||||
|
* `status`: `Filter tasks by status (e.g., 'pending', 'done').` (CLI: `-s, --status <status>`)
|
||||||
|
* `withSubtasks`: `Include subtasks in the export.` (CLI: `--with-subtasks`)
|
||||||
|
* `tag`: `Specify which tag context to export from. Defaults to the current active tag.` (CLI: `--tag <name>`)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Environment Variables Configuration (Updated)
|
||||||
|
|
||||||
|
Taskmaster primarily uses the **`.taskmaster/config.json`** file (in project root) for configuration (models, parameters, logging level, etc.), managed via `task-master models --setup`.
|
||||||
|
|
||||||
|
Environment variables are used **only** for sensitive API keys related to AI providers and specific overrides like the Ollama base URL:
|
||||||
|
|
||||||
|
* **API Keys (Required for corresponding provider):**
|
||||||
|
* `ANTHROPIC_API_KEY`
|
||||||
|
* `PERPLEXITY_API_KEY`
|
||||||
|
* `OPENAI_API_KEY`
|
||||||
|
* `GOOGLE_API_KEY`
|
||||||
|
* `MISTRAL_API_KEY`
|
||||||
|
* `AZURE_OPENAI_API_KEY` (Requires `AZURE_OPENAI_ENDPOINT` too)
|
||||||
|
* `OPENROUTER_API_KEY`
|
||||||
|
* `XAI_API_KEY`
|
||||||
|
* `OLLAMA_API_KEY` (Requires `OLLAMA_BASE_URL` too)
|
||||||
|
* **Endpoints (Optional/Provider Specific inside .taskmaster/config.json):**
|
||||||
|
* `AZURE_OPENAI_ENDPOINT`
|
||||||
|
* `OLLAMA_BASE_URL` (Default: `http://localhost:11434/api`)
|
||||||
|
|
||||||
|
**Set API keys** in your **`.env`** file in the project root (for CLI use) or within the `env` section of your **`.cursor/mcp.json`** file (for MCP/Cursor integration). All other settings (model choice, max tokens, temperature, log level, custom endpoints) are managed in `.taskmaster/config.json` via `task-master models` command or `models` MCP tool.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
For details on how these commands fit into the development process, see the [Development Workflow Guide](mdc:.cursor/rules/dev_workflow.mdc).
|
||||||
@@ -3,9 +3,19 @@ description: Guidelines for implementing task management operations
|
|||||||
globs: scripts/modules/task-manager.js
|
globs: scripts/modules/task-manager.js
|
||||||
alwaysApply: false
|
alwaysApply: false
|
||||||
---
|
---
|
||||||
|
|
||||||
# Task Management Guidelines
|
# Task Management Guidelines
|
||||||
|
|
||||||
|
## Tagged Task Lists System
|
||||||
|
|
||||||
|
Task Master now uses a **tagged task lists system** for multi-context task management:
|
||||||
|
|
||||||
|
- **Data Structure**: Tasks are organized into separate contexts (tags) within `tasks.json`
|
||||||
|
- **Legacy Format**: `{"tasks": [...]}`
|
||||||
|
- **Tagged Format**: `{"master": {"tasks": [...]}, "feature-branch": {"tasks": [...]}}`
|
||||||
|
- **Silent Migration**: Legacy format automatically converts to tagged format on first use
|
||||||
|
- **Tag Resolution**: Core functions receive legacy format for 100% backward compatibility
|
||||||
|
- **Default Tag**: "master" is used for all existing and new tasks unless otherwise specified
|
||||||
|
|
||||||
## Task Structure Standards
|
## Task Structure Standards
|
||||||
|
|
||||||
- **Core Task Properties**:
|
- **Core Task Properties**:
|
||||||
@@ -28,6 +38,25 @@ alwaysApply: false
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- **Tagged Data Structure**:
|
||||||
|
- ✅ DO: Access tasks through tag resolution layer
|
||||||
|
- ✅ DO: Use `getTasksForTag(data, tagName)` to retrieve tasks for a specific tag
|
||||||
|
- ✅ DO: Use `setTasksForTag(data, tagName, tasks)` to update tasks for a specific tag
|
||||||
|
- ❌ DON'T: Directly manipulate the tagged structure in core functions
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Use tag resolution functions
|
||||||
|
const tasksData = readJSON(tasksPath);
|
||||||
|
const currentTag = getCurrentTag() || 'master';
|
||||||
|
const tasks = getTasksForTag(tasksData, currentTag);
|
||||||
|
|
||||||
|
// Manipulate tasks as normal...
|
||||||
|
|
||||||
|
// Save back to the tagged structure
|
||||||
|
setTasksForTag(tasksData, currentTag, tasks);
|
||||||
|
writeJSON(tasksPath, tasksData);
|
||||||
|
```
|
||||||
|
|
||||||
- **Subtask Structure**:
|
- **Subtask Structure**:
|
||||||
- ✅ DO: Use consistent properties across subtasks
|
- ✅ DO: Use consistent properties across subtasks
|
||||||
- ✅ DO: Maintain simple numeric IDs within parent tasks
|
- ✅ DO: Maintain simple numeric IDs within parent tasks
|
||||||
@@ -48,53 +77,56 @@ alwaysApply: false
|
|||||||
## Task Creation and Parsing
|
## Task Creation and Parsing
|
||||||
|
|
||||||
- **ID Management**:
|
- **ID Management**:
|
||||||
- ✅ DO: Assign unique sequential IDs to tasks
|
- ✅ DO: Assign unique sequential IDs to tasks within each tag context
|
||||||
- ✅ DO: Calculate the next ID based on existing tasks
|
- ✅ DO: Calculate the next ID based on existing tasks in the current tag
|
||||||
- ❌ DON'T: Hardcode or reuse IDs
|
- ❌ DON'T: Hardcode or reuse IDs within the same tag
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// ✅ DO: Calculate the next available ID
|
// ✅ DO: Calculate the next available ID within the current tag
|
||||||
const highestId = Math.max(...data.tasks.map(t => t.id));
|
const tasksData = readJSON(tasksPath);
|
||||||
|
const currentTag = getCurrentTag() || 'master';
|
||||||
|
const tasks = getTasksForTag(tasksData, currentTag);
|
||||||
|
const highestId = Math.max(...tasks.map(t => t.id));
|
||||||
const nextTaskId = highestId + 1;
|
const nextTaskId = highestId + 1;
|
||||||
```
|
```
|
||||||
|
|
||||||
- **PRD Parsing**:
|
- **PRD Parsing**:
|
||||||
- ✅ DO: Extract tasks from PRD documents using AI
|
- ✅ DO: Extract tasks from PRD documents using AI
|
||||||
|
- ✅ DO: Create tasks in the current tag context (defaults to "master")
|
||||||
- ✅ DO: Provide clear prompts to guide AI task generation
|
- ✅ DO: Provide clear prompts to guide AI task generation
|
||||||
- ✅ DO: Validate and clean up AI-generated tasks
|
- ✅ DO: Validate and clean up AI-generated tasks
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// ✅ DO: Validate AI responses
|
// ✅ DO: Parse into current tag context
|
||||||
try {
|
const tasksData = readJSON(tasksPath) || {};
|
||||||
// Parse the JSON response
|
const currentTag = getCurrentTag() || 'master';
|
||||||
taskData = JSON.parse(jsonContent);
|
|
||||||
|
// Parse tasks and add to current tag
|
||||||
// Check that we have the required fields
|
const newTasks = await parseTasksFromPRD(prdContent);
|
||||||
if (!taskData.title || !taskData.description) {
|
setTasksForTag(tasksData, currentTag, newTasks);
|
||||||
throw new Error("Missing required fields in the generated task");
|
writeJSON(tasksPath, tasksData);
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
log('error', "Failed to parse AI's response as valid task JSON:", error);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Task Updates and Modifications
|
## Task Updates and Modifications
|
||||||
|
|
||||||
- **Status Management**:
|
- **Status Management**:
|
||||||
- ✅ DO: Provide functions for updating task status
|
- ✅ DO: Provide functions for updating task status within current tag context
|
||||||
- ✅ DO: Handle both individual tasks and subtasks
|
- ✅ DO: Handle both individual tasks and subtasks
|
||||||
- ✅ DO: Consider subtask status when updating parent tasks
|
- ✅ DO: Consider subtask status when updating parent tasks
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// ✅ DO: Handle status updates for both tasks and subtasks
|
// ✅ DO: Handle status updates within tagged context
|
||||||
async function setTaskStatus(tasksPath, taskIdInput, newStatus) {
|
async function setTaskStatus(tasksPath, taskIdInput, newStatus) {
|
||||||
|
const tasksData = readJSON(tasksPath);
|
||||||
|
const currentTag = getCurrentTag() || 'master';
|
||||||
|
const tasks = getTasksForTag(tasksData, currentTag);
|
||||||
|
|
||||||
// Check if it's a subtask (e.g., "1.2")
|
// Check if it's a subtask (e.g., "1.2")
|
||||||
if (taskIdInput.includes('.')) {
|
if (taskIdInput.includes('.')) {
|
||||||
const [parentId, subtaskId] = taskIdInput.split('.').map(id => parseInt(id, 10));
|
const [parentId, subtaskId] = taskIdInput.split('.').map(id => parseInt(id, 10));
|
||||||
|
|
||||||
// Find the parent task and subtask
|
// Find the parent task and subtask
|
||||||
const parentTask = data.tasks.find(t => t.id === parentId);
|
const parentTask = tasks.find(t => t.id === parentId);
|
||||||
const subtask = parentTask.subtasks.find(st => st.id === subtaskId);
|
const subtask = parentTask.subtasks.find(st => st.id === subtaskId);
|
||||||
|
|
||||||
// Update subtask status
|
// Update subtask status
|
||||||
@@ -109,7 +141,7 @@ alwaysApply: false
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Handle regular task
|
// Handle regular task
|
||||||
const task = data.tasks.find(t => t.id === parseInt(taskIdInput, 10));
|
const task = tasks.find(t => t.id === parseInt(taskIdInput, 10));
|
||||||
task.status = newStatus;
|
task.status = newStatus;
|
||||||
|
|
||||||
// If marking as done, also mark subtasks
|
// If marking as done, also mark subtasks
|
||||||
@@ -119,16 +151,24 @@ alwaysApply: false
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save updated tasks back to tagged structure
|
||||||
|
setTasksForTag(tasksData, currentTag, tasks);
|
||||||
|
writeJSON(tasksPath, tasksData);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- **Task Expansion**:
|
- **Task Expansion**:
|
||||||
- ✅ DO: Use AI to generate detailed subtasks
|
- ✅ DO: Use AI to generate detailed subtasks within current tag context
|
||||||
- ✅ DO: Consider complexity analysis for subtask counts
|
- ✅ DO: Consider complexity analysis for subtask counts
|
||||||
- ✅ DO: Ensure proper IDs for newly created subtasks
|
- ✅ DO: Ensure proper IDs for newly created subtasks
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// ✅ DO: Generate appropriate subtasks based on complexity
|
// ✅ DO: Generate appropriate subtasks based on complexity
|
||||||
|
const tasksData = readJSON(tasksPath);
|
||||||
|
const currentTag = getCurrentTag() || 'master';
|
||||||
|
const tasks = getTasksForTag(tasksData, currentTag);
|
||||||
|
|
||||||
if (taskAnalysis) {
|
if (taskAnalysis) {
|
||||||
log('info', `Found complexity analysis for task ${taskId}: Score ${taskAnalysis.complexityScore}/10`);
|
log('info', `Found complexity analysis for task ${taskId}: Score ${taskAnalysis.complexityScore}/10`);
|
||||||
|
|
||||||
@@ -138,6 +178,11 @@ alwaysApply: false
|
|||||||
log('info', `Using recommended number of subtasks: ${numSubtasks}`);
|
log('info', `Using recommended number of subtasks: ${numSubtasks}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Generate subtasks and save back
|
||||||
|
// ... subtask generation logic ...
|
||||||
|
setTasksForTag(tasksData, currentTag, tasks);
|
||||||
|
writeJSON(tasksPath, tasksData);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Task File Generation
|
## Task File Generation
|
||||||
@@ -155,67 +200,65 @@ alwaysApply: false
|
|||||||
|
|
||||||
// Format dependencies with their status
|
// Format dependencies with their status
|
||||||
if (task.dependencies && task.dependencies.length > 0) {
|
if (task.dependencies && task.dependencies.length > 0) {
|
||||||
content += `# Dependencies: ${formatDependenciesWithStatus(task.dependencies, data.tasks)}\n`;
|
content += `# Dependencies: ${formatDependenciesWithStatus(task.dependencies, tasks)}\n`;
|
||||||
} else {
|
} else {
|
||||||
content += '# Dependencies: None\n';
|
content += '# Dependencies: None\n';
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- **Subtask Inclusion**:
|
- **Tagged Context Awareness**:
|
||||||
- ✅ DO: Include subtasks in parent task files
|
- ✅ DO: Generate task files from current tag context
|
||||||
- ✅ DO: Use consistent indentation for subtask sections
|
- ✅ DO: Include tag information in generated files
|
||||||
- ✅ DO: Display subtask dependencies with proper formatting
|
- ❌ DON'T: Mix tasks from different tags in file generation
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// ✅ DO: Format subtasks correctly in task files
|
// ✅ DO: Generate files for current tag context
|
||||||
if (task.subtasks && task.subtasks.length > 0) {
|
async function generateTaskFiles(tasksPath, outputDir) {
|
||||||
content += '\n# Subtasks:\n';
|
const tasksData = readJSON(tasksPath);
|
||||||
|
const currentTag = getCurrentTag() || 'master';
|
||||||
|
const tasks = getTasksForTag(tasksData, currentTag);
|
||||||
|
|
||||||
task.subtasks.forEach(subtask => {
|
// Add tag context to file header
|
||||||
content += `## ${subtask.id}. ${subtask.title} [${subtask.status || 'pending'}]\n`;
|
let content = `# Tag Context: ${currentTag}\n`;
|
||||||
|
content += `# Task ID: ${task.id}\n`;
|
||||||
// Format subtask dependencies
|
// ... rest of file generation
|
||||||
if (subtask.dependencies && subtask.dependencies.length > 0) {
|
|
||||||
// Format the dependencies
|
|
||||||
content += `### Dependencies: ${formattedDeps}\n`;
|
|
||||||
} else {
|
|
||||||
content += '### Dependencies: None\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
content += `### Description: ${subtask.description || ''}\n`;
|
|
||||||
content += '### Details:\n';
|
|
||||||
content += (subtask.details || '').split('\n').map(line => line).join('\n');
|
|
||||||
content += '\n\n';
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Task Listing and Display
|
## Task Listing and Display
|
||||||
|
|
||||||
- **Filtering and Organization**:
|
- **Filtering and Organization**:
|
||||||
- ✅ DO: Allow filtering tasks by status
|
- ✅ DO: Allow filtering tasks by status within current tag context
|
||||||
- ✅ DO: Handle subtask display in lists
|
- ✅ DO: Handle subtask display in lists
|
||||||
- ✅ DO: Use consistent table formats
|
- ✅ DO: Use consistent table formats
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// ✅ DO: Implement clear filtering and organization
|
// ✅ DO: Implement clear filtering within tag context
|
||||||
|
const tasksData = readJSON(tasksPath);
|
||||||
|
const currentTag = getCurrentTag() || 'master';
|
||||||
|
const tasks = getTasksForTag(tasksData, currentTag);
|
||||||
|
|
||||||
// Filter tasks by status if specified
|
// Filter tasks by status if specified
|
||||||
const filteredTasks = statusFilter
|
const filteredTasks = statusFilter
|
||||||
? data.tasks.filter(task =>
|
? tasks.filter(task =>
|
||||||
task.status && task.status.toLowerCase() === statusFilter.toLowerCase())
|
task.status && task.status.toLowerCase() === statusFilter.toLowerCase())
|
||||||
: data.tasks;
|
: tasks;
|
||||||
```
|
```
|
||||||
|
|
||||||
- **Progress Tracking**:
|
- **Progress Tracking**:
|
||||||
- ✅ DO: Calculate and display completion statistics
|
- ✅ DO: Calculate and display completion statistics for current tag
|
||||||
- ✅ DO: Track both task and subtask completion
|
- ✅ DO: Track both task and subtask completion
|
||||||
- ✅ DO: Use visual progress indicators
|
- ✅ DO: Use visual progress indicators
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// ✅ DO: Track and display progress
|
// ✅ DO: Track and display progress within tag context
|
||||||
|
const tasksData = readJSON(tasksPath);
|
||||||
|
const currentTag = getCurrentTag() || 'master';
|
||||||
|
const tasks = getTasksForTag(tasksData, currentTag);
|
||||||
|
|
||||||
// Calculate completion statistics
|
// Calculate completion statistics
|
||||||
const totalTasks = data.tasks.length;
|
const totalTasks = tasks.length;
|
||||||
const completedTasks = data.tasks.filter(task =>
|
const completedTasks = tasks.filter(task =>
|
||||||
task.status === 'done' || task.status === 'completed').length;
|
task.status === 'done' || task.status === 'completed').length;
|
||||||
const completionPercentage = totalTasks > 0 ? (completedTasks / totalTasks) * 100 : 0;
|
const completionPercentage = totalTasks > 0 ? (completedTasks / totalTasks) * 100 : 0;
|
||||||
|
|
||||||
@@ -223,7 +266,7 @@ alwaysApply: false
|
|||||||
let totalSubtasks = 0;
|
let totalSubtasks = 0;
|
||||||
let completedSubtasks = 0;
|
let completedSubtasks = 0;
|
||||||
|
|
||||||
data.tasks.forEach(task => {
|
tasks.forEach(task => {
|
||||||
if (task.subtasks && task.subtasks.length > 0) {
|
if (task.subtasks && task.subtasks.length > 0) {
|
||||||
totalSubtasks += task.subtasks.length;
|
totalSubtasks += task.subtasks.length;
|
||||||
completedSubtasks += task.subtasks.filter(st =>
|
completedSubtasks += task.subtasks.filter(st =>
|
||||||
@@ -232,99 +275,52 @@ alwaysApply: false
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
## Complexity Analysis
|
## Migration and Compatibility
|
||||||
|
|
||||||
- **Scoring System**:
|
- **Silent Migration Handling**:
|
||||||
- ✅ DO: Use AI to analyze task complexity
|
- ✅ DO: Implement silent migration in `readJSON()` function
|
||||||
- ✅ DO: Include complexity scores (1-10)
|
- ✅ DO: Detect legacy format and convert automatically
|
||||||
- ✅ DO: Generate specific expansion recommendations
|
- ✅ DO: Preserve all existing task data during migration
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// ✅ DO: Handle complexity analysis properly
|
// ✅ DO: Handle silent migration (implemented in utils.js)
|
||||||
const report = {
|
function readJSON(filepath) {
|
||||||
meta: {
|
let data = JSON.parse(fs.readFileSync(filepath, 'utf8'));
|
||||||
generatedAt: new Date().toISOString(),
|
|
||||||
tasksAnalyzed: tasksData.tasks.length,
|
|
||||||
thresholdScore: thresholdScore,
|
|
||||||
projectName: tasksData.meta?.projectName || 'Your Project Name',
|
|
||||||
usedResearch: useResearch
|
|
||||||
},
|
|
||||||
complexityAnalysis: complexityAnalysis
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
- **Analysis-Based Workflow**:
|
|
||||||
- ✅ DO: Use complexity reports to guide task expansion
|
|
||||||
- ✅ DO: Prioritize complex tasks for more detailed breakdown
|
|
||||||
- ✅ DO: Use expansion prompts from complexity analysis
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
// ✅ DO: Apply complexity analysis to workflow
|
|
||||||
// Sort tasks by complexity if report exists, otherwise by ID
|
|
||||||
if (complexityReport && complexityReport.complexityAnalysis) {
|
|
||||||
log('info', 'Sorting tasks by complexity...');
|
|
||||||
|
|
||||||
// Create a map of task IDs to complexity scores
|
// Silent migration for tasks.json files
|
||||||
const complexityMap = new Map();
|
if (data.tasks && Array.isArray(data.tasks) && !data.master && isTasksFile) {
|
||||||
complexityReport.complexityAnalysis.forEach(analysis => {
|
const migratedData = {
|
||||||
complexityMap.set(analysis.taskId, analysis.complexityScore);
|
master: {
|
||||||
});
|
tasks: data.tasks
|
||||||
|
}
|
||||||
|
};
|
||||||
|
writeJSON(filepath, migratedData);
|
||||||
|
data = migratedData;
|
||||||
|
}
|
||||||
|
|
||||||
// Sort tasks by complexity score (high to low)
|
return data;
|
||||||
tasksToExpand.sort((a, b) => {
|
|
||||||
const scoreA = complexityMap.get(a.id) || 0;
|
|
||||||
const scoreB = complexityMap.get(b.id) || 0;
|
|
||||||
return scoreB - scoreA;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Next Task Selection
|
- **Tag Resolution**:
|
||||||
|
- ✅ DO: Use tag resolution functions to maintain backward compatibility
|
||||||
- **Eligibility Criteria**:
|
- ✅ DO: Return legacy format to core functions
|
||||||
- ✅ DO: Consider dependencies when finding next tasks
|
- ❌ DON'T: Expose tagged structure to existing core logic
|
||||||
- ✅ DO: Prioritize by task priority and dependency count
|
|
||||||
- ✅ DO: Skip completed tasks
|
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// ✅ DO: Use proper task prioritization logic
|
// ✅ DO: Use tag resolution layer
|
||||||
function findNextTask(tasks) {
|
function getTasksForTag(data, tagName) {
|
||||||
// Get all completed task IDs
|
if (data.tasks && Array.isArray(data.tasks)) {
|
||||||
const completedTaskIds = new Set(
|
// Legacy format - return as-is
|
||||||
tasks
|
return data.tasks;
|
||||||
.filter(t => t.status === 'done' || t.status === 'completed')
|
}
|
||||||
.map(t => t.id)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Filter for pending tasks whose dependencies are all satisfied
|
if (data[tagName] && data[tagName].tasks) {
|
||||||
const eligibleTasks = tasks.filter(task =>
|
// Tagged format - return tasks for specified tag
|
||||||
(task.status === 'pending' || task.status === 'in-progress') &&
|
return data[tagName].tasks;
|
||||||
task.dependencies &&
|
}
|
||||||
task.dependencies.every(depId => completedTaskIds.has(depId))
|
|
||||||
);
|
|
||||||
|
|
||||||
// Sort by priority, dependency count, and ID
|
return [];
|
||||||
const priorityValues = { 'high': 3, 'medium': 2, 'low': 1 };
|
|
||||||
|
|
||||||
const nextTask = eligibleTasks.sort((a, b) => {
|
|
||||||
// Priority first
|
|
||||||
const priorityA = priorityValues[a.priority || 'medium'] || 2;
|
|
||||||
const priorityB = priorityValues[b.priority || 'medium'] || 2;
|
|
||||||
|
|
||||||
if (priorityB !== priorityA) {
|
|
||||||
return priorityB - priorityA; // Higher priority first
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dependency count next
|
|
||||||
if (a.dependencies.length !== b.dependencies.length) {
|
|
||||||
return a.dependencies.length - b.dependencies.length; // Fewer dependencies first
|
|
||||||
}
|
|
||||||
|
|
||||||
// ID last
|
|
||||||
return a.id - b.id; // Lower ID first
|
|
||||||
})[0];
|
|
||||||
|
|
||||||
return nextTask;
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
228
.cursor/rules/telemetry.mdc
Normal file
228
.cursor/rules/telemetry.mdc
Normal file
@@ -0,0 +1,228 @@
|
|||||||
|
---
|
||||||
|
description: Guidelines for integrating AI usage telemetry across Task Master.
|
||||||
|
globs: scripts/modules/**/*.js,mcp-server/src/**/*.js
|
||||||
|
alwaysApply: true
|
||||||
|
---
|
||||||
|
|
||||||
|
# AI Usage Telemetry Integration
|
||||||
|
|
||||||
|
This document outlines the standard pattern for capturing, propagating, and handling AI usage telemetry data (cost, tokens, model, etc.) across the Task Master stack. This ensures consistent telemetry for both CLI and MCP interactions.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
Telemetry data is generated within the unified AI service layer ([`ai-services-unified.js`](mdc:scripts/modules/ai-services-unified.js)) and then passed upwards through the calling functions.
|
||||||
|
|
||||||
|
- **Data Source**: [`ai-services-unified.js`](mdc:scripts/modules/ai-services-unified.js) (specifically its `generateTextService`, `generateObjectService`, etc.) returns an object like `{ mainResult: AI_CALL_OUTPUT, telemetryData: TELEMETRY_OBJECT }`.
|
||||||
|
- **`telemetryData` Object Structure**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"timestamp": "ISO_STRING_DATE",
|
||||||
|
"userId": "USER_ID_FROM_CONFIG",
|
||||||
|
"commandName": "invoking_command_or_tool_name",
|
||||||
|
"modelUsed": "ai_model_id",
|
||||||
|
"providerName": "ai_provider_name",
|
||||||
|
"inputTokens": NUMBER,
|
||||||
|
"outputTokens": NUMBER,
|
||||||
|
"totalTokens": NUMBER,
|
||||||
|
"totalCost": NUMBER, // e.g., 0.012414
|
||||||
|
"currency": "USD" // e.g., "USD"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Integration Pattern by Layer
|
||||||
|
|
||||||
|
The key principle is that each layer receives telemetry data from the layer below it (if applicable) and passes it to the layer above it, or handles it for display in the case of the CLI.
|
||||||
|
|
||||||
|
### 1. Core Logic Functions (e.g., in `scripts/modules/task-manager/`)
|
||||||
|
|
||||||
|
Functions in this layer that invoke AI services are responsible for handling the `telemetryData` they receive from [`ai-services-unified.js`](mdc:scripts/modules/ai-services-unified.js).
|
||||||
|
|
||||||
|
- **Actions**:
|
||||||
|
1. Call the appropriate AI service function (e.g., `generateObjectService`).
|
||||||
|
- Pass `commandName` (e.g., `add-task`, `expand-task`) and `outputType` (e.g., `cli` or `mcp`) in the `params` object to the AI service. The `outputType` can be derived from context (e.g., presence of `mcpLog`).
|
||||||
|
2. The AI service returns an object, e.g., `aiServiceResponse = { mainResult: {/*AI output*/}, telemetryData: {/*telemetry data*/} }`.
|
||||||
|
3. Extract `aiServiceResponse.mainResult` for the core processing.
|
||||||
|
4. **Must return an object that includes `aiServiceResponse.telemetryData`**.
|
||||||
|
Example: `return { operationSpecificData: /*...*/, telemetryData: aiServiceResponse.telemetryData };`
|
||||||
|
|
||||||
|
- **CLI Output Handling (If Applicable)**:
|
||||||
|
- If the core function also handles CLI output (e.g., it has an `outputFormat` parameter that can be `'text'` or `'cli'`):
|
||||||
|
1. Check if `outputFormat === 'text'` (or `'cli'`).
|
||||||
|
2. If so, and if `aiServiceResponse.telemetryData` is available, call `displayAiUsageSummary(aiServiceResponse.telemetryData, 'cli')` from [`scripts/modules/ui.js`](mdc:scripts/modules/ui.js).
|
||||||
|
- This ensures telemetry is displayed directly to CLI users after the main command output.
|
||||||
|
|
||||||
|
- **Example Snippet (Core Logic in `scripts/modules/task-manager/someAiAction.js`)**:
|
||||||
|
```javascript
|
||||||
|
import { generateObjectService } from '../ai-services-unified.js';
|
||||||
|
import { displayAiUsageSummary } from '../ui.js';
|
||||||
|
|
||||||
|
async function performAiRelatedAction(params, context, outputFormat = 'text') {
|
||||||
|
const { commandNameFromContext, /* other context vars */ } = context;
|
||||||
|
let aiServiceResponse = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
aiServiceResponse = await generateObjectService({
|
||||||
|
// ... other parameters for AI service ...
|
||||||
|
commandName: commandNameFromContext || 'default-action-name',
|
||||||
|
outputType: context.mcpLog ? 'mcp' : 'cli' // Derive outputType
|
||||||
|
});
|
||||||
|
|
||||||
|
const usefulAiOutput = aiServiceResponse.mainResult.object;
|
||||||
|
// ... do work with usefulAiOutput ...
|
||||||
|
|
||||||
|
if (outputFormat === 'text' && aiServiceResponse.telemetryData) {
|
||||||
|
displayAiUsageSummary(aiServiceResponse.telemetryData, 'cli');
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
actionData: /* results of processing */,
|
||||||
|
telemetryData: aiServiceResponse.telemetryData
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
// ... handle error ...
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Direct Function Wrappers (in `mcp-server/src/core/direct-functions/`)
|
||||||
|
|
||||||
|
These functions adapt core logic for the MCP server, ensuring structured responses.
|
||||||
|
|
||||||
|
- **Actions**:
|
||||||
|
1. Call the corresponding core logic function.
|
||||||
|
- Pass necessary context (e.g., `session`, `mcpLog`, `projectRoot`).
|
||||||
|
- Provide the `commandName` (typically derived from the MCP tool name) and `outputType: 'mcp'` in the context object passed to the core function.
|
||||||
|
- If the core function supports an `outputFormat` parameter, pass `'json'` to suppress CLI-specific UI.
|
||||||
|
2. The core logic function returns an object (e.g., `coreResult = { actionData: ..., telemetryData: ... }`).
|
||||||
|
3. Include `coreResult.telemetryData` as a field within the `data` object of the successful response returned by the direct function.
|
||||||
|
|
||||||
|
- **Example Snippet (Direct Function `someAiActionDirect.js`)**:
|
||||||
|
```javascript
|
||||||
|
import { performAiRelatedAction } from '../../../../scripts/modules/task-manager/someAiAction.js'; // Core function
|
||||||
|
import { createLogWrapper } from '../../tools/utils.js'; // MCP Log wrapper
|
||||||
|
|
||||||
|
export async function someAiActionDirect(args, log, context = {}) {
|
||||||
|
const { session } = context;
|
||||||
|
// ... prepare arguments for core function from args, including args.projectRoot ...
|
||||||
|
|
||||||
|
try {
|
||||||
|
const coreResult = await performAiRelatedAction(
|
||||||
|
{ /* parameters for core function */ },
|
||||||
|
{ // Context for core function
|
||||||
|
session,
|
||||||
|
mcpLog: createLogWrapper(log),
|
||||||
|
projectRoot: args.projectRoot,
|
||||||
|
commandNameFromContext: 'mcp_tool_some_ai_action', // Example command name
|
||||||
|
outputType: 'mcp'
|
||||||
|
},
|
||||||
|
'json' // Request 'json' output format from core function
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: {
|
||||||
|
operationSpecificData: coreResult.actionData,
|
||||||
|
telemetryData: coreResult.telemetryData // Pass telemetry through
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
// ... error handling, return { success: false, error: ... } ...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. MCP Tools (in `mcp-server/src/tools/`)
|
||||||
|
|
||||||
|
These are the exposed endpoints for MCP clients.
|
||||||
|
|
||||||
|
- **Actions**:
|
||||||
|
1. Call the corresponding direct function wrapper.
|
||||||
|
2. The direct function returns an object structured like `{ success: true, data: { operationSpecificData: ..., telemetryData: ... } }` (or an error object).
|
||||||
|
3. Pass this entire result object to `handleApiResult(result, log)` from [`mcp-server/src/tools/utils.js`](mdc:mcp-server/src/tools/utils.js).
|
||||||
|
4. `handleApiResult` ensures that the `data` field from the direct function's response (which correctly includes `telemetryData`) is part of the final MCP response.
|
||||||
|
|
||||||
|
- **Example Snippet (MCP Tool `some_ai_action.js`)**:
|
||||||
|
```javascript
|
||||||
|
import { someAiActionDirect } from '../core/task-master-core.js';
|
||||||
|
import { handleApiResult, withNormalizedProjectRoot } from './utils.js';
|
||||||
|
// ... zod for parameters ...
|
||||||
|
|
||||||
|
export function registerSomeAiActionTool(server) {
|
||||||
|
server.addTool({
|
||||||
|
name: "some_ai_action",
|
||||||
|
// ... description, parameters ...
|
||||||
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
|
try {
|
||||||
|
const resultFromDirectFunction = await someAiActionDirect(
|
||||||
|
{ /* args including projectRoot */ },
|
||||||
|
log,
|
||||||
|
{ session }
|
||||||
|
);
|
||||||
|
return handleApiResult(resultFromDirectFunction, log); // This passes the nested telemetryData through
|
||||||
|
} catch (error) {
|
||||||
|
// ... error handling ...
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. CLI Commands (`scripts/modules/commands.js`)
|
||||||
|
|
||||||
|
These define the command-line interface.
|
||||||
|
|
||||||
|
- **Actions**:
|
||||||
|
1. Call the appropriate core logic function.
|
||||||
|
2. Pass `outputFormat: 'text'` (or ensure the core function defaults to text-based output for CLI).
|
||||||
|
3. The core logic function (as per Section 1) is responsible for calling `displayAiUsageSummary` if telemetry data is available and it's in CLI mode.
|
||||||
|
4. The command action itself **should not** call `displayAiUsageSummary` if the core logic function already handles this. This avoids duplicate display.
|
||||||
|
|
||||||
|
- **Example Snippet (CLI Command in `commands.js`)**:
|
||||||
|
```javascript
|
||||||
|
// In scripts/modules/commands.js
|
||||||
|
import { performAiRelatedAction } from './task-manager/someAiAction.js'; // Core function
|
||||||
|
|
||||||
|
programInstance
|
||||||
|
.command('some-cli-ai-action')
|
||||||
|
// ... .option() ...
|
||||||
|
.action(async (options) => {
|
||||||
|
try {
|
||||||
|
const projectRoot = findProjectRoot() || '.'; // Example root finding
|
||||||
|
// ... prepare parameters for core function from command options ...
|
||||||
|
await performAiRelatedAction(
|
||||||
|
{ /* parameters for core function */ },
|
||||||
|
{ // Context for core function
|
||||||
|
projectRoot,
|
||||||
|
commandNameFromContext: 'some-cli-ai-action',
|
||||||
|
outputType: 'cli'
|
||||||
|
},
|
||||||
|
'text' // Explicitly request text output format for CLI
|
||||||
|
);
|
||||||
|
// Core function handles displayAiUsageSummary internally for 'text' outputFormat
|
||||||
|
} catch (error) {
|
||||||
|
// ... error handling ...
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Summary Flow
|
||||||
|
|
||||||
|
The telemetry data flows as follows:
|
||||||
|
|
||||||
|
1. **[`ai-services-unified.js`](mdc:scripts/modules/ai-services-unified.js)**: Generates `telemetryData` and returns `{ mainResult, telemetryData }`.
|
||||||
|
2. **Core Logic Function**:
|
||||||
|
* Receives `{ mainResult, telemetryData }`.
|
||||||
|
* Uses `mainResult`.
|
||||||
|
* If CLI (`outputFormat: 'text'`), calls `displayAiUsageSummary(telemetryData)`.
|
||||||
|
* Returns `{ operationSpecificData, telemetryData }`.
|
||||||
|
3. **Direct Function Wrapper**:
|
||||||
|
* Receives `{ operationSpecificData, telemetryData }` from core logic.
|
||||||
|
* Returns `{ success: true, data: { operationSpecificData, telemetryData } }`.
|
||||||
|
4. **MCP Tool**:
|
||||||
|
* Receives direct function response.
|
||||||
|
* `handleApiResult` ensures the final MCP response to the client is `{ success: true, data: { operationSpecificData, telemetryData } }`.
|
||||||
|
5. **CLI Command**:
|
||||||
|
* Calls core logic with `outputFormat: 'text'`. Display is handled by core logic.
|
||||||
|
|
||||||
|
This pattern ensures telemetry is captured and appropriately handled/exposed across all interaction modes.
|
||||||
@@ -5,6 +5,8 @@ globs: "**/*.test.js,tests/**/*"
|
|||||||
|
|
||||||
# Testing Guidelines for Task Master CLI
|
# Testing Guidelines for Task Master CLI
|
||||||
|
|
||||||
|
*Note:* Never use asynchronous operations in tests. Always mock tests properly based on the way the tested functions are defined and used. Do not arbitrarily create tests. Based them on the low-level details and execution of the underlying code being tested.
|
||||||
|
|
||||||
## Test Organization Structure
|
## Test Organization Structure
|
||||||
|
|
||||||
- **Unit Tests** (See [`architecture.mdc`](mdc:.cursor/rules/architecture.mdc) for module breakdown)
|
- **Unit Tests** (See [`architecture.mdc`](mdc:.cursor/rules/architecture.mdc) for module breakdown)
|
||||||
@@ -88,6 +90,122 @@ describe('Feature or Function Name', () => {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Commander.js Command Testing Best Practices
|
||||||
|
|
||||||
|
When testing CLI commands built with Commander.js, several special considerations must be made to avoid common pitfalls:
|
||||||
|
|
||||||
|
- **Direct Action Handler Testing**
|
||||||
|
- ✅ **DO**: Test the command action handlers directly rather than trying to mock the entire Commander.js chain
|
||||||
|
- ✅ **DO**: Create simplified test-specific implementations of command handlers that match the original behavior
|
||||||
|
- ✅ **DO**: Explicitly handle all options, including defaults and shorthand flags (e.g., `-p` for `--prompt`)
|
||||||
|
- ✅ **DO**: Include null/undefined checks in test implementations for parameters that might be optional
|
||||||
|
- ✅ **DO**: Use fixtures from `tests/fixtures/` for consistent sample data across tests
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Create a simplified test version of the command handler
|
||||||
|
const testAddTaskAction = async (options) => {
|
||||||
|
options = options || {}; // Ensure options aren't undefined
|
||||||
|
|
||||||
|
// Validate parameters
|
||||||
|
const isManualCreation = options.title && options.description;
|
||||||
|
const prompt = options.prompt || options.p; // Handle shorthand flags
|
||||||
|
|
||||||
|
if (!prompt && !isManualCreation) {
|
||||||
|
throw new Error('Expected error message');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call the mocked task manager
|
||||||
|
return mockTaskManager.addTask(/* parameters */);
|
||||||
|
};
|
||||||
|
|
||||||
|
test('should handle required parameters correctly', async () => {
|
||||||
|
// Call the test implementation directly
|
||||||
|
await expect(async () => {
|
||||||
|
await testAddTaskAction({ file: 'tasks.json' });
|
||||||
|
}).rejects.toThrow('Expected error message');
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Commander Chain Mocking (If Necessary)**
|
||||||
|
- ✅ **DO**: Mock ALL chainable methods (`option`, `argument`, `action`, `on`, etc.)
|
||||||
|
- ✅ **DO**: Return `this` (or the mock object) from all chainable method mocks
|
||||||
|
- ✅ **DO**: Remember to mock not only the initial object but also all objects returned by methods
|
||||||
|
- ✅ **DO**: Implement a mechanism to capture the action handler for direct testing
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// If you must mock the Commander.js chain:
|
||||||
|
const mockCommand = {
|
||||||
|
command: jest.fn().mockReturnThis(),
|
||||||
|
description: jest.fn().mockReturnThis(),
|
||||||
|
option: jest.fn().mockReturnThis(),
|
||||||
|
argument: jest.fn().mockReturnThis(), // Don't forget this one
|
||||||
|
action: jest.fn(fn => {
|
||||||
|
actionHandler = fn; // Capture the handler for testing
|
||||||
|
return mockCommand;
|
||||||
|
}),
|
||||||
|
on: jest.fn().mockReturnThis() // Don't forget this one
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Parameter Handling**
|
||||||
|
- ✅ **DO**: Check for both main flag and shorthand flags (e.g., `prompt` and `p`)
|
||||||
|
- ✅ **DO**: Handle parameters like Commander would (comma-separated lists, etc.)
|
||||||
|
- ✅ **DO**: Set proper default values as defined in the command
|
||||||
|
- ✅ **DO**: Validate that required parameters are actually required in tests
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Parse dependencies like Commander would
|
||||||
|
const dependencies = options.dependencies
|
||||||
|
? options.dependencies.split(',').map(id => id.trim())
|
||||||
|
: [];
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Environment and Session Handling**
|
||||||
|
- ✅ **DO**: Properly mock session objects when required by functions
|
||||||
|
- ✅ **DO**: Reset environment variables between tests if modified
|
||||||
|
- ✅ **DO**: Use a consistent pattern for environment-dependent tests
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Session parameter mock pattern
|
||||||
|
const sessionMock = { session: process.env };
|
||||||
|
|
||||||
|
// In test:
|
||||||
|
expect(mockAddTask).toHaveBeenCalledWith(
|
||||||
|
expect.any(String),
|
||||||
|
'Test prompt',
|
||||||
|
[],
|
||||||
|
'medium',
|
||||||
|
sessionMock,
|
||||||
|
false,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Common Pitfalls to Avoid**
|
||||||
|
- ❌ **DON'T**: Try to use the real action implementation without proper mocking
|
||||||
|
- ❌ **DON'T**: Mock Commander partially - either mock it completely or test the action directly
|
||||||
|
- ❌ **DON'T**: Forget to handle optional parameters that may be undefined
|
||||||
|
- ❌ **DON'T**: Neglect to test shorthand flag functionality (e.g., `-p`, `-r`)
|
||||||
|
- ❌ **DON'T**: Create circular dependencies in your test mocks
|
||||||
|
- ❌ **DON'T**: Access variables before initialization in your test implementations
|
||||||
|
- ❌ **DON'T**: Include actual command execution in unit tests
|
||||||
|
- ❌ **DON'T**: Overwrite the same file path in multiple tests
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ❌ DON'T: Create circular references in mocks
|
||||||
|
const badMock = {
|
||||||
|
method: jest.fn().mockImplementation(() => badMock.method())
|
||||||
|
};
|
||||||
|
|
||||||
|
// ❌ DON'T: Access uninitialized variables
|
||||||
|
const badImplementation = () => {
|
||||||
|
const result = uninitialized;
|
||||||
|
let uninitialized = 'value';
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
## Jest Module Mocking Best Practices
|
## Jest Module Mocking Best Practices
|
||||||
|
|
||||||
- **Mock Hoisting Behavior**
|
- **Mock Hoisting Behavior**
|
||||||
@@ -165,107 +283,97 @@ When testing ES modules (`"type": "module"` in package.json), traditional mockin
|
|||||||
- Imported functions may not use your mocked dependencies even with proper jest.mock() setup
|
- Imported functions may not use your mocked dependencies even with proper jest.mock() setup
|
||||||
- ES module exports are read-only properties (cannot be reassigned during tests)
|
- ES module exports are read-only properties (cannot be reassigned during tests)
|
||||||
|
|
||||||
- **Mocking Entire Modules**
|
- **Mocking Modules Statically Imported**
|
||||||
|
- For modules imported with standard `import` statements at the top level:
|
||||||
|
- Use `jest.mock('path/to/module', factory)` **before** any imports.
|
||||||
|
- Jest hoists these mocks.
|
||||||
|
- Ensure the factory function returns the mocked structure correctly.
|
||||||
|
|
||||||
|
- **Mocking Dependencies for Dynamically Imported Modules**
|
||||||
|
- **Problem**: Standard `jest.mock()` often fails for dependencies of modules loaded later using dynamic `import('path/to/module')`. The mocks aren't applied correctly when the dynamic import resolves.
|
||||||
|
- **Solution**: Use `jest.unstable_mockModule(modulePath, factory)` **before** the dynamic `import()` call.
|
||||||
```javascript
|
```javascript
|
||||||
// Mock the entire module with custom implementation
|
// 1. Define mock function instances
|
||||||
jest.mock('../../scripts/modules/task-manager.js', () => {
|
const mockExistsSync = jest.fn();
|
||||||
// Get original implementation for functions you want to preserve
|
const mockReadFileSync = jest.fn();
|
||||||
const originalModule = jest.requireActual('../../scripts/modules/task-manager.js');
|
// ... other mocks
|
||||||
|
|
||||||
// Return mix of original and mocked functionality
|
// 2. Mock the dependency module *before* the dynamic import
|
||||||
return {
|
jest.unstable_mockModule('fs', () => ({
|
||||||
...originalModule,
|
__esModule: true, // Important for ES module mocks
|
||||||
generateTaskFiles: jest.fn() // Replace specific functions
|
// Mock named exports
|
||||||
};
|
existsSync: mockExistsSync,
|
||||||
|
readFileSync: mockReadFileSync,
|
||||||
|
// Mock default export if necessary
|
||||||
|
// default: { ... }
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 3. Dynamically import the module under test (e.g., in beforeAll or test case)
|
||||||
|
let moduleUnderTest;
|
||||||
|
beforeAll(async () => {
|
||||||
|
// Ensure mocks are reset if needed before import
|
||||||
|
mockExistsSync.mockReset();
|
||||||
|
mockReadFileSync.mockReset();
|
||||||
|
// ... reset other mocks ...
|
||||||
|
|
||||||
|
// Import *after* unstable_mockModule is called
|
||||||
|
moduleUnderTest = await import('../../scripts/modules/module-using-fs.js');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Import after mocks
|
// 4. Now tests can use moduleUnderTest, and its 'fs' calls will hit the mocks
|
||||||
import * as taskManager from '../../scripts/modules/task-manager.js';
|
test('should use mocked fs.readFileSync', () => {
|
||||||
|
mockReadFileSync.mockReturnValue('mock data');
|
||||||
// Now you can use the mock directly
|
moduleUnderTest.readFileAndProcess();
|
||||||
const { generateTaskFiles } = taskManager;
|
expect(mockReadFileSync).toHaveBeenCalled();
|
||||||
|
// ... other assertions
|
||||||
|
});
|
||||||
|
```
|
||||||
|
- ✅ **DO**: Call `jest.unstable_mockModule()` before `await import()`.
|
||||||
|
- ✅ **DO**: Include `__esModule: true` in the mock factory for ES modules.
|
||||||
|
- ✅ **DO**: Mock named and default exports as needed within the factory.
|
||||||
|
- ✅ **DO**: Reset mock functions (`mockFn.mockReset()`) before the dynamic import if they might have been called previously.
|
||||||
|
|
||||||
|
- **Mocking Entire Modules (Static Import)**
|
||||||
|
```javascript
|
||||||
|
// Mock the entire module with custom implementation for static imports
|
||||||
|
// ... (existing example remains valid) ...
|
||||||
```
|
```
|
||||||
|
|
||||||
- **Direct Implementation Testing**
|
- **Direct Implementation Testing**
|
||||||
- Instead of calling the actual function which may have module-scope reference issues:
|
- Instead of calling the actual function which may have module-scope reference issues:
|
||||||
```javascript
|
```javascript
|
||||||
test('should perform expected actions', () => {
|
// ... (existing example remains valid) ...
|
||||||
// Setup mocks for this specific test
|
|
||||||
mockReadJSON.mockImplementationOnce(() => sampleData);
|
|
||||||
|
|
||||||
// Manually simulate the function's behavior
|
|
||||||
const data = mockReadJSON('path/file.json');
|
|
||||||
mockValidateAndFixDependencies(data, 'path/file.json');
|
|
||||||
|
|
||||||
// Skip calling the actual function and verify mocks directly
|
|
||||||
expect(mockReadJSON).toHaveBeenCalledWith('path/file.json');
|
|
||||||
expect(mockValidateAndFixDependencies).toHaveBeenCalledWith(data, 'path/file.json');
|
|
||||||
});
|
|
||||||
```
|
```
|
||||||
|
|
||||||
- **Avoiding Module Property Assignment**
|
- **Avoiding Module Property Assignment**
|
||||||
```javascript
|
```javascript
|
||||||
// ❌ DON'T: This causes "Cannot assign to read only property" errors
|
// ... (existing example remains valid) ...
|
||||||
const utils = await import('../../scripts/modules/utils.js');
|
|
||||||
utils.readJSON = mockReadJSON; // Error: read-only property
|
|
||||||
|
|
||||||
// ✅ DO: Use the module factory pattern in jest.mock()
|
|
||||||
jest.mock('../../scripts/modules/utils.js', () => ({
|
|
||||||
readJSON: mockReadJSONFunc,
|
|
||||||
writeJSON: mockWriteJSONFunc
|
|
||||||
}));
|
|
||||||
```
|
```
|
||||||
|
|
||||||
- **Handling Mock Verification Failures**
|
- **Handling Mock Verification Failures**
|
||||||
- If verification like `expect(mockFn).toHaveBeenCalled()` fails:
|
- If verification like `expect(mockFn).toHaveBeenCalled()` fails:
|
||||||
1. Check that your mock setup is before imports
|
1. Check that your mock setup (`jest.mock` or `jest.unstable_mockModule`) is correctly placed **before** imports (static or dynamic).
|
||||||
2. Ensure you're using the right mock instance
|
2. Ensure you're using the right mock instance and it's properly passed to the module.
|
||||||
3. Verify your test invokes behavior that would call the mock
|
3. Verify your test invokes behavior that *should* call the mock.
|
||||||
4. Use `jest.clearAllMocks()` in beforeEach to reset mock state
|
4. Use `jest.clearAllMocks()` or specific `mockFn.mockReset()` in `beforeEach` to prevent state leakage between tests.
|
||||||
5. Consider implementing a simpler test that directly verifies mock behavior
|
5. **Check Console Assertions**: If verifying `console.log`, `console.warn`, or `console.error` calls, ensure your assertion matches the *actual* arguments passed. If the code logs a single formatted string, assert against that single string (using `expect.stringContaining` or exact match), not multiple `expect.stringContaining` arguments.
|
||||||
|
```javascript
|
||||||
- **Full Example Pattern**
|
// Example: Code logs console.error(`Error: ${message}. Details: ${details}`)
|
||||||
```javascript
|
// ❌ DON'T: Assert multiple arguments if only one is logged
|
||||||
// 1. Define mock implementations
|
// expect(console.error).toHaveBeenCalledWith(
|
||||||
const mockReadJSON = jest.fn();
|
// expect.stringContaining('Error:'),
|
||||||
const mockValidateAndFixDependencies = jest.fn();
|
// expect.stringContaining('Details:')
|
||||||
|
// );
|
||||||
// 2. Mock modules
|
// ✅ DO: Assert the single string argument
|
||||||
jest.mock('../../scripts/modules/utils.js', () => ({
|
expect(console.error).toHaveBeenCalledWith(
|
||||||
readJSON: mockReadJSON,
|
expect.stringContaining('Error: Specific message. Details: More details')
|
||||||
// Include other functions as needed
|
);
|
||||||
}));
|
// or for exact match:
|
||||||
|
expect(console.error).toHaveBeenCalledWith(
|
||||||
jest.mock('../../scripts/modules/dependency-manager.js', () => ({
|
'Error: Specific message. Details: More details'
|
||||||
validateAndFixDependencies: mockValidateAndFixDependencies
|
);
|
||||||
}));
|
```
|
||||||
|
6. Consider implementing a simpler test that *only* verifies the mock behavior in isolation.
|
||||||
// 3. Import after mocks
|
|
||||||
import * as taskManager from '../../scripts/modules/task-manager.js';
|
|
||||||
|
|
||||||
describe('generateTaskFiles function', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should generate task files', () => {
|
|
||||||
// 4. Setup test-specific mock behavior
|
|
||||||
const sampleData = { tasks: [{ id: 1, title: 'Test' }] };
|
|
||||||
mockReadJSON.mockReturnValueOnce(sampleData);
|
|
||||||
|
|
||||||
// 5. Create direct implementation test
|
|
||||||
// Instead of calling: taskManager.generateTaskFiles('path', 'dir')
|
|
||||||
|
|
||||||
// Simulate reading data
|
|
||||||
const data = mockReadJSON('path');
|
|
||||||
expect(mockReadJSON).toHaveBeenCalledWith('path');
|
|
||||||
|
|
||||||
// Simulate other operations the function would perform
|
|
||||||
mockValidateAndFixDependencies(data, 'path');
|
|
||||||
expect(mockValidateAndFixDependencies).toHaveBeenCalledWith(data, 'path');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## Mocking Guidelines
|
## Mocking Guidelines
|
||||||
|
|
||||||
@@ -552,6 +660,102 @@ npm test -- -t "pattern to match"
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Testing AI Service Integrations
|
||||||
|
|
||||||
|
- **DO NOT import real AI service clients**
|
||||||
|
- ❌ DON'T: Import actual AI clients from their libraries
|
||||||
|
- ✅ DO: Create fully mocked versions that return predictable responses
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ❌ DON'T: Import and instantiate real AI clients
|
||||||
|
import { Anthropic } from '@anthropic-ai/sdk';
|
||||||
|
const anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });
|
||||||
|
|
||||||
|
// ✅ DO: Mock the entire module with controlled behavior
|
||||||
|
jest.mock('@anthropic-ai/sdk', () => ({
|
||||||
|
Anthropic: jest.fn().mockImplementation(() => ({
|
||||||
|
messages: {
|
||||||
|
create: jest.fn().mockResolvedValue({
|
||||||
|
content: [{ type: 'text', text: 'Mocked AI response' }]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
}));
|
||||||
|
```
|
||||||
|
|
||||||
|
- **DO NOT rely on environment variables for API keys**
|
||||||
|
- ❌ DON'T: Assume environment variables are set in tests
|
||||||
|
- ✅ DO: Set mock environment variables in test setup
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// In tests/setup.js or at the top of test file
|
||||||
|
process.env.ANTHROPIC_API_KEY = 'test-mock-api-key-for-tests';
|
||||||
|
process.env.PERPLEXITY_API_KEY = 'test-mock-perplexity-key-for-tests';
|
||||||
|
```
|
||||||
|
|
||||||
|
- **DO NOT use real AI client initialization logic**
|
||||||
|
- ❌ DON'T: Use code that attempts to initialize or validate real AI clients
|
||||||
|
- ✅ DO: Create test-specific paths that bypass client initialization
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ❌ DON'T: Test functions that require valid AI client initialization
|
||||||
|
// This will fail without proper API keys or network access
|
||||||
|
test('should use AI client', async () => {
|
||||||
|
const result = await functionThatInitializesAIClient();
|
||||||
|
expect(result).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
// ✅ DO: Test with bypassed initialization or manual task paths
|
||||||
|
test('should handle manual task creation without AI', () => {
|
||||||
|
// Using a path that doesn't require AI client initialization
|
||||||
|
const result = addTaskDirect({
|
||||||
|
title: 'Manual Task',
|
||||||
|
description: 'Test Description'
|
||||||
|
}, mockLogger);
|
||||||
|
|
||||||
|
expect(result.success).toBe(true);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing Asynchronous Code
|
||||||
|
|
||||||
|
- **DO NOT rely on asynchronous operations in tests**
|
||||||
|
- ❌ DON'T: Use real async/await or Promise resolution in tests
|
||||||
|
- ✅ DO: Make all mocks return synchronous values when possible
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ❌ DON'T: Use real async functions that might fail unpredictably
|
||||||
|
test('should handle async operation', async () => {
|
||||||
|
const result = await realAsyncFunction(); // Can time out or fail for external reasons
|
||||||
|
expect(result).toBe(expectedValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
// ✅ DO: Make async operations synchronous in tests
|
||||||
|
test('should handle operation', () => {
|
||||||
|
mockAsyncFunction.mockReturnValue({ success: true, data: 'test' });
|
||||||
|
const result = functionUnderTest();
|
||||||
|
expect(result).toEqual({ success: true, data: 'test' });
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
- **DO NOT test exact error messages**
|
||||||
|
- ❌ DON'T: Assert on exact error message text that might change
|
||||||
|
- ✅ DO: Test for error presence and general properties
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ❌ DON'T: Test for exact error message text
|
||||||
|
expect(result.error).toBe('Could not connect to API: Network error');
|
||||||
|
|
||||||
|
// ✅ DO: Test for general error properties or message patterns
|
||||||
|
expect(result.success).toBe(false);
|
||||||
|
expect(result.error).toContain('Could not connect');
|
||||||
|
// Or even better:
|
||||||
|
expect(result).toMatchObject({
|
||||||
|
success: false,
|
||||||
|
error: expect.stringContaining('connect')
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
## Reliable Testing Techniques
|
## Reliable Testing Techniques
|
||||||
|
|
||||||
- **Create Simplified Test Functions**
|
- **Create Simplified Test Functions**
|
||||||
@@ -564,99 +768,125 @@ npm test -- -t "pattern to match"
|
|||||||
const setTaskStatus = async (taskId, newStatus) => {
|
const setTaskStatus = async (taskId, newStatus) => {
|
||||||
const tasksPath = 'tasks/tasks.json';
|
const tasksPath = 'tasks/tasks.json';
|
||||||
const data = await readJSON(tasksPath);
|
const data = await readJSON(tasksPath);
|
||||||
// Update task status logic
|
// [implementation]
|
||||||
await writeJSON(tasksPath, data);
|
await writeJSON(tasksPath, data);
|
||||||
return data;
|
return { success: true };
|
||||||
};
|
};
|
||||||
|
|
||||||
// Test-friendly simplified function (easy to test)
|
// Test-friendly version (easier to test)
|
||||||
const testSetTaskStatus = (tasksData, taskIdInput, newStatus) => {
|
const updateTaskStatus = (tasks, taskId, newStatus) => {
|
||||||
// Same core logic without file operations
|
// Pure logic without side effects
|
||||||
// Update task status logic on provided tasksData object
|
const updatedTasks = [...tasks];
|
||||||
return tasksData; // Return updated data for assertions
|
const taskIndex = findTaskById(updatedTasks, taskId);
|
||||||
|
if (taskIndex === -1) return { success: false, error: 'Task not found' };
|
||||||
|
updatedTasks[taskIndex].status = newStatus;
|
||||||
|
return { success: true, tasks: updatedTasks };
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
- **Avoid Real File System Operations**
|
|
||||||
- Never write to real files during tests
|
|
||||||
- Create test-specific versions of file operation functions
|
|
||||||
- Mock all file system operations including read, write, exists, etc.
|
|
||||||
- Verify function behavior using the in-memory data structures
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
// Mock file operations
|
|
||||||
const mockReadJSON = jest.fn();
|
|
||||||
const mockWriteJSON = jest.fn();
|
|
||||||
|
|
||||||
jest.mock('../../scripts/modules/utils.js', () => ({
|
|
||||||
readJSON: mockReadJSON,
|
|
||||||
writeJSON: mockWriteJSON,
|
|
||||||
}));
|
|
||||||
|
|
||||||
test('should update task status correctly', () => {
|
|
||||||
// Setup mock data
|
|
||||||
const testData = JSON.parse(JSON.stringify(sampleTasks));
|
|
||||||
mockReadJSON.mockReturnValue(testData);
|
|
||||||
|
|
||||||
// Call the function that would normally modify files
|
|
||||||
const result = testSetTaskStatus(testData, '1', 'done');
|
|
||||||
|
|
||||||
// Assert on the in-memory data structure
|
|
||||||
expect(result.tasks[0].status).toBe('done');
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
- **Data Isolation Between Tests**
|
|
||||||
- Always create fresh copies of test data for each test
|
|
||||||
- Use `JSON.parse(JSON.stringify(original))` for deep cloning
|
|
||||||
- Reset all mocks before each test with `jest.clearAllMocks()`
|
|
||||||
- Avoid state that persists between tests
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.clearAllMocks();
|
|
||||||
// Deep clone the test data
|
|
||||||
testTasksData = JSON.parse(JSON.stringify(sampleTasks));
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
- **Test All Path Variations**
|
|
||||||
- Regular tasks and subtasks
|
|
||||||
- Single items and multiple items
|
|
||||||
- Success paths and error paths
|
|
||||||
- Edge cases (empty data, invalid inputs, etc.)
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
// Multiple test cases covering different scenarios
|
|
||||||
test('should update regular task status', () => {
|
|
||||||
/* test implementation */
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should update subtask status', () => {
|
|
||||||
/* test implementation */
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should update multiple tasks when given comma-separated IDs', () => {
|
|
||||||
/* test implementation */
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should throw error for non-existent task ID', () => {
|
|
||||||
/* test implementation */
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
- **Stabilize Tests With Predictable Input/Output**
|
|
||||||
- Use consistent, predictable test fixtures
|
|
||||||
- Avoid random values or time-dependent data
|
|
||||||
- Make tests deterministic for reliable CI/CD
|
|
||||||
- Control all variables that might affect test outcomes
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
// Use a specific known date instead of current date
|
|
||||||
const fixedDate = new Date('2023-01-01T12:00:00Z');
|
|
||||||
jest.spyOn(global, 'Date').mockImplementation(() => fixedDate);
|
|
||||||
```
|
|
||||||
|
|
||||||
See [tests/README.md](mdc:tests/README.md) for more details on the testing approach.
|
See [tests/README.md](mdc:tests/README.md) for more details on the testing approach.
|
||||||
|
|
||||||
Refer to [jest.config.js](mdc:jest.config.js) for Jest configuration options.
|
Refer to [jest.config.js](mdc:jest.config.js) for Jest configuration options.
|
||||||
|
|
||||||
|
## Variable Hoisting and Module Initialization Issues
|
||||||
|
|
||||||
|
When testing ES modules or working with complex module imports, you may encounter variable hoisting and initialization issues. These can be particularly tricky to debug and often appear as "Cannot access 'X' before initialization" errors.
|
||||||
|
|
||||||
|
- **Understanding Module Initialization Order**
|
||||||
|
- ✅ **DO**: Declare and initialize global variables at the top of modules
|
||||||
|
- ✅ **DO**: Use proper function declarations to avoid hoisting issues
|
||||||
|
- ✅ **DO**: Initialize variables before they are referenced, especially in imported modules
|
||||||
|
- ✅ **DO**: Be aware that imports are hoisted to the top of the file
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Define global state variables at the top of the module
|
||||||
|
let silentMode = false; // Declare and initialize first
|
||||||
|
|
||||||
|
const CONFIG = { /* configuration */ };
|
||||||
|
|
||||||
|
function isSilentMode() {
|
||||||
|
return silentMode; // Reference variable after it's initialized
|
||||||
|
}
|
||||||
|
|
||||||
|
function log(level, message) {
|
||||||
|
if (isSilentMode()) return; // Use the function instead of accessing variable directly
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Testing Modules with Initialization-Dependent Functions**
|
||||||
|
- ✅ **DO**: Create test-specific implementations that initialize all variables correctly
|
||||||
|
- ✅ **DO**: Use factory functions in mocks to ensure proper initialization order
|
||||||
|
- ✅ **DO**: Be careful with how you mock or stub functions that depend on module state
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Test-specific implementation that avoids initialization issues
|
||||||
|
const testLog = (level, ...args) => {
|
||||||
|
// Local implementation with proper initialization
|
||||||
|
const isSilent = false; // Explicit initialization
|
||||||
|
if (isSilent) return;
|
||||||
|
// Test implementation...
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Common Hoisting-Related Errors to Avoid**
|
||||||
|
- ❌ **DON'T**: Reference variables before their declaration in module scope
|
||||||
|
- ❌ **DON'T**: Create circular dependencies between modules
|
||||||
|
- ❌ **DON'T**: Rely on variable initialization order across module boundaries
|
||||||
|
- ❌ **DON'T**: Define functions that use hoisted variables before they're initialized
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ❌ DON'T: Create reference-before-initialization patterns
|
||||||
|
function badFunction() {
|
||||||
|
if (silentMode) { /* ... */ } // ReferenceError if silentMode is declared later
|
||||||
|
}
|
||||||
|
|
||||||
|
let silentMode = false;
|
||||||
|
|
||||||
|
// ❌ DON'T: Create cross-module references that depend on initialization order
|
||||||
|
// module-a.js
|
||||||
|
import { getSetting } from './module-b.js';
|
||||||
|
export const config = { value: getSetting() };
|
||||||
|
|
||||||
|
// module-b.js
|
||||||
|
import { config } from './module-a.js';
|
||||||
|
export function getSetting() {
|
||||||
|
return config.value; // Circular dependency causing initialization issues
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Dynamic Imports as a Solution**
|
||||||
|
- ✅ **DO**: Use dynamic imports (`import()`) to avoid initialization order issues
|
||||||
|
- ✅ **DO**: Structure modules to avoid circular dependencies that cause initialization issues
|
||||||
|
- ✅ **DO**: Consider factory functions for modules with complex state
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Use dynamic imports to avoid initialization issues
|
||||||
|
async function getTaskManager() {
|
||||||
|
return import('./task-manager.js');
|
||||||
|
}
|
||||||
|
|
||||||
|
async function someFunction() {
|
||||||
|
const taskManager = await getTaskManager();
|
||||||
|
return taskManager.someMethod();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Testing Approach for Modules with Initialization Issues**
|
||||||
|
- ✅ **DO**: Create self-contained test implementations rather than using real implementations
|
||||||
|
- ✅ **DO**: Mock dependencies at module boundaries instead of trying to mock deep dependencies
|
||||||
|
- ✅ **DO**: Isolate module-specific state in tests
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Create isolated test implementation instead of reusing module code
|
||||||
|
test('should log messages when not in silent mode', () => {
|
||||||
|
// Local test implementation instead of importing from module
|
||||||
|
const testLog = (level, message) => {
|
||||||
|
if (false) return; // Always non-silent for this test
|
||||||
|
mockConsole(level, message);
|
||||||
|
};
|
||||||
|
|
||||||
|
testLog('info', 'test message');
|
||||||
|
expect(mockConsole).toHaveBeenCalledWith('info', 'test message');
|
||||||
|
});
|
||||||
|
```
|
||||||
@@ -150,4 +150,91 @@ alwaysApply: false
|
|||||||
));
|
));
|
||||||
```
|
```
|
||||||
|
|
||||||
Refer to [`ui.js`](mdc:scripts/modules/ui.js) for implementation examples and [`new_features.mdc`](mdc:.cursor/rules/new_features.mdc) for integration guidelines.
|
## Enhanced Display Patterns
|
||||||
|
|
||||||
|
### **Token Breakdown Display**
|
||||||
|
- Use detailed, granular token breakdowns for AI-powered commands
|
||||||
|
- Display context sources with individual token counts
|
||||||
|
- Show both token count and character count for transparency
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Display detailed token breakdown
|
||||||
|
function displayDetailedTokenBreakdown(tokenBreakdown, systemTokens, userTokens) {
|
||||||
|
const sections = [];
|
||||||
|
|
||||||
|
if (tokenBreakdown.tasks?.length > 0) {
|
||||||
|
const taskDetails = tokenBreakdown.tasks.map(task =>
|
||||||
|
`${task.type === 'subtask' ? ' ' : ''}${task.id}: ${task.tokens.toLocaleString()}`
|
||||||
|
).join('\n');
|
||||||
|
sections.push(`Tasks (${tokenBreakdown.tasks.reduce((sum, t) => sum + t.tokens, 0).toLocaleString()}):\n${taskDetails}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const content = sections.join('\n\n');
|
||||||
|
console.log(boxen(content, {
|
||||||
|
title: chalk.cyan('Token Usage'),
|
||||||
|
padding: { top: 1, bottom: 1, left: 2, right: 2 },
|
||||||
|
borderStyle: 'round',
|
||||||
|
borderColor: 'cyan'
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Code Block Syntax Highlighting**
|
||||||
|
- Use `cli-highlight` library for syntax highlighting in terminal output
|
||||||
|
- Process code blocks in AI responses for better readability
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Enhance code blocks with syntax highlighting
|
||||||
|
import { highlight } from 'cli-highlight';
|
||||||
|
|
||||||
|
function processCodeBlocks(text) {
|
||||||
|
return text.replace(/```(\w+)?\n([\s\S]*?)```/g, (match, language, code) => {
|
||||||
|
try {
|
||||||
|
const highlighted = highlight(code.trim(), {
|
||||||
|
language: language || 'javascript',
|
||||||
|
theme: 'default'
|
||||||
|
});
|
||||||
|
return `\n${highlighted}\n`;
|
||||||
|
} catch (error) {
|
||||||
|
return `\n${code.trim()}\n`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Multi-Section Result Display**
|
||||||
|
- Use separate boxes for headers, content, and metadata
|
||||||
|
- Maintain consistent styling across different result types
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// ✅ DO: Use structured result display
|
||||||
|
function displayResults(result, query, detailLevel) {
|
||||||
|
// Header with query info
|
||||||
|
const header = boxen(
|
||||||
|
chalk.green.bold('Research Results') + '\n\n' +
|
||||||
|
chalk.gray('Query: ') + chalk.white(query) + '\n' +
|
||||||
|
chalk.gray('Detail Level: ') + chalk.cyan(detailLevel),
|
||||||
|
{
|
||||||
|
padding: { top: 1, bottom: 1, left: 2, right: 2 },
|
||||||
|
margin: { top: 1, bottom: 0 },
|
||||||
|
borderStyle: 'round',
|
||||||
|
borderColor: 'green'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
console.log(header);
|
||||||
|
|
||||||
|
// Process and display main content
|
||||||
|
const processedResult = processCodeBlocks(result);
|
||||||
|
const contentBox = boxen(processedResult, {
|
||||||
|
padding: { top: 1, bottom: 1, left: 2, right: 2 },
|
||||||
|
margin: { top: 0, bottom: 1 },
|
||||||
|
borderStyle: 'single',
|
||||||
|
borderColor: 'gray'
|
||||||
|
});
|
||||||
|
console.log(contentBox);
|
||||||
|
|
||||||
|
console.log(chalk.green('✓ Operation complete'));
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Refer to [`ui.js`](mdc:scripts/modules/ui.js) for implementation examples, [`context_gathering.mdc`](mdc:.cursor/rules/context_gathering.mdc) for context display patterns, and [`new_features.mdc`](mdc:.cursor/rules/new_features.mdc) for integration guidelines.
|
||||||
File diff suppressed because it is too large
Load Diff
33
.env.example
33
.env.example
@@ -1,20 +1,15 @@
|
|||||||
# API Keys (Required)
|
# API Keys (Required for using in any role i.e. main/research/fallback -- see `task-master models`)
|
||||||
ANTHROPIC_API_KEY=your_anthropic_api_key_here # Format: sk-ant-api03-...
|
ANTHROPIC_API_KEY=YOUR_ANTHROPIC_KEY_HERE
|
||||||
PERPLEXITY_API_KEY=your_perplexity_api_key_here # Format: pplx-...
|
PERPLEXITY_API_KEY=YOUR_PERPLEXITY_KEY_HERE
|
||||||
|
OPENAI_API_KEY=YOUR_OPENAI_KEY_HERE
|
||||||
|
GOOGLE_API_KEY=YOUR_GOOGLE_KEY_HERE
|
||||||
|
MISTRAL_API_KEY=YOUR_MISTRAL_KEY_HERE
|
||||||
|
OPENROUTER_API_KEY=YOUR_OPENROUTER_KEY_HERE
|
||||||
|
XAI_API_KEY=YOUR_XAI_KEY_HERE
|
||||||
|
AZURE_OPENAI_API_KEY=YOUR_AZURE_KEY_HERE
|
||||||
|
|
||||||
# Model Configuration
|
# Google Vertex AI Configuration
|
||||||
MODEL=claude-3-7-sonnet-20250219 # Recommended models: claude-3-7-sonnet-20250219, claude-3-opus-20240229
|
VERTEX_PROJECT_ID=your-gcp-project-id
|
||||||
PERPLEXITY_MODEL=sonar-pro # Perplexity model for research-backed subtasks
|
VERTEX_LOCATION=us-central1
|
||||||
MAX_TOKENS=64000 # Maximum tokens for model responses
|
# Optional: Path to service account credentials JSON file (alternative to API key)
|
||||||
TEMPERATURE=0.4 # Temperature for model responses (0.0-1.0)
|
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account-credentials.json
|
||||||
|
|
||||||
# Logging Configuration
|
|
||||||
DEBUG=false # Enable debug logging (true/false)
|
|
||||||
LOG_LEVEL=info # Log level (debug, info, warn, error)
|
|
||||||
|
|
||||||
# Task Generation Settings
|
|
||||||
DEFAULT_SUBTASKS=4 # Default number of subtasks when expanding
|
|
||||||
DEFAULT_PRIORITY=medium # Default priority for generated tasks (high, medium, low)
|
|
||||||
|
|
||||||
# Project Metadata (Optional)
|
|
||||||
PROJECT_NAME=Your Project Name # Override default project name in tasks.json
|
|
||||||
|
|||||||
39
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
39
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: 'bug: '
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
---
|
||||||
|
|
||||||
|
### Description
|
||||||
|
|
||||||
|
Detailed description of the problem, including steps to reproduce the issue.
|
||||||
|
|
||||||
|
### Steps to Reproduce
|
||||||
|
|
||||||
|
1. Step-by-step instructions to reproduce the issue
|
||||||
|
2. Include command examples or UI interactions
|
||||||
|
|
||||||
|
### Expected Behavior
|
||||||
|
|
||||||
|
Describe clearly what the expected outcome or behavior should be.
|
||||||
|
|
||||||
|
### Actual Behavior
|
||||||
|
|
||||||
|
Describe clearly what the actual outcome or behavior is.
|
||||||
|
|
||||||
|
### Screenshots or Logs
|
||||||
|
|
||||||
|
Provide screenshots, logs, or error messages if applicable.
|
||||||
|
|
||||||
|
### Environment
|
||||||
|
|
||||||
|
- Task Master version:
|
||||||
|
- Node.js version:
|
||||||
|
- Operating system:
|
||||||
|
- IDE (if applicable):
|
||||||
|
|
||||||
|
### Additional Context
|
||||||
|
|
||||||
|
Any additional information or context that might help diagnose the issue.
|
||||||
51
.github/ISSUE_TEMPLATE/enhancements---feature-requests.md
vendored
Normal file
51
.github/ISSUE_TEMPLATE/enhancements---feature-requests.md
vendored
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
---
|
||||||
|
name: Enhancements & feature requests
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: 'feat: '
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
---
|
||||||
|
|
||||||
|
> "Direct quote or clear summary of user request or need or user story."
|
||||||
|
|
||||||
|
### Motivation
|
||||||
|
|
||||||
|
Detailed explanation of why this feature is important. Describe the problem it solves or the benefit it provides.
|
||||||
|
|
||||||
|
### Proposed Solution
|
||||||
|
|
||||||
|
Clearly describe the proposed feature, including:
|
||||||
|
|
||||||
|
- High-level overview of the feature
|
||||||
|
- Relevant technologies or integrations
|
||||||
|
- How it fits into the existing workflow or architecture
|
||||||
|
|
||||||
|
### High-Level Workflow
|
||||||
|
|
||||||
|
1. Step-by-step description of how the feature will be implemented
|
||||||
|
2. Include necessary intermediate milestones
|
||||||
|
|
||||||
|
### Key Elements
|
||||||
|
|
||||||
|
- Bullet-point list of technical or UX/UI enhancements
|
||||||
|
- Mention specific integrations or APIs
|
||||||
|
- Highlight changes needed in existing data models or commands
|
||||||
|
|
||||||
|
### Example Workflow
|
||||||
|
|
||||||
|
Provide a clear, concrete example demonstrating the feature:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ task-master [action]
|
||||||
|
→ Expected response/output
|
||||||
|
```
|
||||||
|
|
||||||
|
### Implementation Considerations
|
||||||
|
|
||||||
|
- Dependencies on external components or APIs
|
||||||
|
- Backward compatibility requirements
|
||||||
|
- Potential performance impacts or resource usage
|
||||||
|
|
||||||
|
### Out of Scope (Future Considerations)
|
||||||
|
|
||||||
|
Clearly list any features or improvements not included but relevant for future iterations.
|
||||||
31
.github/ISSUE_TEMPLATE/feedback.md
vendored
Normal file
31
.github/ISSUE_TEMPLATE/feedback.md
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
name: Feedback
|
||||||
|
about: Give us specific feedback on the product/approach/tech
|
||||||
|
title: 'feedback: '
|
||||||
|
labels: feedback
|
||||||
|
assignees: ''
|
||||||
|
---
|
||||||
|
|
||||||
|
### Feedback Summary
|
||||||
|
|
||||||
|
Provide a clear summary or direct quote from user feedback.
|
||||||
|
|
||||||
|
### User Context
|
||||||
|
|
||||||
|
Explain the user's context or scenario in which this feedback was provided.
|
||||||
|
|
||||||
|
### User Impact
|
||||||
|
|
||||||
|
Describe how this feedback affects the user experience or workflow.
|
||||||
|
|
||||||
|
### Suggestions
|
||||||
|
|
||||||
|
Provide any initial thoughts, potential solutions, or improvements based on the feedback.
|
||||||
|
|
||||||
|
### Relevant Screenshots or Examples
|
||||||
|
|
||||||
|
Attach screenshots, logs, or examples that illustrate the feedback.
|
||||||
|
|
||||||
|
### Additional Notes
|
||||||
|
|
||||||
|
Any additional context or related information.
|
||||||
95
.github/workflows/ci.yml
vendored
Normal file
95
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- next
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- next
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
setup:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
id: install
|
||||||
|
run: npm ci
|
||||||
|
timeout-minutes: 2
|
||||||
|
|
||||||
|
- name: Cache node_modules
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
|
||||||
|
format-check:
|
||||||
|
needs: setup
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
|
||||||
|
- name: Restore node_modules
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
|
||||||
|
- name: Format Check
|
||||||
|
run: npm run format-check
|
||||||
|
env:
|
||||||
|
FORCE_COLOR: 1
|
||||||
|
|
||||||
|
test:
|
||||||
|
needs: setup
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
|
||||||
|
- name: Restore node_modules
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
|
||||||
|
- name: Run Tests
|
||||||
|
run: |
|
||||||
|
npm run test:coverage -- --coverageThreshold '{"global":{"branches":0,"functions":0,"lines":0,"statements":0}}' --detectOpenHandles --forceExit
|
||||||
|
env:
|
||||||
|
NODE_ENV: test
|
||||||
|
CI: true
|
||||||
|
FORCE_COLOR: 1
|
||||||
|
timeout-minutes: 10
|
||||||
|
|
||||||
|
- name: Upload Test Results
|
||||||
|
if: always()
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: test-results
|
||||||
|
path: |
|
||||||
|
test-results
|
||||||
|
coverage
|
||||||
|
junit.xml
|
||||||
|
retention-days: 30
|
||||||
62
.github/workflows/pre-release.yml
vendored
Normal file
62
.github/workflows/pre-release.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
name: Pre-Release (RC)
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch: # Allows manual triggering from GitHub UI/API
|
||||||
|
|
||||||
|
concurrency: pre-release-${{ github.ref }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
rc:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Cache node_modules
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
node_modules
|
||||||
|
*/*/node_modules
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
timeout-minutes: 2
|
||||||
|
|
||||||
|
- name: Enter RC mode
|
||||||
|
run: |
|
||||||
|
npx changeset pre exit || true
|
||||||
|
npx changeset pre enter rc
|
||||||
|
|
||||||
|
- name: Version RC packages
|
||||||
|
run: npx changeset version
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
|
- name: Create Release Candidate Pull Request or Publish Release Candidate to npm
|
||||||
|
uses: changesets/action@v1
|
||||||
|
with:
|
||||||
|
publish: npm run release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
|
- name: Exit RC mode
|
||||||
|
run: npx changeset pre exit
|
||||||
|
|
||||||
|
- name: Commit & Push changes
|
||||||
|
uses: actions-js/push@master
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
branch: ${{ github.ref }}
|
||||||
|
message: 'chore: rc version bump'
|
||||||
21
.github/workflows/release.yml
vendored
21
.github/workflows/release.yml
vendored
@@ -3,7 +3,9 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- next
|
|
||||||
|
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -15,9 +17,24 @@ jobs:
|
|||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Cache node_modules
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
node_modules
|
||||||
|
*/*/node_modules
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm install
|
run: npm ci
|
||||||
|
timeout-minutes: 2
|
||||||
|
|
||||||
|
- name: Exit pre-release mode (safety check)
|
||||||
|
run: npx changeset pre exit || true
|
||||||
|
|
||||||
- name: Create Release Pull Request or Publish to npm
|
- name: Create Release Pull Request or Publish to npm
|
||||||
uses: changesets/action@v1
|
uses: changesets/action@v1
|
||||||
|
|||||||
40
.github/workflows/update-models-md.yml
vendored
Normal file
40
.github/workflows/update-models-md.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
name: Update models.md from supported-models.json
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- next
|
||||||
|
paths:
|
||||||
|
- 'scripts/modules/supported-models.json'
|
||||||
|
- 'docs/scripts/models-json-to-markdown.js'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update_markdown:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
|
||||||
|
- name: Run transformation script
|
||||||
|
run: node docs/scripts/models-json-to-markdown.js
|
||||||
|
|
||||||
|
- name: Format Markdown with Prettier
|
||||||
|
run: npx prettier --write docs/models.md
|
||||||
|
|
||||||
|
- name: Stage docs/models.md
|
||||||
|
run: git add docs/models.md
|
||||||
|
|
||||||
|
- name: Commit & Push docs/models.md
|
||||||
|
uses: actions-js/push@master
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
branch: ${{ github.ref_name }}
|
||||||
|
message: 'docs: Auto-update and format models.md'
|
||||||
|
author_name: 'github-actions[bot]'
|
||||||
|
author_email: 'github-actions[bot]@users.noreply.github.com'
|
||||||
35
.gitignore
vendored
35
.gitignore
vendored
@@ -9,6 +9,9 @@ jspm_packages/
|
|||||||
.env.test.local
|
.env.test.local
|
||||||
.env.production.local
|
.env.production.local
|
||||||
|
|
||||||
|
# Cursor configuration -- might have ENV variables. Included by default
|
||||||
|
# .cursor/mcp.json
|
||||||
|
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
*.log
|
*.log
|
||||||
@@ -18,9 +21,24 @@ yarn-error.log*
|
|||||||
lerna-debug.log*
|
lerna-debug.log*
|
||||||
|
|
||||||
# Coverage directory used by tools like istanbul
|
# Coverage directory used by tools like istanbul
|
||||||
coverage
|
coverage/
|
||||||
*.lcov
|
*.lcov
|
||||||
|
|
||||||
|
# Jest cache
|
||||||
|
.jest/
|
||||||
|
|
||||||
|
# Test temporary files and directories
|
||||||
|
tests/temp/
|
||||||
|
tests/e2e/_runs/
|
||||||
|
tests/e2e/log/
|
||||||
|
tests/**/*.log
|
||||||
|
tests/**/coverage/
|
||||||
|
|
||||||
|
# Test database files (if any)
|
||||||
|
tests/**/*.db
|
||||||
|
tests/**/*.sqlite
|
||||||
|
tests/**/*.sqlite3
|
||||||
|
|
||||||
# Optional npm cache directory
|
# Optional npm cache directory
|
||||||
.npm
|
.npm
|
||||||
|
|
||||||
@@ -55,4 +73,17 @@ dist
|
|||||||
# Debug files
|
# Debug files
|
||||||
*.debug
|
*.debug
|
||||||
init-debug.log
|
init-debug.log
|
||||||
dev-debug.log
|
dev-debug.log
|
||||||
|
|
||||||
|
# NPMRC
|
||||||
|
.npmrc
|
||||||
|
|
||||||
|
# Added by Task Master AI
|
||||||
|
# Editor directories and files
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
|
|||||||
34
.taskmaster/config.json
Normal file
34
.taskmaster/config.json
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"models": {
|
||||||
|
"main": {
|
||||||
|
"provider": "vertex",
|
||||||
|
"modelId": "gemini-1.5-pro-002",
|
||||||
|
"maxTokens": 50000,
|
||||||
|
"temperature": 0.2
|
||||||
|
},
|
||||||
|
"research": {
|
||||||
|
"provider": "perplexity",
|
||||||
|
"modelId": "sonar",
|
||||||
|
"maxTokens": 8700,
|
||||||
|
"temperature": 0.1
|
||||||
|
},
|
||||||
|
"fallback": {
|
||||||
|
"provider": "anthropic",
|
||||||
|
"modelId": "claude-3-7-sonnet-20250219",
|
||||||
|
"maxTokens": 128000,
|
||||||
|
"temperature": 0.2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"global": {
|
||||||
|
"logLevel": "info",
|
||||||
|
"debug": false,
|
||||||
|
"defaultSubtasks": 5,
|
||||||
|
"defaultPriority": "medium",
|
||||||
|
"projectName": "Taskmaster",
|
||||||
|
"ollamaBaseURL": "http://localhost:11434/api",
|
||||||
|
"bedrockBaseURL": "https://bedrock.us-east-1.amazonaws.com",
|
||||||
|
"userId": "1234567890",
|
||||||
|
"azureBaseURL": "https://your-endpoint.azure.com/",
|
||||||
|
"defaultTag": "master"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,16 +21,18 @@ In an AI-driven development process—particularly with tools like [Cursor](http
|
|||||||
The script can be configured through environment variables in a `.env` file at the root of the project:
|
The script can be configured through environment variables in a `.env` file at the root of the project:
|
||||||
|
|
||||||
### Required Configuration
|
### Required Configuration
|
||||||
|
|
||||||
- `ANTHROPIC_API_KEY`: Your Anthropic API key for Claude
|
- `ANTHROPIC_API_KEY`: Your Anthropic API key for Claude
|
||||||
|
|
||||||
### Optional Configuration
|
### Optional Configuration
|
||||||
|
|
||||||
- `MODEL`: Specify which Claude model to use (default: "claude-3-7-sonnet-20250219")
|
- `MODEL`: Specify which Claude model to use (default: "claude-3-7-sonnet-20250219")
|
||||||
- `MAX_TOKENS`: Maximum tokens for model responses (default: 4000)
|
- `MAX_TOKENS`: Maximum tokens for model responses (default: 4000)
|
||||||
- `TEMPERATURE`: Temperature for model responses (default: 0.7)
|
- `TEMPERATURE`: Temperature for model responses (default: 0.7)
|
||||||
- `PERPLEXITY_API_KEY`: Your Perplexity API key for research-backed subtask generation
|
- `PERPLEXITY_API_KEY`: Your Perplexity API key for research-backed subtask generation
|
||||||
- `PERPLEXITY_MODEL`: Specify which Perplexity model to use (default: "sonar-medium-online")
|
- `PERPLEXITY_MODEL`: Specify which Perplexity model to use (default: "sonar-medium-online")
|
||||||
- `DEBUG`: Enable debug logging (default: false)
|
- `DEBUG`: Enable debug logging (default: false)
|
||||||
- `LOG_LEVEL`: Log level - debug, info, warn, error (default: info)
|
- `TASKMASTER_LOG_LEVEL`: Log level - debug, info, warn, error (default: info)
|
||||||
- `DEFAULT_SUBTASKS`: Default number of subtasks when expanding (default: 3)
|
- `DEFAULT_SUBTASKS`: Default number of subtasks when expanding (default: 3)
|
||||||
- `DEFAULT_PRIORITY`: Default priority for generated tasks (default: medium)
|
- `DEFAULT_PRIORITY`: Default priority for generated tasks (default: medium)
|
||||||
- `PROJECT_NAME`: Override default project name in tasks.json
|
- `PROJECT_NAME`: Override default project name in tasks.json
|
||||||
@@ -38,13 +40,14 @@ The script can be configured through environment variables in a `.env` file at t
|
|||||||
|
|
||||||
## How It Works
|
## How It Works
|
||||||
|
|
||||||
1. **`tasks.json`**:
|
1. **`tasks.json`**:
|
||||||
- A JSON file at the project root containing an array of tasks (each with `id`, `title`, `description`, `status`, etc.).
|
|
||||||
- The `meta` field can store additional info like the project's name, version, or reference to the PRD.
|
- A JSON file at the project root containing an array of tasks (each with `id`, `title`, `description`, `status`, etc.).
|
||||||
|
- The `meta` field can store additional info like the project's name, version, or reference to the PRD.
|
||||||
- Tasks can have `subtasks` for more detailed implementation steps.
|
- Tasks can have `subtasks` for more detailed implementation steps.
|
||||||
- Dependencies are displayed with status indicators (✅ for completed, ⏱️ for pending) to easily track progress.
|
- Dependencies are displayed with status indicators (✅ for completed, ⏱️ for pending) to easily track progress.
|
||||||
|
|
||||||
2. **Script Commands**
|
2. **Script Commands**
|
||||||
You can run the script via:
|
You can run the script via:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -102,6 +105,7 @@ node scripts/dev.js update --file=custom-tasks.json --from=5 --prompt="Change da
|
|||||||
```
|
```
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
- The `--prompt` parameter is required and should explain the changes or new context
|
- The `--prompt` parameter is required and should explain the changes or new context
|
||||||
- Only tasks that aren't marked as 'done' will be updated
|
- Only tasks that aren't marked as 'done' will be updated
|
||||||
- Tasks with ID >= the specified --from value will be updated
|
- Tasks with ID >= the specified --from value will be updated
|
||||||
@@ -120,6 +124,7 @@ node scripts/dev.js update-task --id=4 --prompt="Use JWT for authentication" --r
|
|||||||
```
|
```
|
||||||
|
|
||||||
This command:
|
This command:
|
||||||
|
|
||||||
- Updates only the specified task rather than a range of tasks
|
- Updates only the specified task rather than a range of tasks
|
||||||
- Provides detailed validation with helpful error messages
|
- Provides detailed validation with helpful error messages
|
||||||
- Checks for required API keys when using research mode
|
- Checks for required API keys when using research mode
|
||||||
@@ -146,6 +151,7 @@ node scripts/dev.js set-status --id=1,2,3 --status=done
|
|||||||
```
|
```
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
- When marking a parent task as "done", all of its subtasks will automatically be marked as "done" as well
|
- When marking a parent task as "done", all of its subtasks will automatically be marked as "done" as well
|
||||||
- Common status values are 'done', 'pending', and 'deferred', but any string is accepted
|
- Common status values are 'done', 'pending', and 'deferred', but any string is accepted
|
||||||
- You can specify multiple task IDs by separating them with commas
|
- You can specify multiple task IDs by separating them with commas
|
||||||
@@ -195,6 +201,7 @@ node scripts/dev.js clear-subtasks --all
|
|||||||
```
|
```
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
- After clearing subtasks, task files are automatically regenerated
|
- After clearing subtasks, task files are automatically regenerated
|
||||||
- This is useful when you want to regenerate subtasks with a different approach
|
- This is useful when you want to regenerate subtasks with a different approach
|
||||||
- Can be combined with the `expand` command to immediately generate new subtasks
|
- Can be combined with the `expand` command to immediately generate new subtasks
|
||||||
@@ -210,6 +217,7 @@ The script integrates with two AI services:
|
|||||||
The Perplexity integration uses the OpenAI client to connect to Perplexity's API, which provides enhanced research capabilities for generating more informed subtasks. If the Perplexity API is unavailable or encounters an error, the script will automatically fall back to using Anthropic's Claude.
|
The Perplexity integration uses the OpenAI client to connect to Perplexity's API, which provides enhanced research capabilities for generating more informed subtasks. If the Perplexity API is unavailable or encounters an error, the script will automatically fall back to using Anthropic's Claude.
|
||||||
|
|
||||||
To use the Perplexity integration:
|
To use the Perplexity integration:
|
||||||
|
|
||||||
1. Obtain a Perplexity API key
|
1. Obtain a Perplexity API key
|
||||||
2. Add `PERPLEXITY_API_KEY` to your `.env` file
|
2. Add `PERPLEXITY_API_KEY` to your `.env` file
|
||||||
3. Optionally specify `PERPLEXITY_MODEL` in your `.env` file (default: "sonar-medium-online")
|
3. Optionally specify `PERPLEXITY_MODEL` in your `.env` file (default: "sonar-medium-online")
|
||||||
@@ -217,7 +225,8 @@ To use the Perplexity integration:
|
|||||||
|
|
||||||
## Logging
|
## Logging
|
||||||
|
|
||||||
The script supports different logging levels controlled by the `LOG_LEVEL` environment variable:
|
The script supports different logging levels controlled by the `TASKMASTER_LOG_LEVEL` environment variable:
|
||||||
|
|
||||||
- `debug`: Detailed information, typically useful for troubleshooting
|
- `debug`: Detailed information, typically useful for troubleshooting
|
||||||
- `info`: Confirmation that things are working as expected (default)
|
- `info`: Confirmation that things are working as expected (default)
|
||||||
- `warn`: Warning messages that don't prevent execution
|
- `warn`: Warning messages that don't prevent execution
|
||||||
@@ -240,17 +249,20 @@ node scripts/dev.js remove-dependency --id=<id> --depends-on=<id>
|
|||||||
These commands:
|
These commands:
|
||||||
|
|
||||||
1. **Allow precise dependency management**:
|
1. **Allow precise dependency management**:
|
||||||
|
|
||||||
- Add dependencies between tasks with automatic validation
|
- Add dependencies between tasks with automatic validation
|
||||||
- Remove dependencies when they're no longer needed
|
- Remove dependencies when they're no longer needed
|
||||||
- Update task files automatically after changes
|
- Update task files automatically after changes
|
||||||
|
|
||||||
2. **Include validation checks**:
|
2. **Include validation checks**:
|
||||||
|
|
||||||
- Prevent circular dependencies (a task depending on itself)
|
- Prevent circular dependencies (a task depending on itself)
|
||||||
- Prevent duplicate dependencies
|
- Prevent duplicate dependencies
|
||||||
- Verify that both tasks exist before adding/removing dependencies
|
- Verify that both tasks exist before adding/removing dependencies
|
||||||
- Check if dependencies exist before attempting to remove them
|
- Check if dependencies exist before attempting to remove them
|
||||||
|
|
||||||
3. **Provide clear feedback**:
|
3. **Provide clear feedback**:
|
||||||
|
|
||||||
- Success messages confirm when dependencies are added/removed
|
- Success messages confirm when dependencies are added/removed
|
||||||
- Error messages explain why operations failed (if applicable)
|
- Error messages explain why operations failed (if applicable)
|
||||||
|
|
||||||
@@ -275,6 +287,7 @@ node scripts/dev.js validate-dependencies --file=custom-tasks.json
|
|||||||
```
|
```
|
||||||
|
|
||||||
This command:
|
This command:
|
||||||
|
|
||||||
- Scans all tasks and subtasks for non-existent dependencies
|
- Scans all tasks and subtasks for non-existent dependencies
|
||||||
- Identifies potential self-dependencies (tasks referencing themselves)
|
- Identifies potential self-dependencies (tasks referencing themselves)
|
||||||
- Reports all found issues without modifying files
|
- Reports all found issues without modifying files
|
||||||
@@ -296,6 +309,7 @@ node scripts/dev.js fix-dependencies --file=custom-tasks.json
|
|||||||
```
|
```
|
||||||
|
|
||||||
This command:
|
This command:
|
||||||
|
|
||||||
1. **Validates all dependencies** across tasks and subtasks
|
1. **Validates all dependencies** across tasks and subtasks
|
||||||
2. **Automatically removes**:
|
2. **Automatically removes**:
|
||||||
- References to non-existent tasks and subtasks
|
- References to non-existent tasks and subtasks
|
||||||
@@ -333,6 +347,7 @@ node scripts/dev.js analyze-complexity --research
|
|||||||
```
|
```
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
- The command uses Claude to analyze each task's complexity (or Perplexity with --research flag)
|
- The command uses Claude to analyze each task's complexity (or Perplexity with --research flag)
|
||||||
- Tasks are scored on a scale of 1-10
|
- Tasks are scored on a scale of 1-10
|
||||||
- Each task receives a recommended number of subtasks based on DEFAULT_SUBTASKS configuration
|
- Each task receives a recommended number of subtasks based on DEFAULT_SUBTASKS configuration
|
||||||
@@ -357,33 +372,35 @@ node scripts/dev.js expand --id=8 --num=5 --prompt="Custom prompt"
|
|||||||
```
|
```
|
||||||
|
|
||||||
When a complexity report exists:
|
When a complexity report exists:
|
||||||
|
|
||||||
- The `expand` command will use the recommended subtask count from the report (unless overridden)
|
- The `expand` command will use the recommended subtask count from the report (unless overridden)
|
||||||
- It will use the tailored expansion prompt from the report (unless a custom prompt is provided)
|
- It will use the tailored expansion prompt from the report (unless a custom prompt is provided)
|
||||||
- When using `--all`, tasks are sorted by complexity score (highest first)
|
- When using `--all`, tasks are sorted by complexity score (highest first)
|
||||||
- The `--research` flag is preserved from the complexity analysis to expansion
|
- The `--research` flag is preserved from the complexity analysis to expansion
|
||||||
|
|
||||||
The output report structure is:
|
The output report structure is:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"meta": {
|
"meta": {
|
||||||
"generatedAt": "2023-06-15T12:34:56.789Z",
|
"generatedAt": "2023-06-15T12:34:56.789Z",
|
||||||
"tasksAnalyzed": 20,
|
"tasksAnalyzed": 20,
|
||||||
"thresholdScore": 5,
|
"thresholdScore": 5,
|
||||||
"projectName": "Your Project Name",
|
"projectName": "Your Project Name",
|
||||||
"usedResearch": true
|
"usedResearch": true
|
||||||
},
|
},
|
||||||
"complexityAnalysis": [
|
"complexityAnalysis": [
|
||||||
{
|
{
|
||||||
"taskId": 8,
|
"taskId": 8,
|
||||||
"taskTitle": "Develop Implementation Drift Handling",
|
"taskTitle": "Develop Implementation Drift Handling",
|
||||||
"complexityScore": 9.5,
|
"complexityScore": 9.5,
|
||||||
"recommendedSubtasks": 6,
|
"recommendedSubtasks": 6,
|
||||||
"expansionPrompt": "Create subtasks that handle detecting...",
|
"expansionPrompt": "Create subtasks that handle detecting...",
|
||||||
"reasoning": "This task requires sophisticated logic...",
|
"reasoning": "This task requires sophisticated logic...",
|
||||||
"expansionCommand": "node scripts/dev.js expand --id=8 --num=6 --prompt=\"Create subtasks...\" --research"
|
"expansionCommand": "node scripts/dev.js expand --id=8 --num=6 --prompt=\"Create subtasks...\" --research"
|
||||||
},
|
}
|
||||||
// More tasks sorted by complexity score (highest first)
|
// More tasks sorted by complexity score (highest first)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -457,16 +474,19 @@ This command is particularly useful when you need to examine a specific task in
|
|||||||
The script now includes improved error handling throughout all commands:
|
The script now includes improved error handling throughout all commands:
|
||||||
|
|
||||||
1. **Detailed Validation**:
|
1. **Detailed Validation**:
|
||||||
|
|
||||||
- Required parameters (like task IDs and prompts) are validated early
|
- Required parameters (like task IDs and prompts) are validated early
|
||||||
- File existence is checked with customized errors for common scenarios
|
- File existence is checked with customized errors for common scenarios
|
||||||
- Parameter type conversion is handled with clear error messages
|
- Parameter type conversion is handled with clear error messages
|
||||||
|
|
||||||
2. **Contextual Error Messages**:
|
2. **Contextual Error Messages**:
|
||||||
|
|
||||||
- Task not found errors include suggestions to run the list command
|
- Task not found errors include suggestions to run the list command
|
||||||
- API key errors include reminders to check environment variables
|
- API key errors include reminders to check environment variables
|
||||||
- Invalid ID format errors show the expected format
|
- Invalid ID format errors show the expected format
|
||||||
|
|
||||||
3. **Command-Specific Help Displays**:
|
3. **Command-Specific Help Displays**:
|
||||||
|
|
||||||
- When validation fails, detailed help for the specific command is shown
|
- When validation fails, detailed help for the specific command is shown
|
||||||
- Help displays include usage examples and parameter descriptions
|
- Help displays include usage examples and parameter descriptions
|
||||||
- Formatted in clear, color-coded boxes with examples
|
- Formatted in clear, color-coded boxes with examples
|
||||||
@@ -481,11 +501,13 @@ The script now includes improved error handling throughout all commands:
|
|||||||
The script now automatically checks for updates without slowing down execution:
|
The script now automatically checks for updates without slowing down execution:
|
||||||
|
|
||||||
1. **Background Version Checking**:
|
1. **Background Version Checking**:
|
||||||
|
|
||||||
- Non-blocking version checks run in the background while commands execute
|
- Non-blocking version checks run in the background while commands execute
|
||||||
- Actual command execution isn't delayed by version checking
|
- Actual command execution isn't delayed by version checking
|
||||||
- Update notifications appear after command completion
|
- Update notifications appear after command completion
|
||||||
|
|
||||||
2. **Update Notifications**:
|
2. **Update Notifications**:
|
||||||
|
|
||||||
- When a newer version is available, a notification is displayed
|
- When a newer version is available, a notification is displayed
|
||||||
- Notifications include current version, latest version, and update command
|
- Notifications include current version, latest version, and update command
|
||||||
- Formatted in an attention-grabbing box with clear instructions
|
- Formatted in an attention-grabbing box with clear instructions
|
||||||
@@ -516,6 +538,7 @@ node scripts/dev.js add-subtask --parent=5 --title="Login API route" --skip-gene
|
|||||||
```
|
```
|
||||||
|
|
||||||
Key features:
|
Key features:
|
||||||
|
|
||||||
- Create new subtasks with detailed properties or convert existing tasks
|
- Create new subtasks with detailed properties or convert existing tasks
|
||||||
- Define dependencies between subtasks
|
- Define dependencies between subtasks
|
||||||
- Set custom status for new subtasks
|
- Set custom status for new subtasks
|
||||||
@@ -538,7 +561,8 @@ node scripts/dev.js remove-subtask --id=5.2 --skip-generate
|
|||||||
```
|
```
|
||||||
|
|
||||||
Key features:
|
Key features:
|
||||||
|
|
||||||
- Remove subtasks individually or in batches
|
- Remove subtasks individually or in batches
|
||||||
- Optionally convert subtasks to standalone tasks
|
- Optionally convert subtasks to standalone tasks
|
||||||
- Control whether task files are regenerated
|
- Control whether task files are regenerated
|
||||||
- Provides detailed success messages and next steps
|
- Provides detailed success messages and next steps
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user