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
43 changes: 43 additions & 0 deletions .github/workflows/llms-txt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Builds the site exactly like production (npm run build = generate-llms + docusaurus build)
# and verifies that the LLM/MCP text files (llms.txt, llms-full.txt, /docs/**.txt)
# are present and in sync with the HTML pages.
#
# Production deploys are done by Cloudflare Pages from `master`; this workflow does not
# deploy anything. It only guards against regressions before they reach master.
name: llms.txt parity

on:
pull_request:
push:
branches: [master]

permissions:
contents: read

jobs:
build-and-verify:
runs-on: ubuntu-latest
timeout-minutes: 20
env:
# Placeholders only. The Algolia theme refuses to build with empty values.
# Real search keys live in the Cloudflare Pages environment, never in this repo.
ALGOLIA_APP_ID: placeholder
ALGOLIA_API_KEY: placeholder
ALGOLIA_INDEX_NAME: placeholder
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # showLastUpdateTime reads git history

- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- run: npm ci

- name: Build site (same command as production)
run: npm run build

- name: Verify LLM text files match the built pages
run: npm run verify-llms
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,40 @@ yarn serve

---

### 🚀 Deployment

The live site is built and published by **Cloudflare Pages** (project `capmonstercloud-docs-v2`) directly from this GitHub repository. Every push to `master` triggers a production build. There is no deploy step in this repo — merging to `master` **is** the deploy.

The Cloudflare build runs `npm run build`, which is:

1. `node scripts/generate-llms.mjs` — generates the plain-text documentation for AI agents (see below);
2. `docusaurus build` — builds the site into `build/`.

Search (Algolia) credentials are provided as environment variables in the Cloudflare Pages project settings. **Never commit them to this repository** — it is public.

The `Dockerfile` is a legacy artifact from a previous hosting setup and is not used by the current deployment.

### 🤖 Text version for AI agents (llms.txt / MCP)

Alongside the HTML pages the build publishes plain-text copies of the documentation, used by the [CapMonster Cloud MCP server](https://github.com/CapMonsterCloud/capmonster-mcp-captcha-solver) and other AI agents:

- `https://docs.capmonster.cloud/llms.txt` — index of all pages with short descriptions;
- `https://docs.capmonster.cloud/llms-full.txt` — the whole documentation in one file;
- `https://docs.capmonster.cloud/docs/<page>.txt` — one file per page, e.g. `/docs/captchas/recaptcha-v3-task/` → `/docs/captchas/recaptcha-v3-task.txt`.

They are generated from the English MDX sources on every build by `scripts/generate-llms.mjs` (output is git-ignored), so they are always in sync with the deployed pages. Content that lives in React components rather than MDX (`<McpNotice/>`, `<PriceBlock/>`, `<BlogLink/>`) is rendered to text by that script — if you add a new content-bearing component, teach the script about it too.

To check locally:

```bash
npm run build # generates txt files + builds the site
npm run verify-llms # checks that txt files exist and match the built pages
```

The same check runs in GitHub Actions (`.github/workflows/llms-txt.yml`) on every pull request.

---

## 📄 License

[MIT](./LICENSE) © [CapMonster Cloud](https://capmonster.cloud/en/?utm_source=github&utm_medium=referral&utm_campaign=docs_repo_read)
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"docusaurus": "docusaurus",
"start": "docusaurus start --host 0.0.0.0",
"generate-llms": "node scripts/generate-llms.mjs",
"verify-llms": "node scripts/verify-llms.mjs",
"build": "node scripts/generate-llms.mjs && docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
Expand Down
Loading
Loading