extensionsCommand provides the `cam extension(s)` group. Most subcommands are thin passthroughs to `gemini extensions ` since the Python implementation does the same. `browse` is a native implementation that queries geminicli.com/extensions.json so it works even when Gemini isn't installed.
()
| 18 | // queries geminicli.com/extensions.json so it works even when Gemini isn't |
| 19 | // installed. |
| 20 | func (a *App) extensionsCommand() *cobra.Command { |
| 21 | cmd := &cobra.Command{ |
| 22 | Use: "extension", |
| 23 | Aliases: []string{"extensions", "ext"}, |
| 24 | Short: "Manage AI assistant extensions (Gemini today)", |
| 25 | } |
| 26 | cmd.AddCommand(extensionBrowseCommand()) |
| 27 | for _, sub := range []struct { |
| 28 | name, short string |
| 29 | }{ |
| 30 | {"install", "Install an extension"}, |
| 31 | {"uninstall", "Uninstall an extension"}, |
| 32 | {"list", "List installed extensions"}, |
| 33 | {"update", "Update extensions"}, |
| 34 | {"disable", "Disable an extension"}, |
| 35 | {"enable", "Enable an extension"}, |
| 36 | {"link", "Link a local extension"}, |
| 37 | {"new", "Create a new extension"}, |
| 38 | {"validate", "Validate an extension"}, |
| 39 | {"settings", "Manage extension settings"}, |
| 40 | } { |
| 41 | sub := sub |
| 42 | cmd.AddCommand(&cobra.Command{ |
| 43 | Use: sub.name + " [args...]", |
| 44 | Short: sub.short, |
| 45 | DisableFlagParsing: true, |
| 46 | RunE: func(cmd *cobra.Command, args []string) error { |
| 47 | return passthroughGemini(append([]string{"extensions", sub.name}, args...)) |
| 48 | }, |
| 49 | }) |
| 50 | } |
| 51 | return cmd |
| 52 | } |
| 53 | |
| 54 | // extensionBrowseURL is the canonical extension catalog endpoint. Tests can |
| 55 | // override it via the CAM_EXTENSION_BROWSE_URL env var so they don't hit the |
no test coverage detected