@doist/todoist-ai 0.1.4 → 1.0.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.
Files changed (88) hide show
  1. package/README.md +27 -0
  2. package/dist/index.d.ts +34 -34
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +68 -68
  5. package/dist/main.js +7 -7
  6. package/dist/mcp-helpers.d.ts +4 -4
  7. package/dist/mcp-helpers.d.ts.map +1 -1
  8. package/dist/mcp-helpers.js +5 -7
  9. package/dist/mcp-server.d.ts +4 -2
  10. package/dist/mcp-server.d.ts.map +1 -1
  11. package/dist/mcp-server.js +50 -49
  12. package/dist/todoist-tool.d.ts +2 -2
  13. package/dist/todoist-tool.d.ts.map +1 -1
  14. package/dist/tools/account-overview.d.ts +1 -1
  15. package/dist/tools/account-overview.d.ts.map +1 -1
  16. package/dist/tools/account-overview.js +12 -11
  17. package/dist/tools/project-overview.d.ts +2 -2
  18. package/dist/tools/project-overview.d.ts.map +1 -1
  19. package/dist/tools/project-overview.js +9 -12
  20. package/dist/tools/projects-add-one.d.ts +1 -1
  21. package/dist/tools/projects-add-one.d.ts.map +1 -1
  22. package/dist/tools/projects-add-one.js +5 -5
  23. package/dist/tools/projects-delete-one.d.ts +1 -1
  24. package/dist/tools/projects-delete-one.d.ts.map +1 -1
  25. package/dist/tools/projects-delete-one.js +3 -3
  26. package/dist/tools/projects-list.d.ts +2 -2
  27. package/dist/tools/projects-list.d.ts.map +1 -1
  28. package/dist/tools/projects-list.js +4 -4
  29. package/dist/tools/projects-search.d.ts +1 -1
  30. package/dist/tools/projects-search.d.ts.map +1 -1
  31. package/dist/tools/projects-search.js +7 -7
  32. package/dist/tools/projects-update-one.d.ts +3 -3
  33. package/dist/tools/projects-update-one.d.ts.map +1 -1
  34. package/dist/tools/projects-update-one.js +3 -3
  35. package/dist/tools/sections-add-one.d.ts +1 -1
  36. package/dist/tools/sections-add-one.d.ts.map +1 -1
  37. package/dist/tools/sections-add-one.js +4 -7
  38. package/dist/tools/sections-delete-one.d.ts +1 -1
  39. package/dist/tools/sections-delete-one.d.ts.map +1 -1
  40. package/dist/tools/sections-delete-one.js +3 -3
  41. package/dist/tools/sections-search.d.ts +1 -1
  42. package/dist/tools/sections-search.d.ts.map +1 -1
  43. package/dist/tools/sections-search.js +4 -7
  44. package/dist/tools/sections-update-one.d.ts +2 -2
  45. package/dist/tools/sections-update-one.d.ts.map +1 -1
  46. package/dist/tools/sections-update-one.js +3 -3
  47. package/dist/tools/shared.d.ts +4 -1
  48. package/dist/tools/shared.d.ts.map +1 -1
  49. package/dist/tools/shared.js +11 -3
  50. package/dist/tools/shared.test.d.ts +2 -0
  51. package/dist/tools/shared.test.d.ts.map +1 -0
  52. package/dist/tools/shared.test.js +135 -0
  53. package/dist/tools/subtasks-list-for-parent-task.d.ts +2 -2
  54. package/dist/tools/subtasks-list-for-parent-task.d.ts.map +1 -1
  55. package/dist/tools/subtasks-list-for-parent-task.js +7 -10
  56. package/dist/tools/tasks-add-multiple.d.ts +2 -2
  57. package/dist/tools/tasks-add-multiple.d.ts.map +1 -1
  58. package/dist/tools/tasks-add-multiple.js +12 -30
  59. package/dist/tools/tasks-complete-multiple.d.ts +1 -1
  60. package/dist/tools/tasks-complete-multiple.d.ts.map +1 -1
  61. package/dist/tools/tasks-complete-multiple.js +3 -6
  62. package/dist/tools/tasks-delete-one.d.ts +1 -1
  63. package/dist/tools/tasks-delete-one.d.ts.map +1 -1
  64. package/dist/tools/tasks-delete-one.js +3 -3
  65. package/dist/tools/{tasks-by-date-range.d.ts → tasks-list-by-date.d.ts} +2 -2
  66. package/dist/tools/tasks-list-by-date.d.ts.map +1 -0
  67. package/dist/tools/{tasks-by-date-range.js → tasks-list-by-date.js} +10 -10
  68. package/dist/tools/{tasks-by-project.d.ts → tasks-list-for-project.d.ts} +2 -2
  69. package/dist/tools/tasks-list-for-project.d.ts.map +1 -0
  70. package/dist/tools/{tasks-by-project.js → tasks-list-for-project.js} +7 -10
  71. package/dist/tools/tasks-list-for-section.d.ts +1 -1
  72. package/dist/tools/tasks-list-for-section.d.ts.map +1 -1
  73. package/dist/tools/tasks-list-for-section.js +7 -10
  74. package/dist/tools/tasks-list-overdue.d.ts +1 -1
  75. package/dist/tools/tasks-list-overdue.d.ts.map +1 -1
  76. package/dist/tools/tasks-list-overdue.js +7 -7
  77. package/dist/tools/tasks-organize-multiple.d.ts +4 -4
  78. package/dist/tools/tasks-organize-multiple.d.ts.map +1 -1
  79. package/dist/tools/tasks-organize-multiple.js +8 -23
  80. package/dist/tools/tasks-search.d.ts +1 -1
  81. package/dist/tools/tasks-search.d.ts.map +1 -1
  82. package/dist/tools/tasks-search.js +6 -6
  83. package/dist/tools/tasks-update-one.d.ts +3 -3
  84. package/dist/tools/tasks-update-one.d.ts.map +1 -1
  85. package/dist/tools/tasks-update-one.js +9 -21
  86. package/package.json +54 -58
  87. package/dist/tools/tasks-by-date-range.d.ts.map +0 -1
  88. package/dist/tools/tasks-by-project.d.ts.map +0 -1
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.accountOverview = void 0;
4
+ const shared_1 = require("./shared");
4
5
  const ArgsSchema = {};
