@todu/cli 0.1.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.
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +61 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/habit.d.ts +4 -0
- package/dist/commands/habit.d.ts.map +1 -0
- package/dist/commands/habit.js +457 -0
- package/dist/commands/habit.js.map +1 -0
- package/dist/commands/label.d.ts +4 -0
- package/dist/commands/label.d.ts.map +1 -0
- package/dist/commands/label.js +156 -0
- package/dist/commands/label.js.map +1 -0
- package/dist/commands/note.d.ts +4 -0
- package/dist/commands/note.d.ts.map +1 -0
- package/dist/commands/note.js +190 -0
- package/dist/commands/note.js.map +1 -0
- package/dist/commands/project.d.ts +4 -0
- package/dist/commands/project.d.ts.map +1 -0
- package/dist/commands/project.js +220 -0
- package/dist/commands/project.js.map +1 -0
- package/dist/commands/recurring.d.ts +4 -0
- package/dist/commands/recurring.d.ts.map +1 -0
- package/dist/commands/recurring.js +449 -0
- package/dist/commands/recurring.js.map +1 -0
- package/dist/commands/sync.d.ts +4 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +30 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/task.d.ts +4 -0
- package/dist/commands/task.d.ts.map +1 -0
- package/dist/commands/task.js +387 -0
- package/dist/commands/task.js.map +1 -0
- package/dist/config.d.ts +13 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +28 -0
- package/dist/config.js.map +1 -0
- package/dist/format.d.ts +27 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +97 -0
- package/dist/format.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { createProjectId, createTaskId, isTaskPriority, isTaskSortField, isTaskStatus, } from "@todu/core";
|
|
2
|
+
import { colorPriority, colorStatus, formatError, formatJSON, formatTable } from "../format.js";
|
|
3
|
+
const TASK_COLUMNS = [
|
|
4
|
+
{ key: "id", label: "ID" },
|
|
5
|
+
{ key: "title", label: "Title" },
|
|
6
|
+
{ key: "status", label: "Status", colorize: colorStatus },
|
|
7
|
+
{ key: "priority", label: "Priority", colorize: colorPriority },
|
|
8
|
+
{ key: "project", label: "Project" },
|
|
9
|
+
];
|
|
10
|
+
function taskToRow(t, projectName) {
|
|
11
|
+
return {
|
|
12
|
+
id: t.id,
|
|
13
|
+
title: t.title,
|
|
14
|
+
status: t.status,
|
|
15
|
+
priority: t.priority,
|
|
16
|
+
project: projectName ?? t.projectId,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function taskDetail(t, projectName) {
|
|
20
|
+
const lines = [
|
|
21
|
+
`ID: ${t.id}`,
|
|
22
|
+
`Title: ${t.title}`,
|
|
23
|
+
`Status: ${t.status}`,
|
|
24
|
+
`Priority: ${t.priority}`,
|
|
25
|
+
`Project: ${projectName ?? t.projectId}`,
|
|
26
|
+
`Labels: ${t.labels.length > 0 ? t.labels.join(", ") : "(none)"}`,
|
|
27
|
+
`Created: ${t.createdAt}`,
|
|
28
|
+
`Updated: ${t.updatedAt}`,
|
|
29
|
+
];
|
|
30
|
+
if (t.dueDate)
|
|
31
|
+
lines.push(`Due: ${t.dueDate}`);
|
|
32
|
+
if (t.scheduledDate)
|
|
33
|
+
lines.push(`Scheduled: ${t.scheduledDate}`);
|
|
34
|
+
if (t.description) {
|
|
35
|
+
lines.push("", "Description:", t.description);
|
|
36
|
+
}
|
|
37
|
+
return lines.join("\n");
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Resolve a project reference to a ProjectId.
|
|
41
|
+
* Try as ID first, then search by name.
|
|
42
|
+
*/
|
|
43
|
+
async function resolveProjectId(todu, ref) {
|
|
44
|
+
// Try as ID
|
|
45
|
+
const byId = await todu.project.get(createProjectId(ref));
|
|
46
|
+
if (byId.ok)
|
|
47
|
+
return { ok: true, id: byId.value.id, name: byId.value.name };
|
|
48
|
+
// Try name search
|
|
49
|
+
const list = await todu.project.list();
|
|
50
|
+
if (!list.ok)
|
|
51
|
+
return { ok: false, message: formatError(list.error) };
|
|
52
|
+
const matches = list.value.filter((p) => p.name.toLowerCase() === ref.toLowerCase());
|
|
53
|
+
if (matches.length === 1)
|
|
54
|
+
return { ok: true, id: matches[0].id, name: matches[0].name };
|
|
55
|
+
if (matches.length > 1) {
|
|
56
|
+
return { ok: false, message: `Multiple projects match "${ref}". Use the project ID instead.` };
|
|
57
|
+
}
|
|
58
|
+
return { ok: false, message: `Project not found: ${ref}` };
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Build a map of projectId → projectName for display.
|
|
62
|
+
*/
|
|
63
|
+
async function buildProjectNameMap(todu) {
|
|
64
|
+
const result = await todu.project.list();
|
|
65
|
+
if (!result.ok)
|
|
66
|
+
return {};
|
|
67
|
+
const map = {};
|
|
68
|
+
for (const p of result.value) {
|
|
69
|
+
map[p.id] = p.name;
|
|
70
|
+
}
|
|
71
|
+
return map;
|
|
72
|
+
}
|
|
73
|
+
export function registerTaskCommands(program, getTodu) {
|
|
74
|
+
const task = program.command("task").description("Manage tasks");
|
|
75
|
+
// create
|
|
76
|
+
task
|
|
77
|
+
.command("create")
|
|
78
|
+
.description("Create a new task")
|
|
79
|
+
.requiredOption("--title <title>", "task title")
|
|
80
|
+
.requiredOption("--project <project>", "project (ID or name)")
|
|
81
|
+
.option("--priority <priority>", "priority (low, medium, high)", "medium")
|
|
82
|
+
.option("--description <desc>", "task description")
|
|
83
|
+
.option("--label <labels...>", "labels")
|
|
84
|
+
.option("--due <date>", "due date (ISO format)")
|
|
85
|
+
.option("--scheduled <date>", "scheduled date (ISO format)")
|
|
86
|
+
.action(async (opts) => {
|
|
87
|
+
const todu = await getTodu();
|
|
88
|
+
try {
|
|
89
|
+
const project = await resolveProjectId(todu, opts.project);
|
|
90
|
+
if (!project.ok) {
|
|
91
|
+
console.error(project.message);
|
|
92
|
+
process.exitCode = 1;
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const result = await todu.task.create({
|
|
96
|
+
title: opts.title,
|
|
97
|
+
projectId: project.id,
|
|
98
|
+
priority: opts.priority,
|
|
99
|
+
description: opts.description,
|
|
100
|
+
labels: opts.label,
|
|
101
|
+
dueDate: opts.due,
|
|
102
|
+
scheduledDate: opts.scheduled,
|
|
103
|
+
});
|
|
104
|
+
if (!result.ok) {
|
|
105
|
+
console.error(formatError(result.error));
|
|
106
|
+
process.exitCode = 1;
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const format = program.opts().format;
|
|
110
|
+
if (format === "json") {
|
|
111
|
+
console.log(formatJSON(result.value));
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
console.log("Task created:");
|
|
115
|
+
console.log(taskDetail(result.value, project.name));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
finally {
|
|
119
|
+
await todu.close();
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
// list
|
|
123
|
+
task
|
|
124
|
+
.command("list")
|
|
125
|
+
.description("List tasks")
|
|
126
|
+
.option("--project <project>", "filter by project (ID or name)")
|
|
127
|
+
.option("--status <statuses>", "filter by status (comma-separated)")
|
|
128
|
+
.option("--priority <priority>", "filter by priority")
|
|
129
|
+
.option("--label <label>", "filter by label")
|
|
130
|
+
.option("--overdue", "show overdue tasks only")
|
|
131
|
+
.option("--today", "show tasks due or scheduled today")
|
|
132
|
+
.option("--sort <field>", "sort by field (priority, dueDate, createdAt, updatedAt, title)")
|
|
133
|
+
.option("--asc", "sort ascending (default: descending)")
|
|
134
|
+
.action(async (opts) => {
|
|
135
|
+
const todu = await getTodu();
|
|
136
|
+
try {
|
|
137
|
+
let projectId;
|
|
138
|
+
if (opts.project) {
|
|
139
|
+
const project = await resolveProjectId(todu, opts.project);
|
|
140
|
+
if (!project.ok) {
|
|
141
|
+
console.error(project.message);
|
|
142
|
+
process.exitCode = 1;
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
projectId = project.id;
|
|
146
|
+
}
|
|
147
|
+
// Parse multi-status: --status active,inprogress
|
|
148
|
+
let status;
|
|
149
|
+
if (opts.status) {
|
|
150
|
+
const parts = opts.status.split(",").map((s) => s.trim());
|
|
151
|
+
for (const s of parts) {
|
|
152
|
+
if (!isTaskStatus(s)) {
|
|
153
|
+
console.error(`Error: invalid status: ${s}`);
|
|
154
|
+
process.exitCode = 1;
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
status = parts.length === 1 ? parts[0] : parts;
|
|
159
|
+
}
|
|
160
|
+
if (opts.priority && !isTaskPriority(opts.priority)) {
|
|
161
|
+
console.error(`Error: invalid priority: ${opts.priority}`);
|
|
162
|
+
process.exitCode = 1;
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
// Parse sort
|
|
166
|
+
let sort;
|
|
167
|
+
if (opts.sort) {
|
|
168
|
+
if (!isTaskSortField(opts.sort)) {
|
|
169
|
+
console.error(`Error: invalid sort field: ${opts.sort}`);
|
|
170
|
+
process.exitCode = 1;
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
sort = { field: opts.sort, direction: opts.asc ? "asc" : "desc" };
|
|
174
|
+
}
|
|
175
|
+
const result = await todu.task.list({
|
|
176
|
+
projectId,
|
|
177
|
+
status,
|
|
178
|
+
priority: opts.priority,
|
|
179
|
+
label: opts.label,
|
|
180
|
+
overdue: opts.overdue,
|
|
181
|
+
today: opts.today,
|
|
182
|
+
}, sort);
|
|
183
|
+
if (!result.ok) {
|
|
184
|
+
console.error(formatError(result.error));
|
|
185
|
+
process.exitCode = 1;
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const format = program.opts().format;
|
|
189
|
+
if (format === "json") {
|
|
190
|
+
console.log(formatJSON(result.value));
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
const nameMap = await buildProjectNameMap(todu);
|
|
194
|
+
const rows = result.value.map((t) => taskToRow(t, nameMap[t.projectId]));
|
|
195
|
+
console.log(formatTable(rows, TASK_COLUMNS));
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
finally {
|
|
199
|
+
await todu.close();
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
// show
|
|
203
|
+
task
|
|
204
|
+
.command("show <id>")
|
|
205
|
+
.description("Show task details")
|
|
206
|
+
.action(async (id) => {
|
|
207
|
+
const todu = await getTodu();
|
|
208
|
+
try {
|
|
209
|
+
const result = await todu.task.get(createTaskId(id));
|
|
210
|
+
if (!result.ok) {
|
|
211
|
+
console.error(formatError(result.error));
|
|
212
|
+
process.exitCode = 1;
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const nameMap = await buildProjectNameMap(todu);
|
|
216
|
+
const format = program.opts().format;
|
|
217
|
+
if (format === "json") {
|
|
218
|
+
console.log(formatJSON(result.value));
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
console.log(taskDetail(result.value, nameMap[result.value.projectId]));
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
finally {
|
|
225
|
+
await todu.close();
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
// update
|
|
229
|
+
task
|
|
230
|
+
.command("update <id>")
|
|
231
|
+
.description("Update a task")
|
|
232
|
+
.option("--title <title>", "new title")
|
|
233
|
+
.option("--status <status>", "new status")
|
|
234
|
+
.option("--priority <priority>", "new priority")
|
|
235
|
+
.option("--description <desc>", "new description")
|
|
236
|
+
.option("--label <labels...>", "replace labels")
|
|
237
|
+
.option("--due <date>", "new due date")
|
|
238
|
+
.option("--scheduled <date>", "new scheduled date")
|
|
239
|
+
.action(async (id, opts) => {
|
|
240
|
+
const todu = await getTodu();
|
|
241
|
+
try {
|
|
242
|
+
const result = await todu.task.update(createTaskId(id), {
|
|
243
|
+
title: opts.title,
|
|
244
|
+
status: opts.status,
|
|
245
|
+
priority: opts.priority,
|
|
246
|
+
description: opts.description,
|
|
247
|
+
labels: opts.label,
|
|
248
|
+
dueDate: opts.due,
|
|
249
|
+
scheduledDate: opts.scheduled,
|
|
250
|
+
});
|
|
251
|
+
if (!result.ok) {
|
|
252
|
+
console.error(formatError(result.error));
|
|
253
|
+
process.exitCode = 1;
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
const nameMap = await buildProjectNameMap(todu);
|
|
257
|
+
const format = program.opts().format;
|
|
258
|
+
if (format === "json") {
|
|
259
|
+
console.log(formatJSON(result.value));
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
console.log("Task updated:");
|
|
263
|
+
console.log(taskDetail(result.value, nameMap[result.value.projectId]));
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
finally {
|
|
267
|
+
await todu.close();
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
// delete
|
|
271
|
+
task
|
|
272
|
+
.command("delete <id>")
|
|
273
|
+
.description("Delete a task")
|
|
274
|
+
.action(async (id) => {
|
|
275
|
+
const todu = await getTodu();
|
|
276
|
+
try {
|
|
277
|
+
const result = await todu.task.delete(createTaskId(id));
|
|
278
|
+
if (!result.ok) {
|
|
279
|
+
console.error(formatError(result.error));
|
|
280
|
+
process.exitCode = 1;
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const format = program.opts().format;
|
|
284
|
+
if (format === "json") {
|
|
285
|
+
console.log(formatJSON({ deleted: id }));
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
console.log(`Deleted task: ${id}`);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
finally {
|
|
292
|
+
await todu.close();
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
// move
|
|
296
|
+
task
|
|
297
|
+
.command("move <id> <project>")
|
|
298
|
+
.description("Move a task to another project")
|
|
299
|
+
.action(async (id, projectRef) => {
|
|
300
|
+
const todu = await getTodu();
|
|
301
|
+
try {
|
|
302
|
+
const project = await resolveProjectId(todu, projectRef);
|
|
303
|
+
if (!project.ok) {
|
|
304
|
+
console.error(project.message);
|
|
305
|
+
process.exitCode = 1;
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
const result = await todu.task.move(createTaskId(id), project.id);
|
|
309
|
+
if (!result.ok) {
|
|
310
|
+
console.error(formatError(result.error));
|
|
311
|
+
process.exitCode = 1;
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const format = program.opts().format;
|
|
315
|
+
if (format === "json") {
|
|
316
|
+
console.log(formatJSON(result.value));
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
console.log(`Moved task to ${project.name}:`);
|
|
320
|
+
console.log(taskDetail(result.value, project.name));
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
finally {
|
|
324
|
+
await todu.close();
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
// search
|
|
328
|
+
task
|
|
329
|
+
.command("search <query>")
|
|
330
|
+
.description("Search tasks by title")
|
|
331
|
+
.action(async (query) => {
|
|
332
|
+
const todu = await getTodu();
|
|
333
|
+
try {
|
|
334
|
+
const result = await todu.task.search(query);
|
|
335
|
+
if (!result.ok) {
|
|
336
|
+
console.error(formatError(result.error));
|
|
337
|
+
process.exitCode = 1;
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
const format = program.opts().format;
|
|
341
|
+
if (format === "json") {
|
|
342
|
+
console.log(formatJSON(result.value));
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
const nameMap = await buildProjectNameMap(todu);
|
|
346
|
+
const rows = result.value.map((t) => taskToRow(t, nameMap[t.projectId]));
|
|
347
|
+
console.log(formatTable(rows, TASK_COLUMNS));
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
finally {
|
|
351
|
+
await todu.close();
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
// Status shortcut helper
|
|
355
|
+
function statusShortcut(name, description, targetStatus) {
|
|
356
|
+
task
|
|
357
|
+
.command(`${name} <id>`)
|
|
358
|
+
.description(description)
|
|
359
|
+
.action(async (id) => {
|
|
360
|
+
const todu = await getTodu();
|
|
361
|
+
try {
|
|
362
|
+
const result = await todu.task.update(createTaskId(id), { status: targetStatus });
|
|
363
|
+
if (!result.ok) {
|
|
364
|
+
console.error(formatError(result.error));
|
|
365
|
+
process.exitCode = 1;
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
const nameMap = await buildProjectNameMap(todu);
|
|
369
|
+
const format = program.opts().format;
|
|
370
|
+
if (format === "json") {
|
|
371
|
+
console.log(formatJSON(result.value));
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
console.log(`Task ${targetStatus}:`);
|
|
375
|
+
console.log(taskDetail(result.value, nameMap[result.value.projectId]));
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
finally {
|
|
379
|
+
await todu.close();
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
statusShortcut("start", "Start a task (set status to inprogress)", "inprogress");
|
|
384
|
+
statusShortcut("done", "Complete a task (set status to done)", "done");
|
|
385
|
+
statusShortcut("cancel", "Cancel a task (set status to canceled)", "canceled");
|
|
386
|
+
}
|
|
387
|
+
//# sourceMappingURL=task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.js","sourceRoot":"","sources":["../../src/commands/task.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,YAAY,EACZ,cAAc,EACd,eAAe,EACf,YAAY,GACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhG,MAAM,YAAY,GAAG;IACnB,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE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|
+
import type { ToduFileConfig } from "@todu/core";
|
|
2
|
+
export type { ToduFileConfig as ToduConfig } from "@todu/core";
|
|
3
|
+
export { resolveConfigPath as getConfigPath, resolveConfigSources, resolveDataDir, } from "@todu/core";
|
|
4
|
+
/**
|
|
5
|
+
* Load config from YAML file. Returns empty config if file doesn't exist.
|
|
6
|
+
* Throws on malformed YAML so users know their config is broken.
|
|
7
|
+
*/
|
|
8
|
+
export declare function loadConfig(configPath: string): ToduFileConfig;
|
|
9
|
+
/**
|
|
10
|
+
* Save config to YAML file. Creates directory if needed.
|
|
11
|
+
*/
|
|
12
|
+
export declare function saveConfig(config: ToduFileConfig, configPath: string): void;
|
|
13
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAWjD,YAAY,EAAE,cAAc,IAAI,UAAU,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EACL,iBAAiB,IAAI,aAAa,EAClC,oBAAoB,EACpB,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,CAS7D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAI3E"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { parse, stringify } from "yaml";
|
|
4
|
+
export { resolveConfigPath as getConfigPath, resolveConfigSources, resolveDataDir, } from "@todu/core";
|
|
5
|
+
/**
|
|
6
|
+
* Load config from YAML file. Returns empty config if file doesn't exist.
|
|
7
|
+
* Throws on malformed YAML so users know their config is broken.
|
|
8
|
+
*/
|
|
9
|
+
export function loadConfig(configPath) {
|
|
10
|
+
let content;
|
|
11
|
+
try {
|
|
12
|
+
content = fs.readFileSync(configPath, "utf-8");
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return {}; // File not found — that's fine
|
|
16
|
+
}
|
|
17
|
+
// Let YAML parse errors surface
|
|
18
|
+
return parse(content) ?? {};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Save config to YAML file. Creates directory if needed.
|
|
22
|
+
*/
|
|
23
|
+
export function saveConfig(config, configPath) {
|
|
24
|
+
const dir = path.dirname(configPath);
|
|
25
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
26
|
+
fs.writeFileSync(configPath, stringify(config), "utf-8");
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAWxC,OAAO,EACL,iBAAiB,IAAI,aAAa,EAClC,oBAAoB,EACpB,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,UAAkB,EAAkB;IAC7D,IAAI,OAAe,CAAC;IACpB,IAAI,CAAC;QACH,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC,CAAC,iCAA+B;IAC5C,CAAC;IACD,gCAAgC;IAChC,OAAQ,KAAK,CAAC,OAAO,CAAoB,IAAI,EAAE,CAAC;AAAA,CACjD;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,MAAsB,EAAE,UAAkB,EAAQ;IAC3E,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACvC,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;AAAA,CAC1D"}
|
package/dist/format.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ToduError } from "@todu/core";
|
|
2
|
+
export declare function setColorEnabled(enabled: boolean): void;
|
|
3
|
+
export declare function isColorEnabled(): boolean;
|
|
4
|
+
/** Colorize a priority value */
|
|
5
|
+
export declare function colorPriority(priority: string): string;
|
|
6
|
+
/** Colorize a status value */
|
|
7
|
+
export declare function colorStatus(status: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Format data as a table for terminal output.
|
|
10
|
+
* Columns auto-size to content width.
|
|
11
|
+
* Optional colorizers transform cell values for display while keeping
|
|
12
|
+
* width calculations based on the raw value.
|
|
13
|
+
*/
|
|
14
|
+
export declare function formatTable(rows: Record<string, string>[], columns: {
|
|
15
|
+
key: string;
|
|
16
|
+
label: string;
|
|
17
|
+
colorize?: (value: string) => string;
|
|
18
|
+
}[]): string;
|
|
19
|
+
/**
|
|
20
|
+
* Format data as JSON.
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatJSON(data: unknown): string;
|
|
23
|
+
/**
|
|
24
|
+
* Format a ToduError for display.
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatError(error: ToduError): string;
|
|
27
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAU5C,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAEtD;AAED,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAOD,gCAAgC;AAChC,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAWtD;AAED,8BAA8B;AAC9B,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAalD;AAMD;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAC9B,OAAO,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;CAAE,EAAE,GAC9E,MAAM,CA6BR;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAEhD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CASpD"}
|
package/dist/format.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import pc from "picocolors";
|
|
2
|
+
// ============================================================================
|
|
3
|
+
// Color support
|
|
4
|
+
// ============================================================================
|
|
5
|
+
/** Whether color output is enabled (TTY + not explicitly disabled) */
|
|
6
|
+
let colorEnabled = process.stdout.isTTY === true && !process.env.NO_COLOR;
|
|
7
|
+
export function setColorEnabled(enabled) {
|
|
8
|
+
colorEnabled = enabled;
|
|
9
|
+
}
|
|
10
|
+
export function isColorEnabled() {
|
|
11
|
+
return colorEnabled;
|
|
12
|
+
}
|
|
13
|
+
/** Apply color only when enabled */
|
|
14
|
+
function color(fn, text) {
|
|
15
|
+
return colorEnabled ? fn(text) : text;
|
|
16
|
+
}
|
|
17
|
+
/** Colorize a priority value */
|
|
18
|
+
export function colorPriority(priority) {
|
|
19
|
+
switch (priority) {
|
|
20
|
+
case "high":
|
|
21
|
+
return color(pc.red, priority);
|
|
22
|
+
case "medium":
|
|
23
|
+
return color(pc.yellow, priority);
|
|
24
|
+
case "low":
|
|
25
|
+
return color(pc.green, priority);
|
|
26
|
+
default:
|
|
27
|
+
return priority;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** Colorize a status value */
|
|
31
|
+
export function colorStatus(status) {
|
|
32
|
+
switch (status) {
|
|
33
|
+
case "done":
|
|
34
|
+
return color(pc.green, status);
|
|
35
|
+
case "canceled":
|
|
36
|
+
return color(pc.dim, status);
|
|
37
|
+
case "inprogress":
|
|
38
|
+
return color(pc.cyan, status);
|
|
39
|
+
case "waiting":
|
|
40
|
+
return color(pc.yellow, status);
|
|
41
|
+
default:
|
|
42
|
+
return status;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// ============================================================================
|
|
46
|
+
// Output formatting
|
|
47
|
+
// ============================================================================
|
|
48
|
+
/**
|
|
49
|
+
* Format data as a table for terminal output.
|
|
50
|
+
* Columns auto-size to content width.
|
|
51
|
+
* Optional colorizers transform cell values for display while keeping
|
|
52
|
+
* width calculations based on the raw value.
|
|
53
|
+
*/
|
|
54
|
+
export function formatTable(rows, columns) {
|
|
55
|
+
if (rows.length === 0) {
|
|
56
|
+
return "No results.";
|
|
57
|
+
}
|
|
58
|
+
// Calculate column widths based on raw (uncolored) values
|
|
59
|
+
const widths = columns.map((col) => {
|
|
60
|
+
const values = rows.map((row) => (row[col.key] ?? "").length);
|
|
61
|
+
return Math.max(col.label.length, ...values);
|
|
62
|
+
});
|
|
63
|
+
// Header
|
|
64
|
+
const header = columns.map((col, i) => color(pc.bold, col.label.padEnd(widths[i]))).join(" ");
|
|
65
|
+
const separator = color(pc.dim, widths.map((w) => "─".repeat(w)).join("──"));
|
|
66
|
+
// Rows
|
|
67
|
+
const body = rows
|
|
68
|
+
.map((row) => columns
|
|
69
|
+
.map((col, i) => {
|
|
70
|
+
const raw = row[col.key] ?? "";
|
|
71
|
+
const padded = raw.padEnd(widths[i]);
|
|
72
|
+
return col.colorize ? col.colorize(raw) + " ".repeat(widths[i] - raw.length) : padded;
|
|
73
|
+
})
|
|
74
|
+
.join(" "))
|
|
75
|
+
.join("\n");
|
|
76
|
+
return `${header}\n${separator}\n${body}`;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Format data as JSON.
|
|
80
|
+
*/
|
|
81
|
+
export function formatJSON(data) {
|
|
82
|
+
return JSON.stringify(data, null, 2);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Format a ToduError for display.
|
|
86
|
+
*/
|
|
87
|
+
export function formatError(error) {
|
|
88
|
+
switch (error.type) {
|
|
89
|
+
case "not-found":
|
|
90
|
+
return `Error: ${error.entity} not found: ${error.id}`;
|
|
91
|
+
case "validation":
|
|
92
|
+
return `Error: ${error.field}: ${error.message}`;
|
|
93
|
+
case "storage":
|
|
94
|
+
return `Error: ${error.message}`;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E,sEAAsE;AACtE,IAAI,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AAE1E,MAAM,UAAU,eAAe,CAAC,OAAgB,EAAQ;IACtD,YAAY,GAAG,OAAO,CAAC;AAAA,CACxB;AAED,MAAM,UAAU,cAAc,GAAY;IACxC,OAAO,YAAY,CAAC;AAAA,CACrB;AAED,oCAAoC;AACpC,SAAS,KAAK,CAAC,EAAyB,EAAE,IAAY,EAAU;IAC9D,OAAO,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAAA,CACvC;AAED,gCAAgC;AAChC,MAAM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C,IAAI,CAAC,CAAC;IAEd,OAAO,GAAG,MAAM,KAAK,SAAS,KAAK,IAAI,EAAE,CAAC;AAAA,CAC3C;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAa,EAAU;IAChD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAAA,CACtC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAgB,EAAU;IACpD,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,WAAW;YACd,OAAO,UAAU,KAAK,CAAC,MAAM,eAAe,KAAK,CAAC,EAAE,EAAE,CAAC;QACzD,KAAK,YAAY;YACf,OAAO,UAAU,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;QACnD,KAAK,SAAS;YACZ,OAAO,UAAU,KAAK,CAAC,OAAO,EAAE,CAAC;IACrC,CAAC;AAAA,CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createTodu, isSyncServerAvailable } from "@todu/engine";
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { registerConfigCommands } from "./commands/config.js";
|
|
5
|
+
import { registerHabitCommands } from "./commands/habit.js";
|
|
6
|
+
import { registerLabelCommands } from "./commands/label.js";
|
|
7
|
+
import { registerNoteCommands } from "./commands/note.js";
|
|
8
|
+
import { registerProjectCommands } from "./commands/project.js";
|
|
9
|
+
import { registerRecurringCommands } from "./commands/recurring.js";
|
|
10
|
+
import { registerSyncCommands } from "./commands/sync.js";
|
|
11
|
+
import { registerTaskCommands } from "./commands/task.js";
|
|
12
|
+
import { getConfigPath, loadConfig, resolveDataDir } from "./config.js";
|
|
13
|
+
import { setColorEnabled } from "./format.js";
|
|
14
|
+
const program = new Command();
|
|
15
|
+
program
|
|
16
|
+
.name("todu")
|
|
17
|
+
.description("Local-first task management")
|
|
18
|
+
.version("0.0.1")
|
|
19
|
+
.option("--format <type>", "output format (text or json)", "text")
|
|
20
|
+
.option("--config <path>", "path to config file")
|
|
21
|
+
.option("--no-color", "disable color output")
|
|
22
|
+
.hook("preAction", () => {
|
|
23
|
+
if (!program.opts().color) {
|
|
24
|
+
setColorEnabled(false);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
// Lazy initialization — resolve config, then create Todu instance.
|
|
28
|
+
// Tries to connect to a running sync server (Electron) first so
|
|
29
|
+
// both share the same Automerge data in real-time.
|
|
30
|
+
const getTodu = async () => {
|
|
31
|
+
const opts = program.opts();
|
|
32
|
+
const configPath = getConfigPath(opts.config);
|
|
33
|
+
const config = loadConfig(configPath);
|
|
34
|
+
const storagePath = resolveDataDir(configPath, config);
|
|
35
|
+
// Skip sync detection when TODU_NO_SYNC is set (used by tests to force standalone mode)
|
|
36
|
+
const syncClient = process.env.TODU_NO_SYNC ? false : await isSyncServerAvailable();
|
|
37
|
+
return createTodu({ storagePath, syncClient });
|
|
38
|
+
};
|
|
39
|
+
// Register command groups
|
|
40
|
+
registerProjectCommands(program, getTodu);
|
|
41
|
+
registerTaskCommands(program, getTodu);
|
|
42
|
+
registerLabelCommands(program, getTodu);
|
|
43
|
+
registerNoteCommands(program, getTodu);
|
|
44
|
+
registerRecurringCommands(program, getTodu);
|
|
45
|
+
registerHabitCommands(program, getTodu);
|
|
46
|
+
registerSyncCommands(program, getTodu);
|
|
47
|
+
registerConfigCommands(program);
|
|
48
|
+
program.parse();
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,c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