CLI commands
| Command | What it does |
|---|---|
layero init | Auto-detect the framework, scaffold .layero/project.json and add a block for AI agents to AGENTS.md / CLAUDE.md / .cursorrules. |
layero login | Sign in through the browser (an emailed code or Yandex ID) — a device flow. |
layero logout | Remove the saved token. |
layero whoami | Show the current account. |
layero orgs list | List your Layero organizations (personal + teams). |
layero projects list | List your projects. |
layero link <id_or_slug> | Link the current directory to an existing project. |
layero deploy | Auto-detect the framework, pack the current directory, deploy. |
layero deploy --prod | Deploy to production (with confirmation). |
layero deploy --org <slug> | Create the new project in the given team instead of your personal organization. |
layero deploy --json | A machine-readable event stream — for agents and CI. |
layero deploys list | Show recent deploys of the current project. |
layero promote | Point the production apex at a specific ready deploy. |
layero promote <sha> | Point the apex at a specific deploy by commit_sha — the working way to roll back, see Rollback. |
layero hooks list/create/delete | Deploy hooks — URL tokens that start a build on POST (CMS, cron, external CI). |
layero token set <jwt> | Set the token by hand (for CI). |
The full flag list for a command:
npx layero@latest <cmd> --help
The global --json flag switches the CLI to JSON lines on stdout — that is for
AI agents (Cursor, Claude Code) and CI pipelines. More in
Deploying from AI agents.
layero init
Run it once inside the site directory:
cd my-site
npx layero@latest init
What it does:
- Reads
package.jsonand the characteristic configs (next.config.*,vite.config.*,astro.config.*and so on) to determine the framework. - Creates
.layero/project.jsonwithframework_hint/build_cmd/output_dir. If the file already exists it is left alone. - Appends a "Deploying with Layero" block to
AGENTS.md,CLAUDE.mdand/or.cursorrules(whichever exist; if none do, it createsAGENTS.md).
The block is fenced with <!-- layero:start --> / <!-- layero:end -->
markers, so a repeat init updates it in place instead of duplicating it.
Flags:
--skip-agent-docs— leaveAGENTS.md/CLAUDE.md/.cursorrulesuntouched.-y,--yes— non-interactive (all defaults applied silently).
layero orgs list
Shows the Layero organizations you belong to:
borisowvalia personal (admin)
acme-team team (admin)
client-x team (member)
- personal — your personal account, created at signup.
- team — a team, created by hand (in the dashboard or via
layero deploy --org=...).
Under the older naming scheme the organization slug was a prefix of the
hostname (<org>-<project>.layero.app). For projects created after the move
the address consists of the project slug alone — see
Environments, previews and production.
layero projects list
Shows every project you have access to.
layero link
Link the current directory to an existing project:
npx layero@latest link 123 # by id
npx layero@latest link alice-blog # by slug
It creates ./.layero/project.json pointing at the project. Useful when you
cloned somebody else's repository and want to deploy into your own project, or
moved from another folder.
layero deploy
Pack the current directory and start a deploy. Details in
layero deploy.
layero deploys list
Show the project's recent deploys (the default branch unless told otherwise):
npx layero@latest deploys list # the current default branch
npx layero@latest deploys list --branch=staging # another branch
npx layero@latest deploys list --limit 50 # more history
Each line carries the status (ready/building/failed), the commit SHA, a
timestamp and the deploy source:
| Badge | What it means |
|---|---|
(push) | Came from a GitHub webhook after a push |
(cli) | Uploaded through layero deploy |
(manual) | Started by hand from the dashboard (Redeploy) |
layero hooks
A deploy hook is a URL that starts a build when it receives a POST. It is
for cases where the build is triggered by something other than a person:
publishing in a headless CMS, a cron job, an external CI pipeline.
layero hooks create strapi-content # preview hook, default branch
layero hooks create publish --prod # production hook
layero hooks list
layero hooks delete <id> # revoked immediately
The command prints a URL of the form https://api.layero.ru/hooks/<token>.
Verified on a live project: POST returns 202 with a deploy_id and starts
a build, while GET returns 405 — so a crawler or an accidental visit in a
browser cannot fire one.
Anyone holding it can start a build. To rotate, delete the hook and create a new one; there is no separate "regenerate token".
layero promote
Point the project's production apex at a specific ready deploy. Details in
layero promote.
npx layero@latest promote # default branch → latest ready
npx layero@latest promote --branch=staging # latest ready of the staging branch
npx layero@latest promote a3f9c2b # a specific deploy by commit_sha (positional)
npx layero@latest promote --yes # no confirmation (CI)
layero deploy --promote is the short path — "build it and ship it to
production straight away", equivalent to
layero deploy … && layero promote <last-sha>.