LLM Wiki is a cross-platform desktop application that turns your documents into an organized, interlinked knowledge base — automatically. Instead of traditional RAG (retrieve-and-answer from scratch every time), the LLM incrementally builds and maintains a persistent wiki from your sources。
TypeScript
fix: preserve scheduled import scan history on Windows
nash_su313a64302de4
diff --git a/src/lib/scheduled-import.test.ts b/src/lib/scheduled-import.test.tsindex ceb2e24c..830cd001 100644--- a/src/lib/scheduled-import.test.ts+++ b/src/lib/scheduled-import.test.ts@@ -235,6 +235,43 @@ describe("scanAndImport failure handling", () => {expect(mocks.writeFileAtomic).not.toHaveBeenCalled()})+ it("reuses legacy mixed-case Windows database keys after upgrade", async () => {+ const windowsProject: WikiProject = {+ id: "windows-project",+ name: "Windows Project",+ path: "C:/Users/Me/Wiki",+ }+ useWikiStore.setState({ project: windowsProject })+ mocks.fileExists.mockResolvedValue(true)+ mocks.readFile.mockResolvedValue(JSON.stringify({+ version: 1,+ directories: {+ "C:/Users/Me/Inbox": {+ files: {+ "C:/Users/Me/Inbox/Paper.pdf": "md5-new",+ },+ lastScan: 123,+ },+ },+ }))+ mocks.listDirectory.mockResolvedValue([+ {+ name: "Paper.pdf",+ path: "c:/users/me/inbox/paper.pdf",+ is_dir: false,+ },+ ])++ await scanAndImport(windowsProject, "c:/users/me/inbox")++ expect(mocks.copyFile).not.toHaveBeenCalled()+ expect(mocks.enqueueSourceIngest).not.toHaveBeenCalled()+ expect(mocks.writeFileAtomic).toHaveBeenCalledWith(+ "C:/Users/Me/Wiki/.llm-wiki/scheduled-import-db.json",+ expect.stringContaining('"c:/users/me/inbox/paper.pdf": "md5-new"'),+ )+ })+it("does not leave the scanner locked after a managed project path is skipped", async () => {await scanAndImport(project, `${project.path}/raw/sources`)await scanAndImport(project, "/Users/me/inbox")diff --git a/src/lib/scheduled-import.ts b/src/lib/scheduled-import.tsindex 8baf52fb..262f373c 100644--- a/src/lib/scheduled-import.ts+++ b/src/lib/scheduled-import.ts@@ -302,8 +302,22 @@ async function loadImportDb(importPath: string,): Promise<ImportDb> {const store = await loadDbStore(projectPath)- const db = store.directories[dbDirectoryKey(importPath)]- return db ? cloneDb(db) : cloneDb(EMPTY_DB)+ const directoryKey = dbDirectoryKey(importPath)+ const db = store.directories[directoryKey] ??+ Object.entries(store.directories).find(+ ([storedKey]) => dbDirectoryKey(storedKey) === directoryKey,+ )?.[1]+ if (!db) return cloneDb(EMPTY_DB)++ // Older builds persisted Windows directory and file keys with their+ // observed casing. Normalize both levels while loading so upgrading does+ // not make the first scan treat every unchanged file as new.+ return {+ files: Object.fromEntries(+ Object.entries(db.files).map(([path, md5]) => [dbDirectoryKey(path), md5]),+ ),+ lastScan: db.lastScan,+ }}async function saveImportDb(@@ -383,7 +397,7 @@ export async function scanAndImport(continue}- const key = sourcePath+ const key = dbDirectoryKey(sourcePath)const md5 = await getFileMd5(sourcePath)if (db.files[key] === md5) {