feat(related): add semantic similarity discovery command
Implement `lore related` command for discovering semantically similar entities using vector embeddings. Supports two modes: Entity mode: lore related issues 42 # Find entities similar to issue #42 lore related mrs 99 # Find entities similar to MR !99 Query mode: lore related "auth bug" # Find entities matching free text query Key features: - Uses existing embedding infrastructure (nomic-embed-text via Ollama) - Computes shared labels between source and results - Shows similarity scores as percentage (0-100%) - Warns when all results have low similarity (<30%) - Warns for short queries (<=2 words) that may produce noisy results - Filters out discussion/note documents, returning only issues and MRs - Handles orphaned documents gracefully (skips if entity deleted) - Robot mode JSON output with {ok, data, meta} envelope Implementation details: - distance_to_similarity() converts L2 distance to 0-1 score: 1/(1+distance) - Uses saturating_add/saturating_mul for overflow safety on limit parameter - Proper error handling for missing embeddings ("run lore embed first") - Project scoping via -p flag with fuzzy matching CLI integration: - Added to autocorrect.rs command registry - Added Related variant to Commands enum in cli/mod.rs - Wired into main.rs with handle_related() Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -183,6 +183,7 @@ const COMMAND_FLAGS: &[(&str, &[&str])] = &[
|
||||
"--max-evidence",
|
||||
],
|
||||
),
|
||||
("related", &["--limit", "--project"]),
|
||||
(
|
||||
"who",
|
||||
&[
|
||||
|
||||
Reference in New Issue
Block a user