A Go library that bootstraps Stripe CLI plugins. It handles the plugin lifecycle including RPC communication with the CLI host, command registration, telemetry, and signal handling.
package main
import (
"context"
"github.com/spf13/cobra"
"github.com/stripe/stripe-cli-go-plugin-bootstrap/v2/pkg/bootstrap"
"github.com/stripe/stripe-cli-go-plugin-bootstrap/v2/pkg/telemetry"
)
func main() {
rootCmd := &cobra.Command{
Use: "myplugin",
Short: "My Stripe CLI plugin",
}
bootstrap.StartPlugin(
&bootstrap.Config{
HandshakeKey: "myplugin",
HandshakeValue: "hello",
},
func(args []string, ctx context.Context) error {
rootCmd.SetArgs(args)
return rootCmd.ExecuteContext(ctx)
},
rootCmd,
telemetry.PluginInfo{
Name: "myplugin",
Version: "0.1.0",
},
)
}
WithTelemetry--api-key, --color, --config, etc.)-tags localdev to run the plugin standalone without the CLI hostExtractCommandTree exports your command structure for use in plugin manifestsgo get github.com/stripe/stripe-cli-go-plugin-bootstrap/v2
Apache 2.0 - See LICENSE for details.