CLI reference
Every command and option of @stagepass/cli, read from the CLI source.
Commands
Every command accepts -v or --verbose. stagepass --version prints the installed version and stagepass --help lists all commands.
| Command | What it does |
|---|---|
stagepass setup | Install 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 reload | Reload Caddy configuration. |
stagepass start | Start background services (Caddy & PHP). |
stagepass stop | Stop all background services. |
stagepass doctor | Check the local setup. Read only, never uses sudo. |
stagepass certs check | Check the local Caddy certificate authority. Read only. |
stagepass certs trust | Trust the local Caddy certificate authority, after a confirmation. |
stagepass autostart on|off|status | Start Stagepass at login with a macOS LaunchAgent. |
stagepass daemon | Foreground helper for the LaunchAgent. Not for direct use. |
stagepass new [name] | Scaffold a new Webflow project. |
stagepass build | Run npm run build in the current project. |
stagepass watch | Run npm run watch in the current project. |
stagepass upgrade | Update @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 option | Description |
|---|---|
-v, --verbose | Show detailed installation logs |
stagepass link
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 option | Description |
|---|---|
[domain] | Domain name (optional) |
-v, --verbose | Show 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-origins | Allow CORS from any Origin (Access-Control-Allow-Origin: *). Insecure; prefer --origin. |
--no-allow-all-origins | Disable allow-all CORS and use the origin allowlist |
Examples:
$ 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 onlyRe-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.
stagepass unlink
Removes the site block for the domain from the local Caddy config.
| Argument or option | Description |
|---|---|
[domain] | Domain name (optional, defaults to current folder name) |
-v, --verbose | Show Caddy reload output |
stagepass reload
Reloads the Caddy config after manual changes. Old site blocks are upgraded first.
| Argument or option | Description |
|---|---|
-v, --verbose | Show 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 option | Description |
|---|---|
-v, --verbose | Show detailed Caddy server logs |
stagepass stop
Stops Caddy and the PHP service.
| Argument or option | Description |
|---|---|
-v, --verbose | Show 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 option | Description |
|---|---|
-v, --verbose | Show extra detail for ok checks |
--json | Machine readable JSON output |
--skip-site | Do 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 option | Description |
|---|---|
check --json | Machine readable JSON output |
check --skip-handshake | Skip the TLS handshake per domain |
trust -y, --yes | Skip 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.
$ stagepass autostart on
$ stagepass autostart statusstagepass 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 option | Description |
|---|---|
[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-modules | Include @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-git | Initialize a git repository or not |
--remote <url> | Git remote URL (requires git) |
--install, --no-install | Run npm install after scaffolding (default: no) |
-y, --yes | Non interactive, accept defaults for omitted flags |
--dry-run | Print the file plan without writing |
$ stagepass new my-project --site www.example.comstagepass 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 option | Description |
|---|---|
--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-site | Do not fetch the live site |
-y, --yes | Accept the detected or existing list without asking |
--dry-run | Show changes without writing any file |
$ stagepass upgrade --dry-runDeclared 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"].
{ "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:
{ "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:
{
"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.