CLI

Scripting

Drive the CLI from shell scripts, CI and coding agents with JSON output, stable exit codes and no prompts.

The CLI is built to be driven by shell scripts, CI jobs and coding agents. Data goes to stdout, everything else goes to stderr, exit codes are stable and every prompt can be turned off.

Output

Output is text when stdout is a terminal and JSON when it is piped or redirected; force a format with --output json or --output text, the POLYLANE_OUTPUT variable or the config file, in that order of precedence. stdout carries only data, whether JSON, table rows or streamed tokens, so it is safe to pipe. stderr carries spinners, progress, hints and errors, and in JSON mode an error arrives as an object with code, message and hint, where code matches the exit code.

Flags for scripts

FlagDescription
--output jsonForce JSON regardless of terminal state
--quietSuppress spinners and progress; stdout stays pure data
--non-interactiveFail fast on missing input instead of prompting
--yesSkip confirmation on destructive commands
--dry-runShow what would happen without making changes
--fullReturn full objects on list commands instead of the narrow field projection
--api-key <key>Override the stored API key for one call
--workspace <id>Override the default workspace for one call

With --non-interactive, polylane cloud disconnect refuses to run unless you also pass --yes, while other confirmations, such as polylane memory delete, are skipped, so pass --yes explicitly to make intent clear. POLYLANE_API_KEY and POLYLANE_WORKSPACE_ID set the credential and workspace from the environment, which suits CI; see Authentication.

Exit codes

CodeDescription
0Success
1General error
2Usage error: bad flag, missing argument
3Authentication error
4Rate limit or plan upgrade required
5Timeout
6Network error
130Interrupted with Ctrl-C

Branch on the exit code first to decide whether to retry, re-authenticate or surface the failure, then parse the error object on stderr for detail.

Example

Terminal
polylane issue list --active --severity critical --output json --quiet \
  | jq -r '.items[] | "\(.id)\t\(.title)"'

polylane issue list returns an object with items and count, and each item is projected to id, severity, status, title, resourceKind, resourceId, detectedAt and investigationThreadId; --full returns the complete objects. Issues explains the lifecycle behind each status.

  • Authentication: API keys and environment variables for CI.
  • Configuration: output and timeout settings and the config file.
  • Issues: the statuses and severities the issue commands return.
  • Threads: what thread ask starts and how a thread progresses.