Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

autoindex remove: --uncataloged cleans up a build that never reached finalize (#2663)

xerj-orgb38c4724c1ac
diff --git a/engine/crates/xerj-autoindex/src/cli.rs b/engine/crates/xerj-autoindex/src/cli.rs
index 4b1ae506e..782b2d738 100644
--- a/engine/crates/xerj-autoindex/src/cli.rs
+++ b/engine/crates/xerj-autoindex/src/cli.rs
@@ -208,6 +208,9 @@ pub struct RemoveCfg {
/// When set, `remove` also deletes `journal.ndjson` here. The default
/// journal for the selected folder is deleted either way.
pub state_dir: Option<PathBuf>,
+ /// `--uncataloged`: when the prefix has no catalog run and no resume
+ /// journal, delete the live `<prefix>-*` indices nothing names (#2405).
+ pub uncataloged: bool,
}
/// `xerj autoindex s3://bucket/prefix --watch`: poll a bucket and emit a change
@@ -314,7 +317,7 @@ pub fn help_text_with(feedback: bool) -> String {
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20--dry-run`: walk, sniff, infer, print the plan.\n\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Nothing is written to an index. With no\n\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20folder, `map` reads the catalog on --url\n\
- \x20\x20\x20\x20xerj autoindex remove --prefix <P> [--root <DIR>] [--yes]\n\
+ \x20\x20\x20\x20xerj autoindex remove --prefix <P> [--root <DIR>] [--uncataloged] [--yes]\n\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20list one folder's indices and catalog rows,\n\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20then delete them. Nothing is deleted without\n\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20--yes or a terminal y. Another folder under\n\
@@ -322,6 +325,10 @@ pub fn help_text_with(feedback: bool) -> String {
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20build of this folder left, with no catalog run, is\n\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20included. A cataloged index another folder still names\n\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20is left in place.\n\
+\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20With --uncataloged, a prefix with no catalog run\n\
+\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20and no resume journal (a build that never reached\n\
+\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20finalize, its journal gone) drops the live <P>-*\n\
+\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20indices that no catalog row names.\n\
\x20\x20\x20\x20xerj autoindex status [OPTIONS] resume-journal + index progress view\n\
\x20\x20\x20\x20xerj autoindex s3://bucket/prefix --watch [OPTIONS]\n\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20poll object storage and emit a change feed\n\
@@ -961,6 +968,7 @@ pub fn parse(args: Vec<String>) -> Result<Cmd, String> {
// is not a confirmation for `autoindex remove`.
let mut yes_flag = false;
let mut remove_root: Option<String> = None;
+ let mut remove_uncataloged = false;
let mut markdown = false;
let mut code_analyzer_explicit = false;
let mut max_index_bytes: Option<u64> = None;
@@ -1243,6 +1251,12 @@ pub fn parse(args: Vec<String>) -> Result<Cmd, String> {
code_analyzer = crate::infer::CodeAnalyzer::parse(&raw)?;
code_analyzer_explicit = true;
}
+ "--uncataloged" => {
+ if remove_uncataloged {
+ return Err("--uncataloged was given twice".into());
+ }
+ remove_uncataloged = true;
+ }
"--root" => {
let raw = it
.next()
@@ -1894,6 +1908,14 @@ pub fn parse(args: Vec<String>) -> Result<Cmd, String> {
})));
}
+ if remove_uncataloged && sub.as_deref() != Some("remove") {
+ return Err(
+ "--uncataloged selects the uncataloged indices `autoindex remove` drops. It is only \
+ supported with `autoindex remove --prefix <P> --uncataloged`."
+ .into(),
+ );
+ }
+
if remove_root.is_some() && sub.as_deref() != Some("remove") {
return Err(
"--root names the folder `autoindex remove` drops. It is only supported with \
@@ -1914,6 +1936,7 @@ pub fn parse(args: Vec<String>) -> Result<Cmd, String> {
quiet,
xerj_url_note,
state_dir: state_dir.clone(),
+ uncataloged: remove_uncataloged,
},
prefix_explicit,
approve_set: approve.is_some(),
@@ -3109,6 +3132,20 @@ mod tests {
Some(std::path::Path::new("/tmp/j"))
);
assert!(err(&["data", "--root", "/tmp/a"]).contains("only supported with"));
+ // #2405: the uncataloged opt-in parses for remove and only for remove.
+ let cfg = match parse(
+ ["remove", "--prefix", "proj", "--uncataloged", "--yes"]
+ .into_iter()
+ .map(str::to_string)
+ .collect(),
+ )
+ .unwrap()
+ {
+ Cmd::Remove(cfg) => cfg,
+ other => panic!("expected remove, got {other:?}"),
+ };
+ assert!(cfg.uncataloged);
+ assert!(err(&["data", "--uncataloged"]).contains("only supported with"));
assert!(err(&["remove", "--prefix", "proj", "--approve", "proceed"]).contains("--yes"));
assert!(super::help_text().contains("autoindex remove"));
}
diff --git a/engine/crates/xerj-autoindex/src/lib.rs b/engine/crates/xerj-autoindex/src/lib.rs
index 1d4fa0128..208a61e0c 100644
--- a/engine/crates/xerj-autoindex/src/lib.rs
+++ b/engine/crates/xerj-autoindex/src/lib.rs
@@ -13120,6 +13120,7 @@ fn run_remove(cfg: cli::RemoveCfg) -> Result<i32> {
yes: cfg.yes,
prompt,
state_dir: cfg.state_dir,
+ uncataloged: cfg.uncataloged,
})?;
println!(
"{}",
diff --git a/engine/crates/xerj-autoindex/src/remove.rs b/engine/crates/xerj-autoindex/src/remove.rs
index f6a382cf0..19ce1ca85 100644
--- a/engine/crates/xerj-autoindex/src/remove.rs
+++ b/engine/crates/xerj-autoindex/src/remove.rs
@@ -88,6 +88,12 @@ pub struct RemovePlan {
kept_indices: Vec<Kept>,
rows: Vec<Row>,
kept_rows: Vec<Row>,
+ /// Live `{prefix}-*` indices that no catalog row and no resume journal
+ /// names, found only when the plan is otherwise empty (#2405). Listed,
+ /// and deleted only with [`RemoveRequest::uncataloged`].
+ uncataloged: Vec<LiveIndex>,
+ /// This plan deletes `uncataloged` (the caller passed `--uncataloged`).
+ uncataloged_selected: bool,
}
#[derive(Debug, Clone)]
@@ -133,6 +139,13 @@ pub struct RemoveRequest {
/// prefix) is always removed after a successful delete; this one is too,
/// because the default hash cannot find a journal the operator moved.
pub state_dir: Option<PathBuf>,
+ /// `--uncataloged`: when the prefix has no catalog run and no unfinished
+ /// resume journal, delete the live `{prefix}-*` indices that no catalog
+ /// row names (#2405). A build killed before finalize whose journal is
+ /// gone (another machine, another HOME, a discarded state dir) leaves
+ /// exactly that. Without this flag those indices are only listed: a
+ /// `{prefix}-*` index nothing names is not assumed to be autoindex's.
+ pub uncataloged: bool,
}
pub struct RemoveReport {
@@ -158,9 +171,23 @@ pub fn execute(req: RemoveRequest) -> Result<RemoveReport> {
}
}
let live = fetch_live(&es, &mentioned)?;
- let plan = plan_remove(&req.prefix, req.root.as_deref(), &docs, &live, &aborted);
+ let mut plan = plan_remove(&req.prefix, req.root.as_deref(), &docs, &live, &aborted);
+ if plan.empty && req.root.is_none() {
+ // Best effort: a failed listing keeps the old "nothing to remove".
+ let names =
+ uncataloged_index_names(&es, &req.prefix, &docs, &mentioned).unwrap_or_default();
+ if !names.is_empty() {
+ plan.uncataloged = fetch_live(&es, &names)?;
+ if req.uncataloged {
+ select_uncataloged(&mut plan);
+ }
+ }
+ }
if plan.needs_root || plan.root_not_found || plan.empty {
- let code = if plan.empty || plan.root_not_found {
+ let code = if plan.empty && !plan.uncataloged.is_empty() {
+ // A decision is required: `--uncataloged` names these indices.
+ EXIT_NEEDS_DECISION
+ } else if plan.empty || plan.root_not_found {
1
} else {
EXIT_NEEDS_DECISION
@@ -620,6 +647,8 @@ pub fn plan_remove(
kept_indices,
rows,
kept_rows,
+ uncataloged: Vec::new(),
+ uncataloged_selected: false,
}
}
@@ -1053,6 +1082,68 @@ fn index_names_of(docs: &[CatalogDoc], prefix: &str) -> BTreeSet<String> {
names
}
+/// Live `{prefix}-*` indices that no catalog row read for this command names
+/// (dataset rows of every prefix, run edges, correlation sides), that are not
+/// a longer sibling prefix's, and that `remove` may delete (#2405).
+fn uncataloged_index_names(
+ es: &Es,
+ prefix: &str,
+ docs: &[CatalogDoc],
+ mentioned: &BTreeSet<String>,
+) -> Result<BTreeSet<String>> {
+ let live = es.cat_indices_json(&format!("{prefix}-*"))?;
+ let refs: Vec<&CatalogDoc> = docs.iter().collect();
+ Ok(uncataloged_among(prefix, &live, &refs, mentioned))
+}
+
+fn uncataloged_among(
+ prefix: &str,
+ live: &[String],
+ docs: &[&CatalogDoc],
+ mentioned: &BTreeSet<String>,
+) -> BTreeSet<String> {
+ let siblings = sibling_prefixes_of(docs, prefix);
+ let mut claimed: BTreeSet<String> = mentioned.clone();
+ for doc in docs {
+ for key in ["index_name", "a_index", "b_index"] {
+ if let Some(name) = doc.source.get(key).and_then(Value::as_str) {
+ claimed.insert(name.to_string());
+ }
+ }
+ if let Some(name) = edges_index(&doc.source) {
+ claimed.insert(name);
+ }
+ if let Some(plan) = doc.source.get("plan") {
+ collect_dataset_indices(plan, &mut claimed);
+ }
+ }
+ live.iter()
+ .filter(|name| deletable_index(name))
+ .filter(|name| !name.starts_with('.'))
+ .filter(|name| index_owned_by_prefix(name, prefix, &siblings))
+ .filter(|name| !claimed.contains(*name))
+ .cloned()
+ .collect()
+}
+
+/// Turn an empty plan into one that deletes its uncataloged indices.
+fn select_uncataloged(plan: &mut RemovePlan) {
+ plan.indices = plan
+ .uncataloged
+ .iter()
+ .map(|live| PlannedIndex {
+ name: live.name.clone(),
+ live_docs: Some(live.docs),
+ store_bytes: Some(live.store_bytes),
+ record_count: 0,
+ catalog_bytes: 0,
+ orphan: true,
+ })
+ .collect();
+ plan.uncataloged_selected = true;
+ plan.empty = plan.indices.is_empty();
+}
+
fn fetch_catalog(es: &Es, prefix: &str) -> Result<Vec<CatalogDoc>> {
let mut docs = Vec::new();
docs.extend(search_kind(es, json!({"term": {"doc_kind": "run"}}))?);
@@ -1385,6 +1476,11 @@ fn plan_body(plan: &RemovePlan, exit_code: i32, deleted: bool, error: Option<Str
row.doc_kind != "run" || plan.roots.iter().any(|g| g.display == row.root || g.key == root_key(&row.root))
}).map(row_json).collect::<Vec<_>>(),
},
+ "uncataloged": plan.uncataloged.iter().map(|idx| json!({
+ "name": idx.name,
+ "docs": idx.docs,
+ "store_bytes": idx.store_bytes,
+ })).collect::<Vec<_>>(),
"error": error,
})
}
@@ -1432,6 +1528,23 @@ fn summary_text(plan: &RemovePlan, exit_code: i32, deleted: bool, error: Option<
lines.push(
"error: --root does not match a folder under this prefix. Nothing was deleted.".into(),
);
+ } else if plan.empty && !plan.uncataloged.is_empty() {
+ lines.push(format!(
+ "no resume journal under this prefix either. These live {}-* indices are named by \
+ no catalog row (a build that never reached finalize, or indices made by hand):",
+ plan.prefix
+ ));
+ for idx in &plan.uncataloged {
+ lines.push(format!(
+ " index {} live docs {} store {}b",
+ idx.name, idx.docs, idx.store_bytes
+ ));
+ }
+ lines.push(format!(
+ "Nothing was deleted. To delete exactly these, rerun:\n xerj autoindex remove \
+ --prefix {} --uncataloged --yes",
+ shell_quote(&plan.prefix)
+ ));
} else if plan.empty {
lines.push("error: nothing under this prefix to remove. Nothing was deleted.".into());
} else {
@@ -1448,7 +1561,9 @@ fn summary_text(plan: &RemovePlan, exit_code: i32, deleted: bool, error: Option<
.store_bytes
.map(|n| format!("{n}b"))
.unwrap_or_else(|| "unknown".into());
- let orphan = if idx.orphan {
+ let orphan = if plan.uncataloged_selected {
+ " no catalog row, no resume journal"
+ } else if idx.orphan {
" aborted build, no catalog run"
} else {
""
@@ -1795,6 +1910,7 @@ mod tests {
yes: false,
prompt: false,
state_dir: None,
+ uncataloged: false,
})
.expect("plan");
assert_eq!(report.exit_code, EXIT_NEEDS_DECISION, "{}", report.summary);
@@ -1828,6 +1944,7 @@ mod tests {
yes: true,
prompt: false,
state_dir: None,
+ uncataloged: false,
})
.expect("plan");
assert_eq!(report.exit_code, EXIT_NEEDS_DECISION, "{}", report.summary);
@@ -1856,6 +1973,7 @@ mod tests {
yes: true,
prompt: false,
state_dir: None,
+ uncataloged: false,
})
.expect("remove");
assert_eq!(report.exit_code, 0, "{}\n{}", report.summary, report.body);
@@ -1888,9 +2006,101 @@ mod tests {
);
}
+ /// #2405: a build killed before finalize, with its journal gone, leaves
+ /// live `{prefix}-*` indices and no catalog row. `remove --prefix` used to
+ /// say "nothing under this prefix" and delete nothing.
+ #[test]
+ fn uncataloged_indices_are_listed_and_deleted_only_with_the_opt_in() {
+ let other = vec![
+ run("run:o", "zq-2", "/data/o", "2026-01-01T00:00:00Z"),
+ dataset("ds:zq-2:docs", "zq-2-docs", "docs", "o", 1, 1),
+ ];
+ let live = ["zq-docs", "zq-code", "zq-2-docs"];
+ let request = |url: String, uncataloged: bool| RemoveRequest {
+ url,
+ api_key: None,
+ prefix: "zq".into(),
+ root: None,
+ yes: true,
+ prompt: false,
+ state_dir: None,
+ uncataloged,
+ };
+
+ let (url, log) = spawn_catalog_server_with(&other, &live);
+ let report = execute(request(url, false)).expect("plan");
+ assert_eq!(report.exit_code, EXIT_NEEDS_DECISION, "{}", report.summary);
+ assert_eq!(report.body["deleted"], false);
+ let listed: Vec<&str> = report.body["uncataloged"]
+ .as_array()
+ .unwrap()
+ .iter()
+ .map(|v| v["name"].as_str().unwrap())
+ .collect();
+ assert_eq!(listed, vec!["zq-code", "zq-docs"], "{}", report.summary);
+ assert!(
+ report
+ .summary
+ .contains("xerj autoindex remove --prefix zq --uncataloged --yes"),
+ "{}",
+ report.summary
+ );
+ let calls = log.lock().unwrap().clone();
+ assert!(
+ calls.iter().all(|c| !c.starts_with("DELETE ")),
+ "listing is not deleting: {calls:?}"
+ );
+
+ let (url, log) = spawn_catalog_server_with(&other, &live);
+ let report = execute(request(url, true)).expect("remove");
+ assert_eq!(report.exit_code, 0, "{}", report.summary);
+ assert_eq!(report.body["deleted"], true);
+ let calls = log.lock().unwrap().clone();
+ let deletes: Vec<&String> = calls.iter().filter(|c| c.starts_with("DELETE ")).collect();
+ assert_eq!(
+ deletes,
+ vec!["DELETE /zq-code", "DELETE /zq-docs"],
+ "the sibling prefix's cataloged index stays: {calls:?}"
+ );
+ }
+
+ #[test]
+ fn uncataloged_skips_claimed_sibling_dotted_and_catalog_indices() {
+ let docs = [
+ run("run:o", "zq-2", "/data/o", "2026-01-01T00:00:00Z"),
+ dataset("ds:other:x", "zq-claimed", "x", "o", 1, 1),
+ ];
+ let refs: Vec<&CatalogDoc> = docs.iter().collect();
+ let live: Vec<String> = [
+ "zq-docs",
+ "zq-claimed",
+ "zq-2-docs",
+ CATALOG_INDEX,
+ ".zq-hidden",
+ "zqx-docs",
+ ]
+ .iter()
+ .map(|s| s.to_string())
+ .collect();
+ let got = uncataloged_among("zq", &live, &refs, &BTreeSet::new());
+ assert_eq!(
+ got.into_iter().collect::<Vec<_>>(),
+ vec!["zq-docs".to_string()]
+ );
+ }
+
fn spawn_catalog_server(
docs: &[CatalogDoc],
) -> (String, std::sync::Arc<std::sync::Mutex<Vec<String>>>) {
+ spawn_catalog_server_with(docs, &[])
+ }
+
+ /// Like [`spawn_catalog_server`], and `GET /_cat/indices/...` lists `live`.
+ fn spawn_catalog_server_with(
+ docs: &[CatalogDoc],
+ live: &[&str],
+ ) -> (String, std::sync::Arc<std::sync::Mutex<Vec<String>>>) {
+ let cat = Value::Array(live.iter().map(|n| json!({"index": n})).collect()).to_string();
use std::io::{Read, Write};
use std::net::TcpListener;
use std::sync::{Arc, Mutex};
@@ -1920,7 +2130,7 @@ mod tests {
Ok(n) => {
buf.extend_from_slice(&tmp[..n]);
while let Some((head, body)) = take_http(&mut buf) {
- let resp = answer(&head, &body, &catalog, &log_thread);
+ let resp = answer(&head, &body, &catalog, &cat, &log_thread);
if stream.write_all(resp.as_bytes()).is_err() {
return;
}
@@ -1965,6 +2175,7 @@ mod tests {
head: &str,
body: &[u8],
catalog: &str,
+ cat: &str,
log: &std::sync::Arc<std::sync::Mutex<Vec<String>>>,
) -> String {
let req = head.lines().next().unwrap_or("");
@@ -1980,6 +2191,8 @@ mod tests {
"{}".into()
} else if path.contains("_search") {
catalog.to_string()
+ } else if path.starts_with("/_cat/indices") {
+ cat.to_string()
} else if path.ends_with("/_stats") {
let name = path.trim_start_matches('/').trim_end_matches("/_stats");
let (docs, bytes) = if name == "ax-only-a" {
@@ -2324,6 +2537,7 @@ mod tests {
yes: true,
prompt: false,
state_dir: Some(state.path().to_path_buf()),
+ uncataloged: false,
})
.expect("remove");
assert_eq!(report.exit_code, 0, "{}\n{}", report.summary, report.body);
diff --git a/engine/crates/xerj-mcp/src/lib.rs b/engine/crates/xerj-mcp/src/lib.rs
index 265a2d5ce..90a9e1107 100644
--- a/engine/crates/xerj-mcp/src/lib.rs
+++ b/engine/crates/xerj-mcp/src/lib.rs
@@ -1431,6 +1431,10 @@ pub fn tool_specs_with(include_hub: bool) -> Value {
"confirm": {
"type": "boolean",
"description": "Delete what the plan lists. false, or omitted, prints the plan and deletes nothing."
+ },
+ "uncataloged": {
+ "type": "boolean",
+ "description": "Only when the plan says the prefix has no catalog run and no resume journal and lists `uncataloged` indices (a build that never reached finalize): include those live `<prefix>-*` indices in the plan. They are deleted only with `confirm: true`."
}
},
"required": ["prefix"]
@@ -3121,6 +3125,16 @@ async fn run_autoindex_remove(ctx: &Ctx, args: &Value) -> Value {
Some(Value::Bool(true)) => true,
Some(_) => return tool_text("xerj_autoindex_remove: `confirm` must be a boolean", true),
};
+ let uncataloged = match args.get("uncataloged") {
+ None | Some(Value::Null) | Some(Value::Bool(false)) => false,
+ Some(Value::Bool(true)) => true,
+ Some(_) => {
+ return tool_text(
+ "xerj_autoindex_remove: `uncataloged` must be a boolean",
+ true,
+ )
+ }
+ };
let url = ctx.base_url.clone();
let api_key = api_key_from_header(ctx.auth.clone());
let joined = tokio::task::spawn_blocking(move || {
@@ -3132,6 +3146,7 @@ async fn run_autoindex_remove(ctx: &Ctx, args: &Value) -> Value {
yes: confirm,
prompt: false,
state_dir: None,
+ uncataloged,
})
})
.await;
diff --git a/landing/docs/agents/schemas/mcp-tools.json b/landing/docs/agents/schemas/mcp-tools.json
index 321ab577e..6b832de6f 100644
--- a/landing/docs/agents/schemas/mcp-tools.json
+++ b/landing/docs/agents/schemas/mcp-tools.json
@@ -731,6 +731,10 @@
"confirm": {
"type": "boolean",
"description": "Delete what the plan lists. false, or omitted, prints the plan and deletes nothing."
+ },
+ "uncataloged": {
+ "type": "boolean",
+ "description": "Only when the plan says the prefix has no catalog run and no resume journal and lists `uncataloged` indices (a build that never reached finalize): include those live `<prefix>-*` indices in the plan. They are deleted only with `confirm: true`."
}
},
"required": [