Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
12 changes: 12 additions & 0 deletions component-library/.storybook/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@ import { addons } from 'storybook/manager-api';

import theme from './theme';

const redirectMarkdownDocsPath = () => {
const docsPath = new URL(window.location.href).searchParams.get('path');

if (!docsPath?.startsWith('/docs/') || !docsPath.endsWith('.md')) {
return;
}

window.location.replace(docsPath);
};

redirectMarkdownDocsPath();

addons.setConfig({
theme,
});
2 changes: 2 additions & 0 deletions component-library/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ const preview: Preview = {
'Tokens',
'Token Reference',
],
'AI Tools',
['LLMS.txt'],
'Custom',
'Wrapped',
'PrimeVue',
Expand Down
21 changes: 18 additions & 3 deletions component-library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ app.mount('#app');

2. **Add styles** using one of the two options below.


### Styles Option 1 — Recommended: full Tailwind in your app

Use this if you want Tailwind utility classes in your own templates while still letting the library's components render correctly.
Expand Down Expand Up @@ -71,7 +70,7 @@ That single import is enough. `theme.css` includes:
- BCC design tokens, `@theme` / `@utility` definitions, and the rest of the design-system CSS inlined from `src/style.css` (including component-specific rules such as `BccInput` icon sizing and `BccButton` context tokens).
- `library-utilities.css`, the pre-compiled Tailwind **utility class** rules used inside library templates (which your build cannot infer from the published JS).

Do **not** rely on `library-utilities.css` alone with a minimal “base” import: you still need the full `theme.css` (or `style.css` for Option 2) so non-utility component styles and tokens are present.
Do **not** rely on `library-utilities.css` alone with a minimal “base” import: you still need the full `theme.css` (or `style.css` for Option 2) so non-utility component styles and tokens are present.

### Styles Option 2 — Pre-built CSS only

Expand All @@ -85,7 +84,6 @@ import '@bcc-code/component-library-vue/style.css';

You get the BCC theme and component styles only; no Tailwind utilities in your app.


# Components

All components are namespaced with `Bcc`. Use them in templates or register them globally in your `main.ts`.
Expand Down Expand Up @@ -130,9 +128,26 @@ The library exports both **custom BCC components** (e.g. `BccBadge`, `BccFrame`,
pnpm install
pnpm run start # Storybook on port 6006
pnpm run build # Typecheck, types, and Vite build
pnpm run docs:ai # Build Storybook, then generate AI-ready docs outputs
pnpm run build:llms # Regenerate AI docs from an existing storybook-static/index.json
pnpm run build:vite # Vite build only (includes theme.css)
```

### AI-ready docs outputs


`pnpm run docs:ai` generates the public AI documentation artifacts into `storybook-static/`:

- `/llms.txt`: Markdown index of public docs pages.
- `/llms-full.txt`: concatenated Markdown for all public docs pages.
- `/docs/<page>.md`: per-page Markdown mirroring the Storybook docs route, e.g. `/docs/foundations-colors--docs` -> `/docs/foundations-colors--docs.md`.

`build-storybook` runs the same generation after Storybook builds, so deployed docs get these files at runtime. The generated files live in `storybook-static/`, which is ignored and not committed; CI does not need a drift check unless these build artifacts are committed later.

The generator uses Storybook's `storybook-static/index.json` as the route source of truth, converts MDX to readable Markdown, and summarizes autodocs story pages from story metadata. It only reads public docs entries from `docs` and `src` through the Storybook manifest, and excludes private/internal/secrets paths, env files, dependency folders, build outputs, and caches.

Override the published URL base with `LLMS_BASE_URL=https://your-docs-host pnpm run build:llms` if needed. Only static Markdown and JSON documentation artifacts are produced.

### Folder structure (where to work)

- `src/components/custom`: New BCC-first components and component-specific styles/logic.
Expand Down
23 changes: 23 additions & 0 deletions component-library/docs/ai-tools/LLMS.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Meta } from '@storybook/addon-docs/blocks';

<Meta title="AI Tools/LLMS.txt" />

# AI-ready documentation

The Storybook build publishes static Markdown and JSON artifacts for AI tools and documentation crawlers.

## Outputs

- [`/llms.txt`](/llms.txt): concise Markdown index of public docs pages.
- [`/llms-full.txt`](/llms-full.txt): full Markdown export of all public docs pages.
- <a href="/docs/foundations-colors--docs.md" target="_blank">`/docs/<page>.md`</a>: per-page Markdown that mirrors each Storybook docs route, for example `/docs/foundations-colors--docs` -> `/docs/foundations-colors--docs.md`.

## Generation

Run `pnpm run docs:ai` from `component-library` to build Storybook and generate all AI docs outputs. Run `pnpm run build:llms` only when `storybook-static/index.json` already exists.

The generator uses Storybook's public docs manifest as the route source of truth. It converts MDX into readable Markdown, strips imports and presentational JSX, and creates metadata pages for autodocs generated from stories.

## Exclusions

The AI docs pipeline only reads public docs entries from the Storybook manifest. Private or internal docs, secrets, env files, `node_modules`, build outputs, and caches are excluded.
4 changes: 3 additions & 1 deletion component-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@
},
"scripts": {
"start": "storybook dev -p 6006",
"build-storybook": "storybook build",
"build-storybook": "storybook build && pnpm run build:llms",
"build": "run-p typecheck build:types build:vite",
"docs:ai": "storybook build && pnpm run build:llms",
"build:llms": "node scripts/generate-llms-files.mjs",
"build:vite": "rimraf dist && vite build && pnpm run build:sfc-styles && pnpm run build:library-utilities && node scripts/build-archivo-font.mjs && node scripts/build-theme-css.mjs",
"build:sfc-styles": "vite build --config vite.config.sfc-styles.ts && rimraf dist/sfc-styles.js",
"build:library-utilities": "tailwindcss -i src/library-utilities-input.css -o dist/library-utilities.css --minify",
Expand Down
Loading
Loading