@voidwire/lore 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.ts +28 -25
- package/package.json +1 -1
package/cli.ts
CHANGED
|
@@ -224,48 +224,51 @@ async function handleSearch(args: string[]): Promise<void> {
|
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
//
|
|
228
|
-
if (
|
|
227
|
+
// FTS5 path (explicit --exact only)
|
|
228
|
+
if (exact) {
|
|
229
229
|
try {
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
mode: "semantic",
|
|
238
|
-
});
|
|
239
|
-
console.error(
|
|
240
|
-
`✅ ${results.length} result${results.length !== 1 ? "s" : ""} found (semantic)`,
|
|
241
|
-
);
|
|
242
|
-
process.exit(0);
|
|
243
|
-
}
|
|
244
|
-
// Fall through to FTS5 if semantic not available
|
|
245
|
-
} catch (error) {
|
|
246
|
-
// Semantic search failed, fall back to FTS5
|
|
230
|
+
const results = search(query, { source, limit, since });
|
|
231
|
+
output({
|
|
232
|
+
success: true,
|
|
233
|
+
results,
|
|
234
|
+
count: results.length,
|
|
235
|
+
mode: "exact",
|
|
236
|
+
});
|
|
247
237
|
console.error(
|
|
248
|
-
|
|
238
|
+
`✅ ${results.length} result${results.length !== 1 ? "s" : ""} found (exact)`,
|
|
249
239
|
);
|
|
240
|
+
process.exit(0);
|
|
241
|
+
} catch (error) {
|
|
242
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
243
|
+
fail(message, 2);
|
|
250
244
|
}
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Semantic path (default) - fail if unavailable
|
|
249
|
+
if (!hasEmbeddings()) {
|
|
250
|
+
fail("No embeddings found. Run lore-embed-all first.", 2);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (!(await isOllamaAvailable())) {
|
|
254
|
+
fail("Ollama not available. Start Ollama or check SQLITE_VEC_PATH.", 2);
|
|
251
255
|
}
|
|
252
256
|
|
|
253
|
-
// FTS5 path (default fallback or explicit --exact)
|
|
254
257
|
try {
|
|
255
|
-
const results =
|
|
258
|
+
const results = await semanticSearch(query, { source, limit });
|
|
256
259
|
output({
|
|
257
260
|
success: true,
|
|
258
261
|
results,
|
|
259
262
|
count: results.length,
|
|
260
|
-
mode:
|
|
263
|
+
mode: "semantic",
|
|
261
264
|
});
|
|
262
265
|
console.error(
|
|
263
|
-
`✅ ${results.length} result${results.length !== 1 ? "s" : ""} found (
|
|
266
|
+
`✅ ${results.length} result${results.length !== 1 ? "s" : ""} found (semantic)`,
|
|
264
267
|
);
|
|
265
268
|
process.exit(0);
|
|
266
269
|
} catch (error) {
|
|
267
270
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
268
|
-
fail(message
|
|
271
|
+
fail(`Semantic search failed: ${message}`, 2);
|
|
269
272
|
}
|
|
270
273
|
}
|
|
271
274
|
|