From 7817dc11a465a9544aea6cef29c9ef21ab4b05e3 Mon Sep 17 00:00:00 2001 From: Tobi Lutke Date: Mon, 19 Jan 2026 11:32:59 -0400 Subject: [PATCH] Show embedding notice only once at end of qmd update Previously, the "Run 'qmd embed' to update embeddings" message was printed after each collection was indexed, repeating the same global count multiple times. Now it's shown once at the end of the update. Co-Authored-By: Claude Opus 4.5 --- src/qmd.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/qmd.ts b/src/qmd.ts index ac89227..35f9502 100755 --- a/src/qmd.ts +++ b/src/qmd.ts @@ -422,11 +422,19 @@ async function updateCollections(): Promise { } } - await indexFiles(col.pwd, col.glob_pattern, col.name); + await indexFiles(col.pwd, col.glob_pattern, col.name, true); console.log(""); } + // Check if any documents need embedding (show once at end) + const finalDb = getDb(); + const needsEmbedding = getHashesNeedingEmbedding(finalDb); + closeDb(); + console.log(`${c.green}✓ All collections updated.${c.reset}`); + if (needsEmbedding > 0) { + console.log(`\nRun 'qmd embed' to update embeddings (${needsEmbedding} unique hashes need vectors)`); + } } /** @@ -1329,7 +1337,7 @@ function collectionRename(oldName: string, newName: string): void { console.log(` Virtual paths updated: ${c.cyan}qmd://${oldName}/${c.reset} → ${c.cyan}qmd://${newName}/${c.reset}`); } -async function indexFiles(pwd?: string, globPattern: string = DEFAULT_GLOB, collectionName?: string): Promise { +async function indexFiles(pwd?: string, globPattern: string = DEFAULT_GLOB, collectionName?: string, suppressEmbedNotice: boolean = false): Promise { const db = getDb(); const resolvedPwd = pwd || getPwd(); const now = new Date().toISOString(); @@ -1450,7 +1458,7 @@ async function indexFiles(pwd?: string, globPattern: string = DEFAULT_GLOB, coll console.log(`Cleaned up ${orphanedContent} orphaned content hash(es)`); } - if (needsEmbedding > 0) { + if (needsEmbedding > 0 && !suppressEmbedNotice) { console.log(`\nRun 'qmd embed' to update embeddings (${needsEmbedding} unique hashes need vectors)`); }