@devtune/cli provides the devtune executable for Node 20+. It uses the
TypeScript client for project workflows.
Sign in
Browser sign-in requires CLI 0.2.0 or later. CLI 0.1.x uses project API keys;
use the automation configuration below. Run
devtune --version to check your
installed version.login opens your browser. Sign in to DevTune, select a project on the consent
screen, review its permissions and approve the connection. The CLI discovers that
project automatically. Use devtune login --no-browser to open the printed URL
manually on the same computer. Login waits up to five minutes and requires a
local loopback callback; use a project API key on headless or remote machines.
Refresh credentials are saved in macOS Keychain, Windows Credential Manager,
or a Linux Secret Service such as GNOME Keyring, KWallet or KeePassXC. Unlock the
credential store before login. Access tokens stay in memory. Each command obtains an access token using the saved
refresh credentials and refreshes it automatically when needed.
Canceling a command waits for any in-progress token refresh to finish saving securely.
It never falls back to a plaintext credentials file. If secure storage is
unavailable, use the environment configuration below.
A login belongs to one API root and the project selected during consent. Run
devtune login again to change projects. --project UUID and
DEVTUNE_PROJECT_ID must match that selected project; they do not expand access.
devtune auth status checks the connection’s current permissions, without
printing credentials. Removed project access or revoked consent requires a new
login after access has been restored.
Automation configuration
Create a project API key in API Keys in the account sidebar:--project UUID overrides the environment
project ID. An explicitly set DEVTUNE_API_KEY takes precedence over saved OAuth
credentials, including on machines that have run login; unset it to use OAuth.
No API-key argument is provided. See authentication
for API access and scopes.
Help, version and packaged workflow instructions work offline without a key or
credential-store access. Use DEVTUNE_API_BASE_URL or --base-url URL for an
explicit API root, including /api/v2; the default is
https://devtune.ai/api/v2. OAuth requires HTTPS except for loopback development
servers, and credentials are stored separately for each API root.
Measurements and Actions
no_recent_traffic; inactive needs attention. Snippet coverage
does not establish server-side answer fetch or 404 coverage.
Results reports observed before/after movement, not causation. Preserve null
deltas, evidence quality, unmeasured and still_measuring. Use
--intervention UUID for an existing measurement’s impact windows.
Actions list returns one page with bounded evidence context. Page size is 1
through 100 and defaults to 25. While pagination.hasMore is true, pass
pagination.nextCursor back with --cursor (CLI 0.3.0 or later) and the same
--page-size; the API refuses a cursor sent with a different page size, and
human output prints the next command while pagination.hasMore is true, except
when --page is used. --page N (from 1) still reads a numbered
page and cannot be combined with --cursor. Every list response carries
pagination.hasMore and pagination.nextCursor; where a command takes
--cursor, such as Actions and Results, pass nextCursor back with other
filters unchanged.
Bound your loops and report incomplete results. The CLI does not fetch every page
silently.
actions get ACTION_UUID searches the current project’s Actions workspace using
SDK list pages and evidence context. Defaults are --start-page 1, --max-pages 10
and --page-size 25. Max pages accepts 1 through 100; start page accepts 1 through 1000000. The lookup sends no status filter and includes the workspace’s workflow
statuses. Rows without a workflow state are outside this population; this is not
a search of every historical record or another project.
Lookup JSON is {action, pages, lookup}. The matching row retains workflow status,
opportunity, evidence and nulls. Every full list envelope is retained in pages.
A complete search from page 1 with no match returns lookup.state: "absent" and
exits 7, meaning not observed in the pages read. Live pagination cannot prove current absence. A bound with
more pages returns incomplete, exits 6 and provides lookup.nextPage for
--start-page. Keep page size unchanged. A search starting later cannot establish
absence from earlier pages; reaching the end without a match remains incomplete
and points back to page 1. Invalid, overlapping or changing pagination exits 4. Short or empty
pages do not establish the end when metadata says more pages remain. Live
pagination is not a snapshot; restart if the workspace changes during lookup.
Brief and draft commands read existing artifacts by Action ID. They do not
generate missing content. Suggestions steer around locked pages and
say when they do. Draft content needs human approval before publishing.
Scopes are citations.read and traffic.read for status, actions.read for
Actions, outcomes.read for Results, agents.read for waiting and agents.run for
launching. Existing keys do not automatically gain newly added scopes.
Response history and export
Usevisibility.read for these read-only commands. responses list --json returns
one history envelope. responses export always writes NDJSON to stdout, including
when --json is supplied. Redirect it to a file:
--prompt UUID, --platform KEY and --status STATUS select exact
cohorts. Status is pending, running, success, failed or rate_limited;
all five are included by default. Enterprise platforms follow existing access.
Only still-present executions whose started_at falls in the anchored 30/90-day
window are discoverable. Deleted executions cannot be recovered. Rows are newest
first. The listing is live, so retention, deletions and lifecycle status can change
during export. Exported rows are not a sample for visibility rates; use summary
commands for analytical reporting.
The devtune.responses.v1 format contains:
start: format, project, requested cohort, initial cursor and bounds.page: explicit window and population, API metadata, page size,pageCursor,nextCursorandhasMore. Windowfromis inclusive andbeforeis exclusive.execution: execution identifier, prompt, platform, lifecycle status, timestamps and the full publicgetVisibilityResponseenvelope underresponse, including null answer text, retained flag, ad coverage and separate ads. Raw provider JSON, credentials and internal errors are excluded.retained=falsemeans no nonempty public answer or ad evidence remains; it does not distinguish expiry from an answer that was never captured. An empty raw object is not retained evidence.completion:complete, reason, exit code, pages read, items exported, window, population and recovery. Onlycomplete=trueplus exit 0 establishes traversal completed. Missing or partial completion always means incomplete output.
complete=false; executions
are never silently skipped. Export failures normally produce completion records on
stdout. A blocked or broken output pipe may leave a partial record and prevent
completion from being written. The CLI then exits nonzero and tries to write a
recovery diagnostic to stderr, which may not arrive. When present, this diagnostic contains the reason, exit code, counts
and recovery metadata, but omits window and population. Use the preceding page
record for those fields. If recoveryTruncated=true, use that page record for
the replay cursor too. A partial execution record must be discarded before
replaying its page. Never infer success from missing or partial completion, even
if every expected execution appears present. Usage/configuration errors remain
on stderr and exit 2 before traversal.
To resume, pass completion.recovery.cursor using --cursor, with the same
project, window and cohort filters. If replayPage=true, replay the entire page
and deduplicate by project ID and execution ID, including records already written
before the failure. failedExecutionId identifies the interrupted detail read or
execution output write.
The first page has its own replay cursor, so its anchor is preserved too. A null
recovery cursor means no page anchor was obtained and no execution was exported;
retry starts a fresh window. Cursors expire after 90 days or server secret rotation.
A resumed invocation’s completion covers that invocation’s remaining traversal;
combine it with saved prior records and deduplicate to reconstruct the export.
Approved managed-agent task
Launching can spend credits. Obtain explicit human intent for the specific task. Save a UUID with the exact project, agent and instructions before launching. The CLI requires both--approve-metered and your saved --idempotency-key.
draft_ready, approved, dismissed and
superseded;
failed, blocked and server canceled are failures. Unknown statuses remain
pending until the deadline. No CLI command publishes output. Drafts require human
approval.
JSON and exit codes
--json reserves stdout for one JSON value, with no banners, except
responses export, which streams the NDJSON records described above. Individual
reads and launches without waiting return complete API envelopes, except the
Action lookup wrapper described above. Status returns
{citations, traffic} with both envelopes intact. Waiting returns {run, wait};
a launch with waiting returns {launch, run, wait}. run is the last full API
envelope or null if no poll completed. Coverage, windows, nulls and pagination are
preserved. A reused task that ended unsuccessfully with --wait retains the wrapper with run: null
and wait: {state: "failed", taskId}, exits 5 and never polls. Without --wait,
it returns the raw launch envelope. A dispatch failure during the current request
returns an API error and exits 4. Errors and launch recovery messages go to
stderr as JSON.
On a failed or pending wait, stdout can still hold the last full task envelope.
Read stderr. Resume
agents wait with its task ID only for pending work. For a
terminal failure, inspect the ended task before any new launch. Do not relaunch
just to continue waiting.
devtune instructions prints workflow v1 shipped with the installed CLI release.
devtune instructions --json includes the CLI version and workflow version for
coding agents. It covers configuration, scopes, JSON, pagination, coverage,
explicit metered intent and recovery.
Versions and updates
The SDK and CLI have separate versions. For reproducible CI jobs, pin the version rather than followinglatest. Check the published version before upgrading:
npm install -g @devtune/cli@VERSION.
For CI, use npx --yes @devtune/cli@VERSION --help, then replace --help with
the intended read command. Never put an API key in the command line. Run
devtune instructions after an update to read the workflow shipped with it.