feat: add user reset-apikey command

Adds `hf user reset-apikey <username>` to regenerate a user API key.
Requires user.manage permission. Returns the new key (shown once only).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-16 21:06:35 +00:00
parent cd22642472
commit 6252039fc5
4 changed files with 49 additions and 0 deletions

View File

@@ -341,6 +341,11 @@ func handleUserCommand(subCmd string, args []string) {
output.Error("usage: hf user delete <username>")
}
commands.RunUserDelete(filtered[0], tokenFlag)
case "reset-apikey":
if len(filtered) < 1 {
output.Error("usage: hf user reset-apikey <username>")
}
commands.RunUserResetAPIKey(filtered[0], tokenFlag)
default:
output.Errorf("hf user %s is not implemented yet", subCmd)
}