feat(cli): Wire --full flag for embed, add sync stage spinners
- Add --full / --no-full flag pair to EmbedArgs with overrides_with semantics matching the existing flag pattern. When active, atomically DELETEs all embedding_metadata and embeddings before re-embedding. - Thread the full flag through run_embed -> run_sync so that 'lore sync --full' triggers a complete re-embed alongside the full re-ingest it already performed. - Add indicatif spinners to sync stages with dynamic stage numbering that adjusts when --no-docs or --no-embed skip stages. Spinners are hidden in robot mode. - Update robot-docs manifest to advertise the new --full flag on the embed command. - Replace hardcoded schema version 9 in health check with the LATEST_SCHEMA_VERSION constant from db.rs. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,7 @@ pub struct EmbedCommandResult {
|
||||
/// Run the embed command.
|
||||
pub async fn run_embed(
|
||||
config: &Config,
|
||||
full: bool,
|
||||
retry_failed: bool,
|
||||
) -> Result<EmbedCommandResult> {
|
||||
let db_path = get_db_path(config.storage.db_path.as_deref());
|
||||
@@ -37,8 +38,18 @@ pub async fn run_embed(
|
||||
// Health check — fail fast if Ollama is down or model missing
|
||||
client.health_check().await?;
|
||||
|
||||
// If retry_failed, clear errors so they become pending again
|
||||
if retry_failed {
|
||||
if full {
|
||||
// Clear ALL embeddings and metadata atomically for a complete re-embed.
|
||||
// Wrapped in a transaction so a crash between the two DELETEs can't
|
||||
// leave orphaned data.
|
||||
conn.execute_batch(
|
||||
"BEGIN;
|
||||
DELETE FROM embedding_metadata;
|
||||
DELETE FROM embeddings;
|
||||
COMMIT;",
|
||||
)?;
|
||||
} else if retry_failed {
|
||||
// Clear errors so they become pending again
|
||||
conn.execute(
|
||||
"UPDATE embedding_metadata SET last_error = NULL, attempt_count = 0
|
||||
WHERE last_error IS NOT NULL",
|
||||
|
||||
Reference in New Issue
Block a user