@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.
Files changed (2) hide show
  1. package/cli.ts +28 -25
  2. 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
- // Route semantic vs FTS5 based on --exact flag and availability
228
- if (!exact) {
227
+ // FTS5 path (explicit --exact only)
228
+ if (exact) {
229
229
  try {
230
- const canUseSemantic = hasEmbeddings() && (await isOllamaAvailable());
231
- if (canUseSemantic) {
232
- const results = await semanticSearch(query, { source, limit });
233
- output({
234
- success: true,
235
- results,
236
- count: results.length,
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
- `⚠️ Semantic search unavailable: ${error instanceof Error ? error.message : "Unknown error"}`,
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 = search(query, { source, limit, since });
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: exact ? "exact" : "fts5",
263
+ mode: "semantic",
261
264
  });
262
265
  console.error(
263
- `✅ ${results.length} result${results.length !== 1 ? "s" : ""} found (${exact ? "exact" : "fts5"})`,
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, 2);
271
+ fail(`Semantic search failed: ${message}`, 2);
269
272
  }
270
273
  }
271
274
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voidwire/lore",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Unified knowledge CLI - Search, list, and capture your indexed knowledge",
5
5
  "type": "module",
6
6
  "main": "./index.ts",