Stagepass

CLI reference

Every command and option of @stagepass/cli, read from the CLI source.

loader 2.3.0cli 2.2.1macOS

Commands

Every command accepts -v or --verbose. stagepass --version prints the installed version and stagepass --help lists all commands.

CommandWhat it does
stagepass setupInstall dependencies (Caddy, PHP, Dnsmasq) and configure .sp domain.
stagepass link [domain]Link current directory to a .sp domain.
stagepass unlink [domain]Unlink current directory from .sp domain.
stagepass reloadReload Caddy configuration.
stagepass startStart background services (Caddy & PHP).
stagepass stopStop all background services.
stagepass doctorCheck the local setup. Read only, never uses sudo.
stagepass certs checkCheck the local Caddy certificate authority. Read only.
stagepass certs trustTrust the local Caddy certificate authority, after a confirmation.
stagepass autostart on|off|statusStart Stagepass at login with a macOS LaunchAgent.
stagepass daemonForeground helper for the LaunchAgent. Not for direct use.
stagepass new [name]Scaffold a new Webflow project.
stagepass buildRun npm run build in the current project.
stagepass watchRun npm run watch in the current project.
stagepass upgradeUpdate @stagepass packages and sync the project files.

stagepass setup

Checks for Homebrew, runs brew install caddy php dnsmasq, points *.sp to 127.0.0.1 in Dnsmasq and writes /etc/resolver/sp. Writing the resolver asks for your password. Run it once per Mac.

Argument or optionDescription
-v, --verboseShow detailed installation logs

Serves the current folder at https://<domain>.sp. Without a domain, the folder name is turned into a valid domain. Unsafe roots like / or your home folder are refused. Running it again keeps stored origins unless you change them with flags.

Argument or optionDescription
[domain]Domain name (optional)
-v, --verboseShow Caddy reload output
--origin <host>Allow CORS from this live hostname (repeatable; e.g. example.com or *.example.com)
--remove-origin <host>Remove a previously stored CORS hostname (repeatable)
--allow-all-originsAllow CORS from any Origin (Access-Control-Allow-Origin: *). Insecure; prefer --origin.
--no-allow-all-originsDisable allow-all CORS and use the origin allowlist

Examples:

Terminal
$ stagepass link my-project --origin www.example.com --origin example.com
$ stagepass link my-project --origin my-project.webflow.io
$ stagepass link my-project --remove-origin old.example.com
$ stagepass link my-project --no-allow-all-origins
$ stagepass link my-project --allow-all-origins   # emergency / legacy compatibility only

Re-running stagepass link keeps stored origins / allow-all setting unless you change them with flags. Omitting both --allow-all-origins and --no-allow-all-origins leaves the stored value unchanged. New projects default to allowAllOrigins: false.

If projects.json is missing an entry but a v2 Caddyfile block exists, CORS options are restored from the # stagepass-options: marker instead of being reset.

Removes the site block for the domain from the local Caddy config.

Argument or optionDescription
[domain]Domain name (optional, defaults to current folder name)
-v, --verboseShow Caddy reload output

stagepass reload

Reloads the Caddy config after manual changes. Old site blocks are upgraded first.

Argument or optionDescription
-v, --verboseShow Caddy reload output

stagepass start

Asks for your password once, checks port 443 and offers to free it if another server uses it. Then it upgrades old site blocks, restarts PHP and starts Caddy. Logs go to ~/.stagepass/server.log unless you pass -v.

Argument or optionDescription
-v, --verboseShow detailed Caddy server logs

stagepass stop

Stops Caddy and the PHP service.

Argument or optionDescription
-v, --verboseShow detailed stop logs

stagepass doctor

Checks Homebrew, Caddy, PHP, Dnsmasq, the resolver, port 443, the Caddyfile, your projects, the certificates and the LaunchAgent. In a project folder it also compares the declared modules with the live site. It is read only, never uses sudo and exits with 1 if a check fails.

Argument or optionDescription
-v, --verboseShow extra detail for ok checks
--jsonMachine readable JSON output
--skip-siteDo not fetch the live site of the current project

