From 83e5db8e028d134495bd2c2d0c6481248cc80b00 Mon Sep 17 00:00:00 2001 From: Jon Ayers Date: Tue, 10 Dec 2024 15:34:51 +0000 Subject: [PATCH 1/3] fix: disable github/charmbracelete/bubbletea init() --- cmd/coder/main.go | 3 +++ enterprise/cmd/coder/main.go | 6 +++++- go.mod | 5 ++++- go.sum | 6 ++++-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/cmd/coder/main.go b/cmd/coder/main.go index 46e0850574a99..abed62df9f7f3 100644 --- a/cmd/coder/main.go +++ b/cmd/coder/main.go @@ -5,6 +5,8 @@ import ( "os" _ "time/tzdata" + tea "github.com/sreya/bubbletea" + "github.com/coder/coder/v2/agent/agentexec" "github.com/coder/coder/v2/cli" ) @@ -15,6 +17,7 @@ func main() { _, _ = fmt.Fprintln(os.Stderr, err) os.Exit(1) } + tea.InitTerminal() var rootCmd cli.RootCmd rootCmd.RunWithSubcommands(rootCmd.AGPL()) } diff --git a/enterprise/cmd/coder/main.go b/enterprise/cmd/coder/main.go index c71e479fe0079..c1b451378ddf8 100644 --- a/enterprise/cmd/coder/main.go +++ b/enterprise/cmd/coder/main.go @@ -5,6 +5,8 @@ import ( "os" _ "time/tzdata" + tea "github.com/sreya/bubbletea" + "github.com/coder/coder/v2/agent/agentexec" entcli "github.com/coder/coder/v2/enterprise/cli" ) @@ -15,7 +17,9 @@ func main() { _, _ = fmt.Fprintln(os.Stderr, err) os.Exit(1) } - + // This preserves backwards compatibility with an init function that is causing grief for + // web terminals using agent-exec + screen. + tea.InitTerminal() var rootCmd entcli.RootCmd rootCmd.RunWithSubcommands(rootCmd.EnterpriseSubcommands()) } diff --git a/go.mod b/go.mod index fc5b6d394b26a..f898c8d49d046 100644 --- a/go.mod +++ b/go.mod @@ -67,6 +67,8 @@ replace github.com/pkg/sftp => github.com/mafredri/sftp v1.13.6-0.20231212144145 // which we use in the awsiamrds package. replace github.com/lib/pq => github.com/coder/pq v1.10.5-0.20240813183442-0c420cb5a048 +replace github.com/charmbracelet/bubbletea => github.com/sreya/bubbletea v1.2.2-0.20241210232551-43ff5fc42edd + require ( cdr.dev/slog v1.6.2-0.20241112041820-0ec81e6e67bb cloud.google.com/go/compute/metadata v0.5.2 @@ -202,7 +204,7 @@ require go.uber.org/mock v0.5.0 require ( github.com/cespare/xxhash v1.1.0 github.com/charmbracelet/bubbles v0.20.0 - github.com/charmbracelet/bubbletea v1.2.1 + github.com/charmbracelet/bubbletea v1.1.0 github.com/charmbracelet/lipgloss v1.0.0 github.com/coder/serpent v0.10.0 github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21 @@ -212,6 +214,7 @@ require ( github.com/google/go-github/v61 v61.0.0 github.com/mocktools/go-smtp-mock/v2 v2.4.0 github.com/natefinch/atomic v1.0.1 + github.com/sreya/bubbletea v1.2.2-0.20241210232912-64577f67745d kernel.org/pub/linux/libs/security/libcap/cap v1.2.73 ) diff --git a/go.sum b/go.sum index 6483c3505565c..2d9d95e5c9cc1 100644 --- a/go.sum +++ b/go.sum @@ -177,8 +177,6 @@ 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.2.1 h1:J041h57zculJKEKf/O2pS4edXGIz+V0YvojvfGXePIk= -github.com/charmbracelet/bubbletea v1.2.1/go.mod h1:viLoDL7hG4njLJSKU2gw7kB3LSEmWsrM80rO1dBJWBI= github.com/charmbracelet/glamour v0.8.0 h1:tPrjL3aRcQbn++7t18wOpgLyl8wrOHUEDS7IZ68QtZs= github.com/charmbracelet/glamour v0.8.0/go.mod h1:ViRgmKkf3u5S7uakt2czJ272WSg2ZenlYEZXT2x7Bjw= github.com/charmbracelet/lipgloss v1.0.0 h1:O7VkGDvqEdGi93X+DeqsQ7PKHDgtQfF8j8/O2qFMQNg= @@ -875,6 +873,10 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/sqlc-dev/pqtype v0.3.0 h1:b09TewZ3cSnO5+M1Kqq05y0+OjqIptxELaSayg7bmqk= github.com/sqlc-dev/pqtype v0.3.0/go.mod h1:oyUjp5981ctiL9UYvj1bVvCKi8OXkCa0u645hce7CAs= +github.com/sreya/bubbletea v1.2.2-0.20241210232551-43ff5fc42edd h1:xPRu22sr8KkxW77hDVI7+LtGzkvN4VIa2B9KguAtseY= +github.com/sreya/bubbletea v1.2.2-0.20241210232551-43ff5fc42edd/go.mod h1:viLoDL7hG4njLJSKU2gw7kB3LSEmWsrM80rO1dBJWBI= +github.com/sreya/bubbletea v1.2.2-0.20241210232912-64577f67745d h1:quKivcS5oKQqHJrQCuwcynyZIL277p+1eMs40dVjfyM= +github.com/sreya/bubbletea v1.2.2-0.20241210232912-64577f67745d/go.mod h1:sjEM8Zl1LP776ZK9xhLVX6fC5bDWw0HryxT8bmBfcsY= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= From 9dfe7f819d09c42afc292dbc3de7d67fa90354b4 Mon Sep 17 00:00:00 2001 From: Jon Ayers Date: Wed, 11 Dec 2024 20:26:31 +0000 Subject: [PATCH 2/3] update comment --- cmd/coder/main.go | 2 ++ enterprise/cmd/coder/main.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/coder/main.go b/cmd/coder/main.go index abed62df9f7f3..a520474aa2d97 100644 --- a/cmd/coder/main.go +++ b/cmd/coder/main.go @@ -17,6 +17,8 @@ func main() { _, _ = fmt.Fprintln(os.Stderr, err) os.Exit(1) } + // This preserves backwards compatibility with an init function that is causing grief for + // web terminals using agent-exec + screen. See https://github.com/coder/coder/pull/15817 tea.InitTerminal() var rootCmd cli.RootCmd rootCmd.RunWithSubcommands(rootCmd.AGPL()) diff --git a/enterprise/cmd/coder/main.go b/enterprise/cmd/coder/main.go index c1b451378ddf8..24467a0a80b6d 100644 --- a/enterprise/cmd/coder/main.go +++ b/enterprise/cmd/coder/main.go @@ -18,7 +18,7 @@ func main() { os.Exit(1) } // This preserves backwards compatibility with an init function that is causing grief for - // web terminals using agent-exec + screen. + // web terminals using agent-exec + screen. See https://github.com/coder/coder/pull/15817 tea.InitTerminal() var rootCmd entcli.RootCmd rootCmd.RunWithSubcommands(rootCmd.EnterpriseSubcommands()) From c0aeb14e28a0929393d609bb12ab7199ee3f62da Mon Sep 17 00:00:00 2001 From: Jon Ayers Date: Thu, 12 Dec 2024 19:15:40 +0000 Subject: [PATCH 3/3] use coder fork --- cmd/coder/main.go | 2 +- enterprise/cmd/coder/main.go | 2 +- go.mod | 5 +++-- go.sum | 6 ++---- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/cmd/coder/main.go b/cmd/coder/main.go index a520474aa2d97..1c22d578d7160 100644 --- a/cmd/coder/main.go +++ b/cmd/coder/main.go @@ -5,7 +5,7 @@ import ( "os" _ "time/tzdata" - tea "github.com/sreya/bubbletea" + tea "github.com/charmbracelet/bubbletea" "github.com/coder/coder/v2/agent/agentexec" "github.com/coder/coder/v2/cli" diff --git a/enterprise/cmd/coder/main.go b/enterprise/cmd/coder/main.go index 24467a0a80b6d..803903f390e5a 100644 --- a/enterprise/cmd/coder/main.go +++ b/enterprise/cmd/coder/main.go @@ -5,7 +5,7 @@ import ( "os" _ "time/tzdata" - tea "github.com/sreya/bubbletea" + tea "github.com/charmbracelet/bubbletea" "github.com/coder/coder/v2/agent/agentexec" entcli "github.com/coder/coder/v2/enterprise/cli" diff --git a/go.mod b/go.mod index f898c8d49d046..acb6ab5e0b7e5 100644 --- a/go.mod +++ b/go.mod @@ -67,7 +67,9 @@ replace github.com/pkg/sftp => github.com/mafredri/sftp v1.13.6-0.20231212144145 // which we use in the awsiamrds package. replace github.com/lib/pq => github.com/coder/pq v1.10.5-0.20240813183442-0c420cb5a048 -replace github.com/charmbracelet/bubbletea => github.com/sreya/bubbletea v1.2.2-0.20241210232551-43ff5fc42edd +// Removes an init() function that causes terminal sequences to be printed to the web terminal when +// used in conjunction with agent-exec. See https://github.com/coder/coder/pull/15817 +replace github.com/charmbracelet/bubbletea => github.com/coder/bubbletea v1.2.2-0.20241212190825-007a1cdb2c41 require ( cdr.dev/slog v1.6.2-0.20241112041820-0ec81e6e67bb @@ -214,7 +216,6 @@ require ( github.com/google/go-github/v61 v61.0.0 github.com/mocktools/go-smtp-mock/v2 v2.4.0 github.com/natefinch/atomic v1.0.1 - github.com/sreya/bubbletea v1.2.2-0.20241210232912-64577f67745d kernel.org/pub/linux/libs/security/libcap/cap v1.2.73 ) diff --git a/go.sum b/go.sum index 2d9d95e5c9cc1..bb9c265232652 100644 --- a/go.sum +++ b/go.sum @@ -207,6 +207,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/coder/bubbletea v1.2.2-0.20241212190825-007a1cdb2c41 h1:SBN/DA63+ZHwuWwPHPYoCZ/KLAjHv5g4h2MS4f2/MTI= +github.com/coder/bubbletea v1.2.2-0.20241212190825-007a1cdb2c41/go.mod h1:I9ULxr64UaOSUv7hcb3nX4kowodJCVS7vt7VVJk/kW4= github.com/coder/flog v1.1.0 h1:kbAes1ai8fIS5OeV+QAnKBQE22ty1jRF/mcAwHpLBa4= github.com/coder/flog v1.1.0/go.mod h1:UQlQvrkJBvnRGo69Le8E24Tcl5SJleAAR7gYEHzAmdQ= github.com/coder/glog v1.0.1-0.20220322161911-7365fe7f2cd1 h1:UqBrPWSYvRI2s5RtOul20JukUEpu4ip9u7biBL+ntgk= @@ -873,10 +875,6 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/sqlc-dev/pqtype v0.3.0 h1:b09TewZ3cSnO5+M1Kqq05y0+OjqIptxELaSayg7bmqk= github.com/sqlc-dev/pqtype v0.3.0/go.mod h1:oyUjp5981ctiL9UYvj1bVvCKi8OXkCa0u645hce7CAs= -github.com/sreya/bubbletea v1.2.2-0.20241210232551-43ff5fc42edd h1:xPRu22sr8KkxW77hDVI7+LtGzkvN4VIa2B9KguAtseY= -github.com/sreya/bubbletea v1.2.2-0.20241210232551-43ff5fc42edd/go.mod h1:viLoDL7hG4njLJSKU2gw7kB3LSEmWsrM80rO1dBJWBI= -github.com/sreya/bubbletea v1.2.2-0.20241210232912-64577f67745d h1:quKivcS5oKQqHJrQCuwcynyZIL277p+1eMs40dVjfyM= -github.com/sreya/bubbletea v1.2.2-0.20241210232912-64577f67745d/go.mod h1:sjEM8Zl1LP776ZK9xhLVX6fC5bDWw0HryxT8bmBfcsY= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=