motionmcp 2.8.0 → 2.10.0
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/README.md +21 -5
- package/dist/handlers/CustomFieldHandler.js +1 -1
- package/dist/handlers/CustomFieldHandler.js.map +1 -1
- package/dist/handlers/RecurringTaskHandler.d.ts.map +1 -1
- package/dist/handlers/RecurringTaskHandler.js +14 -2
- package/dist/handlers/RecurringTaskHandler.js.map +1 -1
- package/dist/handlers/SearchHandler.d.ts.map +1 -1
- package/dist/handlers/SearchHandler.js +6 -8
- package/dist/handlers/SearchHandler.js.map +1 -1
- package/dist/handlers/StatusHandler.d.ts.map +1 -1
- package/dist/handlers/StatusHandler.js +11 -3
- package/dist/handlers/StatusHandler.js.map +1 -1
- package/dist/handlers/TaskHandler.d.ts +8 -0
- package/dist/handlers/TaskHandler.d.ts.map +1 -1
- package/dist/handlers/TaskHandler.js +105 -33
- package/dist/handlers/TaskHandler.js.map +1 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +10 -4
- package/dist/mcp-server.js.map +1 -1
- package/dist/schemas/motion.d.ts +0 -424
- package/dist/schemas/motion.d.ts.map +1 -1
- package/dist/schemas/motion.js +1 -217
- package/dist/schemas/motion.js.map +1 -1
- package/dist/services/api/projects.d.ts.map +1 -1
- package/dist/services/api/projects.js +22 -3
- package/dist/services/api/projects.js.map +1 -1
- package/dist/services/api/recurringTasks.d.ts.map +1 -1
- package/dist/services/api/recurringTasks.js +7 -3
- package/dist/services/api/recurringTasks.js.map +1 -1
- package/dist/services/api/search.js +4 -4
- package/dist/services/api/search.js.map +1 -1
- package/dist/services/api/tasks.d.ts +16 -1
- package/dist/services/api/tasks.d.ts.map +1 -1
- package/dist/services/api/tasks.js +58 -18
- package/dist/services/api/tasks.js.map +1 -1
- package/dist/services/motionApi.d.ts +2 -1
- package/dist/services/motionApi.d.ts.map +1 -1
- package/dist/services/motionApi.js +2 -2
- package/dist/services/motionApi.js.map +1 -1
- package/dist/tools/ToolDefinitions.d.ts.map +1 -1
- package/dist/tools/ToolDefinitions.js +50 -21
- package/dist/tools/ToolDefinitions.js.map +1 -1
- package/dist/tools/ToolRegistry.d.ts +1 -1
- package/dist/tools/ToolRegistry.d.ts.map +1 -1
- package/dist/tools/ToolRegistry.js +9 -3
- package/dist/tools/ToolRegistry.js.map +1 -1
- package/dist/types/mcp-tool-args.d.ts +4 -0
- package/dist/types/mcp-tool-args.d.ts.map +1 -1
- package/dist/types/mcp.d.ts +2 -2
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/utils/constants.d.ts +10 -1
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +53 -14
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/dateFormat.d.ts +86 -0
- package/dist/utils/dateFormat.d.ts.map +1 -0
- package/dist/utils/dateFormat.js +261 -0
- package/dist/utils/dateFormat.js.map +1 -0
- package/dist/utils/errors.d.ts +5 -3
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +14 -3
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/frequencyTransform.d.ts.map +1 -1
- package/dist/utils/frequencyTransform.js +52 -2
- package/dist/utils/frequencyTransform.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/paginationNew.d.ts.map +1 -1
- package/dist/utils/paginationNew.js +14 -6
- package/dist/utils/paginationNew.js.map +1 -1
- package/dist/utils/parameterUtils.d.ts +24 -3
- package/dist/utils/parameterUtils.d.ts.map +1 -1
- package/dist/utils/parameterUtils.js +52 -4
- package/dist/utils/parameterUtils.js.map +1 -1
- package/dist/utils/responseFormatters.d.ts +13 -2
- package/dist/utils/responseFormatters.d.ts.map +1 -1
- package/dist/utils/responseFormatters.js +101 -30
- package/dist/utils/responseFormatters.js.map +1 -1
- package/dist/utils/sanitize.d.ts.map +1 -1
- package/dist/utils/sanitize.js +3 -2
- package/dist/utils/sanitize.js.map +1 -1
- package/dist/utils/validator.d.ts +8 -1
- package/dist/utils/validator.d.ts.map +1 -1
- package/dist/utils/validator.js +19 -3
- package/dist/utils/validator.js.map +1 -1
- package/dist/utils/workspaceResolver.d.ts.map +1 -1
- package/dist/utils/workspaceResolver.js +14 -1
- package/dist/utils/workspaceResolver.js.map +1 -1
- package/package.json +10 -7
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
## Getting Started
|
|
15
15
|
|
|
16
|
-
**Prerequisites:** Node.js
|
|
16
|
+
**Prerequisites:** Node.js 20+ and a [Motion API key](https://app.usemotion.com/settings/api).
|
|
17
17
|
|
|
18
18
|
### Local Setup (npx)
|
|
19
19
|
|
|
@@ -71,12 +71,24 @@ Your MCP URL will be:
|
|
|
71
71
|
https://motion-mcp-server.YOUR_SUBDOMAIN.workers.dev/mcp/YOUR_SECRET
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
+
Use exactly that address. The secret goes at the end of the path and nothing follows it. The server speaks MCP Streamable HTTP on that single endpoint; do not append `/sse` or any other sub-path.
|
|
75
|
+
|
|
76
|
+
Clients that can send headers can keep the secret out of the URL instead: point them at `https://motion-mcp-server.YOUR_SUBDOMAIN.workers.dev/mcp` and send `Authorization: Bearer YOUR_SECRET`.
|
|
77
|
+
|
|
74
78
|
#### Connecting from Claude
|
|
75
79
|
|
|
76
80
|
1. Go to [claude.ai](https://claude.ai) > Settings > Connectors
|
|
77
81
|
2. Add your MCP URL
|
|
78
82
|
3. The server syncs automatically to the Claude mobile app
|
|
79
83
|
|
|
84
|
+
For Claude Code, use the Streamable HTTP transport:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
claude mcp add --transport http motion https://motion-mcp-server.YOUR_SUBDOMAIN.workers.dev/mcp --header "Authorization: Bearer YOUR_SECRET"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
In Claude Desktop, add the same URL as a remote server of type `http` (not `sse`).
|
|
91
|
+
|
|
80
92
|
#### Connecting from ChatGPT
|
|
81
93
|
|
|
82
94
|
1. Go to ChatGPT Settings > Connectors
|
|
@@ -84,6 +96,8 @@ https://motion-mcp-server.YOUR_SUBDOMAIN.workers.dev/mcp/YOUR_SECRET
|
|
|
84
96
|
|
|
85
97
|
> **Security:** The secret in the URL prevents casual discovery. Treat the full URL like a password — don't share it publicly.
|
|
86
98
|
|
|
99
|
+
> **Transport:** Only Streamable HTTP is served. The older HTTP+SSE transport (a `GET` stream plus a `/message` endpoint) was retired in the move to a stateless server; a client configured with transport type `sse` must be switched to `http`.
|
|
100
|
+
|
|
87
101
|
Tool configuration works the same as the local server. Set `MOTION_MCP_TOOLS` in `wrangler.toml` under `[vars]`, or override via `wrangler secret put MOTION_MCP_TOOLS`.
|
|
88
102
|
|
|
89
103
|
For local Worker development, see [DEVELOPER.md](./DEVELOPER.md).
|
|
@@ -111,8 +125,8 @@ All 10 tools are enabled by default. If you run multiple MCP servers and want to
|
|
|
111
125
|
| Level | Tools | Description |
|
|
112
126
|
|---|---|---|
|
|
113
127
|
| **minimal** | 3 | Tasks, projects, workspaces only |
|
|
114
|
-
| **essential** |
|
|
115
|
-
| **complete** (default) | 10 | Full API access including custom fields
|
|
128
|
+
| **essential** | 8 | Adds users, search, comments, schedules, statuses |
|
|
129
|
+
| **complete** (default) | 10 | Full API access including custom fields and recurring tasks |
|
|
116
130
|
| **custom** | varies | Pick exactly the tools you need |
|
|
117
131
|
|
|
118
132
|
Custom example:
|
|
@@ -123,10 +137,12 @@ MOTION_MCP_TOOLS=custom:motion_tasks,motion_projects,motion_search npx motionmcp
|
|
|
123
137
|
## Tools Reference
|
|
124
138
|
|
|
125
139
|
### motion_tasks
|
|
126
|
-
**Operations:** `create`, `list`, `get`, `update`, `delete`, `move`, `unassign`
|
|
140
|
+
**Operations:** `create`, `list`, `list_all_uncompleted`, `get`, `update`, `delete`, `move`, `unassign`
|
|
127
141
|
|
|
128
142
|
The primary tool for task management. Supports all Motion API parameters including `name`, `description`, `priority`, `dueDate`, `duration`, `labels`, `assigneeId`, and `autoScheduled`. You can reference workspaces and projects by name — the server resolves them automatically.
|
|
129
143
|
|
|
144
|
+
`list_all_uncompleted` spans every workspace in one call (it ignores `workspaceId`/`workspaceName`) and honors the `dueDate` and `priority` filters, so "what's due this week across all my workspaces?" resolves directly. On `list`, `dueDate` is an inclusive on-or-before-day bound that includes overdue tasks (so `dueDate: "today"` answers "what's due today?"), and `completedAfter` / `completedBefore` bound by completion date in your account's time zone for "what did I get done this week?". Dates are interpreted in your Motion account's time zone, and list responses lead with a header naming that zone and today's local date.
|
|
145
|
+
|
|
130
146
|
```json
|
|
131
147
|
{
|
|
132
148
|
"operation": "create",
|
|
@@ -179,7 +195,7 @@ Read and add comments on tasks and projects.
|
|
|
179
195
|
### motion_schedules
|
|
180
196
|
**Operations:** `list`
|
|
181
197
|
|
|
182
|
-
Retrieve user schedules and time zones.
|
|
198
|
+
Retrieve user schedules, showing each day's working hours (start-end per day) and time zones. These are recurring working-hour templates only — they do not expose actual calendar events or meetings, so they cannot by themselves show a true free/busy picture; combine with tasks' `scheduledStart`/`scheduledEnd` to see what Motion has auto-booked.
|
|
183
199
|
|
|
184
200
|
### motion_custom_fields
|
|
185
201
|
**Operations:** `list`, `create`, `delete`, `add_to_project`, `remove_from_project`, `add_to_task`, `remove_from_task`
|
|
@@ -52,7 +52,7 @@ class CustomFieldHandler extends BaseHandler_1.BaseHandler {
|
|
|
52
52
|
if (!isSelectType && args.options) {
|
|
53
53
|
return this.handleError(new Error('Options parameter is only allowed for select/multiSelect field types'));
|
|
54
54
|
}
|
|
55
|
-
if (isSelectType && !args.options) {
|
|
55
|
+
if (isSelectType && (!args.options || args.options.length === 0)) {
|
|
56
56
|
return this.handleError(new Error('Options parameter is required for select/multiSelect field types'));
|
|
57
57
|
}
|
|
58
58
|
const workspace = await this.workspaceResolver.resolveWorkspace({
|
|
@@ -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SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/G,OAAO,IAAA,gCAAwB,EAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxE,CAAC;IAEO,KAAK,CAAC,oBAAoB,CAAC,IAA4B;QAC7D,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,yFAAyF,CAAC,CAAC,CAAC;QAChI,CAAC;QAED,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9E,OAAO,IAAA,gCAAwB,EAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAClE,CAAC;CACF;AAlJD,gDAkJC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecurringTaskHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/RecurringTaskHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAIlE,qBAAa,oBAAqB,SAAQ,WAAW;IAC7C,MAAM,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,eAAe,CAAC;YAmBxD,UAAU;YAYV,YAAY;
|
|
1
|
+
{"version":3,"file":"RecurringTaskHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/RecurringTaskHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAIlE,qBAAa,oBAAqB,SAAQ,WAAW;IAC7C,MAAM,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,eAAe,CAAC;YAmBxD,UAAU;YAYV,YAAY;YAuDZ,YAAY;CAQ3B"}
|
|
@@ -46,19 +46,31 @@ class RecurringTaskHandler extends BaseHandler_1.BaseHandler {
|
|
|
46
46
|
if (!frequency.type || !['daily', 'weekly', 'biweekly', 'monthly', 'quarterly', 'yearly', 'custom'].includes(frequency.type)) {
|
|
47
47
|
return this.handleError(new Error('Frequency type must be one of: daily, weekly, biweekly, monthly, quarterly, yearly, custom'));
|
|
48
48
|
}
|
|
49
|
+
// Validate duration: non-negative integer minutes or the 'REMINDER' sentinel.
|
|
50
|
+
// The recurring schema omits 'NONE', so it is not accepted here.
|
|
51
|
+
let validatedDuration;
|
|
52
|
+
if (args.duration !== undefined && args.duration !== null) {
|
|
53
|
+
validatedDuration = (0, utils_1.parseDurationValue)(args.duration, ['REMINDER']);
|
|
54
|
+
}
|
|
49
55
|
const workspace = await this.workspaceResolver.resolveWorkspace({
|
|
50
56
|
workspaceId: args.workspaceId,
|
|
51
57
|
workspaceName: args.workspaceName
|
|
52
58
|
});
|
|
59
|
+
// Resolve the 'me' shortcut to a concrete user ID, consistent with motion_tasks.
|
|
60
|
+
// (Unlike motion_tasks, this tool has no assignee-name field yet — only the
|
|
61
|
+
// 'me' shortcut and direct IDs are supported here.)
|
|
62
|
+
const resolvedAssigneeId = args.assigneeId.trim().toLowerCase() === 'me'
|
|
63
|
+
? (await this.motionService.getCurrentUser()).id
|
|
64
|
+
: args.assigneeId;
|
|
53
65
|
const taskData = {
|
|
54
66
|
name: args.name,
|
|
55
67
|
workspaceId: workspace.id,
|
|
56
|
-
assigneeId:
|
|
68
|
+
assigneeId: resolvedAssigneeId,
|
|
57
69
|
frequency,
|
|
58
70
|
...(args.description && { description: args.description }),
|
|
59
71
|
...(args.projectId && { projectId: args.projectId }),
|
|
60
72
|
...(args.deadlineType && { deadlineType: args.deadlineType }),
|
|
61
|
-
...(
|
|
73
|
+
...(validatedDuration !== undefined && { duration: validatedDuration }),
|
|
62
74
|
...(args.startingOn && { startingOn: args.startingOn }),
|
|
63
75
|
...(args.idealTime && { idealTime: args.idealTime }),
|
|
64
76
|
...(args.schedule && { schedule: args.schedule }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecurringTaskHandler.js","sourceRoot":"","sources":["../../src/handlers/RecurringTaskHandler.ts"],"names":[],"mappings":";;;AAAA,oDAAiD;AAIjD,
|
|
1
|
+
{"version":3,"file":"RecurringTaskHandler.js","sourceRoot":"","sources":["../../src/handlers/RecurringTaskHandler.ts"],"names":[],"mappings":";;;AAAA,oDAAiD;AAIjD,oCAAsI;AAEtI,MAAa,oBAAqB,SAAQ,yBAAW;IACnD,KAAK,CAAC,MAAM,CAAC,IAA8B;QACzC,IAAI,CAAC;YACH,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;YAE3B,QAAO,SAAS,EAAE,CAAC;gBACjB,KAAK,MAAM;oBACT,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;gBACrC,KAAK,QAAQ;oBACX,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;gBACvC,KAAK,QAAQ;oBACX,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;gBACvC;oBACE,OAAO,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,UAAU,CAAC,IAA8B;QACrD,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YAC7C,OAAO,IAAI,CAA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AAG,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;YACvD,GAAG,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;YACpD,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjD,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;SAClD,CAAC;QAEF,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QACvE,OAAO,IAAA,iCAAyB,EAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAEO,KAAK,CAAC,YAAY,CAAC,IAA8B;QACvD,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC,CAAC;QAC3F,CAAC;QAED,MAAM,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnE,OAAO,IAAA,wBAAgB,EAAC,kBAAkB,IAAI,CAAC,eAAe,uBAAuB,CAAC,CAAC;IACzF,CAAC;CACF;AA/FD,oDA+FC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/SearchHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAkB,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/SearchHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAkB,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAW1D,qBAAa,aAAc,SAAQ,WAAW;IACtC,MAAM,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;YAehD,mBAAmB;IA4DjC,OAAO,CAAC,kBAAkB;CAY3B"}
|
|
@@ -22,7 +22,8 @@ class SearchHandler extends BaseHandler_1.BaseHandler {
|
|
|
22
22
|
if (!args.query) {
|
|
23
23
|
return this.handleError(new Error("Query is required for content search"));
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const searchScope = args.searchScope || 'both';
|
|
26
|
+
const entityTypes = this.resolveEntityTypes(searchScope);
|
|
26
27
|
// Use configurable limit to prevent resource exhaustion
|
|
27
28
|
const limit = args.limit || utils_1.LIMITS.MAX_SEARCH_RESULTS;
|
|
28
29
|
const workspace = await this.workspaceResolver.resolveWorkspace({
|
|
@@ -65,18 +66,15 @@ class SearchHandler extends BaseHandler_1.BaseHandler {
|
|
|
65
66
|
}
|
|
66
67
|
return (0, utils_1.formatSearchResults)(slicedResults, args.query, {
|
|
67
68
|
limit,
|
|
68
|
-
searchScope
|
|
69
|
+
searchScope,
|
|
69
70
|
truncation: mergedTruncation
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
|
-
resolveEntityTypes(
|
|
73
|
-
if (
|
|
74
|
-
return Array.from(new Set(args.entityTypes));
|
|
75
|
-
}
|
|
76
|
-
if (args.searchScope === 'tasks') {
|
|
73
|
+
resolveEntityTypes(searchScope) {
|
|
74
|
+
if (searchScope === 'tasks') {
|
|
77
75
|
return ['tasks'];
|
|
78
76
|
}
|
|
79
|
-
if (
|
|
77
|
+
if (searchScope === 'projects') {
|
|
80
78
|
return ['projects'];
|
|
81
79
|
}
|
|
82
80
|
return ['tasks', 'projects'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchHandler.js","sourceRoot":"","sources":["../../src/handlers/SearchHandler.ts"],"names":[],"mappings":";;;AAAA,oDAAiD;AAGjD,oCAAuD;
|
|
1
|
+
{"version":3,"file":"SearchHandler.js","sourceRoot":"","sources":["../../src/handlers/SearchHandler.ts"],"names":[],"mappings":";;;AAAA,oDAAiD;AAGjD,oCAAuD;AAUvD,MAAa,aAAc,SAAQ,yBAAW;IAC5C,KAAK,CAAC,MAAM,CAAC,IAAsB;QACjC,IAAI,CAAC;YACH,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;YAE3B,QAAO,SAAS,EAAE,CAAC;gBACjB,KAAK,SAAS;oBACZ,OAAO,MAAM,IAAI,CAAC,mBAAmB,CAAC,IAAyB,CAAC,CAAC;gBACnE;oBACE,OAAO,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,mBAAmB,CAAC,IAAuB;QACvD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC,CAAC;QAC7E,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,MAAM,CAAC;QAC/C,MAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;QAEzD,wDAAwD;QACxD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,cAAM,CAAC,kBAAkB,CAAC;QAEtD,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC;YAC9D,WAAW,EAAE,IAAI,CAAC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tC,MAAM,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"StatusHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/StatusHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,qBAAa,aAAc,SAAQ,WAAW;IACtC,MAAM,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,eAAe,CAAC;YAQlD,UAAU;CAczB"}
|
|
@@ -6,14 +6,22 @@ const utils_1 = require("../utils");
|
|
|
6
6
|
class StatusHandler extends BaseHandler_1.BaseHandler {
|
|
7
7
|
async handle(args) {
|
|
8
8
|
try {
|
|
9
|
-
|
|
10
|
-
return await this.handleList(workspaceId);
|
|
9
|
+
return await this.handleList(args);
|
|
11
10
|
}
|
|
12
11
|
catch (error) {
|
|
13
12
|
return this.handleError(error);
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
|
-
async handleList(
|
|
15
|
+
async handleList(args) {
|
|
16
|
+
// Resolve a workspace name to its ID when provided; a bare workspaceId is used
|
|
17
|
+
// as-is, and omitting both returns statuses across all workspaces.
|
|
18
|
+
let workspaceId = args.workspaceId;
|
|
19
|
+
if (!workspaceId && args.workspaceName) {
|
|
20
|
+
const workspace = await this.workspaceResolver.resolveWorkspace({
|
|
21
|
+
workspaceName: args.workspaceName
|
|
22
|
+
});
|
|
23
|
+
workspaceId = workspace.id;
|
|
24
|
+
}
|
|
17
25
|
const statuses = await this.motionService.getStatuses(workspaceId);
|
|
18
26
|
return (0, utils_1.formatStatusList)(statuses);
|
|
19
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusHandler.js","sourceRoot":"","sources":["../../src/handlers/StatusHandler.ts"],"names":[],"mappings":";;;AAAA,oDAAiD;AAGjD,oCAA4C;AAE5C,MAAa,aAAc,SAAQ,yBAAW;IAC5C,KAAK,CAAC,MAAM,CAAC,IAAwB;QACnC,IAAI,CAAC;YACH,
|
|
1
|
+
{"version":3,"file":"StatusHandler.js","sourceRoot":"","sources":["../../src/handlers/StatusHandler.ts"],"names":[],"mappings":";;;AAAA,oDAAiD;AAGjD,oCAA4C;AAE5C,MAAa,aAAc,SAAQ,yBAAW;IAC5C,KAAK,CAAC,MAAM,CAAC,IAAwB;QACnC,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,UAAU,CAAC,IAAwB;QAC/C,+EAA+E;QAC/E,mEAAmE;QACnE,IAAI,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACnC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC;gBAC9D,aAAa,EAAE,IAAI,CAAC,aAAa;aAClC,CAAC,CAAC;YACH,WAAW,GAAG,SAAS,CAAC,EAAE,CAAC;QAC7B,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QACnE,OAAO,IAAA,wBAAgB,EAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;CACF;AAvBD,sCAuBC"}
|
|
@@ -40,6 +40,13 @@ export declare class TaskHandler extends BaseHandler {
|
|
|
40
40
|
* @returns Formatted list of matching tasks with filter context
|
|
41
41
|
*/
|
|
42
42
|
private handleList;
|
|
43
|
+
/**
|
|
44
|
+
* Resolve the IANA zone used to render local times beside ISO instants.
|
|
45
|
+
* Backed by the schedules cache, so this costs one API call per cache window.
|
|
46
|
+
* Any failure degrades to undefined — callers then emit ISO instants alone,
|
|
47
|
+
* which remain unambiguous. Display formatting must never fail a read.
|
|
48
|
+
*/
|
|
49
|
+
private resolveTimeZone;
|
|
43
50
|
/**
|
|
44
51
|
* Retrieves detailed information for a single task.
|
|
45
52
|
* @param params - Parameters containing the task ID
|
|
@@ -98,6 +105,7 @@ export declare class TaskHandler extends BaseHandler {
|
|
|
98
105
|
/**
|
|
99
106
|
* Parse and validate task duration from user input.
|
|
100
107
|
* Accepts non-negative integer minutes or special values NONE/REMINDER.
|
|
108
|
+
* Delegates to the shared parseDurationValue helper.
|
|
101
109
|
*/
|
|
102
110
|
private parseDurationValue;
|
|
103
111
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/TaskHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"TaskHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/TaskHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AA4GzD;;;;;;;;GAQG;AACH,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;OAIG;IACG,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IA6B7D;;;;;;;;;;OAUG;YACW,YAAY;IA6E1B;;;;;;;;;OASG;YACW,UAAU;IA+IxB;;;;;OAKG;YACW,eAAe;IAW7B;;;;OAIG;YACW,SAAS;IASvB;;;;;;;;;OASG;YACW,YAAY;IAwE1B;;;;OAIG;YACW,YAAY;IAS1B;;;;;OAKG;YACW,UAAU;IAwBxB;;;;OAIG;YACW,cAAc;IAY5B;;;;;OAKG;YACW,wBAAwB;IA2CtC;;;;;;;;;;OAUG;YACW,eAAe;IAqD7B;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAI1B;;;;;;OAMG;YACW,kCAAkC;CA4FjD"}
|
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TaskHandler = void 0;
|
|
4
4
|
const BaseHandler_1 = require("./base/BaseHandler");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
|
+
const dateFormat_1 = require("../utils/dateFormat");
|
|
6
7
|
const constants_1 = require("../utils/constants");
|
|
8
|
+
const logger_1 = require("../utils/logger");
|
|
7
9
|
class AutoSchedulingValidationError extends Error {
|
|
8
10
|
constructor(message) {
|
|
9
11
|
super(message);
|
|
@@ -100,16 +102,22 @@ class TaskHandler extends BaseHandler_1.BaseHandler {
|
|
|
100
102
|
const convertedLabels = taskData.labels;
|
|
101
103
|
// Validate and normalize auto-scheduling configuration
|
|
102
104
|
taskData.autoScheduled = await this.validateAndNormalizeAutoScheduling(taskData.autoScheduled, targetWorkspaceId);
|
|
105
|
+
// Resolve a supplied assignee name or the 'me' shortcut to a concrete user ID
|
|
106
|
+
// in the task's target workspace. A supplied name that cannot be found throws.
|
|
107
|
+
const { resolvedId: resolvedAssigneeId } = await this.resolveAssignee(taskData.assigneeId, taskData.assignee, targetWorkspaceId);
|
|
108
|
+
// Zone-aware relative-date resolution ('today' means today in the account's
|
|
109
|
+
// schedule zone, not UTC). Cached lookup; failure degrades to UTC resolution.
|
|
110
|
+
const dueDateZone = taskData.dueDate ? await this.resolveTimeZone() : undefined;
|
|
103
111
|
const task = await this.motionService.createTask({
|
|
104
112
|
name: taskData.name,
|
|
105
113
|
description: taskData.description,
|
|
106
114
|
projectId: resolvedProjectId,
|
|
107
115
|
status: taskData.status,
|
|
108
116
|
priority: taskData.priority,
|
|
109
|
-
dueDate: (0, utils_1.normalizeDueDateForApi)(taskData.dueDate),
|
|
117
|
+
dueDate: (0, utils_1.normalizeDueDateForApi)(taskData.dueDate, dueDateZone),
|
|
110
118
|
duration: convertedDuration,
|
|
111
119
|
labels: convertedLabels,
|
|
112
|
-
assigneeId:
|
|
120
|
+
assigneeId: resolvedAssigneeId,
|
|
113
121
|
autoScheduled: taskData.autoScheduled,
|
|
114
122
|
workspaceId: targetWorkspaceId
|
|
115
123
|
});
|
|
@@ -172,15 +180,34 @@ class TaskHandler extends BaseHandler_1.BaseHandler {
|
|
|
172
180
|
if (params.priority && !(0, constants_1.isValidPriority)(params.priority)) {
|
|
173
181
|
return this.handleError(new Error(`Invalid priority "${params.priority}". Valid values are: ASAP, HIGH, MEDIUM, LOW`));
|
|
174
182
|
}
|
|
183
|
+
// Resolve the account zone once; reused for filtering by dueDate and for display.
|
|
184
|
+
const timeZone = await this.resolveTimeZone();
|
|
175
185
|
// Validate and parse due date if provided
|
|
176
186
|
let validatedDueDate;
|
|
177
187
|
if (params.dueDate) {
|
|
178
|
-
const parsedDate = (0, constants_1.parseFilterDate)(params.dueDate);
|
|
188
|
+
const parsedDate = (0, constants_1.parseFilterDate)(params.dueDate, timeZone);
|
|
179
189
|
if (!parsedDate) {
|
|
180
190
|
return this.handleError(new Error(`Invalid date format "${params.dueDate}". Use YYYY-MM-DD format or relative dates like 'today', 'tomorrow'`));
|
|
181
191
|
}
|
|
182
192
|
validatedDueDate = parsedDate;
|
|
183
193
|
}
|
|
194
|
+
// Validate and parse completion-date bounds if provided
|
|
195
|
+
let validatedCompletedAfter;
|
|
196
|
+
if (params.completedAfter) {
|
|
197
|
+
const parsed = (0, constants_1.parseFilterDate)(params.completedAfter, timeZone);
|
|
198
|
+
if (!parsed) {
|
|
199
|
+
return this.handleError(new Error(`Invalid date format "${params.completedAfter}". Use YYYY-MM-DD format or relative dates like 'today', 'yesterday'`));
|
|
200
|
+
}
|
|
201
|
+
validatedCompletedAfter = parsed;
|
|
202
|
+
}
|
|
203
|
+
let validatedCompletedBefore;
|
|
204
|
+
if (params.completedBefore) {
|
|
205
|
+
const parsed = (0, constants_1.parseFilterDate)(params.completedBefore, timeZone);
|
|
206
|
+
if (!parsed) {
|
|
207
|
+
return this.handleError(new Error(`Invalid date format "${params.completedBefore}". Use YYYY-MM-DD format or relative dates like 'today', 'yesterday'`));
|
|
208
|
+
}
|
|
209
|
+
validatedCompletedBefore = parsed;
|
|
210
|
+
}
|
|
184
211
|
// Validate labels if provided
|
|
185
212
|
if (params.labels && (!Array.isArray(params.labels) || params.labels.some(label => !label || typeof label !== 'string'))) {
|
|
186
213
|
return this.handleError(new Error('Labels must be an array of non-empty strings'));
|
|
@@ -195,8 +222,11 @@ class TaskHandler extends BaseHandler_1.BaseHandler {
|
|
|
195
222
|
assigneeId: resolvedAssigneeId,
|
|
196
223
|
priority: params.priority,
|
|
197
224
|
dueDate: validatedDueDate,
|
|
225
|
+
completedAfter: validatedCompletedAfter,
|
|
226
|
+
completedBefore: validatedCompletedBefore,
|
|
198
227
|
labels: params.labels,
|
|
199
|
-
limit: params.limit
|
|
228
|
+
limit: params.limit,
|
|
229
|
+
timeZone
|
|
200
230
|
});
|
|
201
231
|
const statusDisplay = params.includeAllStatuses
|
|
202
232
|
? 'all statuses'
|
|
@@ -213,9 +243,27 @@ class TaskHandler extends BaseHandler_1.BaseHandler {
|
|
|
213
243
|
priority: params.priority,
|
|
214
244
|
dueDate: params.dueDate,
|
|
215
245
|
limit: params.limit,
|
|
216
|
-
truncation
|
|
246
|
+
truncation,
|
|
247
|
+
timeZone
|
|
217
248
|
});
|
|
218
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* Resolve the IANA zone used to render local times beside ISO instants.
|
|
252
|
+
* Backed by the schedules cache, so this costs one API call per cache window.
|
|
253
|
+
* Any failure degrades to undefined — callers then emit ISO instants alone,
|
|
254
|
+
* which remain unambiguous. Display formatting must never fail a read.
|
|
255
|
+
*/
|
|
256
|
+
async resolveTimeZone() {
|
|
257
|
+
try {
|
|
258
|
+
return (0, dateFormat_1.resolveDisplayTimeZone)(await this.motionService.getSchedules());
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
(0, logger_1.mcpLog)(constants_1.LOG_LEVELS.WARN, 'Timezone resolution failed, timestamps will omit local time', {
|
|
262
|
+
error: error instanceof Error ? error.message : String(error)
|
|
263
|
+
});
|
|
264
|
+
return undefined;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
219
267
|
/**
|
|
220
268
|
* Retrieves detailed information for a single task.
|
|
221
269
|
* @param params - Parameters containing the task ID
|
|
@@ -226,7 +274,7 @@ class TaskHandler extends BaseHandler_1.BaseHandler {
|
|
|
226
274
|
return this.handleError(new Error("Task ID is required for get operation"));
|
|
227
275
|
}
|
|
228
276
|
const taskDetails = await this.motionService.getTask(params.taskId);
|
|
229
|
-
return (0, utils_1.formatTaskDetail)(taskDetails);
|
|
277
|
+
return (0, utils_1.formatTaskDetail)(taskDetails, await this.resolveTimeZone());
|
|
230
278
|
}
|
|
231
279
|
/**
|
|
232
280
|
* Updates an existing task with new values.
|
|
@@ -260,7 +308,7 @@ class TaskHandler extends BaseHandler_1.BaseHandler {
|
|
|
260
308
|
updateData.priority = params.priority;
|
|
261
309
|
}
|
|
262
310
|
if (params.dueDate !== undefined) {
|
|
263
|
-
updateData.dueDate = (0, utils_1.normalizeDueDateForApi)(params.dueDate);
|
|
311
|
+
updateData.dueDate = (0, utils_1.normalizeDueDateForApi)(params.dueDate, await this.resolveTimeZone());
|
|
264
312
|
}
|
|
265
313
|
if (params.duration !== undefined) {
|
|
266
314
|
updateData.duration = this.parseDurationValue(params.duration);
|
|
@@ -268,20 +316,31 @@ class TaskHandler extends BaseHandler_1.BaseHandler {
|
|
|
268
316
|
// API accepts labels as plain string array per docs
|
|
269
317
|
if (params.labels !== undefined)
|
|
270
318
|
updateData.labels = params.labels;
|
|
271
|
-
|
|
272
|
-
|
|
319
|
+
// Resolve the task's workspaceId once (fetching only if needed) so assignee
|
|
320
|
+
// resolution and auto-scheduling validation both scope to the task's actual
|
|
321
|
+
// workspace instead of falling into a cross-workspace name lookup.
|
|
322
|
+
const needsWorkspaceId = params.assigneeId !== undefined ||
|
|
323
|
+
params.assignee !== undefined ||
|
|
324
|
+
params.autoScheduled !== undefined;
|
|
325
|
+
let resolvedWorkspaceId = params.workspaceId;
|
|
326
|
+
if (!resolvedWorkspaceId && needsWorkspaceId) {
|
|
327
|
+
const task = await this.motionService.getTask(params.taskId);
|
|
328
|
+
resolvedWorkspaceId = task.workspaceId;
|
|
329
|
+
}
|
|
330
|
+
if (params.assigneeId !== undefined || params.assignee !== undefined) {
|
|
331
|
+
// Resolve the 'me' shortcut and assignee names, scoped to the task's
|
|
332
|
+
// workspace. A supplied name that cannot be found throws.
|
|
333
|
+
const { resolvedId } = await this.resolveAssignee(params.assigneeId, params.assignee, resolvedWorkspaceId);
|
|
334
|
+
if (resolvedId !== undefined) {
|
|
335
|
+
updateData.assigneeId = resolvedId;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
273
338
|
if (params.autoScheduled !== undefined) {
|
|
274
339
|
// Normalize string shorthand (e.g., "Work Hours") to { schedule: "Work Hours" }
|
|
275
340
|
updateData.autoScheduled = (0, utils_1.parseAutoScheduledParam)(params.autoScheduled);
|
|
276
341
|
// Validate auto-scheduling (same as create): catches "true" → {} silent no-op
|
|
277
342
|
if (updateData.autoScheduled !== null && updateData.autoScheduled !== undefined) {
|
|
278
|
-
|
|
279
|
-
let workspaceId = params.workspaceId;
|
|
280
|
-
if (!workspaceId) {
|
|
281
|
-
const task = await this.motionService.getTask(params.taskId);
|
|
282
|
-
workspaceId = task.workspaceId;
|
|
283
|
-
}
|
|
284
|
-
updateData.autoScheduled = await this.validateAndNormalizeAutoScheduling(updateData.autoScheduled, workspaceId);
|
|
343
|
+
updateData.autoScheduled = await this.validateAndNormalizeAutoScheduling(updateData.autoScheduled, resolvedWorkspaceId);
|
|
285
344
|
}
|
|
286
345
|
}
|
|
287
346
|
const updatedTask = await this.motionService.updateTask(params.taskId, updateData);
|
|
@@ -312,7 +371,11 @@ class TaskHandler extends BaseHandler_1.BaseHandler {
|
|
|
312
371
|
if (!params.targetWorkspaceId) {
|
|
313
372
|
return this.handleError(new Error("Target workspace ID is required for move operation"));
|
|
314
373
|
}
|
|
315
|
-
|
|
374
|
+
// Resolve the 'me' shortcut and assignee names, scoped to the destination
|
|
375
|
+
// workspace, so a reassignment during the move uses a concrete user ID from
|
|
376
|
+
// the workspace the task is moving into. Unresolvable names throw.
|
|
377
|
+
const { resolvedId: resolvedAssigneeId } = await this.resolveAssignee(params.assigneeId, params.assignee, params.targetWorkspaceId);
|
|
378
|
+
const movedTask = await this.motionService.moveTask(params.taskId, params.targetWorkspaceId, resolvedAssigneeId);
|
|
316
379
|
if (movedTask?.name) {
|
|
317
380
|
return (0, utils_1.formatMcpSuccess)(`Successfully moved task "${movedTask.name}" (ID: ${movedTask.id})`);
|
|
318
381
|
}
|
|
@@ -340,14 +403,35 @@ class TaskHandler extends BaseHandler_1.BaseHandler {
|
|
|
340
403
|
* @returns Formatted list of uncompleted tasks from all workspaces
|
|
341
404
|
*/
|
|
342
405
|
async handleListAllUncompleted(params) {
|
|
406
|
+
if (params.priority && !(0, constants_1.isValidPriority)(params.priority)) {
|
|
407
|
+
return this.handleError(new Error(`Invalid priority "${params.priority}". Valid values are: ASAP, HIGH, MEDIUM, LOW`));
|
|
408
|
+
}
|
|
409
|
+
const timeZone = await this.resolveTimeZone();
|
|
410
|
+
let validatedDueDate;
|
|
411
|
+
if (params.dueDate) {
|
|
412
|
+
const parsedDate = (0, constants_1.parseFilterDate)(params.dueDate, timeZone);
|
|
413
|
+
if (!parsedDate) {
|
|
414
|
+
return this.handleError(new Error(`Invalid date format "${params.dueDate}". Use YYYY-MM-DD format or relative dates like 'today', 'tomorrow'`));
|
|
415
|
+
}
|
|
416
|
+
validatedDueDate = parsedDate;
|
|
417
|
+
}
|
|
343
418
|
const { resolvedId, display } = await this.resolveAssignee(params.assigneeId, params.assignee);
|
|
344
|
-
const { items: tasks, truncation } = await this.motionService.getAllUncompletedTasks(
|
|
419
|
+
const { items: tasks, truncation } = await this.motionService.getAllUncompletedTasks({
|
|
420
|
+
limit: params.limit,
|
|
421
|
+
assigneeId: resolvedId,
|
|
422
|
+
dueDate: validatedDueDate,
|
|
423
|
+
priority: params.priority,
|
|
424
|
+
timeZone
|
|
425
|
+
});
|
|
345
426
|
return (0, utils_1.formatTaskList)(tasks, {
|
|
346
427
|
status: 'uncompleted',
|
|
347
428
|
assigneeName: display || resolvedId,
|
|
429
|
+
priority: params.priority,
|
|
430
|
+
dueDate: params.dueDate,
|
|
348
431
|
limit: params.limit,
|
|
349
432
|
allWorkspaces: true,
|
|
350
|
-
truncation
|
|
433
|
+
truncation,
|
|
434
|
+
timeZone
|
|
351
435
|
});
|
|
352
436
|
}
|
|
353
437
|
/**
|
|
@@ -398,22 +482,10 @@ class TaskHandler extends BaseHandler_1.BaseHandler {
|
|
|
398
482
|
/**
|
|
399
483
|
* Parse and validate task duration from user input.
|
|
400
484
|
* Accepts non-negative integer minutes or special values NONE/REMINDER.
|
|
485
|
+
* Delegates to the shared parseDurationValue helper.
|
|
401
486
|
*/
|
|
402
487
|
parseDurationValue(duration) {
|
|
403
|
-
|
|
404
|
-
if (!Number.isInteger(duration) || duration < 0) {
|
|
405
|
-
throw new Error('Duration must be a non-negative integer number of minutes, or "NONE"/"REMINDER".');
|
|
406
|
-
}
|
|
407
|
-
return duration;
|
|
408
|
-
}
|
|
409
|
-
const trimmed = duration.trim();
|
|
410
|
-
if (trimmed === 'NONE' || trimmed === 'REMINDER') {
|
|
411
|
-
return trimmed;
|
|
412
|
-
}
|
|
413
|
-
if (!/^\d+$/.test(trimmed)) {
|
|
414
|
-
throw new Error('Duration must be a non-negative integer number of minutes, or "NONE"/"REMINDER".');
|
|
415
|
-
}
|
|
416
|
-
return parseInt(trimmed, 10);
|
|
488
|
+
return (0, utils_1.parseDurationValue)(duration, ['NONE', 'REMINDER']);
|
|
417
489
|
}
|
|
418
490
|
/**
|
|
419
491
|
* Validate and normalize auto-scheduling configuration and provide helpful error messages
|