feat(vault-tui): implement KV client and service for managing secrets

- Added internal/vault/client.go for creating a Vault client with configuration settings.
- Introduced internal/vault/errors.go to classify Vault API errors for better UI handling.
- Created internal/vault/kv.go to manage KV secrets, including listing, reading, writing, and deleting operations.
- Implemented internal/vault/mounts.go to list and describe secret engine mounts.
- Developed internal/vault/service.go to provide a unified entry point for Vault operations.
- Added internal/vault/kv_test.go for comprehensive testing of KV operations.
- Introduced internal/ui/toast.go for transient notifications in the UI.
- Added renovate.json for dependency management and updates.
This commit is contained in:
2026-08-14 11:09:03 +02:00
commit ae30ba1240
85 changed files with 9413 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
// Package ui is vault-tui's Bubbletea v2 terminal UI. It talks to Vault
// exclusively through internal/vault.Service and internal/auth.Method —
// never hashicorp/vault/api directly — which is what keeps this package
// swappable/testable independently of the headless CLI in internal/cli
// (which builds the very same Service/Method values from the same
// resolved config.Settings).
package ui
import (
"context"
"fmt"
tea "charm.land/bubbletea/v2"
"git.morlana.online/f.weber/vault-tui/internal/cli"
)
// Run launches the TUI. Wired into internal/cli's "ui" command (and its
// DefaultCommand) via cli.SetUIRunner in cmd/vault-tui/main.go, so that
// internal/cli itself never has to import a TUI toolkit.
func Run(ctx context.Context, a *cli.App) error {
m, err := newModel(ctx, a)
if err != nil {
return err
}
p := tea.NewProgram(m, tea.WithContext(ctx))
_, err = p.Run()
return err
}
func init() {
cli.SetUIRunner(func(ctx context.Context, a *cli.App) error {
if err := Run(ctx, a); err != nil {
return fmt.Errorf("ui: %w", err)
}
return nil
})
}