Command-line interface
The Arcane command-line interface (CLI) is a standalone Go program that lets an operator manage an Arcane server from a shell or an automation job. It turns command input into authenticated API requests, applies one run-wide context for environment and output settings, and presents server results as terminal text or JSON. It also supports local setup, diagnostics, credential management, resource control, GitOps, backups, and platform administration.
Product role
The CLI is a remote control for Arcane rather than a second service. The executable starts the Cobra command tree, while command groups define product actions and the shared client carries those actions to the server (cli/main.go• L1-7, cli/…/root.go• L95-186).
Command tree
The root command is the public map of the product. It groups resource management, authentication, local configuration, diagnostics, secret and certificate generation, updates, GitOps, backups, activity tracking, and administration under one arcane-cli command. Each group owns its own subcommands (cli/…/root.go• L248-287).
The command groups are intentionally separate. This lets an engineer understand a user workflow at the group level without needing to know how the HTTP client or terminal renderer works. Detailed command and runtime support belongs in the related page: CLI commands and runtime.
References: cli/…/root.go• L248-287
Command lifecycle
Every invocation first resolves global settings and creates an application context. The root command places that context on the command, and the context carries the selected environment, output mode, confirmation policy, color policy, and timeout to the command's client and output helpers (cli/…/root.go• L66-99, cli/…/context.go• L32-74, cli/…/context.go• L112-141).
Commands also declare their environment scope. A resource command uses the selected environment, a merged command combines results from enabled environments, a fleet command runs an action across them, and a destination command requires one target environment. The scope wrapper keeps these choices consistent while reusing the command's request and output behavior (cli/…/scope.go• L48-87, cli/…/scope.go• L90-140, cli/…/scope.go• L143-302).
A command then obtains an authenticated or unauthenticated client, calls the Arcane API, checks the result, and renders it for the selected output mode. Shared request runners provide the common list, success-envelope, delete, timeout, and output rules so each command can focus on its product action (cli/…/run.go• L21-98, cli/…/run.go• L100-171, cli/…/context.go• L112-141, cli/…/client.go• L151-224).
The following diagram shows how a shell request becomes a server operation and terminal result.
sequenceDiagram
participant O as Operator or job
participant R as Root command
participant A as Run context
participant C as API client
participant S as Arcane server
O->>R: Run arcane-cli command
R->>A: Load config and global flags
A->>C: Create scoped client
C->>S: Send authenticated API request
S-->>C: Return API response or stream
C-->>R: Return checked result
R-->>O: Print text or JSON
References: cli/…/root.go• L66-99 cli/…/context.go• L32-74 cli/…/context.go• L112-141 cli/…/run.go• L37-171 cli/…/scope.go• L90-302
API client integration
The API client is the shared boundary between CLI commands and the Arcane server. It builds URLs from the configured server address, adds the active credentials, sends JSON or raw request bodies, and exposes response helpers for typed data, direct JSON, raw bytes, and the standard API envelope (cli/…/client.go• L60-110, cli/…/client.go• L176-256, cli/…/client.go• L495-602). Endpoint builders keep resource paths separate from command intent (cli/…/endpoints.go• L1-25). See API services for the server boundary behind these requests.
Authentication boundary
Authenticated commands require a server URL and at least one usable credential. The client prefers a JWT bearer token when both token types exist. Otherwise it sends the API key. Login, webhook triggers, and other public endpoints can use a client that checks only the server URL (cli/…/config.go• L103-127, cli/…/client.go• L81-110, cli/…/client.go• L386-395).
The CLI supports several credential paths:
arcane auth loginuses an OIDC device flow and saves the returned JWT and refresh token.arcane config set api-key <key>stores an API key for direct API access.arcane auth api-keysmanages personal keys that inherit the current user's permissions.arcane auth federatedexchanges a CI or other external OIDC token for a short-lived Arcane token.arcane admin api-keysmanages keys with explicit permission grants for administrative use.
An ARCANE_TOKEN environment value takes precedence for one run and replaces stored credentials in the client view. A stored JWT can refresh after an unauthorized response when a refresh token is available. A successful refresh updates the saved profile so later commands can use the new tokens (cli/…/client.go• L60-78, cli/…/client.go• L316-323, cli/…/client.go• L397-463).
The federated flow can use a token from a flag, file, standard input, GitHub Actions, or GitLab. The server maps the external identity to a short-lived Arcane token. The operator can export it as ARCANE_TOKEN for one job or persist it in the CLI profile (cli/…/federated.go• L31-138, cli/…/federated.go• L140-173).
References: cli/…/config.go• L103-127 cli/…/client.go• L60-110 cli/…/client.go• L151-224 cli/…/client.go• L316-323 cli/…/client.go• L397-463 cli/…/cmd.go• L33-167 cli/…/apikeys.go• L21-30 cli/…/federated.go• L31-173 cli/…/cmd.go• L78-83
Request contract
Commands use Arcane endpoint definitions and shared response checks instead of treating HTTP status as the full product result. Successful calls decode either direct JSON or the server's success/data/error envelope. Failed status codes return a bounded error body for useful operator feedback (cli/…/client.go• L495-602, cli/…/run.go• L100-171).
The client retries only idempotent requests after selected temporary server responses or transport failures. It does not retry actions that could repeat a state change. Commands that submit a job can add an idempotency key and reuse it when delivery is uncertain, so a retry does not create an unintended second run (cli/…/client.go• L279-384, cli/…/cmd.go• L157-192).
The client also supports raw request bodies for file transfer and streaming responses. This lets image builds and pulls, volume backups, and workspace changes keep their data path separate from normal JSON commands. Large local files use upload sessions so the CLI can send chunks and abort an incomplete session (cli/…/client.go• L176-256, cli/…/cmd.go• L376-414, cli/…/backup.go• L486-519).
References: cli/…/client.go• L176-256 cli/…/client.go• L279-384 cli/…/client.go• L495-602 cli/…/run.go• L21-171 cli/…/cmd.go• L258-414 cli/…/backup.go• L486-519 cli/…/cmd.go• L157-192
Configuration and run context
Configuration gives the CLI a durable connection profile. The default YAML file is ~/…/arcanecli.yml, and a command can replace that path with the global --config option. The profile holds the server URL, credentials, default environment, federated-auth audience, log level, update channel, and list-size preferences (cli/…/config.go• L78-105, cli/…/config.go• L80-100).
Configuration operations
The config command lets an operator inspect, initialize, update, back up, and test the profile. It accepts key/value pairs as well as legacy flags. It masks credentials when it displays them and writes the file with owner-only permissions (cli/…/cmd.go• L33-154, cli/…/cmd.go• L157-269, cli/…/config.go• L169-194, cli/…/config.go• L197-277).
The normal setup path is:
- Create or select a config file.
- Set the Arcane server URL.
- Choose an API key, OIDC login, or federated token path.
- Select a default environment if the server has more than one.
- Test the connection or run
arcane doctorbefore using resource commands.
The file is created on demand when it does not exist. A missing file therefore supplies local defaults, but a command that calls the protected API still fails until the server and credentials are valid (cli/…/config.go• L78-88, cli/…/config.go• L136-166, cli/…/config.go• L108-135).
References: cli/…/cmd.go• L33-154 cli/…/cmd.go• L157-239 cli/…/config.go• L78-105 cli/…/config.go• L136-194 cli/…/config.go• L103-135
Run-wide options
Global flags shape one invocation without changing the saved profile. The run context carries the environment override, output mode, confirmation policy, color policy, and request timeout to commands and clients (cli/…/root.go• L66-99, cli/…/context.go• L32-52).
The most important rules are:
--envchanges the environment for the current command only.--output jsonselects machine-readable output;--jsonis an alias.--yesskips confirmation for destructive actions.--no-colorremoves terminal color.--request-timeoutchanges the HTTP timeout for the current run.
The shared command helpers read these values from the context. Commands can therefore support shell automation without each group defining a separate policy. Confirmation can also use invocation-level fleet consent when a higher-level workflow has already approved the action (cli/…/context.go• L37-82).
References: cli/…/root.go• L66-99 cli/…/context.go• L32-52 cli/…/context.go• L37-82
Pagination policy
List commands share a pagination policy that balances safe terminal output with script control. An explicit --limit wins over a per-resource setting, which wins over the global default, which wins over the command fallback (cli/…/limit.go• L13-46).
--all rejects explicit pagination flags and sends the server's return-everything sentinel rather than an all query parameter. Resource names are normalized before lookup, so common singular and separator variants map to the same saved setting (cli/…/pagination.go• L11-26, cli/…/pagination.go• L61-90, cli/…/config.go• L23-78). Resource filters stay on the server so displayed rows and totals describe the same set (cli/…/cmd.go• L53-132, cli/…/cmd.go• L43-105, cli/…/cmd.go• L42-108, cli/…/cmd.go• L62-80, cli/…/cmd.go• L95-149).
List results keep pagination data available to both output modes. Text mode shows a count summary, while JSON mode preserves the server data and pagination information when the command uses the standard list helper (cli/…/run.go• L21-98).
References: cli/…/limit.go• L13-46 cli/…/pagination.go• L11-26 cli/…/pagination.go• L61-90 cli/…/config.go• L23-78 cli/…/run.go• L37-98 cli/…/cmd.go• L53-132 cli/…/cmd.go• L62-80 cli/…/cmd.go• L95-149
Product operations
The CLI exposes the Arcane control plane through command groups. Resource groups cover containers, images, volumes, networks, projects, environments, registries, repositories, templates, GitOps syncs, jobs, settings, system actions, activities, webhooks, vulnerabilities, and backups. Separate groups support authentication, diagnostics, local generation, version checks, server updates, and CLI self-update (cli/…/root.go• L126-136).
Resource management
Resource commands follow a common operator pattern: list or inspect server state, resolve a resource reference, perform a lifecycle or configuration action, then report the result. Environment-scoped resources use the selected environment from the run context. Interactive commands can resolve names or partial IDs and ask the operator to choose when a reference is not unique (cli/…/cmd.go• L84-145, cli/…/cmd.go• L171-228, cli/…/cmd.go• L108-143, cli/…/cmd.go• L111-146).
When all-environments preview is enabled, commands use their declared scope to choose a safe execution model:
- Merged read commands send one combined request and keep environment names and partial failures in the result.
- Fleet actions run once per enabled environment and combine their text or JSON results.
- Destination actions require
--envin JSON or non-interactive use. An interactive terminal can select a destination. - Resource actions resolve an identifier in the selected environment instead of guessing across environments.
This scope model lets read commands compare environments while preventing a create, pull, build, or upload action from using an unclear target. Mutating fleet commands ask for one confirmation before they start and report failures by environment (cli/…/scope.go• L90-140, cli/…/scope.go• L143-302, cli/…/cmd.go• L62-165, cli/…/cmd.go• L53-132, cli/…/extra.go• L312-402, cli/…/cmd.go• L43-105, cli/…/cmd.go• L62-96, cli/…/cmd.go• L42-108).
The main product areas are:
| Area | Operator purpose |
|---|---|
| Containers, images, volumes, and networks | Inspect runtime state and control Docker resources in an environment. |
| Projects and templates | Manage Compose-based applications and reusable application content. |
| Environments, registries, and settings | Connect Arcane to managed targets, image sources, and platform policy. |
| Jobs, activities, updater, and system actions | Start, inspect, cancel, or monitor background and platform work. |
| Webhooks and variables | Connect external triggers and shared configuration to Arcane actions. |
| Backups and vulnerabilities | Protect Arcane or volume data and review image security state. |
| Repositories and GitOps syncs | Connect source repositories to automated Compose deployments. |
Destructive actions ask for confirmation unless the operator supplies a command-specific force option or the run uses --yes. Long actions use a larger request window and may stream progress or activity data. This makes the same command usable at a terminal and in a controlled automation job (cli/…/confirm.go• L12-30, cli/…/scope.go• L200-302, cli/…/cmd.go• L171-353, cli/…/cmd.go• L258-414, cli/…/backup.go• L391-519).
References: cli/…/root.go• L126-136 cli/…/scope.go• L80-302 cli/…/cmd.go• L28-165 cli/…/cmd.go• L22-105 cli/…/cmd.go• L19-108 cli/…/confirm.go• L12-30
Project and file operations
Project commands manage Compose applications as a unit. Operators can inspect projects, start or stop services, restart or redeploy them, build or pull images, create or update project files, update workspace include files, archive or destroy a project, and inspect update counts (cli/…/cmd.go• L62-169, cli/…/cmd.go• L171-277, cli/…/actions.go• L25-340).
Long-running project actions return an operation stream. Log frames show work as it happens, while terminal error and completion frames decide whether the command reports success. Project and volume workspace operations also preserve the server's file-tree revision so local file changes apply to the right workspace state (cli/…/cmd.go• L279-353, cli/…/cmd.go• L514-601, cli/…/workspace.go• L206-313).
Project lists and project tags can be merged across enabled environments, while project creation is tied to one destination. This keeps application content and its target environment explicit even when an operator is comparing project state across a fleet (cli/…/cmd.go• L62-96, cli/…/actions.go• L25-53, cli/…/cmd.go• L355-449).
References: cli/…/cmd.go• L62-169 cli/…/cmd.go• L171-353 cli/…/cmd.go• L355-601 cli/…/actions.go• L25-340 cli/…/workspace.go• L206-313
Image and volume operations
Image operations combine runtime inspection with registry and storage work. Operators can search and filter images, inspect layer history and attestations, pull, build, upload, export, tag, remove, prune, and check for updates. Volume operations focus on persistent data. They cover lifecycle actions, usage, workspace files, backup policies, backup creation, restore, upload, download, archive inspection, and cleanup (cli/…/cmd.go• L31-132, cli/…/extra.go• L31-310, cli/…/extra.go• L312-612, cli/…/cmd.go• L19-389, cli/…/backup.go• L98-172, cli/…/backup.go• L275-671).
Image lists and usage views can combine enabled environments. Pull, build, upload, and volume creation are destination actions, while image and volume pruning can run as fleet actions. Large image and backup transfers use long timeouts and chunked or streamed data paths. A failed consume step aborts the upload session so incomplete data does not remain as server state (cli/…/cmd.go• L258-414, cli/…/extra.go• L312-402, cli/…/cmd.go• L42-108, cli/…/cmd.go• L209-239, cli/…/backup.go• L486-519).
References: cli/…/cmd.go• L31-132 cli/…/cmd.go• L258-414 cli/…/extra.go• L31-310 cli/…/extra.go• L312-612 cli/…/cmd.go• L19-389 cli/…/backup.go• L98-172 cli/…/backup.go• L275-671
Vulnerability operations
The vulnerabilities group gives operators a security view of images in an environment. It reports scanner status and severity summaries, lists findings, starts scans, shows image-level results, and manages ignore records (cli/…/cmd.go• L24-34, cli/…/cmd.go• L36-149, cli/…/cmd.go• L151-397).
Image identifiers use the shared image resolver, so a scan or ignore action can start from an image name, tag, or partial ID. Vulnerability lists can merge findings across enabled environments, while changes to ignore records remain tied to the selected environment (cli/…/cmd.go• L197-271, cli/…/cmd.go• L371-436, cli/…/cmd.go• L417-500).
References: cli/…/cmd.go• L24-34 cli/…/cmd.go• L95-271 cli/…/cmd.go• L274-436 cli/…/cmd.go• L417-500
Git repository operations
The repos group manages the Git repositories that other GitOps actions use as their source. It lets operators list, create, inspect, update, test, and delete repositories while storing the access method and commit settings needed for server-side Git work (cli/…/cmd.go• L29-34, cli/…/cmd.go• L76-183, cli/…/cmd.go• L230-383).
Repository access supports unauthenticated, HTTP, and SSH paths. Operators can also set host-key checks, commit author data, and an optional signing key. The group exposes branch listing and repository file browsing so an operator can validate source state before using it in a GitOps sync (cli/…/cmd.go• L121-181, cli/…/cmd.go• L386-489).
References: cli/…/cmd.go• L29-34 cli/…/cmd.go• L76-183 cli/…/cmd.go• L230-383 cli/…/cmd.go• L386-489
GitOps synchronization
The gitops group connects a repository to a Compose project and controls how Arcane brings Git state into an environment. A GitOps sync records the source branch, Compose file path, target project name, automatic-sync setting, and sync interval (cli/…/cmd.go• L38-43, cli/…/cmd.go• L88-129).
Operators can list, create, inspect, update, delete, trigger, and check the status of a sync. They can also browse source files and import a sync configuration. The sync flow links three product objects: a repository provides the Git source, a sync configuration selects the source content and timing, and a project receives the Compose-based result (cli/…/cmd.go• L45-86, cli/…/cmd.go• L132-179, cli/…/cmd.go• L282-450).
The related GitOps page gives the broader workflow view. The CLI page focuses on the operator's control surface: GitOps and project automation.
The following diagram shows the main relationship between repository setup and a GitOps deployment action.
flowchart LR
O[Operator] --> R[Git repository]
R --> S[GitOps sync]
S -->|branch and Compose path| P[Arcane project]
S --> T[Scheduled or manual sync]
T --> P
O -->|status or file browse| S
References: cli/…/cmd.go• L38-43 cli/…/cmd.go• L45-86 cli/…/cmd.go• L88-129 cli/…/cmd.go• L132-179 cli/…/cmd.go• L282-450 cli/…/cmd.go• L386-489
Background job operations
The jobs group gives an operator control over server background work. It shows configured schedules, updates selected schedule intervals, lists jobs, and queues a named job for immediate execution (cli/…/cmd.go• L25-193). The activities group gives a wider view of running and finished background operations. It supports filtering, detail messages, cancellation, and history cleanup (cli/…/cmd.go• L31-217).
Immediate job runs use a request ID as an idempotency key. The CLI creates one when needed and lets an operator provide the same value again when delivery is uncertain. This protects a retried submission from starting the same background job twice (cli/…/cmd.go• L157-192).
References: cli/…/cmd.go• L25-193 cli/…/cmd.go• L31-217
Administrative operations
The admin group manages the control-plane objects that define access and platform visibility. It provides user management, role and assignment management, API key management, OIDC role mappings, workload identity federation trust rules, event review, notification provider checks, system backups, and S3 backup destinations (cli/…/cmd.go• L16-32).
These operations express Arcane's access model at a high level:
- Users represent people who can sign in. New users receive no role assignment until an administrator grants one.
- Roles group permissions and can be built-in or custom. Manual assignments can be global or limited to one environment.
- OIDC mappings apply roles from identity-provider claim values during login.
- API keys carry explicit permission grants. A grant can be global or scoped to one environment.
- Federated credentials trust external OIDC claims and issue short-lived tokens through a service user.
- Events and notification settings support audit review and platform checks.
Role, key, and trust-rule changes update server-side access rules. The caller's permission scope and the selected environment affect the result. OIDC mappings are managed separately from manual role assignments, and personal API keys are separate from administrator-managed keys (cli/…/cmd.go• L37-43, cli/…/cmd.go• L48-53, cli/…/cmd.go• L288-355, cli/…/cmd.go• L34-42, cli/…/apikeys.go• L21-30).
References: cli/…/cmd.go• L16-32 cli/…/cmd.go• L37-43 cli/…/cmd.go• L48-53 cli/…/cmd.go• L288-355 cli/…/cmd.go• L34-42 cli/…/cmd.go• L78-83 cli/…/cmd.go• L54-59
System backup operations
The admin backups group protects Arcane's own database and configuration. Operators can create, list, upload, discover, restore, and delete encrypted system backups. Policies control scheduled runs and retention, while saved S3 destinations provide a remote storage target (cli/…/cmd.go• L61-68, cli/…/cmd.go• L70-176, cli/…/cmd.go• L266-509, cli/…/s3.go• L33-35, cli/…/s3.go• L38-299).
Recovery keys are part of the product safety boundary. Restore and remote backup operations need the key that protects the backup, and destructive actions require confirmation unless the operator explicitly bypasses it (cli/…/cmd.go• L179-263, cli/…/cmd.go• L512-607). S3 destinations can be selected by ID or name, tested before use, and checked for references from backups or policies (cli/…/resolve.go• L16-50, cli/…/s3.go• L74-117).
Policy updates preserve the full policy collection when an operator changes selected fields. The CLI reads the current policies, changes one selected policy, and saves the collection. An operator can also replace the full collection from a JSON file or standard input. A new policy requires a schedule, and multiple existing policies require an explicit policy ID (cli/…/cmd.go• L354-448, cli/…/cmd.go• L597-689).
References: cli/…/cmd.go• L61-176 cli/…/cmd.go• L179-263 cli/…/cmd.go• L266-509 cli/…/cmd.go• L512-607 cli/…/cmd.go• L354-448 cli/…/cmd.go• L597-689 cli/…/resolve.go• L16-50 cli/…/s3.go• L33-35 cli/…/s3.go• L38-299
Authentication operations
The auth group manages the operator's session with the server. It supports browser-based device login, logout, current-user inspection, password change, token refresh, personal API keys, federated token exchange, and OIDC status checks (cli/…/cmd.go• L26-31, cli/…/cmd.go• L33-204, cli/…/apikeys.go• L21-173, cli/…/federated.go• L31-138).
Device login is a two-party flow. The CLI asks the server for a device code, the operator completes approval in a browser, and the CLI polls until the server returns tokens or a terminal error. The tokens then become the profile used by later protected commands (cli/…/cmd.go• L33-167).
Personal API keys inherit the owner's permissions and are separate from administrator-managed keys with explicit grants. This distinction keeps self-service credentials and control-plane credentials under different operator workflows (cli/…/apikeys.go• L21-30, cli/…/cmd.go• L78-83).
References: cli/…/cmd.go• L26-31 cli/…/cmd.go• L33-204 cli/…/apikeys.go• L21-173 cli/…/federated.go• L31-138 cli/…/cmd.go• L78-83
Diagnostics and local generation
The CLI also provides local support commands that do not represent server resources. doctor checks the profile, selected environment, credentials, and API connection. generate creates local API keys, encryption secrets, HTTPS certificates, and edge mTLS assets for setup workflows (cli/…/cmd.go• L29-131, cli/…/api_key.go• L17-47, cli/…/secret.go• L18-54, cli/…/certs.go• L42-117).
These commands separate local preparation from server administration. Generated private keys and secrets are written or printed for the operator to place into the deployment environment. The diagnostics command returns a failed process result when a required check fails, which makes it useful in automation (cli/…/cmd.go• L49-130, cli/…/certs.go• L132-190).
References: cli/…/cmd.go• L29-131 cli/…/api_key.go• L17-47 cli/…/secret.go• L18-54 cli/…/certs.go• L42-117 cli/…/certs.go• L132-190
Platform and update operations
The CLI exposes platform-wide actions through system, updater, version, and self-update. These commands report Docker and Arcane versions, prune unused resources, start or stop groups of containers, convert Docker run input to Compose, check or trigger server upgrades, run the container and project updater, inspect update history, and replace the CLI executable (cli/…/cmd.go• L24-29, cli/…/cmd.go• L31-271, cli/…/cmd.go• L23-150, cli/…/cmd.go• L18-69, cli/…/cmd.go• L67-125).
Server upgrades and updater runs can affect many resources, so the CLI uses explicit confirmation and longer request windows. CLI self-update is a local release flow: it resolves a channel and artifact for the current platform, checks its checksum, optionally verifies the signed checksum bundle through Sigstore trust data, and replaces the executable only after verification (cli/…/cmd.go• L196-237, cli/…/cmd.go• L334-376, cli/…/cmd.go• L193-240, cli/…/cmd.go• L406-493, cli/…/verify.go• L30-111).
The self-update command supports stable and next release channels, dry runs, explicit versions or target paths, and JSON plan output. The verification preview uses cached TUF trust data and requires a trusted release-key signature with transparency-log and observer-timestamp checks (cli/…/cmd.go• L67-125, cli/…/cmd.go• L193-240, cli/…/cmd.go• L543-565, cli/…/verify.go• L44-111).
References: cli/…/cmd.go• L24-29 cli/…/cmd.go• L31-271 cli/…/cmd.go• L334-376 cli/…/cmd.go• L23-150 cli/…/cmd.go• L18-69 cli/…/cmd.go• L67-125 cli/…/cmd.go• L193-240 cli/…/cmd.go• L406-493 cli/…/cmd.go• L543-565 cli/…/verify.go• L30-111
Output and operator feedback
The CLI has two output audiences: people at a terminal and programs in a pipeline. Text mode uses shared messages, key-value views, tables, semantic status colors, progress trackers, spinners, and pagination summaries. JSON mode prints structured data so scripts do not need to parse human labels (cli/…/output.go• L78-135, cli/…/output.go• L217-261, cli/…/tui.go• L51-70, cli/…/tui.go• L100-164).
Color is a presentation feature, not part of the command result. The CLI disables it when requested and also avoids color when standard output is not a terminal. Interactive selection requires a terminal, so automation must use explicit flags or values instead (cli/…/output.go• L68-76, cli/…/prompt.go• L15-27).
Output modes
Output mode is a run-wide contract. Text output is for direct operator feedback. JSON output is for scripts and preserves structured data from the server when a command supports the standard response envelope (cli/…/root.go• L73-83, cli/…/context.go• L108-110, cli/…/context.go• L37-50).
Long operations use progress feedback only in text mode. JSON mode passes the machine-readable stream or result through without terminal decoration, which keeps the command usable in pipelines (cli/…/cmd.go• L282-295, cli/…/cmd.go• L502-572, cli/…/extra.go• L561-612, cli/…/tui.go• L51-70).
References: cli/…/output.go• L68-76 cli/…/output.go• L78-135 cli/…/output.go• L217-261 cli/…/tui.go• L51-70 cli/…/tui.go• L100-164 cli/…/prompt.go• L15-27 cli/…/root.go• L73-83 cli/…/context.go• L108-110 cli/…/context.go• L37-50 cli/…/run.go• L37-146
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the executable entry point, root command registration, command-group help, and the related CLI commands and runtime page aligned when a group or global flag changes.
- Keep root run-state options aligned with
AppContext, client construction, command helpers, and the persisted configuration profile. - Keep scope declarations aligned with all-environment preview behavior. A command that changes scope must still choose the right merged, fleet, destination, resource, read, or global contract.
- Keep merged and fleet output aligned with per-environment failure reporting, environment labels, JSON result shape, and restoration of the prior environment.
- Keep credential precedence consistent between config validation, client header selection,
ARCANE_TOKEN, login, logout, federated exchange, personal keys, and token refresh. - Keep environment selection consistent between the saved default,
--env, client endpoint construction, and administrative commands that use global scope. - Keep endpoint path builders aligned with server routes and keep caller-supplied path segments escaped.
- Keep paginated resource names aligned across the known-resource list, config key parsing, list command resource names, and server-supported list paths.
- Keep project archive filters aligned with the server's default exclusion of archived projects so
--allcontinues to mean all projects. - Keep project and image operation-stream framing aligned with the server. Log, activity, terminal error, and completion frames must remain distinct.
- Keep project and volume workspace revisions, manifests, file paths, and file parts aligned with the server's file-content contract.
- Keep repository credentials and signing data aligned with the server's create and update contracts. File flags must still provide the complete key material expected by those requests.
- Keep GitOps repository references aligned with repository IDs. Sync creation and import must continue to send the source and Compose path fields the server needs.
- Keep JSON output contracts aligned with the server response shape. Commands that echo raw responses must not silently drop fields that are not modeled by the CLI.
- Review confirmation, terminal requirements, and timeout behavior when adding a state-changing, interactive, or long-running command. These are part of the automation contract.
- Keep the job run request ID contract aligned with the server's idempotency behavior and the
--request-idrecovery path. - Keep image, network, and volume filters server-side so page totals and displayed rows describe the same set of resources.
- Keep volume and system backup policy updates as full collection updates when the server expects existing policies to remain in the request. Preserve the read-modify-write path when field flags update one policy, and keep raw JSON replacement mutually exclusive with those flags.
- Keep federated provider detection, audience selection, token export, and persistence aligned with CI identity-provider contracts.
- Keep generated certificate and secret output aligned with the deployment variables and file permissions that consume them.
- Keep self-update channels, artifact names, checksums, signed checksum bundles, TUF trust data, and executable replacement behavior aligned with the release sources.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| Server URL is missing | The CLI cannot create even an unauthenticated client | Set server-url or pass a config file with a valid server URL |
| No API key or JWT is available for a protected command | Configuration validation stops the request before it reaches the server | Run auth login, set an API key, or use a federated token |
| Stored JWT is expired and no refresh token is available | The request fails with an authentication error | Log in again or configure a valid refresh token |
ARCANE_TOKEN is used for a federated run that must persist | The token exists only for that run and later commands remain unauthenticated | Use --persist or export the token into the job environment |
--json is combined with federated --export | The command rejects the output combination before token exchange | Choose structured output or shell exports |
A destination command runs in all-environments preview without --env in JSON or non-interactive mode | The command cannot choose a safe target and stops before the resource action | Pass one explicit environment or use an interactive terminal |
A fleet mutation is run without confirmation or --force | The action does not start across the enabled environments | Confirm the fleet action or use the command's force option only in a trusted workflow |
| A merged request exceeds the configured environment limit | Environments beyond the limit are reported as failures and are not queried | Raise the server limit or run the command with an explicit environment |
| A merged command returns invalid JSON for one environment | The per-environment result is marked as failed and the overall command returns an error | Keep each child command's JSON output valid |
--all is combined with --limit or --start | The list command rejects the conflicting pagination request before sending HTTP | Use --all alone or choose explicit pagination |
A list client sends all=true instead of the return-everything limit | The server can ignore the unknown flag and return only its default page | Preserve the shared pagination wire contract |
| Destructive command runs without confirmation input | The command cancels or cannot proceed in a non-interactive context | Use --yes or the command's force option only in a trusted workflow |
| A project, image build, or pull stream receives a terminal error or ends without completion | The CLI reports failure instead of claiming success | Treat error and completion frames as control data and keep the operation timeout long enough |
| A project or volume workspace update uses a stale file-tree revision | The server rejects or conflicts with the file change | Read the current workspace and send its revision with the manifest |
| A large upload fails after session creation | The server can retain an incomplete upload session | Abort the session when chunk upload or consume fails |
| A repository key path is unreadable | Repository creation or update stops before the API request | Use a readable SSH or signing-key file and pass the path explicitly |
| A GitOps sync references a missing repository or invalid Compose path | Sync creation, import, or execution fails at the server boundary | Validate the repository and source path before enabling the sync |
| A job submission is retried with a new request ID after an uncertain response | The same background job can be queued more than once | Reuse the original --request-id value |
| Volume or system backup policy update omits existing policies | The server can replace the full collection and remove policies not included in the update | Select the target policy while preserving the complete collection, or provide a complete JSON payload |
Multiple system backup policies exist and an update omits --policy-id | The CLI cannot identify the target policy and stops before saving | Select the policy ID or replace the full collection with --file |
System backup policy --file is combined with field flags | The CLI rejects the request before sending an ambiguous full-collection update | Use --file alone for replacement, or use field flags for read-modify-write |
| Recovery key is missing during restore | The server cannot decrypt the backup and the restore does not proceed | Provide the recovery key explicitly or use a secure interactive prompt |
| Federated provider or audience does not match the trust rule | Token exchange fails or returns no usable Arcane token | Use the configured provider, audience, issuer, and subject values |
| Generated TLS or mTLS assets are used with the wrong host, environment, or file path | The server or edge agent cannot establish the expected trust relationship | Use the generated output values and keep private keys readable only by the owning user |
| Self-update signature or TUF trust data cannot be verified | The update plan fails before installation | Use a current release with valid trust data, or disable the preview verification only when the release policy allows it |
| Downloaded self-update artifact does not match the expected checksum | The executable is not replaced | Keep the release artifact and checksum source aligned and retry the update |
| Server returns a non-2xx status or a failed API envelope | The command reports an error and does not treat the operation as successful | Check the server response and the caller's permission scope |
Key files
| File | Why to read it |
|---|---|
| cli/main.go | Shows the standalone executable boundary and delegation to the CLI package. |
| cli/…/root.go | Shows the root command registration, global flags, per-run setup, signal handling, and executable behavior. |
| cli/…/context.go | Shows the shared context that carries config, run policy, environment selection, and lazy client access. |
| cli/…/config.go | Shows profile loading, persistence, defaults, permissions, cache behavior, and backup behavior. |
| cli/…/config.go | Defines the durable connection, auth, environment, federated audience, update channel, and pagination model. |
| cli/…/client.go | Shows the boundary between commands and the Arcane API, including auth, retries, refresh, raw transfers, and response checks. |
| cli/…/endpoints.go | Shows how CLI resource concepts map to server paths. |
| cli/…/run.go | Shows the shared request, list, delete, timeout, envelope, and output rules. |
| cli/…/scope.go | Shows how commands select one environment, merge reads, or run fleet and destination actions. |
| cli/…/limit.go | Shows list-size precedence shared by resource groups. |
| cli/…/pagination.go | Shows the --all wire contract and shared pagination query behavior. |
| cli/…/cmd.go | Shows the operator workflow for setup, connection checks, pagination settings, and profile backup. |
| cli/…/cmd.go | Shows login, token storage, logout, password change, and refresh operations. |
| cli/…/federated.go | Shows CI and external OIDC token exchange, token export, and one-run token use. |
| cli/…/cmd.go | Shows the administrative command boundary and its child groups. |
| cli/…/cmd.go | Shows user lifecycle and the separation between users and role assignments. |
| cli/…/cmd.go | Shows custom roles, permission manifests, and scoped manual assignments. |
| cli/…/cmd.go | Shows scoped API key lifecycle and permission grants. |
| cli/…/cmd.go | Shows SSO claim-to-role mappings and environment scope. |
| cli/…/cmd.go | Shows workload identity federation trust rules and service-user linkage. |
| cli/…/cmd.go | Illustrates environment-scoped resource lookup, merged listing, lifecycle actions, creation, and safety prompts. |
| cli/…/cmd.go | Illustrates Compose project lifecycle actions, destination creation, merged lists, streamed operations, and workspace file changes. |
| cli/…/actions.go | Shows project tags, archive state, build and service actions, and workspace file operations. |
| cli/…/cmd.go | Illustrates image search, merged listing, destination transfers, long-running pulls, and storage actions. |
| cli/…/extra.go | Shows image builds, exports, attestations, history, tagging, and build records. |
| cli/…/cmd.go | Shows merged network reads, fleet pruning, destination creation, and container connections. |
| cli/…/cmd.go | Shows merged volume reads, fleet pruning, destination creation, and volume resolution. |
| cli/…/backup.go | Shows volume backup policy, transfer, restore, and archive operations. |
| cli/…/workspace.go | Shows volume workspace browsing, download, and revision-aware file writes. |
| cli/…/cmd.go | Shows image scanning, merged vulnerability views, severity filters, and ignore records. |
| cli/…/cmd.go | Shows repository lifecycle, source validation, authentication settings, branch access, and file browsing. |
| cli/…/cmd.go | Shows GitOps sync lifecycle, source browsing, manual triggers, status, import, and project linkage. |
| cli/…/cmd.go | Shows schedule management and idempotent background-job execution. |
| cli/…/cmd.go | Shows background activity inspection, cancellation, and history management. |
| cli/…/cmd.go | Shows encrypted system backup, recovery-key, policy, restore, S3 selection, and full-policy update operations. |
| cli/…/s3.go | Shows remote S3 destination management and connection checks. |
| cli/…/cmd.go | Shows configuration and API diagnostics for local setup and automation. |
| cli/…/certs.go | Shows local HTTPS and edge mTLS asset generation. |
| cli/…/cmd.go | Shows platform-wide prune, bulk container, Docker info, conversion, and upgrade operations. |
| cli/…/cmd.go | Shows server-side auto-updater status, execution, and history. |
| cli/…/cmd.go | Shows CLI release-channel selection, update planning, checksum validation, optional signature verification, and safe executable replacement. |
| cli/…/verify.go | Shows the release-key and Sigstore trust checks used by the self-update preview. |
| cli/…/output.go | Shows shared text, table, status, color, and pagination presentation. |
| cli/…/tui.go | Shows terminal progress and spinner feedback for long operations. |
| cli/…/prompt.go | Shows the terminal boundary for interactive selection. |
| cli/…/scope_test.go | Pins merged environment names, partial failures, environment limits, JSON results, and restoration of the prior environment. |
| cli/…/cmd_test.go | Pins resource resolution, server-side filters, pagination, merged output, JSON passthrough, and update filtering. |
| cli/…/cmd_test.go | Pins the key/value configuration and pagination setting contract. |