Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

feat(cli): add reindex command to trigger content re-indexing (#795)

Matt Van Horndbfdb5155e44
diff --git a/crates/ov_cli/src/client.rs b/crates/ov_cli/src/client.rs
index 46166e666..b360f316a 100644
--- a/crates/ov_cli/src/client.rs
+++ b/crates/ov_cli/src/client.rs
@@ -307,6 +307,15 @@ impl HttpClient {
self.get("/api/v1/content/overview", &params).await
}
+ pub async fn reindex(&self, uri: &str, regenerate: bool, wait: bool) -> Result<serde_json::Value> {
+ let body = serde_json::json!({
+ "uri": uri,
+ "regenerate": regenerate,
+ "wait": wait,
+ });
+ self.post("/api/v1/content/reindex", &body).await
+ }
+
/// Download file as raw bytes
pub async fn get_bytes(&self, uri: &str) -> Result<Vec<u8>> {
let url = format!("{}/api/v1/content/download", self.base_url);
diff --git a/crates/ov_cli/src/commands/content.rs b/crates/ov_cli/src/commands/content.rs
index c1673f102..7674d23e1 100644
--- a/crates/ov_cli/src/commands/content.rs
+++ b/crates/ov_cli/src/commands/content.rs
@@ -38,6 +38,19 @@ pub async fn overview(
Ok(())
}
+pub async fn reindex(
+ client: &HttpClient,
+ uri: &str,
+ regenerate: bool,
+ wait: bool,
+ output_format: OutputFormat,
+ compact: bool,
+) -> Result<()> {
+ let result = client.reindex(uri, regenerate, wait).await?;
+ crate::output::output_success(result, output_format, compact);
+ Ok(())
+}
+
pub async fn get(
client: &HttpClient,
uri: &str,
diff --git a/crates/ov_cli/src/main.rs b/crates/ov_cli/src/main.rs
index cf444d759..54d955d2b 100644
--- a/crates/ov_cli/src/main.rs
+++ b/crates/ov_cli/src/main.rs
@@ -264,6 +264,17 @@ enum Commands {
/// Viking URI
uri: String,
},
+ /// Reindex content at URI (regenerates .abstract.md and .overview.md)
+ Reindex {
+ /// Viking URI
+ uri: String,
+ /// Force regenerate summaries even if they exist
+ #[arg(short, long)]
+ regenerate: bool,
+ /// Wait for reindex to complete
+ #[arg(long, default_value = "true")]
+ wait: bool,
+ },
/// Download file to local path (supports binaries/images)
Get {
/// Viking URI
@@ -625,6 +636,9 @@ async fn main() {
Commands::Read { uri } => handle_read(uri, ctx).await,
Commands::Abstract { uri } => handle_abstract(uri, ctx).await,
Commands::Overview { uri } => handle_overview(uri, ctx).await,
+ Commands::Reindex { uri, regenerate, wait } => {
+ handle_reindex(uri, regenerate, wait, ctx).await
+ }
Commands::Get { uri, local_path } => handle_get(uri, local_path, ctx).await,
Commands::Find { query, uri, node_limit, threshold } => {
handle_find(query, uri, node_limit, threshold, ctx).await
@@ -953,6 +967,11 @@ async fn handle_overview(uri: String, ctx: CliContext) -> Result<()> {
commands::content::overview(&client, &uri, ctx.output_format, ctx.compact).await
}
+async fn handle_reindex(uri: String, regenerate: bool, wait: bool, ctx: CliContext) -> Result<()> {
+ let client = ctx.get_client();
+ commands::content::reindex(&client, &uri, regenerate, wait, ctx.output_format, ctx.compact).await
+}
+
async fn handle_get(uri: String, local_path: String, ctx: CliContext) -> Result<()> {
let client = ctx.get_client();
commands::content::get(&client, &uri, &local_path).await