@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
Node.js 20 or later
The project ID (see Project Settings)
A Record Key for the commands that record or cancel runs, or an API key for the other commands. See Credentials.
Install
npm install @currents/cmd --save-devIn 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:
currents run upload: upload the results of a Currents reporter, or convert JUnit XML reports and upload themcurrents run attach: upload files, such as logs, to a run recorded in CIcurrents run get: get the data of a runcurrents run share: create a public link to a run, a spec file or a test, for a person or an agentcurrents run cancel: cancel a run in progress, for example when its CI job is cancelled
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 APIcurrents skill: print or install the agent skill that tells coding agents how to use the CLI
Credentials
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
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.
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?