3.6 KiB · text History 3208487

vgl: command-line client for Vigil

Speaks Vigil’s Sentry-compatible /api/0 API with a bearer token. It’s the same API sentry-cli and Terraform-style tools use, so anything vgl can do, any Sentry client can do too.

cargo build --release   # target/release/vgl
cargo test

Signing in

Make a token in the web UI under Settings → API tokens. Tick the scopes for what you’ll do: project:read and event:read to look around, project:write / project:admin to manage projects and keys, event:write to triage issues, team:read (or org:read) for vgl teams. Then:

vgl login --url https://vigil.example.com                  # prompts for the token, unechoed
vgl login --url https://vigil.example.com --token-stdin < token.txt
vgl login --url https://vigil.example.com --org acme --project web

login checks the token against GET /api/0/ before saving anything. Credentials go in ~/.config/vigil/config.toml, mode 0600, along with a default organization and project. If you belong to one organization only, that one becomes the default.

Each setting is looked up in this order: the flag, then the environment variable, then the file.

flag environment file
--url VIGIL_URL url
--token VIGIL_TOKEN token
--org VIGIL_ORG org
--project VIGIL_PROJECT project

VIGIL_CONFIG points at a different config file.

Commands

vgl login [--url URL] [--token-stdin]   check a token and save it
vgl logout                              forget it (the token stays valid)
vgl whoami                              who the token belongs to, its scopes
vgl orgs                                organizations you belong to
vgl teams                               the organization's teams

vgl projects [list]                     projects the token can see
vgl projects create NAME --team TEAM [--slug S] [--platform P]
                                        prints the new project's DSN
vgl projects show [PROJECT]
vgl projects edit [PROJECT] [--name N] [--slug S] [--platform P]
vgl projects delete [PROJECT] [--yes]   asks you to type the slug, unless --yes

vgl keys [list]                         DSN keys of the project
vgl keys create [--name NAME]
vgl keys revoke ID [--disable]          delete a key, or only switch it off
vgl dsn                                 the project's first active DSN, nothing else:
                                          export SENTRY_DSN=$(vgl dsn)

vgl issues [list] [--query Q] [--status unresolved|resolved|ignored|all] [--limit N]
vgl issues resolve ID…                  ID: WEB-12, 12, or the issue's UUID
vgl issues unresolve ID…
vgl issues ignore ID…                   (alias: mute)

vgl releases [list] [--limit N]         the project's when one is set, else the org's
vgl releases show VERSION
vgl monitors [list]                     cron monitors
vgl uptime [list]                       uptime monitors

--query takes the web UI’s search syntax: free text, level:error, release:1.2, environment:prod, assigned:me, any tag:value.

--json on any command prints the server’s JSON instead of a table. Errors print the server’s reason (detail, or the field errors of a refused value) and exit 1.

Packages

cargo deb and cargo generate-rpm build vgl packages from the metadata in Cargo.toml. CI builds both with cli/Dockerfile, which also runs the checks:

podman build --format docker --target packages \
  --output type=local,dest=./cli-dist --file cli/Dockerfile .

docker buildx build takes the same arguments, without --format docker.