feat(core): mirror Plugin.kind + ListCategories proto regen

This commit is contained in:
Alex Dunmow 2026-06-03 01:44:26 +08:00
parent 08be22ec34
commit a79aa709c2
3 changed files with 426 additions and 165 deletions

View File

@ -63,6 +63,9 @@ const (
// PluginRegistryServiceResolveInstallProcedure is the fully-qualified name of the
// PluginRegistryService's ResolveInstall RPC.
PluginRegistryServiceResolveInstallProcedure = "/orchestrator.v1.PluginRegistryService/ResolveInstall"
// PluginRegistryServiceListCategoriesProcedure is the fully-qualified name of the
// PluginRegistryService's ListCategories RPC.
PluginRegistryServiceListCategoriesProcedure = "/orchestrator.v1.PluginRegistryService/ListCategories"
// PluginPublishServicePublishVersionProcedure is the fully-qualified name of the
// PluginPublishService's PublishVersion RPC.
PluginPublishServicePublishVersionProcedure = "/orchestrator.v1.PluginPublishService/PublishVersion"
@ -209,6 +212,7 @@ type PluginRegistryServiceClient interface {
ListPlugins(context.Context, *connect.Request[v1.ListPluginsRequest]) (*connect.Response[v1.ListPluginsResponse], error)
GetVersion(context.Context, *connect.Request[v1.GetVersionRequest]) (*connect.Response[v1.GetVersionResponse], error)
ResolveInstall(context.Context, *connect.Request[v1.ResolveInstallRequest]) (*connect.Response[v1.ResolveInstallResponse], error)
ListCategories(context.Context, *connect.Request[v1.ListCategoriesRequest]) (*connect.Response[v1.ListCategoriesResponse], error)
}
// NewPluginRegistryServiceClient constructs a client for the orchestrator.v1.PluginRegistryService
@ -252,6 +256,12 @@ func NewPluginRegistryServiceClient(httpClient connect.HTTPClient, baseURL strin
connect.WithSchema(pluginRegistryServiceMethods.ByName("ResolveInstall")),
connect.WithClientOptions(opts...),
),
listCategories: connect.NewClient[v1.ListCategoriesRequest, v1.ListCategoriesResponse](
httpClient,
baseURL+PluginRegistryServiceListCategoriesProcedure,
connect.WithSchema(pluginRegistryServiceMethods.ByName("ListCategories")),
connect.WithClientOptions(opts...),
),
}
}
@ -262,6 +272,7 @@ type pluginRegistryServiceClient struct {
listPlugins *connect.Client[v1.ListPluginsRequest, v1.ListPluginsResponse]
getVersion *connect.Client[v1.GetVersionRequest, v1.GetVersionResponse]
resolveInstall *connect.Client[v1.ResolveInstallRequest, v1.ResolveInstallResponse]
listCategories *connect.Client[v1.ListCategoriesRequest, v1.ListCategoriesResponse]
}
// CreatePlugin calls orchestrator.v1.PluginRegistryService.CreatePlugin.
@ -289,6 +300,11 @@ func (c *pluginRegistryServiceClient) ResolveInstall(ctx context.Context, req *c
return c.resolveInstall.CallUnary(ctx, req)
}
// ListCategories calls orchestrator.v1.PluginRegistryService.ListCategories.
func (c *pluginRegistryServiceClient) ListCategories(ctx context.Context, req *connect.Request[v1.ListCategoriesRequest]) (*connect.Response[v1.ListCategoriesResponse], error) {
return c.listCategories.CallUnary(ctx, req)
}
// PluginRegistryServiceHandler is an implementation of the orchestrator.v1.PluginRegistryService
// service.
type PluginRegistryServiceHandler interface {
@ -297,6 +313,7 @@ type PluginRegistryServiceHandler interface {
ListPlugins(context.Context, *connect.Request[v1.ListPluginsRequest]) (*connect.Response[v1.ListPluginsResponse], error)
GetVersion(context.Context, *connect.Request[v1.GetVersionRequest]) (*connect.Response[v1.GetVersionResponse], error)
ResolveInstall(context.Context, *connect.Request[v1.ResolveInstallRequest]) (*connect.Response[v1.ResolveInstallResponse], error)
ListCategories(context.Context, *connect.Request[v1.ListCategoriesRequest]) (*connect.Response[v1.ListCategoriesResponse], error)
}
// NewPluginRegistryServiceHandler builds an HTTP handler from the service implementation. It
@ -336,6 +353,12 @@ func NewPluginRegistryServiceHandler(svc PluginRegistryServiceHandler, opts ...c
connect.WithSchema(pluginRegistryServiceMethods.ByName("ResolveInstall")),
connect.WithHandlerOptions(opts...),
)
pluginRegistryServiceListCategoriesHandler := connect.NewUnaryHandler(
PluginRegistryServiceListCategoriesProcedure,
svc.ListCategories,
connect.WithSchema(pluginRegistryServiceMethods.ByName("ListCategories")),
connect.WithHandlerOptions(opts...),
)
return "/orchestrator.v1.PluginRegistryService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case PluginRegistryServiceCreatePluginProcedure:
@ -348,6 +371,8 @@ func NewPluginRegistryServiceHandler(svc PluginRegistryServiceHandler, opts ...c
pluginRegistryServiceGetVersionHandler.ServeHTTP(w, r)
case PluginRegistryServiceResolveInstallProcedure:
pluginRegistryServiceResolveInstallHandler.ServeHTTP(w, r)
case PluginRegistryServiceListCategoriesProcedure:
pluginRegistryServiceListCategoriesHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
@ -377,6 +402,10 @@ func (UnimplementedPluginRegistryServiceHandler) ResolveInstall(context.Context,
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("orchestrator.v1.PluginRegistryService.ResolveInstall is not implemented"))
}
func (UnimplementedPluginRegistryServiceHandler) ListCategories(context.Context, *connect.Request[v1.ListCategoriesRequest]) (*connect.Response[v1.ListCategoriesResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("orchestrator.v1.PluginRegistryService.ListCategories is not implemented"))
}
// PluginPublishServiceClient is a client for the orchestrator.v1.PluginPublishService service.
type PluginPublishServiceClient interface {
PublishVersion(context.Context, *connect.Request[v1.PublishVersionRequest]) (*connect.Response[v1.PublishVersionResponse], error)

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,7 @@ service PluginRegistryService {
rpc ListPlugins(ListPluginsRequest) returns (ListPluginsResponse);
rpc GetVersion(GetVersionRequest) returns (GetVersionResponse);
rpc ResolveInstall(ResolveInstallRequest) returns (ResolveInstallResponse);
rpc ListCategories(ListCategoriesRequest) returns (ListCategoriesResponse);
}
// PluginPublishService is called by the ninja CLI to publish a version.
@ -54,6 +55,14 @@ message Plugin {
string homepage_url = 7;
repeated string categories = 8;
google.protobuf.Timestamp updated_at = 9;
string kind = 10;
}
message Category {
string slug = 1;
string display_name = 2;
string description = 3;
int32 sort_order = 4;
}
message Version {
@ -88,6 +97,8 @@ message CreatePluginRequest {
string scope_slug = 1;
string name = 2;
string description = 3;
string kind = 4;
repeated string categories = 5;
}
message CreatePluginResponse {
Plugin plugin = 1;
@ -104,9 +115,14 @@ message ListPluginsRequest {
int32 limit = 1;
int32 offset = 2;
string query = 3;
string kind = 4;
repeated string categories = 5;
}
message ListPluginsResponse { repeated Plugin plugins = 1; }
message ListCategoriesRequest {}
message ListCategoriesResponse { repeated Category categories = 1; }
message GetVersionRequest {
string scope_slug = 1;
string plugin_name = 2;