@doist/todoist-ai 2.0.0 → 2.0.1
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 +7 -0
- package/dist/index.d.ts +18 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -48
- package/dist/main.js +6 -11
- package/dist/mcp-helpers.d.ts +2 -2
- package/dist/mcp-helpers.d.ts.map +1 -1
- package/dist/mcp-helpers.js +1 -4
- package/dist/mcp-server.d.ts +1 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +34 -36
- package/dist/todoist-tool.js +1 -2
- package/dist/tool-helpers.d.ts +11 -1
- package/dist/tool-helpers.d.ts.map +1 -1
- package/dist/tool-helpers.js +41 -22
- package/dist/tool-helpers.test.js +35 -14
- package/dist/tools/__tests__/delete-one.test.d.ts +2 -0
- package/dist/tools/__tests__/delete-one.test.d.ts.map +1 -0
- package/dist/tools/__tests__/delete-one.test.js +90 -0
- package/dist/tools/__tests__/overview.test.d.ts +2 -0
- package/dist/tools/__tests__/overview.test.d.ts.map +1 -0
- package/dist/tools/__tests__/overview.test.js +163 -0
- package/dist/tools/__tests__/projects-list.test.d.ts +2 -0
- package/dist/tools/__tests__/projects-list.test.d.ts.map +1 -0
- package/dist/tools/__tests__/projects-list.test.js +140 -0
- package/dist/tools/__tests__/projects-manage.test.d.ts +2 -0
- package/dist/tools/__tests__/projects-manage.test.d.ts.map +1 -0
- package/dist/tools/__tests__/projects-manage.test.js +106 -0
- package/dist/tools/__tests__/sections-manage.test.d.ts +2 -0
- package/dist/tools/__tests__/sections-manage.test.d.ts.map +1 -0
- package/dist/tools/__tests__/sections-manage.test.js +138 -0
- package/dist/tools/__tests__/sections-search.test.d.ts +2 -0
- package/dist/tools/__tests__/sections-search.test.d.ts.map +1 -0
- package/dist/tools/__tests__/sections-search.test.js +235 -0
- package/dist/tools/__tests__/tasks-add-multiple.test.d.ts +2 -0
- package/dist/tools/__tests__/tasks-add-multiple.test.d.ts.map +1 -0
- package/dist/tools/__tests__/tasks-add-multiple.test.js +160 -0
- package/dist/tools/__tests__/tasks-complete-multiple.test.d.ts +2 -0
- package/dist/tools/__tests__/tasks-complete-multiple.test.d.ts.map +1 -0
- package/dist/tools/__tests__/tasks-complete-multiple.test.js +146 -0
- package/dist/tools/__tests__/tasks-list-by-date.test.d.ts +2 -0
- package/dist/tools/__tests__/tasks-list-by-date.test.d.ts.map +1 -0
- package/dist/tools/__tests__/tasks-list-by-date.test.js +192 -0
- package/dist/tools/__tests__/tasks-list-completed.test.d.ts +2 -0
- package/dist/tools/__tests__/tasks-list-completed.test.d.ts.map +1 -0
- package/dist/tools/__tests__/tasks-list-completed.test.js +154 -0
- package/dist/tools/__tests__/tasks-list-for-container.test.d.ts +2 -0
- package/dist/tools/__tests__/tasks-list-for-container.test.d.ts.map +1 -0
- package/dist/tools/__tests__/tasks-list-for-container.test.js +232 -0
- package/dist/tools/__tests__/tasks-organize-multiple.test.d.ts +2 -0
- package/dist/tools/__tests__/tasks-organize-multiple.test.d.ts.map +1 -0
- package/dist/tools/__tests__/tasks-organize-multiple.test.js +245 -0
- package/dist/tools/__tests__/tasks-search.test.d.ts +2 -0
- package/dist/tools/__tests__/tasks-search.test.d.ts.map +1 -0
- package/dist/tools/__tests__/tasks-search.test.js +106 -0
- package/dist/tools/__tests__/tasks-update-one.test.d.ts +2 -0
- package/dist/tools/__tests__/tasks-update-one.test.d.ts.map +1 -0
- package/dist/tools/__tests__/tasks-update-one.test.js +161 -0
- package/dist/tools/delete-one.js +4 -7
- package/dist/tools/overview.js +8 -11
- package/dist/tools/projects-list.js +7 -10
- package/dist/tools/projects-manage.js +6 -9
- package/dist/tools/sections-manage.js +7 -10
- package/dist/tools/sections-search.js +4 -7
- package/dist/tools/tasks-add-multiple.js +13 -16
- package/dist/tools/tasks-complete-multiple.js +3 -6
- package/dist/tools/tasks-list-by-date.js +12 -15
- package/dist/tools/tasks-list-completed.d.ts +1 -1
- package/dist/tools/tasks-list-completed.js +13 -16
- package/dist/tools/tasks-list-for-container.js +8 -11
- package/dist/tools/tasks-organize-multiple.d.ts.map +1 -1
- package/dist/tools/tasks-organize-multiple.js +20 -14
- package/dist/tools/tasks-search.js +7 -10
- package/dist/tools/tasks-update-one.d.ts +2 -2
- package/dist/tools/tasks-update-one.d.ts.map +1 -1
- package/dist/tools/tasks-update-one.js +22 -15
- package/dist/tools/test-helpers.d.ts +79 -0
- package/dist/tools/test-helpers.d.ts.map +1 -0
- package/dist/tools/test-helpers.js +139 -0
- package/package.json +6 -2
- package/scripts/test-executable.cjs +69 -0
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.sectionsManage = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const mcp_helpers_1 = require("../mcp-helpers");
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { errorContent } from '../mcp-helpers.js';
|
|
6
3
|
const ArgsSchema = {
|
|
7
|
-
id:
|
|
4
|
+
id: z
|
|
8
5
|
.string()
|
|
9
6
|
.min(1)
|
|
10
7
|
.optional()
|
|
11
8
|
.describe('The ID of the section to update. If provided, updates the section. If omitted, creates a new section.'),
|
|
12
|
-
name:
|
|
13
|
-
projectId:
|
|
9
|
+
name: z.string().min(1).describe('The name of the section.'),
|
|
10
|
+
projectId: z
|
|
14
11
|
.string()
|
|
15
12
|
.min(1)
|
|
16
13
|
.optional()
|
|
@@ -28,7 +25,7 @@ const sectionsManage = {
|
|
|
28
25
|
}
|
|
29
26
|
// Create new section - projectId is required
|
|
30
27
|
if (!args.projectId) {
|
|
31
|
-
return
|
|
28
|
+
return errorContent('Error: projectId is required when creating a new section (when id is not provided).');
|
|
32
29
|
}
|
|
33
30
|
const section = await client.addSection({
|
|
34
31
|
name: args.name,
|
|
@@ -37,4 +34,4 @@ const sectionsManage = {
|
|
|
37
34
|
return section;
|
|
38
35
|
},
|
|
39
36
|
};
|
|
40
|
-
|
|
37
|
+
export { sectionsManage };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sectionsSearch = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
1
|
+
import { z } from 'zod';
|
|
5
2
|
const ArgsSchema = {
|
|
6
|
-
projectId:
|
|
7
|
-
search:
|
|
3
|
+
projectId: z.string().min(1).describe('The ID of the project to search sections in.'),
|
|
4
|
+
search: z
|
|
8
5
|
.string()
|
|
9
6
|
.optional()
|
|
10
7
|
.describe('Search for a section by name (partial and case insensitive match). If omitted, all sections in the project are returned.'),
|
|
@@ -27,4 +24,4 @@ const sectionsSearch = {
|
|
|
27
24
|
}));
|
|
28
25
|
},
|
|
29
26
|
};
|
|
30
|
-
|
|
27
|
+
export { sectionsSearch };
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
description: zod_1.z.string().optional().describe('The description of the task.'),
|
|
9
|
-
priority: zod_1.z.number().int().min(1).max(4).optional().describe('The priority of the task (1-4).'),
|
|
10
|
-
dueString: zod_1.z.string().optional().describe('The due date for the task, in natural language.'),
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { mapTask } from '../tool-helpers.js';
|
|
3
|
+
const TaskSchema = z.object({
|
|
4
|
+
content: z.string().min(1).describe('The content of the task to create.'),
|
|
5
|
+
description: z.string().optional().describe('The description of the task.'),
|
|
6
|
+
priority: z.number().int().min(1).max(4).optional().describe('The priority of the task (1-4).'),
|
|
7
|
+
dueString: z.string().optional().describe('The due date for the task, in natural language.'),
|
|
11
8
|
});
|
|
12
9
|
const ArgsSchema = {
|
|
13
|
-
projectId:
|
|
14
|
-
sectionId:
|
|
15
|
-
parentId:
|
|
16
|
-
tasks:
|
|
10
|
+
projectId: z.string().optional().describe('The project ID to add the tasks to.'),
|
|
11
|
+
sectionId: z.string().optional().describe('The section ID to add the tasks to.'),
|
|
12
|
+
parentId: z.string().optional().describe('The parent task ID (for subtasks).'),
|
|
13
|
+
tasks: z.array(TaskSchema).min(1).describe('The array of tasks to add.'),
|
|
17
14
|
};
|
|
18
15
|
const tasksAddMultiple = {
|
|
19
16
|
name: 'tasks-add-multiple',
|
|
@@ -26,7 +23,7 @@ const tasksAddMultiple = {
|
|
|
26
23
|
const taskArgs = { ...task, projectId, sectionId, parentId };
|
|
27
24
|
newTasks.push(await client.addTask(taskArgs));
|
|
28
25
|
}
|
|
29
|
-
return newTasks.map(
|
|
26
|
+
return newTasks.map(mapTask);
|
|
30
27
|
},
|
|
31
28
|
};
|
|
32
|
-
|
|
29
|
+
export { tasksAddMultiple };
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tasksCompleteMultiple = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
1
|
+
import { z } from 'zod';
|
|
5
2
|
const ArgsSchema = {
|
|
6
|
-
ids:
|
|
3
|
+
ids: z.array(z.string().min(1)).min(1).describe('The IDs of the tasks to complete.'),
|
|
7
4
|
};
|
|
8
5
|
const tasksCompleteMultiple = {
|
|
9
6
|
name: 'tasks-complete-multiple',
|
|
@@ -23,4 +20,4 @@ const tasksCompleteMultiple = {
|
|
|
23
20
|
return { success: true, completed };
|
|
24
21
|
},
|
|
25
22
|
};
|
|
26
|
-
|
|
23
|
+
export { tasksCompleteMultiple };
|
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const date_fns_1 = require("date-fns");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
const tool_helpers_1 = require("../tool-helpers");
|
|
1
|
+
import { addDays, formatISO } from 'date-fns';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { getTasksByFilter } from '../tool-helpers.js';
|
|
7
4
|
const ArgsSchema = {
|
|
8
|
-
startDate:
|
|
5
|
+
startDate: z
|
|
9
6
|
.string()
|
|
10
7
|
.regex(/^(\d{4}-\d{2}-\d{2}|today|overdue)$/)
|
|
11
8
|
.describe("The start date to get the tasks for. Format: YYYY-MM-DD, 'today', or 'overdue'."),
|
|
12
|
-
daysCount:
|
|
9
|
+
daysCount: z
|
|
13
10
|
.number()
|
|
14
11
|
.int()
|
|
15
12
|
.min(1)
|
|
16
13
|
.max(30)
|
|
17
14
|
.default(1)
|
|
18
15
|
.describe("The number of days to get the tasks for, starting from the start date. Ignored when startDate is 'overdue'."),
|
|
19
|
-
limit:
|
|
16
|
+
limit: z
|
|
20
17
|
.number()
|
|
21
18
|
.int()
|
|
22
19
|
.min(1)
|
|
23
20
|
.max(50)
|
|
24
21
|
.default(10)
|
|
25
22
|
.describe('The maximum number of tasks to return.'),
|
|
26
|
-
cursor:
|
|
23
|
+
cursor: z
|
|
27
24
|
.string()
|
|
28
25
|
.optional()
|
|
29
26
|
.describe('The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters).'),
|
|
@@ -39,13 +36,13 @@ const tasksListByDate = {
|
|
|
39
36
|
}
|
|
40
37
|
else {
|
|
41
38
|
const startDate = args.startDate === 'today'
|
|
42
|
-
?
|
|
39
|
+
? formatISO(new Date(), { representation: 'date' })
|
|
43
40
|
: args.startDate;
|
|
44
|
-
const endDate =
|
|
45
|
-
const endDateStr =
|
|
41
|
+
const endDate = addDays(startDate, args.daysCount + 1);
|
|
42
|
+
const endDateStr = formatISO(endDate, { representation: 'date' });
|
|
46
43
|
query = `(due after: ${startDate} | due: ${startDate}) & due before: ${endDateStr}`;
|
|
47
44
|
}
|
|
48
|
-
return await
|
|
45
|
+
return await getTasksByFilter({
|
|
49
46
|
client,
|
|
50
47
|
query,
|
|
51
48
|
cursor: args.cursor,
|
|
@@ -53,4 +50,4 @@ const tasksListByDate = {
|
|
|
53
50
|
});
|
|
54
51
|
},
|
|
55
52
|
};
|
|
56
|
-
|
|
53
|
+
export { tasksListByDate };
|
|
@@ -20,9 +20,9 @@ declare const tasksListCompleted: {
|
|
|
20
20
|
until: string;
|
|
21
21
|
parentId?: string | undefined;
|
|
22
22
|
workspaceId?: string | undefined;
|
|
23
|
-
cursor?: string | undefined;
|
|
24
23
|
projectId?: string | undefined;
|
|
25
24
|
sectionId?: string | undefined;
|
|
25
|
+
cursor?: string | undefined;
|
|
26
26
|
}, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
|
|
27
27
|
tasks: {
|
|
28
28
|
id: string;
|
|
@@ -1,35 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.tasksListCompleted = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const tool_helpers_1 = require("../tool-helpers");
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { mapTask } from '../tool-helpers.js';
|
|
6
3
|
const ArgsSchema = {
|
|
7
|
-
getBy:
|
|
4
|
+
getBy: z
|
|
8
5
|
.enum(['completion', 'due'])
|
|
9
6
|
.default('completion')
|
|
10
7
|
.describe('The method to use to get the tasks: "completion" to get tasks by completion date (ie, when the task was actually completed), "due" to get tasks by due date (ie, when the task was due to be completed by).'),
|
|
11
|
-
since:
|
|
8
|
+
since: z
|
|
12
9
|
.string()
|
|
13
10
|
.date()
|
|
14
11
|
.regex(/^\d{4}-\d{2}-\d{2}$/)
|
|
15
12
|
.describe('The start date to get the tasks for. Format: YYYY-MM-DD.'),
|
|
16
|
-
until:
|
|
13
|
+
until: z
|
|
17
14
|
.string()
|
|
18
15
|
.date()
|
|
19
16
|
.regex(/^\d{4}-\d{2}-\d{2}$/)
|
|
20
17
|
.describe('The start date to get the tasks for. Format: YYYY-MM-DD.'),
|
|
21
|
-
workspaceId:
|
|
22
|
-
projectId:
|
|
23
|
-
sectionId:
|
|
24
|
-
parentId:
|
|
25
|
-
limit:
|
|
18
|
+
workspaceId: z.string().optional().describe('The ID of the workspace to get the tasks for.'),
|
|
19
|
+
projectId: z.string().optional().describe('The ID of the project to get the tasks for.'),
|
|
20
|
+
sectionId: z.string().optional().describe('The ID of the section to get the tasks for.'),
|
|
21
|
+
parentId: z.string().optional().describe('The ID of the parent task to get the tasks for.'),
|
|
22
|
+
limit: z
|
|
26
23
|
.number()
|
|
27
24
|
.int()
|
|
28
25
|
.min(1)
|
|
29
26
|
.max(200)
|
|
30
27
|
.default(50)
|
|
31
28
|
.describe('The maximum number of tasks to return. Default is 50, maximum is 200.'),
|
|
32
|
-
cursor:
|
|
29
|
+
cursor: z
|
|
33
30
|
.string()
|
|
34
31
|
.optional()
|
|
35
32
|
.describe('The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters).'),
|
|
@@ -44,9 +41,9 @@ const tasksListCompleted = {
|
|
|
44
41
|
? await client.getCompletedTasksByCompletionDate(rest)
|
|
45
42
|
: await client.getCompletedTasksByDueDate(rest);
|
|
46
43
|
return {
|
|
47
|
-
tasks: items.map(
|
|
44
|
+
tasks: items.map(mapTask),
|
|
48
45
|
nextCursor,
|
|
49
46
|
};
|
|
50
47
|
},
|
|
51
48
|
};
|
|
52
|
-
|
|
49
|
+
export { tasksListCompleted };
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.tasksListForContainer = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const tool_helpers_1 = require("../tool-helpers");
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { mapTask } from '../tool-helpers.js';
|
|
6
3
|
const ArgsSchema = {
|
|
7
|
-
type:
|
|
4
|
+
type: z
|
|
8
5
|
.enum(['project', 'section', 'parent'])
|
|
9
6
|
.describe('The type of container to get tasks for.'),
|
|
10
|
-
id:
|
|
11
|
-
limit:
|
|
7
|
+
id: z.string().min(1).describe('The ID of the container to get tasks for.'),
|
|
8
|
+
limit: z
|
|
12
9
|
.number()
|
|
13
10
|
.int()
|
|
14
11
|
.min(1)
|
|
15
12
|
.max(50)
|
|
16
13
|
.default(10)
|
|
17
14
|
.describe('The maximum number of tasks to return.'),
|
|
18
|
-
cursor:
|
|
15
|
+
cursor: z
|
|
19
16
|
.string()
|
|
20
17
|
.optional()
|
|
21
18
|
.describe('The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters).'),
|
|
@@ -43,9 +40,9 @@ const tasksListForContainer = {
|
|
|
43
40
|
}
|
|
44
41
|
const { results, nextCursor } = await client.getTasks(taskParams);
|
|
45
42
|
return {
|
|
46
|
-
tasks: results.map(
|
|
43
|
+
tasks: results.map(mapTask),
|
|
47
44
|
nextCursor,
|
|
48
45
|
};
|
|
49
46
|
},
|
|
50
47
|
};
|
|
51
|
-
|
|
48
|
+
export { tasksListForContainer };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasks-organize-multiple.d.ts","sourceRoot":"","sources":["../../src/tools/tasks-organize-multiple.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"tasks-organize-multiple.d.ts","sourceRoot":"","sources":["../../src/tools/tasks-organize-multiple.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAgBvB,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwBe,CAAA;AAE1C,OAAO,EAAE,qBAAqB,EAAE,CAAA"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
parentId: zod_1.z.string().optional().describe('The new parent task ID (for subtasks).'),
|
|
10
|
-
order: zod_1.z.number().optional().describe('The new order of the task within its parent/section.'),
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createMoveTaskArgs } from '../tool-helpers.js';
|
|
3
|
+
const TaskUpdateSchema = z.object({
|
|
4
|
+
id: z.string().min(1).describe('The ID of the task to update.'),
|
|
5
|
+
projectId: z.string().optional().describe('The new project ID for the task.'),
|
|
6
|
+
sectionId: z.string().optional().describe('The new section ID for the task.'),
|
|
7
|
+
parentId: z.string().optional().describe('The new parent task ID (for subtasks).'),
|
|
8
|
+
order: z.number().optional().describe('The new order of the task within its parent/section.'),
|
|
11
9
|
});
|
|
12
10
|
const ArgsSchema = {
|
|
13
|
-
tasks:
|
|
11
|
+
tasks: z.array(TaskUpdateSchema).min(1).describe('Array of task updates to apply.'),
|
|
14
12
|
};
|
|
15
13
|
const tasksOrganizeMultiple = {
|
|
16
14
|
name: 'tasks-organize-multiple',
|
|
@@ -18,11 +16,19 @@ const tasksOrganizeMultiple = {
|
|
|
18
16
|
parameters: ArgsSchema,
|
|
19
17
|
async execute(args, client) {
|
|
20
18
|
const results = [];
|
|
19
|
+
// Process each task individually for move operations
|
|
21
20
|
for (const update of args.tasks) {
|
|
22
|
-
const { id,
|
|
23
|
-
|
|
21
|
+
const { id, projectId, sectionId, parentId } = update;
|
|
22
|
+
if (!projectId && !sectionId && !parentId) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
// Create and validate move arguments using helper
|
|
26
|
+
const moveArgs = createMoveTaskArgs(id, projectId, sectionId, parentId);
|
|
27
|
+
// Move each task individually to avoid bulk operation issues
|
|
28
|
+
const movedTasks = await client.moveTasks([id], moveArgs);
|
|
29
|
+
results.push(...movedTasks);
|
|
24
30
|
}
|
|
25
31
|
return results;
|
|
26
32
|
},
|
|
27
33
|
};
|
|
28
|
-
|
|
34
|
+
export { tasksOrganizeMultiple };
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.tasksSearch = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const tool_helpers_1 = require("../tool-helpers");
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getTasksByFilter } from '../tool-helpers.js';
|
|
6
3
|
const ArgsSchema = {
|
|
7
|
-
searchText:
|
|
8
|
-
limit:
|
|
4
|
+
searchText: z.string().min(1).describe('The text to search for in tasks.'),
|
|
5
|
+
limit: z
|
|
9
6
|
.number()
|
|
10
7
|
.int()
|
|
11
8
|
.min(1)
|
|
12
9
|
.max(50)
|
|
13
10
|
.default(10)
|
|
14
11
|
.describe('The maximum number of tasks to return.'),
|
|
15
|
-
cursor:
|
|
12
|
+
cursor: z
|
|
16
13
|
.string()
|
|
17
14
|
.optional()
|
|
18
15
|
.describe('The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters).'),
|
|
@@ -22,7 +19,7 @@ const tasksSearch = {
|
|
|
22
19
|
description: "Search tasks by text using Todoist's filter query.",
|
|
23
20
|
parameters: ArgsSchema,
|
|
24
21
|
async execute(args, client) {
|
|
25
|
-
return await
|
|
22
|
+
return await getTasksByFilter({
|
|
26
23
|
client,
|
|
27
24
|
query: `search: ${args.searchText}`,
|
|
28
25
|
cursor: args.cursor,
|
|
@@ -30,4 +27,4 @@ const tasksSearch = {
|
|
|
30
27
|
});
|
|
31
28
|
},
|
|
32
29
|
};
|
|
33
|
-
|
|
30
|
+
export { tasksSearch };
|
|
@@ -18,10 +18,10 @@ declare const tasksUpdateOne: {
|
|
|
18
18
|
description?: string | undefined;
|
|
19
19
|
parentId?: string | undefined;
|
|
20
20
|
projectId?: string | undefined;
|
|
21
|
+
sectionId?: string | undefined;
|
|
21
22
|
priority?: number | undefined;
|
|
22
23
|
dueString?: string | undefined;
|
|
23
|
-
|
|
24
|
-
}, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<import("@doist/todoist-api-typescript").Task>;
|
|
24
|
+
}, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<import("@doist/todoist-api-typescript").Task | undefined>;
|
|
25
25
|
};
|
|
26
26
|
export { tasksUpdateOne };
|
|
27
27
|
//# sourceMappingURL=tasks-update-one.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasks-update-one.d.ts","sourceRoot":"","sources":["../../src/tools/tasks-update-one.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"tasks-update-one.d.ts","sourceRoot":"","sources":["../../src/tools/tasks-update-one.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAwBvB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;CAqBsB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.tasksUpdateOne = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createMoveTaskArgs } from '../tool-helpers.js';
|
|
5
3
|
const ArgsSchema = {
|
|
6
|
-
id:
|
|
7
|
-
content:
|
|
8
|
-
description:
|
|
9
|
-
projectId:
|
|
10
|
-
sectionId:
|
|
11
|
-
parentId:
|
|
12
|
-
priority:
|
|
4
|
+
id: z.string().min(1).describe('The ID of the task to update.'),
|
|
5
|
+
content: z.string().optional().describe('The new content of the task.'),
|
|
6
|
+
description: z.string().optional().describe('The new description of the task.'),
|
|
7
|
+
projectId: z.string().optional().describe('The new project ID for the task.'),
|
|
8
|
+
sectionId: z.string().optional().describe('The new section ID for the task.'),
|
|
9
|
+
parentId: z.string().optional().describe('The new parent task ID (for subtasks).'),
|
|
10
|
+
priority: z
|
|
13
11
|
.number()
|
|
14
12
|
.int()
|
|
15
13
|
.min(1)
|
|
16
14
|
.max(4)
|
|
17
15
|
.optional()
|
|
18
16
|
.describe('The new priority of the task (1-4).'),
|
|
19
|
-
dueString:
|
|
17
|
+
dueString: z
|
|
20
18
|
.string()
|
|
21
19
|
.optional()
|
|
22
20
|
.describe("The new due date for the task, in natural language (e.g., 'tomorrow at 5pm')."),
|
|
@@ -26,8 +24,17 @@ const tasksUpdateOne = {
|
|
|
26
24
|
description: 'Update an existing task with new values.',
|
|
27
25
|
parameters: ArgsSchema,
|
|
28
26
|
async execute(args, client) {
|
|
29
|
-
const { id, ...updateArgs } = args;
|
|
30
|
-
|
|
27
|
+
const { id, projectId, sectionId, parentId, ...updateArgs } = args;
|
|
28
|
+
// If no move parameters are provided, use updateTask without moveTasks
|
|
29
|
+
if (!projectId && !sectionId && !parentId) {
|
|
30
|
+
return await client.updateTask(id, updateArgs);
|
|
31
|
+
}
|
|
32
|
+
const moveArgs = createMoveTaskArgs(id, projectId, sectionId, parentId);
|
|
33
|
+
const movedTasks = await client.moveTasks([id], moveArgs);
|
|
34
|
+
if (Object.keys(updateArgs).length > 0) {
|
|
35
|
+
return await client.updateTask(id, updateArgs);
|
|
36
|
+
}
|
|
37
|
+
return movedTasks[0];
|
|
31
38
|
},
|
|
32
39
|
};
|
|
33
|
-
|
|
40
|
+
export { tasksUpdateOne };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { PersonalProject, Section, Task } from '@doist/todoist-api-typescript';
|
|
2
|
+
/**
|
|
3
|
+
* Mapped task type matching the output of mapTask function.
|
|
4
|
+
* Used for filter-based query test mocks.
|
|
5
|
+
*/
|
|
6
|
+
export type MappedTask = {
|
|
7
|
+
id: string;
|
|
8
|
+
content: string;
|
|
9
|
+
description: string;
|
|
10
|
+
dueDate: string | undefined;
|
|
11
|
+
recurring: string | boolean;
|
|
12
|
+
priority: number;
|
|
13
|
+
projectId: string;
|
|
14
|
+
sectionId: string | null;
|
|
15
|
+
parentId: string | null;
|
|
16
|
+
labels: string[];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Creates a mock Task with all required properties and sensible defaults.
|
|
20
|
+
* Pass only the properties you want to override for your specific test.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createMockTask(overrides?: Partial<Task>): Task;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a mock Section with all required properties and sensible defaults.
|
|
25
|
+
* Pass only the properties you want to override for your specific test.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createMockSection(overrides?: Partial<Section>): Section;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a mock PersonalProject with all required properties and sensible defaults.
|
|
30
|
+
* Pass only the properties you want to override for your specific test.
|
|
31
|
+
*/
|
|
32
|
+
export declare function createMockProject(overrides?: Partial<PersonalProject>): PersonalProject;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a mock API response object with results and nextCursor.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createMockApiResponse<T>(results: T[], nextCursor?: string | null): {
|
|
37
|
+
results: T[];
|
|
38
|
+
nextCursor: string | null;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Creates a simplified mapped task (matches mapTask output) for filter-based query tests.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createMappedTask(overrides?: Partial<MappedTask>): MappedTask;
|
|
44
|
+
/**
|
|
45
|
+
* Common error messages used across tests.
|
|
46
|
+
*/
|
|
47
|
+
export declare const TEST_ERRORS: {
|
|
48
|
+
readonly API_RATE_LIMIT: "API Error: Rate limit exceeded";
|
|
49
|
+
readonly API_UNAUTHORIZED: "API Error: Unauthorized";
|
|
50
|
+
readonly INVALID_CURSOR: "Invalid cursor format";
|
|
51
|
+
readonly INVALID_FILTER: "Invalid filter query";
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Creates multiple test cases for parameterized testing.
|
|
55
|
+
*/
|
|
56
|
+
export declare function createTestCases<T, E = unknown>(cases: Array<{
|
|
57
|
+
name: string;
|
|
58
|
+
input: T;
|
|
59
|
+
expected?: E;
|
|
60
|
+
}>): {
|
|
61
|
+
name: string;
|
|
62
|
+
input: T;
|
|
63
|
+
expected?: E;
|
|
64
|
+
}[];
|
|
65
|
+
/**
|
|
66
|
+
* Common mock IDs used across tests for consistency.
|
|
67
|
+
*/
|
|
68
|
+
export declare const TEST_IDS: {
|
|
69
|
+
readonly TASK_1: "8485093748";
|
|
70
|
+
readonly TASK_2: "8485093749";
|
|
71
|
+
readonly TASK_3: "8485093750";
|
|
72
|
+
readonly PROJECT_INBOX: "inbox-project-id";
|
|
73
|
+
readonly PROJECT_WORK: "work-project-id";
|
|
74
|
+
readonly PROJECT_TEST: "6cfCcrrCFg2xP94Q";
|
|
75
|
+
readonly SECTION_1: "section-123";
|
|
76
|
+
readonly SECTION_2: "section-456";
|
|
77
|
+
readonly USER_ID: "713437";
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=test-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["../../src/tools/test-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAA;AAEnF;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,SAAS,EAAE,MAAM,GAAG,OAAO,CAAA;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,MAAM,EAAE,MAAM,EAAE,CAAA;CACnB,CAAA;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,GAAE,OAAO,CAAC,IAAI,CAAM,GAAG,IAAI,CA8BlE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,GAAE,OAAO,CAAC,OAAO,CAAM,GAAG,OAAO,CAe3E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,GAAE,OAAO,CAAC,eAAe,CAAM,GAAG,eAAe,CAuB3F;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACnC,OAAO,EAAE,CAAC,EAAE,EACZ,UAAU,GAAE,MAAM,GAAG,IAAW,GACjC;IACC,OAAO,EAAE,CAAC,EAAE,CAAA;IACZ,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B,CAKA;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,GAAE,OAAO,CAAC,UAAU,CAAM,GAAG,UAAU,CAchF;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;CAKd,CAAA;AAEV;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,EAC1C,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC;UAAjC,MAAM;WAAS,CAAC;eAAa,CAAC;IAGtD;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;CAUX,CAAA"}
|