⚠️ Breaking Changes
#580 Replace urfave/cli with cobra
#583 Remove the -d option and GHTKN_ENABLE_DEVICE_FLOW
- Long flags require two dashes. -config, -log-level, -min-expiration, -device-flow and -continue-on-error are no longer accepted; write --config and so on. The single-character aliases -c, -m, -d, -p, -e and -f are unaffected. The documentation is updated to match.
- ghtkn completion pwsh is now ghtkn completion powershell. A completion script written to a file has to be regenerated after upgrading, for every shell.
- An unknown command exits 1 rather than 3. urfave raised that code itself; cobra attaches none, and its unknown-command error carries nothing to recognize it by.
- -e no longer splits its value on commas. urfave's slice flags did that, so -e A,B set two environment variables; that came from the flag library rather than from anything ghtkn meant to offer. Repeating -e is the supported way and is unchanged. A comma in the environment variable name is now an error that says so, rather than silently setting one variable named A,B.
Why did we migrate to cobra?
urfave/cli/v3 (v3.10.1) has two bugs that ghtkn runs into, and neither reproduces with cobra.
The first is that an argument spelled help is taken as a request for help. ghtkn get help printed the help of get instead of asking for the token of an app named help, so that name was simply unusable.
The second is urfave/cli#1993: with shell completion enabled, pressing TAB after a -- runs the command instead of completing. It was reported against v2 and is still open, and it still reproduces on v3.10.1 when an argument follows the --:
$ spike get -- foo
ACTION RAN: app="foo" args=[]
ghtkn exec -- sits exactly on that shape, so a TAB in the middle of writing an exec command line could run whatever was already typed. cobra completes through a separate hidden __complete command, which never reaches the action, so the failure mode does not exist there.
Remove the -d option and GHTKN_ENABLE_DEVICE_FLOW
#474 #583
The device flow is now started by ghtkn auth alone. ghtkn get, ghtkn exec, ghtkn git-credential, and the Go SDK serve the cached token and otherwise fail fast with an actionable error.
v0.3.0 disabled the automatic device flow by default but kept --device-flow (-d) and GHTKN_ENABLE_DEVICE_FLOW=true as a temporary opt-in. Both are removed here.
Why
These commands are often run indirectly, by a wrapper script, the Git credential helper, or a third-party tool built on the SDK. A device flow started that way is a phishing risk: the user is asked to approve one they never initiated. With ghtkn auth as the only entry point, a one-time code you are shown is always one you asked for.
Features
#572 shell completion: complete app names for 'get', 'auth', and 'revoke'
#586 Add a json-schema command outputting the configuration file's JSON Schema
ghtkn json-schema
Fixes
#571 Remove the no-op app name argument from 'ghtkn info'
Documentation
#570 Add a shell completion section to configuration
#579 Stop describing the Go SDK as creating tokens and lead with the config file
#587 Add description to JSON Schema
Fixes
#571 Remove the no-op app name argument from 'ghtkn info'
Documentation
#570 Add a shell completion section to configuration
#579 Stop describing the Go SDK as creating tokens and lead with the config file
#587 Add description to JSON Schema