These guides are primarily for agent readers. They explain how agents use Sails. If you are a person, start at sails.app or Add Sails.

Publish a site

The bash command is ship (not publish). ship create binds one folder to one URL. You run it once. Autosave redeploys that same URL on every checkpoint. There is no build command.

A directory with sails.site.json at the mount root compiles as a static site (.page.html / .page.md). Any other folder is served as files. Tailwind CSS and TypeScript/TSX are transpiled when served.

Done looks like

ship list shows a row whose public_url you can open. For a public site that URL returns 200 without sign-in. After you edit a page, the same URL shows the change. You did not create a second mount.

Worked example: public marketing site

Job: copy a template, put it on a public URL, confirm the URL, then ship a copy change without creating again.

cp -r /templates/static-site-demo ./site
ship create site --policy 644

<name> is required and unique in the repo. When --path is omitted, the folder defaults to <name>, so this ships ./site as mount site.

--policy 644 is public web. The default 600 is owner-only: everyone else is sent to /auth/login, then 403.

Expected output is JSON. Shape (not exact ids):

{
  "id": "…",
  "name": "site",
  "path": "site",
  "policy": "644",
  "public_url": "https://{id}.sails.app/"
}
ship list

Open public_url. That is the preview host. Then edit a page under site/pages/ and stop. Do not run ship create again. Do not run repo save as a ritual. Autosave already checkpointed; the mount tracks branch head.

See Static sites for the folder layout.

Who can ship

Actorcreate / update / delete / restore / promote / stageCustom --hostname, ship update --hostname, ship verify, ship token
Repository ownerAny path, including repo rootYes
write member / agentNon-root path they have Unix write on (and inside an agent jail)No
read memberNoNo

Agents can ship a preview URL for a folder they can write. Binding a custom hostname and minting ship token stay owner-only (including HITL elevation).

Flags

ship help
CommandWhat it does
ship create <name> [--path PATH] [--branch name] [--hostname host] [--policy MODE] [--mcp] [--stage-of LIVE]Create the mount once. Path defaults to <name>.
ship listJSON of mounts, including public_url (and mcp_url when --mcp)
ship update <id-or-name> [--name NAME] [--policy MODE] [--hostname H] [--stage-of LIVE] [--mcp] [--no-mcp]Rename, change policy, bind/replace hostname, or turn MCP on or off in place. Hostname and MCP changes are owner-only. MCP keeps hostname, policy, path, and data, so never delete and recreate a live mount for it
ship verify <id>DNS ownership check for a custom domain
ship analytics <id-or-name> [--since 7d] …Page views and custom events (any member can read)
ship issues <id-or-name> [--status …] [--limit N]Grouped browser / SSR / server errors (any member). Status: open, resolved, ignored, or all
ship issues show <id-or-name> <issue-id>Inspect one issue (resolve / ignore same shape)
ship token create <id-or-name> [--path /mcp] [--header NAME] [--name LABEL]Owner. Mint a one-path header token (plaintext once)
ship token list <id-or-name> [--all]Token metadata only; never the secret
ship token rotate <token-id>New plaintext once; old id dies. ship token revoke <token-id> kills immediately
ship stage <live>Copy live folder to {path}-staging (mode 0700) and link with --stage-of
ship promote <id-or-name>Three-way-merge staging folder into live (see .shipignore)
ship delete <id>Tombstone 7 days (ship restore). Avoid --now unless the URL should die
ship restore <id>Restore a tombstoned mount

--policy gates HTTP access to the whole mount (static files and *.api.sh). It does not rewrite per-file modes in the workspace.

PolicyWho can load the URL
644Anyone
640Owner or default-group members (others sign in, then 403)
600Owner only (default)

--mcp turns on Streamable HTTP MCP at /mcp for *.mcp.sh / *.tool.sh on that mount. tools/list exposes search_tools / describe_tool / call_tool (lazy discovery), not every tool schema. Outside clients that only send a fixed header use ship token (next section). Calling someone else's MCP is Connect an MCP server, not this page.

Endpoint token for a private MCP mount

Some outside builders (for example a voice agent) can only send a fixed header, not OAuth or a Sails sign-in. ship token mints an ept_ secret that unlocks exactly one URL path on one mount, usually /mcp. It works on a private 600 mount; the rest of that mount stays private. It is not a login: no CLI, admin, secrets, or other routes. Owner only. Only a SHA-256 hash is stored.

Job: ship a private MCP mount and hand the client a header token without pasting the secret in chat.

ship create handled --path handled --mcp        # default policy 600 is fine
ship token create handled --path /mcp --name xai > ~/handled-mcp-token.json
# Do not print or paste the token. Hand the user a one-time download:
download ~/handled-mcp-token.json
rm ~/handled-mcp-token.json
ship token list handled                         # id, route, header, prefix. Never the secret

ship list and ship create JSON include mcp_url, which is {public_url}mcp. On a path-prefixed hostname that is https://example.com/app/mcp, not https://example.com/mcp. Always hand the client the mcp_url value, never a URL you built by hand. For a mount that is already live without MCP, run ship update NAME --mcp first. ship token create JSON includes token once (plaintext), plus id, header, route, and token_prefix. Tell the user: MCP URL is that mcp_url; header is Authorization: Bearer <token> (or the custom --header you chose).

Wrong, rotated, or revoked tokens get HTTP 401 with an empty body. A missing header on a private mount gets JSON-RPC "sign in required for this published mount". ship token rotate returns a new token id and revokes the old one immediately; revoke the id from the rotate JSON (or every active id in ship token list), not the pre-rotate id. More detail and a live test matrix: Publish → Endpoint tokens.

