Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ require (
github.com/platform-engineering-labs/formae/tests/testcontrol v0.0.0-00010101000000-000000000000
github.com/platform-engineering-labs/jsonpatch v0.0.0-20260921135532-7c58038cb9c7
github.com/platform-engineering-labs/oox/provx v0.0.0-20260905021850-40f9d81e8f38 // re-pin to a real tag at release time
github.com/platform-engineering-labs/orbital v0.2.5
github.com/platform-engineering-labs/orbital v0.2.8
github.com/posthog/posthog-go v1.6.3
github.com/pressly/goose/v3 v3.26.0
github.com/prometheus/client_golang v1.23.2
Expand Down Expand Up @@ -140,18 +140,19 @@ require (
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/asdine/storm v2.1.2+incompatible // indirect
github.com/atotto/clipboard v0.1.4 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.7 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.17 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.38 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.42 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager v0.1.10 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.39 // indirect
github.com/aws/aws-sdk-go-v2/service/iam v1.59.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.17 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.12 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.29 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.38 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.20 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.97.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.37 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.107.1 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.5.7 // indirect
github.com/aws/aws-sdk-go-v2/service/ssm v1.44.7 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.33.7 // indirect
Expand Down
22 changes: 12 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,16 @@ github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
github.com/aws/aws-sdk-go-v2 v1.45.1 h1:iIoG3NaLhV6UZpPXyPXlDj2I9oS8tV/nMcMnITCC6Ks=
github.com/aws/aws-sdk-go-v2 v1.45.1/go.mod h1:bttEH6JqnUL8LepvDVfdrds/fZ5bCIxzpe3abyUrhDU=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.7 h1:3kGOqnh1pPeddVa/E37XNTaWJ8W6vrbYV9lJEkCnhuY=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.7/go.mod h1:lyw7GFp3qENLh7kwzf7iMzAxDn+NzjXEAGjKS2UOKqI=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.17 h1:mn+Vxb9zgz/FE/yDTcFim3DZ1qpcrxR+qBQkBrl6bzA=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.17/go.mod h1:eDfmEFxu+BSVsUGLbzJhWjpOurv1mqczClS97yI8wdk=
github.com/aws/aws-sdk-go-v2/config v1.32.38 h1:n4yPHBjtQ3BrIIUyk0/LAqf/BL2iv0Tw6XZcMRzM0ps=
github.com/aws/aws-sdk-go-v2/config v1.32.38/go.mod h1:dencYsOS1R7rBy8zehCvwBYzdxxL4Q/nRK7In03wjN8=
github.com/aws/aws-sdk-go-v2/credentials v1.19.37 h1:FJ8Iz4/xISMB/rwLlgfWujfGDFWr0oneQgtA6KPcYLY=
github.com/aws/aws-sdk-go-v2/credentials v1.19.37/go.mod h1:Q6pWOgVUp49x4g5QVi29wHofUoICnZ+Zq4jHbRN/7ec=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.38 h1:Nqo2jU1wz5rnBM9XQyXfVD1RP8txkbP3EDx8hR/hbCE=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.38/go.mod h1:PzJFHhjR2vWFKHe8HmY5Lxhvwyxnr5MERtk0nDxWNbk=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.42 h1:UuK6LmQ5GD5JL7x5OY1L9xo93xAQb1wjYOlngNxa9YA=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.42/go.mod h1:BEYAPq1qDt9iBiEwZr0zJCJIHgGVDz67iV9Hw9D6z58=
github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager v0.1.10 h1:2KCL4TmeiNvpPedtC4Bey5jvjRLD74WUYqGeHJ//aco=
github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager v0.1.10/go.mod h1:KwaiUFVO7pG8Z9F5bMGvvrRibdSDaAu8HtlKGKkjZSA=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.1 h1:pc138gM1CW+XPc60rEwUlwwuwWFQK16CI1T7v1F9Oec=
Expand All @@ -114,16 +116,16 @@ github.com/aws/aws-sdk-go-v2/service/iam v1.59.2 h1:An/8OH+HhHxKar6bDa8v1ITiG7V3
github.com/aws/aws-sdk-go-v2/service/iam v1.59.2/go.mod h1:gQRbwtyMFDBnV/58n5bVWmZi50c7H2HN/+ikrW876So=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.17 h1:OvYZOB3qA6zvfdRFiRFRzVSiElMYrz3GdntkXZxlp1o=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.17/go.mod h1:JgR/2Ew50ACfIWau1oeMRX59tMtC0kM+PYQGEaT04cY=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.12 h1:qtJZ70afD3ISKWnoX3xB0J2otEqu3LqicRcDBqsj0hQ=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.12/go.mod h1:v2pNpJbRNl4vEUWEh5ytQok0zACAKfdmKS51Hotc3pQ=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.29 h1:E65Hj648dOV6FuUfI0mYXXhQRHbsi7n+B9h6fZPJO/E=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.29/go.mod h1:xLrF9yNTCs92VZSpdEd68EJbgcdw3SMR74RO6QDzWHE=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.38 h1:H/5TI1jqaHsNoDQ60UwvPvJBg4GURkinXI3Qga29t2w=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.38/go.mod h1:PTVFf+XH++7NJOky+RLBYQx0QA5NcaeEYFQ2fsi0nwo=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.20 h1:siU1A6xjUZ2N8zjTHSXFhB9L/2OY8Dqs0xXiLjF30jA=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.20/go.mod h1:4TLZCmVJDM3FOu5P5TJP0zOlu9zWgDWU7aUxWbr+rcw=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.37 h1:KGHa9iZCrgtkOsFfXb0S4ywsjostA/hau7WE9aSb43E=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.37/go.mod h1:FV79f0DSnZIEGsQjWenENGtUycrasyAaJZO+zRanLHA=
github.com/aws/aws-sdk-go-v2/service/rdsdata v1.32.17 h1:poHYttXFhpCUps5xl5e1GBclCEt4B5dH7RwAjAgp/Yo=
github.com/aws/aws-sdk-go-v2/service/rdsdata v1.32.17/go.mod h1:u5Kzt/39CDtazPRSl5xfkIp/YsLpxJtbxb0AioIUFsw=
github.com/aws/aws-sdk-go-v2/service/s3 v1.97.1 h1:csi9NLpFZXb9fxY7rS1xVzgPRGMt7MSNWeQ6eo247kE=
github.com/aws/aws-sdk-go-v2/service/s3 v1.97.1/go.mod h1:qXVal5H0ChqXP63t6jze5LmFalc7+ZE7wOdLtZ0LCP0=
github.com/aws/aws-sdk-go-v2/service/s3 v1.107.1 h1:VUTtUJMuRNMkb/7NIKmd8NQaeQLPGCMoTJxkYKre4qM=
github.com/aws/aws-sdk-go-v2/service/s3 v1.107.1/go.mod h1:WvUaO0lP5GNMs1R6cs6qvB3mqo16GLta8yfOuf55Rpc=
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.47.0 h1:LjEecQF5MLvqi1H/fMlU4JL6aQZyN/7BYMynz6PVnxQ=
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.47.0/go.mod h1:2rdJeO95tT+EGmjF4jWmIzNKRwIMpr7Dnf7W6mIB9EQ=
github.com/aws/aws-sdk-go-v2/service/signin v1.5.7 h1:YcczQ6zNH/ojIzD/ikDrO+RfW06wmdMp18d4NH5hXY4=
Expand Down Expand Up @@ -483,8 +485,8 @@ github.com/platform-engineering-labs/oox/gcpname v0.0.0-20260825170105-3bd97cb18
github.com/platform-engineering-labs/oox/gcpname v0.0.0-20260825170105-3bd97cb18d15/go.mod h1:wytVDQEOgo/0PLmMj0nOnisBzzqwemanNy9gpueH9Ik=
github.com/platform-engineering-labs/oox/provx v0.0.0-20260905021850-40f9d81e8f38 h1:mXV1j81cMGKoEKal3trLT617utgH8l04I1xzHoUHACA=
github.com/platform-engineering-labs/oox/provx v0.0.0-20260905021850-40f9d81e8f38/go.mod h1:ySd/XvwrvHJv9Qqb4JM5SOrvmMf3BdQMGo2Ae77U+UM=
github.com/platform-engineering-labs/orbital v0.2.5 h1:7rihasWnR68ORytqLubR5WMJchv/mxoWSCB7MqaB9tU=
github.com/platform-engineering-labs/orbital v0.2.5/go.mod h1:wwVPqOmW5RO78dDzL/G5CN1Ioao0P/aUsOZVrPVx64s=
github.com/platform-engineering-labs/orbital v0.2.8 h1:mKwEb6qmIbjHgH7MYSq1O4+DOIw46by8nioowWuQBDQ=
github.com/platform-engineering-labs/orbital v0.2.8/go.mod h1:Tls4Quxi5znwWIZvrutnMAiI+GyCOE+UGhSQd++CYcY=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand Down
8 changes: 8 additions & 0 deletions internal/cli/banner/banner.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ var isTerminal = func(w io.Writer) bool {
return tui.IsTerminal(w)
}

// Suppress sets PEL_NO_BANNER for the rest of this process and anything it
// execs. Commands that build a package manager call it once their own banner
// is out: when the install tree is root-owned the manager re-execs the CLI
// under sudo, and the second run would otherwise print the banner again.
func Suppress() {
_ = os.Setenv(NoBannerEnv, "true")
}

// ClearScreen clears the terminal screen.
func ClearScreen() {
_, _ = fmt.Print("\033[2J") // Clear screen
Expand Down
23 changes: 23 additions & 0 deletions internal/cli/banner/banner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,26 @@ func TestPrintTextBanner_NeverDrawsGraphics(t *testing.T) {
assert.Contains(t, text, "v"+formae.Version, "PrintTextBanner must still show the version")
assert.True(t, strings.ContainsRune(text, '⣿') || strings.ContainsAny(text, "⠀⠁⠂⠃⠄⡀⢀⣀"), "PrintTextBanner must draw the braille logo")
}

// TestSuppress verifies that Suppress sets PEL_NO_BANNER so that this process
// and anything it execs stop printing the banner.
func TestSuppress(t *testing.T) {
origIsTerminal := isTerminal
origDetect := detect
t.Cleanup(func() {
isTerminal = origIsTerminal
detect = origDetect
})

isTerminal = func(_ io.Writer) bool { return true }
detect = func() logo.Capability { return logo.CapText }

// Registers the restore of the variable Suppress is about to set.
t.Setenv(NoBannerEnv, "")
require.NotEmpty(t, captureStdout(func() { PrintBanner() }))

Suppress()

assert.Equal(t, "true", os.Getenv(NoBannerEnv))
assert.Empty(t, captureStdout(func() { PrintBanner() }))
}
2 changes: 2 additions & 0 deletions internal/cli/clean/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"os"

"github.com/platform-engineering-labs/formae/internal/cli/app"
"github.com/platform-engineering-labs/formae/internal/cli/banner"
clicmd "github.com/platform-engineering-labs/formae/internal/cli/cmd"
"github.com/platform-engineering-labs/formae/internal/cli/tui/components"
"github.com/platform-engineering-labs/formae/internal/cli/tui/theme"
Expand Down Expand Up @@ -46,6 +47,7 @@ func CleanCmd() *cobra.Command {
return err
}
a.PrintBanner()
banner.Suppress()

orb, err := opsmgr.New(slog.Default(), a.Config.Artifacts.URL, "", true, true)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions internal/cli/plugin/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"sort"
"strings"

"github.com/platform-engineering-labs/formae/internal/cli/banner"
"github.com/platform-engineering-labs/formae/internal/opsmgr"
apimodel "github.com/platform-engineering-labs/formae/pkg/api/model"
pkgmodel "github.com/platform-engineering-labs/formae/pkg/model"
Expand Down Expand Up @@ -45,6 +46,9 @@ func NewCLIPluginManager(logger *slog.Logger, repos []pkgmodel.Repository, chann
if len(repos) == 0 {
return nil, nil
}
// Every plugin command prints its banner before it gets here, so the sudo
// re-exec below must not print a second one.
banner.Suppress()
orb, err := opsmgr.NewFromRepositories(logger, repos, channel, sudo, writable)
if err != nil {
return nil, err
Expand Down
2 changes: 2 additions & 0 deletions internal/cli/refresh/refresh.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"sync/atomic"

"github.com/platform-engineering-labs/formae/internal/cli/app"
"github.com/platform-engineering-labs/formae/internal/cli/banner"
clicmd "github.com/platform-engineering-labs/formae/internal/cli/cmd"
"github.com/platform-engineering-labs/formae/internal/cli/config"
"github.com/platform-engineering-labs/formae/internal/cli/tui"
Expand Down Expand Up @@ -94,6 +95,7 @@ sudo.`,
return err
}
a.PrintBanner()
banner.Suppress()

// orbital's Refresh() always returns nil, logging per-repository
// fetch failures at ERROR level instead. Count those so we don't
Expand Down
3 changes: 3 additions & 0 deletions internal/cli/update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

"github.com/platform-engineering-labs/formae/internal/agent"
"github.com/platform-engineering-labs/formae/internal/cli/app"
"github.com/platform-engineering-labs/formae/internal/cli/banner"
clicmd "github.com/platform-engineering-labs/formae/internal/cli/cmd"
"github.com/platform-engineering-labs/formae/internal/cli/config"
"github.com/platform-engineering-labs/formae/internal/cli/tui"
Expand Down Expand Up @@ -170,6 +171,7 @@ func UpdateCmd() *cobra.Command {
return err
}
a.PrintBanner()
banner.Suppress()

var orb *mgr.Manager
if len(a.Config.Artifacts.Repositories) > 0 {
Expand Down Expand Up @@ -301,6 +303,7 @@ func UpdateListCmd() *cobra.Command {
return err
}
a.PrintBanner()
banner.Suppress()

var orb *mgr.Manager
if len(a.Config.Artifacts.Repositories) > 0 {
Expand Down
Loading