MCPcopy Create free account
hub / github.com/compozy/agh / newVaultListCommand

Function newVaultListCommand

internal/cli/vault.go:46–78  ·  view source on GitHub ↗
(deps commandDeps)

Source from the content-addressed store, hash-verified

44}
45
46func newVaultListCommand(deps commandDeps) *cobra.Command {
47 var prefix string
48 var namespace string
49
50 cmd := &cobra.Command{
51 Use: vaultListKey,
52 Short: "List redacted vault secret metadata",
53 Example: ` # List session-scoped vault entries
54 agh vault list --prefix vault:sessions/sess_123/
55
56 # List all provider vault entries as JSON
57 agh vault list --namespace providers -o json`,
58 Args: cobra.NoArgs,
59 RunE: func(cmd *cobra.Command, _ []string) error {
60 client, err := clientFromDeps(deps)
61 if err != nil {
62 return err
63 }
64
65 items, err := client.ListVaultSecrets(cmd.Context(), VaultListQuery{
66 Prefix: strings.TrimSpace(prefix),
67 Namespace: strings.TrimSpace(namespace),
68 })
69 if err != nil {
70 return err
71 }
72 return writeVaultRecordsOutput(cmd, items, deps.now)
73 },
74 }
75 cmd.Flags().StringVar(&prefix, "prefix", "", "Vault ref prefix, for example vault:sessions/<session_id>/")
76 cmd.Flags().StringVar(&namespace, "namespace", "", "Vault namespace filter")
77 return cmd
78}
79
80func newVaultGetCommand(deps commandDeps) *cobra.Command {
81 return &cobra.Command{

Callers 1

newVaultCommandFunction · 0.85

Calls 3

clientFromDepsFunction · 0.85
writeVaultRecordsOutputFunction · 0.85
ListVaultSecretsMethod · 0.65

Tested by

no test coverage detected