|
1 | | -# TaskTracker Cursor Integration |
2 | | -# This file enhances TaskTracker functionality within Cursor IDE |
3 | | - |
4 | | -# Get current tasktracker tasks |
5 | | -task.get_tasks = tasktracker list --minimal |
6 | | - |
7 | | -# Get task details |
8 | | -task.view_task = tasktracker view $1 |
9 | | - |
10 | | -# Add quick task |
11 | | -task.add_quick = tasktracker quick "$1" "${2:-feature}" |
12 | | - |
13 | | -# Change task status |
14 | | -task.status_todo = tasktracker update $1 status todo |
15 | | -task.status_in_progress = tasktracker update $1 status in-progress |
16 | | -task.status_review = tasktracker update $1 status review |
17 | | -task.status_done = tasktracker update $1 status done |
18 | | - |
19 | | -# Add comment to task |
20 | | -task.comment = tasktracker update $1 comment "$2" |
21 | | - |
22 | | -# Add current file to task |
23 | | -task.add_file = tasktracker update $1 addfile "${cursor.file}" |
24 | | - |
25 | | -# Track file changes and link to tasks |
26 | | -task.track_changes = tasktracker changes |
27 | | - |
28 | | -# Show statistics |
29 | | -task.stats = tasktracker snapshot |
30 | | - |
31 | | -# Generate task context for AI assistant |
32 | | -task.context = tasktracker ai-context $1 |
33 | | - |
34 | | -# Show burndown chart |
35 | | -task.burndown = ./lib/burndown-chart.js --format=ascii |
36 | | - |
37 | | -# Run batch commands to save premium tool calls |
38 | | -task.batch = ./bin/tasktracker-batch $1 |
39 | | - |
40 | | -# Show dependencies |
41 | | -task.deps = tasktracker list --json | jq '[.tasks[] | select(.dependencies != null or .blockedBy != null)]' |
42 | | - |
43 | | -# Create a PR description from task |
44 | | -task.pr_desc = | |
45 | | - function generatePrDescription() { |
46 | | - const taskId = process.argv[2]; |
47 | | - if (!taskId) { |
48 | | - console.log("Usage: task.pr_desc <task_id>"); |
49 | | - return; |
| 1 | +{ |
| 2 | + "commands": [ |
| 3 | + {"name": "task.list", "command": "tt list", "description": "List all tasks"}, |
| 4 | + {"name": "task.list_todo", "command": "tt list todo", "description": "List only TO-DO tasks"}, |
| 5 | + {"name": "task.list_in_progress", "command": "tt list in-progress", "description": "List tasks in progress"}, |
| 6 | + {"name": "task.view", "command": "tt view %s", "description": "View details of a specific task by ID"}, |
| 7 | + {"name": "task.add", "command": "tt add", "description": "Add a new task interactively"}, |
| 8 | + {"name": "task.quick", "command": "tt quick \"%s\" %s", "description": "Quickly add a task with title and category"}, |
| 9 | + {"name": "task.update_status", "command": "tt update %s status %s", "description": "Update task status (task_id, new_status)"}, |
| 10 | + {"name": "task.add_file", "command": "tt update %s add-file %s", "description": "Link a file to a task (task_id, file_path)"}, |
| 11 | + {"name": "task.comment", "command": "tt update %s comment \"%s\"", "description": "Add a comment to a task (task_id, comment)"}, |
| 12 | + {"name": "task.changes", "command": "tt changes", "description": "Show recent file changes"}, |
| 13 | + {"name": "task.ai_context", "command": "tt ai-context", "description": "Generate AI-friendly context from tasks"}, |
| 14 | + {"name": "task.stats", "command": "tt stats", "description": "Show task statistics"} |
| 15 | + ], |
| 16 | + "rules": [ |
| 17 | + { |
| 18 | + "description": "Create task related to file you're editing", |
| 19 | + "match": { |
| 20 | + "trigger": "create task", |
| 21 | + "patterns": [ |
| 22 | + "create task", |
| 23 | + "add task", |
| 24 | + "new task" |
| 25 | + ] |
| 26 | + }, |
| 27 | + "actions": [ |
| 28 | + { |
| 29 | + "type": "suggest_command", |
| 30 | + "command": "task.quick", |
| 31 | + "args": [ |
| 32 | + "$ASK:Task title?", |
| 33 | + "$ASK:Category? (feature|bugfix|refactor|docs|chore)" |
| 34 | + ] |
| 35 | + } |
| 36 | + ] |
| 37 | + }, |
| 38 | + { |
| 39 | + "description": "Link current file to task", |
| 40 | + "match": { |
| 41 | + "trigger": "link task", |
| 42 | + "patterns": [ |
| 43 | + "link (to|with) task", |
| 44 | + "associate (with|to) task", |
| 45 | + "connect to task" |
| 46 | + ] |
| 47 | + }, |
| 48 | + "actions": [ |
| 49 | + { |
| 50 | + "type": "suggest_command", |
| 51 | + "command": "task.add_file", |
| 52 | + "args": [ |
| 53 | + "$ASK:Task ID?", |
| 54 | + "$CURSOR_FILE" |
| 55 | + ] |
| 56 | + } |
| 57 | + ] |
| 58 | + }, |
| 59 | + { |
| 60 | + "description": "View task details", |
| 61 | + "match": { |
| 62 | + "trigger": "view task", |
| 63 | + "patterns": [ |
| 64 | + "show task", |
| 65 | + "view task", |
| 66 | + "task details" |
| 67 | + ] |
| 68 | + }, |
| 69 | + "actions": [ |
| 70 | + { |
| 71 | + "type": "suggest_command", |
| 72 | + "command": "task.view", |
| 73 | + "args": [ |
| 74 | + "$ASK:Task ID?" |
| 75 | + ] |
| 76 | + } |
| 77 | + ] |
50 | 78 | } |
51 | | - |
52 | | - const { execSync } = require('child_process'); |
53 | | - const result = execSync(`tasktracker view ${taskId} --json`).toString(); |
54 | | - const task = JSON.parse(result); |
55 | | - |
56 | | - let description = `## Task #${task.id}: ${task.title}\n\n`; |
57 | | - |
58 | | - if (task.description) { |
59 | | - description += `${task.description}\n\n`; |
60 | | - } |
61 | | - |
62 | | - description += `**Category:** ${task.category}\n`; |
63 | | - |
64 | | - if (task.priority) { |
65 | | - description += `**Priority:** ${task.priority}\n`; |
66 | | - } |
67 | | - |
68 | | - if (task.relatedFiles && task.relatedFiles.length > 0) { |
69 | | - description += `\n### Files Changed\n`; |
70 | | - task.relatedFiles.forEach(file => { |
71 | | - description += `- \`${file}\`\n`; |
72 | | - }); |
73 | | - } |
74 | | - |
75 | | - if (task.checklists && task.checklists.length > 0) { |
76 | | - description += `\n### Checklist\n`; |
77 | | - |
78 | | - task.checklists.forEach(checklist => { |
79 | | - description += `\n#### ${checklist.title}\n`; |
80 | | - |
81 | | - checklist.items.forEach(item => { |
82 | | - const checkbox = item.completed ? 'x' : ' '; |
83 | | - description += `- [${checkbox}] ${item.text}\n`; |
84 | | - }); |
85 | | - }); |
86 | | - } |
87 | | - |
88 | | - description += `\nResolves #${task.id}`; |
89 | | - |
90 | | - console.log(description); |
91 | | - } |
92 | | - |
93 | | - generatePrDescription(); |
94 | | - |
95 | | -# When creating a cursor task with TaskTracker, this adds a helpful comment template |
96 | | -create_task.template = """ |
97 | | -/** |
98 | | - * Task #${task.id}: ${task.title} |
99 | | - * Status: ${task.status} |
100 | | - * Category: ${task.category} |
101 | | - * |
102 | | - * Description: |
103 | | - * ${task.description} |
104 | | - * |
105 | | - * Related Files: |
106 | | - * ${task.relatedFiles?.join('\n * ')} |
107 | | - * |
108 | | - * Dependencies: |
109 | | - * ${task.dependencies?.map(id => `#${id}`).join(', ')} |
110 | | - */ |
111 | | -""" |
112 | | - |
113 | | -# Generate documentation comment |
114 | | -task.doc_comment = """ |
115 | | -/** |
116 | | - * ${1:Function description} |
117 | | - * |
118 | | - * Related to Task #${2:taskId}: ${3:taskTitle} |
119 | | - * |
120 | | - * @param {${4:Type}} ${5:paramName} - ${6:Description} |
121 | | - * @returns {${7:Type}} ${8:Description} |
122 | | - */ |
123 | | -""" |
124 | | - |
125 | | -# Custom key bindings for TaskTracker |
126 | | -key.ctrl+alt+t = task.get_tasks |
127 | | -key.ctrl+alt+n = task.add_quick "New task from Cursor" feature |
128 | | -key.ctrl+alt+c = task.track_changes |
129 | | -key.ctrl+alt+v = task.view_task ${cursor.selected} |
130 | | -key.ctrl+alt+d = task.status_done ${cursor.selected} |
131 | | -key.ctrl+shift+b = task.burndown --format=ascii |
132 | | - |
133 | | -# Add cursor status bar integration |
134 | | -statusbar.left = "TaskTracker: ${task.current_task || 'No task'}" |
135 | | -statusbar.right = "Priority: ${task.current_priority || 'None'}" |
| 79 | + ] |
| 80 | +} |
0 commit comments