@@ -29,6 +29,7 @@ var registryListCmd = &cobra.Command{
2929 RunE : func (cmd * cobra.Command , args []string ) error {
3030 client := clientFromCmd (cmd )
3131 rawJSON , _ := cmd .Flags ().GetBool ("json" )
32+ suppressWarnings , _ := cmd .Flags ().GetBool ("suppress-warnings" )
3233 query , _ := cmd .Flags ().GetString ("query" )
3334 source , _ := cmd .Flags ().GetString ("source" )
3435 entryType , _ := cmd .Flags ().GetString ("type" )
@@ -66,6 +67,9 @@ var registryListCmd = &cobra.Command{
6667 fmt .Sprint (entry ["version" ]),
6768 fmt .Sprint (entry ["source" ]),
6869 )
70+ if ! suppressWarnings {
71+ printRegistryWarnings (entry )
72+ }
6973 }
7074 return nil
7175 },
@@ -78,6 +82,7 @@ var registryVersionsCmd = &cobra.Command{
7882 RunE : func (cmd * cobra.Command , args []string ) error {
7983 client := clientFromCmd (cmd )
8084 rawJSON , _ := cmd .Flags ().GetBool ("json" )
85+ suppressWarnings , _ := cmd .Flags ().GetBool ("suppress-warnings" )
8186
8287 var resp []map [string ]any
8388 if err := client .Get ("/api/registry/" + args [0 ]+ "/versions" , & resp ); err != nil {
@@ -95,8 +100,54 @@ var registryVersionsCmd = &cobra.Command{
95100 tuioutput .Row (
96101 fmt .Sprint (version ["version" ]),
97102 fmt .Sprint (version ["min_synapse" ]),
103+ fmt .Sprint (version ["max_synapse" ]),
98104 fmt .Sprint (version ["artifact_url" ]),
99105 )
106+ if ! suppressWarnings {
107+ printVersionWarnings (version )
108+ }
109+ }
110+ return nil
111+ },
112+ }
113+
114+ var registryCompatibilityCmd = & cobra.Command {
115+ Use : "compatibility <pluginId>" ,
116+ Short : "Show compatibility details for a registry entry" ,
117+ Args : cobra .ExactArgs (1 ),
118+ RunE : func (cmd * cobra.Command , args []string ) error {
119+ client := clientFromCmd (cmd )
120+ rawJSON , _ := cmd .Flags ().GetBool ("json" )
121+ version , _ := cmd .Flags ().GetString ("version" )
122+
123+ path := "/api/registry/" + args [0 ] + "/compatibility"
124+ if version != "" {
125+ path += "?version=" + url .QueryEscape (version )
126+ }
127+
128+ var resp map [string ]any
129+ if err := client .Get (path , & resp ); err != nil {
130+ return err
131+ }
132+ if rawJSON {
133+ tuioutput .JSON (resp )
134+ return nil
135+ }
136+
137+ tuioutput .Header ("Registry Compatibility: " + args [0 ])
138+ tuioutput .KV ("Synapse" , fmt .Sprint (resp ["currentSynapseVersion" ]))
139+ tuioutput .KV ("Version" , fmt .Sprint (resp ["selectedVersion" ]))
140+ tuioutput .KV ("Compatible" , fmt .Sprint (resp ["compatible" ]))
141+ tuioutput .KV ("Min" , fmt .Sprint (resp ["minimumSynapseVersion" ]))
142+ tuioutput .KV ("Max" , fmt .Sprint (resp ["maximumSynapseVersion" ]))
143+ if resp ["deprecated" ] == true {
144+ tuioutput .Warning (fmt .Sprintf ("Deprecated since %v: %v" , resp ["deprecatedSince" ], resp ["deprecationReason" ]))
145+ if migrationURL := fmt .Sprint (resp ["migrationUrl" ]); migrationURL != "" && migrationURL != "<nil>" {
146+ tuioutput .KV ("Migration" , migrationURL )
147+ }
148+ }
149+ if resp ["updateAvailable" ] == true {
150+ tuioutput .Warning (fmt .Sprintf ("Recommended version: %v" , resp ["recommendedVersion" ]))
100151 }
101152 return nil
102153 },
@@ -293,6 +344,9 @@ func init() {
293344 registryListCmd .Flags ().String ("source" , "" , "Filter by source" )
294345 registryListCmd .Flags ().String ("type" , "" , "Filter by type" )
295346 registryListCmd .Flags ().Bool ("compatible" , false , "Only show entries compatible with this SYNAPSE version" )
347+ registryListCmd .Flags ().Bool ("suppress-warnings" , false , "Hide compatibility and deprecation warnings" )
348+ registryVersionsCmd .Flags ().Bool ("suppress-warnings" , false , "Hide compatibility and deprecation warnings" )
349+ registryCompatibilityCmd .Flags ().String ("version" , "" , "Specific plugin version to evaluate" )
296350
297351 registryAddSourceCmd .Flags ().String ("id" , "" , "Source ID (defaults to a slug from name)" )
298352 registryAddSourceCmd .Flags ().String ("name" , "" , "Source display name" )
@@ -310,6 +364,7 @@ func init() {
310364 registryCmd .AddCommand (
311365 registryListCmd ,
312366 registryVersionsCmd ,
367+ registryCompatibilityCmd ,
313368 registrySyncCmd ,
314369 registryStatusCmd ,
315370 registrySourcesCmd ,
@@ -320,3 +375,32 @@ func init() {
320375 commandfeatures .BindSubcommandListing (registryCmd )
321376 rootCmd .AddCommand (registryCmd )
322377}
378+
379+ func printRegistryWarnings (entry map [string ]any ) {
380+ meta , _ := entry ["meta" ].(map [string ]any )
381+ if meta == nil {
382+ return
383+ }
384+ if compatibility , ok := meta ["compatibility" ].(map [string ]any ); ok {
385+ if compatible , ok := compatibility ["compatible" ].(bool ); ok && ! compatible {
386+ tuioutput .Warning (fmt .Sprintf ("Incompatible with current SYNAPSE version: %v" , entry ["id" ]))
387+ } else if updateAvailable , ok := compatibility ["update_available" ].(bool ); ok && updateAvailable {
388+ tuioutput .Warning (fmt .Sprintf ("Update recommended: %v -> %v" , entry ["version" ], compatibility ["recommended_version" ]))
389+ }
390+ }
391+ if deprecated , ok := meta ["deprecated" ].(map [string ]any ); ok {
392+ tuioutput .Warning (fmt .Sprintf ("Deprecated since %v: %v" , deprecated ["since" ], deprecated ["reason" ]))
393+ }
394+ }
395+
396+ func printVersionWarnings (version map [string ]any ) {
397+ if compatible , ok := version ["compatible" ].(bool ); ok && ! compatible {
398+ tuioutput .Warning (fmt .Sprintf ("Incompatible version: %v" , version ["version" ]))
399+ }
400+ if deprecated , ok := version ["deprecated" ].(bool ); ok && deprecated {
401+ tuioutput .Warning (fmt .Sprintf ("Deprecated since %v: %v" , version ["deprecated_since" ], version ["deprecation_reason" ]))
402+ }
403+ if recommended , ok := version ["recommended" ].(bool ); ok && recommended {
404+ tuioutput .Warning (fmt .Sprintf ("Recommended version: %v" , version ["version" ]))
405+ }
406+ }
0 commit comments