Sites 06 / 17
The CLI
Build, sync, publish and AI-edit your DevDojo site from the terminal with @devdojo/sites — your editor, your agent and your repo all work with it.
The @devdojo/sites CLI
Everything the browser builder does, from your terminal. Your site is a plain folder of Blade files; the CLI keeps that folder and DevDojo in step, renders it locally with the same engine production uses, and lets your own tools — VS Code, Cursor, Claude Code, git — work on it.
npm i -g @devdojo/sites # or run anything with: npx @devdojo/sites <command>
site login # device-code login in the browser
site new my-site # a minimal starter (or --template=lumen, see `site templates`)
cd my-site && site dev # local preview with live reload
site connect --create # create the site on DevDojo from this folder
site deploy # push + publish → live at your-slug.devdojo.site
devdojois an alias forsite— handy in scripts, or ifsiteclashes with something on your PATH. The npm package is not the Composer packagedevdojo/devdojo, which pulls a site into a Laravel app; both are clients of the same API.
Your folder is the source of truth
my-site/
├── resources/
│ ├── views/pages/**.blade.php # pages (dynamic ones: [collection.field].blade.php)
│ ├── views/components/**.blade.php # sections, layouts (+ optional .yml schemas)
│ ├── data/site.json # → $site
│ ├── data/collections/*.json # → $name
│ ├── css/site.css # Tailwind v4
│ └── design.md # the site's design brief
├── public/** # assets, served verbatim
└── .devdojo/
├── link.json # which site this folder is linked to (gitignored)
├── rules.md # rules every agent editing this site must follow
└── skills/<name>/SKILL.md # site-specific skills for agents
Only resources/, public/ and .devdojo/ sync. The Blade dialect is the
pocketknife subset: @props, components and slots, @foreach / @if /
@class, collections — no @php, no raw <?php. Anything executable is refused
on push, because connected Laravel apps render these files as native Blade.
Syncing, without surprises
| Command | What it does |
|---|---|
site pull |
Fetch the server's changes. Your local edits are never touched. |
site push |
Upload your changes as a draft. The server runs the same guards as an AI turn: folder allowlist, size caps, JSON/YAML checks, the raw-PHP scan and the compile lint. A compile error rolls the whole push back and names the file. |
site publish |
Make the current draft live. |
site deploy |
push then publish. |
site status / site diff |
What differs between this folder and the server. |
site dev --sync |
Keep both sides in step while you work: saves push after a short debounce, builder and Assistant edits land in your folder within a second or two. |
Nothing is silently overwritten. Every file has a hash; when the same file
changed both here and on DevDojo, push answers 409 and pull stops, naming
the paths. You decide: site pull --force keeps the server copy, site push --force keeps yours. Files only one side changed merge automatically. If the
Assistant is mid-turn, push waits with a 423 — retry in a moment.
site deploy sends source, never built HTML. DevDojo's exporter is the only
production build, so the browser builder, Visual mode, the Content panel and the
AI all keep working on the same files. site build is for local inspection only.
Agents
site ai "add a pricing page"runs an Assistant turn on your site's chat from the terminal: local changes are pushed first, the reply streams, and the result is pulled back.--engine=<key>picks the model (site ai --engineslists them),--newstarts a fresh thread,--createbuilds from scratch.site mcpexposes the folder to Claude Code, Cursor or any MCP client over stdio:list_files,read_file,apply_changes(same guards as above),compile,list_sections/add_section,pull,push,publish, plus the dialect skill and your.devdojo/rules.mdas resources.site mcp --setupprints the config snippet. For agents with no local checkout there is a remote endpoint,POST /api/sites/{slug}/mcp, with the same tools..devdojo/rules.mdand.devdojo/skills/*/SKILL.mdare injected into every Assistant turn as Site rules / Site skills — below the platform's own rules, so a site rule can steer taste but never break the dialect.site log,site diff --turn=<id>,site rollback <id>— every Assistant turn is addressable: see what it changed, line by line, and restore the site to just before it (the rollback is itself recorded as a turn).site keys set anthropicstores your own provider key (encrypted, write-only). Turns on that provider run on your key and are not metered against your credits. Manage keys and CLI tokens at Account → CLI & API tokens.
Building blocks
site add --list,site add heros/hero-01— copy a library section intoresources/views/components/sections/and paste the tag it prints. The file is yours from then on.site check— the pre-deploy report: the compile lint for every page (static and dynamic), broken internal links, CSS size. Exit code 1 on errors, so it slots into CI.site templates— the catalog;site new <folder> --template=<slug>starts from one.
Tokens and security
site login opens /cli/activate in your browser and shows an 8-character
code; approving it mints a token scoped to your account (abilities
sites:read, sites:write, sites:publish, sites:ai). A verified email is
required. The token lives in ~/.config/devdojo/credentials (mode 0600), one
per control-plane host; DEVDOJO_TOKEN overrides it for CI. Revoke tokens any
time from Account → CLI & API tokens. Pointing the CLI at another instance:
DEVDOJO_URL=https://devdojo.test site ….