agentleFS
CloudflareKnown publishercloudflare/workers-sdk/packages/workers-utils/AGENTS.md

workers-sdk / workers-utils

AGENTS.md4.6k starsChanged 6 months agoApache-2.0View on GitHub

Shared utility package used across wrangler, miniflare, and others. Two main areas: config validation and test helpers.

Trending

Quiet since August.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 1 mentionJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 1 mentionSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the cloudflare/workers-sdk repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about cloudflare/workers-sdk

The biggest 5 of 17 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 17

Talked about on GitHub, Bluesky and Hacker News (17 times).

On GitHub · 14

9 more on GitHub

The file

We split this AGENTS.md into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is 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.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Test helpers imported as @cloudflare/workers-utils/test-helpers across packages

    line 45

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md — workers-utils

OVERVIEW

Shared utility package used across wrangler, miniflare, and others. Two main areas: config validation and test helpers.

STRUCTURE

  • src/config/ — Configuration types, validation, normalization
    • validation.ts — The config normalizer (large file). Central to all wrangler config processing.
    • environment.ts — Environment/config field definitions (many deprecated fields)
    • config.ts — Config types
  • src/test-helpers/ — Shared test utilities used across packages
  • src/types.ts — Shared type definitions

KEY EXPORTS

Config

  • Validation pipeline normalizes wrangler.json/toml into typed config objects
  • Used by wrangler for all config loading

D1 migrations

  • getD1MigrationFiles({ projectPath, migrationsDir, migrationsPattern }) — shared glob-based discovery used by Wrangler and the Vitest plugin. Honour migrations_pattern rather than recursively collecting every .sql file.

Shared runtime utilities

  • createConfigCache(logger) — file-backed JSON config cache (node_modules/.cache or .wrangler/cache). Generic mechanism; the consumer passes its logger (this package has no logger singleton). Both wrangler (src/config-cache.ts) and @cloudflare/workers-auth build their own instances.
  • openInBrowser(url, logger) — opens the open package with a graceful copy-paste fallback when no browser opener is available. Logger is a parameter, not imported.
  • isInteractive() / isNonInteractiveOrCI() / isCI() — TTY / CI detection (the TTY check is inlined here to avoid a cycle back through @cloudflare/cli-shared-helpers). isCI() keys off CI specifically (ignoring TTY), for behaviour like redacting account names in public CI logs. These read ci-info, which is bundled into consumers' distributables. Because a bundled ci-info is an unmockable separate instance (and reads the real environment), consumers that need to fake CI in their tests mock this package's exports rather than ci-info — e.g. wrangler's vitest.setup.ts mocks @cloudflare/workers-utils so isInteractive/isNonInteractiveOrCI/isCI delegate to the mockable ci-info, which reaches both wrangler-source and bundled @cloudflare/workers-auth consumers (since @cloudflare/* is external in workers-auth's bundle).

Test Helpers

  • runInTempDir() — Creates temp dir, chdir's into it, stubs HOME/XDG_CONFIG_HOME, cleans up
  • seed(files) — Writes Record<string, string> of path->content into temp dir
  • writeWranglerConfig() / readWranglerConfig() — Mock wrangler config files (TOML, JSON, JSONC)
  • mockConsoleMethods() — Spies on console, returns normalized output with .debug, .out, .info, .err, .warn
  • normalizeString() — Multi-stage pipeline: strips timings, thin spaces, temp dirs, normalizes slashes/cwd/dates/tables/error markers/byte values, and scrubs the OAuth authorize URL's random state / code_challenge query params to <OAUTH_STATE> / <OAUTH_CODE_CHALLENGE> (so login-URL snapshots stay deterministic without mocking the URL builder)

NOTES

  • validation.ts is the largest single file in the monorepo after generated code — changes here affect all config processing
  • Many deprecated fields in environment.ts — check @deprecated annotations before modifying
  • Test helpers imported as @cloudflare/workers-utils/test-helpers across packages

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.