Hosted preview

Tell Sequential what shipped, from your CI.

The Sequential CLI is one command, sequential, in the npm package @usesequential/cli. It records releases and changes from a CI job or a script. It also calls the same tools as a connected agent.

01Sequential CLI

What it is

  • It needs Node.js 18 or later.
  • The package has no dependencies.
  • Run it with npx and the scoped name.
  • Always write @usesequential/cli. On npm, the name sequential without the scope is a different package. Sequential does not own it.
Run it with npx. In the examples below, sequential is the command. With npx, write npx @usesequential/cli in its place.

npx @usesequential/cli tools

02

Record a release

sequential releases record tells Sequential that a version shipped. For each case that the release names, Sequential compares the sessions before and after it.

Record a release from a CI job or a script.

# A release, which Sequential measures fixes against
sequential releases record --version "$APP_VERSION"
  • The version must match. Give the exact version that your app sends with each session. Sequential reads the version from the session, not from your backend SDK.
  • A short commit sha and a full commit sha do not match.
  • When no session carries the version, Sequential compares by time, from 2 hours after the release. This can count sessions on an older build.
  • The GitHub Action. The GitHub Action usesequential/release-action is another way to record a release from CI.
  • Vercel. A GitHub workflow on deployment_status records each production deployment. It records the release when Vercel reports success. The docs give the workflow.

03

Name the cases that a release fixes

releases record can also name what the release changed and the cases that it fixes. Use one of these two options in a run, not both.

  • --github-changes. It reads the merged pull requests and "Fixes F-12" from GitHub. It sends only GET requests. It needs --commit-sha and GITHUB_TOKEN.
  • --range. It reads trailer lines such as Sequential-Finding: F-12 with git log, in a checkout.
  • Several projects in one repository. A case number belongs to one project. Write the project key before the number, for example web#F-12. Give --project-key with the key of this project. Without it, an id with a key does not count.
  • The release records only what changed. It does not say what caused a result.
From the Vercel workflow in the docs. Each value gets to the command as an environment variable.

npx -y @usesequential/cli releases record \
  --version "$SHA" --commit-sha "$SHA" --released-at "$RELEASED_AT" \
  --github-changes

04

Record changes

A change can be a campaign, a price or a product change. Record it, and you can read a number next to what changed.

  • changes record. It records one change.
  • changes sync. It records a batch from a JSON array, in one request.
  • A title that reads like an instruction stays a proposal. A person confirms it.
One change, then a batch.

# One change: a campaign, a price, a product change
sequential changes record --kind pricing --title "Trial is now 14 days"

# A batch from a JSON array, once for each CI run (one request, never split)
sequential changes sync --items changes.json --source git

05

Call the same tools as an agent

The CLI calls the same tools as an agent connected to Sequential. The same rules apply.

  • sequential tools. It lists the tools that its token can use, each as read, write or paid. The others are under "Not enabled on this token".
  • sequential tools describe. It shows what one tool takes.
  • sequential call. It calls one tool. Each argument of the tool is a flag.
  • --yes. In a script, a tool that changes something or a paid tool needs --yes. On a terminal, the CLI asks first.
List the tools, read what one takes, then call it.

sequential tools                       # the tools this token can use
sequential tools describe list_findings
sequential call list_findings --status all --limit 10

06

The token

  • The CLI reads SEQUENTIAL_TOKEN. It is a project access token (sq_pat_…) for one project.
  • An owner or admin makes it in Sequential: Settings › Agents & tokens › "Make a token".
  • For releases and changes, select the preset "CLI and CI".
  • releases record reads SEQUENTIAL_RELEASES_TOKEN first, then SEQUENTIAL_TOKEN.
  • Put the token in the secrets of your CI, not in a command line.
  • The CLI never prints the token and never writes it to disk.

07

Good to know

  • --dry-run. It prints what the command would send. It needs no token and sends nothing to Sequential.
  • Output for scripts. In a pipe or with --json, the answer is compact JSON on stdout. Errors go to stderr as one line.
  • Exit codes. Each exit code tells your script what to do next. The CLI docs list each one.
  • No retries. The CLI never tries again on its own.
  • Public code. The code of the CLI is on GitHub, with the MIT licence.

08

Questions

The CLI or the GitHub Action?

Both record a release. Both can name the cases that it fixes, from GitHub or from git. The CLI also records changes and calls the tools.

Can it run without a token?

Only with --dry-run. Then it sends nothing to Sequential.

Start free in the hosted preview.

The hosted preview gives you 5,000 sessions a month and keeps 7 days of data by default. It takes no payment.