Publishing
Push a theme version with sneferu push, publish it on your dev store with --dev-store, what the server checks, how review and versions work, and push errors.
On this page
Status: early access. A store only uses a Sneferu theme when the platform switch (
HK2_ENABLED) and the store's ownhk2Themesfeature flag are both on. Developers push with their own developer key and test on their own dev store; themes from outside developers are reviewed by Hekana before merchants can use them.
Sign in
Sign in once with npx sneferu login, or set HEKANA_TOKEN to a
developer key. Getting a key, turning on your dev store and using a key in CI are
covered in Get an API key. You need a Hekana account:
if you do not have one, create it at
dashboard.hekana.com/signup, then sign in at
hekana.dev/login and turn on developer access on
hekana.dev/account. In short:
npx sneferu loginOpen https://hekana.dev/device?code=BCDF-GHJK
Code: BCDF-GHJK
Waiting for approval in the browser…
Logged in as [email protected]. Key hk_dev_Ab12Cd34… saved to /home/you/.config/sneferu/credentials.json- The CLI asks Hekana for a one-time code, prints it with a link, and tries to open the link in your browser (if it cannot, open it yourself).
- On hekana.dev/device (sign in there first if you are not), check that the code matches the one in your terminal, and press Approve. Deny if you did not start this login.
- The CLI receives a new developer key and saves it. The key is shown only to
the CLI, never printed; the terminal shows its prefix (
hk_dev_Ab12Cd34…).
The code is valid for 10 minutes and works once. If it expires, run login
again.
The key is saved to ~/.config/sneferu/credentials.json (or
$XDG_CONFIG_HOME/sneferu/credentials.json), readable only by you (file mode
0600, folder 0700), together with the API URL you logged in to. Each login
creates a new key, named CLI login (sneferu-cli on <host>) <date>; you can see
and revoke your keys on hekana.dev/account/keys. The CLI keeps one
saved key: when login saves a new one, it revokes the key it replaces if that
key was saved for the same API. A key can only push
themes and publish them on your dev store.
| Command | Does |
|---|---|
login [--api-url <url>] | device login as above; revokes the previously saved key for the same API. --api-url (or HEKANA_API_URL) for staging or local; default https://api.hekana.com/api/v1 |
whoami | prints your email, the key prefix and your dev store URL |
logout | revokes the saved key on Hekana, then deletes the file. If Hekana cannot be reached the file is still deleted and the CLI says so: revoke the key on hekana.dev/account/keys |
Push a version
npx sneferu push ./my-theme --package my-theme✔ pushed [email protected] → version 6f1c…e2 (in_review, hash 9a41…)| Input | Rule |
|---|---|
--package <slug> | required; 2-63 lower-case letters, digits, -; must equal theme.json id. The first push of a slug makes it yours. A slug owned by someone else is refused, and so are the reserved slugs: starter, hekana, default, admin, official, theme, themes, test, demo, preview, and anything starting with hekana- |
--dev-store | optional; after the push, install and publish the version on your dev store (see below). Developer key only |
HEKANA_TOKEN | optional; overrides the saved key. Sent as Authorization: Bearer …. Never commit it |
HEKANA_API_URL | optional; overrides the URL saved by login, default https://api.hekana.com/api/v1. Must be https://; plain http:// only for localhost / 127.0.0.1. The saved key is never sent to another host: with a different host and no HEKANA_TOKEN, push stops and says so |
Which credentials push uses: HEKANA_TOKEN if it is set, otherwise the key
saved by login. With neither, it stops with
✖ Not logged in. Run sneferu login, or set HEKANA_TOKEN.
What push does, in order:
- Checks the slug, the token and the URL. Nothing is sent if any is wrong.
- Compiles the theme locally as a pre-flight. A theme with errors is not
pushed: you get the same diagnostics as
validateand✖ not pushed. - Uploads the source files (
theme.json, templates, locales, assets). A developer key (hk_dev_…) uploads toPOST {HEKANA_API_URL}/developer/themes/<slug>/versions; a Hekana platform admin token toPOST {HEKANA_API_URL}/admin/hk2/packages/<slug>/versions.dist/,node_modules/,.git/and any*.sneferu.jsonartifact are never uploaded. Keep build output indist/; another--outfolder inside the theme would be uploaded and rejected as an unknown file location.
Try it on your dev store
Turning on developer access on hekana.dev gives you a dev store: a
private store at devstore-xxxxxxxx.hekana.com with sample products, used only
for testing. It takes no orders or payments and is not indexed by search engines.
npx sneferu push ./my-theme --package my-theme --dev-store✔ pushed [email protected] → version 8a20…41 (in_review, hash 03be…)
Published on your dev store: https://devstore-1a2b3c4d.hekana.com--dev-store installs the version you just pushed on your dev store and
publishes it, so you can see it with the dev store's sample data right away. It
works while the version is still in_review, and only on your own dev store. It needs a
developer key from login; an admin HEKANA_TOKEN is refused before anything is
uploaded. If the push succeeds but publishing fails, the CLI prints the pushed
version and the reason, and exits with an error.
What the server does
- Compiles the source itself. Hekana never trusts a compiled artifact from a
laptop; it runs its own compiler on the files you sent. A compile failure comes
back as
422 HK2_COMPILE_FAILEDwith the diagnostics, printed in the samefile:line:col severity CODE messageformat. - Stores an immutable version.
<slug>@<version>can be pushed once. Pushing the sameversionagain is409 HK2_VERSION_EXISTS: bumpversionintheme.jsonand push again. - Reviews outside themes. Hekana-owned packages are approved automatically
(status
approved). A version pushed with a developer key starts asin_reviewand stays that way until Hekana reviews it. It then becomesapproved, which makes it installable by merchants, orrejected, with a note from the reviewer explaining why. Only approved versions are offered to merchants;in_reviewversions can only be used on your dev store. - Reports
HK2_ASSET_NOT_SERVED(a warning) for every file inassets/the store does not serve: only images are (see Images and assets). - Checks the theme CSS: all
assets/*.csstogether at most 512 KB, valid UTF-8. - Limits each developer. 30 pushes per hour per key and 60 per hour per
developer (
429); at most 5 versions waiting for review (409 HK2_REVIEW_QUEUE_FULL); at most 20 theme packages (409 HK2_PACKAGE_LIMIT).
| Response | Meaning |
|---|---|
201 | created; the CLI prints the version id, status and content hash |
400 HK2_PUSH_INVALID | malformed upload or bad slug |
401 | the key is invalid, expired or revoked; run sneferu login again |
403 HK2_PACKAGE_NOT_OWNED | the slug belongs to someone else (Hekana or another developer); pick another slug |
403 HK2_PACKAGE_RESERVED | the slug is reserved (see the list above); pick another slug |
409 HK2_VERSION_EXISTS | this version number already exists; bump version in theme.json |
409 HK2_REVIEW_QUEUE_FULL | too many versions waiting for review (at most 5); wait for a review before pushing another |
409 HK2_PACKAGE_LIMIT | package limit reached (at most 20 theme packages per developer) |
422 HK2_COMPILE_FAILED | the theme does not compile on the server (diagnostics included) |
422 HK2_PACKAGE_MISMATCH | theme.json id differs from the package slug |
429 | rate limited: 30 pushes per hour per key, 60 per hour per developer; wait and push again |
Versioning
- Use semantic versions: patch (
1.0.1) for fixes, minor (1.1.0) for new sections or settings, major (2.0.0) when you remove or rename sections or settings that stores may be using. - Bump
versionintheme.jsonbefore every push. There is no overwrite and no delete; a version, once pushed, stays exactly as it was. - A store stays on the version it installed until it installs a newer one.
- Keep setting keys stable across versions. Merchants' saved values are keyed by setting name; a renamed key starts again from its default.
Install and publish on a merchant store (admin endpoints for now)
All under {HEKANA_API_URL}, with a platform admin bearer token (developers use
--dev-store instead):
| Step | Endpoint | Effect |
|---|---|---|
| List packages | GET /admin/hk2/packages | every theme package |
| List versions | GET /admin/hk2/packages/<slug>/versions | versions with status and hash |
| Install | POST /admin/hk2/merchants/<merchantId>/install/<versionId> | pins the version on the store as a draft; shoppers see no change |
| Publish | POST /admin/hk2/merchants/<merchantId>/publish | makes the draft live; each publish is kept as a rollback point |
| Deactivate | POST /admin/hk2/merchants/<merchantId>/deactivate | the store goes back to its legacy theme |
Install and publish need the store's hk2Themes flag on (set in the admin
console). Every page type (home, product, collection, search, cart, content
page, 404) is rendered by the Sneferu theme; a type the theme has no template
for uses the SDK's default store.
The merchant-side endpoints (/hk2/install/<versionId>, /hk2/installation/draft,
/hk2/installation/publish, /hk2/publications/<id>/rollback,
/hk2/deactivate) exist for the builder, which will give merchants the same
flow with settings editing, preview and rollback.
Checklist before a push
npx sneferu validateis clean, andnpx sneferu whoamishows the account you expect.- Checked in
devin every locale the theme lists (?locale=<code>), on a narrow window. - Empty states checked (empty collection, a block section with no blocks).
versionbumped intheme.json.theme.jsonidequals the--packageslug.
