Concepts

Guarantees and their limits

What the code holds today, each backed by tests:

  • validateSite⁠, migrate⁠, checkRows⁠, the three compile functions, plan⁠, apply⁠, restore⁠, the four reads, catalogue⁠, diffSites⁠, runChecks and compareReports return problems for bad input and do not throw. buildIdentity rejects when its input cannot be written as JSON.

  • No operation changes the document it is given.

  • A batch is saved whole or not at all, a request key applies once, and a reply of a read never passes READ_CAP⁠.

  • Culm writes every byte of HTML through one writer with one escape function. A text, an attribute value, a page title or a row cannot open a tag.

  • Addresses are limited to http⁠, https⁠, mailto⁠, in-page anchors and in-site paths. Anything else writes no href or src⁠.

  • Every value from the document that reaches CSS is checked first as a known keyword, a number or a colour.

  • A file path produced by compileSite comes from a validated slug and cannot leave the bundle.

  • The same document, rows and options compile to the same bytes.

What the tools add, each backed by tests:

  • A folder loaded and written back with no change leaves every file byte for byte the same, comments included. A write to a file that changed since it was loaded is SOURCE_CONFLICT and changes nothing.

  • Every problem and measure finding on a folder site names a file and a line.

  • culm dev⁠, culm mcp --port and the measure runner bind or serve 127.0.0.1 only. The loader reads inside the project folder only, and culm build deletes only inside an output folder that holds a manifest it wrote.

  • Measure never downloads a browser and never contacts an address outside the compiled bundle. build and dev make no network request.

  • The dev server's reload code is in no file build writes.

What it does not do:

  • Culm builds local files; it does not publish them to a host, and it runs no backend. A built page can sign a visitor in to a web service you declare, in the visitor's browser; the service decides what the key unlocks, and a page marked "signed-in only" is still a public file (app/live-data.md).

  • A plug-in named in culm.json runs as code with your rights, and a caller that can write the files can bypass every operation. Both are stated in "What this does not protect" in folder-sites.md.

  • Measure covers the default state of each part. Hover, focus, open and other states are listed as skipped, not measured.

  • A removed or moved page does not rewrite the links that pointed at it. The result says which links now lead nowhere.

  • A plug-in's block functions and rules are ordinary code that runs with the product's rights. Culm checks what they return. It does not sandbox them.

  • The site policy limits what a page loads and where its scripts and forms send things. It does not restrict navigation, and on a host that cannot send headers it is only a <meta> (app/policy.md).

  • An in-page island is trusted code that can read the sign-in key. A framed island can leak the rows it was granted, and WebRTC egress from a frame is open (measured in Chromium with the test driver's flags dropped; Safari and Firefox not run) (app/islands.md).

  • A package's approval is disclosure, not a review, and the lock file needs code review. A shell with a pseudo-terminal could still approve a package, as it could edit the lock by hand (app/packages.md).

Package layout

@culmjs/core exports its public names from the package root, and by area from /document⁠, /style⁠, /layout⁠, /scripts⁠, /registry⁠, /validate⁠, /data⁠, /compile⁠, /ops and /measure⁠. A test pins the exact set of names the root exports, so a new public name is always a deliberate change.

Inside, the code is layered in this order: scripts⁠, document⁠, style⁠, layout⁠, registry⁠, validate⁠, data⁠, compile⁠, ops⁠, measure⁠. A script fails the build when a layer imports from a later one.

@culmjs/tools is a separate package. Its source imports @culmjs/core by its public sub-paths only, never by a relative path into another package, and the lint rules hold that boundary. @culmjs/webmcp is a third package, a plug-in; its source imports only the root of @culmjs/core and its own files, and the lint rules hold that too. @culmjs/surface is a fourth package; its source imports the root of @culmjs/core⁠, @culmjs/core/internal/projection and @culmjs/core/scripts⁠, and mount.js bundles what it uses. npm test needs no browser and no network; the tests that open Chrome are in packages/tools/__browser__⁠, packages/webmcp/__browser__ and packages/surface/__browser__ and run with npm run test:browser⁠.

Edit this page on GitHub