Suggest this machine's hostname as the token label #20

Merged
geusebio merged 1 commit from feature/api-token-suggested-label into main 2026-08-09 00:51:06 +00:00
Owner

sc login linked to a blank create-token form, so the label — the one field that
answers "which box is this?" when someone comes to revoke a token — was left for
the user to invent.

The link now carries ?label=<short hostname> (sc):

$ sc login --endpoint http://127.0.0.1:7754 --no-browser
Create an API token at:

    http://127.0.0.1:7754/settings/api-tokens?label=cargo-cult+%28sc%29

The platform prefills its label field from that parameter — the other half of
this change, in the platform repo, which also carries the docs and the
screenshot. This PR has to land first; the pin bump there follows.

  • The CLI is the only side that can know the answer, and it is still only a
    suggestion: the field is editable and nothing is minted until the form is
    submitted.
  • The domain is dropped (laptop, not laptop.lan.example.com) — it says
    nothing about which machine this is.
  • localhost, or no hostname at all, suggests nothing rather than proposing a
    name every box would share.

Verified

  • GOWORK=off go test ./... — all packages pass, including two new cases in
    internal/cli: the URL the page is opened at, and labelForHost over the
    hostname shapes above.
  • Built and run against a local platform stack — the output above is the real
    thing, and the form it opens arrives filled in.

Note for whoever runs this in the platform checkout: go vet ./internal/upload/
fails there under go.work on undefined: client.APIErrorFrom, because the
platform repo pins scclient one commit behind main. That predates this
branch and is a pin bump in the platform repo, not a change here — GOWORK=off
(the vendored scclient) builds and tests clean.

`sc login` linked to a blank create-token form, so the label — the one field that answers "which box is this?" when someone comes to revoke a token — was left for the user to invent. The link now carries `?label=<short hostname> (sc)`: ``` $ sc login --endpoint http://127.0.0.1:7754 --no-browser Create an API token at: http://127.0.0.1:7754/settings/api-tokens?label=cargo-cult+%28sc%29 ``` The platform prefills its label field from that parameter — the other half of this change, in the platform repo, which also carries the docs and the screenshot. This PR has to land first; the pin bump there follows. - The CLI is the only side that can know the answer, and it is still only a suggestion: the field is editable and nothing is minted until the form is submitted. - The domain is dropped (`laptop`, not `laptop.lan.example.com`) — it says nothing about which machine this is. - `localhost`, or no hostname at all, suggests nothing rather than proposing a name every box would share. ## Verified - `GOWORK=off go test ./...` — all packages pass, including two new cases in `internal/cli`: the URL the page is opened at, and `labelForHost` over the hostname shapes above. - Built and run against a local platform stack — the output above is the real thing, and the form it opens arrives filled in. Note for whoever runs this in the platform checkout: `go vet ./internal/upload/` fails there under `go.work` on `undefined: client.APIErrorFrom`, because the platform repo pins `scclient` one commit behind `main`. That predates this branch and is a pin bump in the platform repo, not a change here — `GOWORK=off` (the vendored `scclient`) builds and tests clean.
Suggest this machine's hostname as the token label
All checks were successful
CI / build (pull_request) Successful in 1m51s
e4ee6693a6
`sc login` linked to a blank create-token form, so the label — the one field
that answers "which box is this?" when someone comes to revoke a token — was
left for the user to invent. Half of them end up called "token" or "sc".

The link now carries `?label=<short hostname> (sc)`, which the platform
prefills the field with. The CLI is the only side that can know the answer, and
it is still only a suggestion: the field is editable and nothing is minted
until the form is submitted.

The domain is dropped (`laptop`, not `laptop.lan.example.com`) because it says
nothing about which machine this is, and a hostname of `localhost` or none at
all suggests nothing rather than proposing a name every box would share.
geusebio changed title from WIP: Suggest this machine's hostname as the token label to Suggest this machine's hostname as the token label 2026-08-09 00:49:27 +00:00
Sign in to join this conversation.
No reviewers
No labels
in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grey.ooo/someones.computer_agent!20
No description provided.