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 Code graphics.
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 first.
Import a file
Section titled “Import a file”export LIGR_API_KEY="<your write key>"npx ligr-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-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-graphic rive settings select --artboard 0 --state-machine 0Edit one value at a time
Section titled “Edit one value at a time”npx ligr-graphic rive control add stage --type enum --options "GROUP A,FINAL" --default "GROUP A"npx ligr-graphic rive bind set Main.homeScore '$d.1.score'npx ligr-graphic rive bind expose Main.badge --name "Home badge" --entity team --expr '$d.1.id' --requirednpx ligr-graphic rive input set on '!$v.hide.value'npx ligr-graphic rive asset set crest.png --expr '$d.1.logo.url'npx ligr-graphic rive expr add leader '$d.1.score > $d.2.score ? 1 : 2'npx ligr-graphic rive schema add tennisRankingsnpx ligr-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.
Opening a graphic in the dashboard Graphics Builder takes its edit lock.
While that builder tab is open, every CLI write answers 409 LOCKED. The message names the editor.
Close the builder tab, then run the command again.
Edit many values at once
Section titled “Edit many values at once”npx ligr-graphic rive pull# edit the "config" block of rive.jsonnpx ligr-graphic rive push --dry-runnpx ligr-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-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-graphic theme inspect --theme 203 --version 12npx ligr-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-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.