Tool names on a published mount include the mount and path unless you set name: in the tool front matter. Have the client run search_tools first and copy the exact name.

Custom hostname

Platform hosts (*.sails.app, *.localtest.me, *.localhost) include the org slug by default. ship create crm --hostname crm binds {org}-crm.sails.app, not crm.sails.app. Those hosts are auto-verified.

Custom domains do not get the org prefix. The first host on a new domain needs a DNS TXT. After that, this org can ship further hosts on that domain without another TXT.

--hostname host/prefix (example: {org}.sails.app/admin) mounts under a path. The host root must already be shipped by this repository. You cannot hang a prefix on another repo’s host.

To attach or replace a hostname on a folder that is already shipped, use ship update <id> --hostname example.com (owner only). Do not run a second ship create on the same --path: that is a path collision, not a hostname claim. A hostname still binds to one mount. To move a custom domain to another folder, delete the old mount, then ship create (or ship update --hostname) the new one. Keep at least one verified host on the domain if you want to skip a new TXT.

Path on a host you already ship

ship create guides --path sites/sails-guides --hostname sails.app/guides --policy 644

Ship the host root first, then the prefix. sails.app/guides is a path on a host this repo already owns.

Custom domain TXT

Do not invent a TXT value. Sails prints a one-time token.

ship create site --path ./site --hostname example.com --policy 644
ship list
ship verify <id>

Until verify succeeds, public_url is still {published-path-id}.sails.app. hostname already shows example.com. Unverified JSON includes hostname_verification_txt as _sails-challenge.example.com = <token>. Copy the token (the part after =).

DNS (zone example.com):

FieldValue
TypeTXT
Name / host_sails-challenge
Valuethe token only

Then point the hostname at Sails: CNAME example.com → cname.sails.app. Apex domains often cannot CNAME; use ALIAS / ANAME / CNAME-flattening. ship verify checks ownership only; it does not wait for the CNAME.

After verify, public_url becomes https://example.com/ and hostname_verification_txt is omitted.

Staging → promote

Use a folder pair, not a hostname swap. Both URLs keep serving their own folders.

ship stage site                 # copy → site-staging (0700) + linked mount
# edit site-staging/; optional .env with KEY=ssec_…
# list .env in site/.shipignore if prod env must not be overwritten
ship promote site               # merge staging → live
# optional: ship delete site-staging && rm -rf site-staging

.shipignore at the live folder root is gitignore syntax and the only ignore source. .shipignore itself is never promoted. Do not default-ignore *.json; sails.site.json must promote. Conflicts fail closed: nothing applied, conflicting paths printed, non-zero exit.

Analytics and errors

HTML page views are recorded automatically. Unique visitors use a first-party sails_vid cookie. Known crawlers are excluded from headline counts. Shipped mounts also capture browser, SSR, and server errors with no SDK (see /skills/errors.md).

ship analytics site --since 7d --granularity day
ship issues site                         # open issues (default)
ship issues site --status all --limit 20
ship issues show site ISSUE_ID
ship issues resolve site ISSUE_ID
ship issues ignore site ISSUE_ID

Custom events (name and value, both strings, max 128 characters):

navigator.sendBeacon('/sails/analytics/events', JSON.stringify({ name: 'signup', value: 'pro' }))

On a path-prefixed URL, POST /prefix/sails/analytics/events or POST /sails/analytics/events with a same-origin Referer. Do not count that POST as a page view.

--visitor / --exclude-visitor filter by sails_vid. --visitors-limit 0 omits the visitor list (use that on a public dashboard). Any repository member can read analytics and triage issues. In a published *.api.sh / *.mcp.sh, only ship analytics and ship issues list/show are allowed. create, update, delete, list, verify, token, and issue resolve / ignore stay session-only.

Failure modes

What you seeWhat it meansWhat to do
Visitors hit /auth/login then 403Policy is 600 or 640Public sites need --policy 644. Members-only is 640.
publish: command not foundThe binary is shipRun ship help. Do not invent a publish CLI.
Second ship create for the same folderYou tried to mint a “fresh” URL or add a hostnameKeep the first mount. ship list is the URL. Use ship update --hostname for a host.
ship delete --now then a new URLYou hard-deleted the old linksPrefer plain ship delete (7-day tombstone) unless the URL must die
Agent cannot --hostname or ship tokenOwner-onlyOwner binds the host or mints the token; agent can still ship a preview path
ship create denied for repo rootWrite members / agents cannot ship /Ship a subfolder they can write
Custom domain still shows *.sails.appTXT not verifiedCopy hostname_verification_txt, add the TXT, ship verify <id>
Prefix URL 404s on another repo’s hostPrefix only on a host this repo shipsShip this repo’s host root first
Outside client gets 401 with no bodyWrong, rotated, or revoked token, wrong header, or wrong pathship token list <mount>; check header and route; rotate and resend
Client gets JSON-RPC "sign in required for this published mount"No token header reached /mcp on a private mountSend the header from ship token create
Token still works after revokeYou revoked the pre-rotate idRevoke the id from the rotate JSON, or every id in ship token list
call_tool says "unknown tool"Published tool names include the mount and pathsearch_tools first, or set name: in front matter
Promote fails closedMerge conflictResolve conflicting paths in staging; promote again
You ran repo save “to deploy”UnnecessaryAutosave already updated the mount

See Publish for the command summary and the endpoint-token test matrix. Forms on the same mount: Put a form on a site. Sign-in: Add sign-in to a site. Connecting to an external MCP: Connect an MCP server.