Use the CLI in scripts and CI

On this page

The CLI only asks a question in a terminal. Run from a script, CI or most AI agent tools, there's no terminal, and every question has an answer you can give up front.

Questions

QuestionWith no terminalAnswer it up front
How much to do, such as one story map or the whole projectTakes the usual answer, and says so--yes
Before overwriting or removing something, such as Apply changes?Stops, and says to use --force--force
A passwordStops, and says how to give oneSee below

--yes never stands in for --force, so it can't overwrite anything by accident. Some agent tools do run commands in a terminal, so have agents pass --yes every time.

A pull with changes to apply and no terminal:

Terminal
storymaps pull  ~ MVP: 1 card updated (status)storymap.yml was left as it is. Run again with --force to go ahead without being asked.

Passwords

Passwords are never options, as options end up in shell history and agent logs. They come from one of three places:

  1. 1Typed in a terminal.
  2. 2Remembered on this computer after storymaps unlock or storymaps project unlock --maps. Only a hash of the password is saved, never the password. Unlock once yourself, and an agent can push without ever seeing it.
  3. 3STORYMAPS_PASSWORD, an environment variable, for scripts and CI. Set it from the secrets of the pipeline.

With none of them, a command stops before it changes anything:

Terminal
storymaps push  ~ MVP: 1 card updated (status)This map is locked, and there's no terminal to type its password in. Nothing was pushed. Run storymaps unlock in a terminal first, or set STORYMAPS_PASSWORD for this command.

With the variable set:

Terminal
STORYMAPS_PASSWORD="$MAP_PASSWORD" storymaps push  ~ MVP: 1 card updated (status)Pushed to https://storymaps.io/abc12345

It works with every command that needs a password. For storymaps lock, it's the new password, so nothing is asked:

Terminal
STORYMAPS_PASSWORD="$MAP_PASSWORD" storymaps lockLocked Coffee App.

Across a whole project, the variable is only tried on the project and the story maps locked with its password. A story map with its own password is never sent the wrong one, which would count against the limit on wrong passwords.

Lock a release from CI

A pipeline can lock a project, and its story maps, once a release is agreed:

STORYMAPS_PASSWORD="$RELEASE_PASSWORD" storymaps project lock --maps

See Lock and unlock a project.