Repository navigation
Simplify generated AGENTS.md to use live docs - #15384
acoyfellow wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: 9bc665d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Codeowners approval required for this PR:
Show detailed file reviewers |
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/codemods
@cloudflare/config
@cloudflare/containers-shared
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/runtime-types
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-plugin
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
dario-piotrowicz
left a comment
There was a problem hiding this comment.
Approved with one small suggestion 🙂
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
|
@acoyfellow can we fix the conflicts here so we can get this merged 🙏 |
9e36881 to
9bc665d
Compare
|
Codeowners approval required for this PR:
Show detailed file reviewers |
9bc665d to
958b2ed
Compare
|
This pull request was not reviewed automatically because its author does not have write access to this repository. A maintainer with write access can start a review by commenting |
| * This file is injected into new Workers projects created via create-cloudflare | ||
| * to provide AI coding agents with retrieval-led guidance for Cloudflare APIs. | ||
| * | ||
| * Keep the Local Explorer endpoint list in sync with: | ||
| * - packages/wrangler/src/dev/start-dev.ts (printLocalExplorerAgentHint) | ||
| * - packages/vite-plugin-cloudflare/src/plugins/agent-hint.ts (printLocalExplorerAgentHint) | ||
| * | ||
| * @returns The AGENTS.md content as a string | ||
| */ | ||
| export const getAgentsMd = (): string => `# Cloudflare Workers | ||
|
|
||
| STOP. Your knowledge of Cloudflare Workers APIs and limits may be outdated. Always retrieve current documentation before any Workers, KV, R2, D1, Durable Objects, Queues, Vectorize, AI, or Agents SDK task. | ||
|
|
||
| ## Docs | ||
|
|
||
| - https://developers.cloudflare.com/workers/ | ||
| - MCP: \`https://docs.mcp.cloudflare.com/mcp\` | ||
|
|
||
| For all limits and quotas, retrieve from the product's \`/platform/limits/\` page. eg. \`/workers/platform/limits\` | ||
|
|
||
| ## Commands | ||
|
|
||
| | Command | Purpose | | ||
| |---------|---------| | ||
| | \`npx wrangler dev\` | Local development | | ||
| | \`npx wrangler deploy\` | Deploy to Cloudflare | | ||
| | \`npx wrangler types\` | Generate TypeScript types | | ||
|
|
||
| Run \`wrangler types\` after changing bindings in wrangler.jsonc. | ||
|
|
||
| ## Local Explorer (Debugging & Inspection) | ||
|
|
||
| When running \`npx wrangler dev\`, a Local Explorer API is available for inspecting and debugging local Workers, bindings, and storage state. The API base URL is printed in the terminal when the dev server starts. | ||
| const cloudflareDocsIndex = [ | ||
| "https:", | ||
| "", | ||
| "developers.cloudflare.com", | ||
| "llms.txt", | ||
| ].join("/"); |
There was a problem hiding this comment.
📝 Info: JSDoc detached from getAgentsMd
The doc comment with @returns The AGENTS.md content as a string now sits above the newly inserted cloudflareDocsIndex constant, not the exported getAgentsMd. The function is left undocumented and the constant carries a misleading @returns.
(Refers to this code)
Was this helpful? React with 👍 or 👎 to provide feedback.
| export const getAgentsMd = (): string => `# Cloudflare Workers | ||
|
|
||
| If the application uses Durable Objects or Workflows, refer to the relevant best practices: | ||
| Always retrieve current Cloudflare documentation before writing or changing Cloudflare code. Do not rely on training data for APIs, configuration, limits, or best practices. | ||
|
|
||
| - Durable Objects: https://developers.cloudflare.com/durable-objects/best-practices/rules-of-durable-objects/ | ||
| - Workflows: https://developers.cloudflare.com/workflows/build/rules-of-workflows/ | ||
| Start at ${cloudflareDocsIndex}. Choose the relevant product's \`llms.txt\`, then retrieve only the specific Markdown pages needed for the task. |
There was a problem hiding this comment.
🔍 Stale Local Explorer synchronization references
The Wrangler hint and Vite hint still tell maintainers to sync with a section getAgentsMd no longer generates.
Was this helpful? React with 👍 or 👎 to provide feedback.
Tracks DEVX-2642 internally.
Summary
Create Cloudflare currently generates an
AGENTS.mdwith a fixed list of commands, products, limits, error guidance, and best-practice links. That content can become stale as Cloudflare products and documentation change.This change replaces the fixed inventory with a small retrieval instruction:
The root documentation index remains stable while product-specific guidance can change in the documentation without requiring a Create Cloudflare release. Asking agents to retrieve only the pages needed for the task also keeps generated context small.
This deliberately differs from #14775, which expands the generated file with Local Explorer endpoints. The intent here is to keep product instructions in the live documentation and keep the generated file as the durable entry point to that documentation.
Validation:
pnpm run test:ciinpackages/create-cloudflare: 261 tests passedpnpm run check:typeinpackages/create-cloudflarepnpm run buildinpackages/create-cloudflareoxlint --deny-warnings --type-awarefor the changed TypeScript filesoxfmt --checkfor the changed files