fix: scope qmd update/embed to current vault collection only

Previously called 'qmd update' and 'qmd embed' without arguments, which
updated all global qmd collections. If any other collection had a broken
path, the entire indexing would fail.

Now passes the vault name explicitly:
  qmd update <vault_name>
  qmd embed -c <vault_name>

This makes reindex independent of other qmd collections on the system.
This commit is contained in:
lucaronin
2026-03-07 10:08:39 +01:00
parent 99112617bf
commit 5324f729a9

View File

@@ -464,7 +464,9 @@ where
ensure_collection(vault_path)?;
// Phase 1: update (scan files)
let vault_name = vault_dir_name(vault_path);
// Phase 1: update (scan files) — scoped to this vault's collection only
on_progress(IndexingProgress {
phase: "scanning".to_string(),
current: 0,
@@ -475,7 +477,7 @@ where
let update_output = qmd
.command()
.args(["update"])
.args(["update", &vault_name])
.output()
.map_err(|e| format!("qmd update failed: {e}"))?;
@@ -504,7 +506,7 @@ where
error: None,
});
// Phase 2: embed (generate vectors)
// Phase 2: embed (generate vectors) — scoped to this vault's collection only
on_progress(IndexingProgress {
phase: "embedding".to_string(),
current: 0,
@@ -515,7 +517,7 @@ where
let embed_output = qmd
.command()
.args(["embed"])
.args(["embed", "-c", &vault_name])
.output()
.map_err(|e| format!("qmd embed failed: {e}"))?;
@@ -579,7 +581,7 @@ pub fn run_incremental_update(vault_path: &str) -> Result<(), String> {
let output = qmd
.command()
.args(["update"])
.args(["update", &vault_name])
.output()
.map_err(|e| format!("qmd incremental update failed: {e}"))?;