Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,35 @@ const components = {
};
```

## Live Example App

The repo includes a canonical consumer demo at `apps/docs-smoke`.

- Renders real `.mdx` fixture files through the package's exported `mdxComponents`.
- Uses TanStack Start for SSR and hydration coverage.
- Shows extracted `AutoTypeTable` output while keeping pipeline fixtures in the validation path.

Local workflow:

```bash
bun install
bun run demo:dev
```

Pipeline and browser checks:

```bash
bun run --filter docs-smoke pipeline:build
bun run --filter docs-smoke pipeline:test
bun run --filter docs-smoke test:e2e
```

Validation layers:

- Package unit tests in `packages/docs/src/**/*.test.ts*` cover component semantics and pure library behavior.
- Pipeline fixtures in `apps/docs-smoke/scripts` and `apps/docs-smoke/content` cover MDX conversion, LLM generation, and `AutoTypeTable`.
- The TanStack Start demo app in `apps/docs-smoke/src` covers real browser rendering and hydration.

### Convert MDX to markdown

```ts
Expand Down
23 changes: 23 additions & 0 deletions apps/docs-smoke/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "radix-nova",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "",
"css": "src/styles.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
},
"iconLibrary": "tabler",
"rtl": false,
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"registries": {}
}
11 changes: 11 additions & 0 deletions apps/docs-smoke/content/docs/guides/auto-type-table-fixture.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: "AutoTypeTable Fixture"
description: "Pipeline-only fixture for type extraction coverage."
---

# AutoTypeTable Fixture

<AutoTypeTable
name="PipelineExampleOptions"
path="./apps/docs-smoke/type-fixtures/pipeline-example.ts"
/>
108 changes: 108 additions & 0 deletions apps/docs-smoke/content/docs/guides/components-fixture.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
title: "Components Fixture"
description: "Render the runtime-facing adapters from @inth/docs in one browser route."
---

# Components Fixture

<Callout variant="success" title="Runtime fixture">
This page intentionally exercises the browser-facing adapters without replacing them with shadcn variants.
</Callout>

## Authoring Example

```mdx
<Callout variant="success" title="Runtime fixture">
Render the exported adapters through your shared `mdxComponents` map.
</Callout>

<PackageCommandTabs command="{pm} add @inth/docs" />

<Tabs items={["Overview", "Types"]}>
<Tab value="Overview">Tabs hydrate in the browser.</Tab>
<Tab value="Types">Use `TypeTable` when the type data already exists in MDX.</Tab>
</Tabs>

<Mermaid chart={`flowchart LR
A[MDX] --> B[mdxComponents]
B --> C[Rendered route]
`} />

<TypeTable
type={{
command: {
type: "string",
description: "Command template with a {pm} placeholder.",
required: true,
},
}}
/>

<AutoTypeTable
name="PipelineExampleOptions"
path="./apps/docs-smoke/type-fixtures/pipeline-example.ts"
type={pipelineExampleType}
/>
```

`AutoTypeTable` still needs extracted `type` data from the route or conversion pipeline. This demo renders that extracted output on `/docs`.

<Cards>
<Card title="Quickstart route" description="Internal docs route rendered by the package card component." href="/docs/guides/quickstart" />
<Card title="External reference" description="External links should preserve safe target and rel attributes." href="https://example.com/docs" />
</Cards>

<Steps>
<Step title="Author MDX">
Start with semantic components such as `Callout`, `Tabs`, `Cards`, and `TypeTable`.
</Step>
<Step title="Render in TanStack Start">
Import the `.mdx` file directly and provide `mdxComponents` through the shared runtime map.
</Step>
<Step title="Validate separately">
Keep `AutoTypeTable` in pipeline coverage where source extraction actually happens.
</Step>
</Steps>

<PackageCommandTabs command="{pm} add @inth/docs" />

<Tabs items={["Overview", "Tables", "Pipeline note"]}>
<Tab value="Overview">
This tabset proves the package adapters hydrate correctly inside the demo app.
</Tab>
<Tab value="Tables">
`TypeTable` is safe to render live because all of its data is already present in the MDX payload.
</Tab>
<Tab value="Pipeline note">
`AutoTypeTable` is not shown live here because extraction depends on a stable build-time file system base path.
</Tab>
</Tabs>

