feat: auto-detect document links from markdown and wikilinks#396
Open
feat: auto-detect document links from markdown and wikilinks#396
Conversation
Implements issue #394. Automatically extracts and stores document relationships from content at index time, and surfaces them in the knowledge graph. - Add extractMarkdownLinks() and extractWikilinks() to link-extractor.ts - Add "references" LinkType for auto-detected links - Add resolveDocumentByUrl/Title/Link() and extractAndStoreDocumentLinks() to links.ts - Call extractAndStoreDocumentLinks() after indexDocument() completes - Wire Obsidian wikilink resolution into createLink() via syncObsidianVault() - Extend GraphEdge.type with see_also/prerequisite/supersedes/related/references - Include document_links edges in buildKnowledgeGraph() - Add unit and integration tests (1276 passing) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
| const re = /\[([^\]]*)\]\(([^)]+)\)/g; | ||
| let match: RegExpExecArray | null; | ||
|
|
||
| while ((match = re.exec(content)) !== null) { |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data High
| const re = /\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g; | ||
| let match: RegExpExecArray | null; | ||
|
|
||
| while ((match = re.exec(content)) !== null) { |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data High
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #394
Implements automatic link detection from document content to populate the knowledge graph with explicit document relationships.
extractMarkdownLinks()([text](url)) andextractWikilinks()([[PageName]]/[[PageName|alias]]) tolink-extractor.tsresolveDocumentByUrl(),resolveDocumentByTitle(), andresolveDocumentLink()tolinks.tsfor matching extracted refs to existing documents"references"toLinkTypeto distinguish auto-detected links from manually curated onesextractAndStoreDocumentLinks()is called afterindexDocument()completes (post-transaction, non-blocking)syncObsidianVault()now resolves parsed wikilinks viaresolveDocumentByTitle()and stores them as"references"linksGraphEdge.typeextended withsee_also | prerequisite | supersedes | related | references;buildKnowledgeGraph()now queriesdocument_linksand includes them as edgesTest plan
extractMarkdownLinks()andextractWikilinks()— standard links, aliases, dedup, empty inputresolveDocumentByUrl/Title/Link()andextractAndStoreDocumentLinks()— URL lookup, case-insensitive title lookup, fallback resolution, self-link skipping, unresolvable skippingbuildKnowledgeGraph()— verifiesdocument_linksedges appear with correct type🤖 Generated with Claude Code