kumo-astro / kumo-screenshot-worker
AGENTS.md4 starsChanged 9 months agoMITView on GitHub
Cloudflare Worker that uses Puppeteer + Browser Rendering to capture screenshots of Kumo docs pages. Used for visual regression testing. Parent: See root AGENTS.md for monorepo context. Never commit secret values. .dev.vars is gitignored at the root level. All requests require X-API-Key: <API_KEY> header. Returns { results: ScreenshotResult[] } where each result has a base64-encoded image or an error string. Limits: max 50 pages per batch, max 64 KB per css/js action payload. When captureSections: true, the worker looks for…
- Reads credentials
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,439 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository11 other files it gives its agents.
- AGENTS.mdAGENTS.md
- ci/AGENTS.mdAGENTS.md
- packages/kumo/AGENTS.mdAGENTS.md
- packages/kumo-astro/AGENTS.mdAGENTS.md
- packages/kumo-blocks/AGENTS.mdAGENTS.md
- packages/kumo-docs-astro/AGENTS.mdAGENTS.md
- packages/kumo-figma/AGENTS.mdAGENTS.md
- packages/kumo-figma/src/generators/AGENTS.mdAGENTS.md
- packages/kumo/src/components/AGENTS.mdAGENTS.md
- packages/kumo-studio/AGENTS.mdAGENTS.md
- index-knowledgeSkill
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 48
All requests require X-API-Key: <API_KEY> header.
- Very specific: line 71
When captureSections: true, the worker looks for elements with data-vr-demo, data-vr-section, and data-vr-title attributes in the DOM.
- Very specific: line 75
URL validation: all URLs are validated as https:// (or http://localhost).
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Screenshot Worker (@cloudflare/kumo-screenshot-worker)
Cloudflare Worker that uses Puppeteer + Browser Rendering to capture screenshots of Kumo docs pages. Used for visual regression testing.
Parent: See root AGENTS.md for monorepo context.
STRUCTURE
kumo-screenshot-worker/
├── src/
│ └── index.ts # Worker entry — auth, validation, screenshot logic
├── wrangler.jsonc # Worker config (no secrets committed)
├── tsconfig.json # Workers + DOM lib (DOM needed for evaluate() callbacks)
├── .dev.vars.example # Template for local secrets
└── AGENTS.md # This fileSETUP
Local dev:
cp .dev.vars.example .dev.vars # then fill in API_KEY
pnpm --filter @cloudflare/kumo-screenshot-worker devDeploy:
# Set secret (one-time per environment):
pnpm --filter @cloudflare/kumo-screenshot-worker exec wrangler secret put API_KEY
# Deploy:
pnpm --filter @cloudflare/kumo-screenshot-worker deploySECRETS
| Name | How set | Description |
API_KEY | wrangler secret put API_KEY | Shared secret sent as X-API-Key request header |
Never commit secret values. .dev.vars is gitignored at the root level.
API
All requests require X-API-Key: <API_KEY> header.
POST /batch
{
"baseUrl": "https://kumo-ui.com",
"pages": [
{
"url": "/components/button",
"captureSections": true,
"viewport": { "width": 1440, "height": 900 }
}
]
}Returns { results: ScreenshotResult[] } where each result has a base64-encoded image or an error string.
Limits: max 50 pages per batch, max 64 KB per css/js action payload.
Section Capture
When captureSections: true, the worker looks for elements with data-vr-demo, data-vr-section, and data-vr-title attributes in the DOM. These are set via vrSection and vrTitle props on ComponentExample.astro in the docs site.
SECURITY NOTES
- URL validation: all URLs are validated as
https://(orhttp://localhost). Private IP ranges and cloud-metadata endpoints are blocked to prevent SSRF. - Selector injection prevention:
sectionSelectorfrom the request is passed as a parameter topage.evaluate(), never interpolated into eval strings. action.js: executes arbitrary JavaScript in the browser context. This is intentional — callers are trusted viaAPI_KEY. Never expose the worker without the auth check.- CORS: currently
*(permissive). Acceptable for server-to-server use. Restrict to specific origins if the worker is ever called from a browser.
COMMANDS
pnpm --filter @cloudflare/kumo-screenshot-worker dev # Local dev server
pnpm --filter @cloudflare/kumo-screenshot-worker deploy # Deploy to Cloudflare
pnpm --filter @cloudflare/kumo-screenshot-worker typecheck # TypeScript check
pnpm --filter @cloudflare/kumo-screenshot-worker lint # oxlintNOTES
tsconfig.jsonincludes"DOM"inlib— required so TypeScript understands the DOM code insidepage.evaluate()callbacks, even though the Worker host has no DOM.Bufferusage requiresnodejs_compatflag inwrangler.toml(already set).- A fresh browser page is created per URL to prevent cookie/localStorage/style bleed between pages.
- External endpoint:
kumo-screenshot-worker.design-engineering.workers.dev
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

