CLI reference
The CLI for new apps is the npm package @sovyn/build. Usually your AI
assistant runs it for you. This page lists every command, so you know what
your assistant is doing and which steps need your OK.
npx @sovyn/build <command>npx @sovyn/build --help shows the list of commands.
Requirements
Section titled “Requirements”- Node.js 20 from version 20.19, or 22.12 and later. With an older version, the CLI stops and tells you to update.
- A
package-lock.jsonnext topackage.jsonin the project folder.npm install --package-lock-onlywrites it if it is missing. You do not need a localnpm installor a local build; the platform installs and builds. - After adding a package with
npm install <package>, the updatedpackage-lock.jsoncan lack entries. Ifdeployor the build reports “from lock file”, deletenode_modulesand the lockfile and write it again (an existingnode_modulescarries the gap over):rm -rf node_modules package-lock.json && npm install --package-lock-only, then rundeployagain. A fullnpm installdoes not repair it.
Run every command except init in the project folder of the app, the folder
that init created.
Access token
Section titled “Access token”The CLI needs an access token for the app. Add it with --token <token>.
- A token is valid for one hour.
- Your assistant gets a fresh one from Sovyn whenever it needs one (through
the tool
build_get_status). The CLI remembers it in the folder.sovynof the project, whichdeploynever uploads. - For setting secrets, you get your own token in the console. It is not stored in the project. See API keys and secrets.
Commands
Section titled “Commands”init --token <token>
Section titled “init --token <token>”Fetches the starter project into an empty folder and links it to the app. The folder must be empty.
Applies the manifest (sovyn.build.yaml) to development, lists the changes
and writes the types to src/lib/sovyn.gen.ts. It only adds: new
collections, new fields, new values. If a field or a collection would
disappear, apply stops and names it. Other changes are refused, and
nothing is changed.
apply --destructive
Section titled “apply --destructive”Also removes the fields and collections the manifest no longer has. They move to the trash with their values for 30 days. Only with your consent.
apply --reset
Section titled “apply --reset”Rebuilds development empty. The old data, end users and sessions move to the trash for 30 days. Only with your consent.
deploy
Section titled “deploy”Uploads the source code and waits while the platform checks, builds and
publishes it as a new version in development. It never uploads
node_modules, dist, .git, .sovyn or .env files; packed, the upload
may be at most 25 MB. If a step fails, the running app stays unchanged.
Details on Versions, development and production.
promote
Section titled “promote”Puts the version running in development into production, without a new build. No data is copied. Your assistant runs it only when you explicitly ask for production; the command does not ask back.
promote --destructive
Section titled “promote --destructive”Also removes fields and collections in production that the promoted manifest no longer has. They move to the trash of production for 30 days. Only with your consent.
promote --plan <plan>
Section titled “promote --plan <plan>”Names the plan of production. During the introductory phase there is only pro. The
first promote needs it. With a running contract, it books nothing yet: it
names the monthly price and what is charged today. See
Plans and usage.
promote --plan <plan> --confirm-cost
Section titled “promote --plan <plan> --confirm-cost”Books the app as a paid monthly position. Only after you have approved the named price.
versions <dev|prod> [--before <entry>]
Section titled “versions <dev|prod> [--before <entry>]”Lists the versions that were active in development (dev) or production
(prod), newest first, 50 at a time. --before with an entry number shows
older ones.
rollback <dev|prod> --to <version>
Section titled “rollback <dev|prod> --to <version>”Checks a rollback to an earlier version against the real data. It changes nothing and shows what would happen.
rollback <dev|prod> --to <version> --confirm
Section titled “rollback <dev|prod> --to <version> --confirm”Rolls back for real. Only with your consent, after you have seen the check.
secret set, secret list, secret delete, secret import
Section titled “secret set, secret list, secret delete, secret import”Set, list, delete and import API keys and other secrets of an environment. These commands are for people, not for your assistant. See API keys and secrets.
Platform files
Section titled “Platform files”Some files in the project belong to the platform. Their first line starts
with // Platform file of sovyn.build. Do not edit them: apply and
deploy replace them with the current version. The types of your app are
generated into src/lib/sovyn.gen.ts by apply.