From cb6b23ec5ff6ccb925d28a4cb5f2d1546269559c Mon Sep 17 00:00:00 2001 From: rektdeckard Date: Thu, 12 Sep 2024 13:48:49 -0600 Subject: [PATCH 1/8] chore(cloud): add comments for usage with staging env --- cmd/lk/cloud.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/lk/cloud.go b/cmd/lk/cloud.go index 9e6d1ae5..242820c1 100644 --- a/cmd/lk/cloud.go +++ b/cmd/lk/cloud.go @@ -91,6 +91,7 @@ var ( }, &cli.StringFlag{ // Use "http://cloud-api.livekit.run" in local dev + // Use "https://cloud-api-server-staging.ochicago1a.staging.livekit.app" in staging Name: "server-url", Value: cloudAPIServerURL, Destination: &serverURL, @@ -98,6 +99,7 @@ var ( }, &cli.StringFlag{ // Use "https://cloud.livekit.run" in local dev + // Use "https://cloud-site-staging.ochicago1a.staging.livekit.app" in staging Name: "dashboard-url", Value: cloudDashboardURL, Destination: &dashboardURL, From 28d9756bc435b02c536850071d7a01f7718a3f4f Mon Sep 17 00:00:00 2001 From: rektdeckard Date: Thu, 12 Sep 2024 14:07:24 -0600 Subject: [PATCH 2/8] feat(app): add app env and better output redirection on tasks --- cmd/lk/app.go | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/cmd/lk/app.go b/cmd/lk/app.go index e083836f..6a9d7acb 100644 --- a/cmd/lk/app.go +++ b/cmd/lk/app.go @@ -108,24 +108,20 @@ var ( Before: requireProject, Action: installTemplate, }, + { + Name: "env", + Usage: "Manage environment variables", + Before: requireProject, + Action: func(ctx context.Context, cmd *cli.Command) error { + return instantiateEnv(ctx, cmd, ".") + }, + }, { Name: "run", Usage: "Execute a task defined in " + bootstrap.TaskFile, ArgsUsage: "`DIR` location or the project directory (default: current directory)", Action: runTask, }, - { - Name: "test", - Action: func(ctx context.Context, c *cli.Command) error { - templates, err := bootstrap.FetchTemplates(ctx) - if err != nil { - return err - } - - fmt.Printf("Fetched templates: %+v\n", templates) - return nil - }, - }, }, }, } @@ -406,6 +402,7 @@ func doInstall(ctx context.Context, task bootstrap.KnownTask, rootPath string, v } func runTask(ctx context.Context, cmd *cli.Command) error { + verbose := cmd.Bool("verbose") taskName := cmd.Args().First() if taskName == "" { return errors.New("task name is required") @@ -421,5 +418,17 @@ func runTask(ctx context.Context, cmd *cli.Command) error { if err != nil { return err } - return task() + if verbose { + return task() + } else { + var cmdErr error + if err := spinner.New(). + Title("Running task " + taskName + "..."). + Action(func() { cmdErr = task() }). + Type(spinner.Dots). + Run(); err != nil { + return err + } + return cmdErr + } } From da3b10aab6d7054033a3a2bae5a37b0da8dde26e Mon Sep 17 00:00:00 2001 From: rektdeckard Date: Thu, 12 Sep 2024 14:47:12 -0600 Subject: [PATCH 3/8] chore(deps): update charms --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 9d935d43..112b0dc2 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.22.2 require ( github.com/charmbracelet/huh v0.6.0 - github.com/charmbracelet/huh/spinner v0.0.0-20240906163306-a9285a0ef8a3 + github.com/charmbracelet/huh/spinner v0.0.0-20240912161303-b56e9290a68e github.com/charmbracelet/lipgloss v0.13.0 github.com/frostbyte73/core v0.0.12 github.com/go-logr/logr v1.4.2 @@ -45,7 +45,7 @@ require ( github.com/catppuccin/go v0.2.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/charmbracelet/bubbles v0.20.0 // indirect - github.com/charmbracelet/bubbletea v1.1.0 // indirect + github.com/charmbracelet/bubbletea v1.1.1 // indirect github.com/charmbracelet/x/ansi v0.2.3 // indirect github.com/charmbracelet/x/exp/strings v0.0.0-20240809174237-9ab0ca04ce0c // indirect github.com/charmbracelet/x/term v0.2.0 // indirect diff --git a/go.sum b/go.sum index 461119f4..8a96969e 100644 --- a/go.sum +++ b/go.sum @@ -38,12 +38,12 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/charmbracelet/bubbles v0.20.0 h1:jSZu6qD8cRQ6k9OMfR1WlM+ruM8fkPWkHvQWD9LIutE= github.com/charmbracelet/bubbles v0.20.0/go.mod h1:39slydyswPy+uVOHZ5x/GjwVAFkCsV8IIVy+4MhzwwU= -github.com/charmbracelet/bubbletea v1.1.0 h1:FjAl9eAL3HBCHenhz/ZPjkKdScmaS5SK69JAK2YJK9c= -github.com/charmbracelet/bubbletea v1.1.0/go.mod h1:9Ogk0HrdbHolIKHdjfFpyXJmiCzGwy+FesYkZr7hYU4= +github.com/charmbracelet/bubbletea v1.1.1 h1:KJ2/DnmpfqFtDNVTvYZ6zpPFL9iRCRr0qqKOCvppbPY= +github.com/charmbracelet/bubbletea v1.1.1/go.mod h1:9Ogk0HrdbHolIKHdjfFpyXJmiCzGwy+FesYkZr7hYU4= github.com/charmbracelet/huh v0.6.0 h1:mZM8VvZGuE0hoDXq6XLxRtgfWyTI3b2jZNKh0xWmax8= github.com/charmbracelet/huh v0.6.0/go.mod h1:GGNKeWCeNzKpEOh/OJD8WBwTQjV3prFAtQPpLv+AVwU= -github.com/charmbracelet/huh/spinner v0.0.0-20240906163306-a9285a0ef8a3 h1:fP1Lr+Q8rWGLCifueSnqW/2QFtZUswA3YsNOx9OesZ0= -github.com/charmbracelet/huh/spinner v0.0.0-20240906163306-a9285a0ef8a3/go.mod h1:/dHGy3eS2ikDSO71IhslBdBGvrknQ+ze/VDiNdIxocw= +github.com/charmbracelet/huh/spinner v0.0.0-20240912161303-b56e9290a68e h1:7j2L0HkIzFSdzDmP2Dl97Q8ttWzlwubIgiNrutMd5Lc= +github.com/charmbracelet/huh/spinner v0.0.0-20240912161303-b56e9290a68e/go.mod h1:Cxhgl8N0sX9A+EQxedzzGZAalaF8fUVL+JP/pSOW8cI= github.com/charmbracelet/lipgloss v0.13.0 h1:4X3PPeoWEDCMvzDvGmTajSyYPcZM4+y8sCA/SsA3cjw= github.com/charmbracelet/lipgloss v0.13.0/go.mod h1:nw4zy0SBX/F/eAO1cWdcvy6qnkDUxr8Lw7dvFrAIbbY= github.com/charmbracelet/x/ansi v0.2.3 h1:VfFN0NUpcjBRd4DnKfRaIRo53KRgey/nhOoEqosGDEY= From 4fd3d1fda50e9707cf89c7ee424cf45fd4ca0d4e Mon Sep 17 00:00:00 2001 From: rektdeckard Date: Thu, 12 Sep 2024 14:47:25 -0600 Subject: [PATCH 4/8] chore(cmd): apply styling to spinners --- cmd/lk/app.go | 5 +++-- cmd/lk/cloud.go | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/lk/app.go b/cmd/lk/app.go index 6a9d7acb..f1cf4fb5 100644 --- a/cmd/lk/app.go +++ b/cmd/lk/app.go @@ -326,6 +326,7 @@ func cloneTemplate(_ context.Context, cmd *cli.Command, url, appName string) err } os.RemoveAll(path.Join(appName, ".git")) }). + Style(theme.Focused.Title). Run(); err != nil { return err } @@ -384,7 +385,7 @@ func doInstall(ctx context.Context, task bootstrap.KnownTask, rootPath string, v if err := spinner.New(). Title("Installing..."). Action(func() { cmdErr = install() }). - Type(spinner.Dots). + Style(theme.Focused.Title). Run(); err != nil { return err } @@ -425,7 +426,7 @@ func runTask(ctx context.Context, cmd *cli.Command) error { if err := spinner.New(). Title("Running task " + taskName + "..."). Action(func() { cmdErr = task() }). - Type(spinner.Dots). + Style(theme.Focused.Title). Run(); err != nil { return err } diff --git a/cmd/lk/cloud.go b/cmd/lk/cloud.go index 242820c1..f8b34161 100644 --- a/cmd/lk/cloud.go +++ b/cmd/lk/cloud.go @@ -305,6 +305,7 @@ func tryAuthIfNeeded(ctx context.Context, cmd *cli.Command) error { Action(func() { ak, pollErr = pollClaim(ctx, cmd) }). + Style(theme.Focused.Title). Run(); err != nil { return err } From 64550cc8039ece334e087c79135fd352b2ebe99b Mon Sep 17 00:00:00 2001 From: rektdeckard Date: Thu, 12 Sep 2024 14:54:06 -0600 Subject: [PATCH 5/8] chore(app): add IsSandbox Template field --- pkg/bootstrap/bootstrap.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/bootstrap/bootstrap.go b/pkg/bootstrap/bootstrap.go index 9684bc16..f249a943 100644 --- a/pkg/bootstrap/bootstrap.go +++ b/pkg/bootstrap/bootstrap.go @@ -53,12 +53,13 @@ const ( ) type Template struct { - Name string `yaml:"name" json:"name"` - Desc string `yaml:"desc" json:"description,omitempty"` - URL string `yaml:"url" json:"url,omitempty"` - Docs string `yaml:"docs" json:"docs_url,omitempty"` - Image string `yaml:"image" json:"image_ref,omitempty"` - Tags []string `yaml:"tags" json:"tags,omitempty"` + Name string `yaml:"name" json:"name"` + Desc string `yaml:"desc" json:"description,omitempty"` + URL string `yaml:"url" json:"url,omitempty"` + Docs string `yaml:"docs" json:"docs_url,omitempty"` + Image string `yaml:"image" json:"image_ref,omitempty"` + Tags []string `yaml:"tags" json:"tags,omitempty"` + IsSandbox bool `yaml:"is_sandbox" json:"is_sandbox,omitempty"` } func FetchTemplates(ctx context.Context) ([]Template, error) { From f0a2c9f6e3953e891a1e121573494b35e6c7e505 Mon Sep 17 00:00:00 2001 From: rektdeckard Date: Thu, 12 Sep 2024 14:58:10 -0600 Subject: [PATCH 6/8] chore(app): remove unused flag --- cmd/lk/app.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/cmd/lk/app.go b/cmd/lk/app.go index f1cf4fb5..46e04fe1 100644 --- a/cmd/lk/app.go +++ b/cmd/lk/app.go @@ -87,18 +87,12 @@ var ( }, &cli.StringFlag{ // Use "http://cloud-api.livekit.run" in local dev + // Use "https://cloud-api-server-staging.ochicago1a.staging.livekit.app" in staging Name: "server-url", Value: cloudAPIServerURL, Destination: &serverURL, Hidden: true, }, - &cli.StringFlag{ - // Use "https://cloud.livekit.run" in local dev - Name: "dashboard-url", - Value: cloudDashboardURL, - Destination: &dashboardURL, - Hidden: true, - }, }, }, { From 30d136619465b132123777afa132707383f636c8 Mon Sep 17 00:00:00 2001 From: rektdeckard Date: Thu, 12 Sep 2024 15:08:35 -0600 Subject: [PATCH 7/8] chore(bin): bump version --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index d0945fab..f4472a54 100644 --- a/version.go +++ b/version.go @@ -15,5 +15,5 @@ package livekitcli const ( - Version = "2.1.0" + Version = "2.1.1" ) From 470180d5a8034269dd0a4986d3557c33e226f746 Mon Sep 17 00:00:00 2001 From: rektdeckard Date: Thu, 12 Sep 2024 17:57:26 -0600 Subject: [PATCH 8/8] chore(cmd): remove local/staging url comments --- cmd/lk/app.go | 2 -- cmd/lk/cloud.go | 4 ---- 2 files changed, 6 deletions(-) diff --git a/cmd/lk/app.go b/cmd/lk/app.go index 46e04fe1..662e8fbd 100644 --- a/cmd/lk/app.go +++ b/cmd/lk/app.go @@ -86,8 +86,6 @@ var ( Required: true, }, &cli.StringFlag{ - // Use "http://cloud-api.livekit.run" in local dev - // Use "https://cloud-api-server-staging.ochicago1a.staging.livekit.app" in staging Name: "server-url", Value: cloudAPIServerURL, Destination: &serverURL, diff --git a/cmd/lk/cloud.go b/cmd/lk/cloud.go index f8b34161..5802bff0 100644 --- a/cmd/lk/cloud.go +++ b/cmd/lk/cloud.go @@ -90,16 +90,12 @@ var ( Value: 4, }, &cli.StringFlag{ - // Use "http://cloud-api.livekit.run" in local dev - // Use "https://cloud-api-server-staging.ochicago1a.staging.livekit.app" in staging Name: "server-url", Value: cloudAPIServerURL, Destination: &serverURL, Hidden: true, }, &cli.StringFlag{ - // Use "https://cloud.livekit.run" in local dev - // Use "https://cloud-site-staging.ochicago1a.staging.livekit.app" in staging Name: "dashboard-url", Value: cloudDashboardURL, Destination: &dashboardURL,