Skip to main content

knuckles-cli

The operator CLI for Knuckles. It lets you add a new site, configure its sign-in methods, and check that everything is wired correctly, using just your Knuckles URL and admin token. You don't need a checkout, database access, or curl.

pip install knuckles-cli

It talks to a running Knuckles over HTTP only: the public discovery endpoints plus the /v1/admin/* API, so the server needs KNUCKLES_ADMIN_TOKEN set (Decisions #021 and #025).

Five-minute setup for a new site

# 1. Point the CLI at your server. The token is read from
#    $KNUCKLES_ADMIN_TOKEN, a file (--token-file, '-' = stdin), or a
#    hidden prompt. It never goes on the command line.
knuckles login --url https://auth.example.com

# 2. Create the tenant and drop its credentials into the app's .env
knuckles init my-site --name "My Site" \
  --origin https://my-site.com --origin http://localhost:3000 \
  --env-file ../my-site/.env

# 3. Turn on sign-in methods (any subset)
knuckles providers email   my-site --from "My Site <signin@mail.my-site.com>"
knuckles providers google  my-site --client-secret-json ~/Downloads/client_secret_*.json
knuckles providers apple   my-site --services-id com.my-site.web \
  --team-id AB12CD34EF --p8 ~/Downloads/AuthKey_ABCDE12345.p8
knuckles providers passkey my-site --origin https://my-site.com

# 4. Check it
knuckles doctor my-site

Commands

Command What it does
login --url URL Verifies the admin token against the server, then stores the profile.
logout Forgets the stored profile.
init ID --name N --origin O [--env-file F] Creates a tenant and prints the next setup steps.
apps list / apps show ID Lists tenants, or shows one. Secrets appear only as *_configured booleans.
apps create ID --name N --origin O [--env-file F] Creates a tenant without the next-steps output.
apps rotate-secret ID [--env-file F --force] Mints a new client secret. The old one stops working immediately.
apps set-origins ID ORIGIN... Replaces the tenant's allowed origins.
providers google ID --client-secret-json F Configures Google from the JSON file Google Cloud Console downloads. It warns if a redirect URI's origin isn't allowed.
providers apple ID --services-id S --team-id T --p8 F Checks the key is P-256 and reads the key id from AuthKey_<KEYID>.p8.
providers email ID --from ADDR Configures Resend. It checks that the sending domain is verified before storing the key.
providers passkey ID --origin O [--rp-id R] Derives the WebAuthn relying party and checks that the origin fits under the rp_id.
providers clear ID GROUP Resets email, google, apple or passkey to the operator env fallback.
doctor [ID] Checks the server (health, issuer, JWKS, HTTPS) and each tenant (origins, config groups, passkey fit).

Where secrets come from

The CLI never takes a secret as a command-line argument, because those end up in shell history and ps. Each secret is read from the first source available:

Secret --*-file option (- = stdin) Env var Otherwise
Admin token login --token-file KNUCKLES_ADMIN_TOKEN hidden prompt
Resend API key --api-key-file KNUCKLES_RESEND_API_KEY hidden prompt
Google client secret (manual entry) --client-secret-file KNUCKLES_GOOGLE_CLIENT_SECRET hidden prompt

For scripts and coding agents

  • Pass --json (before the subcommand) to get the Knuckles API envelope: {"data": ...} on success, {"error": {"code", "message"}} on failure. Server error codes such as APP_CLIENT_NOT_FOUND are passed through verbatim.
  • Exit codes: 0 success, 1 failure (including any failing doctor check), 2 usage error.
  • No config file needed: KNUCKLES_URL and KNUCKLES_ADMIN_TOKEN override the stored profile.
  • Profiles are stored in $XDG_CONFIG_HOME/knuckles/config.json (mode 0600), or at KNUCKLES_CONFIG if that's set. Select one with --profile NAME or KNUCKLES_PROFILE.

What doctor can't see

doctor sees only what the admin API returns. Encrypted values show up as booleans, and whether an empty group inherits the operator's env vars depends on server-side state (KNUCKLES_ALLOW_ENV_TENANT_FALLBACK). That's why empty groups are warnings, not failures. Resend domain verification is checked once, by providers email, while the key is in hand.

Releasing

Bump the version in pyproject.toml and __init__.py, add a CHANGELOG entry, merge, then push a tag:

git tag knuckles-cli-vX.Y.Z && git push origin knuckles-cli-vX.Y.Z

.github/workflows/release-cli.yml tests, builds and publishes to PyPI via Trusted Publishing.

Metadata

Release files for knuckles-cli 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for knuckles-cli 0.2.0
File Size Uploaded Provenance Actions
knuckles_cli-0.2.0.tar.gz 34.6 kB With provenance Details for knuckles_cli-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for knuckles-cli 0.2.0
File Interpreter ABI Platform Actions
knuckles_cli-0.2.0-py3-none-any.whl Python 3 none any Details for knuckles_cli-0.2.0-py3-none-any.whl

Total release size: 64.3 kB

Release files / knuckles_cli-0.2.0.tar.gz

Download URL knuckles_cli-0.2.0.tar.gz
Size 34.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7812a98ca8ae4cfae530429964feae921e0c1e6020693baf0b71ab1951271957
BLAKE2b-256 checksum
How to use checksums
291623cb7a94b84a34a877c540b2bbb898e7781928c9e9eec0b3bb86f9f6c784
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

Release files / knuckles_cli-0.2.0-py3-none-any.whl

Download URL knuckles_cli-0.2.0-py3-none-any.whl
Size 29.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
685b55cffd58ed71be6b89053bd0d980697bbeaaa12e0c287b92d6a4005e7e99
BLAKE2b-256 checksum
How to use checksums
63c2ac86de3422dae44129eab8c0e5a67efe34a419c20fb4c0bd0f1eed6b1cc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

Security for knuckles-cli 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for knuckles_cli-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page