@voidwire/lore 0.4.0 → 0.5.0

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 (3) hide show
  1. package/cli.ts +4 -1
  2. package/lib/list.ts +15 -1
  3. 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/lib/list.ts CHANGED
@@ -71,6 +71,7 @@ const PROJECT_FIELD: Record<string, string> = {
71
71
  export interface ListOptions {
72
72
  limit?: number;
73
73
  project?: string;
74
+ type?: string;
74
75
  }
75
76
 
76
77
  export interface ListEntry {
@@ -104,6 +105,7 @@ function queryBySource(
104
105
  source: string,
105
106
  limit?: number,
106
107
  project?: string,
108
+ type?: string,
107
109
  ): ListEntry[] {
108
110
  let sql = "SELECT title, content, metadata FROM search WHERE source = ?";
109
111
  const params: (string | number)[] = [source];
@@ -117,6 +119,12 @@ function queryBySource(
117
119
  }
118
120
  }
119
121
 
122
+ // Add type filter if provided (captures source only)
123
+ if (type && source === "captures") {
124
+ sql += ` AND json_extract(metadata, '$.type') = ?`;
125
+ params.push(type);
126
+ }
127
+
120
128
  if (limit) {
121
129
  sql += " LIMIT ?";
122
130
  params.push(limit);
@@ -190,7 +198,13 @@ export function list(source: Source, options: ListOptions = {}): ListResult {
190
198
  if (personalType) {
191
199
  entries = queryPersonalType(db, personalType, options.limit);
192
200
  } else {
193
- entries = queryBySource(db, source, options.limit, options.project);
201
+ entries = queryBySource(
202
+ db,
203
+ source,
204
+ options.limit,
205
+ options.project,
206
+ options.type,
207
+ );
194
208
  }
195
209
 
196
210
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voidwire/lore",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Unified knowledge CLI - Search, list, and capture your indexed knowledge",
5
5
  "type": "module",
6
6
  "main": "./index.ts",