@voidwire/lore 1.0.0 → 1.0.1
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/lib/db.ts +2 -2
- package/lib/info.ts +1 -5
- package/lib/list.ts +2 -7
- package/lib/projects.ts +1 -5
- package/lib/realtime.ts +1 -8
- package/lib/search.ts +1 -5
- package/package.json +1 -1
package/lib/db.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { Database } from "bun:sqlite";
|
|
9
9
|
import { existsSync } from "fs";
|
|
10
|
-
import {
|
|
10
|
+
import { getConfig } from "./config";
|
|
11
11
|
|
|
12
12
|
// Use Homebrew SQLite on macOS to enable extension loading
|
|
13
13
|
// Must be called before any Database instances are created
|
|
@@ -20,7 +20,7 @@ if (existsSync(HOMEBREW_SQLITE)) {
|
|
|
20
20
|
* Get the path to the lore database
|
|
21
21
|
*/
|
|
22
22
|
export function getDatabasePath(): string {
|
|
23
|
-
return
|
|
23
|
+
return getConfig().database.sqlite;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
package/lib/info.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { Database } from "bun:sqlite";
|
|
9
|
-
import { homedir } from "os";
|
|
10
9
|
import { existsSync } from "fs";
|
|
10
|
+
import { getDatabasePath } from "./db.js";
|
|
11
11
|
import { projects as getProjects } from "./projects.js";
|
|
12
12
|
|
|
13
13
|
export interface SourceInfo {
|
|
@@ -22,10 +22,6 @@ export interface InfoOutput {
|
|
|
22
22
|
total_entries: number;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
function getDatabasePath(): string {
|
|
26
|
-
return `${homedir()}/.local/share/lore/lore.db`;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
25
|
/**
|
|
30
26
|
* Get info about indexed sources
|
|
31
27
|
*
|
package/lib/list.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { Database } from "bun:sqlite";
|
|
9
|
-
import { homedir } from "os";
|
|
10
9
|
import { existsSync } from "fs";
|
|
10
|
+
import { getDatabasePath } from "./db.js";
|
|
11
11
|
|
|
12
12
|
// Source types - data sources that can be listed
|
|
13
13
|
export type Source =
|
|
@@ -85,11 +85,6 @@ export interface ListResult {
|
|
|
85
85
|
count: number;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
// Database path following XDG spec
|
|
89
|
-
function getDatabasePath(): string {
|
|
90
|
-
return `${homedir()}/.local/share/lore/lore.db`;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
88
|
interface RawRow {
|
|
94
89
|
title: string;
|
|
95
90
|
content: string;
|
|
@@ -196,7 +191,7 @@ export function list(source: Source, options: ListOptions = {}): ListResult {
|
|
|
196
191
|
const dbPath = getDatabasePath();
|
|
197
192
|
|
|
198
193
|
if (!existsSync(dbPath)) {
|
|
199
|
-
throw new Error(`Database not found: ${dbPath}. Run lore-
|
|
194
|
+
throw new Error(`Database not found: ${dbPath}. Run lore-db-init first.`);
|
|
200
195
|
}
|
|
201
196
|
|
|
202
197
|
const db = new Database(dbPath, { readonly: true });
|
package/lib/projects.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { Database } from "bun:sqlite";
|
|
9
|
-
import { homedir } from "os";
|
|
10
9
|
import { existsSync } from "fs";
|
|
10
|
+
import { getDatabasePath } from "./db.js";
|
|
11
11
|
|
|
12
12
|
const PROJECT_SOURCES = [
|
|
13
13
|
"commits",
|
|
@@ -20,10 +20,6 @@ const PROJECT_SOURCES = [
|
|
|
20
20
|
"observations",
|
|
21
21
|
];
|
|
22
22
|
|
|
23
|
-
function getDatabasePath(): string {
|
|
24
|
-
return `${homedir()}/.local/share/lore/lore.db`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
23
|
/**
|
|
28
24
|
* Get all unique project names across sources
|
|
29
25
|
*
|
package/lib/realtime.ts
CHANGED
|
@@ -23,12 +23,7 @@ import {
|
|
|
23
23
|
EMBEDDING_DIM,
|
|
24
24
|
serializeEmbedding,
|
|
25
25
|
} from "./semantic.js";
|
|
26
|
-
import {
|
|
27
|
-
hashContent,
|
|
28
|
-
getCachedEmbedding,
|
|
29
|
-
cacheEmbedding,
|
|
30
|
-
getMissingHashes,
|
|
31
|
-
} from "./cache.js";
|
|
26
|
+
import { hashContent, getCachedEmbedding, cacheEmbedding } from "./cache.js";
|
|
32
27
|
import type { CaptureEvent } from "./capture.js";
|
|
33
28
|
|
|
34
29
|
/**
|
|
@@ -182,12 +177,10 @@ function buildMetadata(event: CaptureEvent): string {
|
|
|
182
177
|
break;
|
|
183
178
|
case "teaching":
|
|
184
179
|
metadata.confidence = data.confidence;
|
|
185
|
-
metadata.capture_source = data.source || "manual";
|
|
186
180
|
break;
|
|
187
181
|
case "observation":
|
|
188
182
|
metadata.subtype = data.subtype;
|
|
189
183
|
metadata.confidence = data.confidence;
|
|
190
|
-
metadata.capture_source = data.source || "auto";
|
|
191
184
|
break;
|
|
192
185
|
case "insight":
|
|
193
186
|
metadata.subtype = data.subtype;
|
package/lib/search.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { Database } from "bun:sqlite";
|
|
9
|
-
import { homedir } from "os";
|
|
10
9
|
import { existsSync } from "fs";
|
|
10
|
+
import { getDatabasePath } from "./db.js";
|
|
11
11
|
|
|
12
12
|
export interface SearchResult {
|
|
13
13
|
rowid: number;
|
|
@@ -26,10 +26,6 @@ export interface SearchOptions {
|
|
|
26
26
|
type?: string | string[];
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
function getDatabasePath(): string {
|
|
30
|
-
return `${homedir()}/.local/share/lore/lore.db`;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
29
|
/**
|
|
34
30
|
* Escape a query for safe FTS5 MATCH
|
|
35
31
|
* Wraps terms in double quotes to prevent FTS5 syntax interpretation
|