Extract lib.rs, inline search in memory-search hook

Create lib.rs so all binaries can share library code directly instead
of shelling out to poc-memory. memory-search now calls search::search()
and store::Store::load() in-process instead of Command::new("poc-memory").

The load-context call still shells out (needs get_group_content moved
from main.rs to a library module).

Also: add search::format_results(), deduplicate extract_query_terms.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Kent Overstreet 2026-03-05 22:23:03 -05:00
parent 0c15002797
commit aa24c40a1c
5 changed files with 59 additions and 31 deletions

View file

@ -6,7 +6,7 @@ use std::fs;
use std::path::PathBuf;
/// Ensure a subdirectory of the memory dir exists and return its path.
pub(crate) fn memory_subdir(name: &str) -> Result<PathBuf, String> {
pub fn memory_subdir(name: &str) -> Result<PathBuf, String> {
let dir = store::memory_dir().join(name);
fs::create_dir_all(&dir)
.map_err(|e| format!("create {}: {}", dir.display(), e))?;