@standardbeagle/dart-query 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +427 -0
- package/TOOLS.md +2148 -0
- package/dist/api/dartClient.d.ts +123 -0
- package/dist/api/dartClient.d.ts.map +1 -0
- package/dist/api/dartClient.js +436 -0
- package/dist/api/dartClient.js.map +1 -0
- package/dist/batch/batchOperations.d.ts +14 -0
- package/dist/batch/batchOperations.d.ts.map +1 -0
- package/dist/batch/batchOperations.js +65 -0
- package/dist/batch/batchOperations.js.map +1 -0
- package/dist/cache/configCache.d.ts +20 -0
- package/dist/cache/configCache.d.ts.map +1 -0
- package/dist/cache/configCache.js +59 -0
- package/dist/cache/configCache.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1120 -0
- package/dist/index.js.map +1 -0
- package/dist/parsers/csv.d.ts +44 -0
- package/dist/parsers/csv.d.ts.map +1 -0
- package/dist/parsers/csv.js +574 -0
- package/dist/parsers/csv.js.map +1 -0
- package/dist/parsers/dartql.d.ts +104 -0
- package/dist/parsers/dartql.d.ts.map +1 -0
- package/dist/parsers/dartql.js +889 -0
- package/dist/parsers/dartql.js.map +1 -0
- package/dist/tools/add_task_comment.d.ts +3 -0
- package/dist/tools/add_task_comment.d.ts.map +1 -0
- package/dist/tools/add_task_comment.js +43 -0
- package/dist/tools/add_task_comment.js.map +1 -0
- package/dist/tools/add_time_tracking.d.ts +3 -0
- package/dist/tools/add_time_tracking.d.ts.map +1 -0
- package/dist/tools/add_time_tracking.js +52 -0
- package/dist/tools/add_time_tracking.js.map +1 -0
- package/dist/tools/attach_url.d.ts +3 -0
- package/dist/tools/attach_url.d.ts.map +1 -0
- package/dist/tools/attach_url.js +38 -0
- package/dist/tools/attach_url.js.map +1 -0
- package/dist/tools/batch_delete_tasks.d.ts +3 -0
- package/dist/tools/batch_delete_tasks.d.ts.map +1 -0
- package/dist/tools/batch_delete_tasks.js +125 -0
- package/dist/tools/batch_delete_tasks.js.map +1 -0
- package/dist/tools/batch_update_tasks.d.ts +3 -0
- package/dist/tools/batch_update_tasks.d.ts.map +1 -0
- package/dist/tools/batch_update_tasks.js +327 -0
- package/dist/tools/batch_update_tasks.js.map +1 -0
- package/dist/tools/create_doc.d.ts +3 -0
- package/dist/tools/create_doc.d.ts.map +1 -0
- package/dist/tools/create_doc.js +65 -0
- package/dist/tools/create_doc.js.map +1 -0
- package/dist/tools/create_task.d.ts +3 -0
- package/dist/tools/create_task.d.ts.map +1 -0
- package/dist/tools/create_task.js +143 -0
- package/dist/tools/create_task.js.map +1 -0
- package/dist/tools/delete_doc.d.ts +3 -0
- package/dist/tools/delete_doc.d.ts.map +1 -0
- package/dist/tools/delete_doc.js +35 -0
- package/dist/tools/delete_doc.js.map +1 -0
- package/dist/tools/delete_task.d.ts +3 -0
- package/dist/tools/delete_task.d.ts.map +1 -0
- package/dist/tools/delete_task.js +35 -0
- package/dist/tools/delete_task.js.map +1 -0
- package/dist/tools/get_batch_status.d.ts +3 -0
- package/dist/tools/get_batch_status.d.ts.map +1 -0
- package/dist/tools/get_batch_status.js +24 -0
- package/dist/tools/get_batch_status.js.map +1 -0
- package/dist/tools/get_config.d.ts +3 -0
- package/dist/tools/get_config.d.ts.map +1 -0
- package/dist/tools/get_config.js +74 -0
- package/dist/tools/get_config.js.map +1 -0
- package/dist/tools/get_dartboard.d.ts +3 -0
- package/dist/tools/get_dartboard.d.ts.map +1 -0
- package/dist/tools/get_dartboard.js +43 -0
- package/dist/tools/get_dartboard.js.map +1 -0
- package/dist/tools/get_doc.d.ts +3 -0
- package/dist/tools/get_doc.d.ts.map +1 -0
- package/dist/tools/get_doc.js +34 -0
- package/dist/tools/get_doc.js.map +1 -0
- package/dist/tools/get_folder.d.ts +3 -0
- package/dist/tools/get_folder.d.ts.map +1 -0
- package/dist/tools/get_folder.js +45 -0
- package/dist/tools/get_folder.js.map +1 -0
- package/dist/tools/get_task.d.ts +3 -0
- package/dist/tools/get_task.d.ts.map +1 -0
- package/dist/tools/get_task.js +109 -0
- package/dist/tools/get_task.js.map +1 -0
- package/dist/tools/import_tasks_csv.d.ts +3 -0
- package/dist/tools/import_tasks_csv.d.ts.map +1 -0
- package/dist/tools/import_tasks_csv.js +218 -0
- package/dist/tools/import_tasks_csv.js.map +1 -0
- package/dist/tools/info.d.ts +3 -0
- package/dist/tools/info.d.ts.map +1 -0
- package/dist/tools/info.js +474 -0
- package/dist/tools/info.js.map +1 -0
- package/dist/tools/list_comments.d.ts +3 -0
- package/dist/tools/list_comments.d.ts.map +1 -0
- package/dist/tools/list_comments.js +46 -0
- package/dist/tools/list_comments.js.map +1 -0
- package/dist/tools/list_docs.d.ts +3 -0
- package/dist/tools/list_docs.d.ts.map +1 -0
- package/dist/tools/list_docs.js +101 -0
- package/dist/tools/list_docs.js.map +1 -0
- package/dist/tools/list_tasks.d.ts +3 -0
- package/dist/tools/list_tasks.d.ts.map +1 -0
- package/dist/tools/list_tasks.js +325 -0
- package/dist/tools/list_tasks.js.map +1 -0
- package/dist/tools/move_task.d.ts +3 -0
- package/dist/tools/move_task.d.ts.map +1 -0
- package/dist/tools/move_task.js +44 -0
- package/dist/tools/move_task.js.map +1 -0
- package/dist/tools/search_tasks.d.ts +3 -0
- package/dist/tools/search_tasks.d.ts.map +1 -0
- package/dist/tools/search_tasks.js +227 -0
- package/dist/tools/search_tasks.js.map +1 -0
- package/dist/tools/update_doc.d.ts +3 -0
- package/dist/tools/update_doc.d.ts.map +1 -0
- package/dist/tools/update_doc.js +102 -0
- package/dist/tools/update_doc.js.map +1 -0
- package/dist/tools/update_task.d.ts +3 -0
- package/dist/tools/update_task.d.ts.map +1 -0
- package/dist/tools/update_task.js +241 -0
- package/dist/tools/update_task.js.map +1 -0
- package/dist/types/index.d.ts +529 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +65 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
const TOOL_GROUPS = {
|
|
2
|
+
discovery: {
|
|
3
|
+
count: 1,
|
|
4
|
+
purpose: 'Progressive capability discovery',
|
|
5
|
+
tools: [
|
|
6
|
+
{
|
|
7
|
+
name: 'info',
|
|
8
|
+
description: 'Progressive discovery of dart-query capabilities - start here',
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
},
|
|
12
|
+
config: {
|
|
13
|
+
count: 1,
|
|
14
|
+
purpose: 'Workspace configuration',
|
|
15
|
+
tools: [
|
|
16
|
+
{
|
|
17
|
+
name: 'get_config',
|
|
18
|
+
description: 'Get workspace configuration: assignees, dartboards, statuses, tags, priorities, sizes',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
'task-crud': {
|
|
23
|
+
count: 5,
|
|
24
|
+
purpose: 'Single task operations',
|
|
25
|
+
tools: [
|
|
26
|
+
{
|
|
27
|
+
name: 'create_task',
|
|
28
|
+
description: 'Create a new task with title, description, status, priority, size, dates, dartboard, assignees, tags, and relationships (parent, blockers, related)',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'get_task',
|
|
32
|
+
description: 'Retrieve an existing task by its dart_id with full details and relationship information',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'update_task',
|
|
36
|
+
description: "Update an existing task's properties (status, title, description, priority, assignees, relationships, etc.)",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'delete_task',
|
|
40
|
+
description: 'Move a task to trash (recoverable from Dart web UI)',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'add_task_comment',
|
|
44
|
+
description: 'Add a comment to an existing task',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
'task-query': {
|
|
49
|
+
count: 2,
|
|
50
|
+
purpose: 'Search and filter tasks',
|
|
51
|
+
tools: [
|
|
52
|
+
{
|
|
53
|
+
name: 'list_tasks',
|
|
54
|
+
description: 'List tasks with optional filtering by assignee, status, dartboard, priority, due date, relationships, and more',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'search_tasks',
|
|
58
|
+
description: 'Full-text search across task titles and descriptions with relevance ranking',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
'task-batch': {
|
|
63
|
+
count: 3,
|
|
64
|
+
purpose: 'Bulk operations on multiple tasks',
|
|
65
|
+
tools: [
|
|
66
|
+
{
|
|
67
|
+
name: 'batch_update_tasks',
|
|
68
|
+
description: 'Update multiple tasks matching a DartQL selector expression (SQL-like WHERE syntax)',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'batch_delete_tasks',
|
|
72
|
+
description: 'Delete multiple tasks matching a DartQL selector expression (moves to trash, recoverable)',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'get_batch_status',
|
|
76
|
+
description: 'Get status of a long-running batch operation by batch_operation_id',
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
'doc-crud': {
|
|
81
|
+
count: 5,
|
|
82
|
+
purpose: 'Document management',
|
|
83
|
+
tools: [
|
|
84
|
+
{
|
|
85
|
+
name: 'list_docs',
|
|
86
|
+
description: 'List docs with optional filtering by folder, title, text content',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'create_doc',
|
|
90
|
+
description: 'Create a new doc with title, text content (markdown), and folder',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'get_doc',
|
|
94
|
+
description: 'Retrieve an existing doc by its doc_id with full text content',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'update_doc',
|
|
98
|
+
description: "Update an existing doc's title or text content",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'delete_doc',
|
|
102
|
+
description: 'Move a doc to trash (recoverable)',
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
import: {
|
|
107
|
+
count: 1,
|
|
108
|
+
purpose: 'CSV bulk import',
|
|
109
|
+
tools: [
|
|
110
|
+
{
|
|
111
|
+
name: 'import_tasks_csv',
|
|
112
|
+
description: 'Bulk-create tasks from CSV data (inline text or file path) with validation and error recovery',
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
function renderOverview() {
|
|
118
|
+
return `Dart Query MCP - Task Management with Batch Operations
|
|
119
|
+
|
|
120
|
+
Tool Groups
|
|
121
|
+
-----------
|
|
122
|
+
Group | Count | Purpose
|
|
123
|
+
----------- | ----- | -------
|
|
124
|
+
discovery | 1 | Progressive capability discovery
|
|
125
|
+
config | 1 | Workspace configuration
|
|
126
|
+
task-crud | 5 | Single task operations
|
|
127
|
+
task-query | 2 | Search and filter tasks
|
|
128
|
+
task-batch | 3 | Bulk operations on multiple tasks
|
|
129
|
+
doc-crud | 5 | Document management
|
|
130
|
+
import | 1 | CSV bulk import
|
|
131
|
+
|
|
132
|
+
Quick Start: info(level='group', target='task-crud')
|
|
133
|
+
Batch Ops: info(level='group', target='task-batch')
|
|
134
|
+
DartQL Help: info(level='tool', target='batch_update_tasks')
|
|
135
|
+
Relationships: info(level='tool', target='relationships')`;
|
|
136
|
+
}
|
|
137
|
+
function renderGroup(target) {
|
|
138
|
+
const group = TOOL_GROUPS[target];
|
|
139
|
+
if (!group) {
|
|
140
|
+
const validGroups = Object.keys(TOOL_GROUPS).join(', ');
|
|
141
|
+
return `Error: Unknown group "${target}". Valid groups: ${validGroups}`;
|
|
142
|
+
}
|
|
143
|
+
let output = `Tool Group: ${target}\n`;
|
|
144
|
+
output += `Purpose: ${group.purpose}\n`;
|
|
145
|
+
output += `Tools (${group.count}):\n\n`;
|
|
146
|
+
group.tools.forEach((tool) => {
|
|
147
|
+
output += `• ${tool.name}\n ${tool.description}\n\n`;
|
|
148
|
+
});
|
|
149
|
+
output += `\nNext Steps:\n`;
|
|
150
|
+
output += `- info(level='tool', target='${group.tools[0].name}') - Full documentation\n`;
|
|
151
|
+
output += `- info(level='overview') - Return to overview`;
|
|
152
|
+
return output;
|
|
153
|
+
}
|
|
154
|
+
function renderTool(target) {
|
|
155
|
+
const toolDocs = {
|
|
156
|
+
info: `Tool: info
|
|
157
|
+
Description: Progressive discovery of dart-query capabilities - start here
|
|
158
|
+
|
|
159
|
+
Input Schema:
|
|
160
|
+
level?: 'overview' | 'group' | 'tool' (default: 'overview')
|
|
161
|
+
Detail level for information display
|
|
162
|
+
|
|
163
|
+
target?: string
|
|
164
|
+
Group name (when level='group') or tool name (when level='tool')
|
|
165
|
+
|
|
166
|
+
Output Schema:
|
|
167
|
+
level: string (echoed back)
|
|
168
|
+
content: string (formatted documentation)
|
|
169
|
+
next_steps: string[] (suggested follow-up queries)
|
|
170
|
+
|
|
171
|
+
Examples:
|
|
172
|
+
info()
|
|
173
|
+
→ Shows overview table of all tool groups
|
|
174
|
+
|
|
175
|
+
info(level='group', target='task-batch')
|
|
176
|
+
→ Shows batch operation tools
|
|
177
|
+
|
|
178
|
+
info(level='tool', target='batch_update_tasks')
|
|
179
|
+
→ Shows full schema and DartQL syntax guide
|
|
180
|
+
|
|
181
|
+
Token Budget: ~150 tokens (overview), ~200 tokens (group), ~500 tokens (tool)
|
|
182
|
+
Performance: Instant (no API calls required)`,
|
|
183
|
+
get_config: `Tool: get_config
|
|
184
|
+
Description: Get workspace configuration: assignees, dartboards, statuses, tags, priorities, sizes
|
|
185
|
+
|
|
186
|
+
Input Schema:
|
|
187
|
+
cache_bust?: boolean (default: false)
|
|
188
|
+
Force refresh cached config (default: 5-minute cache)
|
|
189
|
+
|
|
190
|
+
include?: Array<'assignees' | 'dartboards' | 'statuses' | 'tags' | 'priorities' | 'sizes' | 'folders'>
|
|
191
|
+
Limit response to specific config sections (default: all)
|
|
192
|
+
|
|
193
|
+
Output Schema:
|
|
194
|
+
assignees: Array<{dart_id, name, email, role}>
|
|
195
|
+
dartboards: Array<{dart_id, name, description}>
|
|
196
|
+
statuses: Array<{dart_id, name, color, order}>
|
|
197
|
+
tags: Array<{dart_id, name, color}>
|
|
198
|
+
priorities: Array<{value: 1-5, label}>
|
|
199
|
+
sizes: Array<{value: 1-5, label}>
|
|
200
|
+
folders: Array<{dart_id, name, space_id}>
|
|
201
|
+
cached_at: iso8601 timestamp
|
|
202
|
+
cache_ttl_seconds: integer
|
|
203
|
+
|
|
204
|
+
Use Cases:
|
|
205
|
+
- Get valid dartboard_ids before creating tasks
|
|
206
|
+
- Validate assignee emails before CSV import
|
|
207
|
+
- Resolve status names to dart_ids
|
|
208
|
+
|
|
209
|
+
Examples:
|
|
210
|
+
get_config()
|
|
211
|
+
→ Full workspace configuration (cached for 5 minutes)
|
|
212
|
+
|
|
213
|
+
get_config(include=['dartboards', 'assignees'])
|
|
214
|
+
→ Only dartboards and assignees (token-efficient)
|
|
215
|
+
|
|
216
|
+
get_config(cache_bust=true)
|
|
217
|
+
→ Force refresh cached config
|
|
218
|
+
|
|
219
|
+
Token Budget: ~400 tokens
|
|
220
|
+
Performance: Fast (cached) / Medium (API call)`,
|
|
221
|
+
batch_update_tasks: `Tool: batch_update_tasks
|
|
222
|
+
Description: Update multiple tasks matching a DartQL selector expression (SQL-like WHERE syntax)
|
|
223
|
+
|
|
224
|
+
Input Schema:
|
|
225
|
+
selector: string (required)
|
|
226
|
+
DartQL WHERE clause (e.g., "status = 'Todo' AND priority >= 3")
|
|
227
|
+
|
|
228
|
+
updates: object (required)
|
|
229
|
+
Fields to update on all matching tasks
|
|
230
|
+
Properties: status, priority, size, assignees, tags, due_at, start_at
|
|
231
|
+
|
|
232
|
+
dry_run?: boolean (default: false)
|
|
233
|
+
Preview matching tasks without updating (RECOMMENDED for first run)
|
|
234
|
+
|
|
235
|
+
concurrency?: integer (default: 5)
|
|
236
|
+
Max concurrent API calls (1-20)
|
|
237
|
+
|
|
238
|
+
Output Schema:
|
|
239
|
+
batch_operation_id: string
|
|
240
|
+
selector_matched: integer (total tasks matching selector)
|
|
241
|
+
dry_run: boolean
|
|
242
|
+
preview_tasks?: Array<{dart_id, title, current_values}> (if dry_run=true)
|
|
243
|
+
successful_updates: integer
|
|
244
|
+
failed_updates: integer
|
|
245
|
+
successful_dart_ids: string[]
|
|
246
|
+
failed_items: Array<{dart_id, error, reason}>
|
|
247
|
+
execution_time_ms: integer
|
|
248
|
+
|
|
249
|
+
DartQL Syntax Guide:
|
|
250
|
+
Operators: =, !=, >, >=, <, <=, IN, NOT IN, LIKE, CONTAINS
|
|
251
|
+
Logical: AND, OR, NOT
|
|
252
|
+
Grouping: Use parentheses for precedence
|
|
253
|
+
|
|
254
|
+
Examples:
|
|
255
|
+
"status = 'Todo'"
|
|
256
|
+
"priority >= 3 AND assignee = 'duid_user1'"
|
|
257
|
+
"tags CONTAINS 'urgent' AND due_at < '2026-02-01'"
|
|
258
|
+
"(status = 'Todo' OR status = 'In Progress') AND NOT (priority = 1)"
|
|
259
|
+
|
|
260
|
+
Workflow:
|
|
261
|
+
1. batch_update_tasks(selector="...", updates={...}, dry_run=true)
|
|
262
|
+
→ Preview matching tasks
|
|
263
|
+
|
|
264
|
+
2. Review preview, confirm selector is correct
|
|
265
|
+
|
|
266
|
+
3. batch_update_tasks(selector="...", updates={...}, dry_run=false)
|
|
267
|
+
→ Execute update
|
|
268
|
+
|
|
269
|
+
Token Budget: ~400 tokens
|
|
270
|
+
Performance: Slow (depends on match count)`,
|
|
271
|
+
import_tasks_csv: `Tool: import_tasks_csv
|
|
272
|
+
Description: Bulk-create tasks from CSV data with validation and error recovery
|
|
273
|
+
|
|
274
|
+
Input Schema:
|
|
275
|
+
csv_data?: string
|
|
276
|
+
Inline CSV content (first row must be headers)
|
|
277
|
+
|
|
278
|
+
csv_file_path?: string
|
|
279
|
+
Path to CSV file (alternative to csv_data)
|
|
280
|
+
|
|
281
|
+
dartboard: string (required)
|
|
282
|
+
Default dartboard dart_id (can be overridden per-row via 'dartboard' column)
|
|
283
|
+
|
|
284
|
+
column_mapping?: object
|
|
285
|
+
Custom column name mappings (e.g., {'Task Name': 'title', 'Assigned To': 'assignee'})
|
|
286
|
+
|
|
287
|
+
validate_only?: boolean (default: false)
|
|
288
|
+
Validate and preview without creating tasks (RECOMMENDED for first run)
|
|
289
|
+
|
|
290
|
+
continue_on_error?: boolean (default: true)
|
|
291
|
+
Continue processing if individual rows fail
|
|
292
|
+
|
|
293
|
+
concurrency?: integer (default: 5)
|
|
294
|
+
Max concurrent task creation calls
|
|
295
|
+
|
|
296
|
+
CSV Format Guide:
|
|
297
|
+
Required Columns:
|
|
298
|
+
title - Task title (required)
|
|
299
|
+
|
|
300
|
+
Optional Columns:
|
|
301
|
+
description, status, priority, size, assignee, dartboard, tags, due_date, start_date, parent_task
|
|
302
|
+
|
|
303
|
+
Flexible Column Names (case-insensitive):
|
|
304
|
+
'Title' = 'title' = 'Task Name'
|
|
305
|
+
'Assigned To' = 'assignee' = 'Owner'
|
|
306
|
+
'Tags' = 'labels' (comma-separated)
|
|
307
|
+
|
|
308
|
+
CSV Example:
|
|
309
|
+
title,description,assignee,priority,tags,due_date
|
|
310
|
+
"Fix login bug","Users can't login",engineer@company.com,5,"bug,urgent",2026-02-01
|
|
311
|
+
"Update docs","API documentation",writer@company.com,2,documentation,2026-02-15
|
|
312
|
+
|
|
313
|
+
Workflow:
|
|
314
|
+
1. get_config() → Get dartboard_ids for reference resolution
|
|
315
|
+
|
|
316
|
+
2. import_tasks_csv(csv_file_path='tasks.csv', dartboard='duid_board1', validate_only=true)
|
|
317
|
+
→ Validation errors, preview
|
|
318
|
+
|
|
319
|
+
3. Fix CSV errors if any
|
|
320
|
+
|
|
321
|
+
4. import_tasks_csv(csv_file_path='tasks.csv', dartboard='duid_board1', validate_only=false)
|
|
322
|
+
→ Execute import
|
|
323
|
+
|
|
324
|
+
Token Budget: ~500 tokens
|
|
325
|
+
Performance: Slow (depends on row count)`,
|
|
326
|
+
relationships: `Topic: Task Relationships
|
|
327
|
+
Description: Dart supports six relationship types to model task dependencies and connections
|
|
328
|
+
|
|
329
|
+
Relationship Types:
|
|
330
|
+
parent_task / subtask_ids
|
|
331
|
+
Hierarchical parent-child relationships for breaking work into subtasks.
|
|
332
|
+
A task can have one parent and multiple subtasks.
|
|
333
|
+
|
|
334
|
+
blocker_ids / blocking_ids
|
|
335
|
+
Dependency relationships where one task blocks another.
|
|
336
|
+
blocker_ids: Tasks that must complete before this task can start.
|
|
337
|
+
blocking_ids: Tasks that this task is blocking.
|
|
338
|
+
|
|
339
|
+
duplicate_ids
|
|
340
|
+
Links tasks that represent the same work (usually to consolidate).
|
|
341
|
+
Bidirectional - marking A as duplicate of B links both.
|
|
342
|
+
|
|
343
|
+
related_ids
|
|
344
|
+
General-purpose links between related tasks.
|
|
345
|
+
Use for reference without implying dependency or hierarchy.
|
|
346
|
+
|
|
347
|
+
Creating Tasks with Relationships:
|
|
348
|
+
create_task(
|
|
349
|
+
title="Implement login",
|
|
350
|
+
subtask_ids=["duid_task2", "duid_task3"],
|
|
351
|
+
blocker_ids=["duid_task1"]
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
Updating Relationships:
|
|
355
|
+
update_task(
|
|
356
|
+
dart_id="duid_task1",
|
|
357
|
+
subtask_ids=["duid_new1", "duid_new2"], // Replaces existing
|
|
358
|
+
related_ids=[] // Clears all related tasks
|
|
359
|
+
)
|
|
360
|
+
Note: Relationship updates use full replacement, not append.
|
|
361
|
+
|
|
362
|
+
Querying Relationships:
|
|
363
|
+
get_task(dart_id="duid_task1", expand_relationships=true)
|
|
364
|
+
→ Includes relationship_counts and expanded relationship details
|
|
365
|
+
|
|
366
|
+
list_tasks(has_subtasks=true)
|
|
367
|
+
→ Filter to parent tasks only
|
|
368
|
+
|
|
369
|
+
list_tasks(has_blockers=true)
|
|
370
|
+
→ Find blocked tasks
|
|
371
|
+
|
|
372
|
+
list_tasks(blocked_by="duid_task1")
|
|
373
|
+
→ Find all tasks blocked by a specific task
|
|
374
|
+
|
|
375
|
+
Relationship Filters (list_tasks):
|
|
376
|
+
has_parent: boolean - Tasks with a parent task
|
|
377
|
+
has_subtasks: boolean - Tasks with subtasks
|
|
378
|
+
has_blockers: boolean - Tasks blocked by other tasks
|
|
379
|
+
is_blocking: boolean - Tasks blocking other tasks
|
|
380
|
+
blocked_by: string - Tasks blocked by specific task
|
|
381
|
+
blocking: string - Tasks that block specific task
|
|
382
|
+
|
|
383
|
+
DartQL Relationship Queries:
|
|
384
|
+
"subtask_ids IS NOT NULL" - Parent tasks
|
|
385
|
+
"blocker_ids CONTAINS 'duid_x'" - Tasks blocked by duid_x
|
|
386
|
+
"related_ids IS NULL" - Tasks with no relations
|
|
387
|
+
|
|
388
|
+
CSV Import:
|
|
389
|
+
Relationship columns accept comma-separated dart_ids:
|
|
390
|
+
subtask_ids,blocker_ids
|
|
391
|
+
"duid_a,duid_b","duid_c"
|
|
392
|
+
|
|
393
|
+
Best Practices:
|
|
394
|
+
- Use expand_relationships=true sparingly (adds API calls)
|
|
395
|
+
- Clear relationships with empty array [], not null
|
|
396
|
+
- Validate dart_ids exist before creating relationships
|
|
397
|
+
- Use has_blockers filter to find blocked work
|
|
398
|
+
|
|
399
|
+
Token Budget: ~600 tokens
|
|
400
|
+
Performance: Varies by operation`,
|
|
401
|
+
};
|
|
402
|
+
const doc = toolDocs[target];
|
|
403
|
+
if (!doc) {
|
|
404
|
+
const availableTools = Object.keys(toolDocs).join(', ');
|
|
405
|
+
return `Error: No documentation for tool "${target}".
|
|
406
|
+
|
|
407
|
+
Available tools with full documentation: ${availableTools}
|
|
408
|
+
|
|
409
|
+
For other tools, use: info(level='group', target='...')`;
|
|
410
|
+
}
|
|
411
|
+
return doc + "\n\nNext Steps:\n- info(level='overview') - Return to overview";
|
|
412
|
+
}
|
|
413
|
+
function generateNextSteps(level, target) {
|
|
414
|
+
if (level === 'overview') {
|
|
415
|
+
return [
|
|
416
|
+
"info(level='group', target='task-batch') - Learn batch operations",
|
|
417
|
+
"get_config() - Get workspace configuration before creating tasks",
|
|
418
|
+
"info(level='group', target='task-crud') - Learn single task operations",
|
|
419
|
+
];
|
|
420
|
+
}
|
|
421
|
+
if (level === 'group' && target) {
|
|
422
|
+
const group = TOOL_GROUPS[target];
|
|
423
|
+
if (group && group.tools.length > 0) {
|
|
424
|
+
return [
|
|
425
|
+
`info(level='tool', target='${group.tools[0].name}') - Full documentation for ${group.tools[0].name}`,
|
|
426
|
+
"info(level='overview') - Return to overview",
|
|
427
|
+
];
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
if (level === 'tool') {
|
|
431
|
+
return [
|
|
432
|
+
"info(level='overview') - Return to overview",
|
|
433
|
+
"get_config() - Get workspace configuration",
|
|
434
|
+
];
|
|
435
|
+
}
|
|
436
|
+
return [
|
|
437
|
+
"info() - Show overview",
|
|
438
|
+
];
|
|
439
|
+
}
|
|
440
|
+
export async function handleInfo(input) {
|
|
441
|
+
const safeInput = input || {};
|
|
442
|
+
const level = safeInput.level || 'overview';
|
|
443
|
+
const target = safeInput.target;
|
|
444
|
+
let content;
|
|
445
|
+
switch (level) {
|
|
446
|
+
case 'overview':
|
|
447
|
+
content = renderOverview();
|
|
448
|
+
break;
|
|
449
|
+
case 'group':
|
|
450
|
+
if (!target) {
|
|
451
|
+
content = 'Error: target parameter required when level=group\n\n' + renderOverview();
|
|
452
|
+
}
|
|
453
|
+
else {
|
|
454
|
+
content = renderGroup(target);
|
|
455
|
+
}
|
|
456
|
+
break;
|
|
457
|
+
case 'tool':
|
|
458
|
+
if (!target) {
|
|
459
|
+
content = 'Error: target parameter required when level=tool\n\n' + renderOverview();
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
content = renderTool(target);
|
|
463
|
+
}
|
|
464
|
+
break;
|
|
465
|
+
default:
|
|
466
|
+
content = `Error: Invalid level "${level}". Valid levels: overview, group, tool\n\n` + renderOverview();
|
|
467
|
+
}
|
|
468
|
+
return {
|
|
469
|
+
level,
|
|
470
|
+
content,
|
|
471
|
+
next_steps: generateNextSteps(level, target),
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
//# sourceMappingURL=info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.js","sourceRoot":"","sources":["../../src/tools/info.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,GAAG;IAClB,SAAS,EAAE;QACT,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,kCAAkC;QAC3C,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,+DAA+D;aAC7E;SACF;KACF;IACD,MAAM,EAAE;QACN,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,yBAAyB;QAClC,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,YAAY;gBAClB,WAAW,EAAE,uFAAuF;aACrG;SACF;KACF;IACD,WAAW,EAAE;QACX,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,wBAAwB;QACjC,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,aAAa;gBACnB,WAAW,EAAE,qJAAqJ;aACnK;YACD;gBACE,IAAI,EAAE,UAAU;gBAChB,WAAW,EAAE,yFAAyF;aACvG;YACD;gBACE,IAAI,EAAE,aAAa;gBACnB,WAAW,EAAE,6GAA6G;aAC3H;YACD;gBACE,IAAI,EAAE,aAAa;gBACnB,WAAW,EAAE,qDAAqD;aACnE;YACD;gBACE,IAAI,EAAE,kBAAkB;gBACxB,WAAW,EAAE,mCAAmC;aACjD;SACF;KACF;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,yBAAyB;QAClC,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,YAAY;gBAClB,WAAW,EAAE,gHAAgH;aAC9H;YACD;gBACE,IAAI,EAAE,cAAc;gBACpB,WAAW,EAAE,6EAA6E;aAC3F;SACF;KACF;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,mCAAmC;QAC5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,CAAC;YACD,MAAM;QAER,KAAK,MAAM;YACT,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,GAAG,sDAAsD,GAAG,cAAc,EAAE,CAAC;YACtF,CAAC;iBAAM,CAAC;gBACN,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;YAC/B,CAAC;YACD,MAAM;QAER;YACE,OAAO,GAAG,yBAAyB,KAAK,4CAA4C,GAAG,cAAc,EAAE,CAAC;IAC5G,CAAC;IAED,OAAO;QACL,KAAK;QACL,OAAO;QACP,UAAU,EAAE,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC;KAC7C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list_comments.d.ts","sourceRoot":"","sources":["../../src/tools/list_comments.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAInB,MAAM,mBAAmB,CAAC;AAQ3B,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA0D9F"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { DartClient } from '../api/dartClient.js';
|
|
2
|
+
import { DartAPIError, ValidationError, } from '../types/index.js';
|
|
3
|
+
export async function handleListComments(input) {
|
|
4
|
+
const DART_TOKEN = process.env.DART_TOKEN;
|
|
5
|
+
if (!DART_TOKEN) {
|
|
6
|
+
throw new DartAPIError('DART_TOKEN environment variable is required. Get your token from: https://app.dartai.com/?settings=account', 401);
|
|
7
|
+
}
|
|
8
|
+
if (!input || typeof input !== 'object') {
|
|
9
|
+
throw new ValidationError('Input must be an object', 'input');
|
|
10
|
+
}
|
|
11
|
+
if (!input.task_id || typeof input.task_id !== 'string' || input.task_id.trim() === '') {
|
|
12
|
+
throw new ValidationError('task_id is required and must be a non-empty string', 'task_id');
|
|
13
|
+
}
|
|
14
|
+
const limit = input.limit ?? 50;
|
|
15
|
+
if (typeof limit !== 'number' || limit < 1 || limit > 100) {
|
|
16
|
+
throw new ValidationError('limit must be a number between 1 and 100', 'limit');
|
|
17
|
+
}
|
|
18
|
+
const offset = input.offset ?? 0;
|
|
19
|
+
if (typeof offset !== 'number' || offset < 0) {
|
|
20
|
+
throw new ValidationError('offset must be a non-negative number', 'offset');
|
|
21
|
+
}
|
|
22
|
+
const client = new DartClient({ token: DART_TOKEN });
|
|
23
|
+
const result = await client.listComments({
|
|
24
|
+
task_id: input.task_id.trim(),
|
|
25
|
+
limit,
|
|
26
|
+
offset,
|
|
27
|
+
});
|
|
28
|
+
const returnedCount = result.comments.length;
|
|
29
|
+
const hasMore = (offset + returnedCount) < result.total;
|
|
30
|
+
const comments = result.comments.map(c => ({
|
|
31
|
+
comment_id: c.comment_id,
|
|
32
|
+
text: c.text,
|
|
33
|
+
author: c.author,
|
|
34
|
+
created_at: c.created_at,
|
|
35
|
+
parent_id: c.parent_id,
|
|
36
|
+
}));
|
|
37
|
+
return {
|
|
38
|
+
comments,
|
|
39
|
+
total_count: result.total,
|
|
40
|
+
returned_count: returnedCount,
|
|
41
|
+
has_more: hasMore,
|
|
42
|
+
next_offset: hasMore ? offset + returnedCount : null,
|
|
43
|
+
task_id: input.task_id.trim(),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=list_comments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list_comments.js","sourceRoot":"","sources":["../../src/tools/list_comments.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAIL,YAAY,EACZ,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAQ3B,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,KAAwB;IAC/D,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;IAE1C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,YAAY,CAC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C;IAGxD,MAAM,QAAQ,GAAkB,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACxD,UAAU,EAAE,CAAC,CAAC,UAAU;QACxB,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,UAAU,EAAE,CAAC,CAAC,UAAU;QACxB,SAAS,EAAE,CAAC,CAAC,SAAS;KACvB,CAAC,CAAC,CAAC;IAEJ,OAAO;QACL,QAAQ;QACR,WAAW,EAAE,MAAM,CAAC,KAAK;QACzB,cAAc,EAAE,aAAa;QAC7B,QAAQ,EAAE,OAAO;QACjB,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI;QACpD,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE;KAC9B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list_docs.d.ts","sourceRoot":"","sources":["../../src/tools/list_docs.ts"],"names":[],"mappings":"AASA,OAAO,EACL,aAAa,EACb,cAAc,EAMf,MAAM,mBAAmB,CAAC;AAgB3B,wBAAsB,cAAc,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAkLnF"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { DartClient } from '../api/dartClient.js';
|
|
2
|
+
import { handleGetConfig } from './get_config.js';
|
|
3
|
+
import { DartAPIError, ValidationError, findFolder, getFolderNames, } from '../types/index.js';
|
|
4
|
+
export async function handleListDocs(input) {
|
|
5
|
+
const DART_TOKEN = process.env.DART_TOKEN;
|
|
6
|
+
if (!DART_TOKEN) {
|
|
7
|
+
throw new DartAPIError('DART_TOKEN environment variable is required. Get your token from: https://app.dartai.com/?settings=account', 401);
|
|
8
|
+
}
|
|
9
|
+
const safeInput = input || {};
|
|
10
|
+
let limit = safeInput.limit !== undefined ? safeInput.limit : 50;
|
|
11
|
+
if (typeof limit !== 'number' || limit < 1 || limit > 500) {
|
|
12
|
+
throw new ValidationError(`limit must be a number between 1 and 500 (received: ${limit})`, 'limit');
|
|
13
|
+
}
|
|
14
|
+
let offset = safeInput.offset !== undefined ? safeInput.offset : 0;
|
|
15
|
+
if (typeof offset !== 'number' || offset < 0) {
|
|
16
|
+
throw new ValidationError(`offset must be a non-negative number (received: ${offset})`, 'offset');
|
|
17
|
+
}
|
|
18
|
+
let resolvedFolder;
|
|
19
|
+
if (safeInput.folder) {
|
|
20
|
+
let config;
|
|
21
|
+
try {
|
|
22
|
+
config = await handleGetConfig({ cache_bust: false });
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
if (error instanceof DartAPIError) {
|
|
26
|
+
throw new DartAPIError(`Failed to retrieve workspace config for folder validation: ${error.message}`, error.statusCode, error.response);
|
|
27
|
+
}
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
if (!config.folders || config.folders.length === 0) {
|
|
31
|
+
throw new ValidationError('No folders found in workspace configuration. Create a folder first in Dart AI.', 'folder');
|
|
32
|
+
}
|
|
33
|
+
const folder = findFolder(config.folders, safeInput.folder);
|
|
34
|
+
if (!folder) {
|
|
35
|
+
const folderNames = getFolderNames(config.folders);
|
|
36
|
+
const availableFolders = folderNames.join(', ');
|
|
37
|
+
throw new ValidationError(`Invalid folder: "${safeInput.folder}" not found in workspace. Available folders: ${availableFolders}`, 'folder', folderNames);
|
|
38
|
+
}
|
|
39
|
+
resolvedFolder = folder.dart_id;
|
|
40
|
+
}
|
|
41
|
+
const client = new DartClient({ token: DART_TOKEN });
|
|
42
|
+
const apiInput = {
|
|
43
|
+
limit,
|
|
44
|
+
offset,
|
|
45
|
+
};
|
|
46
|
+
if (resolvedFolder) {
|
|
47
|
+
apiInput.folder = resolvedFolder;
|
|
48
|
+
}
|
|
49
|
+
if (safeInput.title_contains !== undefined) {
|
|
50
|
+
if (typeof safeInput.title_contains !== 'string') {
|
|
51
|
+
throw new ValidationError('title_contains must be a string', 'title_contains');
|
|
52
|
+
}
|
|
53
|
+
if (safeInput.title_contains.trim() !== '') {
|
|
54
|
+
apiInput.title_contains = safeInput.title_contains;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (safeInput.text_contains !== undefined) {
|
|
58
|
+
if (typeof safeInput.text_contains !== 'string') {
|
|
59
|
+
throw new ValidationError('text_contains must be a string', 'text_contains');
|
|
60
|
+
}
|
|
61
|
+
if (safeInput.text_contains.trim() !== '') {
|
|
62
|
+
apiInput.text_contains = safeInput.text_contains;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
let apiResponse;
|
|
66
|
+
try {
|
|
67
|
+
apiResponse = await client.listDocs(apiInput);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
if (error instanceof DartAPIError) {
|
|
71
|
+
throw new DartAPIError(`Failed to list documents: ${error.message}`, error.statusCode, error.response);
|
|
72
|
+
}
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
const returnedCount = apiResponse.docs.length;
|
|
76
|
+
const totalCount = apiResponse.total;
|
|
77
|
+
const hasMore = (offset + returnedCount) < totalCount;
|
|
78
|
+
const nextOffset = hasMore ? offset + returnedCount : null;
|
|
79
|
+
const filtersApplied = {
|
|
80
|
+
limit,
|
|
81
|
+
offset,
|
|
82
|
+
};
|
|
83
|
+
if (resolvedFolder) {
|
|
84
|
+
filtersApplied.folder = resolvedFolder;
|
|
85
|
+
}
|
|
86
|
+
if (safeInput.title_contains) {
|
|
87
|
+
filtersApplied.title_contains = safeInput.title_contains;
|
|
88
|
+
}
|
|
89
|
+
if (safeInput.text_contains) {
|
|
90
|
+
filtersApplied.text_contains = safeInput.text_contains;
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
docs: apiResponse.docs,
|
|
94
|
+
total_count: totalCount,
|
|
95
|
+
returned_count: returnedCount,
|
|
96
|
+
has_more: hasMore,
|
|
97
|
+
next_offset: nextOffset,
|
|
98
|
+
filters_applied: filtersApplied,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=list_docs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list_docs.js","sourceRoot":"","sources":["../../src/tools/list_docs.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAGL,YAAY,EACZ,eAAe,EAEf,UAAU,EACV,cAAc,GACf,MAAM,mBAAmB,CAAC;AAgB3B,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAAqB;IACxD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;IAE1C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,YAAY,CACpB,4GAA4G,EAC5G,GAAG,CACJ,CAAC;IACJ,CAAC;IAKD,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE,CAAC;IAG9B,IAAI,KAAK,GAAG,SAAS,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC;QAC1D,MAAM,IAAI,eAAe,CACvB,uDAAuD,KAAK,GAAG,EAC/D,OAAO,CACR,CAAC;IACJ,CAAC;IAGD,IAAI,MAAM,GAAG,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,eAAe,CACvB,mDAAmD,MAA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