# Layero deployment rules — drop this in .cursorrules at the root of your project. # Source: https://layero.ru/cursorrules When the user asks you to deploy this project (especially with words like "deploy", "publish", "ship", "задеплой", "опубликуй", "выкати"), and they mention Layero, follow this procedure: 1. Do NOT create a git repository (`git init`) or push to GitHub. Layero does not require git — it ships local files directly. 2. Do NOT run `npm install -g layero`. Global installs fail in Cursor's sandboxed terminal on most setups. Use `npx layero@latest` instead. 3. Do NOT open the Layero dashboard in a browser to "finish setup". The CLI does everything inline since v0.5.0. 4. Run this command from the project root: npx layero@latest deploy --json 5. The CLI emits JSON-lines events on stdout, one per line. Parse each line: - `{"event":"auth_required","url":"https://app.layero.ru/cli?code=...","user_code":"..."}` → Render the URL as a clickable link in chat. The user clicks once to sign in (GitHub or Yandex — account is created automatically on first OAuth). Within 2 seconds the CLI's poll loop picks up the token and caches it in `~/.layero/config.json`. No localhost server: browser can be on a different machine than the CLI (works from SSH, Docker, Cursor sandbox). - `{"event":"detected","framework":"...","build_cmd":"...","output_dir":"..."}` → Just informational. Framework auto-detected from package.json and config files. Don't try to override unless detection is wrong. - `{"event":"project_created","slug":"...","organization":"..."}` → First deploy in this directory created a new project. - `{"event":"build_log","line":"..."}` → Build output from the framework's build command. Forward to the user only if it contains errors. - `{"event":"ready","url":"https://..."}` → Deployment is complete. Show the URL to the user as a clickable link. Your job is done. - `{"event":"error","code":"...","next_action":"...","message":"..."}` → Follow the `next_action` field. Most common codes: * `auth_required` → run `npx layero@latest login`, or set `LAYERO_TOKEN` * `auth_expired` / `auth_timeout` → user did not approve in 15 min, re-run login * `project_unknown` → run from the project directory, or pass `--project` * `invalid_type` → omit `--type` flag, use auto-detect * `cli_deploys_disabled` → user must enable in project settings * `deploy_failed` → build did not reach `ready`; open the logs URL from `next_action`. The code is built from the deploy status, and the only failing statuses are `failed` and `cancelled` — there is no `deploy_error` or `deploy_timed_out`. 6. To re-deploy after edits: just run `npx layero@latest deploy` again. No commits between runs needed. Take the address from the `ready` event's `url` field as-is — never build the hostname from a template. Project addresses live in the `layero.app` zone, organizations not yet migrated still use the older `-.layero.ru` scheme, and a guessed hostname will simply be wrong. 7. A project created by `layero deploy` auto-promotes to its live address on EVERY deploy — the apex is the destination and `--prod` is redundant there. Do not treat a plain deploy as a harmless preview: it replaces what visitors see. There is no way around this from the CLI: `--branch` is accepted and silently ignored — every archive upload is filed under the reserved `cli` environment. A publish that leaves the live address alone does not exist for a CLI project. `--prod` matters for repository-linked projects, where it targets the production environment. # Building a landing page from scratch — use the MCP server, not the CLI # # These rules cover deploying a project that already exists. If the user has # no code yet and wants a landing page built, Layero has a remote MCP server # for exactly that: https://mcp.layero.ru/mcp (Streamable HTTP). In Cursor it # installs in one click from https://land.layero.app — after that `@layero` # builds the page from a short brief and deploys it. Different job from the # CLI, not a second way to do the same one. # Optional: AGENTS.md — drop this rules block into AGENTS.md or CLAUDE.md # too if you want other AI agents (Claude Code, Aider) to follow the same # procedure. `npx layero@latest init` does this automatically.