canopy CLI Reference
- Build, profiles, login
- Output, exit status, completion
- Getting the binary
- Offline commands
- Access
- Command tables
login,logout,token,completion— canopy-identity (identity_issuer) and localconfig— local files, offlineperson— canopy-persons (persons_url)household— canopy-persons (persons_url)income— canopy-persons (persons_url)asset— canopy-persons (persons_url)expense— canopy-persons (persons_url)address— canopy-persons (persons_url)rules— canopy-rules (rules_url)application— canopy-applications (applications_url)interview— canopy-applications (applications_url)eligibility,determine— canopy-eligibility (eligibility_url)document— canopy-notices (notices_url)renewal— canopy-renewals (renewals_url)appeal— canopy-appeals (appeals_url)ipv— canopy-appeals (appeals_url)report— canopy-reporting (reporting_url)verification— canopy-snap (snap_url) and canopy-persons (persons_url)snap— canopy-snap (snap_url)tanf,medicaid,caps,wic— the program services (<program>_url)security— canopy-security (security_url)
For an operator or developer driving a Canopy operation from a shell: canopy is the ADR-007
parity binary — every subcommand is one thin reqwest call to a service’s REST API, never a
database (ADR-007; tools/canopy-cli/src/main.rs
dispatches, tools/canopy-cli/src/cmd/<group>.rs builds the request). canopy --help and
canopy <group> <sub> --help are authoritative for flags; the tables here add the endpoint and
the route’s admission. The task runner cargo xtask is a different binary — cargo xtask Subcommand Catalog.
Build, profiles, login
cargo build -p canopy-cli # [[bin]] name = "canopy" in tools/canopy-cli/Cargo.toml
./target/debug/canopy --help # target/release/canopy after --release; the service image carries it at /app/canopy (deployment-guide.adoc, #2099)
canopy --profile devstack login # prints canopy-web's device page and a code; approve it there
canopy --profile devstack token canopy-persons # prints a canopy-persons token from the session
canopy --profile devstack logout # revokes and removes the session
-
Profiles. Every command except
completionopens the session of--profile <PROFILE>(global, defaultdefault;session::Session::open,tools/canopy-cli/src/session.rs). A profile is a table inprofiles.tomlunderdirs::config_dir()/canopy—~/.config/canopy/on Linux (config::load_profile,config::config_dir,tools/canopy-cli/src/config.rs); a missing file is created with a[default]table ofProfile::default()values. Fields (config::Profile):identity_issuer, canopy-identity’s issuer identifier (:<port>/identity;httponly underCANOPY_ENV=development), an optionalca_file, a PEM CA bundle trusted beside the system's roots when reaching it, and one base URL per service —persons_url,applications_url,eligibility_url,rules_url,security_url,notices_url,renewals_url,snap_url,tanf_url,medicaid_url,caps_url,wic_url,appeals_url,reporting_url; the last nine carry serde defaults, the rest are required. -
The
devstackprofile names no table: it is derived on every run from the nearest.ports.envat or above the working directory (devstack::profile,tools/canopy-cli/src/devstack.rs), so it follows each bring-up’s ports. Its issuer isCANOPY_TESTIDENTITY_ISSUER(canopy-web’shttps://web.canopy.test:<port>/identity), its CACANOPY_TESTUPSTREAM_CA(.devstack/idp/kanidm-ca.pem), each service URLCANOPY_TEST<SERVICE>_URL, and the issuer’s host is pinned toCANOPY_TESTWEB_ADDR, the ingress’s published address, so no hosts entry is needed. A process variable of the same name wins over the file. -
loginis the RFC 8628 device flow at the profile’s issuer (ADR-049 §7;cmd::login::loginover canopy-auth’sDeviceClient): it prints canopy-web’s device page and a user code on stderr, a worker signed in to canopy-web approves the device there (a fresh sign-in, the step-up the approval needs), and the command polls until then or the code expires. canopy-web’s identity edge serves every endpoint under the issuer, so the CLI needs no other URL. No credential is typed into the CLI. A new login revokes the profile’s prior session at the same issuer. -
The session. A native session: a DPoP device key and a rotating refresh credential bound to it, in one owner-only directory per profile,
identity/<profile>besideprofiles.toml(canopy-auth’sDeviceStore,device_store_dir), every refresh under the store’s file lock so two invocations never present one credential. The session names its issuer: after the issuer moves (a devstack port move) or the session ends, a command answersno session for this issuer; log in, and youloginagain. -
Calls. Each call to a service refreshes the session for that service’s own audience and sends the token through
canopy_auth::send_with_retry(client::ApiClient): a token the receiver refuses (a401whoseBearerchallenge names no error orinvalid_token,canopy_auth::refuses_the_bearer) is re-minted once and resent; any other401is returned as it came. A command whose service canopy-cli has no edge to (identity_policy::call_graph's canopy-cli rows) fails before anything is sent. -
token <SERVICE>prints one service’s token on stdout, for a caller sending its own request; it is the only command that prints a token.logoutrevokes the session and removes it; no session is no error.
Output, exit status, completion
--format table|json is global (output::Format, default table): table prints a list as
tab-separated columns under a header (output::print_list) and one object as key: value lines
(output::print_detail); json prints the response body pretty-printed. Commands whose route
returns no body (person delete, application withdraw, the claim-delete / close-member
closes, verification reject) print a one-line confirmation in either format. A non-2xx response
fails the command with HTTP <status>: <detail> and a non-zero exit (output::check_status);
the security chain-* commands also exit non-zero on their fail-closed arms (table below).
canopy completion <SHELL> (bash, elvish, fish, powershell, zsh) writes the
clap_complete script to stdout (cmd::completion::run) — source <(canopy completion bash);
it needs no profile or token.
Getting the binary
Canopy builds canopy for others to download, so a pack author or a configuration repository's pipeline runs canopy config check without compiling canopy. The file is canopy-x86_64-unknown-linux-musl, with a .sha256 beside it. Two jobs offer it, each the CLI built alone by the line the car tests:
-
canopy-cli(#3634), inmain's own pipeline after a merge, keeps it as the job's artifacts. It builds from the checkout with no cache, and keeps no binary that needs a shared library: the file is statically linked, so it runs on a pipeline image of another distribution. GitLab deletes a build a week after its job, and keeps the newest successful one onmainwhatever its age (the project's keep-latest-artifacts setting). -
release(#3435), on a tag, uploads it to the project's package registry ascanopy-cli/<version>/canopy-x86_64-unknown-linux-musl: the binary the job ships in the service image at/app/canopy, uploaded only after the images are tagged. It does not expire. A package protection rule on the project refuses an upload ofcanopy-clifrom a pipeline started by a member below Maintainer (#3635).
A merge request's build is never offered: neither job runs on a merge-request pipeline or a train car, and lanes.rs tests hold both to that.
Not every commit of main has a build. When two merges land within seconds of each other, GitLab cancels the earlier pipeline before its jobs start; the later one, which contains it, builds, since the job runs on every merge, a docs-only one included. Jurisdiction onboarding shows both downloads.
Offline commands
canopy completion and canopy config check open no session: they read no profile, need no login, reach no network and no database, and write nothing under the configuration directory (dispatch in tools/canopy-cli/src/main.rs runs them before Session::open). ADR-007 Amendment 5 admits such file checks to the CLI and keeps database and key-material jobs out of it.
canopy config check <PACK_DIR> --federal <FEDERAL_DIR> runs canopy's pack checks on a working copy of a jurisdiction's configuration repository, over a copy of the federal layer. The checks are canopy-pack-check's (Shared Crates Reference), the ones the car runs on a pinned pack:
-
every top-level
*.jsondecision of the pack compiles through zen-engine and is named after its file; -
a pack decision that replaces a federal one is listed under
overridesin the pack'scanopy-config.toml, the rule canopy-rules applies at boot; -
each fixture in the pack's own
fixtures/rulesets/, when it has that directory, is replayed against the decision the stack evaluates: the pack's copy of the name, else the federal one; -
jurisdiction.tomlrestates no constant federal law fixes, every key of it is cited incitations.toml, and its two names for each SNAP processing clock agree; -
the Medicaid and CHIP class catalogue (
[[medicaid.classes]]) loads, and every class the pack's cascade order, hierarchy and[medicaid.cooperation]lists name is a declared row (#3420).
The first line of the output names both directories and, when the federal directory is the root of a git checkout, the commit it has checked out, read from .git/HEAD and the ref it names without running git; any other directory (a linked worktree, or the tree cargo xtask config fetch publishes) reads commit unknown. The line also says that both are read as plain directories with no signature verified, and that a clean check is not a boot proof: a service's parameter loader can still refuse the pack (#3404), and the car of the commit config-sources.lock pins is the gate.
Every finding is printed, as its check and file with the message below; the run does not stop at the first. A note is something that fails nothing: a pack with no fixture directory, a fixture marked ignore, naming no decision, or listing packs that leave out this jurisdiction, a citation verified more than --max-staleness-days ago (default 365). --format json prints one document on stdout, {notice, pack, federal, federal_commit, findings: [{check, file, message}], notes: [{file, message}]}, and the notice on stderr as well.
| Exit status | Meaning |
|---|---|
0 |
No finding. |
1 |
At least one finding. |
2 |
Nothing was checked, and stderr says why: a directory cannot be read or has no |
Every other command still exits 1 on any error.
Access
Every call bears a canopy-cli delegation token minted from the worker’s session, so a route admits
it on the worker’s roles, through the admission its handler checks (principal.admit(&ADMISSION)?;
ADR-049 Amendment 15; every route’s
admission in Fleet authorization inventory). canopy-cli holds a delegation edge to each service
these tables call (CANOPY_CLI in crates/canopy-auth/src/identity_policy/call_graph.rs). The last
column of every table names the route’s admission and the roles it admits canopy-cli’s worker with:
-
An upper-case route name (
PERSONS_POST_PERSONS) is a delegated-route row incrates/canopy-auth/src/delegated.rs(cargo xtask delegated-routeslists them all). -
Any other name is a constant in the handler’s service, and a
user_roles(…)cell an admission written inline in the handler (table below). -
"via canopy-cli" means the admission’s via arm (
user_roles_via) lists canopy-cli; "any actor" means a user arm (user_roles) that admits the roles through any client. The role bars arecrates/canopy-auth/src/roles.rs's.
| Admission | Service | Defined in |
|---|---|---|
|
canopy-persons |
|
|
canopy-applications |
|
|
canopy-eligibility |
|
|
canopy-eligibility |
|
|
canopy-notices |
inline, |
|
canopy-renewals |
|
|
canopy-appeals |
|
|
canopy-reporting |
|
|
canopy-snap |
|
|
canopy-snap, canopy-tanf, canopy-medicaid, canopy-caps, canopy-wic |
inline, |
|
canopy-security |
|
A worker holding none of the roles is refused 403 required_role_missing. The nine data_steward
redactions (person redact-ssn, income/asset/expense redact, the five determination redact)
need the session of a worker holding data_steward (devstack user data.steward). A delegated call
records the session’s worker as its actor (Principal::actor). canopy-persons takes a delegated claim’s or close’s author from
the bearer, whatever --author-sub names (claim_author, close_author,
services/canopy-persons/src/api/authors.rs), so the flag does not change the recorded author.
Command tables
One table per top-level command, rows in canopy <group> --help order; determine sits with
eligibility (its alias), completion with login / logout / token, config after them, and the four program services share
one table because they share one ProgramAction enum. The first cell of every row is the full
command path in backticks — the marker tools/canopy-cli/tests/cli_reference_drift_test.rs
reads to compare this page with the clap tree in both directions. [brackets] mark optional
flags, <ID> a positional argument; the global --format / --profile are omitted. Endpoints
are spelled as the command builds them; the service is the profile URL in the heading.
login, logout, token, completion — canopy-identity (identity_issuer) and local
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
— |
|
any worker canopy-web admits, approving with a fresh sign-in |
|
— |
|
the profile’s session |
|
|
|
the profile’s session; a service canopy-cli has an edge to |
|
|
none |
— |
config — local files, offline
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
|
none: reads the two directories (Offline commands) |
— (no session) |
person — canopy-persons (persons_url)
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
household — canopy-persons (persons_url)
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
income — canopy-persons (persons_url)
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
asset — canopy-persons (persons_url)
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
expense — canopy-persons (persons_url)
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
address — canopy-persons (persons_url)
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
|
|
|
|
|
|
|
rules — canopy-rules (rules_url)
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
— |
|
|
|
|
|
|
|
|
|
|
application — canopy-applications (applications_url)
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interview — canopy-applications (applications_url)
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
|
|
|
|
|
|
|
eligibility, determine — canopy-eligibility (eligibility_url)
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
as |
|
|
Held determinations (#3065). The eligibility held commands are the shell form of the held-determination runbook, which says how to decide each disposition and what each refusal code means. Each needs the session of a determination operator: eligibility_specialist, supervisor or admin (DETERMINATION_OPERATOR_ROLES). The ids parse as UUIDs and --program as a program slug, so a malformed one is refused before anything is sent. --note is the 1 to 500 characters the ledger row records.
canopy --profile devstack eligibility held list --program snap # canopy-snap's holds past its warning age, oldest first
canopy --profile devstack eligibility held list --program snap --after "$NEXT" # the next page: the cursor the previous page printed
canopy --profile devstack eligibility held adopt "$OPERATION_ID" --note "dispatch timed out; the signed verdict stands"
canopy --profile devstack eligibility held drop "$DETERMINATION_ID" --program chip --note "direct caller, never recorded; case re-determined"
-
listprints one row per hold under--format table:determination_id,program,operation_id(empty for a direct caller's hold),held_sinceto the second,held_rowsanddisposition. The last line isnext: <cursor>, the next page's--after, ornext: (last page)(held_table,tools/canopy-cli/src/cmd/eligibility.rs). -
adopttakes theoperation_ida held item reports and prints one row per adopted determination's ledger row (adopted_table). -
droptakes the item's ownprogram:chip, notmedicaid, for a CHIP hold, or the drop is 409not_held. It prints the ledger row.
Quarantined envelopes (#2061, #3117). The eligibility quarantine commands are the shell form of canopy-web's quarantine worklist: a signed envelope canopy-eligibility quarantined instead of recording, which an operator reverifies or dismisses. Each needs a determination operator's session, as the held commands do. The envelope id and --household-id parse as UUIDs, --program as a program slug and --action as reverify or dismiss, so a malformed one is refused before anything is sent; --after-received-at and --after-id are refused one without the other. The household count, GET /v1/eligibility/households/{household_id}/quarantined-determinations/count, is served to canopy-web's delegation of a case reader only (#2321), so it has no command.
canopy --profile devstack eligibility quarantine list --program snap --program tanf # open interactive envelopes, oldest first
canopy --profile devstack eligibility quarantine list --household-id "$HOUSEHOLD_ID" --after-received-at "$AFTER_RECEIVED_AT" --after-id "$AFTER_ID" # one household, the next page
canopy --profile devstack eligibility quarantine get "$QUARANTINED_ID"
canopy --profile devstack eligibility quarantine resolve "$QUARANTINED_ID" --action reverify --note "signing key restored"
canopy --profile devstack eligibility quarantine resolve "$QUARANTINED_ID" --action dismiss --note "duplicate of a recorded determination"
-
listprints one row per envelope under--format table:id,program,household_id,person_idandclaimed_status(each empty when the signed bytes claim none),quarantine_reason,received_atto the second andresolution_count. The last line isnext:with the next page's--after-received-atand--after-id, the instant at full precision, ornext: (last page)(quarantine_page_table,tools/canopy-cli/src/cmd/eligibility.rs). -
getprints the envelope's fields askey: valuelines, an absent claim as(none), then its newest 20 resolutions:revision,action,reason_before,reason_after,determination_id,actorandcreated_at(view_table). The notes are in--format json. -
resolveprints the ledger row in the same columns (resolved_table). A reverify that verified and bound leavesreason_afterempty and names the promoteddetermination_id. One that did not keeps a reason and leaves the envelope open. A repeated reverify of a reverified envelope answers its earlier row, writing nothing. Each refusal code is in the eligibility API page.
document — canopy-notices (notices_url)
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
|
|
|
Exported files are owner-only (#2890). document render and the report CSV exports write PII: applicant documents and federal-report extracts holding SSNs, names and benefit data. Each --output file is created owner-only on Unix: 0600, set when the file is created, or narrower under a stricter umask, never wider (canopy_common::owner_only::write_owner_only_file). The bytes go to a fresh sibling, .<name>.<pid>.<nanos>.tmp, which is renamed over the path:
-
a symbolic link already at the path is replaced, never written through;
-
an existing file is replaced by the owner-only one, never left wider;
-
the path must name a regular file’s place: a FIFO or a device link such as
/dev/stdoutis replaced or refused, never written into.
The directory’s mode is left as it is. A staged copy a crashed export left behind is removed by the next export of the same path once it is a minute old; no other file is touched. Off Unix the file takes the access-control list it inherits from its directory.
renewal — canopy-renewals (renewals_url)
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
— |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
appeal — canopy-appeals (appeals_url)
canopy-appeals' fair-hearing operator routes: no service calls them and canopy-web has no page for
them, so each admits canopy-cli’s operators by the route’s effect (ADR-049 Amendment 15; the constants in
services/canopy-appeals/src/api/mod.rs). Filing an appeal and recording the hearing decision are canopy-web’s.
--actor is the recording worker’s identity the route stores on the appeal; the timeline row records the
session’s worker.
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
— |
|
|
|
— |
|
|
ipv — canopy-appeals (appeals_url)
The IPV case operator routes, admitted as appeal's are (services/canopy-appeals/src/ipv/api.rs). canopy-cli has no
command for the referral, POST /v1/ipv/cases (WORKER_WRITE).
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
report — canopy-reporting (reporting_url)
Every route admits a supervisor or admin through any actor (SUPERVISORS,
services/canopy-reporting/src/api/mod.rs); canopy-web reads only the overpayment summary, so these commands are
the operators' path to the federal reports. A generation that enqueues a durable run answers 202 with the run’s
handle, polled with report runs get; ACF-196, the WPR and CMS-64 compute inline (201). --output writes an
export’s CSV body owner-only ([exported-files]); a page’s --after-* flags are the prior page’s next_cursor, each pair together or not at all.
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
|
|
|
|
— |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
— |
|
|
|
|
|
|
|
— |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
— |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
verification — canopy-snap (snap_url) and canopy-persons (persons_url)
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
|
|
|
|
|
|
canopy-snap’s |
|
|
|
|
snap — canopy-snap (snap_url)
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tanf, medicaid, caps, wic — the program services (<program>_url)
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
security — canopy-security (security_url)
| Subcommand | Key flags | Endpoint | Access |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
— |
|
|
|
— |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|