From 6dae4902575f6bca5ce015c6300e8428a1d22396 Mon Sep 17 00:00:00 2001 From: orion Date: Thu, 16 Apr 2026 21:11:00 +0000 Subject: [PATCH] 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 --- internal/commands/config.go | 2 +- internal/help/leaf.go | 6 +++--- internal/mode/mode.go | 6 +++--- internal/passmgr/passmgr.go | 24 ++++++++++++------------ 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/internal/commands/config.go b/internal/commands/config.go index 54a895a..d43cd27 100644 --- a/internal/commands/config.go +++ b/internal/commands/config.go @@ -20,7 +20,7 @@ func RunConfigURL(url string) { 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) { if token == "" { output.Error("usage: hf config --acc-mgr-token ") diff --git a/internal/help/leaf.go b/internal/help/leaf.go index 8eba619..aacb544 100644 --- a/internal/help/leaf.go +++ b/internal/help/leaf.go @@ -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."}, }, "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 "}, - 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": { Summary: "Create a user account", @@ -105,7 +105,7 @@ func leafHelpSpec(group, cmd string) (leafHelp, bool) { Flags: accountManagerFlagHelp(), Notes: []string{ "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()}, diff --git a/internal/mode/mode.go b/internal/mode/mode.go index 3c52c1f..c6271b1 100644 --- a/internal/mode/mode.go +++ b/internal/mode/mode.go @@ -12,7 +12,7 @@ type RuntimeMode int const ( // ManualMode requires explicit --token / --acc-mgr-token flags. ManualMode RuntimeMode = iota - // PaddedCellMode resolves secrets via pass_mgr automatically. + // PaddedCellMode resolves secrets via secret-mgr automatically. PaddedCellMode ) @@ -21,11 +21,11 @@ var ( 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. func Detect() RuntimeMode { detectOnce.Do(func() { - _, err := exec.LookPath("pass_mgr") + _, err := exec.LookPath("secret-mgr") if err == nil { detectedMode = PaddedCellMode } else { diff --git a/internal/passmgr/passmgr.go b/internal/passmgr/passmgr.go index df1c6eb..525522a 100644 --- a/internal/passmgr/passmgr.go +++ b/internal/passmgr/passmgr.go @@ -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 import ( @@ -7,49 +7,49 @@ import ( "strings" ) -// GetSecret calls: pass_mgr get-secret [--public] --key +// GetSecret calls: secret-mgr get-secret [--public] --key func GetSecret(key string, public bool) (string, error) { args := []string{"get-secret"} if public { args = append(args, "--public") } args = append(args, "--key", key) - out, err := exec.Command("pass_mgr", args...).Output() + out, err := exec.Command("secret-mgr", args...).Output() 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 } -// SetSecret calls: pass_mgr set [--public] --key --secret +// SetSecret calls: secret-mgr set [--public] --key --secret func SetSecret(key, secret string, public bool) error { args := []string{"set"} if public { args = append(args, "--public") } args = append(args, "--key", key, "--secret", secret) - if err := exec.Command("pass_mgr", args...).Run(); err != nil { - return fmt.Errorf("pass_mgr set --key %s failed: %w", key, err) + if err := exec.Command("secret-mgr", args...).Run(); err != nil { + return fmt.Errorf("secret-mgr set --key %s failed: %w", key, err) } return nil } -// GeneratePassword calls: pass_mgr generate --key --username +// GeneratePassword calls: secret-mgr generate --key --username func GeneratePassword(key, username string) (string, error) { 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 { - return "", fmt.Errorf("pass_mgr generate failed: %w", err) + return "", fmt.Errorf("secret-mgr generate failed: %w", err) } 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) { 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) { return GetSecret("hf-acc-mgr-token", true) }