<Mermaid chart={`flowchart LR
A[MDX fixture] --> B[mdxComponents]
B --> C[TanStack Start route]
C --> D[Playwright coverage]
`} />

<TypeTable
type={{
command: {
type: "string",
description: "Command template with a {pm} placeholder.",
required: true,
},
commands: {
type: "Record<PackageManager, string>",
description: "Explicit per-manager overrides when templates are not enough.",
},
defaultManager: {
type: "\"npm\" | \"pnpm\" | \"yarn\" | \"bun\"",
description: "The tab that should be active on first render.",
default: "npm",
},
}}
/>
Comment thread
coderabbitai[bot] marked this conversation as resolved.

<Callout variant="canary" title="Pipeline-only coverage">
`AutoTypeTable` is verified by the markdown conversion fixture at `content/docs/guides/auto-type-table-fixture.mdx` and by the dedicated pipeline test script.
</Callout>
4 changes: 2 additions & 2 deletions apps/docs-smoke/content/docs/guides/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: "Install and run your first command."
<Steps>
<Step title="Install">Install the package.</Step>
<Step title="Import">Import `convertAllMdx` from `@inth/docs/convert`.</Step>
<Step title="Build">Run `bun run build`.</Step>
<Step title="Build">Run `bun run pipeline:build`.</Step>
</Steps>

<PackageCommandTabs command="{pm} install @inth/docs" />
Expand All @@ -18,6 +18,6 @@ description: "Install and run your first command."
Basic usage is one call to `convertAllMdx({ srcDir, outDir, remarkPlugins })`.
</Tab>
<Tab value="Advanced">
Pass custom remark plugins alongside `defaultRemarkPlugins` for extensions.
Pass custom remark plugins alongside `defaultRemarkPlugins` for extensions and set a stable `basePath` when `AutoTypeTable` needs to resolve project files.
</Tab>
</Tabs>
98 changes: 90 additions & 8 deletions apps/docs-smoke/content/docs/index.mdx
Original file line number Diff line number Diff line change
@@ -1,16 +1,98 @@
---
title: "Smoke SDK"
description: "Welcome to the Smoke SDK docs. Exercise @inth/docs end-to-end."
title: "@inth/docs"
description: "Package docs for runtime adapters, remark plugins, conversion, LLM output, and linting."
---

# Smoke SDK
# @inth/docs

<Callout variant="info" title="Welcome">
This is a fixture page that mirrors how consumer apps integrate with `@inth/docs`.
</Callout>
`@inth/docs` has five package surfaces:

Pick your path below.
<TypeTable
type={{
"@inth/docs": {
type: "runtime",
description: "React adapters and `mdxComponents` for browser-rendered MDX.",
required: true,
},
"@inth/docs/remark": {
type: "pipeline",
description: "remark plugins and `defaultRemarkPlugins` for MDX processing.",
required: true,
},
"@inth/docs/convert": {
type: "pipeline",
description: "`convertMdxFile`, `convertSingleMdxFile`, and `convertAllMdx`.",
required: true,
},
"@inth/docs/llm": {
type: "pipeline",
description: "Generate `llms.txt` and topic-scoped agent context files.",
},
"@inth/docs/lint": {
type: "pipeline",
description: "Validation APIs and the `inth-docs-lint` CLI.",
},
}}
/>

## Install

<PackageCommandTabs command="{pm} install @inth/docs" />

## Runtime integration

Use the root package when you want to render authored MDX in a React app.

```tsx
import { mdxComponents } from "@inth/docs";

const components = {
...mdxComponents,
};
```

The root export is the runtime contract. It is not tied to shadcn, TanStack Start, or any specific docs shell.

## Convert MDX

Use the conversion and remark packages when you want markdown output instead of browser rendering.

```ts
import { convertAllMdx } from "@inth/docs/convert";
import { defaultRemarkPlugins, remarkInclude } from "@inth/docs/remark";

await convertAllMdx({
srcDir: "content",
outDir: "public",
remarkPlugins: [remarkInclude, ...defaultRemarkPlugins],
});
```

## What to open in this app

<Cards>
<Card title="Quickstart" description="Install and send your first request." href="/docs/guides/quickstart" />
<Card
title="Quickstart"
description="Shows the basic conversion flow plus hydrated `Tabs` and `PackageCommandTabs`."
href="/docs/guides/quickstart"
/>
<Card
title="Components Fixture"
description="Shows the runtime adapters rendered together through `mdxComponents`."
href="/docs/guides/components-fixture"
/>
</Cards>

