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: tighten missing-page existence matching
nash_su11c755302fa5
diff --git a/src/lib/lint.test.ts b/src/lib/lint.test.tsindex f7512703..139af7be 100644--- a/src/lib/lint.test.ts+++ b/src/lib/lint.test.ts@@ -137,7 +137,7 @@ describe("runSemanticLint — missing-page false positives (#537)", () => {"维特根斯坦在概念页中被引用但未建立独立实体页。","PAGES: 概念页.md","---END LINT---",- "---LINT: missing-page | warning | 阿德勒实体页缺失---", // name + suffix, page exists+ "---LINT: missing-page | warning | 缺失页面:阿德勒---", // standard prefix, page exists"阿德勒被引用但缺少页面。","PAGES: 概念页.md","---END LINT---",@@ -158,6 +158,32 @@ describe("runSemanticLint — missing-page false positives (#537)", () => {expect(missingPages).toHaveLength(1)expect(missingPages[0].page).toBe("尼采")})++ it("does not suppress an unrelated finding that merely contains an existing short title", async () => {+ const pages = [+ makeFileNode("AI.md", "---\ntitle: AI\n---\n# AI"),+ makeFileNode("overview.md", "References [[FAIR data governance]]."),+ ]+ mockListDirectory.mockResolvedValue(pages.map((p) => p.node))+ mockReadFile.mockImplementation(async (path) => {+ const match = pages.find((p) => p.node.path === path)+ return match?.content ?? ""+ })+ mockStreamChat.mockImplementation(async (_c, _m, cb) => {+ cb.onToken([+ "---LINT: missing-page | warning | FAIR data governance---",+ "The concept has no dedicated page.",+ "PAGES: overview.md",+ "---END LINT---",+ ].join("\n"))+ cb.onDone()+ })++ const results = await runSemanticLint("/project", fakeLlmConfig())++ expect(results).toHaveLength(1)+ expect(results[0].page).toBe("FAIR data governance")+ })})describe("runSemanticLint — activity & early returns", () => {diff --git a/src/lib/lint.ts b/src/lib/lint.tsindex ee772a67..a88fb947 100644--- a/src/lib/lint.ts+++ b/src/lib/lint.ts@@ -5,6 +5,7 @@ import type { FileNode } from "@/types/wiki"import { useActivityStore } from "@/stores/activity-store"import { getFileName, getRelativePath, normalizePath } from "@/lib/path-utils"import { buildLanguageDirective } from "@/lib/output-language"+import { normalizeReviewTitle } from "@/lib/review-utils"export interface LintResult {type: "orphan" | "broken-link" | "no-outlinks" | "semantic"@@ -67,16 +68,15 @@ function normalizeLinkTarget(target: string): string {* and compatibility forms so CJK / full-width variants compare equal.*/function normalizeForExistence(s: string): string {- return s.normalize("NFKC").trim().toLowerCase()+ return normalizeReviewTitle(s).normalize("NFKC").trim().toLowerCase()}/*** Decide whether an LLM `missing-page` finding actually refers to a page that* already exists. The LLM does not reliably cross-reference the file list, so it- * flags entities whose page is already present — especially in non-English wikis- * where its free-form titles ("维特根斯坦", "阿德勒实体页缺失", "缺失页面:X") don't- * match a fixed prefix. Drop the finding when a known page name matches exactly- * or appears within the finding title (guarded by length to avoid over-matching).+ * flags entities whose page is already present. Only exact normalized names are+ * accepted here. Substring matching is unsafe because short, valid page titles+ * can also be ordinary words inside an unrelated missing-page finding.*/function missingPageAlreadyExists(llmTitle: string,@@ -84,11 +84,7 @@ function missingPageAlreadyExists(): boolean {const norm = normalizeForExistence(llmTitle)if (!norm) return false- if (existingPageNames.has(norm)) return true- for (const name of existingPageNames) {- if (name.length >= 2 && norm.includes(name)) return true- }- return false+ return existingPageNames.has(norm)}function extractTitle(content: string, fallbackPath: string): string {@@ -406,6 +402,7 @@ export async function runSemanticLint("- stale: information that appears outdated or superseded","- missing-page: an important concept is heavily referenced but has no dedicated page","- suggestion: a question or source worth adding to the wiki",+ "For missing-page findings, Short title must be only the exact missing concept or entity name, without explanatory prefixes or suffixes.","","Severities:","- warning: should be addressed",