Skip to main content

CLI commands

CommandWhat it does
layero initAuto-detect the framework, scaffold .layero/project.json and add a block for AI agents to AGENTS.md / CLAUDE.md / .cursorrules.
layero loginSign in through the browser (an emailed code or Yandex ID) — a device flow.
layero logoutRemove the saved token.
layero whoamiShow the current account.
layero orgs listList your Layero organizations (personal + teams).
layero projects listList your projects.
layero link <id_or_slug>Link the current directory to an existing project.
layero deployAuto-detect the framework, pack the current directory, deploy.
layero deploy --prodDeploy to production (with confirmation).
layero deploy --org <slug>Create the new project in the given team instead of your personal organization.
layero deploy --jsonA machine-readable event stream — for agents and CI.
layero deploys listShow recent deploys of the current project.
layero promotePoint 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/deleteDeploy 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:

  1. Reads package.json and the characteristic configs (next.config.*, vite.config.*, astro.config.* and so on) to determine the framework.
  2. Creates .layero/project.json with framework_hint / build_cmd / output_dir. If the file already exists it is left alone.
  3. Appends a "Deploying with Layero" block to AGENTS.md, CLAUDE.md and/or .cursorrules (whichever exist; if none do, it creates AGENTS.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 — leave AGENTS.md / CLAUDE.md / .cursorrules untouched.
  • -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.

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:

BadgeWhat 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.

The hook URL is a credential

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>.