## Validation layers

<Steps>
<Step title="Package tests">
Cover semantic HTML and safe runtime behavior in `packages/docs/src/**/*.test.ts*`.
</Step>
<Step title="Pipeline fixtures">
Cover conversion, extraction, and LLM output in `apps/docs-smoke/scripts` and `apps/docs-smoke/content`.
</Step>
<Step title="Browser coverage">
Cover hydration and interactive adapters in the Playwright suite for this app.
</Step>
</Steps>
7 changes: 6 additions & 1 deletion apps/docs-smoke/content/docs/meta.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"title": "Docs",
"pages": ["index", "guides/quickstart"]
"pages": [
"index",
"guides/quickstart",
"guides/components-fixture",
"guides/auto-type-table-fixture"
]
}
55 changes: 47 additions & 8 deletions apps/docs-smoke/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,57 @@
"private": true,
"type": "module",
"scripts": {
"convert": "bun run scripts/mdx-convert.ts",
"llm": "bun run scripts/llm-generate.ts",
"build": "bun run convert && bun run llm",
"setup:real": "bun run scripts/setup-real-content.ts",
"test:real": "bun run setup:real && bun run scripts/test-real.ts",
"bench": "bun run setup:real && bun run scripts/bench.ts"
"dev": "bun run --filter @inth/docs build && vite dev --host 0.0.0.0 --port 3000",
"build": "bun run --filter @inth/docs build && vite build",
"preview": "vite preview --host 0.0.0.0 --port 3000",
"check-types": "tsc --noEmit",
"test:e2e": "bun run --filter @inth/docs build && playwright test",
"convert": "bun run pipeline:convert",
"llm": "bun run pipeline:llm",
"setup:real": "bun run pipeline:setup-real",
"test:real": "bun run pipeline:test-real",
"bench": "bun run pipeline:bench",
"pipeline:convert": "bun run scripts/mdx-convert.ts",
"pipeline:llm": "bun run scripts/llm-generate.ts",
"pipeline:build": "bun run pipeline:convert && bun run pipeline:llm",
"pipeline:test": "bun run scripts/test-pipeline.ts",
"pipeline:setup-real": "bun run scripts/setup-real-content.ts",
"pipeline:test-real": "bun run pipeline:setup-real && bun run scripts/test-real.ts",
"pipeline:bench": "bun run pipeline:setup-real && bun run scripts/bench.ts",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add bench alias to keep benchmark workflow running

This script rename leaves only pipeline:bench, but the benchmark job still executes cd apps/docs-smoke && bun run bench in .github/workflows/bench.yml (line 47), so the workflow now exits with Script not found "bench" and stops producing benchmark summaries. Please either restore a bench alias here or update the workflow command to bun run pipeline:bench so CI continues to collect benchmark data.

Useful? React with 👍 / 👎.

"pipeline:convert-real": "bun run scripts/convert-real.ts",
"pipeline:llm-real": "bun run scripts/llm-generate-real.ts"
},
"dependencies": {
"@inth/docs": "workspace:*"
"@fontsource-variable/geist": "^5.2.8",
"@fontsource-variable/geist-mono": "^5.2.7",
"@inth/docs": "workspace:*",
"@mdx-js/react": "^3.1.1",
"@radix-ui/react-separator": "^1.1.7",
"@radix-ui/react-slot": "^1.2.3",
"@tanstack/react-router": "^1.167.4",
"@tanstack/react-start": "^1.166.15",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"nitro": "3.0.260415-beta",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"tailwind-merge": "^3.5.0",
"tailwindcss": "^4.2.1",
"tw-animate-css": "^1.4.0"
},
"devDependencies": {
"@mdx-js/rollup": "^3.1.1",
"@playwright/test": "^1.54.2",
"@tailwindcss/vite": "^4.2.1",
"@types/mdast": "^4.0.4",
"@types/mdx": "^2.0.13",
"@types/node": "^22.10.0",
"typescript": "5.9.2"
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@vitejs/plugin-react": "^5.2.0",
"remark-frontmatter": "^5.0.0",
"typescript": "5.9.2",
"vite": "^7.3.1",
"vite-tsconfig-paths": "^5.1.4"
}
}
Loading
Loading