diff --git a/cmd/lk/app.go b/cmd/lk/app.go index 2ffb427e..3a96f529 100644 --- a/cmd/lk/app.go +++ b/cmd/lk/app.go @@ -40,8 +40,8 @@ var ( project *config.ProjectConfig AppCommands = []*cli.Command{ { - Name: "app", - Category: "Core", + Name: "app", + Usage: "Initialize and manage applications", Commands: []*cli.Command{ { Name: "create", @@ -292,7 +292,10 @@ func setupTemplate(ctx context.Context, cmd *cli.Command) error { } fmt.Println("Instantiating environment...") - addlEnv := &map[string]string{"LIVEKIT_SANDBOX_ID": sandboxID} + addlEnv := &map[string]string{ + "LIVEKIT_SANDBOX_ID": sandboxID, + "NEXT_PUBLIC_LIVEKIT_SANDBOX_ID": sandboxID, + } env, err := instantiateEnv(ctx, cmd, appName, addlEnv) if err != nil { return err @@ -368,9 +371,10 @@ func manageEnv(ctx context.Context, cmd *cli.Command) error { func instantiateEnv(ctx context.Context, cmd *cli.Command, rootPath string, addlEnv *map[string]string) (map[string]string, error) { env := map[string]string{ - "LIVEKIT_API_KEY": project.APIKey, - "LIVEKIT_API_SECRET": project.APISecret, - "LIVEKIT_URL": project.URL, + "LIVEKIT_API_KEY": project.APIKey, + "LIVEKIT_API_SECRET": project.APISecret, + "LIVEKIT_URL": project.URL, + "NEXT_PUBLIC_LIVEKIT_URL": project.URL, } if addlEnv != nil { for k, v := range *addlEnv { diff --git a/cmd/lk/cloud.go b/cmd/lk/cloud.go index 26c56395..4760aefd 100644 --- a/cmd/lk/cloud.go +++ b/cmd/lk/cloud.go @@ -53,17 +53,16 @@ const ( ) var ( - revoke bool - timeout int64 = 60 * 15 - interval int64 = 4 - serverURL string = cloudAPIServerURL - dashboardURL string = cloudDashboardURL - authClient AuthClient - AuthCommands = []*cli.Command{ + revoke bool + timeout int64 = 60 * 15 + interval int64 = 4 + serverURL string = cloudAPIServerURL + dashboardURL string = cloudDashboardURL + authClient AuthClient + CloudCommands = []*cli.Command{ { - Name: "cloud", - Usage: "Interacting with LiveKit Cloud", - Category: "Cloud", + Name: "cloud", + Usage: "Interact with LiveKit Cloud services", Commands: []*cli.Command{ { Name: "auth", diff --git a/cmd/lk/dispatch.go b/cmd/lk/dispatch.go index 11a4a48e..1bbcda23 100644 --- a/cmd/lk/dispatch.go +++ b/cmd/lk/dispatch.go @@ -15,10 +15,8 @@ import ( var ( DispatchCommands = []*cli.Command{ { - Name: "dispatch", - Usage: "Create, list, and delete agent dispatches", - Category: "Agent", - + Name: "dispatch", + Usage: "Create, list, and delete agent dispatches", Commands: []*cli.Command{ { Name: "list", diff --git a/cmd/lk/egress.go b/cmd/lk/egress.go index 901e86b0..53d87cc5 100644 --- a/cmd/lk/egress.go +++ b/cmd/lk/egress.go @@ -69,9 +69,8 @@ See cmd/livekit-cli/examples` var ( EgressCommands = []*cli.Command{ { - Name: "egress", - Usage: "Record or stream media from LiveKit to elsewhere", - Category: "I/O", + Name: "egress", + Usage: "Record or stream media from LiveKit to elsewhere", Commands: []*cli.Command{ { Name: "start", diff --git a/cmd/lk/ingress.go b/cmd/lk/ingress.go index af157439..5dfa961c 100644 --- a/cmd/lk/ingress.go +++ b/cmd/lk/ingress.go @@ -24,14 +24,11 @@ import ( lksdk "github.com/livekit/server-sdk-go/v2" ) -const ingressCategory = "Ingress" - var ( IngressCommands = []*cli.Command{ { - Name: "ingress", - Usage: "Import outside media sources into a LiveKit room", - Category: "I/O", + Name: "ingress", + Usage: "Import outside media sources into a LiveKit room", Commands: []*cli.Command{ { Name: "create", @@ -98,12 +95,11 @@ var ( // Deprecated commands kept for compatibility { - Hidden: true, // deprecated: use `ingress create` - Name: "create-ingress", - Usage: "Create an ingress", - Before: createIngressClient, - Action: createIngress, - Category: ingressCategory, + Hidden: true, // deprecated: use `ingress create` + Name: "create-ingress", + Usage: "Create an ingress", + Before: createIngressClient, + Action: createIngress, Flags: []cli.Flag{ &cli.StringFlag{ Name: "request", @@ -113,12 +109,11 @@ var ( }, }, { - Hidden: true, // deprecated: use `ingress update` - Name: "update-ingress", - Usage: "Update an ingress", - Before: createIngressClient, - Action: updateIngress, - Category: ingressCategory, + Hidden: true, // deprecated: use `ingress update` + Name: "update-ingress", + Usage: "Update an ingress", + Before: createIngressClient, + Action: updateIngress, Flags: []cli.Flag{ &cli.StringFlag{ Name: "request", @@ -128,12 +123,11 @@ var ( }, }, { - Hidden: true, // deprecated: use `ingress list` - Name: "list-ingress", - Usage: "List all active ingress", - Before: createIngressClient, - Action: listIngress, - Category: ingressCategory, + Hidden: true, // deprecated: use `ingress list` + Name: "list-ingress", + Usage: "List all active ingress", + Before: createIngressClient, + Action: listIngress, Flags: []cli.Flag{ &cli.StringFlag{ Name: "room", @@ -148,12 +142,11 @@ var ( }, }, { - Hidden: true, // deprecated: use `ingress delete` - Name: "delete-ingress", - Usage: "Delete ingress", - Before: createIngressClient, - Action: deleteIngress, - Category: ingressCategory, + Hidden: true, // deprecated: use `ingress delete` + Name: "delete-ingress", + Usage: "Delete ingress", + Before: createIngressClient, + Action: deleteIngress, Flags: []cli.Flag{ &cli.StringFlag{ Name: "id", diff --git a/cmd/lk/join.go b/cmd/lk/join.go index 69eb0c9e..c4ce0fdf 100644 --- a/cmd/lk/join.go +++ b/cmd/lk/join.go @@ -40,11 +40,10 @@ import ( var ( JoinCommands = []*cli.Command{ { - Hidden: true, // deprecated: use `lk room join` - Name: "join-room", - Usage: "Joins a room as a participant", - Action: _deprecatedJoinRoom, - Category: "Simulate", + Hidden: true, // deprecated: use `lk room join` + Name: "join-room", + Usage: "Joins a room as a participant", + Action: _deprecatedJoinRoom, Flags: []cli.Flag{ roomFlag, identityFlag, diff --git a/cmd/lk/loadtest.go b/cmd/lk/loadtest.go index bfb74e78..3f7e59af 100644 --- a/cmd/lk/loadtest.go +++ b/cmd/lk/loadtest.go @@ -28,10 +28,9 @@ import ( var LoadTestCommands = []*cli.Command{ { - Name: "load-test", - Usage: "Run load tests against LiveKit with simulated publishers & subscribers", - Category: "Simulate", - Action: loadTest, + Name: "load-test", + Usage: "Run load tests against LiveKit with simulated publishers & subscribers", + Action: loadTest, Flags: []cli.Flag{ &cli.StringFlag{ Name: "room", diff --git a/cmd/lk/main.go b/cmd/lk/main.go index e76bbd54..13e280c4 100644 --- a/cmd/lk/main.go +++ b/cmd/lk/main.go @@ -67,18 +67,18 @@ func main() { }, } - app.Commands = append(app.Commands, AuthCommands...) app.Commands = append(app.Commands, AppCommands...) - app.Commands = append(app.Commands, TokenCommands...) + app.Commands = append(app.Commands, CloudCommands...) + app.Commands = append(app.Commands, ProjectCommands...) app.Commands = append(app.Commands, RoomCommands...) + app.Commands = append(app.Commands, TokenCommands...) app.Commands = append(app.Commands, JoinCommands...) + app.Commands = append(app.Commands, DispatchCommands...) app.Commands = append(app.Commands, EgressCommands...) app.Commands = append(app.Commands, IngressCommands...) + app.Commands = append(app.Commands, SIPCommands...) app.Commands = append(app.Commands, ReplayCommands...) app.Commands = append(app.Commands, LoadTestCommands...) - app.Commands = append(app.Commands, ProjectCommands...) - app.Commands = append(app.Commands, SIPCommands...) - app.Commands = append(app.Commands, DispatchCommands...) // Register cleanup hook for SIGINT, SIGTERM, SIGQUIT ctx, stop := signal.NotifyContext( diff --git a/cmd/lk/project.go b/cmd/lk/project.go index fd29123b..f7eb0d63 100644 --- a/cmd/lk/project.go +++ b/cmd/lk/project.go @@ -32,10 +32,9 @@ import ( var ( ProjectCommands = []*cli.Command{ { - Name: "project", - Usage: "Add or remove projects and view existing project properties", - Category: "Core", - Before: loadProjectConfig, + Name: "project", + Usage: "Add or remove projects and view existing project properties", + Before: loadProjectConfig, Commands: []*cli.Command{ { Name: "add", diff --git a/cmd/lk/replay.go b/cmd/lk/replay.go index fd092f2d..0be61f93 100644 --- a/cmd/lk/replay.go +++ b/cmd/lk/replay.go @@ -19,7 +19,6 @@ var ( { Name: "replay", Usage: "experimental (not yet available)", - Category: "I/O", Hidden: true, HideHelpCommand: true, Commands: []*cli.Command{ diff --git a/cmd/lk/room.go b/cmd/lk/room.go index 4acee076..6846bd6f 100644 --- a/cmd/lk/room.go +++ b/cmd/lk/room.go @@ -38,7 +38,6 @@ var ( { Name: "room", Usage: "Create or delete rooms and manage existing room properties", - Category: "Core", HideHelpCommand: true, Commands: []*cli.Command{ { diff --git a/cmd/lk/sip.go b/cmd/lk/sip.go index 4b5bf22a..dc79f6c3 100644 --- a/cmd/lk/sip.go +++ b/cmd/lk/sip.go @@ -28,25 +28,16 @@ import ( //lint:file-ignore SA1019 we still support older APIs for compatibility -const ( - sipCategory = "I/O" - sipTrunkCategory = "Trunks" - sipDispatchCategory = "Dispatch Rules" - sipParticipantCategory = "Participants" -) - var ( SIPCommands = []*cli.Command{ { - Name: "sip", - Usage: "Manage SIP Trunks, Dispatch Rules, and Participants", - Category: sipCategory, + Name: "sip", + Usage: "Manage SIP Trunks, Dispatch Rules, and Participants", Commands: []*cli.Command{ { - Name: "inbound", - Aliases: []string{"in", "inbound-trunk"}, - Usage: "Inbound SIP Trunk management", - Category: sipTrunkCategory, + Name: "inbound", + Aliases: []string{"in", "inbound-trunk"}, + Usage: "Inbound SIP Trunk management", Commands: []*cli.Command{ { Name: "list", @@ -69,10 +60,9 @@ var ( }, }, { - Name: "outbound", - Aliases: []string{"out", "outbound-trunk"}, - Usage: "Outbound SIP Trunk management", - Category: sipTrunkCategory, + Name: "outbound", + Aliases: []string{"out", "outbound-trunk"}, + Usage: "Outbound SIP Trunk management", Commands: []*cli.Command{ { Name: "list", @@ -95,10 +85,9 @@ var ( }, }, { - Name: "dispatch", - Usage: "SIP Dispatch Rule management", - Aliases: []string{"dispatch-rule"}, - Category: sipDispatchCategory, + Name: "dispatch", + Usage: "SIP Dispatch Rule management", + Aliases: []string{"dispatch-rule"}, Commands: []*cli.Command{ { Name: "list", @@ -121,9 +110,8 @@ var ( }, }, { - Name: "participant", - Usage: "SIP Participant management", - Category: sipParticipantCategory, + Name: "participant", + Usage: "SIP Participant management", Commands: []*cli.Command{ { Name: "create", @@ -156,18 +144,16 @@ var ( // Deprecated commands kept for compatibility { - Hidden: true, // deprecated: use `sip trunk list` - Name: "list-sip-trunk", - Usage: "List all SIP trunk", - Action: listSipTrunk, - Category: sipCategory, + Hidden: true, // deprecated: use `sip trunk list` + Name: "list-sip-trunk", + Usage: "List all SIP trunk", + Action: listSipTrunk, }, { - Hidden: true, // deprecated: use `sip trunk delete` - Name: "delete-sip-trunk", - Usage: "Delete SIP Trunk", - Action: deleteSIPTrunkLegacy, - Category: sipCategory, + Hidden: true, // deprecated: use `sip trunk delete` + Name: "delete-sip-trunk", + Usage: "Delete SIP Trunk", + Action: deleteSIPTrunkLegacy, Flags: []cli.Flag{ &cli.StringFlag{ Name: "id", @@ -177,28 +163,25 @@ var ( }, }, { - Hidden: true, // deprecated: use `sip dispatch create` - Name: "create-sip-dispatch-rule", - Usage: "Create a SIP Dispatch Rule", - Action: createSIPDispatchRuleLegacy, - Category: sipCategory, + Hidden: true, // deprecated: use `sip dispatch create` + Name: "create-sip-dispatch-rule", + Usage: "Create a SIP Dispatch Rule", + Action: createSIPDispatchRuleLegacy, Flags: []cli.Flag{ RequestFlag[livekit.CreateSIPDispatchRuleRequest](), }, }, { - Hidden: true, // deprecated: use `sip dispatch list` - Name: "list-sip-dispatch-rule", - Usage: "List all SIP Dispatch Rule", - Action: listSipDispatchRule, - Category: sipCategory, + Hidden: true, // deprecated: use `sip dispatch list` + Name: "list-sip-dispatch-rule", + Usage: "List all SIP Dispatch Rule", + Action: listSipDispatchRule, }, { - Hidden: true, // deprecated: use `sip dispatch delete` - Name: "delete-sip-dispatch-rule", - Usage: "Delete SIP Dispatch Rule", - Action: deleteSIPDispatchRuleLegacy, - Category: sipCategory, + Hidden: true, // deprecated: use `sip dispatch delete` + Name: "delete-sip-dispatch-rule", + Usage: "Delete SIP Dispatch Rule", + Action: deleteSIPDispatchRuleLegacy, Flags: []cli.Flag{ &cli.StringFlag{ Name: "id", @@ -208,11 +191,10 @@ var ( }, }, { - Hidden: true, // deprecated: use `sip participant create` - Name: "create-sip-participant", - Usage: "Create a SIP Participant", - Action: createSIPParticipantLegacy, - Category: sipCategory, + Hidden: true, // deprecated: use `sip participant create` + Name: "create-sip-participant", + Usage: "Create a SIP Participant", + Action: createSIPParticipantLegacy, Flags: []cli.Flag{ RequestFlag[livekit.CreateSIPParticipantRequest](), }, diff --git a/cmd/lk/token.go b/cmd/lk/token.go index dff4da09..8ce5e392 100644 --- a/cmd/lk/token.go +++ b/cmd/lk/token.go @@ -42,10 +42,9 @@ const ( var ( TokenCommands = []*cli.Command{ { - Name: "token", - Usage: "Create access tokens with granular capabilities", - Category: "Core", - Before: loadProjectConfig, + Name: "token", + Usage: "Create access tokens with granular capabilities", + Before: loadProjectConfig, Commands: []*cli.Command{ { Name: "create",