From cd0740c75f3b05e18a217a8cbb8427a8561741e0 Mon Sep 17 00:00:00 2001 From: thibaud-lclr Date: Mon, 11 May 2026 11:37:35 +0200 Subject: [PATCH] feat: default login handler in bootstrap When Hooks.Login is nil, Run() now handles the login command directly using LoginBitwarden with BinaryName as the service name, removing the need for glue code in each consumer binary. Co-Authored-By: Claude Sonnet 4.6 --- bootstrap/bootstrap.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bootstrap/bootstrap.go b/bootstrap/bootstrap.go index 13fdd57..2ee682f 100644 --- a/bootstrap/bootstrap.go +++ b/bootstrap/bootstrap.go @@ -8,6 +8,8 @@ import ( "os" "sort" "strings" + + "forge.lclr.dev/AI/mcp-framework/secretstore" ) const ( @@ -154,14 +156,24 @@ func Run(ctx context.Context, opts Options) error { } if handler == nil { - if command == CommandVersion { + switch command { + case CommandVersion: if strings.TrimSpace(normalized.Version) == "" { return ErrVersionRequired } _, err := fmt.Fprintln(normalized.Stdout, normalized.Version) return err + case CommandLogin: + _, err := secretstore.LoginBitwarden(secretstore.BitwardenLoginOptions{ + ServiceName: normalized.BinaryName, + Stdin: normalized.Stdin, + Stdout: normalized.Stdout, + Stderr: normalized.Stderr, + }) + return err + default: + return fmt.Errorf("%w: %s", ErrCommandNotConfigured, command) } - return fmt.Errorf("%w: %s", ErrCommandNotConfigured, command) } return handler(ctx, Invocation{