Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

@currents/cmd

The currents command line tool: upload test results, attach files to a run, get, share or cancel a run, capture sessions as evidence, cache files between CI jobs, and call the Currents REST API

@currents/cmd installs the currents command. It uploads test results from reporters that do not send them on their own (Jest, Node.js test runner, JUnit XML), attaches files to runs, gets, shares and cancels runs, captures agent or browser sessions as evidence, caches files between CI jobs, and calls the Currents REST API.

Requirements

Install

npm install @currents/cmd --save-dev

In the project, run the command as npx currents. Outside a project that installs @currents/cmd 2.x, run it as npx --package @currents/cmd@2 currents.

To upgrade from 1.x, see Upgrade to 2.0.

Commands

Run currents <command> --help for the options and examples of a command.

Test runs:

Evidence:

  • currents session: capture an agent or browser session as evidence, attach screenshots and traces, and share a link

CI utilities:

  • currents cache: save files to the Currents cache and restore them in another CI job

Other:

  • currents api: make an authenticated request to any route of the Currents REST API

  • currents skill: print or install the agent skill that tells coding agents how to use the CLI

Credentials

Command
Key
Option
Environment variable

run upload, run cancel, cache set, cache get

--key

CURRENTS_RECORD_KEY

run attach

Record key, or an API key with write access when no record key is set

--key, --api-key

CURRENTS_RECORD_KEY, CURRENTS_API_KEY

session start, session attach, session share

Record key, or an API key with write access when no record key is set

--key, --api-key

CURRENTS_RECORD_KEY, CURRENTS_API_KEY

run share

API key with write access

--api-key

CURRENTS_API_KEY

run get, api

--api-key

CURRENTS_API_KEY

In a CI job, version 3.1.0 or later of the commands that take a record key gets one from the job's OIDC token when no record key, and no API key on a command that accepts one, is set. See Record from CI with an OIDC token instead of a record key.

Set keys as environment variables or CI secrets, not as options, so that they stay out of shell history and CI logs.

Options and environment variables

An option on the command line wins over its environment variable, and the environment variable wins over the default. For a flag such as CURRENTS_DEBUG, the values false, 0, no and off turn it off, and any other value turns it on.

If you use CI sharding or several CI machines, set CURRENTS_CI_BUILD_ID once for the CI job. The reporter, run upload, run attach and run cancel then find the same run. See CI Build ID.

Troubleshooting

Run the command with --debug to print the requests and the resolved configuration. Keys are replaced with ***** in the debug output.

currents exits with 0 when the command finished, and with 1 otherwise. currents without a command prints the help and exits with 1.

Last updated

Was this helpful?