refactor: rename pass_mgr to secret-mgr

The secret manager binary was renamed from pass_mgr to secret-mgr.
Update all references in CLI code, mode detection, and help text.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-16 21:11:00 +00:00
parent 53b5b88fc2
commit 6dae490257
4 changed files with 19 additions and 19 deletions

View File

@@ -20,7 +20,7 @@ func RunConfigURL(url string) {
fmt.Printf("base-url set to %s\n", url) fmt.Printf("base-url set to %s\n", url)
} }
// RunConfigAccMgrToken stores the account-manager token via pass_mgr. // RunConfigAccMgrToken stores the account-manager token via secret-mgr.
func RunConfigAccMgrToken(token string) { func RunConfigAccMgrToken(token string) {
if token == "" { if token == "" {
output.Error("usage: hf config --acc-mgr-token <token>") output.Error("usage: hf config --acc-mgr-token <token>")

View File

@@ -95,9 +95,9 @@ func leafHelpSpec(group, cmd string) (leafHelp, bool) {
Notes: []string{"Writes base-url into .hf-config.json next to the hf binary."}, Notes: []string{"Writes base-url into .hf-config.json next to the hf binary."},
}, },
"config/acc-mgr-token": { "config/acc-mgr-token": {
Summary: "Store the account-manager token via pass_mgr", Summary: "Store the account-manager token via secret-mgr",
Usage: []string{"hf config --acc-mgr-token <token>"}, Usage: []string{"hf config --acc-mgr-token <token>"},
Notes: []string{"Only available in padded-cell mode with pass_mgr installed."}, Notes: []string{"Only available in padded-cell mode with secret-mgr installed."},
}, },
"user/create": { "user/create": {
Summary: "Create a user account", Summary: "Create a user account",
@@ -105,7 +105,7 @@ func leafHelpSpec(group, cmd string) (leafHelp, bool) {
Flags: accountManagerFlagHelp(), Flags: accountManagerFlagHelp(),
Notes: []string{ Notes: []string{
"This command uses the account-manager token flow, not the normal user token flow.", "This command uses the account-manager token flow, not the normal user token flow.",
"In padded-cell mode, --acc-mgr-token is hidden and password generation can fall back to pass_mgr.", "In padded-cell mode, --acc-mgr-token is hidden and password generation can fall back to secret-mgr.",
}, },
}, },
"user/list": {Summary: "List users", Usage: []string{"hf user list"}, Flags: authFlagHelp()}, "user/list": {Summary: "List users", Usage: []string{"hf user list"}, Flags: authFlagHelp()},

View File

@@ -12,7 +12,7 @@ type RuntimeMode int
const ( const (
// ManualMode requires explicit --token / --acc-mgr-token flags. // ManualMode requires explicit --token / --acc-mgr-token flags.
ManualMode RuntimeMode = iota ManualMode RuntimeMode = iota
// PaddedCellMode resolves secrets via pass_mgr automatically. // PaddedCellMode resolves secrets via secret-mgr automatically.
PaddedCellMode PaddedCellMode
) )
@@ -21,11 +21,11 @@ var (
detectOnce sync.Once detectOnce sync.Once
) )
// Detect checks whether pass_mgr is available and returns the runtime mode. // Detect checks whether secret-mgr is available and returns the runtime mode.
// The result is cached after the first call. // The result is cached after the first call.
func Detect() RuntimeMode { func Detect() RuntimeMode {
detectOnce.Do(func() { detectOnce.Do(func() {
_, err := exec.LookPath("pass_mgr") _, err := exec.LookPath("secret-mgr")
if err == nil { if err == nil {
detectedMode = PaddedCellMode detectedMode = PaddedCellMode
} else { } else {

View File

@@ -1,4 +1,4 @@
// Package passmgr wraps calls to the pass_mgr binary for secret resolution. // Package passmgr wraps calls to the secret-mgr binary for secret resolution.
package passmgr package passmgr
import ( import (
@@ -7,49 +7,49 @@ import (
"strings" "strings"
) )
// GetSecret calls: pass_mgr get-secret [--public] --key <key> // GetSecret calls: secret-mgr get-secret [--public] --key <key>
func GetSecret(key string, public bool) (string, error) { func GetSecret(key string, public bool) (string, error) {
args := []string{"get-secret"} args := []string{"get-secret"}
if public { if public {
args = append(args, "--public") args = append(args, "--public")
} }
args = append(args, "--key", key) args = append(args, "--key", key)
out, err := exec.Command("pass_mgr", args...).Output() out, err := exec.Command("secret-mgr", args...).Output()
if err != nil { if err != nil {
return "", fmt.Errorf("pass_mgr get-secret --key %s failed: %w", key, err) return "", fmt.Errorf("secret-mgr get-secret --key %s failed: %w", key, err)
} }
return strings.TrimSpace(string(out)), nil return strings.TrimSpace(string(out)), nil
} }
// SetSecret calls: pass_mgr set [--public] --key <key> --secret <secret> // SetSecret calls: secret-mgr set [--public] --key <key> --secret <secret>
func SetSecret(key, secret string, public bool) error { func SetSecret(key, secret string, public bool) error {
args := []string{"set"} args := []string{"set"}
if public { if public {
args = append(args, "--public") args = append(args, "--public")
} }
args = append(args, "--key", key, "--secret", secret) args = append(args, "--key", key, "--secret", secret)
if err := exec.Command("pass_mgr", args...).Run(); err != nil { if err := exec.Command("secret-mgr", args...).Run(); err != nil {
return fmt.Errorf("pass_mgr set --key %s failed: %w", key, err) return fmt.Errorf("secret-mgr set --key %s failed: %w", key, err)
} }
return nil return nil
} }
// GeneratePassword calls: pass_mgr generate --key <key> --username <username> // GeneratePassword calls: secret-mgr generate --key <key> --username <username>
func GeneratePassword(key, username string) (string, error) { func GeneratePassword(key, username string) (string, error) {
args := []string{"generate", "--key", key, "--username", username} args := []string{"generate", "--key", key, "--username", username}
out, err := exec.Command("pass_mgr", args...).Output() out, err := exec.Command("secret-mgr", args...).Output()
if err != nil { if err != nil {
return "", fmt.Errorf("pass_mgr generate failed: %w", err) return "", fmt.Errorf("secret-mgr generate failed: %w", err)
} }
return strings.TrimSpace(string(out)), nil return strings.TrimSpace(string(out)), nil
} }
// GetToken retrieves the normal hf-token via pass_mgr. // GetToken retrieves the normal hf-token via secret-mgr.
func GetToken() (string, error) { func GetToken() (string, error) {
return GetSecret("hf-token", false) return GetSecret("hf-token", false)
} }
// GetAccountManagerToken retrieves the public hf-acc-mgr-token via pass_mgr. // GetAccountManagerToken retrieves the public hf-acc-mgr-token via secret-mgr.
func GetAccountManagerToken() (string, error) { func GetAccountManagerToken() (string, error) {
return GetSecret("hf-acc-mgr-token", true) return GetSecret("hf-acc-mgr-token", true)
} }