@cocaxcode/logbook-mcp 0.2.0 → 0.2.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,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/cli.ts
4
- var VERSION = true ? "0.1.2" : "0.0.0";
4
+ var VERSION = true ? "0.2.0" : "0.0.0";
5
5
  async function runCli(argv) {
6
6
  if (argv.includes("--version") || argv.includes("-v")) {
7
7
  console.log(`logbook-mcp v${VERSION}`);
package/dist/index.js CHANGED
@@ -6,13 +6,13 @@ async function main() {
6
6
  const hasMcpFlag = argv.includes("--mcp");
7
7
  if (hasMcpFlag) {
8
8
  const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
9
- const { createServer } = await import("./server-RBETEXFK.js");
9
+ const { createServer } = await import("./server-CIZE5MHB.js");
10
10
  const server = createServer();
11
11
  const transport = new StdioServerTransport();
12
12
  await server.connect(transport);
13
13
  console.error("logbook-mcp server running on stdio");
14
14
  } else {
15
- const { runCli } = await import("./cli-T2BAPOJO.js");
15
+ const { runCli } = await import("./cli-UFNP35WT.js");
16
16
  await runCli(argv);
17
17
  }
18
18
  }
@@ -365,6 +365,16 @@ function getCompletedTodos(db2, filters = {}) {
365
365
  `${TODO_WITH_META_SQL} WHERE ${where} ORDER BY t.completed_at DESC`
366
366
  ).all(...params);
367
367
  }
368
+ function resolveTopicId(db2, name) {
369
+ const existing = getTopicByName(db2, name);
370
+ if (existing) return existing.id;
371
+ const normalized = name.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
372
+ if (!normalized) return getTopicByName(db2, "chore").id;
373
+ const existingNorm = getTopicByName(db2, normalized);
374
+ if (existingNorm) return existingNorm.id;
375
+ const created = insertTopic(db2, normalized);
376
+ return created.id;
377
+ }
368
378
  function syncCodeTodos(db2, repoId, currentTodos) {
369
379
  const sync = db2.transaction(() => {
370
380
  const existing = db2.prepare("SELECT * FROM code_todo_snapshots WHERE repo_id = ? AND resolved_at IS NULL").all(repoId);
@@ -507,21 +517,7 @@ function registerNoteTool(server) {
507
517
  try {
508
518
  const db2 = getDb();
509
519
  const repo = autoRegisterRepo(db2);
510
- let topicId = null;
511
- if (topic) {
512
- const topicRow = getTopicByName(db2, topic);
513
- if (!topicRow) {
514
- const available = getAllTopics(db2);
515
- return {
516
- isError: true,
517
- content: [{
518
- type: "text",
519
- text: `Topic "${topic}" no existe. Disponibles: ${available.map((t) => t.name).join(", ")}`
520
- }]
521
- };
522
- }
523
- topicId = topicRow.id;
524
- }
520
+ const topicId = topic ? resolveTopicId(db2, topic) : null;
525
521
  const note = insertNote(db2, repo?.id ?? null, topicId, content);
526
522
  return {
527
523
  content: [{ type: "text", text: JSON.stringify(note) }]
@@ -572,21 +568,7 @@ function registerTodoAddTool(server) {
572
568
  const todoItems = items ? items : [{ content, topic, priority: priority ?? "normal" }];
573
569
  const results = [];
574
570
  for (const item of todoItems) {
575
- let topicId = null;
576
- if (item.topic) {
577
- const topicRow = getTopicByName(db2, item.topic);
578
- if (!topicRow) {
579
- const available = getAllTopics(db2);
580
- return {
581
- isError: true,
582
- content: [{
583
- type: "text",
584
- text: `Topic "${item.topic}" no existe. Disponibles: ${available.map((t) => t.name).join(", ")}`
585
- }]
586
- };
587
- }
588
- topicId = topicRow.id;
589
- }
571
+ const topicId = item.topic ? resolveTopicId(db2, item.topic) : null;
590
572
  const todo = insertTodo(
591
573
  db2,
592
574
  repoId,
@@ -787,21 +769,7 @@ function registerTodoEditTool(server) {
787
769
  async ({ id, content, topic, priority }) => {
788
770
  try {
789
771
  const db2 = getDb();
790
- let topicId;
791
- if (topic) {
792
- const topicRow = getTopicByName(db2, topic);
793
- if (!topicRow) {
794
- const available = getAllTopics(db2);
795
- return {
796
- isError: true,
797
- content: [{
798
- type: "text",
799
- text: `Topic "${topic}" no existe. Disponibles: ${available.map((t) => t.name).join(", ")}`
800
- }]
801
- };
802
- }
803
- topicId = topicRow.id;
804
- }
772
+ const topicId = topic ? resolveTopicId(db2, topic) : void 0;
805
773
  const updated = updateTodo(db2, id, { content, topicId, priority });
806
774
  if (!updated) {
807
775
  return {
@@ -1027,7 +995,7 @@ function registerSearchTool(server) {
1027
995
  }
1028
996
 
1029
997
  // src/server.ts
1030
- var VERSION = true ? "0.1.2" : "0.0.0";
998
+ var VERSION = true ? "0.2.0" : "0.0.0";
1031
999
  function createServer() {
1032
1000
  const server = new McpServer({
1033
1001
  name: "logbook-mcp",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocaxcode/logbook-mcp",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "MCP server — cuaderno de bitácora del developer. Notas, TODOs y code TODOs sin salir de tu AI.",
5
5
  "type": "module",
6
6
  "bin": {