Skip to main content
Ask extension.dev for a shareable URL to a project you already have there. publish is a thin client. It does not compile, package, or upload anything. It sends one authenticated request to the platform and prints the URL the platform answers with.

When to use publish

  • Sending a reviewer a link to a build instead of a zip file.
  • Wiring a share link into CI after build produced the artifacts.
  • Pinning a share link to one specific build rather than the project’s latest.
publish resolves a project that already exists on extension.dev, so it needs a build the platform recorded. To send someone the build sitting in your own dist/ right now, upload that build instead: Share an unpublished build for review.
publish talks to the extension.dev platform, which is a separate product from Extension.js. The Extension.js commands that run on your machine (create, dev, build, preview, start) never need an account. publish does.

Usage

The project that gets published is whatever your token is scoped to. The path argument does not upload anything. It names the local directory whose project name the scope check below compares against.

Token requirement

publish refuses to run without an access token. It looks in three places, in this order:
  1. --token <token> on the command line.
  2. EXTENSION_DEV_TOKEN in the environment (preferred for CI).
  3. The stored device login that npx @extension.dev/mcp login writes.
Without any of them, the command exits with code 1 before any network call happens, and prints this to stderr:
Create a token from the extension.dev dashboard or the project access-tokens API, documented in Access tokens.

Scope checks

A stored device login is scoped to one project. Publishing from an unrelated directory would mint a share link for that project without naming it anywhere obvious. publish treats that mismatch as a refusal, not a warning:
  • When the directory’s project name does not match the stored login’s project, the command refuses and names both.
  • Pass --project <slug> to publish the login’s project on purpose from anywhere.
  • Passing --project with a slug that does not match the stored login also refuses.
  • A --token or EXTENSION_DEV_TOKEN token skips the stored-login comparison entirely.
The local project name comes from package.json, then manifest.json, then src/manifest.json, then the folder name.

Arguments and flags

What it prints

Pretty output is a single line, the share URL, so it pipes cleanly:
--output json prints one envelope. The platform response sits in value, and it carries more than the URL:
A public project answers with value.shareUrl and value.visibility only. There is no token to carry. With --build-sha, the URL points at that build instead of the project overview: https://<workspace>.extension.dev/<project>/builds/<sha>.

Public and private projects

A project is either public or private. publish only reads that setting and never changes it. The platform decides what kind of link you get: Both answers point at the same page. Visibility decides whether a token is attached, not which address you get.

Pinning to a build

--build-sha links to one build instead of the project’s latest. The platform verifies the sha against the project’s build index and answers with a 404 and an UNKNOWN_BUILD code when no completed build matches, so a typo fails loudly instead of producing a link to the wrong artifact.

Examples

Publishing from CI

Behavior notes

  • publish never compiles. Run build first when you want the link to point at fresh output.
  • Every failure path exits with code 1: a missing token, an unreachable platform, or any non-2xx response, which is printed as publish failed (<status>): <message>.
  • --api accepts a base URL with or without a trailing slash. The command appends /api/cli/publish itself.
  • --ttl is clamped by the platform to the 1 to 168 hour range.
  • The ?share= token this command returns is not the 30 day revocable preview link. That link comes from a different verb, which uploads the build; publish uploads nothing. See the platform’s publish page.

Next steps