wiki
Wiki-note catalog, lint, and search logic for wiki_toolkit.
| CLASS | DESCRIPTION |
|---|---|
CatalogEntry |
A single |
CatalogResult |
The full result of a |
CrossLinkCandidate |
A single literal-match cross-link candidate found in a session page’s body. |
LintResult |
The full result of a |
| FUNCTION | DESCRIPTION |
|---|---|
build_catalog |
Walk |
find_cross_link_candidates |
Find literal title/alias mentions of other catalog pages inside |
lint_wiki |
Validate every note in |
parse_tag_taxonomy |
Extract the allowed-tags list from a |
search_catalog |
Return catalog entries whose title or path contains |
Classes¶
CatalogEntry
dataclass
¶
CatalogEntry(
path: str,
title: str,
updated: str,
sources: list[str],
status: Literal["resolved", "proposed"],
aliases: list[str] = list(),
links: list[str] = list(),
)
A single docs/wiki/ note’s catalog entry.
CatalogResult
dataclass
¶
CatalogResult(
entries: list[CatalogEntry] = list(),
violations: list[LintViolation] = list(),
)
The full result of a build pass.
CrossLinkCandidate
dataclass
¶
CrossLinkCandidate(
page: str,
target: str,
mention_text: str,
match_type: Literal["title", "alias"],
)
A single literal-match cross-link candidate found in a session page’s body.
LintResult
dataclass
¶
LintResult(violations: list[LintViolation] = list())
Functions:¶
build_catalog
¶
build_catalog(docs_dir: Path) -> CatalogResult
Walk docs_dir/wiki/, parsing frontmatter into a catalog entry per note.
status is resolved iff every source the note references is resolved
in the source manifest (vacuously true for a note with no sources), else
proposed. A note with malformed frontmatter is reported as a violation
instead of raising.
find_cross_link_candidates
¶
find_cross_link_candidates(
docs_dir: Path, page_paths: list[str]
) -> list[CrossLinkCandidate]
Find literal title/alias mentions of other catalog pages inside page_paths’ bodies.
page_paths are the session’s own pages (paths as stored in catalog.jsonl, relative to
docs_dir.parent) — the only bodies read. Every other catalog entry is a potential match
target, matched by title and aliases, never re-read as a source. A match inside a fenced
code block or an existing [[...]] wikilink is skipped; at most one candidate is reported
per (page, target) pair, preferring a title match over an alias match.
lint_wiki
¶
lint_wiki(docs_dir: Path) -> LintResult
Validate every note in docs_dir/wiki/: frontmatter, tags, source links, source_count.
Tags are checked against the taxonomy in docs_dir/schema.md (skipped if that file
is absent). Sources are checked against docs_dir/source-manifest.jsonl.
parse_tag_taxonomy
¶
parse_tag_taxonomy(schema_text: str) -> set[str]
Extract the allowed-tags list from a ## Tag Taxonomy section in schema.md.
Reads bullet items (- tag) between that heading and the next ## heading (or EOF).
search_catalog
¶
search_catalog(query: str, entries: list[dict]) -> list[dict]
Return catalog entries whose title or path contains query, case-insensitively.