@doist/todoist-ai 4.9.1 → 4.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -448,4 +448,42 @@ describe(`${ADD_TASKS} tool`, () => {
|
|
|
448
448
|
expect(textContent).toContain(`Use ${GET_OVERVIEW} to see your updated project organization`);
|
|
449
449
|
});
|
|
450
450
|
});
|
|
451
|
+
describe('tasks without project context', () => {
|
|
452
|
+
it('should allow creating tasks with only content (goes to Inbox)', async () => {
|
|
453
|
+
const mockApiResponse = createMockTask({
|
|
454
|
+
id: '8485093758',
|
|
455
|
+
content: 'Simple inbox task',
|
|
456
|
+
url: 'https://todoist.com/showTask?id=8485093758',
|
|
457
|
+
addedAt: '2025-08-13T22:09:56.123456Z',
|
|
458
|
+
});
|
|
459
|
+
mockTodoistApi.addTask.mockResolvedValue(mockApiResponse);
|
|
460
|
+
const result = await addTasks.execute({
|
|
461
|
+
tasks: [
|
|
462
|
+
{
|
|
463
|
+
content: 'Simple inbox task',
|
|
464
|
+
},
|
|
465
|
+
],
|
|
466
|
+
}, mockTodoistApi);
|
|
467
|
+
expect(mockTodoistApi.addTask).toHaveBeenCalledWith({
|
|
468
|
+
content: 'Simple inbox task',
|
|
469
|
+
labels: undefined,
|
|
470
|
+
projectId: undefined,
|
|
471
|
+
sectionId: undefined,
|
|
472
|
+
parentId: undefined,
|
|
473
|
+
});
|
|
474
|
+
const textContent = extractTextContent(result);
|
|
475
|
+
expect(textContent).toContain('Added 1 task');
|
|
476
|
+
expect(textContent).toContain('Simple inbox task');
|
|
477
|
+
});
|
|
478
|
+
it('should prevent assignment without project context', async () => {
|
|
479
|
+
await expect(addTasks.execute({
|
|
480
|
+
tasks: [
|
|
481
|
+
{
|
|
482
|
+
content: 'Task with assignment but no project',
|
|
483
|
+
responsibleUser: 'user@example.com',
|
|
484
|
+
},
|
|
485
|
+
],
|
|
486
|
+
}, mockTodoistApi)).rejects.toThrow('Task "Task with assignment but no project": Cannot assign tasks without specifying project context. Please specify a projectId, sectionId, or parentId.');
|
|
487
|
+
});
|
|
488
|
+
});
|
|
451
489
|
});
|
package/dist/tools/add-tasks.js
CHANGED
|
@@ -55,8 +55,8 @@ async function processTask(task, client) {
|
|
|
55
55
|
if (priority) {
|
|
56
56
|
taskArgs.priority = convertPriorityToNumber(priority);
|
|
57
57
|
}
|
|
58
|
-
//
|
|
59
|
-
if (!projectId && !sectionId && !parentId) {
|
|
58
|
+
// Only prevent assignment (not task creation) without sufficient project context
|
|
59
|
+
if (responsibleUser && !projectId && !sectionId && !parentId) {
|
|
60
60
|
throw new Error(`Task "${task.content}": Cannot assign tasks without specifying project context. Please specify a projectId, sectionId, or parentId.`);
|
|
61
61
|
}
|
|
62
62
|
// Parse duration if provided
|