Command line
ligr graphic sends every change as one REST operation. It needs no browser and no dashboard session.
Install it with the commands in Graphics SDK.
Run the npx @ligr/cli graphic commands on this page in the folder where you installed the CLI.
After npm i -g @ligr/cli, run them in any folder.
ligr-graphic is the old name. npx ligr-graphic <command> still runs ligr graphic <command> and prints a deprecation notice.
Replace ligr-graphic <command> with ligr graphic <command>.
Use a write API key with themes:read and themes:write. Keep it in LIGR_API_KEY. Never print it.
The CLI sends requests to production by default. For another environment, set LIGR_API_URL to its
full REST base, including /rest/v2, or pass --base-url. For rive commands, apiUrl in rive.json
comes before LIGR_API_URL. --base-url comes before both.
Import a file
Section titled “Import a file”export LIGR_API_KEY="<your write key>"npx @ligr/cli graphic rive import ./continental-scorebug.zip \ --theme 203 --name "Continental scorebug"The command uploads the file, starts preparation, waits for the result, and creates the graphic.
It writes rive.json with the theme id and the graphic id. Later commands read that file.
Add --retain-source to keep the editable source. Read Source files and privacy first.
An archive with more than one project answers with a list of entries. Pass the exact entry:
npx @ligr/cli graphic rive import ./bundle.zip --theme 203 --name "Bug" --select scorebug/rive.yamlA file with more than one artboard pauses the import. The command prints each choice. Finish it:
npx @ligr/cli graphic rive settings select --artboard 0 --state-machine 0Edit one value at a time
Section titled “Edit one value at a time”npx @ligr/cli graphic rive control add stage --type enum --options "GROUP A,FINAL" --default "GROUP A"npx @ligr/cli graphic rive bind set Main.homeScore '$d.1.score'npx @ligr/cli graphic rive bind expose Main.badge --name "Home badge" --entity team --expr '$d.1.id' --requirednpx @ligr/cli graphic rive input set on '!$v.hide.value'npx @ligr/cli graphic rive asset set crest.png --expr '$d.1.logo.url'npx @ligr/cli graphic rive expr add leader '$d.1.score > $d.2.score ? 1 : 2'npx @ligr/cli graphic rive schema add tennisRankingsnpx @ligr/cli graphic rive settings set --renderer canvas --scale 0.5Bind the visibility of the graphic to the reserved hide variable. The server sets hide on every show
command and every hide command. See How it works.
Each command reads the draft, then sends the change with the timestamp it read.
A draft that changed in the meantime answers 409 TARGET_CHANGED. The CLI reads it again and retries once.
The dashboard Graphics Builder takes the graphic’s edit lock on the first edit, not when it opens.
It releases the lock after 5 minutes with no edit, or when its tab closes.
While a builder holds the lock, every CLI write answers 409 LOCKED. The message names the editor.
Run the command again after the builder releases the lock.
Edit many values at once
Section titled “Edit many values at once”npx @ligr/cli graphic rive pull# edit the "config" block of rive.jsonnpx @ligr/cli graphic rive push --dry-runnpx @ligr/cli graphic rive pushrive pull writes the working configuration into the config block of rive.json.
rive push compares that block with the draft. It sends one operation for each change.
The server never receives the whole configuration.
--dry-run prints the operations and sends none.
A push is not atomic. Each operation stands alone. If one operation fails, the operations before it
stay applied. The command prints the count it applied and the operation that failed.
Run rive pull, then push again.
A push removes a control variable or a user expression only when nothing refers to it.
A referenced value answers 422 UNKNOWN_REFERENCE. Add --force to remove it.
--force blanks every expression that refers to the removed value.
pull and push do not manage manual list elements. Use rive bind list-add, rive bind list-rm
and rive bind list-order for those.
Publish
Section titled “Publish”npx @ligr/cli graphic rive publish --theme-version--theme-version publishes a theme version that pins the new graphic version.
The command prints the theme version. Replace 203 with your theme ID and 12 with that version.
Inspect the version, then activate it when no match is live:
npx @ligr/cli graphic theme inspect --theme 203 --version 12npx @ligr/cli graphic theme activate --theme 203 --version 12Reload overlay pages to load the active version.
Scripts
Section titled “Scripts”Add --json to any command. The command prints one JSON document and no human lines.
npx @ligr/cli graphic rive list --theme 203 --json | jq -r '.[] | "\(.graphicId) \(.name)"'| File | Purpose |
|---|---|
rive.json | themeId, graphicId, optional apiUrl, and the config block that pull writes |
Pass --theme and --graphic to work without rive.json.