@voidwire/lore 0.4.0 → 0.5.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/cli.ts +4 -1
- package/index.ts +3 -0
- package/lib/capture.ts +71 -1
- package/lib/list.ts +19 -2
- package/package.json +1 -1
package/cli.ts
CHANGED
|
@@ -332,10 +332,11 @@ function handleList(args: string[]): void {
|
|
|
332
332
|
: undefined;
|
|
333
333
|
const format = parsed.get("format") || "json";
|
|
334
334
|
const project = parsed.get("project");
|
|
335
|
+
const type = parsed.get("type");
|
|
335
336
|
const brief = hasFlag(args, "brief");
|
|
336
337
|
|
|
337
338
|
try {
|
|
338
|
-
const result = list(source, { limit, project });
|
|
339
|
+
const result = list(source, { limit, project, type });
|
|
339
340
|
|
|
340
341
|
if (brief) {
|
|
341
342
|
console.log(formatBriefList(result));
|
|
@@ -801,6 +802,7 @@ Options:
|
|
|
801
802
|
--limit <n> Maximum entries (default: all)
|
|
802
803
|
--format <fmt> Output format: json (default), jsonl, human
|
|
803
804
|
--project <name> Filter by project name
|
|
805
|
+
--type <type> Filter captures by type (learning, gotcha, preference, decision)
|
|
804
806
|
--brief Compact output (titles only)
|
|
805
807
|
--help Show this help
|
|
806
808
|
|
|
@@ -830,6 +832,7 @@ Examples:
|
|
|
830
832
|
lore list development
|
|
831
833
|
lore list commits --limit 10 --format human
|
|
832
834
|
lore list commits --project=momentum --limit 5
|
|
835
|
+
lore list captures --type=learning --limit 5
|
|
833
836
|
lore list books --format jsonl
|
|
834
837
|
`);
|
|
835
838
|
process.exit(0);
|
package/index.ts
CHANGED
|
@@ -66,12 +66,15 @@ export {
|
|
|
66
66
|
captureTask,
|
|
67
67
|
captureNote,
|
|
68
68
|
captureTeaching,
|
|
69
|
+
captureInsight,
|
|
69
70
|
type CaptureResult,
|
|
70
71
|
type KnowledgeInput,
|
|
71
72
|
type KnowledgeCaptureType,
|
|
72
73
|
type TaskInput,
|
|
73
74
|
type NoteInput,
|
|
74
75
|
type TeachingInput,
|
|
76
|
+
type InsightInput,
|
|
77
|
+
type InsightType,
|
|
75
78
|
type CaptureEvent,
|
|
76
79
|
} from "./lib/capture";
|
|
77
80
|
|
package/lib/capture.ts
CHANGED
|
@@ -57,6 +57,22 @@ export interface TeachingInput {
|
|
|
57
57
|
source?: string;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
export type InsightType =
|
|
61
|
+
| "decision"
|
|
62
|
+
| "pattern"
|
|
63
|
+
| "preference"
|
|
64
|
+
| "problem"
|
|
65
|
+
| "tool"
|
|
66
|
+
| "summary";
|
|
67
|
+
|
|
68
|
+
export interface InsightInput {
|
|
69
|
+
session_id: string;
|
|
70
|
+
project: string;
|
|
71
|
+
insight_type: InsightType;
|
|
72
|
+
text: string;
|
|
73
|
+
source: "auto";
|
|
74
|
+
}
|
|
75
|
+
|
|
60
76
|
interface TaskEvent {
|
|
61
77
|
event: "captured";
|
|
62
78
|
type: "task";
|
|
@@ -110,7 +126,25 @@ interface TeachingEvent {
|
|
|
110
126
|
};
|
|
111
127
|
}
|
|
112
128
|
|
|
113
|
-
|
|
129
|
+
interface InsightEvent {
|
|
130
|
+
event: "captured";
|
|
131
|
+
type: "insight";
|
|
132
|
+
timestamp: string;
|
|
133
|
+
data: {
|
|
134
|
+
session_id: string;
|
|
135
|
+
project: string;
|
|
136
|
+
insight_type: InsightType;
|
|
137
|
+
text: string;
|
|
138
|
+
source: "auto";
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
type CaptureEvent =
|
|
143
|
+
| TaskEvent
|
|
144
|
+
| KnowledgeEvent
|
|
145
|
+
| NoteEvent
|
|
146
|
+
| TeachingEvent
|
|
147
|
+
| InsightEvent;
|
|
114
148
|
|
|
115
149
|
function getLogPath(): string {
|
|
116
150
|
const dataHome =
|
|
@@ -247,4 +281,40 @@ export function captureTeaching(input: TeachingInput): CaptureResult {
|
|
|
247
281
|
return writeEvent(event);
|
|
248
282
|
}
|
|
249
283
|
|
|
284
|
+
const VALID_INSIGHT_TYPES: InsightType[] = [
|
|
285
|
+
"decision",
|
|
286
|
+
"pattern",
|
|
287
|
+
"preference",
|
|
288
|
+
"problem",
|
|
289
|
+
"tool",
|
|
290
|
+
"summary",
|
|
291
|
+
];
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Capture an auto-extracted insight from llm-summarize
|
|
295
|
+
*/
|
|
296
|
+
export function captureInsight(input: InsightInput): CaptureResult {
|
|
297
|
+
if (!VALID_INSIGHT_TYPES.includes(input.insight_type)) {
|
|
298
|
+
return {
|
|
299
|
+
success: false,
|
|
300
|
+
error: `Invalid insight_type: ${input.insight_type}. Must be one of: ${VALID_INSIGHT_TYPES.join(", ")}`,
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const event: InsightEvent = {
|
|
305
|
+
event: "captured",
|
|
306
|
+
type: "insight",
|
|
307
|
+
timestamp: "",
|
|
308
|
+
data: {
|
|
309
|
+
session_id: input.session_id,
|
|
310
|
+
project: input.project,
|
|
311
|
+
insight_type: input.insight_type,
|
|
312
|
+
text: input.text,
|
|
313
|
+
source: input.source,
|
|
314
|
+
},
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
return writeEvent(event);
|
|
318
|
+
}
|
|
319
|
+
|
|
250
320
|
export type { CaptureEvent };
|
package/lib/list.ts
CHANGED
|
@@ -27,7 +27,8 @@ export type Source =
|
|
|
27
27
|
| "people"
|
|
28
28
|
| "habits"
|
|
29
29
|
| "teachings"
|
|
30
|
-
| "sessions"
|
|
30
|
+
| "sessions"
|
|
31
|
+
| "insights";
|
|
31
32
|
|
|
32
33
|
export const SOURCES: Source[] = [
|
|
33
34
|
"development",
|
|
@@ -47,6 +48,7 @@ export const SOURCES: Source[] = [
|
|
|
47
48
|
"habits",
|
|
48
49
|
"teachings",
|
|
49
50
|
"sessions",
|
|
51
|
+
"insights",
|
|
50
52
|
];
|
|
51
53
|
|
|
52
54
|
// Sources that query the 'personal' source with type filter
|
|
@@ -66,11 +68,13 @@ const PROJECT_FIELD: Record<string, string> = {
|
|
|
66
68
|
tasks: "project",
|
|
67
69
|
captures: "context",
|
|
68
70
|
teachings: "source",
|
|
71
|
+
insights: "project",
|
|
69
72
|
};
|
|
70
73
|
|
|
71
74
|
export interface ListOptions {
|
|
72
75
|
limit?: number;
|
|
73
76
|
project?: string;
|
|
77
|
+
type?: string;
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
export interface ListEntry {
|
|
@@ -104,6 +108,7 @@ function queryBySource(
|
|
|
104
108
|
source: string,
|
|
105
109
|
limit?: number,
|
|
106
110
|
project?: string,
|
|
111
|
+
type?: string,
|
|
107
112
|
): ListEntry[] {
|
|
108
113
|
let sql = "SELECT title, content, metadata FROM search WHERE source = ?";
|
|
109
114
|
const params: (string | number)[] = [source];
|
|
@@ -117,6 +122,12 @@ function queryBySource(
|
|
|
117
122
|
}
|
|
118
123
|
}
|
|
119
124
|
|
|
125
|
+
// Add type filter if provided (captures source only)
|
|
126
|
+
if (type && source === "captures") {
|
|
127
|
+
sql += ` AND json_extract(metadata, '$.type') = ?`;
|
|
128
|
+
params.push(type);
|
|
129
|
+
}
|
|
130
|
+
|
|
120
131
|
if (limit) {
|
|
121
132
|
sql += " LIMIT ?";
|
|
122
133
|
params.push(limit);
|
|
@@ -190,7 +201,13 @@ export function list(source: Source, options: ListOptions = {}): ListResult {
|
|
|
190
201
|
if (personalType) {
|
|
191
202
|
entries = queryPersonalType(db, personalType, options.limit);
|
|
192
203
|
} else {
|
|
193
|
-
entries = queryBySource(
|
|
204
|
+
entries = queryBySource(
|
|
205
|
+
db,
|
|
206
|
+
source,
|
|
207
|
+
options.limit,
|
|
208
|
+
options.project,
|
|
209
|
+
options.type,
|
|
210
|
+
);
|
|
194
211
|
}
|
|
195
212
|
|
|
196
213
|
return {
|