5
6
  function buildProjectTree(projects) {
6
7
  // Sort projects by childOrder, then build a tree
@@ -17,7 +18,7 @@ function buildProjectTree(projects) {
17
18
  const current = byId[p.id];
18
19
  if (!current)
19
20
  continue;
20
- if (p.parentId) {
21
+ if ((0, shared_1.isPersonalProject)(p) && p.parentId) {
21
22
  const parent = byId[p.parentId];
22
23
  if (parent) {
23
24
  parent.children.push(current);
@@ -47,7 +48,7 @@ async function getSectionsByProject(client, projectIds) {
47
48
  }));
48
49
  return result;
49
50
  }
50
- function renderProjectMarkdown(project, sectionsByProject, indent = "") {
51
+ function renderProjectMarkdown(project, sectionsByProject, indent = '') {
51
52
  const lines = [];
52
53
  lines.push(`${indent}- Project: ${project.name} (id=${project.id})`);
53
54
  const sections = sectionsByProject[project.id] || [];
@@ -60,17 +61,17 @@ function renderProjectMarkdown(project, sectionsByProject, indent = "") {
60
61
  return lines;
61
62
  }
62
63
  const accountOverview = {
63
- name: "account-overview",
64
- 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.",
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.',
65
66
  parameters: ArgsSchema,
66
67
  async execute(_args, client) {
67
68
  const { results: projects } = await client.getProjects({});
68
- const inbox = projects.find((p) => p.isInboxProject === true);
69
- const nonInbox = projects.filter((p) => p.isInboxProject !== true);
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);
70
71
  const tree = buildProjectTree(nonInbox);
71
72
  const allProjectIds = projects.map((p) => p.id);
72
73
  const sectionsByProject = await getSectionsByProject(client, allProjectIds);
73
- const lines = ["# Personal Projects", ""];
74
+ const lines = ['# Personal Projects', ''];
74
75
  if (inbox) {
75
76
  lines.push(`- Inbox Project: ${inbox.name} (id=${inbox.id})`);
76
77
  for (const section of sectionsByProject[inbox.id] || []) {
@@ -83,15 +84,15 @@ const accountOverview = {
83
84
  }
84
85
  }
85
86
  else {
86
- lines.push("_No projects found._");
87
+ lines.push('_No projects found._');
87
88
  }
88
- lines.push("");
89
+ lines.push('');
89
90
  // Add explanation about nesting if there are nested projects
90
91
  const hasNested = tree.some((p) => p.children.length > 0);
91
92
  if (hasNested) {
92
- 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._", "");
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._', '');
93
94
  }
94
- return lines.join("\n");
95
+ return lines.join('\n');
95
96
  },
96
97
  };
97
98
  exports.accountOverview = accountOverview;
@@ -1,5 +1,5 @@
1
- import type { TodoistApi } from "@doist/todoist-api-typescript";
2
- import { z } from "zod";
1
+ import type { TodoistApi } from '@doist/todoist-api-typescript';
2
+ import { z } from 'zod';
3
3
  declare const projectOverview: {
4
4
  name: string;
5
5
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"project-overview.d.ts","sourceRoot":"","sources":["../../src/tools/project-overview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGX,UAAU,EACV,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8ExB,QAAA,MAAM,eAAe;;;;;;;;;CA4CqB,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,CAAC"}
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"}
@@ -2,12 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.projectOverview = void 0;
4
4
  const zod_1 = require("zod");
5
- const shared_js_1 = require("./shared.js");
5
+ const shared_1 = require("./shared");
6
6
  const ArgsSchema = {
7
- projectId: zod_1.z
8
- .string()
9
- .min(1)
10
- .describe("The ID of the project to get an overview for."),
7
+ projectId: zod_1.z.string().min(1).describe('The ID of the project to get an overview for.'),
11
8
  };
12
9
  function buildTaskTree(tasks) {
13
10
  const byId = {};
@@ -33,11 +30,11 @@ function buildTaskTree(tasks) {
33
30
  }
34
31
  return roots;
35
32
  }
36
- function renderTaskTreeMarkdown(tasks, indent = "") {
33
+ function renderTaskTreeMarkdown(tasks, indent = '') {
37
34
  const lines = [];
38
35
  for (const task of tasks) {
39
36
  const idPart = `id=${task.id}`;
40
- const duePart = task.dueDate ? `; due=${task.dueDate}` : "";
37
+ const duePart = task.dueDate ? `; due=${task.dueDate}` : '';
41
38
  const contentPart = `; content=${task.content}`;
42
39
  lines.push(`${indent}- ${idPart}${duePart}${contentPart}`);
43
40
  if (task.children.length > 0) {
@@ -55,7 +52,7 @@ async function getAllTasksForProject(client, projectId) {
55
52
  limit: 50,
56
53
  cursor: cursor ?? undefined,
57
54
  });
58
- allTasks = allTasks.concat(results.map(shared_js_1.mapTask));
55
+ allTasks = allTasks.concat(results.map(shared_1.mapTask));
59
56
  cursor = nextCursor ?? undefined;
60
57
  } while (cursor);
61
58
  return allTasks;
@@ -65,7 +62,7 @@ async function getProjectSections(client, projectId) {
65
62
  return results;
66
63
  }
67
64
  const projectOverview = {
68
- name: "project-overview",
65
+ name: 'project-overview',
69
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.",
70
67
  parameters: ArgsSchema,
71
68
  async execute(args, client) {
@@ -90,12 +87,12 @@ const projectOverview = {
90
87
  }
91
88
  const lines = [`# ${project.name}`];
92
89
  if (tasksWithoutSection.length > 0) {
93
- lines.push("");
90
+ lines.push('');
94
91
  const tree = buildTaskTree(tasksWithoutSection);
95
92
  lines.push(...renderTaskTreeMarkdown(tree));
96
93
  }
97
94
  for (const section of sections) {
98
- lines.push("");
95
+ lines.push('');
99
96
  lines.push(`## ${section.name}`);
100
97
  const sectionTasks = tasksBySection[section.id];
101
98
  if (!sectionTasks?.length) {
@@ -104,7 +101,7 @@ const projectOverview = {
104
101
  const tree = buildTaskTree(sectionTasks);
105
102
  lines.push(...renderTaskTreeMarkdown(tree));
106
103
  }
107
- return lines.join("\n");
104
+ return lines.join('\n');
108
105
  },
109
106
  };
110
107
  exports.projectOverview = projectOverview;
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod';
2
2
  declare const projectsAddOne: {
3
3
  name: string;
4
4
  description: string;
@@ -1 +1 @@
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,CAAC;AAQxB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;CAQsB,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,CAAC"}
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"}
@@ -2,17 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.projectsAddOne = void 0;
4
4
  const zod_1 = require("zod");
5
- const shared_js_1 = require("./shared.js");
5
+ const shared_1 = require("./shared");
6
6
  const ArgsSchema = {
7
- name: zod_1.z.string().min(1).describe("The name of the project to add."),
7
+ name: zod_1.z.string().min(1).describe('The name of the project to add.'),
8
8
  };
9
9
  const projectsAddOne = {
10
- name: "projects-add-one",
11
- description: "Add a new project.",
10
+ name: 'projects-add-one',
11
+ description: 'Add a new project.',
12
12
  parameters: ArgsSchema,
13
13
  async execute(args, client) {
14
14
  const project = await client.addProject({ name: args.name });
15
- return (0, shared_js_1.mapProject)(project);
15
+ return (0, shared_1.mapProject)(project);
16
16
  },
17
17
  };
18
18
  exports.projectsAddOne = projectsAddOne;
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod';
2
2
  declare const projectsDeleteOne: {
3
3
  name: string;
4
4
  description: string;
@@ -1 +1 @@
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,CAAC;AAOxB,QAAA,MAAM,iBAAiB;;;;;;;;;;;CAQmB,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
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"}
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.projectsDeleteOne = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const ArgsSchema = {
6
- id: zod_1.z.string().min(1).describe("The ID of the project to delete."),
6
+ id: zod_1.z.string().min(1).describe('The ID of the project to delete.'),
7
7
  };
8
8
  const projectsDeleteOne = {
9
- name: "projects-delete-one",
10
- description: "Delete a project by its ID.",
9
+ name: 'projects-delete-one',
10
+ description: 'Delete a project by its ID.',
11
11
  parameters: ArgsSchema,
12
12
  async execute(args, client) {
13
13
  await client.deleteProject(args.id);
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod';
2
2
  declare const projectsList: {
3
3
  name: string;
4
4
  description: string;
@@ -10,7 +10,7 @@ declare const projectsList: {
10
10
  limit: number;
11
11
  cursor?: string | undefined;
12
12
  }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
13
- projects: import("@doist/todoist-api-typescript").Project[];
13
+ projects: (import("@doist/todoist-api-typescript").PersonalProject | import("@doist/todoist-api-typescript").WorkspaceProject)[];
14
14
  nextCursor: string | null;
15
15
  }>;
16
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"projects-list.d.ts","sourceRoot":"","sources":["../../src/tools/projects-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;CAcwB,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"projects-list.d.ts","sourceRoot":"","sources":["../../src/tools/projects-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAmBvB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;CAcwB,CAAA;AAE1C,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -9,15 +9,15 @@ const ArgsSchema = {
9
9
  .min(1)
10
10
  .max(100)
11
11
  .default(50)
12
- .describe("The maximum number of projects to return."),
12
+ .describe('The maximum number of projects to return.'),
13
13
  cursor: zod_1.z
14
14
  .string()
15
15
  .optional()
16
- .describe("The cursor to get the next page of projects (cursor is obtained from the previous call to this tool, with the same parameters)."),
16
+ .describe('The cursor to get the next page of projects (cursor is obtained from the previous call to this tool, with the same parameters).'),
17
17
  };
18
18
  const projectsList = {
19
- name: "projects-list",
20
- description: "List all projects for the user.",
19
+ name: 'projects-list',
20
+ description: 'List all projects for the user.',
21
21
  parameters: ArgsSchema,
22
22
  async execute(args, client) {
23
23
  const { results, nextCursor } = await client.getProjects({
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod';
2
2
  declare const projectsSearch: {
3
3
  name: string;
4
4
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"projects-search.d.ts","sourceRoot":"","sources":["../../src/tools/projects-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0BxB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;CAoBsB,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,CAAC"}
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"}
@@ -2,27 +2,27 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.projectsSearch = void 0;
4
4
  const zod_1 = require("zod");
5
- const shared_js_1 = require("./shared.js");
5
+ const shared_1 = require("./shared");
6
6
  const ArgsSchema = {
7
7
  search: zod_1.z
8
8
  .string()
9
9
  .optional()
10
- .describe("Search for a project by name (partial and case insensitive match). If omitted, all projects are returned."),
10
+ .describe('Search for a project by name (partial and case insensitive match). If omitted, all projects are returned.'),
11
11
  limit: zod_1.z
12
12
  .number()
13
13
  .int()
14
14
  .min(1)
15
15
  .max(100)
16
16
  .default(50)
17
- .describe("The maximum number of projects to return."),
17
+ .describe('The maximum number of projects to return.'),
18
18
  cursor: zod_1.z
19
19
  .string()
20
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)."),
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
22
  };
23
23
  const projectsSearch = {
24
- name: "projects-search",
25
- description: "Search for projects by name or other criteria.",
24
+ name: 'projects-search',
25
+ description: 'Search for projects by name or other criteria.',
26
26
  parameters: ArgsSchema,
27
27
  async execute(args, client) {
28
28
  const { results, nextCursor } = await client.getProjects({
@@ -34,7 +34,7 @@ const projectsSearch = {
34
34
  ? results.filter((project) => project.name.toLowerCase().includes(searchLower))
35
35
  : results;
36
36
  return {
37
- projects: filtered.map(shared_js_1.mapProject),
37
+ projects: filtered.map(shared_1.mapProject),
38
38
  nextCursor,
39
39
  };
40
40
  },
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod';
2
2
  declare const projectsUpdateOne: {
3
3
  name: string;
4
4
  description: string;
@@ -7,9 +7,9 @@ declare const projectsUpdateOne: {
7
7
  name: z.ZodString;
8
8
  };
9
9
  execute(args: {
10
- name: string;
11
10
  id: string;
12
- }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<import("@doist/todoist-api-typescript").Project>;
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
13
  };
14
14
  export { projectsUpdateOne };
15
15
  //# sourceMappingURL=projects-update-one.d.ts.map
@@ -1 +1 @@
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,CAAC;AAQxB,QAAA,MAAM,iBAAiB;;;;;;;;;;;CASmB,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
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"}
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.projectsUpdateOne = void 0;
4
4
  const zod_1 = require("zod");
5
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."),
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
8
  };
9
9
  const projectsUpdateOne = {
10
- name: "projects-update-one",
10
+ name: 'projects-update-one',
11
11
  description: "Update a project's name by its ID.",
12
12
  parameters: ArgsSchema,
13
13
  async execute(args, client) {
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod';
2
2
  declare const sectionsAddOne: {
3
3
  name: string;
4
4
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"sections-add-one.d.ts","sourceRoot":"","sources":["../../src/tools/sections-add-one.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,QAAA,MAAM,cAAc;;;;;;;;;;;CAWsB,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"sections-add-one.d.ts","sourceRoot":"","sources":["../../src/tools/sections-add-one.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAQvB,QAAA,MAAM,cAAc;;;;;;;;;;;CAWsB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -3,15 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sectionsAddOne = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const ArgsSchema = {
6
- name: zod_1.z.string().min(1).describe("The name of the section to add."),
7
- projectId: zod_1.z
8
- .string()
9
- .min(1)
10
- .describe("The ID of the project to add the section to."),
6
+ name: zod_1.z.string().min(1).describe('The name of the section to add.'),
7
+ projectId: zod_1.z.string().min(1).describe('The ID of the project to add the section to.'),
11
8
  };
12
9
  const sectionsAddOne = {
13
- name: "sections-add-one",
14
- description: "Add a new section to a project.",
10
+ name: 'sections-add-one',
11
+ description: 'Add a new section to a project.',
15
12
  parameters: ArgsSchema,
16
13
  async execute(args, client) {
17
14
  const section = await client.addSection({
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod';
2
2
  declare const sectionsDeleteOne: {
3
3
  name: string;
4
4
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"sections-delete-one.d.ts","sourceRoot":"","sources":["../../src/tools/sections-delete-one.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,QAAA,MAAM,iBAAiB;;;;;;;;;;;CAQmB,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"sections-delete-one.d.ts","sourceRoot":"","sources":["../../src/tools/sections-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"}
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sectionsDeleteOne = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const ArgsSchema = {
6
- id: zod_1.z.string().min(1).describe("The ID of the section to delete."),
6
+ id: zod_1.z.string().min(1).describe('The ID of the section to delete.'),
7
7
  };
8
8
  const sectionsDeleteOne = {
9
- name: "sections-delete-one",
10
- description: "Delete a section by its ID.",
9
+ name: 'sections-delete-one',
10
+ description: 'Delete a section by its ID.',
11
11
  parameters: ArgsSchema,
12
12
  async execute(args, client) {
13
13
  await client.deleteSection(args.id);
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod';
2
2
  declare const sectionsSearch: {
3
3
  name: string;
4
4
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"sections-search.d.ts","sourceRoot":"","sources":["../../src/tools/sections-search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgBxB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;CAmBsB,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"sections-search.d.ts","sourceRoot":"","sources":["../../src/tools/sections-search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAavB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;CAiBsB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -3,18 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sectionsSearch = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const ArgsSchema = {
6
- projectId: zod_1.z
7
- .string()
8
- .min(1)
9
- .describe("The ID of the project to search sections in."),
6
+ projectId: zod_1.z.string().min(1).describe('The ID of the project to search sections in.'),
10
7
  search: zod_1.z
11
8
  .string()
12
9
  .optional()
13
- .describe("Search for a section by name (partial and case insensitive match). If omitted, all sections in the project are returned."),
10
+ .describe('Search for a section by name (partial and case insensitive match). If omitted, all sections in the project are returned.'),
14
11
  };
15
12
  const sectionsSearch = {
16
- name: "sections-search",
17
- description: "Search for sections by name or other criteria in a project.",
13
+ name: 'sections-search',
14
+ description: 'Search for sections by name or other criteria in a project.',
18
15
  parameters: ArgsSchema,
19
16
  async execute(args, client) {
20
17
  const { results } = await client.getSections({
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod';
2
2
  declare const sectionsUpdateOne: {
3
3
  name: string;
4
4
  description: string;
@@ -7,8 +7,8 @@ declare const sectionsUpdateOne: {
7
7
  name: z.ZodString;
8
8
  };
9
9
  execute(args: {
10
- name: string;
11
10
  id: string;
11
+ name: string;
12
12
  }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<import("@doist/todoist-api-typescript").Section>;
13
13
  };
14
14
  export { sectionsUpdateOne };
@@ -1 +1 @@
1
- {"version":3,"file":"sections-update-one.d.ts","sourceRoot":"","sources":["../../src/tools/sections-update-one.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,QAAA,MAAM,iBAAiB;;;;;;;;;;;CASmB,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"sections-update-one.d.ts","sourceRoot":"","sources":["../../src/tools/sections-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"}
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sectionsUpdateOne = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const ArgsSchema = {
6
- id: zod_1.z.string().min(1).describe("The ID of the section to update."),
7
- name: zod_1.z.string().min(1).describe("The new name for the section."),
6
+ id: zod_1.z.string().min(1).describe('The ID of the section to update.'),
7
+ name: zod_1.z.string().min(1).describe('The new name for the section.'),
8
8
  };
9
9
  const sectionsUpdateOne = {
10
- name: "sections-update-one",
10
+ name: 'sections-update-one',
11
11
  description: "Update a section's name by its ID.",
12
12
  parameters: ArgsSchema,
13
13
  async execute(args, client) {
@@ -1,4 +1,7 @@
1
- import { type Project, type Task, type TodoistApi } from "@doist/todoist-api-typescript";
1
+ import { type PersonalProject, type Task, type TodoistApi, type WorkspaceProject } from '@doist/todoist-api-typescript';
2
+ export type Project = PersonalProject | WorkspaceProject;
3
+ export declare function isPersonalProject(project: Project): project is PersonalProject;
4
+ export declare function isWorkspaceProject(project: Project): project is WorkspaceProject;
2
5
  /**
3
6
  * Map a single Todoist task to a more structured format, for LLM consumption.
4
7
  * @param task - The task to map.
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/tools/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,UAAU,EAEf,MAAM,+BAA+B,CAAC;AAGvC;;;;GAIG;AACH,iBAAS,OAAO,CAAC,IAAI,EAAE,IAAI;;;;;;;;;;;EAc1B;AAED;;;;GAIG;AACH,iBAAS,UAAU,CAAC,OAAO,EAAE,OAAO;;;;;;;;;EAWnC;AAWD,iBAAe,gBAAgB,CAAC,EAC/B,MAAM,EACN,KAAK,EACL,KAAK,EACL,MAAM,GACN,EAAE;IACF,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;;;;;;;;;;;;;;GAyBA;AAED,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/tools/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,eAAe,EACpB,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,gBAAgB,EAExB,MAAM,+BAA+B,CAAA;AAGtC,MAAM,MAAM,OAAO,GAAG,eAAe,GAAG,gBAAgB,CAAA;AAExD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,eAAe,CAE9E;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,gBAAgB,CAEhF;AAED;;;;GAIG;AACH,iBAAS,OAAO,CAAC,IAAI,EAAE,IAAI;;;;;;;;;;;EAa1B;AAED;;;;GAIG;AACH,iBAAS,UAAU,CAAC,OAAO,EAAE,OAAO;;;;;;;;;EAWnC;AAWD,iBAAe,gBAAgB,CAAC,EAC5B,MAAM,EACN,KAAK,EACL,KAAK,EACL,MAAM,GACT,EAAE;IACC,MAAM,EAAE,UAAU,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7B;;;;;;;;;;;;;;GAyBA;AAED,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,CAAA"}
@@ -3,11 +3,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isPersonalProject = isPersonalProject;
7
+ exports.isWorkspaceProject = isWorkspaceProject;
6
8
  exports.getTasksByFilter = getTasksByFilter;
7
9
  exports.mapTask = mapTask;
8
10
  exports.mapProject = mapProject;
9
11
  const todoist_api_typescript_1 = require("@doist/todoist-api-typescript");
10
12
  const zod_1 = __importDefault(require("zod"));
13
+ function isPersonalProject(project) {
14
+ return 'inboxProject' in project;
15
+ }
16
+ function isWorkspaceProject(project) {
17
+ return 'accessLevel' in project;
18
+ }
11
19
  /**
12
20
  * Map a single Todoist task to a more structured format, for LLM consumption.
13
21
  * @param task - The task to map.
@@ -39,8 +47,8 @@ function mapProject(project) {
39
47
  color: project.color,
40
48
  isFavorite: project.isFavorite,
41
49
  isShared: project.isShared,
42
- parentId: project.parentId ?? null,
43
- inboxProject: project.isInboxProject ?? false,
50
+ parentId: isPersonalProject(project) ? (project.parentId ?? null) : null,
51
+ inboxProject: isPersonalProject(project) ? (project.inboxProject ?? false) : false,
44
52
  viewStyle: project.viewStyle,
45
53
  };
46
54
  }
@@ -70,7 +78,7 @@ async function getTasksByFilter({ client, query, limit, cursor, }) {
70
78
  throw error;
71
79
  }
72
80
  const { responseData } = parsedError.data;
73
- if (responseData.errorTag === "INVALID_SEARCH_QUERY") {
81
+ if (responseData.errorTag === 'INVALID_SEARCH_QUERY') {
74
82
  throw new Error(`Invalid filter query: ${query}`);
75
83
  }
76
84
  throw new Error(`${responseData.error} (tag: ${responseData.errorTag}, code: ${responseData.errorCode})`);
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=shared.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.test.d.ts","sourceRoot":"","sources":["../../src/tools/shared.test.ts"],"names":[],"mappings":""}