92 lines
2.9 KiB
Go
92 lines
2.9 KiB
Go
|
|
// Code generated by mcp-framework generate. DO NOT EDIT.
|
||
|
|
|
||
|
|
package mcpgen
|
||
|
|
|
||
|
|
import (
|
||
|
|
"os"
|
||
|
|
"path/filepath"
|
||
|
|
"strings"
|
||
|
|
|
||
|
|
fwsecretstore "forge.lclr.dev/AI/mcp-framework/secretstore"
|
||
|
|
)
|
||
|
|
|
||
|
|
type SecretStoreOptions struct {
|
||
|
|
ServiceName string
|
||
|
|
LookupEnv func(string) (string, bool)
|
||
|
|
KWalletAppID string
|
||
|
|
KWalletFolder string
|
||
|
|
BitwardenCommand string
|
||
|
|
BitwardenDebug bool
|
||
|
|
DisableBitwardenCache bool
|
||
|
|
Shell string
|
||
|
|
ExecutableResolver fwsecretstore.ExecutableResolver
|
||
|
|
}
|
||
|
|
|
||
|
|
func OpenSecretStore(options SecretStoreOptions) (fwsecretstore.Store, error) {
|
||
|
|
return fwsecretstore.OpenFromManifest(secretStoreOpenOptions(options))
|
||
|
|
}
|
||
|
|
|
||
|
|
func DescribeSecretRuntime(options SecretStoreOptions) (fwsecretstore.RuntimeDescription, error) {
|
||
|
|
return fwsecretstore.DescribeRuntime(secretStoreDescribeOptions(options))
|
||
|
|
}
|
||
|
|
|
||
|
|
func PreflightSecretStore(options SecretStoreOptions) (fwsecretstore.PreflightReport, error) {
|
||
|
|
return fwsecretstore.PreflightFromManifest(secretStoreDescribeOptions(options))
|
||
|
|
}
|
||
|
|
|
||
|
|
func secretStoreOpenOptions(options SecretStoreOptions) fwsecretstore.OpenFromManifestOptions {
|
||
|
|
return fwsecretstore.OpenFromManifestOptions{
|
||
|
|
ServiceName: secretStoreServiceName(options),
|
||
|
|
LookupEnv: options.LookupEnv,
|
||
|
|
KWalletAppID: options.KWalletAppID,
|
||
|
|
KWalletFolder: options.KWalletFolder,
|
||
|
|
BitwardenCommand: options.BitwardenCommand,
|
||
|
|
BitwardenDebug: options.BitwardenDebug,
|
||
|
|
DisableBitwardenCache: options.DisableBitwardenCache,
|
||
|
|
Shell: options.Shell,
|
||
|
|
ManifestLoader: LoadManifest,
|
||
|
|
ExecutableResolver: options.ExecutableResolver,
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func secretStoreDescribeOptions(options SecretStoreOptions) fwsecretstore.DescribeRuntimeOptions {
|
||
|
|
return fwsecretstore.DescribeRuntimeOptions{
|
||
|
|
ServiceName: secretStoreServiceName(options),
|
||
|
|
LookupEnv: options.LookupEnv,
|
||
|
|
KWalletAppID: options.KWalletAppID,
|
||
|
|
KWalletFolder: options.KWalletFolder,
|
||
|
|
BitwardenCommand: options.BitwardenCommand,
|
||
|
|
BitwardenDebug: options.BitwardenDebug,
|
||
|
|
DisableBitwardenCache: options.DisableBitwardenCache,
|
||
|
|
Shell: options.Shell,
|
||
|
|
ManifestLoader: LoadManifest,
|
||
|
|
ExecutableResolver: options.ExecutableResolver,
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func secretStoreServiceName(options SecretStoreOptions) string {
|
||
|
|
serviceName := strings.TrimSpace(options.ServiceName)
|
||
|
|
if serviceName != "" {
|
||
|
|
return serviceName
|
||
|
|
}
|
||
|
|
|
||
|
|
startDir := "."
|
||
|
|
executableResolver := options.ExecutableResolver
|
||
|
|
if executableResolver == nil {
|
||
|
|
executableResolver = os.Executable
|
||
|
|
}
|
||
|
|
if executablePath, err := executableResolver(); err == nil {
|
||
|
|
if dir := strings.TrimSpace(filepath.Dir(strings.TrimSpace(executablePath))); dir != "" {
|
||
|
|
startDir = dir
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
if manifestFile, _, err := LoadManifest(startDir); err == nil {
|
||
|
|
if binaryName := strings.TrimSpace(manifestFile.BinaryName); binaryName != "" {
|
||
|
|
return binaryName
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
return BinaryName
|
||
|
|
}
|