Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/qmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,14 +465,24 @@ async function showStatus(): Promise<void> {
closeDb();
}

async function updateCollections(): Promise<void> {
async function updateCollections(collectionFilter?: string[]): Promise<void> {
const db = getDb();
// Collections are defined in YAML; no duplicate cleanup needed.

// Clear Ollama cache on update
clearCache(db);

const collections = listCollections(db);
let collections = listCollections(db);

// Filter by collection names if specified
if (collectionFilter && collectionFilter.length > 0) {
collections = collections.filter(c => collectionFilter.includes(c.name));
if (collections.length === 0) {
console.log(`${c.dim}No matching collections found. Available: ${listCollections(db).map(c => c.name).join(', ')}${c.reset}`);
closeDb();
return;
}
}

if (collections.length === 0) {
console.log(`${c.dim}No collections found. Run 'qmd collection add .' to index markdown files.${c.reset}`);
Expand Down Expand Up @@ -2840,7 +2850,7 @@ if (isMain) {
break;

case "update":
await updateCollections();
await updateCollections(cli.opts.collection);
break;

case "embed":
Expand Down