Config files as a form

A .json, .yml/.yaml or .toml file in a repository opens as a form (#7336, #7337, part of #7329).

Reading

The blob page's Rendered view draws the file's values as read-only fields. Source, Raw and Download are where they always are. A file that is not valid says why, with the line and column, above its text. Other config files (INI, .env) keep their source view.

Editing

Edit as form opens /:owner/:name/config/:ref/*path. You need to be signed in. A private repository's file is a 404 to anyone who cannot read it.

YAML and TOML

Both read into the same form as JSON and use the same schema lookup. The difference is the save: they are patched, not rewritten.

The two vendored libraries

Neither is a dependency in package.json: each is one bundled file under src/web/render/vendor/, with its licence beside it, run on the server only (no script is sent to the page).

BundlePinnedLicenceWhy
yaml.mjsyaml 2.9.1 (eemeli/yaml)ISC, YAML-LICENSEIts Document API keeps comments, anchors, quoting and key order, which a parse-and-dump cannot. Writing a YAML parser that does the same is far larger and riskier.
toml-patch.mjstoml-patch 3.3.2 (@decimalturn/toml-patch)MIT, TOML-PATCH-LICENSEpatch rewrites only the values that differ, so TOML comments and layout survive.

To regenerate (or bump) one, in a scratch directory outside the repository (this reproduces both files byte for byte; bun build writes // @bun as its first line, which the header replaces):

bun add yaml@2.9.1 @decimalturn/toml-patch@3.3.2
( echo "// yaml 2.9.1 (eemeli/yaml, ISC), bundled from node_modules/yaml/browser; licence in YAML-LICENSE"
  bun build node_modules/yaml/browser/index.js --format=esm --target=bun | tail -n +2 ) > yaml.mjs
( echo "// @decimalturn/toml-patch 3.3.2 (MIT), bundled from its dist; licence in TOML-PATCH-LICENSE"
  bun build node_modules/@decimalturn/toml-patch/dist/toml-patch.js --format=esm --target=bun | tail -n +2 ) > toml-patch.mjs
cp node_modules/yaml/LICENSE YAML-LICENSE
cp node_modules/@decimalturn/toml-patch/LICENSE TOML-PATCH-LICENSE

Copy the four files over their namesakes in vendor/. Each bundle's SHA-256 is pinned here, and test/config-yaml-toml.test.ts fails when a bundle, its header or this page disagree:

On a bump, change the version in the commands, the headers and the table, and the two hashes.

Hostile input is bounded before it is walked: a file over 256 KB is never parsed (page and save both check the size first), YAML aliases and merge keys share a 2,000-value budget, and nesting deeper than 64 is refused in YAML and TOML alike. YAML is counted before the parser sees it (yamlTooLarge), since the vendored parser costs some 25 µs a line: more than 6,000 items (three times MAX_FIELDS; an item is a line of block structure or a value in a flow list), more than 20,000 lines of any sort, or flow brackets or dashes nested past 64 are refused at once. Text inside quotes, block scalars (|, >) and comments is not counted, so a long list written inside a string costs nothing. What a person loses: a file past those caps is not a form; it keeps its source view, and the page says which cap it met. A key written twice is refused at its line and column.

Saving

Review shows the change as a diff, under a commit message.

All of this works without JavaScript, as plain form posts: each card button submits the form, and the form comes back with the change applied.

Files over 256 KB, or with more than 2,000 values, open in the source view and can be edited as text.

In the terminal

The workspace is the terminal's editor. Open a repository, press e on a file, then c:

Try it

Every preview's sample repository (/preview-admin/sample) holds service.yml and service.toml (src/spawn/preview-config.ts, seeded by spawn/preview-seed.ts, also into a sample seeded before they existed). They have comments, an anchor and a merge key (YAML), and a date and an array of tables (TOML). Open either on the blob page, press Edit as form, change one value and Review: the diff touches only that line.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs