import type { ParsedMarkdownFile } from "../types/links.js"; /** * A wikilink whose bare target matches multiple notes in the vault. * * Obsidian resolves such links by path proximity, which means a file move can silently rebind them * without any text changing anywhere -- the reason ambiguity is reported rather than guessed. * * @category Core */ export interface ObsidianAmbiguity { /** The bare wikilink target that matched more than one note */ stem: string; /** Absolute paths of every note the target matched */ candidates: string[]; } /** * A note stem shared by multiple markdown files, making bare wikilinks to it ambiguous. * * @category Core */ export interface DuplicateNoteStem { /** The stem (basename without extension) shared by multiple notes */ stem: string; /** Absolute paths of every note carrying this stem */ paths: string[]; } export type { ParsedMarkdownFile }; /** * Resolve the wikilinks and embeds in a parsed vault against the whole file set. * * Obsidian resolves [[Note]] by unique basename vault-wide, independent of where either file sits, * so resolution needs every note in view: a bare target is matched by stem, an explicit-extension * target by filename, and a path-qualified target against the vault root. Successfully resolved * links gain resolvedPath and feed the file's dependencies, so the dependency graph treats them * like any other inbound reference. Ambiguous bare targets are deliberately left unresolved and * reported instead of guessed. * * @example * ```typescript const files = await new LinkParser().parseDirectory(vaultRoot); const ambiguities = resolveWikilinks(files, vaultRoot); * * if (ambiguities.length > 0) { console.warn('Ambiguous wikilinks:', ambiguities); } ```; * * @param files - Every parsed markdown file in the vault * @param vaultRoot - Absolute path of the vault root path-qualified targets resolve against * * @returns Ambiguities encountered: bare targets that matched multiple notes */ export declare function resolveWikilinks(files: ParsedMarkdownFile[], vaultRoot: string): ObsidianAmbiguity[]; /** * The outcome of resolving one wikilink target against the vault. * * @category Core */ export interface WikilinkResolution { /** The single note or asset the target resolves to, when unambiguous */ resolvedPath?: string; /** Every note a bare target matched, when ambiguous */ ambiguous?: string[]; } /** * Build a resolver for wikilink targets against a known vault file set. * * The index needs only file paths -- stems and filenames -- so callers that have a file list but no * parsed contents (link validation, for example) can resolve exactly like whole-vault passes. * * @param vaultRoot - Absolute path of the vault root path-qualified targets resolve against * @param filePaths - Absolute paths of every file in the vault * * @returns A function mapping a wikilink target to its resolution */ export declare function createWikilinkResolver(vaultRoot: string, filePaths: string[]): (target: string) => WikilinkResolution; /** * Find markdown note stems shared by multiple files in a parsed vault. * * A duplicate stem makes every bare wikilink to it ambiguous, and Obsidian resolves that ambiguity * by path proximity -- so moving a file can silently rebind existing links with zero text changes * anywhere. Surfacing the duplicates before a move is the only defence. * * @param files - Every parsed markdown file in the vault * * @returns Each stem that more than one markdown file carries */ export declare function findDuplicateNoteStems(files: ParsedMarkdownFile[]): DuplicateNoteStem[]; /** * Count how many markdown files carry each note stem. * * A stem carried by exactly one file resolves unambiguously vault-wide, so a rewritten wikilink can * use the bare form; any stem whose post-move count exceeds one needs the path-qualified form. * * @param files - Every parsed markdown file in the vault * * @returns Map from stem (basename without .md) to the number of markdown files carrying it */ export declare function computeNoteStemCounts(files: ParsedMarkdownFile[]): Map; //# sourceMappingURL=obsidian-vault.d.ts.map