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.
Rust agent-memoryai-agentsbm25claude-codeclicode-searchcursordatabaseelasticsearchfull-text-searchhybrid-searchjsonllocal-firstmcpmcp-servermodel-context-protocolragrustsearch-enginevector-search
fix(ask): point a local autoindex at xerj search (#1698)
xerj-org8e3be5d6a54a
diff --git a/engine/crates/xerj-common/src/hub.rs b/engine/crates/xerj-common/src/hub.rsindex 89bd7342b..d3f99f5d5 100644--- a/engine/crates/xerj-common/src/hub.rs+++ b/engine/crates/xerj-common/src/hub.rs@@ -107,7 +107,8 @@ pub fn hub_key_configured() -> bool {pub const NO_HUB_KEY_MESSAGE: &str = "Corpus Hub packs are not available in this build: it has \no hub signing key, so no catalogue or pack can be verified and nothing was downloaded. \For reference code, index the projects yourself with `xerj corpus add` and search them \- with `xerj code` (see `xerj code --help`).";+ with `xerj code` (see `xerj code --help`). A folder you indexed with `xerj autoindex` \+ is queried with `xerj search` or `xerj def`, not `xerj ask`.";/// What a per-source licence review allows, straight from the registry's/// `review.use`. Governs whether a pack is pulled silently, with a warning, or@@ -400,6 +401,15 @@ mod tests {use super::*;use serde_json::json;+ #[test]+ fn a_build_without_a_hub_key_points_ask_at_local_search() {+ assert!(NO_HUB_KEY_MESSAGE.contains("`xerj search`"));+ assert!(NO_HUB_KEY_MESSAGE.contains("`xerj def`"));+ assert!(NO_HUB_KEY_MESSAGE.contains("`xerj autoindex`"));+ assert!(NO_HUB_KEY_MESSAGE.contains("not `xerj ask`"));+ assert!(!NO_HUB_KEY_MESSAGE.contains("xerj hub sync"));+ }+#[test]fn the_compiled_in_hub_key_is_32_bytes_of_lower_hex() {// The workflows read it with a `[0-9a-fA-F]*` sed and compare lower-case;diff --git a/engine/crates/xerj-server/src/main.rs b/engine/crates/xerj-server/src/main.rsindex abb709207..c5af4c167 100644--- a/engine/crates/xerj-server/src/main.rs+++ b/engine/crates/xerj-server/src/main.rs@@ -491,14 +491,33 @@ fn ask_help_lines(hub: bool) -> &'static str {\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(see xerj ask --help); `xerj \"<question>\"`\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\x20is the same\n"} else {- "\x20\x20\x20\x20xerj ask \"<question>\" Corpus Hub answers: not available in this\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\x20build (no hub signing key; exits 5) - use\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\x20xerj corpus + xerj code instead\n"+ "\x20\x20\x20\x20xerj ask \"<question>\" Corpus Hub answers: not available in this\n\+ \x20\x20\x20\x20build (no hub signing key; exits 5).\n\+ \x20\x20\x20\x20A folder you autoindexed: xerj search / xerj def.\n\+ \x20\x20\x20\x20Public libraries: xerj corpus + xerj code\n"}}/// How many tools `xerj mcp` serves — the length of the same `tool_specs()`/// array its `tools/list` returns.+#[cfg(test)]+mod ask_help_tests {+ use super::ask_help_lines;++ #[test]+ fn a_build_without_a_hub_key_does_not_send_ask_at_the_local_index() {+ let lines = ask_help_lines(false);+ assert!(lines.contains("exits 5"), "{lines}");+ assert!(lines.contains("xerj search"), "{lines}");+ assert!(lines.contains("xerj def"), "{lines}");+ assert!(lines.contains("xerj corpus"), "{lines}");+ assert!(+ ask_help_lines(true).contains("xerj ask"),+ "a build with a key still documents the command"+ );+ }+}+fn mcp_tool_count() -> usize {xerj_mcp::tool_specs().as_array().map_or(0, Vec::len)}