@mindtnv/todoist-cli 0.4.0 → 0.5.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 (84) hide show
  1. package/package.json +6 -6
  2. package/src/api/activity.ts +8 -0
  3. package/src/api/client.ts +214 -0
  4. package/src/api/comments.ts +18 -0
  5. package/src/api/completed.ts +15 -0
  6. package/src/api/labels.ts +18 -0
  7. package/src/api/projects.ts +22 -0
  8. package/src/api/sections.ts +20 -0
  9. package/src/api/stats.ts +38 -0
  10. package/src/api/tasks.ts +34 -0
  11. package/src/api/types.ts +202 -0
  12. package/src/cli/auth.ts +40 -0
  13. package/src/cli/commands/task/add.ts +328 -0
  14. package/src/cli/commands/task/complete.ts +62 -0
  15. package/src/cli/commands/task/delete.ts +62 -0
  16. package/src/cli/commands/task/helpers.ts +289 -0
  17. package/src/cli/commands/task/index.ts +27 -0
  18. package/src/cli/commands/task/list.ts +151 -0
  19. package/src/cli/commands/task/move.ts +49 -0
  20. package/src/cli/commands/task/reopen.ts +43 -0
  21. package/src/cli/commands/task/show.ts +115 -0
  22. package/src/cli/commands/task/update.ts +122 -0
  23. package/src/cli/comment.ts +83 -0
  24. package/src/cli/completed.ts +87 -0
  25. package/src/cli/completion.ts +360 -0
  26. package/src/cli/filter.ts +115 -0
  27. package/src/cli/index.ts +638 -0
  28. package/src/cli/label.ts +120 -0
  29. package/src/cli/log.ts +57 -0
  30. package/src/cli/matrix.ts +100 -0
  31. package/src/cli/plugin-loader.ts +38 -0
  32. package/src/cli/plugin.ts +289 -0
  33. package/src/cli/project.ts +172 -0
  34. package/src/cli/review.ts +116 -0
  35. package/src/cli/section.ts +98 -0
  36. package/src/cli/stats.ts +62 -0
  37. package/src/cli/template.ts +89 -0
  38. package/src/config/index.ts +229 -0
  39. package/src/plugins/api-proxy.ts +70 -0
  40. package/src/plugins/extension-registry.ts +53 -0
  41. package/src/plugins/hook-registry.ts +36 -0
  42. package/src/plugins/loader.ts +200 -0
  43. package/src/plugins/marketplace-types.ts +55 -0
  44. package/src/plugins/marketplace.ts +576 -0
  45. package/src/plugins/palette-registry.ts +21 -0
  46. package/src/plugins/storage.ts +101 -0
  47. package/src/plugins/types.ts +226 -0
  48. package/src/plugins/view-registry.ts +19 -0
  49. package/src/ui/App.tsx +234 -0
  50. package/src/ui/components/Breadcrumb.tsx +18 -0
  51. package/src/ui/components/CommandPalette.tsx +237 -0
  52. package/src/ui/components/ConfirmDialog.tsx +28 -0
  53. package/src/ui/components/EditTaskModal.tsx +484 -0
  54. package/src/ui/components/HelpOverlay.tsx +195 -0
  55. package/src/ui/components/InputPrompt.tsx +109 -0
  56. package/src/ui/components/LabelPicker.tsx +110 -0
  57. package/src/ui/components/ModalManager.tsx +275 -0
  58. package/src/ui/components/ProjectPicker.tsx +95 -0
  59. package/src/ui/components/Sidebar.tsx +282 -0
  60. package/src/ui/components/SortMenu.tsx +77 -0
  61. package/src/ui/components/StatusBar.tsx +67 -0
  62. package/src/ui/components/TaskList.tsx +258 -0
  63. package/src/ui/components/TaskRow.tsx +105 -0
  64. package/src/ui/hooks/useKeyboardHandler.ts +291 -0
  65. package/src/ui/hooks/useStatusMessage.ts +32 -0
  66. package/src/ui/hooks/useTaskOperations.ts +558 -0
  67. package/src/ui/hooks/useUndoSystem.ts +218 -0
  68. package/src/ui/views/ActivityView.tsx +213 -0
  69. package/src/ui/views/CompletedView.tsx +337 -0
  70. package/src/ui/views/StatsView.tsx +178 -0
  71. package/src/ui/views/TaskDetailView.tsx +438 -0
  72. package/src/ui/views/TasksView.tsx +851 -0
  73. package/src/utils/colors.ts +27 -0
  74. package/src/utils/date-format.ts +54 -0
  75. package/src/utils/errors.ts +159 -0
  76. package/src/utils/exit.ts +11 -0
  77. package/src/utils/format.ts +46 -0
  78. package/src/utils/open-url.ts +9 -0
  79. package/src/utils/output.ts +29 -0
  80. package/src/utils/quick-add.ts +202 -0
  81. package/src/utils/resolve.ts +359 -0
  82. package/src/utils/sorting.ts +27 -0
  83. package/src/utils/validation.ts +88 -0
  84. package/dist/index.js +0 -11355
