dotmd-cli 0.9.5 → 0.9.6

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/ai.mjs +7 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dotmd-cli",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "CLI for managing markdown documents with YAML frontmatter — index, query, validate, graph, export, Notion sync, AI summaries.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/ai.mjs CHANGED
@@ -34,18 +34,19 @@ export function runMLX(prompt, opts = {}) {
34
34
  const output = result.stdout.trim();
35
35
  const lines = output.split('\n')
36
36
  .filter(l => !l.includes('Fetching') && !l.includes('Warning:') && !l.includes('=========='));
37
- return lines.join(' ').trim() || null;
37
+ const text = lines.join(' ').trim();
38
+ return text ? text.replace(/\*\*/g, '').replace(/^#+\s*/gm, '').trim() : null;
38
39
  }
39
40
 
40
41
  export function summarizeDocBody(bodyText, meta, opts = {}) {
41
42
  if (!bodyText?.trim()) return null;
42
- const prompt = `Summarize this markdown document in 2-3 sentences. Focus on what the document is about, its current state, and any key next actions or open questions.
43
+ const prompt = `<|begin_of_text|><|start_header_id|>system<|end_header_id|>
44
+ You write brief, direct summaries. No preamble. No filler. Start with the subject immediately.<|eot_id|><|start_header_id|>user<|end_header_id|>
45
+ Write a 2-3 sentence plain text summary of this document. State what it covers, its current state (${meta.status}), and what remains to be done. No markdown formatting. No bold, headers, or bullets. Do not start with "This document" or "Here is".
43
46
 
44
47
  Title: ${meta.title}
45
- Status: ${meta.status}
46
- File: ${meta.path}
47
-
48
- ${bodyText.slice(0, 6000)}`;
48
+ ${bodyText.slice(0, 6000)}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
49
+ `;
49
50
  return runMLX(prompt, { maxTokens: 200, ...opts });
50
51
  }
51
52