Skip to content
AI and automation

Command line

Run abilities, build the site, and manage users, tokens and plugins from the terminal or a deploy script.

On this page

Lettern has a command line for developers and deploy scripts: run any ability, build the site, manage users and plugins. Run php cms from your site's folder to see the commands, plugins' included.

Terminal
php cms run entries/create collection=pages title=About

#Run abilities

CommandDoes
cms runLists the abilities.
cms run <ability> key=value …Runs an ability. Values may be JSON: cms run entries/create collection=pages title=About 'data={"summary":"Hi"}'. Pass the whole input with --json='{…}' instead.

Abilities run from the command line act with full rights, and show as cli in the audit log. Add --as=you@example.com to run one as that user, with their permissions. An ability can opt out of the command line with expose: ['cli' => false].

#Build and check the site

CommandDoes
cms serve --port=8000Starts a development server.
cms buildBuilds the whole static site. --strict fails on warnings, such as a missing image.
cms links:checkFails on links, images and anchors in the built site that lead nowhere. External links are left alone.
cms media:checkImports content/media and reports what's broken: see Media. --strict, --json, --adopt.
cms publish:scheduledLets scheduled entries go live. Run it from cron every minute.

#Set up and maintain

CommandDoes
cms installInstalls a site: see Installation.
cms syncRuns migrations and plugin install and upgrade steps, and imports content/media.
cms packages:updateChecks the signed update list and updates the core. --check only says what's on offer. --security-only does what an admin's visit would, for cron.
cms starter:refresh --forcePuts the starter kit back on this site, after a snapshot in storage/backups/. Accounts and settings stay. For working on the kit.

#Users, tokens and plugins

CommandDoes
cms user:create --email= --name= --role=Creates a user. --super makes a super administrator.
cms token:create <email> --scope=… --days=Creates an API token for the REST API or MCP.
cms pluginsLists plugins and modules with their status.
cms plugin enable|disable|uninstall <name>Manages a plugin. --delete-files removes it from disk on uninstall.
cms license:status, license:set <key>, license:refresh, license:clearReads or changes the license of a paid plugin. license:status --json prints the whole report. They don't show in cms list.