Skip to main content

CI Usage

The rules for scripts​

  1. Pass --json. Every client command prints raw JSON with it; doctor --json prints only the summary object.
  2. Branch on exit codes, not text. 0 success, 2 policy refusal, 3 authentication, 4 conflict, 5 not found, 6 timeout, 7 protocol mismatch — the full table is on Troubleshooting.
  3. Provide credentials through the environment. VAGARIS_API_URL, VAGARIS_API_KEY and VAGARIS_COMPANY_ID (the older VAGRIS_* spellings are also read) replace --api-base, --api-key and --company-id. An explicit API key also disables the interactive login recovery, so nothing tries to open a browser.
  4. Nothing prompts. When stdin or stdout is not a terminal the CLI does not prompt: doctor --repair needs --yes, vagaris uninstall needs --force, agent local-cli --install-skills needs --yes.
  5. No telemetry. The CLI sends no usage telemetry, in CI or anywhere else.

A GitHub Actions job​

This mirrors the smoke matrix the project runs against each published version:

jobs:
vagaris-smoke:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install -g @vagarylabs/vagaris
- run: vagaris --version
- run: vagaris --help
- run: vagaris version --json
- run: vagaris doctor --json
env:
VAGARIS_API_KEY: ${{ secrets.VAGARIS_API_KEY }}

doctor needs nothing installed besides the CLI: it checks the server your commands target, the credential and this runner's node and lease state, and exits 1 if any check fails, so it gates the steps after it.

Driving a company from a pipeline​

export VAGARIS_API_URL=https://vagaris.example.com
export VAGARIS_API_KEY="$AGENT_API_KEY"
export VAGARIS_COMPANY_ID=<company-id>

vagaris issue create --title "Nightly dependency review" --json
vagaris heartbeat run --agent-id <agent-id> --timeout-ms 900000 --json
vagaris approval list --status pending --json

heartbeat run --timeout-ms bounds the wait; the default 0 waits until the run reaches a terminal status.

Pipe-friendly patterns:

vagaris issue list --status todo --json | jq -r '.[].identifier'
vagaris runctl history --json | jq '.[0]'

Governed work in CI​

A CI runner can host a run like a developer laptop. Enrol the runner once (Node Enrolment), keep its node data folder (~/.local/share/vagary/node on Linux, under the runner user's home) on persistent storage, and claim with --node-id:

vagaris dev --agent-id <agent-id> --run-id <run-id> --node-id <node-id> --json

The report is JSON; spawn.exitCode and closureGate are the fields to gate on. Use --no-spawn in a pre-flight step to confirm the claim would be allowed before spending runner time.

Backups from a schedule​

pnpm vagaris-dev db:backup --dir /backups --retention-days 30 --json

Version pinning​

vagaris update --to <version> and vagaris rollback --to <version> pin an exact version; vagaris version --json tells you whether the runner is behind. A PROTOCOL_MISMATCH (exit 7) from any command means the server moved ahead — update the CLI in the runner image.

Workload credentials and machine access​

CI authenticates with an existing Core workload binding, admitted by a Vagaris machine path. A company owner uses their own sign-in and the server's step-up gate to admit that binding:

vagaris company workload register <company-id> --core-binding-id <binding-id> --core-service-identity <service-id> --core-organization-id <org-id> --ref refs/heads/main
vagaris company workload list <company-id>
vagaris company workload bindings <company-id> <path-id>

Registration records existing Core references; it creates no issuer, trust binding or permission. Core's organization must equal the company's product tenant. To confer only an existing principal's run-claim authority, use vagaris company workload bind <company-id> <path-id> --principal <principal-id> --operation run_claim. The command explains the conferral and asks for confirmation. In a noninteractive session --yes confirms it; the server still enforces human identity, recent authentication and existing grants. For decision operations, provide --approval-type as well. An import-only binding may prepare an import, but cannot approve or execute it.

vagaris company workload unbind <company-id> <path-id> <service-binding-id>
vagaris company workload revoke <company-id> <path-id>

The CI job then uses the exact assertion audience already conferred in Core:

vagaris auth workload --api-base https://vagaris.example --company-id <company-id> --assertion-audience <audience> --token-output ./workload-token --json

GitHub Actions must grant id-token: write. Other callers can supply the assertion through --assertion-stdin; neither assertions nor issued tokens are accepted in command arguments. The command verifies the workload's company at the resource server before creating a new private token file. Existing files and saved human sessions are preserved. JSON output contains metadata only. Remove the token file when the job ends. The CLI synthetic remains paused until its exact binding, company, audience, receiver reachability and admitted CI capacity are verified.