Skip to content
ContractSpec
Start here
AI index

Build the docs pipeline

Generate reference docs, chunk the index, and wire the docs pages the same way this repo does.

What you'll build

  • Generated Markdown and a chunked index manifest.

  • Reference routes powered by the docs loader.

  • Versioned outputs you can publish per release.

1) Generate contract docs

bash
contractspec generate

Expected output: Markdown in generated/docs.

2) Build the docs index

bash
bun run --cwd packages/platform/delivery/contracts-spec-compat docs:manifest
bun run docs:generate

This writes docs-index.manifest.json, its JSON chunks and a generated import table, docs-index.imports.ts. The website build uses that table to package the same index for runtime search. Regenerate these files from the source instead of editing them by hand.

3) Wire reference routes

tsx
import { notFound } from "next/navigation";
import {
  getPublicGeneratedReferenceById,
  listPublicGeneratedReferences,
} from "@lssm-tech/bundle.library/components/docs/generated";
import { DocsReferencePage } from "@lssm-tech/bundle.library/components/docs/reference/DocsReferencePage";

export async function generateStaticParams() {
  const docs = await listPublicGeneratedReferences();
  return docs.map((doc) => ({ slug: doc.id.split("/") }));
}

export default async function Page({ params }: { params: Promise<{ slug?: string[] }> }) {
  const slug = (await params).slug?.join("/") ?? "";
  const doc = await getPublicGeneratedReferenceById(slug);
  if (!doc) notFound();
  return <DocsReferencePage entry={doc.entry} content={doc.content} />;
}

Use the same public selection for reference pages, search and sitemaps. Internal and mixed DocBlocks stay available to trusted readers without appearing in the public reference. Before a website release, verify one authored guide and one generated reference against the built search endpoint.

Repo reference

This repo wires docs under packages/apps/web-landing/src/app/docs/reference.

Need decision-to-export automation?

Studio exports evidence-backed spec changes and task packs to Linear, Jira, Notion, and GitHub.

See what Studio adds