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
32 changes: 0 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,3 @@ async function compile() {
});
}
```

## buildDocs

Generates a documentation tree for AI agents from a package's markdown sources
(component/hook READMEs plus any markdown under `docs/`), cleaned of Storybook /
GitHub service markers, badges and images. The output ships inside the npm
tarball so an agent working in a consumer project reads documentation matching
the installed version, discoverable via a generated `INDEX.md`.

`buildDocs` is a plain function (not a gulp plugin), so it works from any build
pipeline — call it from a gulp task, an npm script, or a rollup hook.

```ts
import {buildDocs, createDefaultDocsConfig} from '@gravity-ui/gulp-utils';

// buildDocs() with no config uses createDefaultDocsConfig(), the shared
// gravity-ui layout:
// docs/**/*.md → build/docs/guides/
// src/components/*/README → build/docs/components/ (legacy/ excluded)
// src/hooks/*/README → build/docs/hooks/ (private/ excluded)
buildDocs();
```

`rootDir` defaults to `process.cwd()`, and the package name shown in the
generated `INDEX.md` is read from that `package.json` — pass them explicitly
(`createDefaultDocsConfig(rootDir, packageName)`) to override.
Pass a custom `DocsConfig` to change the sources, output directory or INDEX
section order. Intra-repo `README.md` links are rewritten to resolve inside the
output; links to docs that aren't shipped are unwrapped to plain text.

The package README's `For AI agents` section, when present, is cleaned and placed
at the top of the generated `INDEX.md`.
Loading
Loading