@voidwire/lore 1.0.4 → 1.0.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 +5 -1
- package/lib/list.ts +25 -7
- package/lib/semantic.ts +8 -0
- package/package.json +1 -1
package/cli.ts
CHANGED
|
@@ -320,6 +320,7 @@ async function handleSearch(args: string[]): Promise<void> {
|
|
|
320
320
|
limit,
|
|
321
321
|
project,
|
|
322
322
|
type,
|
|
323
|
+
since,
|
|
323
324
|
});
|
|
324
325
|
|
|
325
326
|
if (brief) {
|
|
@@ -428,10 +429,11 @@ function handleList(args: string[]): void {
|
|
|
428
429
|
const format = parsed.get("format") || "json";
|
|
429
430
|
const project = parsed.get("project");
|
|
430
431
|
const type = parsed.get("type");
|
|
432
|
+
const since = parsed.get("since");
|
|
431
433
|
const brief = hasFlag(args, "brief");
|
|
432
434
|
|
|
433
435
|
try {
|
|
434
|
-
const result = list(source, { limit, project, type });
|
|
436
|
+
const result = list(source, { limit, project, type, since });
|
|
435
437
|
|
|
436
438
|
if (brief) {
|
|
437
439
|
console.log(formatBriefList(result));
|
|
@@ -934,6 +936,7 @@ List Options:
|
|
|
934
936
|
--format <fmt> Output format: json (default), jsonl, human
|
|
935
937
|
--brief Compact output (titles only)
|
|
936
938
|
--project <name> Filter by project name
|
|
939
|
+
--since <date> Filter by date (today, yesterday, this-week, YYYY-MM-DD)
|
|
937
940
|
|
|
938
941
|
Capture Types:
|
|
939
942
|
task Log task completion
|
|
@@ -1060,6 +1063,7 @@ Options:
|
|
|
1060
1063
|
--format <fmt> Output format: json (default), jsonl, human
|
|
1061
1064
|
--project <name> Filter by project name
|
|
1062
1065
|
--type <type> Filter captures by type (learning, gotcha, preference, decision)
|
|
1066
|
+
--since <date> Filter by date (today, yesterday, this-week, YYYY-MM-DD)
|
|
1063
1067
|
--brief Compact output (titles only)
|
|
1064
1068
|
--help Show this help
|
|
1065
1069
|
|
package/lib/list.ts
CHANGED
|
@@ -69,6 +69,7 @@ export interface ListOptions {
|
|
|
69
69
|
limit?: number;
|
|
70
70
|
project?: string;
|
|
71
71
|
type?: string;
|
|
72
|
+
since?: string;
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
export interface ListEntry {
|
|
@@ -102,6 +103,7 @@ function queryBySource(
|
|
|
102
103
|
limit?: number,
|
|
103
104
|
project?: string,
|
|
104
105
|
type?: string,
|
|
106
|
+
since?: string,
|
|
105
107
|
): ListEntry[] {
|
|
106
108
|
let sql =
|
|
107
109
|
"SELECT title, content, topic, type, metadata FROM search WHERE source = ?";
|
|
@@ -119,6 +121,12 @@ function queryBySource(
|
|
|
119
121
|
params.push(type);
|
|
120
122
|
}
|
|
121
123
|
|
|
124
|
+
// Add date filter if provided
|
|
125
|
+
if (since) {
|
|
126
|
+
sql += " AND timestamp IS NOT NULL AND timestamp != '' AND timestamp >= ?";
|
|
127
|
+
params.push(since);
|
|
128
|
+
}
|
|
129
|
+
|
|
122
130
|
// Order by timestamp descending (most recent first)
|
|
123
131
|
sql += " ORDER BY timestamp DESC";
|
|
124
132
|
|
|
@@ -146,16 +154,20 @@ function queryPersonalType(
|
|
|
146
154
|
db: Database,
|
|
147
155
|
type: string,
|
|
148
156
|
limit?: number,
|
|
157
|
+
since?: string,
|
|
149
158
|
): ListEntry[] {
|
|
150
159
|
// Filter by type in SQL, not JS - avoids LIMIT truncation bug
|
|
151
|
-
let sql =
|
|
152
|
-
SELECT title, content, topic, type, metadata FROM search
|
|
153
|
-
WHERE source = 'personal'
|
|
154
|
-
AND type = ?
|
|
155
|
-
ORDER BY timestamp DESC
|
|
156
|
-
`;
|
|
160
|
+
let sql =
|
|
161
|
+
"SELECT title, content, topic, type, metadata FROM search WHERE source = 'personal' AND type = ?";
|
|
157
162
|
const params: (string | number)[] = [type];
|
|
158
163
|
|
|
164
|
+
if (since) {
|
|
165
|
+
sql += " AND timestamp IS NOT NULL AND timestamp != '' AND timestamp >= ?";
|
|
166
|
+
params.push(since);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
sql += " ORDER BY timestamp DESC";
|
|
170
|
+
|
|
159
171
|
if (limit) {
|
|
160
172
|
sql += " LIMIT ?";
|
|
161
173
|
params.push(limit);
|
|
@@ -202,7 +214,12 @@ export function list(source: Source, options: ListOptions = {}): ListResult {
|
|
|
202
214
|
// Check if this is a personal subtype source
|
|
203
215
|
const personalType = PERSONAL_SUBTYPES[source];
|
|
204
216
|
if (personalType) {
|
|
205
|
-
entries = queryPersonalType(
|
|
217
|
+
entries = queryPersonalType(
|
|
218
|
+
db,
|
|
219
|
+
personalType,
|
|
220
|
+
options.limit,
|
|
221
|
+
options.since,
|
|
222
|
+
);
|
|
206
223
|
} else {
|
|
207
224
|
entries = queryBySource(
|
|
208
225
|
db,
|
|
@@ -210,6 +227,7 @@ export function list(source: Source, options: ListOptions = {}): ListResult {
|
|
|
210
227
|
options.limit,
|
|
211
228
|
options.project,
|
|
212
229
|
options.type,
|
|
230
|
+
options.since,
|
|
213
231
|
);
|
|
214
232
|
}
|
|
215
233
|
|
package/lib/semantic.ts
CHANGED
|
@@ -27,6 +27,7 @@ export interface SemanticSearchOptions {
|
|
|
27
27
|
limit?: number;
|
|
28
28
|
project?: string;
|
|
29
29
|
type?: string | string[];
|
|
30
|
+
since?: string;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
const MODEL_NAME = "nomic-ai/nomic-embed-text-v1.5";
|
|
@@ -233,6 +234,12 @@ export async function semanticSearch(
|
|
|
233
234
|
params.push(...types);
|
|
234
235
|
}
|
|
235
236
|
|
|
237
|
+
if (options.since) {
|
|
238
|
+
conditions.push("e.timestamp != ''");
|
|
239
|
+
conditions.push("e.timestamp >= ?");
|
|
240
|
+
params.push(options.since);
|
|
241
|
+
}
|
|
242
|
+
|
|
236
243
|
sql = `
|
|
237
244
|
SELECT
|
|
238
245
|
s.rowid,
|
|
@@ -332,6 +339,7 @@ export async function hybridSearch(
|
|
|
332
339
|
limit: fetchLimit,
|
|
333
340
|
project: options.project,
|
|
334
341
|
type: options.type,
|
|
342
|
+
since: options.since,
|
|
335
343
|
}),
|
|
336
344
|
Promise.resolve(
|
|
337
345
|
keywordSearch(query, {
|