@cocaxcode/logbook-mcp 0.4.12 → 0.5.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.
@@ -1,1162 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/server.ts
4
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
5
-
6
- // src/tools/topics.ts
7
- import { z } from "zod";
8
-
9
- // src/db/connection.ts
10
- import Database from "better-sqlite3";
11
- import { existsSync, mkdirSync } from "fs";
12
- import { homedir } from "os";
13
- import { dirname, join } from "path";
14
-
15
- // src/db/schema.ts
16
- var SCHEMA_SQL = `
17
- CREATE TABLE IF NOT EXISTS repos (
18
- id INTEGER PRIMARY KEY AUTOINCREMENT,
19
- name TEXT NOT NULL UNIQUE,
20
- path TEXT NOT NULL UNIQUE,
21
- created_at TEXT NOT NULL DEFAULT (datetime('now'))
22
- );
23
-
24
- CREATE TABLE IF NOT EXISTS topics (
25
- id INTEGER PRIMARY KEY AUTOINCREMENT,
26
- name TEXT NOT NULL UNIQUE,
27
- description TEXT,
28
- commit_prefix TEXT,
29
- is_custom INTEGER NOT NULL DEFAULT 0,
30
- created_at TEXT NOT NULL DEFAULT (datetime('now'))
31
- );
32
-
33
- CREATE TABLE IF NOT EXISTS notes (
34
- id INTEGER PRIMARY KEY AUTOINCREMENT,
35
- repo_id INTEGER REFERENCES repos(id) ON DELETE SET NULL,
36
- topic_id INTEGER REFERENCES topics(id) ON DELETE SET NULL,
37
- content TEXT NOT NULL,
38
- created_at TEXT NOT NULL DEFAULT (datetime('now'))
39
- );
40
-
41
- CREATE TABLE IF NOT EXISTS todos (
42
- id INTEGER PRIMARY KEY AUTOINCREMENT,
43
- repo_id INTEGER REFERENCES repos(id) ON DELETE SET NULL,
44
- topic_id INTEGER REFERENCES topics(id) ON DELETE SET NULL,
45
- content TEXT NOT NULL,
46
- status TEXT NOT NULL DEFAULT 'pending',
47
- priority TEXT NOT NULL DEFAULT 'normal',
48
- remind_at TEXT,
49
- remind_pattern TEXT,
50
- remind_last_done TEXT,
51
- completed_at TEXT,
52
- created_at TEXT NOT NULL DEFAULT (datetime('now'))
53
- );
54
-
55
- CREATE INDEX IF NOT EXISTS idx_notes_repo ON notes(repo_id);
56
- CREATE INDEX IF NOT EXISTS idx_notes_topic ON notes(topic_id);
57
- CREATE INDEX IF NOT EXISTS idx_notes_date ON notes(created_at);
58
- CREATE INDEX IF NOT EXISTS idx_todos_repo ON todos(repo_id);
59
- CREATE INDEX IF NOT EXISTS idx_todos_topic ON todos(topic_id);
60
- CREATE INDEX IF NOT EXISTS idx_todos_status ON todos(status);
61
- CREATE INDEX IF NOT EXISTS idx_todos_date ON todos(created_at);
62
- CREATE TABLE IF NOT EXISTS code_todo_snapshots (
63
- id INTEGER PRIMARY KEY AUTOINCREMENT,
64
- repo_id INTEGER NOT NULL REFERENCES repos(id) ON DELETE CASCADE,
65
- file TEXT NOT NULL,
66
- line INTEGER NOT NULL,
67
- tag TEXT NOT NULL,
68
- content TEXT NOT NULL,
69
- topic_name TEXT NOT NULL,
70
- first_seen_at TEXT NOT NULL DEFAULT (datetime('now')),
71
- resolved_at TEXT,
72
- UNIQUE(repo_id, file, content)
73
- );
74
-
75
- CREATE INDEX IF NOT EXISTS idx_code_snapshots_repo ON code_todo_snapshots(repo_id);
76
- CREATE INDEX IF NOT EXISTS idx_code_snapshots_resolved ON code_todo_snapshots(resolved_at);
77
-
78
- CREATE VIRTUAL TABLE IF NOT EXISTS notes_fts USING fts5(
79
- content,
80
- content='notes',
81
- content_rowid='id'
82
- );
83
-
84
- CREATE VIRTUAL TABLE IF NOT EXISTS todos_fts USING fts5(
85
- content,
86
- content='todos',
87
- content_rowid='id'
88
- );
89
-
90
- CREATE TRIGGER IF NOT EXISTS notes_ai AFTER INSERT ON notes BEGIN
91
- INSERT INTO notes_fts(rowid, content) VALUES (new.id, new.content);
92
- END;
93
- CREATE TRIGGER IF NOT EXISTS notes_ad AFTER DELETE ON notes BEGIN
94
- INSERT INTO notes_fts(notes_fts, rowid, content) VALUES ('delete', old.id, old.content);
95
- END;
96
- CREATE TRIGGER IF NOT EXISTS notes_au AFTER UPDATE ON notes BEGIN
97
- INSERT INTO notes_fts(notes_fts, rowid, content) VALUES ('delete', old.id, old.content);
98
- INSERT INTO notes_fts(rowid, content) VALUES (new.id, new.content);
99
- END;
100
-
101
- CREATE TRIGGER IF NOT EXISTS todos_ai AFTER INSERT ON todos BEGIN
102
- INSERT INTO todos_fts(rowid, content) VALUES (new.id, new.content);
103
- END;
104
- CREATE TRIGGER IF NOT EXISTS todos_ad AFTER DELETE ON todos BEGIN
105
- INSERT INTO todos_fts(todos_fts, rowid, content) VALUES ('delete', old.id, old.content);
106
- END;
107
- CREATE TRIGGER IF NOT EXISTS todos_au AFTER UPDATE ON todos BEGIN
108
- INSERT INTO todos_fts(todos_fts, rowid, content) VALUES ('delete', old.id, old.content);
109
- INSERT INTO todos_fts(rowid, content) VALUES (new.id, new.content);
110
- END;
111
- `;
112
- var MIGRATIONS_SQL = `
113
- -- Add reminder columns to existing todos tables (safe to run multiple times)
114
- ALTER TABLE todos ADD COLUMN remind_at TEXT;
115
- ALTER TABLE todos ADD COLUMN remind_pattern TEXT;
116
- ALTER TABLE todos ADD COLUMN remind_last_done TEXT;
117
- `;
118
- var POST_MIGRATION_SQL = `
119
- CREATE INDEX IF NOT EXISTS idx_todos_remind ON todos(remind_at);
120
- `;
121
- var SEED_TOPICS_SQL = `
122
- INSERT OR IGNORE INTO topics (name, description, commit_prefix, is_custom) VALUES
123
- ('feature', 'Funcionalidad nueva', 'feat', 0),
124
- ('fix', 'Correcci\xF3n de errores', 'fix', 0),
125
- ('chore', 'Mantenimiento general', 'refactor,docs,ci,build,chore,test,perf', 0),
126
- ('idea', 'Ideas y propuestas futuras', NULL, 0),
127
- ('decision', 'Decisiones tomadas', NULL, 0),
128
- ('blocker', 'Bloqueos activos', NULL, 0),
129
- ('reminder', 'Recordatorios con fecha', NULL, 0);
130
- `;
131
-
132
- // src/db/connection.ts
133
- var DB_DIR = join(homedir(), ".logbook");
134
- var DB_PATH = join(DB_DIR, "logbook.db");
135
- var db = null;
136
- function getDb(dbPath) {
137
- if (db) return db;
138
- const path = dbPath ?? DB_PATH;
139
- const dir = dirname(path);
140
- if (!existsSync(dir)) {
141
- mkdirSync(dir, { recursive: true });
142
- }
143
- db = new Database(path);
144
- db.pragma("journal_mode = WAL");
145
- db.pragma("foreign_keys = ON");
146
- db.exec(SCHEMA_SQL);
147
- for (const stmt of MIGRATIONS_SQL.split(";").map((s) => s.trim()).filter(Boolean)) {
148
- try {
149
- db.exec(stmt);
150
- } catch (e) {
151
- const msg = e instanceof Error ? e.message : String(e);
152
- if (!msg.includes("duplicate column")) {
153
- console.error(`Migration warning: ${msg}`);
154
- }
155
- }
156
- }
157
- db.exec(POST_MIGRATION_SQL);
158
- db.exec(SEED_TOPICS_SQL);
159
- return db;
160
- }
161
-
162
- // src/db/queries.ts
163
- function insertRepo(db2, name, path) {
164
- const stmt = db2.prepare(
165
- "INSERT INTO repos (name, path) VALUES (?, ?)"
166
- );
167
- const result = stmt.run(name, path);
168
- return db2.prepare("SELECT * FROM repos WHERE id = ?").get(result.lastInsertRowid);
169
- }
170
- function getRepoByPath(db2, path) {
171
- return db2.prepare("SELECT * FROM repos WHERE path = ?").get(path);
172
- }
173
- function getRepoByName(db2, name) {
174
- return db2.prepare("SELECT * FROM repos WHERE name = ?").get(name);
175
- }
176
- function getTopicByName(db2, name) {
177
- return db2.prepare("SELECT * FROM topics WHERE name = ?").get(name);
178
- }
179
- function getAllTopics(db2) {
180
- return db2.prepare("SELECT * FROM topics ORDER BY is_custom, name").all();
181
- }
182
- function insertTopic(db2, name, description) {
183
- const stmt = db2.prepare(
184
- "INSERT INTO topics (name, description, is_custom) VALUES (?, ?, 1)"
185
- );
186
- const result = stmt.run(name, description ?? null);
187
- return db2.prepare("SELECT * FROM topics WHERE id = ?").get(result.lastInsertRowid);
188
- }
189
- var NOTE_WITH_META_SQL = `
190
- SELECT n.*, r.name as repo_name, t.name as topic_name
191
- FROM notes n
192
- LEFT JOIN repos r ON n.repo_id = r.id
193
- LEFT JOIN topics t ON n.topic_id = t.id
194
- `;
195
- function insertNote(db2, repoId, topicId, content) {
196
- const stmt = db2.prepare(
197
- "INSERT INTO notes (repo_id, topic_id, content) VALUES (?, ?, ?)"
198
- );
199
- const result = stmt.run(repoId, topicId, content);
200
- return db2.prepare(`${NOTE_WITH_META_SQL} WHERE n.id = ?`).get(result.lastInsertRowid);
201
- }
202
- function getNotes(db2, filters = {}) {
203
- const conditions = [];
204
- const params = [];
205
- if (filters.repoId !== void 0) {
206
- conditions.push("n.repo_id = ?");
207
- params.push(filters.repoId);
208
- }
209
- if (filters.topicId !== void 0) {
210
- conditions.push("n.topic_id = ?");
211
- params.push(filters.topicId);
212
- }
213
- if (filters.from) {
214
- conditions.push("n.created_at >= ?");
215
- params.push(filters.from);
216
- }
217
- if (filters.to) {
218
- conditions.push("n.created_at < ?");
219
- params.push(filters.to);
220
- }
221
- const where = conditions.length ? ` WHERE ${conditions.join(" AND ")}` : "";
222
- const limit = filters.limit ?? 100;
223
- return db2.prepare(
224
- `${NOTE_WITH_META_SQL}${where} ORDER BY n.created_at DESC LIMIT ?`
225
- ).all(...params, limit);
226
- }
227
- var TODO_WITH_META_SQL = `
228
- SELECT t.*, r.name as repo_name, tp.name as topic_name, 'manual' as source
229
- FROM todos t
230
- LEFT JOIN repos r ON t.repo_id = r.id
231
- LEFT JOIN topics tp ON t.topic_id = tp.id
232
- `;
233
- function insertTodo(db2, repoId, topicId, content, priority = "normal", remindAt, remindPattern) {
234
- const stmt = db2.prepare(
235
- "INSERT INTO todos (repo_id, topic_id, content, priority, remind_at, remind_pattern) VALUES (?, ?, ?, ?, ?, ?)"
236
- );
237
- const result = stmt.run(repoId, topicId, content, priority, remindAt ?? null, remindPattern ?? null);
238
- return db2.prepare(`${TODO_WITH_META_SQL} WHERE t.id = ?`).get(result.lastInsertRowid);
239
- }
240
- function getTodos(db2, filters = {}) {
241
- const conditions = [];
242
- const params = [];
243
- if (filters.status && filters.status !== "all") {
244
- conditions.push("t.status = ?");
245
- params.push(filters.status);
246
- }
247
- if (filters.repoId !== void 0) {
248
- conditions.push("t.repo_id = ?");
249
- params.push(filters.repoId);
250
- }
251
- if (filters.topicId !== void 0) {
252
- conditions.push("t.topic_id = ?");
253
- params.push(filters.topicId);
254
- }
255
- if (filters.priority) {
256
- conditions.push("t.priority = ?");
257
- params.push(filters.priority);
258
- }
259
- if (filters.from) {
260
- conditions.push("t.created_at >= ?");
261
- params.push(filters.from);
262
- }
263
- if (filters.to) {
264
- conditions.push("t.created_at < ?");
265
- params.push(filters.to);
266
- }
267
- const where = conditions.length ? ` WHERE ${conditions.join(" AND ")}` : "";
268
- const limit = filters.limit ?? 100;
269
- return db2.prepare(
270
- `${TODO_WITH_META_SQL}${where} ORDER BY t.created_at DESC LIMIT ?`
271
- ).all(...params, limit);
272
- }
273
- function updateTodoStatus(db2, ids, status) {
274
- if (ids.length === 0) return [];
275
- const completedAt = status === "done" ? (/* @__PURE__ */ new Date()).toISOString() : null;
276
- const placeholders = ids.map(() => "?").join(",");
277
- db2.prepare(
278
- `UPDATE todos SET status = ?, completed_at = ? WHERE id IN (${placeholders})`
279
- ).run(status, completedAt, ...ids);
280
- return db2.prepare(
281
- `${TODO_WITH_META_SQL} WHERE t.id IN (${placeholders})`
282
- ).all(...ids);
283
- }
284
- function updateTodo(db2, id, fields) {
285
- const sets = [];
286
- const params = [];
287
- if (fields.content !== void 0) {
288
- sets.push("content = ?");
289
- params.push(fields.content);
290
- }
291
- if (fields.topicId !== void 0) {
292
- sets.push("topic_id = ?");
293
- params.push(fields.topicId);
294
- }
295
- if (fields.priority !== void 0) {
296
- sets.push("priority = ?");
297
- params.push(fields.priority);
298
- }
299
- if (sets.length === 0) return void 0;
300
- params.push(id);
301
- db2.prepare(`UPDATE todos SET ${sets.join(", ")} WHERE id = ?`).run(
302
- ...params
303
- );
304
- return db2.prepare(`${TODO_WITH_META_SQL} WHERE t.id = ?`).get(id);
305
- }
306
- function deleteTodos(db2, ids) {
307
- if (ids.length === 0) return [];
308
- const placeholders = ids.map(() => "?").join(",");
309
- const existing = db2.prepare(`SELECT id FROM todos WHERE id IN (${placeholders})`).all(...ids);
310
- const existingIds = existing.map((r) => r.id);
311
- if (existingIds.length > 0) {
312
- const ep = existingIds.map(() => "?").join(",");
313
- db2.prepare(`DELETE FROM todos WHERE id IN (${ep})`).run(
314
- ...existingIds
315
- );
316
- }
317
- return existingIds;
318
- }
319
- function searchNotes(db2, query, filters = {}) {
320
- const conditions = ["notes_fts MATCH ?"];
321
- const params = [sanitizeFts(query)];
322
- if (filters.repoId !== void 0) {
323
- conditions.push("n.repo_id = ?");
324
- params.push(filters.repoId);
325
- }
326
- if (filters.topicId !== void 0) {
327
- conditions.push("n.topic_id = ?");
328
- params.push(filters.topicId);
329
- }
330
- const limit = filters.limit ?? 20;
331
- const where = conditions.join(" AND ");
332
- return db2.prepare(
333
- `SELECT n.*, r.name as repo_name, t.name as topic_name, rank
334
- FROM notes_fts
335
- JOIN notes n ON n.id = notes_fts.rowid
336
- LEFT JOIN repos r ON n.repo_id = r.id
337
- LEFT JOIN topics t ON n.topic_id = t.id
338
- WHERE ${where}
339
- ORDER BY rank
340
- LIMIT ?`
341
- ).all(...params, limit);
342
- }
343
- function searchTodos(db2, query, filters = {}) {
344
- const conditions = ["todos_fts MATCH ?"];
345
- const params = [sanitizeFts(query)];
346
- if (filters.repoId !== void 0) {
347
- conditions.push("t.repo_id = ?");
348
- params.push(filters.repoId);
349
- }
350
- if (filters.topicId !== void 0) {
351
- conditions.push("t.topic_id = ?");
352
- params.push(filters.topicId);
353
- }
354
- const limit = filters.limit ?? 20;
355
- const where = conditions.join(" AND ");
356
- return db2.prepare(
357
- `SELECT t.*, r.name as repo_name, tp.name as topic_name, 'manual' as source, rank
358
- FROM todos_fts
359
- JOIN todos t ON t.id = todos_fts.rowid
360
- LEFT JOIN repos r ON t.repo_id = r.id
361
- LEFT JOIN topics tp ON t.topic_id = tp.id
362
- WHERE ${where}
363
- ORDER BY rank
364
- LIMIT ?`
365
- ).all(...params, limit);
366
- }
367
- function getCompletedTodos(db2, filters = {}) {
368
- const conditions = ["t.status = 'done'"];
369
- const params = [];
370
- if (filters.repoId !== void 0) {
371
- conditions.push("t.repo_id = ?");
372
- params.push(filters.repoId);
373
- }
374
- if (filters.topicId !== void 0) {
375
- conditions.push("t.topic_id = ?");
376
- params.push(filters.topicId);
377
- }
378
- if (filters.from) {
379
- conditions.push("t.completed_at >= ?");
380
- params.push(filters.from);
381
- }
382
- if (filters.to) {
383
- conditions.push("t.completed_at < ?");
384
- params.push(filters.to);
385
- }
386
- const where = conditions.join(" AND ");
387
- return db2.prepare(
388
- `${TODO_WITH_META_SQL} WHERE ${where} ORDER BY t.completed_at DESC`
389
- ).all(...params);
390
- }
391
- function getDueReminders(db2) {
392
- const now = /* @__PURE__ */ new Date();
393
- const today = now.toISOString().split("T")[0];
394
- const tomorrow = new Date(now.getTime() + 864e5).toISOString().split("T")[0];
395
- const todayItems = db2.prepare(
396
- `${TODO_WITH_META_SQL} WHERE t.status = 'pending' AND t.remind_at >= ? AND t.remind_at < ? ORDER BY t.remind_at`
397
- ).all(today, tomorrow);
398
- const overdueItems = db2.prepare(
399
- `${TODO_WITH_META_SQL} WHERE t.status = 'pending' AND t.remind_at IS NOT NULL AND t.remind_at < ? AND t.remind_pattern IS NULL ORDER BY t.remind_at`
400
- ).all(today);
401
- const recurringAll = db2.prepare(
402
- `${TODO_WITH_META_SQL} WHERE t.remind_pattern IS NOT NULL AND (t.remind_last_done IS NULL OR t.remind_last_done < ?)`
403
- ).all(today);
404
- const recurringToday = recurringAll.filter((r) => matchesPattern(r.remind_pattern, now));
405
- const hasAny = todayItems.length > 0 || overdueItems.length > 0 || recurringToday.length > 0;
406
- if (!hasAny) return null;
407
- return {
408
- today: groupByRepo(todayItems),
409
- overdue: groupByRepo(overdueItems),
410
- recurring: groupByRepo(recurringToday)
411
- };
412
- }
413
- function ackRecurringReminder(db2, id) {
414
- const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
415
- db2.prepare("UPDATE todos SET remind_last_done = ? WHERE id = ?").run(today, id);
416
- }
417
- function matchesPattern(pattern, date) {
418
- const dayOfWeek = date.getDay();
419
- const dayOfMonth = date.getDate();
420
- if (pattern === "daily") return true;
421
- if (pattern === "weekdays") return dayOfWeek >= 1 && dayOfWeek <= 5;
422
- if (pattern.startsWith("weekly:")) {
423
- const days = pattern.slice(7).split(",").map(Number);
424
- return days.some((d) => d % 7 === dayOfWeek);
425
- }
426
- if (pattern.startsWith("monthly:")) {
427
- const days = pattern.slice(8).split(",").map(Number);
428
- return days.includes(dayOfMonth);
429
- }
430
- return false;
431
- }
432
- function groupByRepo(items) {
433
- const map = /* @__PURE__ */ new Map();
434
- for (const item of items) {
435
- const key = item.repo_name ?? "global";
436
- if (!map.has(key)) map.set(key, []);
437
- map.get(key).push(item);
438
- }
439
- return Array.from(map.entries()).sort(([a], [b]) => a.localeCompare(b)).map(([repo_name, reminders]) => ({
440
- repo_name: repo_name === "global" ? null : repo_name,
441
- reminders
442
- }));
443
- }
444
- function resolveTopicId(db2, name) {
445
- const existing = getTopicByName(db2, name);
446
- if (existing) return existing.id;
447
- const normalized = name.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
448
- if (!normalized) return getTopicByName(db2, "chore").id;
449
- const existingNorm = getTopicByName(db2, normalized);
450
- if (existingNorm) return existingNorm.id;
451
- const created = insertTopic(db2, normalized);
452
- return created.id;
453
- }
454
- function syncCodeTodos(db2, repoId, currentTodos) {
455
- const sync = db2.transaction(() => {
456
- const existing = db2.prepare("SELECT * FROM code_todo_snapshots WHERE repo_id = ? AND resolved_at IS NULL").all(repoId);
457
- const currentSet = new Set(currentTodos.map((t) => `${t.file}::${t.content}`));
458
- let resolved = 0;
459
- for (const snap of existing) {
460
- const key = `${snap.file}::${snap.content}`;
461
- if (!currentSet.has(key)) {
462
- db2.prepare("UPDATE code_todo_snapshots SET resolved_at = datetime('now') WHERE id = ?").run(snap.id);
463
- resolved++;
464
- }
465
- }
466
- const existingSet = new Set(existing.map((s) => `${s.file}::${s.content}`));
467
- const allSnapshots = db2.prepare("SELECT file, content FROM code_todo_snapshots WHERE repo_id = ?").all(repoId);
468
- const allSet = new Set(allSnapshots.map((s) => `${s.file}::${s.content}`));
469
- let added = 0;
470
- for (const todo of currentTodos) {
471
- const key = `${todo.file}::${todo.content}`;
472
- if (!allSet.has(key)) {
473
- db2.prepare(
474
- "INSERT INTO code_todo_snapshots (repo_id, file, line, tag, content, topic_name) VALUES (?, ?, ?, ?, ?, ?)"
475
- ).run(repoId, todo.file, todo.line, todo.tag, todo.content, todo.topic_name);
476
- added++;
477
- } else if (existingSet.has(key)) {
478
- db2.prepare("UPDATE code_todo_snapshots SET line = ? WHERE repo_id = ? AND file = ? AND content = ? AND resolved_at IS NULL").run(todo.line, repoId, todo.file, todo.content);
479
- }
480
- }
481
- return { added, resolved };
482
- });
483
- return sync();
484
- }
485
- function getResolvedCodeTodos(db2, repoId, from, to) {
486
- const conditions = ["repo_id = ?", "resolved_at IS NOT NULL"];
487
- const params = [repoId];
488
- if (from) {
489
- conditions.push("resolved_at >= ?");
490
- params.push(from);
491
- }
492
- if (to) {
493
- conditions.push("resolved_at < ?");
494
- params.push(to);
495
- }
496
- return db2.prepare(`SELECT * FROM code_todo_snapshots WHERE ${conditions.join(" AND ")} ORDER BY resolved_at DESC`).all(...params);
497
- }
498
- function sanitizeFts(query) {
499
- const words = query.replace(/\0/g, "").split(/\s+/).filter(Boolean).map((word) => word.replace(/"/g, "")).filter(Boolean);
500
- if (words.length === 0) return '""';
501
- return words.map((word) => `"${word}"`).join(" ");
502
- }
503
-
504
- // src/tools/topics.ts
505
- function registerTopicsTool(server) {
506
- server.tool(
507
- "logbook_topics",
508
- "Lista o crea temas para organizar notas y TODOs. Temas predefinidos: feature, fix, chore, idea, decision, blocker.",
509
- {
510
- action: z.enum(["list", "add"]).default("list").describe("Accion: list (ver temas) o add (crear tema custom)"),
511
- name: z.string().min(1).max(50).regex(/^[a-z0-9-]+$/, "Solo letras minusculas, numeros y guiones").optional().describe("Nombre del nuevo tema (solo para action=add, lowercase, sin espacios)"),
512
- description: z.string().max(200).optional().describe("Descripcion del nuevo tema (solo para action=add)")
513
- },
514
- async ({ action, name, description }) => {
515
- try {
516
- const db2 = getDb();
517
- if (action === "add") {
518
- if (!name) {
519
- return {
520
- isError: true,
521
- content: [{ type: "text", text: 'El parametro "name" es obligatorio para action=add' }]
522
- };
523
- }
524
- const existing = getTopicByName(db2, name);
525
- if (existing) {
526
- return {
527
- isError: true,
528
- content: [{ type: "text", text: `El topic "${name}" ya existe` }]
529
- };
530
- }
531
- const topic = insertTopic(db2, name, description);
532
- return {
533
- content: [{ type: "text", text: JSON.stringify(topic) }]
534
- };
535
- }
536
- const topics = getAllTopics(db2);
537
- return {
538
- content: [{ type: "text", text: JSON.stringify(topics) }]
539
- };
540
- } catch (err) {
541
- return {
542
- isError: true,
543
- content: [{ type: "text", text: `Error: ${err instanceof Error ? err.message : String(err)}` }]
544
- };
545
- }
546
- }
547
- );
548
- }
549
-
550
- // src/tools/note.ts
551
- import { z as z2 } from "zod";
552
-
553
- // src/git/detect-repo.ts
554
- import { execFileSync } from "child_process";
555
- import { basename } from "path";
556
- function detectRepoPath() {
557
- try {
558
- const result = execFileSync("git", ["rev-parse", "--show-toplevel"], {
559
- encoding: "utf-8",
560
- timeout: 5e3,
561
- stdio: ["pipe", "pipe", "pipe"]
562
- });
563
- return result.trim().replace(/\\/g, "/");
564
- } catch {
565
- return null;
566
- }
567
- }
568
- function autoRegisterRepo(db2) {
569
- const repoPath = detectRepoPath();
570
- if (!repoPath) return null;
571
- const existing = getRepoByPath(db2, repoPath);
572
- if (existing) return existing;
573
- let name = basename(repoPath);
574
- const nameConflict = getRepoByName(db2, name);
575
- if (nameConflict) {
576
- const parts = repoPath.split("/");
577
- const parent = parts.length >= 2 ? parts[parts.length - 2] : "repo";
578
- name = `${parent}-${name}`;
579
- }
580
- return insertRepo(db2, name, repoPath);
581
- }
582
-
583
- // src/tools/note.ts
584
- function registerNoteTool(server) {
585
- server.tool(
586
- "logbook_note",
587
- "A\xF1ade una nota al logbook. Topics: feature, fix, chore, idea, decision, blocker. Si no se pasa topic, queda sin categorizar.",
588
- {
589
- content: z2.string().min(1).max(5e3).describe("Contenido de la nota"),
590
- topic: z2.string().optional().describe("Topic: feature, fix, chore, idea, decision, blocker (o custom)")
591
- },
592
- async ({ content, topic }) => {
593
- try {
594
- const db2 = getDb();
595
- const repo = autoRegisterRepo(db2);
596
- const topicId = topic ? resolveTopicId(db2, topic) : null;
597
- const note = insertNote(db2, repo?.id ?? null, topicId, content);
598
- return {
599
- content: [{ type: "text", text: JSON.stringify(note) }]
600
- };
601
- } catch (err) {
602
- return {
603
- isError: true,
604
- content: [{ type: "text", text: `Error creando nota: ${err instanceof Error ? err.message : String(err)}` }]
605
- };
606
- }
607
- }
608
- );
609
- }
610
-
611
- // src/tools/todo-add.ts
612
- import { z as z3 } from "zod";
613
- var priorityEnum = z3.enum(["low", "normal", "high", "urgent"]);
614
- function registerTodoAddTool(server) {
615
- server.tool(
616
- "logbook_todo_add",
617
- "Crea uno o varios TODOs. Para uno solo usa content. Para varios usa items (array). El topic se puede pasar o dejar que la AI lo infiera.",
618
- {
619
- content: z3.string().min(1).max(2e3).optional().describe("Contenido del TODO (para crear uno solo)"),
620
- topic: z3.string().optional().describe("Topic para el TODO individual"),
621
- priority: priorityEnum.optional().default("normal").describe("Prioridad del TODO individual"),
622
- remind_at: z3.string().optional().describe("Fecha recordatorio unica (YYYY-MM-DD)"),
623
- remind_pattern: z3.string().optional().describe("Patron recurrente: daily, weekdays, weekly:2 (martes), weekly:1,3 (lun+mie), monthly:1 (dia 1), monthly:1,15"),
624
- items: z3.array(
625
- z3.object({
626
- content: z3.string().min(1).max(2e3).describe("Contenido del TODO"),
627
- topic: z3.string().optional().describe("Topic"),
628
- priority: priorityEnum.optional().default("normal").describe("Prioridad"),
629
- remind_at: z3.string().optional().describe("Fecha recordatorio (YYYY-MM-DD)"),
630
- remind_pattern: z3.string().optional().describe("Patron recurrente")
631
- })
632
- ).max(50).optional().describe("Array de TODOs para crear varios a la vez (max 50)")
633
- },
634
- async ({ content, topic, priority, remind_at, remind_pattern, items }) => {
635
- try {
636
- if (!content && (!items || items.length === 0)) {
637
- return {
638
- isError: true,
639
- content: [{
640
- type: "text",
641
- text: 'Debes pasar "content" (para uno) o "items" (para varios)'
642
- }]
643
- };
644
- }
645
- const db2 = getDb();
646
- const repo = autoRegisterRepo(db2);
647
- const repoId = repo?.id ?? null;
648
- const todoItems = items ? items : [{ content, topic, priority: priority ?? "normal", remind_at, remind_pattern }];
649
- const results = [];
650
- for (const item of todoItems) {
651
- const hasReminder = item.remind_at || item.remind_pattern;
652
- const effectiveTopic = hasReminder && !item.topic ? "reminder" : item.topic;
653
- const topicId = effectiveTopic ? resolveTopicId(db2, effectiveTopic) : null;
654
- const todo = insertTodo(
655
- db2,
656
- repoId,
657
- topicId,
658
- item.content,
659
- item.priority ?? "normal",
660
- item.remind_at,
661
- item.remind_pattern
662
- );
663
- results.push(todo);
664
- }
665
- return {
666
- content: [{
667
- type: "text",
668
- text: JSON.stringify(
669
- results.length === 1 ? results[0] : { created: results.length, todos: results }
670
- )
671
- }]
672
- };
673
- } catch (err) {
674
- return {
675
- isError: true,
676
- content: [{ type: "text", text: `Error creando TODO: ${err instanceof Error ? err.message : String(err)}` }]
677
- };
678
- }
679
- }
680
- );
681
- }
682
-
683
- // src/tools/todo-list.ts
684
- import { z as z4 } from "zod";
685
-
686
- // src/git/code-todos.ts
687
- import { execFileSync as execFileSync2 } from "child_process";
688
- var TAG_TO_TOPIC = {
689
- TODO: "feature",
690
- FIXME: "fix",
691
- BUG: "fix",
692
- HACK: "chore"
693
- };
694
- function scanCodeTodos(repoPath) {
695
- try {
696
- const output = execFileSync2(
697
- "git",
698
- ["-C", repoPath, "grep", "-n", "-E", "(TODO|FIXME|HACK|BUG):", "--no-color"],
699
- { encoding: "utf-8", timeout: 1e4, stdio: ["pipe", "pipe", "pipe"] }
700
- );
701
- return parseGitGrepOutput(output);
702
- } catch {
703
- return [];
704
- }
705
- }
706
- function parseGitGrepOutput(output) {
707
- if (!output.trim()) return [];
708
- const regex = /^(.+?):(\d+):.*?\b(TODO|FIXME|HACK|BUG):\s*(.+)$/;
709
- return output.trim().split("\n").filter(Boolean).map((line) => {
710
- const match = line.match(regex);
711
- if (!match) return null;
712
- const [, file, lineNum, tag, content] = match;
713
- return {
714
- content: content.trim(),
715
- source: "code",
716
- file,
717
- line: parseInt(lineNum, 10),
718
- tag,
719
- topic_name: TAG_TO_TOPIC[tag] ?? "chore"
720
- };
721
- }).filter((item) => item !== null);
722
- }
723
-
724
- // src/tools/todo-list.ts
725
- function registerTodoListTool(server) {
726
- server.tool(
727
- "logbook_todo_list",
728
- "Lista TODOs agrupados por topic. Incluye manuales y del codigo (TODO/FIXME/HACK/BUG). Sincroniza automaticamente: code TODOs que desaparecen del codigo se marcan como resueltos.",
729
- {
730
- status: z4.enum(["pending", "done", "all"]).optional().default("pending").describe("Filtrar por estado (default: pending)"),
731
- topic: z4.string().optional().describe("Filtrar por topic"),
732
- priority: z4.enum(["low", "normal", "high", "urgent"]).optional().describe("Filtrar por prioridad"),
733
- source: z4.enum(["all", "manual", "code"]).optional().default("all").describe("Filtrar por origen: manual (DB), code (git grep), all"),
734
- scope: z4.enum(["project", "global"]).optional().default("project").describe("Scope: project (auto-detecta) o global (todos los proyectos)"),
735
- from: z4.string().optional().describe("Desde fecha (YYYY-MM-DD)"),
736
- to: z4.string().optional().describe("Hasta fecha (YYYY-MM-DD)"),
737
- limit: z4.number().optional().default(100).describe("Maximo resultados manuales")
738
- },
739
- async ({ status, topic, priority, source, scope, from, to, limit }) => {
740
- try {
741
- const db2 = getDb();
742
- const repo = scope === "project" ? autoRegisterRepo(db2) : null;
743
- let topicId;
744
- if (topic) {
745
- const topicRow = getTopicByName(db2, topic);
746
- if (topicRow) topicId = topicRow.id;
747
- }
748
- const manualTodos = source === "code" ? [] : getTodos(db2, {
749
- status,
750
- repoId: repo?.id,
751
- topicId,
752
- priority,
753
- from,
754
- to,
755
- limit
756
- });
757
- let codeTodos = [];
758
- let syncResult = null;
759
- if (source !== "manual" && status !== "done") {
760
- const repoPath = scope === "project" ? detectRepoPath() : null;
761
- if (repoPath && repo) {
762
- codeTodos = scanCodeTodos(repoPath);
763
- syncResult = syncCodeTodos(db2, repo.id, codeTodos);
764
- if (topic) {
765
- codeTodos = codeTodos.filter((ct) => ct.topic_name === topic);
766
- }
767
- }
768
- }
769
- const groupMap = /* @__PURE__ */ new Map();
770
- for (const todo of manualTodos) {
771
- const key = todo.topic_name ?? "sin-topic";
772
- if (!groupMap.has(key)) groupMap.set(key, []);
773
- groupMap.get(key).push(todo);
774
- }
775
- for (const ct of codeTodos) {
776
- const key = ct.topic_name;
777
- if (!groupMap.has(key)) groupMap.set(key, []);
778
- groupMap.get(key).push(ct);
779
- }
780
- const groups = Array.from(groupMap.entries()).sort(([a], [b]) => a.localeCompare(b)).map(([topicName, items]) => ({ topic: topicName, items }));
781
- return {
782
- content: [{
783
- type: "text",
784
- text: JSON.stringify({
785
- groups,
786
- summary: {
787
- manual: manualTodos.length,
788
- code: codeTodos.length,
789
- total: manualTodos.length + codeTodos.length,
790
- ...syncResult && (syncResult.added > 0 || syncResult.resolved > 0) ? { sync: syncResult } : {}
791
- }
792
- })
793
- }]
794
- };
795
- } catch (err) {
796
- return {
797
- isError: true,
798
- content: [{ type: "text", text: `Error listando TODOs: ${err instanceof Error ? err.message : String(err)}` }]
799
- };
800
- }
801
- }
802
- );
803
- }
804
-
805
- // src/tools/todo-done.ts
806
- import { z as z5 } from "zod";
807
- function registerTodoDoneTool(server) {
808
- server.tool(
809
- "logbook_todo_done",
810
- "Marca TODOs como hechos o los devuelve a pendiente (undo). Los recordatorios recurrentes se marcan como hechos por hoy y vuelven automaticamente el proximo dia que toque.",
811
- {
812
- ids: z5.union([z5.number(), z5.array(z5.number())]).describe("ID o array de IDs de TODOs a marcar"),
813
- undo: z5.boolean().optional().default(false).describe("Si true, devuelve a pendiente en vez de marcar como hecho")
814
- },
815
- async ({ ids, undo }) => {
816
- try {
817
- const db2 = getDb();
818
- const idArray = Array.isArray(ids) ? ids : [ids];
819
- const regularIds = [];
820
- const recurringIds = [];
821
- for (const id of idArray) {
822
- const todo = db2.prepare("SELECT remind_pattern FROM todos WHERE id = ?").get(id);
823
- if (todo?.remind_pattern && !undo) {
824
- recurringIds.push(id);
825
- } else {
826
- regularIds.push(id);
827
- }
828
- }
829
- const results = [];
830
- if (regularIds.length > 0) {
831
- const status = undo ? "pending" : "done";
832
- const updated = updateTodoStatus(db2, regularIds, status);
833
- results.push(...updated);
834
- }
835
- for (const id of recurringIds) {
836
- ackRecurringReminder(db2, id);
837
- const todo = db2.prepare(
838
- `SELECT t.*, r.name as repo_name, tp.name as topic_name, 'manual' as source
839
- FROM todos t
840
- LEFT JOIN repos r ON t.repo_id = r.id
841
- LEFT JOIN topics tp ON t.topic_id = tp.id
842
- WHERE t.id = ?`
843
- ).get(id);
844
- results.push(todo);
845
- }
846
- return {
847
- content: [{
848
- type: "text",
849
- text: JSON.stringify({
850
- action: undo ? "undo" : "done",
851
- updated: results.length,
852
- recurring_acked: recurringIds.length,
853
- todos: results
854
- })
855
- }]
856
- };
857
- } catch (err) {
858
- return {
859
- isError: true,
860
- content: [{ type: "text", text: `Error: ${err instanceof Error ? err.message : String(err)}` }]
861
- };
862
- }
863
- }
864
- );
865
- }
866
-
867
- // src/tools/todo-edit.ts
868
- import { z as z6 } from "zod";
869
- function registerTodoEditTool(server) {
870
- server.tool(
871
- "logbook_todo_edit",
872
- "Edita un TODO existente: contenido, topic o prioridad.",
873
- {
874
- id: z6.number().describe("ID del TODO a editar"),
875
- content: z6.string().optional().describe("Nuevo contenido"),
876
- topic: z6.string().optional().describe("Nuevo topic"),
877
- priority: z6.enum(["low", "normal", "high", "urgent"]).optional().describe("Nueva prioridad")
878
- },
879
- async ({ id, content, topic, priority }) => {
880
- try {
881
- const db2 = getDb();
882
- const topicId = topic ? resolveTopicId(db2, topic) : void 0;
883
- const updated = updateTodo(db2, id, { content, topicId, priority });
884
- if (!updated) {
885
- return {
886
- isError: true,
887
- content: [{ type: "text", text: `TODO #${id} no encontrado o sin cambios` }]
888
- };
889
- }
890
- return {
891
- content: [{ type: "text", text: JSON.stringify(updated) }]
892
- };
893
- } catch (err) {
894
- return {
895
- isError: true,
896
- content: [{ type: "text", text: `Error editando TODO: ${err instanceof Error ? err.message : String(err)}` }]
897
- };
898
- }
899
- }
900
- );
901
- }
902
-
903
- // src/tools/todo-rm.ts
904
- import { z as z7 } from "zod";
905
- function registerTodoRmTool(server) {
906
- server.tool(
907
- "logbook_todo_rm",
908
- "Elimina TODOs por ID. Acepta uno o varios IDs.",
909
- {
910
- ids: z7.union([z7.number(), z7.array(z7.number())]).describe("ID o array de IDs de TODOs a eliminar")
911
- },
912
- async ({ ids }) => {
913
- try {
914
- const db2 = getDb();
915
- const idArray = Array.isArray(ids) ? ids : [ids];
916
- const deleted = deleteTodos(db2, idArray);
917
- return {
918
- content: [{
919
- type: "text",
920
- text: JSON.stringify({
921
- deleted: deleted.length,
922
- ids: deleted
923
- })
924
- }]
925
- };
926
- } catch (err) {
927
- return {
928
- isError: true,
929
- content: [{ type: "text", text: `Error eliminando TODOs: ${err instanceof Error ? err.message : String(err)}` }]
930
- };
931
- }
932
- }
933
- );
934
- }
935
-
936
- // src/tools/log.ts
937
- import { z as z8 } from "zod";
938
- function registerLogTool(server) {
939
- server.tool(
940
- "logbook_log",
941
- "Muestra actividad: notas y TODOs completados para un periodo. Por defecto muestra el dia de hoy del proyecto actual.",
942
- {
943
- period: z8.enum(["today", "yesterday", "week", "month"]).optional().describe("Periodo predefinido (default: today)"),
944
- from: z8.string().optional().describe("Desde fecha (YYYY-MM-DD). Sobreescribe period."),
945
- to: z8.string().optional().describe("Hasta fecha (YYYY-MM-DD). Sobreescribe period."),
946
- type: z8.enum(["all", "notes", "todos"]).optional().default("all").describe("Filtrar por tipo: all, notes, todos"),
947
- topic: z8.string().optional().describe("Filtrar por topic"),
948
- scope: z8.enum(["project", "global"]).optional().default("project").describe("Scope: project (auto-detecta) o global")
949
- },
950
- async ({ period, from, to, type, topic, scope }) => {
951
- try {
952
- const db2 = getDb();
953
- const repo = scope === "project" ? autoRegisterRepo(db2) : null;
954
- const { dateFrom, dateTo } = resolveDates(period, from, to);
955
- let topicId;
956
- if (topic) {
957
- const topicRow = getTopicByName(db2, topic);
958
- if (topicRow) topicId = topicRow.id;
959
- }
960
- const filters = {
961
- repoId: repo?.id,
962
- topicId,
963
- from: dateFrom,
964
- to: dateTo
965
- };
966
- const notes = type === "todos" ? [] : getNotes(db2, filters);
967
- const completedTodos = type === "notes" ? [] : getCompletedTodos(db2, filters);
968
- const resolvedCodeTodos = type === "notes" || !repo ? [] : getResolvedCodeTodos(db2, repo.id, dateFrom, dateTo);
969
- const entries = [
970
- ...notes.map((n) => ({
971
- type: "note",
972
- data: n,
973
- timestamp: n.created_at
974
- })),
975
- ...completedTodos.map((t) => ({
976
- type: "todo",
977
- data: t,
978
- timestamp: t.completed_at ?? t.created_at
979
- })),
980
- ...resolvedCodeTodos.map((ct) => ({
981
- type: "code_todo_resolved",
982
- data: { file: ct.file, line: ct.line, tag: ct.tag, content: ct.content, topic_name: ct.topic_name },
983
- timestamp: ct.resolved_at
984
- }))
985
- ].sort((a, b) => b.timestamp.localeCompare(a.timestamp));
986
- return {
987
- content: [{
988
- type: "text",
989
- text: JSON.stringify({
990
- period: from ? `${dateFrom} \u2014 ${dateTo}` : period ?? "today",
991
- scope: scope ?? "project",
992
- project: repo?.name ?? null,
993
- entries,
994
- summary: {
995
- notes: notes.length,
996
- todos_completed: completedTodos.length,
997
- code_todos_resolved: resolvedCodeTodos.length,
998
- total: entries.length
999
- }
1000
- })
1001
- }]
1002
- };
1003
- } catch (err) {
1004
- return {
1005
- isError: true,
1006
- content: [{ type: "text", text: `Error: ${err instanceof Error ? err.message : String(err)}` }]
1007
- };
1008
- }
1009
- }
1010
- );
1011
- }
1012
- function resolveDates(period, from, to) {
1013
- if (from) {
1014
- const endDate = to ?? from;
1015
- const nextDay = new Date(new Date(endDate).getTime() + 864e5).toISOString().split("T")[0];
1016
- return { dateFrom: from, dateTo: nextDay };
1017
- }
1018
- const now = /* @__PURE__ */ new Date();
1019
- const today = now.toISOString().split("T")[0];
1020
- const tomorrow = new Date(now.getTime() + 864e5).toISOString().split("T")[0];
1021
- switch (period) {
1022
- case "yesterday": {
1023
- const yesterday = new Date(now.getTime() - 864e5).toISOString().split("T")[0];
1024
- return { dateFrom: yesterday, dateTo: today };
1025
- }
1026
- case "week": {
1027
- const weekAgo = new Date(now.getTime() - 7 * 864e5).toISOString().split("T")[0];
1028
- return { dateFrom: weekAgo, dateTo: tomorrow };
1029
- }
1030
- case "month": {
1031
- const monthAgo = new Date(now.getTime() - 30 * 864e5).toISOString().split("T")[0];
1032
- return { dateFrom: monthAgo, dateTo: tomorrow };
1033
- }
1034
- default:
1035
- return { dateFrom: today, dateTo: tomorrow };
1036
- }
1037
- }
1038
-
1039
- // src/tools/search.ts
1040
- import { z as z9 } from "zod";
1041
- function registerSearchTool(server) {
1042
- server.tool(
1043
- "logbook_search",
1044
- "Busqueda full-text en notas y TODOs. Usa FTS5 para busqueda rapida.",
1045
- {
1046
- query: z9.string().min(1).max(500).describe("Texto a buscar"),
1047
- type: z9.enum(["all", "notes", "todos"]).optional().default("all").describe("Buscar en: all, notes, todos"),
1048
- topic: z9.string().optional().describe("Filtrar por topic"),
1049
- scope: z9.enum(["project", "global"]).optional().default("project").describe("Scope: project o global"),
1050
- limit: z9.number().optional().default(20).describe("Maximo resultados (default: 20)")
1051
- },
1052
- async ({ query, type, topic, scope, limit }) => {
1053
- try {
1054
- const db2 = getDb();
1055
- const repo = scope === "project" ? autoRegisterRepo(db2) : null;
1056
- let topicId;
1057
- if (topic) {
1058
- const topicRow = getTopicByName(db2, topic);
1059
- if (topicRow) topicId = topicRow.id;
1060
- }
1061
- const filters = {
1062
- repoId: repo?.id,
1063
- topicId,
1064
- limit
1065
- };
1066
- const results = [];
1067
- if (type !== "todos") {
1068
- const notes = searchNotes(db2, query, filters);
1069
- results.push(
1070
- ...notes.map((n, i) => ({
1071
- type: "note",
1072
- data: n,
1073
- rank: i
1074
- }))
1075
- );
1076
- }
1077
- if (type !== "notes") {
1078
- const todos = searchTodos(db2, query, filters);
1079
- results.push(
1080
- ...todos.map((t, i) => ({
1081
- type: "todo",
1082
- data: t,
1083
- rank: i
1084
- }))
1085
- );
1086
- }
1087
- return {
1088
- content: [{
1089
- type: "text",
1090
- text: JSON.stringify({
1091
- query,
1092
- results,
1093
- total: results.length
1094
- })
1095
- }]
1096
- };
1097
- } catch (err) {
1098
- return {
1099
- isError: true,
1100
- content: [{ type: "text", text: `Error buscando: ${err instanceof Error ? err.message : String(err)}` }]
1101
- };
1102
- }
1103
- }
1104
- );
1105
- }
1106
-
1107
- // src/resources/reminders.ts
1108
- function registerRemindersResource(server) {
1109
- server.resource(
1110
- "reminders",
1111
- "logbook://reminders",
1112
- {
1113
- description: "Recordatorios pendientes para hoy y atrasados, agrupados por proyecto. Vacio si no hay ninguno.",
1114
- mimeType: "application/json"
1115
- },
1116
- async (uri) => {
1117
- try {
1118
- const db2 = getDb();
1119
- const result = getDueReminders(db2);
1120
- if (!result) {
1121
- return { contents: [] };
1122
- }
1123
- for (const group of result.recurring) {
1124
- for (const reminder of group.reminders) {
1125
- ackRecurringReminder(db2, reminder.id);
1126
- }
1127
- }
1128
- return {
1129
- contents: [{
1130
- uri: uri.href,
1131
- text: JSON.stringify(result)
1132
- }]
1133
- };
1134
- } catch {
1135
- return { contents: [] };
1136
- }
1137
- }
1138
- );
1139
- }
1140
-
1141
- // src/server.ts
1142
- var VERSION = true ? "0.4.12" : "0.0.0";
1143
- function createServer() {
1144
- const server = new McpServer({
1145
- name: "logbook-mcp",
1146
- version: VERSION
1147
- });
1148
- registerTopicsTool(server);
1149
- registerNoteTool(server);
1150
- registerTodoAddTool(server);
1151
- registerTodoListTool(server);
1152
- registerTodoDoneTool(server);
1153
- registerTodoEditTool(server);
1154
- registerTodoRmTool(server);
1155
- registerLogTool(server);
1156
- registerSearchTool(server);
1157
- registerRemindersResource(server);
1158
- return server;
1159
- }
1160
- export {
1161
- createServer
1162
- };