Shared tooling for the Dustin Edwards repositories, public so private repositories can use it.
default.json: the Renovate policy. Each repository'srenovate.jsonextends it; each setting's reason is in its description..github/workflows/: reusable workflows, each called, never run on its own. A caller pins a full 40-character devkit sha, andscripts/check-callers.mjs(run by the caller on its own workflow files) fails on a branch, a tag orsecrets: inherit.examples/holds the shape of each caller.pr.yml: every pull request check in one job, with one checkout and one install: the three ofchecks.yml, OSV-Scanner in pull request mode, actionlint and zizmor when the change touches.github/, no-bloat, the Worker bundle size (one Worker or several) and the reviewer. The caller isexamples/pr-caller.yml, and it replaces the pull request triggers of the six separate callers below. See "One job per pull request"..github/actions/: the steps of the shared workflows as composite actions (setup,footer,trailers,shared,osv-scanner,workflow-audit,no-bloat,worker-size,review), the one copypr.ymland the standalone workflows both run. A workflow checks out devkit at the commit its caller pinned (job.workflow_sha) into.devkitand runs./.devkit/.github/actions/<name>, so a caller still pins one sha; the caller's own files sit inrepo/beside it.checks.yml: the small checks in one job: it removes the "Generated by Claude Code" footer from pull request descriptions, refuses an AI attribution trailer on new commits (and on a pull request a commit authored or committed as Claude,devkit-check-trailers), and runs the shared-code check (devkit-shared). It checks out devkit at the caller's pin and runs each file with Node, with nothing to install. An edit of a description runs only the footer step. The caller isexamples/checks-caller.yml.review.yml: the automatic PR reviewer. A BLOCK verdict fails itsreview verdictcheck and its job, whose own check (checks / Reviewerinpr.ymlcallers) is required on every repository's default branch (Dustin, 2026-11-28), so GitHub's auto-merge waits for it; APPROVE and CHANGES are neutral, a skipped job counts as passed. It sends the job's OIDC token to Capsid, which reads the pull request through its GitHub App (the diff, the description, the Capsid job it names, CLAUDE.md at the base), skips one of only documents, tests or lockfiles and Renovate's, reviews it with DeepSeek V4.1 Flash on Workers AI through the AI Gateway and records the verdict;scripts/review-check.mjswrites it to areview verdictcheck and the job summary, never a comment. No secret. The caller isexamples/review-caller.yml.no-bloat.yml: the Knip, jscpd, legacy scan and test count ratchet (devkit-no-bloat), and on a pull request the lines it adds and removes in the job summary. Public repositories call it on every pull request; private ones weekly.worker-size.yml: the Worker bundle size budget (devkit-worker-size). A repository with several Workers lists them inworkers(a JSON array of{ "name", "working-directory", "config", "prepare" }): one job, one install, then each Worker's prepare and check in turn, each with its own summary section and annotations, the job failing if any one does.conformance.yml: the official MCP conformance suite against an MCP server underwrangler dev(devkit-conformance), from the server's own install and.conformance.json. Every repository that serves MCP calls it.worker-deploy.yml: deploy, verify and roll back a Cloudflare Worker. See "The shared deploy".restore-drill.yml: the weekly restore drill of a site's nightly D1 dump. See "The restore drill".access-drift.yml: the daily Access drift check of a site behind Cloudflare Access. See "The access drift check".code-map.yml: the code map for the explorer at capsid.dustinedwards.info. See "The code map".workflow-audit.yml: actionlint (with shellcheck) and zizmor at its default persona on the caller's workflows and actions. Any actionlint finding fails, and any zizmor finding atmin-severity(defaultmedium) or above; each is an annotation on its line. The tools are release files at exact versions (actionlint 1.7.12, shellcheck 0.11.0, zizmor 1.31.1), checked against their sha256. Exceptions are the tools' own files, each with its reason:.github/actionlint.yaml(paths,ignore) and.github/zizmor.yml(rules,ignore). devkit's own.github/actionlint.yamlacceptsjob.workflow_sha, which GitHub documents and actionlint 1.7.12 does not know yet.dependencies.yml: known vulnerabilities, found by OSV-Scanner 2.7.0 (checked against its sha256) in every lockfile in the repository, nested ones included (a repository with none passes). On a pull request or a merge queue entry it also scans the base commit and fails only on a vulnerability the change adds, which is OSV-Scanner's documented pull request mode; on a push or a schedule it lists every known vulnerability as a warning and in the job summary, without failing: Renovate and GitHub's alerts carry those fixes. It needs no repository setting and works the same in a private repository, where GitHub's dependency review needs paid Code Security.osv-scanner.tomlat the root ([[IgnoredVulns]]withid,reason,ignoreUntil) holds exceptions for every lockfile. The caller (examples/dependencies-caller.yml) adds a daily schedule, which finds an advisory published after a merge.release.yml: a package repository's release. When apackage.jsonversion on the default branch has nov<version>tag, it tags the commit that set it and publishes a GitHub release with the version's CHANGELOG section (GitHub's generated notes when there is none), so merging the version bump is the release and nobody pushes a tag by hand. A run releases every untagged bump since the tenth newest tag, oldest first, each on its own commit: a caller's concurrency group keeps only one waiting run (a newer one cancels the older pending run), so two bumps that merge together would otherwise leave one with no tag. Itscreatedoutput startsbump-consumers.yml(examples/release-caller.yml). devkit releases itself with it (release-self.yml), without the bump, which would need the token secret in devkit; Renovate finds the tag on its regular runs. Each release'snpm packtarball is attested (actions/attest-build-provenance) and attached to the release;build: truetags a release commit with the built files (Capsomer).scorecard.yml: OpenSSF Scorecard for a public repository, published, uploaded to code scanning, and gated: it fails when the score falls below the last published one (examples/scorecard-caller.yml).bump-consumers.yml: a package repository calls it on a tag push; it starts a Renovate run in every repository whosepackage.jsondepends on that package. It needs theRENOVATE_TRIGGER_TOKENsecret described in its header.
testing/,lint/andbin/: the package (@dustinedwards/devkit): shared test helpers, the shared Oxlint config and shared checks. See below.test/: CI runs these (npm test).oxlint.config.ts: devkit's own lint (npm run lint, in CI after the typecheck), with the shared config. See "The shared lint config".tsconfig.json: CI's typecheck (npm run typecheck, strict,checkJs, Node and DOM types): the package (testing/,lint/,vite/) against its.d.mts, the bins and the scripts. Not checked yet:test/,bin/live.mjs,bin/a11y.mjs,bin/a11y-judge.mjs,vite/dev-toolbar-client.mjsandscripts/fakes-contract.mjs.
Bins in the package, so a check runs the same locally (npx <bin>) as in the workflow that calls it. The workflow runs the bin from the caller's own install, so the caller lists @dustinedwards/devkit in its devDependencies at a tag.
-
devkit-no-bloat: Knip, jscpd, the blocks copied from the shared packages, Chrome's legacy scanner, and the tests, each count compared with the baseline in the repository's.no-bloat.json; it is how the network stops bolt-on code (a parallel helper, wrapper or stylesheet beside code that already does the job). The baseline is a ceiling. A count above it fails (exit 1, an::error::line each); a count below it passes with a::warning::, and the next change that touches the baseline lowers it (npx devkit-no-bloat --write-baseline, then commit.no-bloat.json), so a cleanup never fails a pull request on its own. A baseline is never raised. Knip is read from its JSON report, one per issue (an unused export, dependency or file), so a second unused export in a file that already has one counts; the baseline keys are Knip's issue types (files,exports,dependencies,typesand the rest). Every count the run measures needs its entry in the baseline, and no change may drop one, so a measure cannot be switched off by deleting its count or setting"jscpd": false. Against the branch the change goes into (--lines-from <rev>on a pull request; otherwise the first oforigin/HEAD,origin/mainandorigin/master, whateverGITHUB_ACTIONSsays, and with none a local run fails asking for--lines-from; a--lines-fromthat names the change itself fails too) a change that moves code may not: raise a Knip, jscpd or shared-copies count (a count the base lacks is raised from 0); change how a count is measured (the no-bloat config outsidebaselineandtools, a Knip config in any format Knip reads, a file a Knip plugin reads as its config (.mocharc.cjs,vite.config.ts,tsconfig.json: Knip's own plugin list at the tool's version) and the local modules a config in code imports, unless Knip takes no input from that config now that it did not take at the base (the inputsknip --debuglists for it, run on the base checked out beside this one; an entry naming a file not in git, such as a page the build writes, and a script one of its pages loads count as code), so a Vite config that renders pages differently is code,.jscpd.json, orpackage.json'skniporjscpd); change a workflow that runs this check (a job that callspr.ymlorno-bloat.yml, or a step that runs the bin; moving only its devkit pins, the bump Renovate opens, is no change); or move a shared package to an older release. No change at all may drop such a job, change anything in it but its pin and the inputs below (itsif,needs, the workflow it calls), change a job it waits for, change anything outsidejobs(on, whose filters stop it running), or change an input that turns the check off or decides what runs before it (node,node-version-file,package-manager,install,no-bloat,no-bloat-prepare,no-bloat-config, and no-bloat.yml'sprepareandconfig, named in any case), since the run that judges a pull request uses that pull request's inputs. The workflow is read with a YAML parser (yaml, installed by the check like knip), so CRLF line ends, flow maps, quoted keys, anchors and comments are the same data; a file that no longer parses fails; when pr.yml's no-bloat does not run on a pull request,--inputs-from <base> <caller>compares the caller's inputs with the base's and fails a change, and the owner makes such a change past the check. What an install runs or patches is a change of measure too: package.json's install scripts (preinstall,install,postinstall,prepareand the rest) andpnpm.patchedDependencies,.npmrc,.pnpmfile.cjs,pnpm-workspace.yamlandpatches/. A dependency removed beside a change of measure (a build plugin's config and the library it loads) is part of that change of measure, since Knip turns its plugins on by the dependencies listed, and it may not raise Knip'sunlistedorunresolved; removed alone or beside code, it is code.--write-baselinerefuses what the check would. A change of measure comes in a change of its own, and may raise a count but not lower one, so a narrower measure cannot hide what it stops reading, with one exception: a change whose only change of measure addsentryglobs orignoreDependenciesnames to a Knip config in data (no negation, nothing else in the config moved) may lower any Knip count, since each glob is now an entry (a file a build loads by convention, such as siteScript'sapp/site.tsandapp/islands/*.ts) and what it imports is reached, and a name ignored is one another package.json lists (a seal tool installed withnpm ci --prefix tools), and lower nothing else. The new lines still need their reason. Only a version bump on its own (tools, a lockfile, dependency versions moved forward, a new shared package) may raise or lower the counts.no-bloat.ymlandpr.ymlalso run--verify-installfrom the workflow's own devkit first, since the bin is the caller's own install: the installed devkit must be an exact x.y.z no older than the workflow's, and every file of it byte for byte the file at that release's tag, so a fork, afile:path, a lockfile that resolves elsewhere or an install script that rewrites the bin fails. What would hide the next change's code fails even when it hides nothing yet: every line a change adds to a Knip config needs its own reason (below); a Knip config in code (knip.ts,knip.config.js) or package.json'skniporjscpdcannot change, since neither can hold one; jscpd may not be narrowed (a largerminLinesorminTokens, a smallermaxLinesormaxSize, fewer formats, another mode than strict, a changedpattern,formatsExtsor--config,gitignore,skipLocalornoSymlinksturned on); a jscpd path may widen but never stop covering one it read; jscpd'sunread, gated like a count, is the source files it skips anywhere (one shorter than itsminLinesor with fewer tokens than itsminTokens, which can hold no copy, left out; jscpd 5 lists what it read only in its--summary, which the check asks for), and a file the change creates that it skips fails by name, so a file outside jscpd's path is caught even when another file starts being read; a directory with two lockfiles fails; a knip run's args cannot change (the config is strict JSON); a tracked file a.gitignorehides from Knip fails when the file or the hiding line is new;toolsmust be[email protected],[email protected]and[email protected], never older than the base's; and devkit must be pinned togithub:DrDustinEdwards/devkit#vX.Y.Zin every package.json, with no override. A real exception goes in the Knip config with a comment saying why on its line or in the comment block directly above it (new in the change: a comment above the list it joins is not its reason), behind ajscpd:ignore-startmarker with the reason after it, or after an@public,@betaor@aliastag (Knip never reports the export one tags) with who uses the export. A reason is words: three or more, fifteen letters in all, not a placeholder such asxorTODO. One the change adds without a reason fails, and so does any entry added to.jscpd.jsonor to the config's jscpd--ignore(either form), which are strict JSON and cannot hold one. Only a new test raises the tests' baseline, in the same diff. A source file over 500 lines (a test over 800;sizesets both,"size": falseturns it off; generated files are left out as for comments) is listed in the baseline'ssizewith its line count: a new file over the cap fails, a listed one may not grow, and one cut or removed passes, and--write-baselinelowers or drops its entry in the next change that touches it, so the list only shrinks. The shared copies ("shared copies" in the baseline,"shared": falseturns them off) are jscpd over the repository's source and every shared package installed innode_modulestogether (bin/copies.mjspackageCopies, 10 lines and 80 tokens, the network scan's thresholds): a block in both is a copy whatever it is named, each one an::warning::with both places, caught on the pull request rather than a day later by thecopiesjob inlive.yml. A package the rootpackage.jsondepends on and has not installed is a count that could not run. The legacy scan ("legacy" in the baseline,"legacy": falseturns it off) is Chrome's Modern Web Guidancelegacy-scan --jsonover the repository root (or the paths inlegacy.args; it skips docs, examples and tests itself): a static match of about 35 old patterns (a dialog built by hand,100vh, Enter that ignores an IME,resize: none), counted per guide. A match is a lead, not a verdict:npx modern-web-guidance retrieve <guide>gives the fix and when one may stay, and one kept on purpose (the guide's rubric drops it, such as a guard in a shared helper the scanner cannot follow) carrieslegacy-scan:keep, the id of the guide whose rubric drops it and the reason, in a comment on its line or the line above (// legacy-scan:keep ime-safe-enter-submit isImeEnter checks isComposing and keyCode 229), and is not counted. A marker keeps only its own guide's match, so one on a line another guide also flags keeps nothing of that guide's. A marker added with no guide or no reason fails, as ajscpd:ignore-startdoes. Gated: each Knip heading, the legacy scan's guides, jscpd's clones and duplicated lines (its percentage is shown, not gated, since deleting code that is not duplicated raises it), the shared copies' clones and lines, and the test files and test cases. Tests are counted statically, never run: the files matchingtests.files(default**/*.{test,spec}.{js,mjs,cjs,jsx,ts,mts,cts,tsx}), and in them eachtest(,it(orspecify(call of node:test, vitest, mocha or Playwright, andt.test(/t.it(subtests with a quoted title, outside comments and strings (describe, hooks and Playwright'stest.skip(condition)are not cases; a case made in a loop counts once). The share of source lines that are comment lines is recorded too; a rise of more thancomments.tolerancepoints (default 1) with more comment lines than the baseline is a warning, or a failure withcomments.fail: true, so deleting code alone never trips it. A tool that cannot run fails, naming its error, and so does a missing.no-bloat.jsonor one with an empty baseline, a config that is not JSON, Knip output with no heading it reads, a jscpd run that read no files, and a baseline entry that no run in the config measures.--lines-from <rev>is the pull request mode: it is the base for the raise and reason checks (above) and adds the lines added and removed since the merge base with<rev>, as code, tests, comments, docs and other, blank lines not counted;no-bloat.ymlpasses it on a pull request, so the job summary shows them. knip, jscpd and the legacy scanner are never the repository's own: the check installs them itself, at the config's exacttoolsversions (default[email protected],[email protected],[email protected]), into a fresh directory and npm cache, from the npm registry named outright, with no user, global or project npmrc and no install scripts, and runs them on its own node with no variable that loads code (NODE_OPTIONS,LD_PRELOAD,npm_config_*,GIT_*, and in Actions the proxy and certificate variables an earlier step could set). So a postinstall or a pnpm patch that rewrites node_modules/knip, a shrinkwrap or second lockfile, or a hand-made node_modules with no lockfile is never the program that counts. In Actions the check counts the commit the run is for (GITHUB_SHA, which no step can change): HEAD moved, a tracked file that differs from it, or one marked assume-unchanged or skip-worktree fails, so an install script that puts the base back is caught. Code the repository runs in the job before the check (its install scripts, the prepare command) still runs on the runner with sudo and could change the runner itself (git, node, devkit's own checkout); that is why changing either is a change of its own. The config's fields are in the header ofbin/no-bloat.mjs. There is no report-only mode:--warn-onlywas removed in 0.37.0, because a report never stops a copy from merging, anddevkit-shareddoes not count a no-bloat step withcontinue-on-error: trueas the check. -
devkit-conformance: the official MCP conformance suite (@modelcontextprotocol/conformance, from the repository's own install) against a Worker's protocol layer and its authorization server underwrangler dev, per era, from.conformance.json. A scenario with a recorded pass count must hold it exactly (fewer is a regression, more means tighten the baseline); one without must pass every check. A config with noscenariosfails unless"allow_no_scenarios": true. Then it pins what the suite treats as optional: CIMD advertised,/registerat the auth origin registering an allowlisted callback (201, no token) and refusing any other (400invalid_redirect_uri), and/mcpwithout a token answering 401 with aresource_metadatachallenge (auth.resourceMetadata: falsewaives the challenge for a server that does not advertise it yet). Locally (npx devkit-conformance) and on Actions throughconformance.yml, the job every MCP server's repository calls (examples/conformance-caller.yml;working-directoryfor a server inmcp/). The config's fields are in the header ofbin/conformance.mjs. -
devkit-bootstrap: the postinstall. Copies eachwrangler*.jsonc.exampleat the root to its real name when that is missing, never overwriting, then runswrangler typeswith stdin detached, so wrangler's hidden skills prompt cannot hangnpm install. Arguments after--go towrangler types;--types-onlyskips the copy (fortypecheck);--checkfails when apackage.jsonscript runs a barewrangler types. -
devkit-size-budget: the client bundle budget, run after the build. Reads React Router's asset manifest and fails when the heaviest page's initial JS or CSS, any chunk loaded later, the lazy CSS together, or, whentotal_js_kbis set, all the JS together (every page's and every chunk, so code split into more lazy chunks still counts) is over the gzip limits in.size-budget.json({ "initial_js_kb", "lazy_chunk_kb", "css_kb", "lazy_css_kb" }, optionaltotal_js_kb, reported and not budgeted when unset, and optionalclientandserverpaths). Fails closed on a missing build, config or manifest.devkit-route-weightreports every route; this gates the heaviest one. -
devkit-declarations: the declaration gate for a package with typedexports. Run it in the package's root after its declarations are built: it packs the package, installs the tarball beside links to the repo's dependencies, and typechecks a generated file withcompositeanddeclarationon, which calls every exported function and reads every other export. It fails on TS2883, a function whose return type is defined in a module theexportsmap leaves out (Prelum 0.68.0'sSchemaNode, site-runtime 0.182.0'sImagesLike), which breaks a project that keeps the result under a composite tsconfig. Export the type from the entry point that returns it. An entry that does not load in Node (it importscloudflare:workers) is a warning and is not checked. -
devkit-css-vars: the custom-property gate. Fails on avar(--x)with no fallback that nothing declares, in the.css,.tsand.tsxfiles under thedirsof.css-vars.json;declared_innames files or directories (Capsomer's package) whose declarations count, andexternalthe properties a library sets at run time (exact, or a prefix ending in*). An undeclared property resolves to its initial value, so a shadow or color silently vanishes (Foxing's--fx-shadow-md, 14 uses, 2026-11-11).pr.ymlruns it, from devkit's own file at the caller's pin, in every repository with a.css-vars.json, anddevkit-sharedrequires that file in a repository with stylesheets (a warning before 0.34.0). Its optionalclasseslist does the same for a CSS package's classes: each{ package, dirs, prefix }fails on a class with the prefix (cap-) that a.tsor.tsxfile writes and one of the package's stylesheets styles, when nothing underdirsimports that stylesheet, directly or through the package's own@imports. A repin that moves a class to its own stylesheet then fails the pull request instead of drawing plain markup (capsid #936: the Portal lost.cap-stackand.cap-textwhen Capsomer 0.139 moved them out ofbase.css). -
devkit-tokens: the design-token gate. Fails on a raw hex color outside the token file and on a px font size, in the.ts,.tsxand.cssfiles under thedirsof.tokens.json(hex_exemptandpx_font_exemptlist the surfaces that cannot use a token or a rem: e-mail markup, Satori and SVG). A numeric entity such as✓is not a color. -
devkit-gates: the meta-gate.devkit-gates --min 6fails when the package scriptcheck:all(or--script <name>) chains fewer gates than the minimum, so a gate dropped from the chain is noticed. -
devkit-db-migrate <database>:wrangler d1 migrations applythat stays local unless--remote-confirmis passed (a plain--remoteis refused), for a site whose only D1 database is production. -
devkit-fetch-fonts: self-hosts Google Fonts at build time from.fonts.json(css_url, and optionallysubsets,dir,url_prefix,css,display,header): downloads the woff2 files (only from fonts.gstatic.com, no redirect) for the subsets kept and writes the@font-facestylesheet. -
devkit-test-assertions: fails on atest(...)orit(...)whose body calls no assertion, since a test that cannot fail proves nothing. Reads the test files under thedirsof.test-assertions.json({ "dirs": ["test"], "floor": 1772, "enforce": true });flooris the least number of test calls the scan must read, so a scan gone blind fails;enforce: falsemakes each finding a warning. Lexical, so it needs no TypeScript. -
devkit-deploy-install: the install worker-deploy.yml runs and pr.yml runs on every pull request (deploy-install):npm ci --ignore-scripts, each dependency the lockfile resolves from git built from its locked commit (its ownprepare, which a package shipping no dist/ needs), then the repository's ownpostinstallandprepare.INSTALLset in the environment runs that command instead. -
devkit-verify-deploy <origin>: theverify-commandofworker-deploy.yml. Exit 0 passes, 1 refuses (the deploy rolls back), 3 could not decide. Each--page(default/) must answer 200,--health /healthmust not reportfail, and--assetsneeds every hashed asset the first page names to answer 200 (a rollout that has not converged is exit 3, never a rollback). One bin replaces thecurlblock each caller wrote in its workflow; the live gate runs it from$DEVKIT_DIR, since the gate installs nothing. -
devkit-secrets: the secrets gate, from.secrets.json. Every named secret (secrets, orsecrets_moduleasfile#EXPORT) is declared on the Env interface ofenv_types, its own members or those of a type it extends such as site-runtime'sSiteSecrets(withenv_exact, nothing else the file itself declares is); no secret is read outside the server boundary (server_only, defaultworkers/and*.server.*), read off the TypeScript syntax tree soenv.X,env["X"]andconst { X } = envcount and a comment does not, eachclient_allowedexception naming a secret and a reason; git itself ignores.dev.varsand theignoredfiles; and no tracked file under 2 MB (a larger one is named in a notice, not read) holds anything shaped like a live credential (built in: Anthropic, Stripe live and webhook, GitHub, AWS, Cloudflare, Sentry and private keys;shapesadds the site's own;shape_allowexcuses a file with a reason) or the verbatim value of a.dev.varscredential named indev_var_values. Each root has a file floor, the scan must find reads inside the boundary, andminimum_checksfloors the run. A git that cannot answer fails. The fields are in the header ofbin/secrets.mjs. -
devkit-destructive: the destructive-action gate, from.destructive.json, read off the syntax tree.intents: every intent a routeactionbranches on is classified destructive or reversible (with the reason), and a destructive branch calls the confirmation predicate (defaultconfirmationSatisfied) inside the action, not in anonClick.tools: every tool of a machine API's string-array const is classified, and a destructive tool's descriptor has apolicystring.bindings: a storage binding with ruleno-deleteis never deleted from and each function it is handed to is listed with the reason it cannot delete; ruled1-dump(the backups bucket) is deleted from only through d1-dump and handed only to d1-dump's functions. New and stale entries both fail by name; each rule is proven on planted code first. The fields are in the header ofbin/destructive.mjs. -
devkit-worker-size: runswrangler deploy --dry-runand fails when its "Total Upload" (raw or gzip, the size Cloudflare counts) is over the budget in the repository's.worker-size.json:{ "raw_kib": 1700, "gzip_kib": 400 }, with optionalargsfor the dry run andwrangler(npx spec when wrangler is not installed, default[email protected]). Cloudflare's upload limits are far higher; the budget is about startup, which must finish inside 1 s. No budget file, a failed dry run or no Total Upload line fails. The workflow'sprepareinput gives the dry run a config (cp wrangler.jsonc.example wrangler.jsonc, or a build) andworking-directorynames where it lives. No secret is needed. -
devkit-route-weight: the gzip JS and CSS a first visit to each route downloads, read from a React Router client build's manifest (build/client, or--client <dir>): the client entry, then root down to the route, each file counted once, gzipped at level 9. With the optional.route-weight.json, a route overbudget_bytes, or grown past its baseline by more thangrowth.ratioandgrowth.bytes(default 0.05 and 1024), is a::warning::line and the run passes; with"enforce": trueit is an::error::and the run fails, and the config must setbudget_bytes.npx devkit-route-weight --write-baselinerecords the baseline;linked_css: truealso counts a stylesheet the JS links by URL (app.css?url). On a build with a /site.js (siteScript), a route that does not declarehandle = { hydrate: true }weighs /site.js and its stylesheets, since its page loads no React. No build fails. The config's fields are in the header ofbin/route-weight.mjs. -
devkit-mutation-report: merges a StrykerJS run's JSON reports (--dir, defaultreports/mutation) and prints the mutation score and the pruning candidates (zero-kill and covered-by-others tests), never deleting anything.--protected <regex>is the repository's keep rule, matched against each test's file and name;--tableadds a per-file table and--json <file>writes the kill matrix. -
devkit-shared: the shared-code check: keeps a repository on the shared code. It fails on a shared package, devkit workflow pinned to a raw commit, and warns on one behind its newest release tag (Renovate opens that bump), except that a site-runtime pin fails once it is behind a minor out three days and a devkit pin (package.json or workflow) once it is behind a minor out two days, since devkit's no-bloat check runs from the caller's own pins; on a local copy of something a shared package exports (a definition with its name or a known alias, or text only its builder writes, such asUser-agent:,<urlset, an inlinetype="speculationrules", a directIMAGES.input(resize, an island loader's[data-island]query, JSON-LD or head tags by hand, a hex or base64url encoder, a constant-time compare, a pre-paint theme script, or a security header set in a static_headersfile); on a direct dependency on a library a package wraps (marked, remark, mermaid, sanitize-html, jose); on a shared feature the app's kind needs and does not import; on a site setting its own value for one of Capsomer's tokens for the whole page (:root,htmlorbody), such as--page-max,--radius-mor--text, which belongs in Capsomer or its site layer; on British spelling (codespell's en-GB to en-US list, throughpipxwhen codespell is not installed); on a devkit workflow the repository's kinds need that no workflow calls (a call ofpr.ymlcounts as each ofchecks,review,dependencies,workflow-audit,no-bloat,worker-sizeandcss-varsits inputs leave on,node: falseturning off the last three; every repository:checks,workflow-auditanddependencies; an app of kindsite,privateorworkerwith a wrangler config:worker-sizeand, as a lasting warning,worker-deploy; a public repository with JavaScript or TypeScript:no-bloat; a shared package:bump-consumers; a repository with.cssfiles outside tests: a.css-vars.jsonandpr.yml'scss-varsleft on, waived asworkflow:css-vars), where CI running the bin itself, directly or through a package script, counts, and several apps need the union of their kinds'; on a separate caller of one of those six that still runs onpull_requestormerge_groupbeside apr.ymlcall that covers it (a warning in 0.26.0, a failure from 0.27.0: remove it, or keep only its schedule); and on a test fake devkit already ships (a GitHub API fake of contents or git data routes, an Access key pair with the key set it serves, a fetch that refuses every URL, a list ofDELETE FROMs), naming./github,./access,./networkor./d1: the one check that reads test files. Whether a repository is public comes from the Actions event, so locallyno-bloatis only a warning. The kinds aresite(a public Worker site),static(a public static site),private(behind Cloudflare Access),worker(an MCP or API Worker) andpackage, set per directory in.shared.jsonwhich also holds each exception with its reason ("waive": { "workflow:<name>": "why" }for a workflow). An unknown key or kind in.shared.jsonstops the check (exit 2, naming the valid ones), and so does a--fromdirectory missing a package; locally, a package not innode_modulesis named in a warning, since copies of its exports were not checked. An exception that excused nothing in the run (copies,waive,libraries,tokens,spelling.ignore,spelling.contracts) is a warning naming it, judged only when every package was read. Exit 2 means the check could not run. On a pull request (--base <sha>, whichpr.ymlandchecks.ymlpass) it checks the base too, as its own checkout read by the same packages, and a failure the base already has is a warning marked "already on the base branch": the pull request fails only on what it adds, never on a copy merged earlier, a pin a newer release left behind or a new rule the repository has not met yet. The repository's state is judged once a day on the default branch, by the caller'sschedule(examples/pr-caller.yml), with no base: that run goes red on what is owed and Capsid's watcher opens one job for the repository. A new rule arrives as a warning (::warning::, exit 0) for one release and fails from the next, so the sites can move first: each rule'sfailsFromnames the release, compared with devkit's ownpackage.jsonversion, so releasing it is the flip. Three heuristic features (an accessibility test, noindex on admin and login routes, a feed's alternate link),worker-deployand a stale exception stay warnings.--fix-spellingrewrites the British spellings in place; a line ending in acodespell:ignorecomment is a data contract it leaves.devkit-shared listprints every shared feature and every package's exports;shared-list.ymlpublishes that list hourly to https://github.com/DrDustinEdwards/devkit/blob/shared-list/SHARED.md. It also checks the AI code (area 11): a model call or prompt that skips the shared pieces (Anthropic outside site-runtime./anthropic, a Workers AI run without a timeout, gateway or max_tokens, an AI Search call with no timeout, JSON cut out of free text with a regex, a prompt's own dash rule instead of WRITING_RULES, a routine fired outsidefireOnce), each finding naming its checklist item, and an MCP server's site-runtime more than one minor behind the newest release. And it holds the agent jobs to one owner each (jobs,JOBSinbin/shared.mjs, the "Agent jobs" table in SHARED.md): backups and site checks with drift repair are Capsid Admin's, media, writing and webmentions Carrel's, email site-runtime's, the Claude Code hooks devkit's. An MCP server's tool for a job another owner holds fails, read by the tool's name (less its site prefix), its title and the operator tool or API path its handler calls, so a renamed copy fails too;"copies": { "<file>#<tool>": "why" }excuses one tool. The config's fields are in the header ofbin/shared.mjs. A repository runs it by callingpr.yml(examples/pr-caller.yml) orchecks.yml(examples/checks-caller.yml), which needs nothing installed: it checks out devkit at the pinned commit and reads each package at its newest tag. Spelling also reads each part of a camelCase or CONSTANT_CASE name; the fix rewrites whole words only, so an exported name is renamed by hand with the old one kept as an alias. -
devkit-check-trailers: with no arguments it reads the range from the GitHub event (EVENT,PR_BASE,PR_HEAD,PUSH_BEFORE,PUSH_AFTER, set bychecks.yml), and formerge_groupthe group's base and head from the event payload; locally,npx devkit-check-trailers <base> <head> [--authors]. Schedule,workflow_dispatchandrepository_dispatchadd no commits and pass. Exit 1 names each commit and how to fix it; exit 2 means it could not read the commits or does not know the event, which is a failure, not a pass. -
devkit-console: the console ratchet. Counts the rawconsole.*calls in server code (filesin.console.json, default every JS and TS file;ignore, default tests, scripts, bin, type declarations and built files, is where the logger that wraps console is named), read with comments and strings blanked, and fails when the total rises above the config'sbaseline, naming each file above its own count. A fall is a warning asking to lower the baseline;npx devkit-console --write-baselinerecords it, in the same reviewed change for a deliberate raise. No file read fails (exit 2). The config's fields are in the header ofbin/console.mjs. -
devkit-migrations <dir>: the expand-only migration check for D1.--writerecords each migration's sha256 in<dir>/manifest.json(--manifestto move it) and refuses, without--force, to change a recorded hash or to drop a recorded migration that is gone from disk; the check fails on a migration that is not recorded, differs from its hash, or is gone, on fewer than--minmigrations, and on a migration after the manifest'sexpand_only_after(set by the first--write) that drops or renames a table or column, drops an index, view or trigger, updates, replaces or deletes rows, or setsPRAGMA writable_schema, without a-- contract: <reason>line (a marker inside a block comment or a string is not one). When wrangler's local state (--state, default.wrangler/state) holds one database with ad1_migrationsledger, the ledger must match the files;--require-ledgerfails when there is none. -
devkit-migrations <dir> --apply <database> [--config <file>]: applies a deploy's pending D1 migrations, so no site runs them by hand. Run it in the deploy before the build (worker-deploy'spre-deploy). It reads the remote list; pending migrations that only add are applied after the Time Travel bookmark is read, with the restore command in the log and the step summary. A pending migration that drops, renames, updates, replaces or deletes rows (a trigger body counts when the same file writes rows), or carries a-- contract:line, or a pending file whose name is notNNNN_name.sql, is refused with the hand-run command, and so is a list or bookmark it cannot read or a database still behind after the apply. Every refusal exits 1 before anything is deployed. -
devkit-a11y: the live accessibility check, area 9's on the scoreboard.npx devkit-a11y --origin https://example.com [--from <where it is served now>] [--max-pages 8]loads the home page, a 404 and up to--max-pagessitemap pages of different types (about, contact, sign-in, then list and detail pages, one per section; nothing with a file extension but.html) in Chromium, and prints each finding as::error title=<item>::<page> <detail>(or::warning), titled with the checklist item it proves: L1 axe-core at 1440 and 390 px in light and dark (WCAG 2.2 A and AA rules are errors, best-practice rules warnings); L2 a 40-press Tab walk (a skip link to main first, a visible focus change at every stop, nothing fixed or sticky over it, no trap) and, on up to three buttons it reached that open something (aria-expanded,aria-haspopup,popovertarget), Enter then Escape: what opened must close and focus return to the button; L3 sideways scroll at 320 px, text clipped by the WCAG 1.4.12 spacing, and a 720 px viewport as a proxy for 200% zoom (no sideways scroll, and a visible nav link or a focusable menu toggle; the finding says it is a proxy); L4 animations still running under reduced motion, and axe and a 20-press Tab walk again in forced colors (a rule or a lost focus ring only there); S2langandtitle(errors), oneh1, no skipped heading level, the landmarks and a title no other page has (warnings); S3 an image with no alt; S6 no page at/accessibility. Exit 0 with no errors, 1 with errors, 3 when nothing failed but an item could not be measured (no browser, a page or view axe could not scan; each a::notice title=<item>::<url> could not measure: <reason>), 2 when the site did not answer. When the installed Playwright's own Chromium build is missing, it launches the newest Chromium build Playwright installed (PLAYWRIGHT_BROWSERS_PATH, else~/.cache/ms-playwright) orDEVKIT_A11Y_CHROMIUM, and says which. Read-only: it never signs in or submits a form, so signed-in pages (L5) are not checked; they need a test account on each site. It needsplaywrightand@axe-core/playwright, which devkit does not install: they are found from the working directory's package, then beside devkit, thenNODE_PATH; Chromium isnpx playwright install --with-deps chromium, whichlive.ymlruns. The judging isbin/a11y-judge.mjs, apart from the browser driving. -
devkit-live: the completeness scoreboard. See "The scoreboard". -
devkit-ops-audit: running and recovery on a live site, area 8's scoreboard check:devkit-ops-audit --origin <origin> [--from <host>] [--health-path /health] [--repo owner/name] [--branch <branch>] [--path <dir>] [--drill-workflow <file>] [--wrangler <path>]. It reads/health(H1: 2xx or 503,application/health+jsonorapplication/json,Cache-Control: no-store,X-Robots-Tag: noindex; H2: site-runtime's shape,statuspass, warn or fail,ok,timeandchecks; H3: 503 for fail and only for fail; H4:shaof 7 to 40 hex characters; B1: abackupunder 26 hours old with no warning; C2: acroncheck that passes) and a random missing path (N1: a 404, never a redirect or a 200; N6: on a site whose home page is HTML, the shared error page: HTML with a<title>and Capsomer's ErrorPage region, classcap-error-page). With--repo,shamust be the branch head (the default branch unless--branch, and with--paththe newest commit that touched that directory, for a Worker such as an admin MCP inmcp/that deploys only when its own directory changes; a head under 30 minutes old is a warning, a deploy may be in flight), and with--drill-workflow, that workflow's newest completed run on the branch must be a success under 8 days old (R1). With--repoit also compares/health'scheckswith the bindings the repository's wrangler config declares (H5:--wranglernames the file, else the first ofwrangler.jsonc,wrangler.json,wrangler.jsonc.example,wrangler.json.exampleat the root) and lists every D1, R2, KV, Durable Object, queue, service, email, AI, Images, Browser and other probe-able binding no check covers;.ops-audit.jsonbeside the config holds the exceptions,{ "unprobed": { "EMAIL": "<reason>" }, "checks": { "BLOG_IMAGES": "images" } }, an unprobed binding with no reason being an error. A check covers a binding when the names match ignoring case and punctuation or one holds the other, and a check named for its kind (db,kv,email) covers the one binding of that kind. GitHub is read without a token, or withGITHUB_TOKEN. A GitHub read that fails (401, 403, 429, no answer), or no--repoat all, leaves the items it would prove (H4's sha, H5, R1) not measured: each is a::notice title=<item>::<url> could not measure: <reason>, so a broken token or a missing flag never shows green and never hides the health findings. A health route elsewhere is named with--health-path; nothing falls back to it silently. Each finding is::error title=<item>::<proof URL> <detail>(or::warning), after one plain line per check saying what it read; exit 0 with no errors, 1 with any, 3 with none but an item not measured, 2 when the site answered nothing.
Per-repository measurements (capsomer's page weight, capsid's dashboard size budget) stay in the repository.
One board shows each of the 12 areas of the shared code against the package and every live site, at https://github.com/DrDustinEdwards/devkit/blob/scoreboard/SCOREBOARD.md. It is filled only from live checks and verifiers' verdicts, never from the thread that built an area.
live/sites.json: every live site, its kind (site,static,worker, orappfor a signed-in app behind Access, which only the checks that nameappgrade), its productionorigin, andfromwhere it is served until its domain moves.live/areas.json: each area, the thread that builds it, and its checks. A check is a bin in a shared package, installed at the newest release tag (orref), run as<bin> --origin <origin> [--from <from>]. It prints each finding as an annotation,::error title=<item>::<proof URL> <detail>, and exits 0 with no errors, 1 with errors, anything else when it could not run: the contractprelum-auditkeeps. An::errorline fails the check whatever its exit of 0, 1 or 3, and exit 1 with no::errorline is a crash, so it isunmeasured, as is a check killed at its 20-minute timeout (with its whole process group). An item a check could not measure (a service refused, a proxy hid the answer, a GitHub read failed) is never a pass or a failure: the check prints::notice title=<item>::<url> could not measure: <reason>and exits 3 when nothing failed (the Monitoring Plugins guidelines' UNKNOWN). The run records it asunmeasuredwith the reasons, as it does any other exit (a crash, an outage), and the cell shows ❔ "could not measure" with why, unless another check of the cell measured a failure.kindsnames the site kinds it applies to;argsadds arguments for every site andsite_args({ "<site id>": [...] }) for one, as area 8 gives each site with a restore drill its--repoand--drill-workflow. A check's bin gets only the basics of a process (PATH, HOME, locale,NODE_EXTRA_CA_CERTS,NODE_NO_WARNINGS,NODE_ENV, proxy variables without their credentials), the variables itsenvlists (GITHUB_TOKEN,PSI_API_KEY) and, for a"grants": truecheck, the oneMCP_TEST_GRANT_<HOST>for the site being probed;git ls-remoteandnpm installget the basics alone. An area'sskipnames a site it does not apply to, and why; itsuncheckednames what its checks cannot reach (a signed-in site or page), and why. The board lists each one, and the job is not finished while any remain.- A check that needs a site's secrets is reported, not run: it runs where the secrets already live (area 5's runs in Carrel, which holds the site keys) and publishes its result on that system's own https origin, and its
areas.jsonentry is{ "name", "report": "<https URL>", "max_age_minutes"? }. The report is{ "check", "at", "ref", "sites": { "<site origin, or its from>": { "status": "pass" | "fail" | "unmeasured", "findings": [{ "severity": "error" | "warning" | "unmeasured", "check", "detail" }] } } }, never with a secret in it. A report that can't be read, is older thanmax_age_minutes(default 60), names another check or leaves a site out counts asunmeasuredfor that site, with the reason (as does the older statuserror), apasswith an error finding counts asfail, and one with an unmeasured finding asunmeasured. No site key is ever stored in GitHub. live/verdicts/area-<n>.json: a verifier's verdict, per site and for thepackage,complete,partialormissing, with evidence links. The verifier must not be the area's builder, and a complete cell needs evidence:devkit-live lintfails CI otherwise.
A cell is complete only when its checks pass in the newest run, the verifier signed it complete, and no run after the verdict failed; a failure after a verdict voids it until a fresh verifier signs again. Checks passing without a verdict is partial; a failing check is missing, and one that could not measure is ❔. An area with no live check at all (area 12, the checks and tooling) is the verdict alone in every cell, as the package column is. The job is finished when every cell is complete and every site cell with a live check has passed seven daily runs in a row. Lines added and removed per area are the merged pull requests labeled completeness-area-<n>, read with the LIVE_GITHUB_TOKEN secret (a fine-grained token on all of the owner's repositories with Contents, Pull requests and Metadata read) (without it, public repositories only).
live.yml runs it daily, fails when any check fails (a check that could not measure is a warning, with its reason), and keeps 60 days of runs on the branch. Locally: node bin/live.mjs run --out run.json --areas 1 --sites capsomer, then node bin/live.mjs board --runs <dir of runs> --out board.json --md SCOREBOARD.md.
live.yml also runs the network-wide copy ratchet, bin/copies.mjs, daily and on a pull request that changes it. devkit-shared finds a local copy by its name, so a block copied into another repository under a new name slips past it; this scan reads the code. It clones every repository of the owner it can read (no forks, nothing archived): with the LIVE_GITHUB_TOKEN secret, given Contents read, the private ones too; without it, the public ones and a warning that private ones were left out. It gathers each one's tracked source (JavaScript, TypeScript, CSS, Python, shell and SQL, leaving out tests, builds, vendored and generated code, dot-folders other than .claude and .github, and database migrations, a site's applied history that can never be removed), runs jscpd over all of it at once with --min-lines 10 --min-tokens 80, and counts the copied blocks whose two files sit in different repositories. More than the baseline in live/copies.json fails, listing every copy with both places; fewer passes with a warning to lower the baseline (node bin/copies.mjs --write-baseline, then commit live/copies.json). The baseline started at 44 on 2026-11-06, the shared-code audit's count over the public repositories, and was 23 that afternoon over all 24, private ones included, once copies had been moved into the shared packages. jscpd is pinned to an exact version there, since another version counts differently. Beside jscpd's blocks it counts .claude files repeated byte for byte (not settings.json) and, as a second ratchet ("names"), the distinctive names two non-package repositories each export, which finds the same job written twice in different code; and a third ("packages"), the names two or more shared packages each export (site-api and Prelum both export splitSource, for one), which no check over the sites can see; --write-baseline sets all three. Locally, node bin/copies.mjs --from <dir> reads checkouts named by repository instead of cloning.
.github/workflows/worker-deploy.yml deploys a Cloudflare Worker, checks it live, and rolls it back when the check refuses it. It is capsid's deploy and live gate jobs and scripts/rollback-guard.mjs, so every Worker site gets what capsid has. A caller (examples/worker-deploy-caller.yml) calls it on a push to its default branch, after its own checks, pinned to a full devkit sha, with a concurrency group that never cancels a deploy in flight.
Two jobs:
deploychecks out, installs, runs the caller's pre-deploy guard, runswrangler deploywith the wrangler version pinned in the file, and publishes the run attempt it shipped in. Never on a pull request.live gatepolls the health URL (40 reads, 3 seconds apart) until its JSONshais this run's commit, then runs the verify command. Exit 0 passes. Exit 1 is a refusal, and only a refusal runs "Roll back the deploy this run shipped": the rollback guard rolls back only when what is live is this run's commit (or /health is unreadable and the deploy ran in this same attempt), runswrangler rollback, and reads /health until the sha moves. Exit 3, or a /health that never answered, is "could not run": the job fails and nothing rolls back.
Once the gate passes, "Warm the stored pages" fetches every sitemap page once, so the first reader gets a stored page. A site that deploys another way runs the same loop with npx devkit-warm <origin> [--sha <commit>] after its deploy; --sha (at least 7 hex characters) waits up to 10 minutes for /health to name that commit first. It never fails the run once started; a --sha shorter than 7 is refused as a usage error. On a large sitemap it takes a minute or two (Foxing: 59 to 102 s), and every job that needs the deploy waits for it, since a job waits for every job of a workflow it calls. warm: false leaves it out of the gate, so those jobs start sooner but read cold pages first; such a caller runs npx devkit-warm <origin> in a job nothing waits on, or not at all. The default stays true.
Every job starts with StepSecurity Harden-Runner (egress-policy, audit by default): the run's log links the hosts each job reached, and block with allowed-endpoints refuses any other.
capsid's watcher reads the job name live gate, the step name, and the step's three ::error:: sentences ("rolled back: was ...", "not rolling back. ...", "the rollback did not take effect: ...") to write deploy_outcomes, and the step summary carries rollback_from= and rollback_to=. test/worker-deploy-workflow.test.mjs fails on a change to any of them.
Inputs:
| Input | Required | Default | What it is |
|---|---|---|---|
worker-name |
yes | The Worker's name, for wrangler deploy --name and wrangler rollback --name. |
|
health-url |
yes | The live health route. It must answer JSON whose sha is the deployed commit (abbreviated to 7 or more hex characters is fine). |
|
verify-command |
yes | The live checks, run in the working directory with EXPECT_SHA, HEALTH_URL and DEVKIT_DIR (devkit at the caller's pin; node "$DEVKIT_DIR/bin/verify-deploy.mjs" <origin> is the standard check) set and no install. 0 passes, 1 refuses, 3 could not run. It gets no Cloudflare secret, only VERIFY_TOKEN when the caller passes one. |
|
node-version-file |
no | .nvmrc |
As actions/setup-node reads it, from the repository root. |
working-directory |
no | . |
Where the Worker and its wrangler config live. |
install |
no | empty | The deploy job's install. Empty runs bin/deploy-install.mjs: npm ci --ignore-scripts, each git-resolved dependency built from its locked commit (its own prepare), then the repository's postinstall and prepare. pr.yml runs the same on every pull request (deploy-install). |
pre-deploy |
no | none | The caller's guards before the deploy (a migration check, a config rebuild, a build), run with the Cloudflare secrets. A failure stops the deploy. |
sha-var |
no | none | When set, the deploy passes --var <name>:<this run's commit>, so the Worker can report it on /health. |
warm |
no | true |
Warm the stored pages in the live gate once it passes. false ends the gate sooner (above). |
generated-secrets |
no | none | Names of secrets nobody needs to know, such as site-runtime's ADMIN_IDLE_SECRET, separated by spaces. A name the Worker does not hold (wrangler secret list, names only) is minted, 32 random bytes as base64url, masked in the log, and uploaded with this deploy (--secrets-file, which keeps every other secret; Cloudflare Docs, "Secrets", "Upload secrets alongside code"), on a gradual upload too. A name it holds is never read or changed, so the value is set once and stays. To rotate one, delete it (wrangler secret delete) and the next deploy mints a new one. |
d1-database |
no | none | The D1 database's name. When set, the deploy job reads its Time Travel bookmark (wrangler d1 time-travel info <db> --json) before the pre-deploy guard, and writes it, the time and the undo command to the step summary and to the outputs d1-bookmark and d1-bookmark-time. A bookmark it cannot read stops the deploy. The token then also needs D1: Read. |
Secrets, passed by name (secrets: inherit is refused by check-callers.mjs): CLOUDFLARE_API_TOKEN, a token that can deploy and roll back the Worker (Workers Scripts: Edit), and CLOUDFLARE_ACCOUNT_ID. Both are required, and a missing one fails the deploy loudly rather than skipping it. VERIFY_TOKEN, optional, reaches only the verify command, as $VERIFY_TOKEN (capsid passes its live-probe key, so its verify makes a real MCP call).
The limits. Cloudflare's rollback swaps the Worker's code and bindings only. It is refused when D1 or KV resources changed between the two versions, and it never undoes a D1 migration (Cloudflare Docs, "Rollbacks"). A deploy that ran a migration is not made safe by this workflow: keep migrations a separate, human step, and check them in pre-deploy. Data recovery is D1 Time Travel, by hand: with d1-database set, the run's summary holds the bookmark from before the guard and the one command that goes back to it, npx wrangler d1 time-travel restore <db> --bookmark=<bookmark>. The rollback goes to the previous version, whatever that is; the guard is what stops a rerun from moving production onto the refused commit.
Gradual rollout (opt-in, gradual-percent). With 1 to 99, the deploy job reads the version serving most traffic now (wrangler deployments status --json), uploads this commit as a new version (wrangler versions upload, its id read from wrangler's output file), and splits traffic: wrangler versions deploy <new>@<p>% <old>@<rest>% --yes. A version upload leaves routes, custom domains and cron schedules as they were, so the step then runs wrangler triggers deploy from the same config. The live gate reads /health through the Cloudflare-Workers-Version-Overrides: <worker>="<version id>" header, so every read reaches the new version, and gives the verify command the same value in WORKERS_VERSION_OVERRIDE for its own requests. The new version serves its share of real traffic before the verify command runs: the gate reads the analytics every 30 seconds and stops waiting once the new version has served 20 requests, enough to compare error rates, or after gradual-minutes (default 3, at most 25), whichever comes first. A pass then runs "Compare the error rates" (scripts/error-rates.mjs): both versions' requests and errors since the split, from the GraphQL Analytics API (workersInvocationsAdaptive grouped by scriptVersion, the data behind the dashboard's per-version metrics), so the token needs Account Analytics Read too. Under 20 requests on the new version is too few to judge (a warning, and it promotes on the gate alone); at 3 or more errors with a rate above twice the old one's and more than a point above it, the new version is refused and rolled back; an analytics read that fails leaves the split as it is (exit 3). Otherwise "Promote the gradual rollout" runs (versions deploy <new>@100%); a refusal rolls back to the old version by id. A gate that could not run leaves the split as it is, and the summary has the command that sends everything back. Not for a Worker with a Durable Object migration to apply (Cloudflare applies those only with wrangler deploy), nor for one that declares its Durable Objects in exports (Cloudflare Docs, "Durable Objects migrations": gradual deployments are not supported there), and the first deploy of a Worker must be a plain one. Cloudflare Docs: "Gradual deployments", "Version overrides".
Preview per pull request (opt-in, preview). On a pull request from the same repository (a fork's never gets the secrets), the preview job installs, runs preview-build if set, and uploads a version that is never deployed: wrangler versions upload --preview-alias pr-<number>. Its URL, pr-<number>-<worker>.<subdomain>.workers.dev, goes to the summary and the preview-url output. The caller adds pull_request to its triggers. The pre-deploy guard never runs for a preview, since it may migrate the live database, but the preview runs with the live Worker's bindings, its D1 and buckets included. It needs Version URLs on (workers_dev, or "preview_urls": true), and Cloudflare gives a Worker with a Durable Object none. Cloudflare Docs: "Preview URLs".
Earlier releases' assets (opt-in, keep-assets). A Worker version serves only the files in its own upload, so after a deploy a page an older release served (a tab left open, the back-forward cache, a crawler rendering HTML it fetched hours ago) asks for a hashed stylesheet or script the live version lacks and gets a 404 (Cloudflare Docs, "Version skew and static assets", whose fix for older pages is "Include assets needed by older pages"). With keep-assets set to the built asset directory, a step after the pre-deploy guard runs devkit-keep-assets: it reads /assets/kept-assets.json from the live origin (health-url's), the list of every file under <dir>/assets with its sha-256 and when a build last produced it; fetches each listed file this build lacks, produced within keep-assets-days, checks its hash and adds it; and writes this build's list for the next deploy. It never fails a deploy. During a gradual rollout's split it covers an old page reaching the new version, not a new page's request reaching the old one (that needs version affinity, a zone rule).
Why both stay opt-in. Turning either on by default would break callers that work today: a gradual rollout refuses a Durable Object migration (Foxhound, Foxing, Carrel and Capsid have Durable Objects, and a new class or rename needs wrangler deploy), cannot run on a Worker's first deploy, needs Account Analytics Read on a token that today has only the deploy permissions, and adds up to gradual-minutes to every deploy; a preview fails on every pull request for a Worker with a Durable Object (Cloudflare gives it no preview URL) or with Version URLs off. Each site turns them on in its caller once its token and config allow, in a reviewed change.
| Input | Default | What it is |
|---|---|---|
gradual-percent |
0 |
0 deploys at once. 1 to 99 is the new version's share of traffic before the gate promotes it. |
gradual-minutes |
3 |
The longest that share runs before the verify command, 0 to 25; it ends sooner at 20 requests. |
preview |
false |
Upload a preview version for each pull request from this repository. |
preview-build |
none | Run before the preview upload, with the Cloudflare secrets (a config rebuild, a build). |
keep-assets |
none | The built asset directory; keep earlier releases' hashed files in the upload (below). |
keep-assets-days |
7 |
How long after a build last produced a file it is still kept. |
Which browser features a site may use, and with what fallback, is docs/browser-support.md: Baseline Widely available freely, Newly available with a small fallback, Limited availability only as feature-detected enhancement, no polyfills.
When something breaks after a deploy, or anywhere else, the steps are in docs/runbook.md: site down, database down, bad deploy, stale backup and lost data, each site's RPO and RTO, and the incident record.
What every repo's .claude/skills/verify skill shares (the driver helpers, the rules, the report) is docs/verify.md; a repo's own skill keeps its boot steps, flows and specs.
The guard is inlined into the workflow so a caller's one pinned sha fixes both. After an edit to scripts/rollback-guard.mjs, run node scripts/inline-rollback-guard.mjs; the test fails while the two differ.
.github/workflows/restore-drill.yml proves a site's nightly D1 dump restores. Every site with a D1 database calls it weekly (examples/restore-drill-caller.yml): it runs npx github:DrDustinEdwards/d1-dump#<the release the caller's package.json pins> drill --bucket <bucket> --backend sqlite, which downloads the newest complete run from the backups bucket through the R2 REST API, restores it into a scratch SQLite file and checks the copy (d1-dump README, "Restore drill"). Exit 1 is a dump the drill refused, 3 a drill that could not run; both fail the job, and the output goes to the step summary. Then "Restore a sample of files and check the bytes" runs d1-dump drill-files at the same release: for each files backup in the bucket, files-sample copies (default 5) are restored with restoreFiles into a scratch directory and checked byte for byte against the copy and its etag (R3); it runs after a refused dump too. devkit-ops-audit --repo <repo> --drill-workflow <the caller's file> reads the newest run (R1), so a failed drill turns the site red on the daily scoreboard as well as in GitHub's mail.
Inputs: bucket (required), package-json (default package.json: the caller's file that pins @dustinedwards/d1-dump; the drill runs that tag or sha, so it cannot drift from the nightly dump), files-sample (default 5) and node-version (default 24). Secrets, by name: CLOUDFLARE_API_TOKEN (R2: Read on the bucket is enough; the sqlite backend creates no database) and CLOUDFLARE_ACCOUNT_ID.
Measured 2026-11-06 over 18 repositories and 2,454 jobs (14:00 to 18:00 UTC): CI was slow because of the runner queue, not slow steps. The account runs 20 jobs at once and sat at 20 with 30 to 98 queued; the queue's p90 was 6.5 minutes and its worst 16. 74% of the jobs ran under a minute, and each pull request started six to eight tiny workflows from devkit callers, each taking a runner of its own. pr.yml runs them all in one job:
| Part | Standalone workflow | When it runs in pr.yml |
Turned off by |
|---|---|---|---|
| footer strip | checks.yml |
opened, reopened, a dispatch (an edit: examples/footer-caller.yml) |
|
| trailer check, shared-code check | checks.yml |
every event that adds commits | |
| OSV-Scanner, pull request mode | dependencies.yml |
every event that adds commits | dependencies: false |
| actionlint, zizmor | workflow-audit.yml |
when the change touches .github/ |
workflow-audit: false |
| no-bloat | no-bloat.yml |
after the install | no-bloat: false (a private repository), node: false |
Worker bundle size, workers for several |
worker-size.yml |
after the install | worker-size: false (no Worker), node: false |
CSS custom properties (devkit-css-vars) |
after the install, when .css-vars.json exists |
css-vars: false, node: false |
|
| reviewer (fails on BLOCK) | review.yml |
started first in the background, collected last | review: false |
Every check runs and reports even when another failed: each step runs unless the run was canceled or what it needs (the checkout, the install) failed, keeps its own annotations and its own section of the job summary, and the last step tables each outcome and fails the job if any failed. Each part is one of the composite actions in .github/actions/, the one copy the standalone workflows run too, so a fix lands in both. The standalone workflows still work for a repository that has not moved.
The caller (examples/pr-caller.yml) runs on pull_request (opened, reopened, synchronize, ready_for_review), merge_group and a dispatch, and its concurrency group is the pull request with cancel-in-progress, so a superseded push (a Renovate branch moved by the next release) cancels its older run. Its job grants contents: read, pull-requests: write, id-token: write and checks: write; pr.yml gives the first two to the checks job and the last two to the reviewer job alone.
THE CHECK NAME. Every repository's "Protect main" ruleset requires checks by name (read 2026-11-06 with gh api repos/DrDustinEdwards/<repo>/rulesets/<id>; the memory that they require none is out of date), and every one but capsid-bench's requires checks / Repo checks. The caller's job id is checks and pr.yml's job is named Repo checks, so the combined job reports that same name. An edit of the description is not this workflow's: GitHub judges a required check by the newest run of the workflow on the commit, so a footer-only run under another name left the required check expected and blocked the merge, one under the same name would put a green over a red, and a full rerun on every edit was 1,061 runs in the week to 2026-11-27, nearly all of them Renovate's. The footer strip on an edit is its own workflow, examples/footer-caller.yml, which runs devkit's footer action and skips Renovate's edits. A dispatch runs only the footer strip, as checks / Description footer. The rulesets also require the standalone names the job now covers: no-bloat / No-bloat ratchet (dustinedwards-info, capsid, capsomer, site-runtime, site-api, d1-dump, astro, bsw, julieedwards-info, txasm), worker-size / Worker bundle size (carrel, foxing, capsid, enarratio, bsw, foxhound, germomics, julieedwards-info, txasm), site / Worker bundle size, watchdog / Worker bundle size and mcp / Worker bundle size (dustinedwards-info), mcp / Worker bundle size (foxing), admin-mcp / Worker bundle size (foxhound), and in devkit dependencies / OSV-Scanner, workflow-audit / actionlint and workflow-audit / zizmor. A repository that moves to pr.yml has those names removed from its ruleset in the same change, or its pull requests wait on checks that never run again. Checks named for a repository's own jobs (test, Gates, clean checkout, Route weight and the like) stay. The scoreboard reads no pull request check (devkit-ops-audit reads only the restore drill's runs), and Capsid's auto-merge reads every check on the head by its conclusion, not its name.
A repository moving to pr.yml replaces its checks.yml caller with examples/pr-caller.yml, deletes its review.yml, workflow-audit.yml, worker-size.yml and (a public repository) no-bloat.yml callers, and keeps dependencies.yml with its daily schedule alone (a private repository also keeps its weekly no-bloat.yml). devkit-shared names a caller left on pull requests beside it. devkit runs itself through pr.yml in checks-self.yml, with OSV-Scanner and the workflow audit left to ci.yml until its ruleset stops requiring their standalone names.
THE REVIEWER NEEDS A CAPSID CHANGE FIRST. Capsid admits a review only from a token whose job_workflow_ref is devkit's review.yml (capsid src/review.ts, REVIEW_WORKFLOW), so in pr.yml the reviewer answers "Capsid answered 403: only devkit's review.yml may ask for a review" and its check says it could not run, blocking nothing. Until Capsid also admits pr.yml, a repository that moves keeps its review.yml caller and passes review: false, as devkit's own checks-self.yml does beside review-self.yml.
Pushes to main were 39% of the jobs on 2026-11-06, because the pull request checks ran again on each merge commit. Every repository's "Protect main" ruleset requires a pull request and has no bypass actor, so nothing reaches main that did not pass its pull request, and a second run on the merge commit repeats it. What each devkit workflow does on a push to main now, decided from what reads it:
| Workflow | On a push to main | Why |
|---|---|---|
pr.yml, checks.yml, review.yml, no-bloat.yml, worker-size.yml, workflow-audit.yml, conformance.yml |
no | Each gates the pull request; no deploy, release or scoreboard reads its result on main. |
dependencies.yml |
no (daily schedule) | On a push it only lists what the daily run lists, as warnings, and never fails. The schedule finds an advisory published after a merge. |
code-map.yml |
no (nightly) | The explorer reads the newest map, which is then at most a day behind. Monday's run also mutation-tests. |
scorecard.yml |
no (nightly, and a dispatch) | The score reads settings and history a merge rarely moves. |
worker-deploy.yml |
yes | It is the deploy: a merge to main ships. |
release.yml (paths: [package.json, CHANGELOG.md]) |
yes | Merging a version bump is the release. |
devkit's release-self.yml and shared-list.yml |
yes | devkit's release, and SHARED.md current the moment a merge changes what is shared. |
A deploying repository keeps on a push to main exactly what its deploy needs, in its own workflow: the tests the deploy job needs (the checks job in examples/worker-deploy-caller.yml), then the deploy. No deploy reads a devkit check. dustinedwards-info's deploy.yml starts from workflow_run of its own CI workflow and its decide job ships only when that run concluded success, was a push and is main's tip, so its ci.yml keeps its push: branches: [main] trigger; nothing in it reads checks / Repo checks or any other shared check (searched 2026-11-06: no check-runs or statuses read in its workflows or scripts). Foxing's ci-cf.yml deploys from its own job on a push, Carrel and Capsid from their own CI's deploy job, and each keeps that. The shared-code check's verdict on main moves when a shared package releases or devkit adds a rule, so the caller's daily scheduled run judges main, and a pull request is judged only on what it adds.
.github/workflows/rollback-drill.yml proves the shared deploy's rollback every week on a test Worker, devkit-rollback-drill on workers.dev (checklist F2). It deploys drill/worker.mjs as a known good version with a stand-in commit, then ships the committed config, whose every page answers 500, through this commit's worker-deploy.yml. The live gate must refuse it and roll it back. The verdict job passes only when /health reports the known good commit again and Cloudflare's newest deployment is the gate's rollback of this run's commit. drill: true is the one input that differs from a real deploy: the gate's refusal does not fail the run. It needs CLOUDFLARE_API_TOKEN (Workers Scripts: Edit) and CLOUDFLARE_ACCOUNT_ID as devkit repository secrets.
.github/workflows/access-drift.yml compares who a site's Cloudflare Access application lets in with the site's own admin list (area 3, I2). Every site behind Access calls it daily (examples/access-drift-caller.yml): it runs site-runtime's site-runtime-access-drift --account <id> --app <name> --admins-url <url> at the caller's site-runtime-ref (v0.59.0 or later). The site's list comes from the site, never from a GitHub copy: its adminListResponse route (site-runtime ./access-drift) answers salted hashes of the admin addresses, behind Access, to an Access service token only, so the application needs a Service Auth policy for that token. The caller passes four secrets by name: ACCESS_READ_TOKEN (Access: Apps and Policies Read), CLOUDFLARE_ACCOUNT_ID, ACCESS_CLIENT_ID and ACCESS_CLIENT_SECRET. Until all four are set the job fails and names the missing ones; it never skips. Exit 1 is drift, 2 a check that could not run; addresses print masked.
.github/workflows/code-map.yml runs nightly on a public repository's default branch (until 0.26.0, on every push to it) and replaces code-map.json on that repository's orphan code-map branch. Capsid reads it there and the explorer draws it. The script, scripts/code-map.mjs, is inline in the workflow, so a caller pins one sha and needs no release (examples/code-map-caller.yml).
It reads the code through the caller's own TypeScript, so there is no new dependency: imports are resolved with the caller's compiler options, and cyclomatic complexity is counted on the syntax tree (one, plus each if, loop, case, catch, ?:, &&, || and ?? in a function's own body). Coverage is the istanbul JSON Vitest writes (--coverage.reporter=json) or the lcov file of node --test --experimental-test-coverage --test-reporter=lcov, and a Stryker mutation.json adds mutants and a mutation score; both are mapped onto the innermost function holding each statement or mutant. CRAP is CC² × (1 − coverage)³ + CC. A number nobody measured is null, never 0.
Mutation runs only when mutation-command is given, which a caller does on its Monday run: that run's Stryker reports (mutation-file, a glob for one report per chunk) are kept as mutation.json on the code-map branch beside the map. Every other run reads that file back and, from the source each report holds, carries a function's numbers forward only while its lines are unchanged; a function that changed or is new is stale: true with no numbers, and the map names the run as mutated: {sha, date}.
Inputs: coverage-command (empty for no coverage), coverage-file, mutation-command, mutation-artifacts (for a caller whose Stryker run is a matrix of earlier jobs: the pattern of the artifacts holding the reports, downloaded from that run into mutation-artifacts/<artifact>/), mutation-file, tsconfig (a repository without one is read as plain JavaScript modules), include (path prefixes to map, separated by spaces, default src/; . for every folder), exclude (prefixes to leave out), install (must install typescript; a JavaScript repository can add it with npm i --no-save typescript), npm-cache (false for a repository with no package-lock.json) and node-version-file. Locally: node scripts/code-map.mjs --out code-map.json [--coverage coverage/coverage-final.json] from the repository's root.
devkit maps itself the same way (code-map-self.yml), and once a week mutation-tests its own checks: node stryker.config.mjs runs Stryker 10.1.1 (through npx, so nothing is installed) once per module in bin/ and scripts/, each against its own test file, and fails when a module's score falls below its bar in stryker.config.mjs (thresholds.break). One module: MODULE=shared npx --package @stryker-mutator/[email protected] stryker run, report in reports/mutation/shared.json.
@dustinedwards/devkit/oxlint (lint/oxlint.mjs, typed by lint/oxlint.d.mts) is one Oxlint config for every repository: Oxlint, type-aware through oxlint-tsgolint, in place of ESLint and Biome's linter. It exports three plain config objects, which a repository's oxlint.config.ts extends. Oxlint's docs name this as the way to share a config from a package: "Use oxlint.config.ts when extending config objects imported from a shared package. Package imports are not supported in the .oxlintrc.json format." (Configuration, Extend shared configs). Configs merge first to last, so the repository's own rules and overrides after extends win.
base, every repository: the correctness category with the typescript, unicorn, oxc and import plugins;typescript/no-floating-promises(node:test'stest,describe,itandsuiteallowed, since the runner awaits them),typescript/no-misused-promises,typescript/no-explicit-anyandeslint/prefer-constat error.no-non-null-assertionis not on: typescript-eslint keeps it instrict, notrecommended, and its 1,600 findings in capsid and site-api were churn, not bugs. Four type-aware correctness rules are off for everyone (no-base-to-string,restrict-template-expressions,unbound-method,require-array-sort-compare): each finding they made in dustinedwards-info and site-api was a value the checker could not narrow, not a bug. The counts are in the file.react, a repository with React: base's plugins plusreactandjsx-a11y;react/rules-of-hooks,react/exhaustive-depsand the native React Compiler rules at error.only-export-componentsis not on: it guards only Fast Refresh in development.ignorePatterns, what no repository lints (build/,dist/,.react-router/,.wrangler/,worker-configuration.d.ts,**/*.gen.ts). The repository's config sets it itself, since Oxlint does not carryignorePatternsthroughextends.
Two Oxlint behaviors to know: an override that sets a plugin's rules lists the plugin in its own plugins (plugins: react.plugins), or the rules do nothing; and a suppression comment goes on the line the finding is reported on (for exhaustive-deps, the dependency array), naming the rule as react-hooks/exhaustive-deps or react/exhaustive-deps.
node, Node's globals, spread into an override.
// oxlint.config.ts import { defineConfig } from "oxlint"; import { base, react, node, ignorePatterns } from "@dustinedwards/devkit/oxlint"; export default defineConfig({ extends: [base, react], ignorePatterns, overrides: [{ files: ["scripts/**", "bin/**", "test/**"], ...node }], });
"lint": "oxlint --type-aware --deny-warnings --report-unused-disable-directives-severity=error"
The repository adds oxlint and oxlint-tsgolint to its devDependencies at a version inside devkit's peerDependencies ranges (oxlint >=1.92.0 <2, oxlint-tsgolint >=7.0.2006 <8; optional peers, so a repository that does not lint yet installs neither). The ranges are open on purpose: an exact peer made every Renovate bump of an Oxc tool a peer conflict, the lockfile went stale and the PR failed npm ci, and one CI step, npm run lint, after the typecheck where the typecheck generates types (wrangler types, react-router typegen), since the type-aware rules read them. oxlint.config.ts needs Node 22.18 or later. No --tsconfig: type-aware mode finds each file's tsconfig itself. test/oxlint.test.mjs runs Oxlint on a fixture that extends the export by its package name and must be flagged for exactly a dropped promise, a conditional hook and a restricted import (eslint/no-restricted-imports with patterns, as txasm's boundary will use it).
@dustinedwards/devkit/oxfmt (lint/oxfmt.mjs) is the formatter's half: Oxfmt, Oxlint's formatter, which prints what Prettier prints and is tested against Prettier's own suite (Oxfmt), for every repository (Dustin, 2026-11-06). format is Oxfmt's defaults (2 spaces, double quotes, semicolons, trailing commas, width 100) with build output, generated types and lockfiles ignored; a repository adds only what its files need (astro: astro: true and @astrojs/compiler-rs).
// oxfmt.config.ts import { defineConfig } from "oxfmt"; import { format } from "@dustinedwards/devkit/oxfmt"; export default defineConfig({ ...format });
"format": "oxfmt", "format:check": "oxfmt --check"
oxfmt goes in devDependencies at a version inside devkit's peer range (>=0.77.0 <1; pre-1.0, so the repository pins it exactly and Renovate bumps it with the other Oxc tools), CI runs npm run format:check, and the commit that first formats a repository is listed in its .git-blame-ignore-revs, which GitHub's blame reads. Three things the first reformats showed (2026-11-06): Oxfmt 0.77.0 is not idempotent on a few files, so run oxfmt until oxfmt --check passes before the formatting commit; the reformat moves codespell:ignore, @ts-expect-error and oxlint-disable-next-line comments off the line they guard (a JSX attribute list gets split), so check them, or put // oxfmt-ignore above the statement; and a formatting-only pull request merges with a merge commit, never a squash, since the SHA in .git-blame-ignore-revs must stay a commit on main. Anything that matches exact source text (a plant, a test of a source string) can break on the reformat, and jscpd baselines can rise from line wrapping alone.
devkit-shared's lint check keeps every repository on both: a repository with JavaScript or TypeScript fails without a root oxlint.config.ts importing @dustinedwards/devkit/oxlint, with a linter config of its own (eslint.config.*, .eslintrc*, biome.json, .oxlintrc.json), with a root lint script other than the one above, or with no workflow running npm run lint, and the same for Oxfmt (oxfmt.config.ts with @dustinedwards/devkit/oxfmt, no Prettier or .oxfmtrc.json config, format:check, npm run format:check in CI). It warns in 0.24.0 and fails from 0.25.0. A nested oxlint.config.ts for one part (foxing's apps/mobile, with its local dash rule) is allowed. Renovate's shared policy (default.json) moves oxlint, oxlint-tsgolint and oxfmt as one "Oxc" update.
claude/hooks/ holds the network's Claude Code hooks, one copy for every repository, in the package: no-em-dash.sh blocks a Write, Edit or Bash call that carries an em or en dash, and scoped-git-add.sh blocks git add -A, --all and .. Both fail closed, and each file's header says why. pre-push.sh runs before a git push and blocks it on what CI would fail the push on: an AI trailer or Claude author on a commit, npm run format:check, devkit-shared, devkit-no-bloat and devkit-worker-size, each only where the repository has it (bin/pre-push.mjs, also npx devkit-pre-push by hand). It blocks only on a real finding: a check that cannot run (a timeout, no origin/HEAD, a tool that will not install) is printed as skipped and passes, so it fails open where the other two fail closed, and CI stays the gate. Where neither codespell nor pipx is on PATH, it installs the pinned codespell for the user (pip install --user) before devkit-shared runs. A caller workflow's one-line no-bloat-prepare and worker-size-prepare run first; several Workers are left to CI. It reads only a Bash git push of commits, not a push through a GitHub tool. A repository runs them from node_modules through its committed .claude/settings.json, never a copy of its own; devkit-shared fails a .claude/hooks/ copy of either.
{
"hooks": {
"PreToolUse": [
{
"matcher": "Write|Edit|Bash",
"hooks": [
{
"type": "command",
"command": "h=\"$CLAUDE_PROJECT_DIR/node_modules/@dustinedwards/devkit/claude/hooks/no-em-dash.sh\"; [ -f \"$h\" ] && exec bash \"$h\"; grep -Eq '\"command\" *: *\"npm (ci|install)( --?[a-z-]+)*\"' && exit 0; echo \"devkit is not installed, so the shared Claude Code hooks cannot run and this call is BLOCKED: run npm ci first.\" >&2; exit 2"
}
]
},
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "h=\"$CLAUDE_PROJECT_DIR/node_modules/@dustinedwards/devkit/claude/hooks/scoped-git-add.sh\"; [ -f \"$h\" ] && exec bash \"$h\"; grep -Eq '\"command\" *: *\"npm (ci|install)( --?[a-z-]+)*\"' && exit 0; echo \"devkit is not installed, so the shared Claude Code hooks cannot run and this call is BLOCKED: run npm ci first.\" >&2; exit 2"
}
]
},
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"timeout": 600,
"command": "h=\"$CLAUDE_PROJECT_DIR/node_modules/@dustinedwards/devkit/claude/hooks/pre-push.sh\"; [ -f \"$h\" ] && exec bash \"$h\"; exit 0"
}
]
}
]
}
}Each command runs the hook from the installed devkit. Before npm ci it is not there, and the first two fail closed too (the pre-push one passes, since the others already block until devkit is installed): it blocks every call except a Bash npm ci or npm install, so the session's first step installs and every later call is checked. A cloud session installs in its SessionStart hook where the repository has one. Not a plugin: a Claude Code cloud session loads neither the plugins a repository's .claude/settings.json enables nor the ones installed on a machine (code.claude.com/docs/en/plugins/install, "Cloud session"), so the hooks would not run where most of the work happens. A hook only one repository needs (dustinedwards.info's deploy and content guards) stays in that repository.
@dustinedwards/devkit/node holds what a repository's own Node gates share, so no site keeps a copy: createTally() (the ok, eq, fail and floor counter every gate keeps, label first) and assertFloor(), walkFiles(dir, { keep, skipDir }) and readDevVar(name, { root }) (one .dev.vars value by name, never the file). @dustinedwards/devkit/node/syntax holds the TypeScript syntax-tree readers the gates use instead of a regex over raw text: parseSource, propertyReads, interfaceMembers, findAction, intentBranches, objectConst, stringArrayConst, propertyValue, isLiteralString and bindingUses. It reads through @typescript/typescript6, a dependency of devkit's own: TypeScript 7 is the native compiler and has no JavaScript compiler API, so the site's own typescript is not used.
Test code that more than one repository needs, written once here. Installed by tag:
"@dustinedwards/devkit": "github:DrDustinEdwards/devkit#v0.8.0"
Only testing/, lint/, stryker/, vite/, bin/, claude/ and this README are in the package. No dependencies and no test framework: they run in node and in workerd. oxlint and oxlint-tsgolint are optional peer dependencies, for ./oxlint only.
-
@dustinedwards/devkit/github:stubGitHub({ owner, repo, branch, files, token }), a fake of the GitHub contents and Git Data API at the outbound fetch. An unknown host or route throws, blob shas are real and tree and commit shas are 40 hex digits, a tree applies only when the ref moves, and the ref moves only forward: a commit whose parents do not reach the head answers 422Update is not a fast forwardunlessforce. Writes answer 201,base_treeand?ref=are honored, and aRequestis read for its method, headers and body. Withtokenthe repository is private: no token answers 404 and another one 401.failNextplants 500s andhistoryplants the commit listing.install: falsehands back the fake asfetchinstead of installing it globally.gitBlobShaandversionOfcome with it. -
@dustinedwards/devkit/network:refuseNetwork({ hint }), the global fetch that throws naming the URL, andinstallFetch, the swap under it and under the GitHub fake. Each returns its restore. -
@dustinedwards/devkit/stryker:chunkedStryker({ all, chunks, exclude, vitestConfig, timeoutMS }), the StrykerJS config of a repository's mutation run (code-map.yml's Monday run, or by hand): a run is never a gate, and it is split into chunks because Stryker saves its incremental file only when a run finishes, so an interrupted run loses at most one chunk.allis every file a whole run mutates,chunksthe named groups, andSTRYKER_CHUNK=<name>picks one; the chunkrestis added and holds what no chunk names. Each chunk writesreports/mutation/<chunk>.jsonfordevkit-mutation-report. The repository'sstryker.config.mjsis the one call:export default chunkedStryker({ all: ["src/**/*.ts"], chunks: { server: ["src/server/**/*.ts"] } }); -
@dustinedwards/devkit/d1:resetDb(db, { keep }), which empties every tablesqlite_masterlists in one batch, so a table a migration adds is cleared without anyone adding it to a list. A full-text table is cleared through itself and its shadow tables are left to it; foreign keys are checked at commit, so table order does not matter;d1_migrations, SQLite's and D1's own tables are never touched. It returns the tables it cleared. -
@dustinedwards/devkit/access:await stubAccess({ issuer, audience, email, authorizationUrl }), a fake of Cloudflare Access for SaaS for one sign-in. The token endpoint answers a POST withgrant_type=authorization_code, the authorization URL'sredirect_uriand acode_verifiermatching itscode_challenge, and refuses anything else with a 400 as RFC 6749 words it; it answers an RS256 ID token carrying the issuer, the audience,sub, the email and the nonce from the authorization URL.token(extra)signs an application token (what a test sends asCf-Access-Jwt-Assertion, withjwksUrlset to the team's/cdn-cgi/access/certs) with the claims Cloudflare documents:audan array,email,exp,iat,nbf,iss,type,identity_nonce,subandcountry.claimsadds to every token. The JWKS serves two keys, the current and the previous, askeys,public_certandpublic_certs, androtate()moves to a new key the way Access does;jwkis the current one.tokenRequestsholds what the token endpoint received. An unknown URL throws unlessfallbackanswers it.
test/testing-contract.test.mjs holds both fakes to what GitHub and Cloudflare publish: each served operation's success status and response field names from GitHub's OpenAPI description, and the application token's claims and the certs endpoint's fields from Cloudflare's docs, extracted into test/fixtures/fakes-contract.json by npm run contract (scripts/fakes-contract.mjs, at a pinned commit of github/rest-api-description). Run it again when either source moves.
-
@dustinedwards/devkit/vite/site-script:siteScript({ entry, islands, toolbar }), a Vite plugin for a site that sends no framework to the browser. It bundlesentry(defaultapp/site.ts;falsefor an app with its own client script) into one minified classic script at/site.js, and each file inislands(defaultapp/islands/) into an ES module, so a CSP'sscript-src 'self'covers them. A build bundles every island in one pass, so code two islands import is one shared chunk under/islands/chunks/, fetched once and still same-origin, and names every file by its content (/islands/<name>-<hash>.js), so/islands/*can be cached immutable; the built/site.jscarries the mapstartIslandsreads.vite devserves each island whole, per request, at/islands/<name>.js. A server-rendered app reads the same map fromvirtual:islands, with each island's size:import { ISLAND_GZIP_BYTES, ISLAND_URLS } from "virtual:islands"; // ISLAND_URLS.gallery: "/islands/gallery-Bx3k9Q2a.js" ("/islands/gallery.js" in vite dev) // ISLAND_GZIP_BYTES.gallery: gzip -9 bytes of the island and the chunks it imports, each once
A TypeScript site declares it in an ambient
.d.tsnaming its islands:declare module "virtual:islands" { export const ISLAND_URLS: Readonly<Record<"gallery", string>>; export const ISLAND_GZIP_BYTES: Readonly<Record<"gallery", number>>; }. Invite dev,/site.jsalso loads the dev toolbar unlesstoolbar: false. Vite comes from the site; this package still has no dependencies. -
@dustinedwards/devkit/islands:startIslands({ root, load }), Astro's client directives for those islands. An element names its island and when it starts, and the page's HTML works before it does:<div data-island="gallery" data-client="visible" data-props='{"start":2}'>...</div>
data-clientisload(default),idle(data-client-timeout),visible(data-client-root-margin) ormedia(data-client-media). The island's default export gets the element and the parsed props, once; then the element getsdata-island-ready. -
@dustinedwards/devkit/vite/native-builtins:nativeBuiltins(), a Vite plugin that swaps a polyfill for the platform function it fills in, so the polyfill never reaches the bundle:@ungap/structured-clone, which mdast-util-to-hast imports (every site that renders Markdown through Prelum), becomes the globalstructuredClone, which Workers and every supported browser have. About 3 KiB raw and 0.9 KiB gzip off a Worker. In a server build it also answers micromark'sdecode-named-character-referencewithentities' decoder, so only one HTML entity table is bundled (about 12 KiB gzip). Put it first inplugins.@ungap'sjsonandlossyoptions are not supported. It also stubs React's legacy string renderer (renderToString,renderToStaticMarkup) in a production build, so a site renders withrenderToReadableStreamonly. -
@dustinedwards/devkit/vite/dev-toolbar:devToolbar(), Astro's dev toolbar, invite devonly. Inspect outlines the page's islands with their directive, props and whether they started. Audit runs axe-core (the site's own, served at/@devkit/axe.js; without it only performance is checked) and Astro's performance rules: a large image with no srcset, lazy above the fold, eager below it, a GIF over 100 KB, an island slow to start. Settings places the bar and hides it. siteScript already includes it; a React Router site adds{import.meta.env.DEV && <script type="module" src="/@devkit/toolbar.js" />}to its root.
An entry point is added when a repository adopts it. A pull request adds a changeset (npx changeset) and never sets the version or writes CHANGELOG.md; a release is its own pull request, npx changeset version on main, and merging it is the release (release-self.yml tags it, .changeset/README.md); a consumer moves to it in its own pull request.