docslothregistry

Publish a component

Build a component package, publish it to a registry, and let projects install it by name and digest. registry.docsloth.dev serves the official packages and does not accept uploads yet; you can run your own registry today.

What a package is

A package is a directory with a manifest (component-package.json), a payload and a JSON Schema for its props. The manifest lists every file with its sha256 digest, and the package digest is computed from the manifest, so changing one byte of one file changes the package digest.

KindWhat it shipsHere today
blockDeclarative document blocks: props schemas and specifications57 official packages
themeTokens and stylesheetsnone yet
adapterConversions from other documentation formatsnone yet
pluginThird-party executable codenone yet; refused by default: the CLI installs a plugin only when the operator trust policy sets allow_plugins and --allow-plugin is passed; neither the registry nor the CLI ever runs plugin code

From source to install

The docsloth CLI is not on npm yet: it runs from a checkout of the Docsloth engine, and the quickstart shows the setup.

  1. Describe the package

    The CLI reads the fields from the docsloth object in package.json or from flags. blocks, props and capabilities have no flags, so they must be in package.json.

    {
      "name": "@acme/heatmaps",
      "version": "1.0.0",
      "license": "Apache-2.0",
      "docsloth": {
        "kind": "block",
        "engine": ">=1 <2",
        "entry": "blocks/heatmap.json",
        "props": "props.schema.json",
        "blocks": [
          "acme.heatmaps.tile"
        ],
        "capabilities": [
          "render.html"
        ],
        "publisher": "acme"
      }
    }
  2. Build it

    docsloth component build --dir ./package

    Validates the payload and writes component-package.json. With --dry-run it reports the name, version, digest and file count without writing.

  3. Publish it to a registry you run

    docsloth component publish --dir ./package --registry ./registry

    A directory registry needs no server: the CLI writes index.json and packages/<name>/<version>/ with the manifest and every file. Serve that directory from any static host.

  4. Install it in a project

    docsloth component add @acme/heatmaps@1.0.0 \
      --registry https://components.example.com

    Projects install from your registry exactly as they install the official packages from registry.docsloth.dev.

Rules every package follows

Versions never change
Publishing a name and version that exists with different bytes is refused: a directory registry reports DSL1705; an HTTP registry answers 409, which the CLI reports as DSL1714. Publishing identical bytes again changes nothing.
Digests are checked on install
The registry pins one digest per package version. docsloth component add recomputes it and the digest of every file, and writes nothing on a mismatch (DSL1708, DSL1709).
Nothing runs
There are no install scripts and no post-install hooks. Block, theme and adapter packages are data; plugin packages are refused by default: the CLI installs a plugin only when the operator trust policy sets allow_plugins and --allow-plugin is passed; neither the registry nor the CLI ever runs plugin code.
Capabilities are declarations
A package declares capabilities such as render.html; it never grants them. The CLI derives the install trust class from those declarations, not from the catalog's runtime trust class: by default it installs pure and interactive packages and refuses the rest (DSL1716) unless a trust policy allows them. Every official package declares only render.html, so each one installs as interactive without a trust policy, including the components whose runtime class is connected or agentic.
Limits
At most 512 files and 16 MiB per package, no symlinks, no paths outside the package, and an allowlisted SPDX licence.
Block names
A block is a built-in block name or is namespaced with the package name: @acme/heatmaps may declare acme.heatmaps.tile.

Publishing over HTTP

A registry that accepts uploads takes the same package over HTTP. registry.docsloth.dev is static and does not accept uploads yet; this is the contract the CLI sends:

FieldValue
Method and pathPOST /v1/packages
AuthorizationBearer <token> from --token or DOCSLOTH_TOKEN, sent only as the Authorization header; never written to the manifest, the index or the CLI output (DSL1713 refuses a manifest that contains it)
Body{ "manifest": { … }, "files": { "<path>": "<base64>" } }
Success2xx { "ok": true, "digest": "sha256:…", "unchanged": true|false }
RefusalAny non-2xx status (409 when the version exists with different bytes) fails the publish with DSL1714

The same contract as JSON: /api/v1/publish.json.

Signing an index

A registry operator can sign index.json with an Ed25519 key using the registry package of the Docsloth engine, which writes index.json.sig. A signature shows the index was not rewritten after signing; it does not show who published a package, and docsloth component add does not verify it. This registry's index is not signed.

Errors you may see

CodeMeaningWhat to do
DSL1705Registry refuses overwrite: a directory registry already holds this name and version with different bytesIncrease the version and publish again
DSL1706Registry index unusablePoint --registry at a directory or URL that serves index.json
DSL1707Unknown package version: the error lists the versions the registry has publishedInstall one of the listed versions, or publish the version first
DSL1708Manifest digest mismatchDo not install; the registry entry and its manifest disagree
DSL1709File digest mismatch (the error names the file)Do not install; the file changed after publishing
DSL1710Registry unreachableCheck the URL or directory and that the host is serving
DSL1712Project config unusableRun docsloth init in the project first
DSL1713Secret in package manifest: the token passed to publish appears in the manifestRemove the credential and rotate it
DSL1714Registry request failed: an HTTP registry answered with a non-2xx status (409 when the version exists with different bytes, 401 without a valid token)For 409, increase the version; for 401, pass a valid --token
DSL1715Manifest identity mismatch: the manifest the index points at declares another name or versionDo not install; the registry index points at the wrong manifest
DSL1716Component trust policy refusedAllow the trust class with --trust-policy <file>, or choose another package
DSL1718Unsafe registry URL: not http(s), credentials in the URL, a link-local or metadata address, or a private addressUse an http(s) URL or a directory and pass credentials with --token; an internal registry needs DOCSLOTH_COMPONENT_REGISTRY_ALLOW_PRIVATE=true