Relocate the ~6k-file docs tree from the repo root into plugins/document-navigator/docs/ so the plugin is self-contained and portable. docs/superpowers/ (specs and plans) stays at the repo root. Moved via cp+rm rather than git mv because directory rename() fails with EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the identical-content files at commit time. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4.6 KiB
4.6 KiB
@suaveplan/docs - Server-tier markdown documentation toolkit: project-wide discovery, mdast-typed parsing, bidirectional reference graph, hierarchy builder, full-text scored search, typed DocsError registry, OpenTelemetry counters + histograms, Zod-validated DiscoverOptions, AbortSignal propagation.
Server-tier markdown documentation toolkit for Suaveplan.
Discovers every .md file under a repo root, parses each via gray-matter +
remark into a structured DocFile, builds a bidirectional reference graph,
identifies orphans, materialises a per-category hierarchy tree, and answers
scored full-text search queries. Ships a typed DocsError namespace, eight
OpenTelemetry instruments, Zod-validated DiscoverOptions, and AbortSignal
support throughout the async surface.
Documentation tree
- discovery —
discoverDocswalks a project root directory and returns one structuredDocFileper markdown file it can read. It i…- discover —
discoverDocswalks a project root directory and returns one structuredDocFileper markdown file it can read. It i…
- discover —
- errors — The
errorsmodule owns the typed-error surface of@suaveplan/docs. Every failure path the package can take surfaces…- errors — The
errorsmodule owns the typed-error surface of@suaveplan/docs. Every failure path the package can take surfaces…
- errors — The
- build-graph —
buildGraphconsumes the flat array returned bydiscoverDocs(or anyDocFile[]you construct fromparseDocdirec… - find-orphans —
findOrphansprojects theorphansarray of aDocGraphinto an actionableOrphanInfo[]sorted by package name, pa… - hierarchy —
buildHierarchymaterialises aDocGraphinto a tree (DocHierarchy) by treating every README as a root and recursiv…- build-hierarchy —
buildHierarchymaterialises aDocGraphinto a tree (DocHierarchy) by treating every README as a root and recursiv…
- build-hierarchy —
- observability — The
observabilitymodule assembles the OpenTelemetry instruments emitted by@suaveplan/docs. `createDocsObservabili…- observability — The
observabilitymodule assembles the OpenTelemetry instruments emitted by@suaveplan/docs. `createDocsObservabili…
- observability — The
- parser —
parseDocturns the raw text of a single markdown file into a structuredDocFileby composinggray-matter(frontma…- parse —
parseDocturns the raw text of a single markdown file into a structuredDocFileby composinggray-matter(frontma…
- parse —
- search —
searchDocsanswers a free-text query against aDocFile[]and returns ranked hits with snippet context. It is intent…- search —
searchDocsanswers a free-text query against aDocFile[]and returns ranked hits with snippet context. It is intent…
- search —
Install
bun add @suaveplan/docs
Quick start
import {
buildGraph,
buildHierarchy,
discoverDocs,
findOrphans,
searchDocs,
} from "@suaveplan/docs";
const docs = await discoverDocs({ rootDir: "/path/to/project" });
const graph = buildGraph(docs);
const tree = buildHierarchy(graph);
const orphans = findOrphans(graph);
const hits = searchDocs(docs, "vault");
console.log(
`${docs.length} docs, ${tree.roots.length} packages, ${orphans.length} orphans, ${hits.length} matches`
);
Modules
discovery/discover.md— project-wide.mddiscovery withAbortSignaland IO-error surfacing.parser/parse.md— typed mdast parser with frontmatter, H1 extraction, and link harvesting.graph/build-graph.md— bidirectional reference graph + roots + orphans.graph/find-orphans.md— orphan listing withsuggestedParentREADME pairing.hierarchy/build-hierarchy.md— hierarchy tree with configurablemaxDepth.search/search.md— scored search with snippet context.errors/errors.md—DocsError+DOCS_CODESregistry.observability/observability.md— OTel counters + histograms factory.