stagepass certs

stagepass certs check checks that the local Caddy certificate authority is valid and trusted in the System keychain, finds orphaned certificates and tests a TLS handshake for each linked domain. It never deletes keychain items or files. stagepass certs trust runs caddy trust after you confirm.

Argument or optionDescription
check --jsonMachine readable JSON output
check --skip-handshakeSkip the TLS handshake per domain
trust -y, --yesSkip the confirmation

stagepass autostart

stagepass autostart on installs a LaunchAgent for your user that runs stagepass daemon at login. off removes it and status shows the state, with --json if you need it. The daemon never uses sudo. If port 443 is in use, it logs an error and exits. Run stagepass start to fix the conflict. stagepass stop reminds you when autostart is on.

Terminal
$ stagepass autostart on
$ stagepass autostart status

stagepass new

Scaffolds a lean Webflow project with TypeScript and SCSS by default: a build script with content hashed files in dist/, Webflow head and footer snippets with the @2 pin, stagepass.json, AGENTS.md with the sp reference, an editor rule file and a .gitignore. The name must be DNS safe. Existing files are never overwritten.

Argument or optionDescription
[name]DNS safe project name
--dir <dir>Target directory (default: ./)
--author <author>Author for package.json (default: git user.name)
--lang <lang>ts or js (default: ts)
--styles <styles>scss or css (default: scss)
--modules, --no-modulesInclude @stagepass/modules or skip it
--site <host>Live Webflow site to detect loaded modules from (https)
--site-modules <list>Modules the site loads: none, all, or inject,cookies,maintenance
--git, --no-gitInitialize a git repository or not
--remote <url>Git remote URL (requires git)
--install, --no-installRun npm install after scaffolding (default: no)
-y, --yesNon interactive, accept defaults for omitted flags
--dry-runPrint the file plan without writing
Terminal
$ stagepass new my-project --site www.example.com

stagepass build and watch

Run npm run build or npm run watch in the current project and pass on the exit code.

stagepass upgrade

Updates @stagepass/* in package.json, finds out which modules your site loads and syncs stagepass.json, the managed block in AGENTS.md, the editor rule file and compilerOptions.types. Your own text stays. Every change is printed. npm install is printed, not run. The Webflow snippets use the @2 pin.

Argument or optionDescription
--version <x>Target version, range or dist tag. It must be published on npm. Default: the latest published 2.x
--site <host>Live site to detect modules from
--site-modules <list>Set the modules list: none, all, or inject,cookies,maintenance
--skip-siteDo not fetch the live site
-y, --yesAccept the detected or existing list without asking
--dry-runShow changes without writing any file
Terminal
$ stagepass upgrade --dry-run

Declared modules

Projects from stagepass new or stagepass upgrade list in stagepass.json which modules the Webflow site loads: [] for the loader only, any of inject, cookies and maintenance, or ["all"].

stagepass.json
{ "name": "my-project", "modules": ["cookies"] }

From this list the CLI generates the sp reference in AGENTS.md between <!-- stagepass:begin --> and <!-- stagepass:end -->, the editor rule file and the types in tsconfig.json, so a module the site does not load is a type error:

tsconfig.json
{ "compilerOptions": { "types": ["@stagepass/loader", "@stagepass/modules/cookies"] } }

To read the list, the CLI fetches the live site once: https only, no cookies, nothing is executed. It only recognises loader and module tags on public npm CDN URLs. For self-hosted files, pass --site-modules. stagepass doctor warns when the list and the live site differ.

Files

Stagepass keeps its state in ~/.stagepass/: Caddyfile for the local sites, projects.json for per-project settings and server.log for the server output. In a project folder, stagepass.json lists the declared modules.

Per-domain settings live in ~/.stagepass/projects.json:

JSON
{
  "version": 1,
  "projects": {
    "my-project.sp": {
      "root": "/Users/you/Sites/my-project",
      "origins": ["www.example.com"],
      "allowAllOrigins": false
    }
  }
}

More on what the server blocks and which origins it allows: Security and CORS.