Skip to Content
BricoleDocs

Publish a revision or roll back

Update an existing artifact, verify the new head, and restore an earlier build.

Publishing replaces the build at an artifact’s address and records a revision. Start in the template or app folder with publishing access, a current build under dist/, and BRICOLE_URL set to your host.

Publish from a connected agent

Connect your MCP client to the host’s /mcp endpoint and sign in as someone with publishing access. To start a new artifact, call create_artifact with its title and keep the returned ID. For an existing artifact, use its current ID.

  1. Call mint_publish_credential with the artifact ID.
  2. Feed the tool’s complete result directly to the publisher’s standard input as a single JSON line.
  3. Run the following command with that stream as stdin. Set the shell variable ARTIFACT to the ID used for the mint.
bun run bricole-publish push --artifact "$ARTIFACT" --credential-stdin --json

Keep the credential in the tool-to-process handoff. It lasts 15 minutes and names a particular head revision. After another publish, read the current head and mint a fresh credential.

Update an existing artifact

With a service token loaded into BRICOLE_TOKEN, set ARTIFACT to the ID saved after the first publish. Edit a source file, rebuild, and push to that ID.

bun run build
bun run bricole-publish push --artifact "$ARTIFACT" --json

Compare the returned artifact and revision with the previous receipt. Open the original address and check the changed page. For a server app, check the declared read tool too. The build can succeed even if a caller lacks the role needed to use it.

A 409 stale-revision means another publisher moved the head. Read the new revision, reconcile the sources, and rebuild. On 422 migration-failed, inspect the named migration. Earlier successful migrations stay applied. Correct the failed migration and republish.

Restore an earlier build

Open History and identify the revision you want. With a service token, run the following from the app folder, replacing 1 with the desired revision.

bun run bricole-publish rollback --artifact "$ARTIFACT" --revision 1 --json

The receipt gives a new head revision, rollbackOf naming the source revision, and zero uploads. With a connected MCP client, read the target using read_revision and publish its manifest unchanged against the current head.

A rollback restores the artifact files. Database migrations and saved rows persist. If later migrations removed a column that older code reads, repair the schema or publish a compatible build. A public website has a separate release selection, so check its released revision when changing what signed-out visitors see.