@doist/todoist-ai 1.1.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.
Files changed (137) hide show
  1. package/README.md +8 -22
  2. package/dist/index.d.ts +64 -209
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +31 -74
  5. package/dist/main.js +6 -11
  6. package/dist/mcp-helpers.d.ts +10 -3
  7. package/dist/mcp-helpers.d.ts.map +1 -1
  8. package/dist/mcp-helpers.js +1 -3
  9. package/dist/mcp-server.d.ts +1 -1
  10. package/dist/mcp-server.d.ts.map +1 -1
  11. package/dist/mcp-server.js +34 -54
  12. package/dist/todoist-tool.js +1 -2
  13. package/dist/{tools/shared.d.ts → tool-helpers.d.ts} +12 -2
  14. package/dist/tool-helpers.d.ts.map +1 -0
  15. package/dist/{tools/shared.js → tool-helpers.js} +41 -22
  16. package/dist/tool-helpers.test.d.ts +2 -0
  17. package/dist/tool-helpers.test.d.ts.map +1 -0
  18. package/dist/{tools/shared.test.js → tool-helpers.test.js} +35 -14
  19. package/dist/tools/__tests__/delete-one.test.d.ts +2 -0
  20. package/dist/tools/__tests__/delete-one.test.d.ts.map +1 -0
  21. package/dist/tools/__tests__/delete-one.test.js +90 -0
  22. package/dist/tools/__tests__/overview.test.d.ts +2 -0
  23. package/dist/tools/__tests__/overview.test.d.ts.map +1 -0
  24. package/dist/tools/__tests__/overview.test.js +163 -0
  25. package/dist/tools/__tests__/projects-list.test.d.ts +2 -0
  26. package/dist/tools/__tests__/projects-list.test.d.ts.map +1 -0
  27. package/dist/tools/__tests__/projects-list.test.js +140 -0
  28. package/dist/tools/__tests__/projects-manage.test.d.ts +2 -0
  29. package/dist/tools/__tests__/projects-manage.test.d.ts.map +1 -0
  30. package/dist/tools/__tests__/projects-manage.test.js +106 -0
  31. package/dist/tools/__tests__/sections-manage.test.d.ts +2 -0
  32. package/dist/tools/__tests__/sections-manage.test.d.ts.map +1 -0
  33. package/dist/tools/__tests__/sections-manage.test.js +138 -0
  34. package/dist/tools/__tests__/sections-search.test.d.ts +2 -0
  35. package/dist/tools/__tests__/sections-search.test.d.ts.map +1 -0
  36. package/dist/tools/__tests__/sections-search.test.js +235 -0
  37. package/dist/tools/__tests__/tasks-add-multiple.test.d.ts +2 -0
  38. package/dist/tools/__tests__/tasks-add-multiple.test.d.ts.map +1 -0
  39. package/dist/tools/__tests__/tasks-add-multiple.test.js +160 -0
  40. package/dist/tools/__tests__/tasks-complete-multiple.test.d.ts +2 -0
  41. package/dist/tools/__tests__/tasks-complete-multiple.test.d.ts.map +1 -0
  42. package/dist/tools/__tests__/tasks-complete-multiple.test.js +146 -0
  43. package/dist/tools/__tests__/tasks-list-by-date.test.d.ts +2 -0
  44. package/dist/tools/__tests__/tasks-list-by-date.test.d.ts.map +1 -0
  45. package/dist/tools/__tests__/tasks-list-by-date.test.js +192 -0
  46. package/dist/tools/__tests__/tasks-list-completed.test.d.ts +2 -0
  47. package/dist/tools/__tests__/tasks-list-completed.test.d.ts.map +1 -0
  48. package/dist/tools/__tests__/tasks-list-completed.test.js +154 -0
  49. package/dist/tools/__tests__/tasks-list-for-container.test.d.ts +2 -0
  50. package/dist/tools/__tests__/tasks-list-for-container.test.d.ts.map +1 -0
  51. package/dist/tools/__tests__/tasks-list-for-container.test.js +232 -0
  52. package/dist/tools/__tests__/tasks-organize-multiple.test.d.ts +2 -0
  53. package/dist/tools/__tests__/tasks-organize-multiple.test.d.ts.map +1 -0
  54. package/dist/tools/__tests__/tasks-organize-multiple.test.js +245 -0
  55. package/dist/tools/__tests__/tasks-search.test.d.ts +2 -0
  56. package/dist/tools/__tests__/tasks-search.test.d.ts.map +1 -0
  57. package/dist/tools/__tests__/tasks-search.test.js +106 -0
  58. package/dist/tools/__tests__/tasks-update-one.test.d.ts +2 -0
  59. package/dist/tools/__tests__/tasks-update-one.test.d.ts.map +1 -0
  60. package/dist/tools/__tests__/tasks-update-one.test.js +161 -0
  61. package/dist/tools/{tasks-delete-one.d.ts → delete-one.d.ts} +5 -3
  62. package/dist/tools/delete-one.d.ts.map +1 -0
  63. package/dist/tools/delete-one.js +25 -0
  64. package/dist/tools/{project-overview.d.ts → overview.d.ts} +5 -5
  65. package/dist/tools/overview.d.ts.map +1 -0
  66. package/dist/tools/overview.js +202 -0
  67. package/dist/tools/projects-list.d.ts +12 -1
  68. package/dist/tools/projects-list.d.ts.map +1 -1
  69. package/dist/tools/projects-list.js +15 -9
  70. package/dist/tools/{projects-add-one.d.ts → projects-manage.d.ts} +6 -4
  71. package/dist/tools/projects-manage.d.ts.map +1 -0
  72. package/dist/tools/projects-manage.js +26 -0
  73. package/dist/tools/sections-manage.d.ts +23 -0
  74. package/dist/tools/sections-manage.d.ts.map +1 -0
  75. package/dist/tools/sections-manage.js +37 -0
  76. package/dist/tools/sections-search.js +4 -7
  77. package/dist/tools/tasks-add-multiple.js +13 -16
  78. package/dist/tools/tasks-complete-multiple.js +3 -6
  79. package/dist/tools/tasks-list-by-date.d.ts.map +1 -1
  80. package/dist/tools/tasks-list-by-date.js +25 -22
  81. package/dist/tools/tasks-list-completed.d.ts +1 -1
  82. package/dist/tools/tasks-list-completed.js +13 -16
  83. package/dist/tools/{tasks-list-for-project.d.ts → tasks-list-for-container.d.ts} +7 -5
  84. package/dist/tools/tasks-list-for-container.d.ts.map +1 -0
  85. package/dist/tools/tasks-list-for-container.js +48 -0
  86. package/dist/tools/tasks-organize-multiple.d.ts.map +1 -1
  87. package/dist/tools/tasks-organize-multiple.js +20 -14
  88. package/dist/tools/tasks-search.js +7 -10
  89. package/dist/tools/tasks-update-one.d.ts +2 -2
  90. package/dist/tools/tasks-update-one.d.ts.map +1 -1
  91. package/dist/tools/tasks-update-one.js +22 -15
  92. package/dist/tools/test-helpers.d.ts +79 -0
  93. package/dist/tools/test-helpers.d.ts.map +1 -0
  94. package/dist/tools/test-helpers.js +139 -0
  95. package/package.json +20 -5
  96. package/scripts/test-executable.cjs +69 -0
  97. package/dist/tools/account-overview.d.ts +0 -9
  98. package/dist/tools/account-overview.d.ts.map +0 -1
  99. package/dist/tools/account-overview.js +0 -98
  100. package/dist/tools/project-overview.d.ts.map +0 -1
  101. package/dist/tools/project-overview.js +0 -107
  102. package/dist/tools/projects-add-one.d.ts.map +0 -1
  103. package/dist/tools/projects-add-one.js +0 -18
  104. package/dist/tools/projects-delete-one.d.ts +0 -15
  105. package/dist/tools/projects-delete-one.d.ts.map +0 -1
  106. package/dist/tools/projects-delete-one.js +0 -17
  107. package/dist/tools/projects-search.d.ts +0 -29
  108. package/dist/tools/projects-search.d.ts.map +0 -1
  109. package/dist/tools/projects-search.js +0 -42
  110. package/dist/tools/projects-update-one.d.ts +0 -15
  111. package/dist/tools/projects-update-one.d.ts.map +0 -1
  112. package/dist/tools/projects-update-one.js +0 -19
  113. package/dist/tools/sections-add-one.d.ts +0 -15
  114. package/dist/tools/sections-add-one.d.ts.map +0 -1
  115. package/dist/tools/sections-add-one.js +0 -21
  116. package/dist/tools/sections-delete-one.d.ts +0 -15
  117. package/dist/tools/sections-delete-one.d.ts.map +0 -1
  118. package/dist/tools/sections-delete-one.js +0 -17
  119. package/dist/tools/sections-update-one.d.ts +0 -15
  120. package/dist/tools/sections-update-one.d.ts.map +0 -1
  121. package/dist/tools/sections-update-one.js +0 -19
  122. package/dist/tools/shared.d.ts.map +0 -1
  123. package/dist/tools/shared.test.d.ts +0 -2
  124. package/dist/tools/shared.test.d.ts.map +0 -1
  125. package/dist/tools/subtasks-list-for-parent-task.d.ts +0 -31
  126. package/dist/tools/subtasks-list-for-parent-task.d.ts.map +0 -1
  127. package/dist/tools/subtasks-list-for-parent-task.js +0 -37
  128. package/dist/tools/tasks-delete-one.d.ts.map +0 -1
  129. package/dist/tools/tasks-delete-one.js +0 -17
  130. package/dist/tools/tasks-list-for-project.d.ts.map +0 -1
  131. package/dist/tools/tasks-list-for-project.js +0 -37
  132. package/dist/tools/tasks-list-for-section.d.ts +0 -31
  133. package/dist/tools/tasks-list-for-section.d.ts.map +0 -1
  134. package/dist/tools/tasks-list-for-section.js +0 -37
  135. package/dist/tools/tasks-list-overdue.d.ts +0 -29
  136. package/dist/tools/tasks-list-overdue.d.ts.map +0 -1
  137. package/dist/tools/tasks-list-overdue.js +0 -32
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Creates a mock Task with all required properties and sensible defaults.
3
+ * Pass only the properties you want to override for your specific test.
4
+ */
5
+ export function createMockTask(overrides = {}) {
6
+ return {
7
+ id: '8485093748',
8
+ content: 'Test task content',
9
+ description: '',
10
+ completedAt: null,
11
+ labels: [],
12
+ childOrder: 1,
13
+ priority: 1,
14
+ projectId: '6cfCcrrCFg2xP94Q',
15
+ sectionId: null,
16
+ parentId: null,
17
+ url: 'https://todoist.com/showTask?id=8485093748',
18
+ // Use correct property names from Task schema
19
+ noteCount: 0,
20
+ addedByUid: '713437',
21
+ addedAt: '2025-08-13T22:09:56.123456Z',
22
+ deadline: null,
23
+ responsibleUid: null,
24
+ assignedByUid: null,
25
+ isCollapsed: false,
26
+ isDeleted: false,
27
+ duration: null,
28
+ checked: false,
29
+ updatedAt: '2025-08-13T22:09:56.123456Z',
30
+ due: null,
31
+ dayOrder: 0,
32
+ userId: '713437',
33
+ ...overrides,
34
+ };
35
+ }
36
+ /**
37
+ * Creates a mock Section with all required properties and sensible defaults.
38
+ * Pass only the properties you want to override for your specific test.
39
+ */
40
+ export function createMockSection(overrides = {}) {
41
+ return {
42
+ id: 'section-123',
43
+ projectId: '6cfCcrrCFg2xP94Q',
44
+ sectionOrder: 1,
45
+ userId: 'test-user',
46
+ addedAt: '2024-01-01T00:00:00Z',
47
+ updatedAt: '2024-01-01T00:00:00Z',
48
+ archivedAt: null,
49
+ isArchived: false,
50
+ isDeleted: false,
51
+ isCollapsed: false,
52
+ name: 'Test Section',
53
+ ...overrides,
54
+ };
55
+ }
56
+ /**
57
+ * Creates a mock PersonalProject with all required properties and sensible defaults.
58
+ * Pass only the properties you want to override for your specific test.
59
+ */
60
+ export function createMockProject(overrides = {}) {
61
+ return {
62
+ id: '6cfCcrrCFg2xP94Q',
63
+ name: 'Test Project',
64
+ color: 'charcoal',
65
+ isFavorite: false,
66
+ isShared: false,
67
+ parentId: null,
68
+ inboxProject: false,
69
+ viewStyle: 'list',
70
+ url: 'https://todoist.com/projects/6cfCcrrCFg2xP94Q',
71
+ isDeleted: false,
72
+ updatedAt: '2025-08-13T22:09:55.841800Z',
73
+ createdAt: '2025-08-13T22:09:55.841785Z',
74
+ childOrder: 1,
75
+ defaultOrder: 0,
76
+ description: '',
77
+ isCollapsed: false,
78
+ canAssignTasks: false,
79
+ isFrozen: false,
80
+ isArchived: false,
81
+ ...overrides,
82
+ };
83
+ }
84
+ /**
85
+ * Creates a mock API response object with results and nextCursor.
86
+ */
87
+ export function createMockApiResponse(results, nextCursor = null) {
88
+ return {
89
+ results,
90
+ nextCursor,
91
+ };
92
+ }
93
+ /**
94
+ * Creates a simplified mapped task (matches mapTask output) for filter-based query tests.
95
+ */
96
+ export function createMappedTask(overrides = {}) {
97
+ return {
98
+ id: TEST_IDS.TASK_1,
99
+ content: 'Test task content',
100
+ description: '',
101
+ dueDate: undefined,
102
+ recurring: false,
103
+ priority: 1,
104
+ projectId: TEST_IDS.PROJECT_TEST,
105
+ sectionId: null,
106
+ parentId: null,
107
+ labels: [],
108
+ ...overrides,
109
+ };
110
+ }
111
+ /**
112
+ * Common error messages used across tests.
113
+ */
114
+ export const TEST_ERRORS = {
115
+ API_RATE_LIMIT: 'API Error: Rate limit exceeded',
116
+ API_UNAUTHORIZED: 'API Error: Unauthorized',
117
+ INVALID_CURSOR: 'Invalid cursor format',
118
+ INVALID_FILTER: 'Invalid filter query',
119
+ };
120
+ /**
121
+ * Creates multiple test cases for parameterized testing.
122
+ */
123
+ export function createTestCases(cases) {
124
+ return cases;
125
+ }
126
+ /**
127
+ * Common mock IDs used across tests for consistency.
128
+ */
129
+ export const TEST_IDS = {
130
+ TASK_1: '8485093748',
131
+ TASK_2: '8485093749',
132
+ TASK_3: '8485093750',
133
+ PROJECT_INBOX: 'inbox-project-id',
134
+ PROJECT_WORK: 'work-project-id',
135
+ PROJECT_TEST: '6cfCcrrCFg2xP94Q',
136
+ SECTION_1: 'section-123',
137
+ SECTION_2: 'section-456',
138
+ USER_ID: '713437',
139
+ };
package/package.json CHANGED
@@ -1,21 +1,34 @@
1
1
  {
2
2
  "name": "@doist/todoist-ai",
3
- "version": "1.1.0",
3
+ "version": "2.0.1",
4
+ "type": "module",
4
5
  "main": "./dist/index.js",
5
6
  "types": "./dist/index.d.ts",
6
- "files": ["dist", "package.json", "LICENSE.txt", "README.md"],
7
+ "files": [
8
+ "dist",
9
+ "scripts",
10
+ "package.json",
11
+ "LICENSE.txt",
12
+ "README.md"
13
+ ],
7
14
  "license": "MIT",
8
15
  "description": "A collection of tools for Todoist using AI",
9
16
  "repository": {
10
17
  "type": "git",
11
18
  "url": "https://github.com/Doist/todoist-ai"
12
19
  },
13
- "keywords": ["todoist", "ai", "tools"],
20
+ "keywords": [
21
+ "todoist",
22
+ "ai",
23
+ "tools"
24
+ ],
14
25
  "scripts": {
15
26
  "test": "jest",
16
27
  "build": "rimraf dist && npx tsc --project tsconfig.json",
17
- "dev": "concurrently \"npx tsc --watch\" \"nodemon --watch dist --ext js --exec 'npx -y @modelcontextprotocol/inspector npx node dist/main.js\"",
28
+ "start": "npm run build && npx @modelcontextprotocol/inspector node dist/main.js",
29
+ "dev": "concurrently \"npx tsc --watch\" \"nodemon --watch dist --ext js --exec 'npx @modelcontextprotocol/inspector node dist/main.js'\"",
18
30
  "setup": "cp .env.example .env && npm install && npm run build",
31
+ "test:executable": "npm run build && node scripts/test-executable.cjs",
19
32
  "type-check": "npx tsc --noEmit",
20
33
  "biome:sort-imports": "biome check --formatter-enabled=false --linter-enabled=false --organize-imports-enabled=true --write .",
21
34
  "lint:check": "biome lint",
@@ -51,6 +64,8 @@
51
64
  "typescript": "^5.8.3"
52
65
  },
53
66
  "lint-staged": {
54
- "*": ["biome check --write --no-errors-on-unmatched --files-ignore-unknown=true"]
67
+ "*": [
68
+ "biome check --write --no-errors-on-unmatched --files-ignore-unknown=true"
69
+ ]
55
70
  }
56
71
  }
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require('node:child_process')
4
+ const path = require('node:path')
5
+
6
+ console.log('Testing MCP server executable...')
7
+
8
+ const mainJs = path.join(__dirname, '..', 'dist', 'main.js')
9
+ const child = spawn('node', [mainJs], {
10
+ stdio: ['pipe', 'pipe', 'pipe'],
11
+ })
12
+
13
+ let _stdoutOutput = ''
14
+ let stderrOutput = ''
15
+ let hasError = false
16
+
17
+ child.stdout.on('data', (data) => {
18
+ _stdoutOutput += data.toString()
19
+ })
20
+
21
+ child.stderr.on('data', (data) => {
22
+ const output = data.toString()
23
+ stderrOutput += output
24
+
25
+ // Only consider it an error if it's not related to graceful shutdown
26
+ if (output.includes('Error:') && !output.includes('SIGTERM') && !output.includes('SIGKILL')) {
27
+ console.error('Server startup error detected:', output)
28
+ hasError = true
29
+ }
30
+ })
31
+
32
+ child.on('error', (error) => {
33
+ console.error('Failed to start MCP server:', error.message)
34
+ hasError = true
35
+ process.exit(1)
36
+ })
37
+
38
+ child.on('exit', (code, signal) => {
39
+ // Expected signals when we kill the process
40
+ if (signal === 'SIGTERM' || signal === 'SIGKILL') {
41
+ return // This is expected
42
+ }
43
+
44
+ // Unexpected exit codes during startup
45
+ if (code !== null && code !== 0) {
46
+ console.error(`Server exited unexpectedly with code ${code}`)
47
+ hasError = true
48
+ }
49
+ })
50
+
51
+ // Kill the process after 2 seconds (MCP server should start successfully)
52
+ setTimeout(() => {
53
+ if (hasError) {
54
+ console.error('❌ MCP server failed to start properly')
55
+ if (stderrOutput.trim()) {
56
+ console.error('Error output:', stderrOutput.trim())
57
+ }
58
+ process.exit(1)
59
+ }
60
+
61
+ // Gracefully terminate
62
+ child.kill('SIGTERM')
63
+
64
+ setTimeout(() => {
65
+ console.log('✅ MCP server executable test passed')
66
+ console.log('Server started successfully and is ready to accept connections')
67
+ process.exit(0)
68
+ }, 200) // Give it a moment to clean up
69
+ }, 2000)
@@ -1,9 +0,0 @@
1
- import type { TodoistApi } from '@doist/todoist-api-typescript';
2
- declare const accountOverview: {
3
- name: string;
4
- description: string;
5
- parameters: {};
6
- execute(_args: {}, client: TodoistApi): Promise<string>;
7
- };
8
- export { accountOverview };
9
- //# sourceMappingURL=account-overview.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"account-overview.d.ts","sourceRoot":"","sources":["../../src/tools/account-overview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,UAAU,EAAE,MAAM,+BAA+B,CAAA;AA6ExE,QAAA,MAAM,eAAe;;;;;CAsCqB,CAAA;AAE1C,OAAO,EAAE,eAAe,EAAE,CAAA"}
@@ -1,98 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.accountOverview = void 0;
4
- const shared_1 = require("./shared");
5
- const ArgsSchema = {};
6
- function buildProjectTree(projects) {
7
- // Sort projects by childOrder, then build a tree
8
- const byId = {};
9
- for (const p of projects) {
10
- byId[p.id] = {
11
- ...p,
12
- children: [],
13
- childOrder: p.childOrder ?? 0,
14
- };
15
- }
16
- const roots = [];
17
- for (const p of projects) {
18
- const current = byId[p.id];
19
- if (!current)
20
- continue;
21
- if ((0, shared_1.isPersonalProject)(p) && p.parentId) {
22
- const parent = byId[p.parentId];
23
- if (parent) {
24
- parent.children.push(current);
25
- }
26
- else {
27
- roots.push(current);
28
- }
29
- }
30
- else {
31
- roots.push(current);
32
- }
33
- }
34
- function sortTree(nodes) {
35
- nodes.sort((a, b) => a.childOrder - b.childOrder);
36
- for (const n of nodes) {
37
- sortTree(n.children);
38
- }
39
- }
40
- sortTree(roots);
41
- return roots;
42
- }
43
- async function getSectionsByProject(client, projectIds) {
44
- const result = {};
45
- await Promise.all(projectIds.map(async (projectId) => {
46
- const { results } = await client.getSections({ projectId });
47
- result[projectId] = results;
48
- }));
49
- return result;
50
- }
51
- function renderProjectMarkdown(project, sectionsByProject, indent = '') {
52
- const lines = [];
53
- lines.push(`${indent}- Project: ${project.name} (id=${project.id})`);
54
- const sections = sectionsByProject[project.id] || [];
55
- for (const section of sections) {
56
- lines.push(`${indent} - Section: ${section.name} (id=${section.id})`);
57
- }
58
- for (const child of project.children) {
59
- lines.push(...renderProjectMarkdown(child, sectionsByProject, `${indent} `));
60
- }
61
- return lines;
62
- }
63
- const accountOverview = {
64
- name: 'account-overview',
65
- description: 'Get a Markdown overview of all projects (with hierarchy and sections) and the inbox project. Useful in almost any context before engaging with Todoist further.',
66
- parameters: ArgsSchema,
67
- async execute(_args, client) {
68
- const { results: projects } = await client.getProjects({});
69
- const inbox = projects.find((p) => (0, shared_1.isPersonalProject)(p) && p.inboxProject === true);
70
- const nonInbox = projects.filter((p) => !(0, shared_1.isPersonalProject)(p) || p.inboxProject !== true);
71
- const tree = buildProjectTree(nonInbox);
72
- const allProjectIds = projects.map((p) => p.id);
73
- const sectionsByProject = await getSectionsByProject(client, allProjectIds);
74
- const lines = ['# Personal Projects', ''];
75
- if (inbox) {
76
- lines.push(`- Inbox Project: ${inbox.name} (id=${inbox.id})`);
77
- for (const section of sectionsByProject[inbox.id] || []) {
78
- lines.push(` - Section: ${section.name} (id=${section.id})`);
79
- }
80
- }
81
- if (tree.length) {
82
- for (const project of tree) {
83
- lines.push(...renderProjectMarkdown(project, sectionsByProject));
84
- }
85
- }
86
- else {
87
- lines.push('_No projects found._');
88
- }
89
- lines.push('');
90
- // Add explanation about nesting if there are nested projects
91
- const hasNested = tree.some((p) => p.children.length > 0);
92
- if (hasNested) {
93
- lines.push('_Note: Indentation indicates that a project is a sub-project of the one above it. This allows for organizing projects hierarchically, with parent projects containing related sub-projects._', '');
94
- }
95
- return lines.join('\n');
96
- },
97
- };
98
- exports.accountOverview = accountOverview;
@@ -1 +0,0 @@
1
- {"version":3,"file":"project-overview.d.ts","sourceRoot":"","sources":["../../src/tools/project-overview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,UAAU,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAqEvB,QAAA,MAAM,eAAe;;;;;;;;;CA4CqB,CAAA;AAE1C,OAAO,EAAE,eAAe,EAAE,CAAA"}
@@ -1,107 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.projectOverview = void 0;
4
- const zod_1 = require("zod");
5
- const shared_1 = require("./shared");
6
- const ArgsSchema = {
7
- projectId: zod_1.z.string().min(1).describe('The ID of the project to get an overview for.'),
8
- };
9
- function buildTaskTree(tasks) {
10
- const byId = {};
11
- for (const task of tasks) {
12
- byId[task.id] = { ...task, children: [] };
13
- }
14
- const roots = [];
15
- for (const task of tasks) {
16
- const node = byId[task.id];
17
- if (!node)
18
- continue;
19
- if (!task.parentId) {
20
- roots.push(node);
21
- continue;
22
- }
23
- const parent = byId[task.parentId];
24
- if (parent) {
25
- parent.children.push(node);
26
- }
27
- else {
28
- roots.push(node);
29
- }
30
- }
31
- return roots;
32
- }
33
- function renderTaskTreeMarkdown(tasks, indent = '') {
34
- const lines = [];
35
- for (const task of tasks) {
36
- const idPart = `id=${task.id}`;
37
- const duePart = task.dueDate ? `; due=${task.dueDate}` : '';
38
- const contentPart = `; content=${task.content}`;
39
- lines.push(`${indent}- ${idPart}${duePart}${contentPart}`);
40
- if (task.children.length > 0) {
41
- lines.push(...renderTaskTreeMarkdown(task.children, `${indent} `));
42
- }
43
- }
44
- return lines;
45
- }
46
- async function getAllTasksForProject(client, projectId) {
47
- let allTasks = [];
48
- let cursor = undefined;
49
- do {
50
- const { results, nextCursor } = await client.getTasks({
51
- projectId,
52
- limit: 50,
53
- cursor: cursor ?? undefined,
54
- });
55
- allTasks = allTasks.concat(results.map(shared_1.mapTask));
56
- cursor = nextCursor ?? undefined;
57
- } while (cursor);
58
- return allTasks;
59
- }
60
- async function getProjectSections(client, projectId) {
61
- const { results } = await client.getSections({ projectId });
62
- return results;
63
- }
64
- const projectOverview = {
65
- name: 'project-overview',
66
- description: "Get a Markdown overview of a single project, including its sections and all tasks. Tasks are grouped by section, with tasks not in any section listed first. Each task is listed as '- id=TASKID; due=YYYY-MM-DD; content=TASK CONTENT' (omit due if not present). Subtasks are nested as indented list items.",
67
- parameters: ArgsSchema,
68
- async execute(args, client) {
69
- const { projectId } = args;
70
- const project = await client.getProject(projectId);
71
- const sections = await getProjectSections(client, projectId);
72
- const allTasks = await getAllTasksForProject(client, projectId);
73
- // Group tasks by sectionId
74
- const tasksBySection = {};
75
- for (const section of sections) {
76
- tasksBySection[section.id] = [];
77
- }
78
- const tasksWithoutSection = [];
79
- for (const task of allTasks) {
80
- if (task.sectionId && tasksBySection[task.sectionId]) {
81
- // biome-ignore lint/style/noNonNullAssertion: the "if" above ensures that it is defined
82
- tasksBySection[task.sectionId].push(task);
83
- }
84
- else {
85
- tasksWithoutSection.push(task);
86
- }
87
- }
88
- const lines = [`# ${project.name}`];
89
- if (tasksWithoutSection.length > 0) {
90
- lines.push('');
91
- const tree = buildTaskTree(tasksWithoutSection);
92
- lines.push(...renderTaskTreeMarkdown(tree));
93
- }
94
- for (const section of sections) {
95
- lines.push('');
96
- lines.push(`## ${section.name}`);
97
- const sectionTasks = tasksBySection[section.id];
98
- if (!sectionTasks?.length) {
99
- continue;
100
- }
101
- const tree = buildTaskTree(sectionTasks);
102
- lines.push(...renderTaskTreeMarkdown(tree));
103
- }
104
- return lines.join('\n');
105
- },
106
- };
107
- exports.projectOverview = projectOverview;
@@ -1 +0,0 @@
1
- {"version":3,"file":"projects-add-one.d.ts","sourceRoot":"","sources":["../../src/tools/projects-add-one.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAQvB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;CAQsB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.projectsAddOne = void 0;
4
- const zod_1 = require("zod");
5
- const shared_1 = require("./shared");
6
- const ArgsSchema = {
7
- name: zod_1.z.string().min(1).describe('The name of the project to add.'),
8
- };
9
- const projectsAddOne = {
10
- name: 'projects-add-one',
11
- description: 'Add a new project.',
12
- parameters: ArgsSchema,
13
- async execute(args, client) {
14
- const project = await client.addProject({ name: args.name });
15
- return (0, shared_1.mapProject)(project);
16
- },
17
- };
18
- exports.projectsAddOne = projectsAddOne;
@@ -1,15 +0,0 @@
1
- import { z } from 'zod';
2
- declare const projectsDeleteOne: {
3
- name: string;
4
- description: string;
5
- parameters: {
6
- id: z.ZodString;
7
- };
8
- execute(args: {
9
- id: string;
10
- }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
11
- success: boolean;
12
- }>;
13
- };
14
- export { projectsDeleteOne };
15
- //# sourceMappingURL=projects-delete-one.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"projects-delete-one.d.ts","sourceRoot":"","sources":["../../src/tools/projects-delete-one.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAOvB,QAAA,MAAM,iBAAiB;;;;;;;;;;;CAQmB,CAAA;AAE1C,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.projectsDeleteOne = void 0;
4
- const zod_1 = require("zod");
5
- const ArgsSchema = {
6
- id: zod_1.z.string().min(1).describe('The ID of the project to delete.'),
7
- };
8
- const projectsDeleteOne = {
9
- name: 'projects-delete-one',
10
- description: 'Delete a project by its ID.',
11
- parameters: ArgsSchema,
12
- async execute(args, client) {
13
- await client.deleteProject(args.id);
14
- return { success: true };
15
- },
16
- };
17
- exports.projectsDeleteOne = projectsDeleteOne;
@@ -1,29 +0,0 @@
1
- import { z } from 'zod';
2
- declare const projectsSearch: {
3
- name: string;
4
- description: string;
5
- parameters: {
6
- search: z.ZodOptional<z.ZodString>;
7
- limit: z.ZodDefault<z.ZodNumber>;
8
- cursor: z.ZodOptional<z.ZodString>;
9
- };
10
- execute(args: {
11
- limit: number;
12
- cursor?: string | undefined;
13
- search?: string | undefined;
14
- }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
15
- projects: {
16
- id: string;
17
- name: string;
18
- color: string;
19
- isFavorite: boolean;
20
- isShared: boolean;
21
- parentId: string | null;
22
- inboxProject: boolean;
23
- viewStyle: string;
24
- }[];
25
- nextCursor: string | null;
26
- }>;
27
- };
28
- export { projectsSearch };
29
- //# sourceMappingURL=projects-search.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"projects-search.d.ts","sourceRoot":"","sources":["../../src/tools/projects-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AA0BvB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;CAkBsB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.projectsSearch = void 0;
4
- const zod_1 = require("zod");
5
- const shared_1 = require("./shared");
6
- const ArgsSchema = {
7
- search: zod_1.z
8
- .string()
9
- .optional()
10
- .describe('Search for a project by name (partial and case insensitive match). If omitted, all projects are returned.'),
11
- limit: zod_1.z
12
- .number()
13
- .int()
14
- .min(1)
15
- .max(100)
16
- .default(50)
17
- .describe('The maximum number of projects to return.'),
18
- cursor: zod_1.z
19
- .string()
20
- .optional()
21
- .describe('The cursor to get the next page of projects (cursor is obtained from the previous call to this tool, with the same parameters).'),
22
- };
23
- const projectsSearch = {
24
- name: 'projects-search',
25
- description: 'Search for projects by name or other criteria.',
26
- parameters: ArgsSchema,
27
- async execute(args, client) {
28
- const { results, nextCursor } = await client.getProjects({
29
- limit: args.limit,
30
- cursor: args.cursor ?? null,
31
- });
32
- const searchLower = args.search ? args.search.toLowerCase() : undefined;
33
- const filtered = searchLower
34
- ? results.filter((project) => project.name.toLowerCase().includes(searchLower))
35
- : results;
36
- return {
37
- projects: filtered.map(shared_1.mapProject),
38
- nextCursor,
39
- };
40
- },
41
- };
42
- exports.projectsSearch = projectsSearch;
@@ -1,15 +0,0 @@
1
- import { z } from 'zod';
2
- declare const projectsUpdateOne: {
3
- name: string;
4
- description: string;
5
- parameters: {
6
- id: z.ZodString;
7
- name: z.ZodString;
8
- };
9
- execute(args: {
10
- id: string;
11
- name: string;
12
- }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<import("@doist/todoist-api-typescript").PersonalProject | import("@doist/todoist-api-typescript").WorkspaceProject>;
13
- };
14
- export { projectsUpdateOne };
15
- //# sourceMappingURL=projects-update-one.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"projects-update-one.d.ts","sourceRoot":"","sources":["../../src/tools/projects-update-one.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAQvB,QAAA,MAAM,iBAAiB;;;;;;;;;;;CASmB,CAAA;AAE1C,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.projectsUpdateOne = void 0;
4
- const zod_1 = require("zod");
5
- const ArgsSchema = {
6
- id: zod_1.z.string().min(1).describe('The ID of the project to update.'),
7
- name: zod_1.z.string().min(1).describe('The new name for the project.'),
8
- };
9
- const projectsUpdateOne = {
10
- name: 'projects-update-one',
11
- description: "Update a project's name by its ID.",
12
- parameters: ArgsSchema,
13
- async execute(args, client) {
14
- const { id, name } = args;
15
- const project = await client.updateProject(id, { name });
16
- return project;
17
- },
18
- };
19
- exports.projectsUpdateOne = projectsUpdateOne;
@@ -1,15 +0,0 @@
1
- import { z } from 'zod';
2
- declare const sectionsAddOne: {
3
- name: string;
4
- description: string;
5
- parameters: {
6
- name: z.ZodString;
7
- projectId: z.ZodString;
8
- };
9
- execute(args: {
10
- name: string;
11
- projectId: string;
12
- }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<import("@doist/todoist-api-typescript").Section>;
13
- };
14
- export { sectionsAddOne };
15
- //# sourceMappingURL=sections-add-one.d.ts.map