# Run agentmarkup on any static site with the CLI

Use @agentmarkup/cli to run llms.txt, JSON-LD, markdown mirrors, and AI crawler controls over any built static output, with a CI check command.

## Why a CLI

The Vite, Astro, Next.js, and Nuxt adapters each hook a specific build. The CLI has zero framework coupling: point it at a directory of emitted HTML and it generates `llms.txt`, markdown mirrors, JSON-LD, AI-crawler `robots.txt`, and `_headers`, then validates the result. That makes it the right tool for Eleventy, Gatsby, Hugo, Jekyll, Docusaurus, plain static HTML, and any pipeline without a dedicated adapter.

## Setup

Install the CLI:

```
pnpm add -D @agentmarkup/cli
```

Add a config file in your project root:

```javascript
// agentmarkup.config.mjs
export default {
 site: 'https://example.com',
 name: 'Example',
 outDir: 'dist', // optional default; or pass the directory as an argument
 llmsTxt: {
 sections: [
 {
 title: 'Docs',
 entries: [
 { title: 'Home', url: 'https://example.com/', description: 'Start here' },
 ],
 },
 ],
 },
 markdownPages: { enabled: true },
 aiCrawlers: { GPTBot: 'disallow' },
}
```

The config is the same `AgentMarkupConfig` the adapters use, plus an optional CLI-only `outDir` for path resolution.

## Three modes

```
# Inject + write llms.txt, markdown mirrors, JSON-LD, robots.txt, _headers
agentmarkup generate ./dist

# Validate what is already on disk (CI gate) - exits non-zero on errors
agentmarkup check ./dist

# Preview without writing anything
agentmarkup generate ./dist --dry-run
```

- **`generate`** injects discovery links and JSON-LD into your HTML and writes `llms.txt`, `llms-full.txt`, markdown mirrors, `robots.txt`, and `_headers`.
- **`generate --dry-run`** reports every planned write without touching any files.
- **`check`** validates the files exactly as they are on disk and never writes. It exits non-zero on any error, and warns when a configured artifact is missing.

## A real CI gate

`check` is the piece the build-time adapters cannot offer on their own: a standalone command that fails CI when your deployed output would not be machine-readable. Add it after your build step:

```
# .github/workflows/ci.yml (excerpt)
- run: pnpm build
- run: pnpm exec agentmarkup check ./dist
```

Use `--strict` to also fail on warnings (for example a configured artifact that never got generated).

## Coexistence by default

Existing curated `llms.txt`, existing `robots.txt` rules, and existing page JSON-LD are preserved by default; the CLI only fills gaps. Opt into replacement per feature in the config when you want the CLI to take over an output.

One safety note worth knowing: the CLI never auto-guesses `public/` as an output directory, because it is a source asset directory in many frameworks. Pass it explicitly if you really mean it.

## The bottom line

If your site emits static HTML, [@agentmarkup/cli](https://www.npmjs.com/package/@agentmarkup/cli) gives you the full agentmarkup pipeline without an adapter, plus a CI gate to keep your machine-readable output honest over time.

For more on the underlying pieces, read the [llms.txt guide](/docs/llms-txt/), the [JSON-LD guide](/docs/json-ld/), and the [AI crawlers guide](/docs/ai-crawlers/).
