Skip to content

badge

snug badge <COMMAND>

Badge template registry, rendering, and verification.

Subcommands

CommandWhat it does
template-addCreate a badge template from a JSON definition file
template-listList badge templates
template-getGet a badge template by id
template-versionCreate a new version of an existing template
template-activateActivate a template version (sets it as the active version)
template-deprecateDeprecate a template version
template-disableDisable a template version (renders are rejected)
template-visibilitySet template visibility (public or private)
cache-purgePurge all cached renders for a template
public-keyShow the service Ed25519 verification public key
template-metricsShow render and cache metrics for a template
source-addRegister a state source from a JSON definition file
source-listList registered state sources
renderRender a badge by template id
verifyVerify signed badge metadata from a JSON file

Run snug badge <command> --help for that command's own options. The global options apply everywhere.

Examples

snug badge template-add --file status-template.json --activate --public
snug badge template-list --filter 'status[eq]=active'
snug badge template-get bdg_tpl_service_status --include-versions
snug badge template-version bdg_tpl_service_status --file status-v2.json --activate
snug badge template-activate bdg_tpl_service_status --version 2
snug badge template-deprecate bdg_tpl_service_status --version 1
snug badge template-disable bdg_tpl_service_status
snug badge template-visibility bdg_tpl_service_status --visibility public
snug badge source-add --file leaderboard-rank-source.json
snug badge source-list --limit 20
snug badge render --id bdg_tpl_service_status --param service_id=snug-api --param label=api
snug badge render --id bdg_tpl_service_status --version 3 --output status.svg
snug badge render --id bdg_tpl_service_status --param state=passing --include-metadata
snug badge verify --metadata badge-metadata.json
snug badge public-key
snug badge template-metrics bdg_tpl_service_status
snug badge cache-purge bdg_tpl_service_status

Next

Workspace and permission options

The JSON files accepted by template-add and source-add may set workspace_id and access_visibility (private or workspace). Omitting them creates a private resource in the organization's default root workspace. Template visibility (private or public) separately controls anonymous SVG rendering.

Share through the existing Access commands:

snug access grant --target badge-templates --id "$TEMPLATE_ID" \
  --subject-kind user --subject-id "$USER_ID" --role reader
snug access revoke --target badge-templates --id "$TEMPLATE_ID" \
  --subject-kind user --subject-id "$USER_ID" --role reader

Use badge-sources to share a source definition. Raw state sources require a current tenant administrator and a tenant-qualified Redis key. A source must explicitly set public_render: true before an anonymous badge can use it.