Prerequisites
- A facet project with a valid
facet.jsonand at least one text asset. See Create Your First Facet if you need to scaffold one. - A registry account. Sign up at facet.cafe and create a personal access token (PAT) from your account settings.
Sign in
Run facet login
facet login flow presents an interactive menu. Select “Paste a token”, then paste the PAT you created in the web UI.The token is verified against the registry (GET /v0/auth/me) before it is saved. A typo or expired token fails immediately with the registry’s own error message, and you are reprompted rather than left with an unusable credential.On success, the token is persisted to ~/.facet/credentials with mode 0600.Verify your identity
facet whoami shows your identity. Expected output:FACET_TOKEN environment variable instead of the saved file, an additional line appears:Build
Build your facet before publishing. If you have not built yet, or if your source has changed since the last build:facet build for details on the 6-stage pipeline. The build writes dist/<name>-<version>.facet (a scoped name renders as a nested path, e.g. dist/@acme/cowsay-1.0.0.facet).
Publish
facet publish runs a 7-step pipeline:
- Resolve directory — defaults to the current working directory.
- Resolve credential — checks
FACET_TOKENenv, then~/.facet/credentials. Fails before any work if no credential is found. - Validate manifest — loads and validates the source-tree
facet.json. - Discover dist/ artifact — finds the
.facetfile indist/. - Drift detection — compares the built artifact’s embedded manifest against the current source-tree
facet.json. See Drift detection below. - Re-verify archive — runs full archive verification (integrity hash, per-asset hashes, embedded manifest).
- Upload — POSTs the verified bytes to the registry using the artifact’s embedded
nameandversion.
Drift detection
When the built artifact and the source-treefacet.json disagree, facet publish distinguishes two cases:
Content drift — same name and version, different manifest content (you edited a description, an asset descriptor, or the private flag without rebuilding). In an interactive terminal, you get two options: rebuild and publish, or publish the existing artifact unchanged. If you flip private without rebuilding, publishing the existing artifact ships its old embedded privacy value; rebuild first to embed the new one.
Identity drift — different name or version (the most common case: you bumped version in facet.json but dist/ still has the old build). In an interactive terminal, you get three options:
- Build and publish the current source.
- Publish the existing artifact under its own embedded identity.
- Cancel.
facet build && facet publish as two separate commands.
Publish outcomes
| HTTP status | Meaning |
|---|---|
201 | Published immediately. The facet is live in the registry. |
202 | Queued for review. The CLI reports the submission was accepted and surfaces the registry’s guidance. The version becomes available once an admin approves it. |
409 | Version already exists. The registry enforces immutability. Once a version is published, it cannot be republished with different content. |
Registry errors are rendered verbatim. The CLI shows the registry’s own message and suggested fix rather than maintaining its own copy of what each error code means.
Update and republish
To publish a new version:- Bump the
versionfield infacet.json. - Rebuild:
facet build. - Republish:
facet publish.
Making a published facet private (or public)
Theprivate flag is manifest content, so changing it is a content change like any other. A version that is already published is immutable: you cannot flip private on an existing (name, version). To change visibility, set the privacy intent, bump the version, rebuild, and republish:
facet edit to change visibility interactively — it shows the current privacy intent and writes the manifest for you. (You can still hand-edit facet.json if you prefer.) Omitting private (or setting it to false) keeps the facet public; true declares private publish intent. Registry-side enforcement of who can see or download a private facet is handled by the registry, not the CLI.
Sign out
facet logout deletes the ~/.facet/credentials file. No server call is made. Token revocation is done in the web UI.
Environment variables
| Variable | Description |
|---|---|
FACET_TOKEN | Registry personal access token. Takes precedence over the credentials file. Use this for CI pipelines. |
FACET_REGISTRY_URL | Override the registry base URL. Defaults to the production registry. |