@@ -0,0 +1,115 @@
1
+ import type { Command } from "commander";
2
+ import chalk from "chalk";
3
+ import { getFilters, saveFilter, removeFilter } from "../config/index.ts";
4
+ import { getTasks } from "../api/tasks.ts";
5
+ import { printTaskTable } from "./commands/task/index.ts";
6
+ import { handleError } from "../utils/errors.ts";
7
+ import { cliExit } from "../utils/exit.ts";
8
+
9
+ export function registerFilterCommand(program: Command): void {
10
+ const filter = program
11
+ .command("filter")
12
+ .description("Manage saved filters");
13
+
14
+ filter
15
+ .command("save")
16
+ .description("Save a named filter")
17
+ .argument("<name>", "Filter name (used as shortcut)")
18
+ .argument("<query>", "Todoist filter query")
19
+ .action((name: string, query: string) => {
20
+ saveFilter(name, query);
21
+ console.log(chalk.green(`Filter saved: ${chalk.bold(name)} → "${query}"`));
22
+ console.log(chalk.dim(`Run with: todoist filter run ${name}`));
23
+ });
24
+
25
+ filter
26
+ .command("list")
27
+ .description("List saved filters")
28
+ .action(() => {
29
+ const filters = getFilters();
30
+ const entries = Object.entries(filters);
31
+ if (entries.length === 0) {
32
+ console.log(chalk.dim("No saved filters."));
33
+ return;
34
+ }
35
+ console.log(chalk.bold("Saved Filters"));
36
+ console.log(chalk.dim("-".repeat(50)));
37
+ for (const [name, query] of entries) {
38
+ console.log(` ${chalk.cyan(name)} → ${query}`);
39
+ }
40
+ });
41
+
42
+ filter
43
+ .command("delete")
44
+ .description("Delete a saved filter")
45
+ .argument("<name>", "Filter name")
46
+ .action((name: string) => {
47
+ if (removeFilter(name)) {
48
+ console.log(chalk.green(`Filter "${name}" deleted.`));
49
+ } else {
50
+ console.error(chalk.red(`Filter "${name}" not found.`));
51
+ cliExit(1);
52
+ }
53
+ });
54
+
55
+ filter
56
+ .command("run")
57
+ .description("Run a saved filter")
58
+ .argument("<name>", "Filter name")
59
+ .option("-q, --quiet", "Print only task IDs")
60
+ .option("--json <fields>", "Output JSON with specified fields")
61
+ .option("--csv", "Output in CSV format")
62
+ .option("--tsv", "Output in TSV format")
63
+ .option("--count", "Show only the count")
64
+ .action(async (name: string, opts: { quiet?: boolean; json?: string; csv?: boolean; tsv?: boolean; count?: boolean }) => {
65
+ try {
66
+ const filters = getFilters();
67
+ const query = filters[name];
68
+ if (!query) {
69
+ console.error(chalk.red(`Filter "${name}" not found.`));
70
+ const available = Object.keys(filters);
71
+ if (available.length > 0) {
72
+ console.error(chalk.dim(`Available: ${available.join(", ")}`));
73
+ }
74
+ cliExit(1);
75
+ }
76
+
77
+ const tasks = await getTasks({ filter: query });
78
+
79
+ if (opts.count) {
80
+ console.log(String(tasks.length));
81
+ return;
82
+ }
83
+
84
+ if (opts.quiet) {
85
+ for (const t of tasks) console.log(t.id);
86
+ return;
87
+ }
88
+
89
+ if (opts.json !== undefined) {
90
+ const fields = opts.json.split(",").map(f => f.trim());
91
+ const data = tasks.map(t => {
92
+ const obj: Record<string, unknown> = {};
93
+ for (const f of fields) {
94
+ if (f in t) obj[f] = (t as unknown as Record<string, unknown>)[f];
95
+ }
96
+ return obj;
97
+ });
98
+ console.log(JSON.stringify(data, null, 2));
99
+ return;
100
+ }
101
+
102
+ if (opts.csv || opts.tsv) {
103
+ const { formatTasksDelimited } = await import("../utils/output.ts");
104
+ console.log(formatTasksDelimited(tasks, opts.tsv ? "\t" : ","));
105
+ return;
106
+ }
107
+
108
+ console.log(chalk.bold(`Filter: ${name}`) + chalk.dim(` (${query})`));
109
+ console.log("");
110
+ printTaskTable(tasks);
111
+ } catch (err) {
112
+ handleError(err);
113
+ }
114
+ });
115
+ }