@voidwire/lore 1.0.1 → 1.0.3

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/config.ts CHANGED
@@ -24,6 +24,7 @@ export interface LoreConfig {
24
24
  projects: string;
25
25
  personal: string;
26
26
  session_events?: string;
27
+ sable_events?: string;
27
28
  flux?: string;
28
29
  flux_projects?: string;
29
30
  };
@@ -118,6 +119,10 @@ export function getConfig(): LoreConfig {
118
119
  typeof paths.session_events === "string"
119
120
  ? resolvePath(paths.session_events)
120
121
  : undefined,
122
+ sable_events:
123
+ typeof paths.sable_events === "string"
124
+ ? resolvePath(paths.sable_events)
125
+ : undefined,
121
126
  flux:
122
127
  typeof paths.flux === "string" ? resolvePath(paths.flux) : undefined,
123
128
  flux_projects:
package/lib/indexer.ts CHANGED
@@ -150,8 +150,11 @@ export function createIndexerContext(
150
150
  // Chunk content if needed
151
151
  const chunks = chunkContent(entry.content);
152
152
 
153
- // Insert each chunk
153
+ // Insert each chunk (dedup at chunk level)
154
154
  for (const chunk of chunks) {
155
+ const chunkHash = createHash("sha256").update(chunk).digest("hex");
156
+ if (seenHashes.has(chunkHash)) continue;
157
+ seenHashes.add(chunkHash);
155
158
  insertStmt.run(
156
159
  entry.source,
157
160
  entry.title,
@@ -12,7 +12,7 @@
12
12
  * Timestamp: captured date if present, otherwise empty
13
13
  */
14
14
 
15
- import { readdirSync, readFileSync, existsSync } from "fs";
15
+ import { readdirSync, readFileSync, existsSync, statSync } from "fs";
16
16
  import { join, basename } from "path";
17
17
  import type { IndexerContext } from "../indexer";
18
18
 
@@ -82,6 +82,7 @@ function parseFluxFile(
82
82
  status: string,
83
83
  ): void {
84
84
  const raw = readFileSync(filePath, "utf-8");
85
+ const mtime = statSync(filePath).mtime;
85
86
  const lines = raw.split("\n");
86
87
 
87
88
  for (const line of lines) {
@@ -112,6 +113,11 @@ function parseFluxFile(
112
113
  );
113
114
  }
114
115
 
116
+ // Fall back to file mtime if no captured date
117
+ if (!timestamp) {
118
+ timestamp = mtime.toISOString();
119
+ }
120
+
115
121
  // Extract archived date if present (strip from description)
116
122
  rest = rest.replace(/\s*archived::\s*\S+/, "");
117
123
 
@@ -135,6 +135,8 @@ export async function indexObsidian(ctx: IndexerContext): Promise<void> {
135
135
 
136
136
  const title = basename(filePath, ".md");
137
137
 
138
+ if (!content.trim()) continue;
139
+
138
140
  ctx.insert({
139
141
  source: "obsidian",
140
142
  title,
@@ -27,16 +27,25 @@ interface SessionData {
27
27
  }
28
28
 
29
29
  export async function indexSessions(ctx: IndexerContext): Promise<void> {
30
- const eventsDir = ctx.config.paths.session_events;
31
- if (!eventsDir || !existsSync(eventsDir)) {
32
- console.log("No session events directory found, skipping sessions");
30
+ // Collect event files from all configured directories
31
+ const eventDirs = [
32
+ ctx.config.paths.session_events,
33
+ ctx.config.paths.sable_events,
34
+ ].filter((d): d is string => !!d && existsSync(d));
35
+
36
+ if (eventDirs.length === 0) {
37
+ console.log("No session events directories found, skipping sessions");
33
38
  return;
34
39
  }
35
40
 
36
- const eventFiles = readdirSync(eventsDir)
37
- .filter((f) => f.endsWith(".jsonl"))
38
- .sort()
39
- .map((f) => join(eventsDir, f));
41
+ const eventFiles: string[] = [];
42
+ for (const dir of eventDirs) {
43
+ const files = readdirSync(dir)
44
+ .filter((f) => f.endsWith(".jsonl"))
45
+ .map((f) => join(dir, f));
46
+ eventFiles.push(...files);
47
+ }
48
+ eventFiles.sort();
40
49
 
41
50
  if (eventFiles.length === 0) {
42
51
  console.log("No session event files found, skipping sessions");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voidwire/lore",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Unified knowledge CLI - Search, list, and capture your indexed knowledge",
5
5
  "type": "module",
6
6
  "main": "./index.ts",