Merged
Conversation
vcheung-stripe
commented
Mar 25, 2026
af59fcc to
dd8cf03
Compare
dd8cf03 to
5573f4a
Compare
anjg-stripe
requested changes
Mar 27, 2026
0092a45 to
6186472
Compare
6186472 to
ad9663f
Compare
anjg-stripe
approved these changes
Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In this PR, if the user tries to run a plugin command without having installed the plugin, we'll prompt them to install it. This also handles plugins that are in private preview by ensuring they have access to it first. These hints are currently hardcoded here for speed; I don't want to make a network call every time the user enters an unknown command to check if there's a plugin named that.
This does mean that plugin authors will have to hardcode their hint, but that is the tradeoff for this speed. I think this is fine because the hint is a nicety that doesn't preclude a plugin from being used.
For example, to add a new hint:
// AddHintCommands registers a hint command for each known plugin that is not // present in installedPluginSet. func AddHintCommands(rootCmd *cobra.Command, cfg *config.Config, installedPluginSet map[string]bool) { if !installedPluginSet["apps"] { rootCmd.AddCommand( newPluginHintCmd(cfg, "apps", "This plugin lets you build and manage Stripe Apps.").Command, ) } if !installedPluginSet["generate"] { rootCmd.AddCommand( newPluginHintCmd(cfg, "generate", "The generate plugin creates skeleton files for you to get started.", withPrivatePreview()).Command, ) } if !installedPluginSet["projects"] { rootCmd.AddCommand( newPluginHintCmd(cfg, "projects", "The projects plugin helps you scaffold and manage Stripe integration projects.").Command, ) } +if !installedPluginSet["pay"] { + rootCmd.AddCommand( + newPluginHintCmd(cfg, "pay", "The pay plugin lets you pay for things from the command line.").Command, + ) + } }To remove the "private preview" behavior (not necessary because once the plugin is release publicly this logic is smart enough to see that, so maybe we even remove this option in the future):
// AddHintCommands registers a hint command for each known plugin that is not // present in installedPluginSet. func AddHintCommands(rootCmd *cobra.Command, cfg *config.Config, installedPluginSet map[string]bool) { if !installedPluginSet["apps"] { rootCmd.AddCommand( newPluginHintCmd(cfg, "apps", "This plugin lets you build and manage Stripe Apps.").Command, ) } if !installedPluginSet["generate"] { rootCmd.AddCommand( - newPluginHintCmd(cfg, "generate", "The generate plugin creates skeleton files for you to get started.", withPrivatePreview()).Command, + newPluginHintCmd(cfg, "generate", "The generate plugin creates skeleton files for you to get started.").Command, ) } if !installedPluginSet["projects"] { rootCmd.AddCommand( newPluginHintCmd(cfg, "projects", "The projects plugin helps you scaffold and manage Stripe integration projects.").Command, ) } }Testing
Not logged in:
Logged in but not flagged in:
Logged in and available to install:
Apps
Projects
More than one arg