diff --git a/go.mod b/go.mod index 3b755a06..6b5bf33d 100644 --- a/go.mod +++ b/go.mod @@ -5,15 +5,16 @@ go 1.24.4 require ( buf.build/gen/go/depot/api/connectrpc/go v1.15.0-20240221184445-e8316610338f.1 buf.build/gen/go/depot/api/protocolbuffers/go v1.32.0-20240221184445-e8316610338f.1 + charm.land/bubbles/v2 v2.0.0 + charm.land/bubbletea/v2 v2.0.2 + charm.land/huh/v2 v2.0.0 + charm.land/lipgloss/v2 v2.0.0 connectrpc.com/connect v1.15.0 github.com/adrg/xdg v0.4.0 github.com/aws/aws-sdk-go-v2/config v1.15.5 github.com/bmatcuk/doublestar/v4 v4.10.0 github.com/briandowns/spinner v1.18.1 - github.com/charmbracelet/bubbles v1.0.0 - github.com/charmbracelet/bubbletea v1.3.10 - github.com/charmbracelet/huh v0.7.0 - github.com/charmbracelet/lipgloss v1.1.0 + github.com/charmbracelet/colorprofile v0.4.2 github.com/charmbracelet/x/ansi v0.11.6 github.com/cli/safeexec v1.0.0 github.com/compose-spec/compose-go/v2 v2.14.0 @@ -27,7 +28,6 @@ require ( github.com/docker/docker v24.0.7+incompatible github.com/docker/go-connections v0.4.0 github.com/docker/go-units v0.5.0 - github.com/erikgeiser/promptkit v0.9.0 github.com/getsentry/sentry-go v0.13.0 github.com/gogo/protobuf v1.3.2 github.com/hashicorp/go-cty-funcs v0.0.0-20250210171435-dda779884a9f @@ -81,18 +81,18 @@ require ( github.com/aws/aws-sdk-go-v2/service/sso v1.11.4 // indirect github.com/aws/aws-sdk-go-v2/service/sts v1.16.4 // indirect github.com/aws/smithy-go v1.11.2 // indirect - github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/catppuccin/go v0.3.0 // indirect github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/charmbracelet/colorprofile v0.4.1 // indirect - github.com/charmbracelet/x/cellbuf v0.0.15 // indirect + github.com/charmbracelet/ultraviolet v0.0.0-20260205113103-524a6607adb8 // indirect + github.com/charmbracelet/x/exp/ordered v0.1.0 // indirect github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0 // indirect github.com/charmbracelet/x/term v0.2.2 // indirect - github.com/clipperhouse/displaywidth v0.9.0 // indirect - github.com/clipperhouse/stringish v0.1.1 // indirect - github.com/clipperhouse/uax29/v2 v2.5.0 // indirect + github.com/charmbracelet/x/termios v0.1.1 // indirect + github.com/charmbracelet/x/windows v0.2.2 // indirect + github.com/clipperhouse/displaywidth v0.11.0 // indirect + github.com/clipperhouse/uax29/v2 v2.7.0 // indirect github.com/containerd/continuity v0.3.0 // indirect github.com/containerd/ttrpc v1.1.1 // indirect github.com/containerd/typeurl v1.0.2 // indirect @@ -102,7 +102,6 @@ require ( github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect github.com/docker/go-metrics v0.0.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect github.com/fatih/color v1.13.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect @@ -131,8 +130,7 @@ require ( github.com/lucasb-eyer/go-colorful v1.3.0 // indirect github.com/magiconair/properties v1.8.6 // indirect github.com/mattn/go-colorable v0.1.12 // indirect - github.com/mattn/go-localereader v0.0.1 // indirect - github.com/mattn/go-runewidth v0.0.19 // indirect + github.com/mattn/go-runewidth v0.0.20 // indirect github.com/mattn/go-shellwords v1.0.12 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/miekg/pkcs11 v1.1.1 // indirect @@ -148,10 +146,7 @@ require ( github.com/moby/term v0.0.0-20221120202655-abb19827d345 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect github.com/muesli/cancelreader v0.2.2 // indirect - github.com/muesli/reflow v0.3.0 // indirect - github.com/muesli/termenv v0.16.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect @@ -187,7 +182,7 @@ require ( golang.org/x/crypto v0.46.0 // indirect golang.org/x/mod v0.30.0 // indirect golang.org/x/oauth2 v0.34.0 // indirect - golang.org/x/sys v0.39.0 // indirect + golang.org/x/sys v0.41.0 // indirect golang.org/x/text v0.32.0 // indirect golang.org/x/time v0.1.0 // indirect golang.org/x/tools v0.39.0 // indirect diff --git a/go.sum b/go.sum index ccd92696..9b7779d9 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,14 @@ buf.build/gen/go/depot/api/connectrpc/go v1.15.0-20240221184445-e8316610338f.1 h buf.build/gen/go/depot/api/connectrpc/go v1.15.0-20240221184445-e8316610338f.1/go.mod h1:u3UQrhy7mXGU+2gMag3WeI7FZgLd2GsQxpWqt2ZSNvg= buf.build/gen/go/depot/api/protocolbuffers/go v1.32.0-20240221184445-e8316610338f.1 h1:kgC5f06snCbDMa9hN8DY5MEYSeQzBMSXXB3z4SUX5ao= buf.build/gen/go/depot/api/protocolbuffers/go v1.32.0-20240221184445-e8316610338f.1/go.mod h1:MP5BDdzxwFdhf/KEm27tKfz9dKjtC9C1kXdpuSOb09g= +charm.land/bubbles/v2 v2.0.0 h1:tE3eK/pHjmtrDiRdoC9uGNLgpopOd8fjhEe31B/ai5s= +charm.land/bubbles/v2 v2.0.0/go.mod h1:rCHoleP2XhU8um45NTuOWBPNVHxnkXKTiZqcclL/qOI= +charm.land/bubbletea/v2 v2.0.2 h1:4CRtRnuZOdFDTWSff9r8QFt/9+z6Emubz3aDMnf/dx0= +charm.land/bubbletea/v2 v2.0.2/go.mod h1:3LRff2U4WIYXy7MTxfbAQ+AdfM3D8Xuvz2wbsOD9OHQ= +charm.land/huh/v2 v2.0.0 h1:fvZlEc/PyLgl1fQrr1P30QW7CVY9k8Q1e+LD9jwMur8= +charm.land/huh/v2 v2.0.0/go.mod h1:0WOQ7ZIycEMUsvhcmBMda7tAGkEy9Tvvs6OreNllufA= +charm.land/lipgloss/v2 v2.0.0 h1:sd8N/B3x892oiOjFfBQdXBQp3cAkvjGaU5TvVZC3ivo= +charm.land/lipgloss/v2 v2.0.0/go.mod h1:w6SnmsBFBmEFBodiEDurGS/sdUY/u1+v72DqUzc6J14= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -111,10 +119,8 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.16.4 h1:+xtV90n3abQmgzk1pS++FdxZTrPE github.com/aws/aws-sdk-go-v2/service/sts v1.16.4/go.mod h1:lfSYenAXtavyX2A1LsViglqlG9eEFYxNryTZS5rn3QE= github.com/aws/smithy-go v1.11.2 h1:eG/N+CcUMAvsdffgMvjMKwfyDzIkjM6pfxMJ8Mzc6mE= github.com/aws/smithy-go v1.11.2/go.mod h1:3xHYmszWVx2c0kIwQeEVf9uSm4fYZt67FBJnwub1bgM= -github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= -github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= -github.com/aymanbagabas/go-udiff v0.3.1 h1:LV+qyBQ2pqe0u42ZsUEtPiCaUoqgA9gYRDs3vj1nolY= -github.com/aymanbagabas/go-udiff v0.3.1/go.mod h1:G0fsKmG+P6ylD0r6N/KgQD/nWzgfnl8ZBcNLgcbrw8E= +github.com/aymanbagabas/go-udiff v0.4.0 h1:TKnLPh7IbnizJIBKFWa9mKayRUBQ9Kh1BPCk6w2PnYM= +github.com/aymanbagabas/go-udiff v0.4.0/go.mod h1:0L9PGwj20lrtmEMeyw4WKJ/TMyDtvAoK9bf2u/mNo3w= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -139,46 +145,40 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/charmbracelet/bubbles v1.0.0 h1:12J8/ak/uCZEMQ6KU7pcfwceyjLlWsDLAxB5fXonfvc= -github.com/charmbracelet/bubbles v1.0.0/go.mod h1:9d/Zd5GdnauMI5ivUIVisuEm3ave1XwXtD1ckyV6r3E= -github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw= -github.com/charmbracelet/bubbletea v1.3.10/go.mod h1:ORQfo0fk8U+po9VaNvnV95UPWA1BitP1E0N6xJPlHr4= -github.com/charmbracelet/colorprofile v0.4.1 h1:a1lO03qTrSIRaK8c3JRxJDZOvhvIeSco3ej+ngLk1kk= -github.com/charmbracelet/colorprofile v0.4.1/go.mod h1:U1d9Dljmdf9DLegaJ0nGZNJvoXAhayhmidOdcBwAvKk= -github.com/charmbracelet/huh v0.7.0 h1:W8S1uyGETgj9Tuda3/JdVkc3x7DBLZYPZc4c+/rnRdc= -github.com/charmbracelet/huh v0.7.0/go.mod h1:UGC3DZHlgOKHvHC07a5vHag41zzhpPFj34U92sOmyuk= -github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY= -github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30= +github.com/charmbracelet/colorprofile v0.4.2 h1:BdSNuMjRbotnxHSfxy+PCSa4xAmz7szw70ktAtWRYrY= +github.com/charmbracelet/colorprofile v0.4.2/go.mod h1:0rTi81QpwDElInthtrQ6Ni7cG0sDtwAd4C4le060fT8= +github.com/charmbracelet/ultraviolet v0.0.0-20260205113103-524a6607adb8 h1:eyFRbAmexyt43hVfeyBofiGSEmJ7krjLOYt/9CF5NKA= +github.com/charmbracelet/ultraviolet v0.0.0-20260205113103-524a6607adb8/go.mod h1:SQpCTRNBtzJkwku5ye4S3HEuthAlGy2n9VXZnWkEW98= github.com/charmbracelet/x/ansi v0.11.6 h1:GhV21SiDz/45W9AnV2R61xZMRri5NlLnl6CVF7ihZW8= github.com/charmbracelet/x/ansi v0.11.6/go.mod h1:2JNYLgQUsyqaiLovhU2Rv/pb8r6ydXKS3NIttu3VGZQ= -github.com/charmbracelet/x/cellbuf v0.0.15 h1:ur3pZy0o6z/R7EylET877CBxaiE1Sp1GMxoFPAIztPI= -github.com/charmbracelet/x/cellbuf v0.0.15/go.mod h1:J1YVbR7MUuEGIFPCaaZ96KDl5NoS0DAWkskup+mOY+Q= -github.com/charmbracelet/x/conpty v0.1.0 h1:4zc8KaIcbiL4mghEON8D72agYtSeIgq8FSThSPQIb+U= -github.com/charmbracelet/x/conpty v0.1.0/go.mod h1:rMFsDJoDwVmiYM10aD4bH2XiRgwI7NYJtQgl5yskjEQ= +github.com/charmbracelet/x/conpty v0.1.1 h1:s1bUxjoi7EpqiXysVtC+a8RrvPPNcNvAjfi4jxsAuEs= +github.com/charmbracelet/x/conpty v0.1.1/go.mod h1:OmtR77VODEFbiTzGE9G1XiRJAga6011PIm4u5fTNZpk= github.com/charmbracelet/x/errors v0.0.0-20240508181413-e8d8b6e2de86 h1:JSt3B+U9iqk37QUU2Rvb6DSBYRLtWqFqfxf8l5hOZUA= github.com/charmbracelet/x/errors v0.0.0-20240508181413-e8d8b6e2de86/go.mod h1:2P0UgXMEa6TsToMSuFqKFQR+fZTO9CNGUNokkPatT/0= -github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payRxjMjKgx2PaCWLZ4p3ro9y97+TVLZNaRZgJwSVDQ= -github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= +github.com/charmbracelet/x/exp/golden v0.0.0-20250806222409-83e3a29d542f h1:pk6gmGpCE7F3FcjaOEKYriCvpmIN4+6OS/RD0vm4uIA= +github.com/charmbracelet/x/exp/golden v0.0.0-20250806222409-83e3a29d542f/go.mod h1:IfZAMTHB6XkZSeXUqriemErjAWCCzT0LwjKFYCZyw0I= +github.com/charmbracelet/x/exp/ordered v0.1.0 h1:55/qLwjIh0gL0Vni+QAWk7T/qRVP6sBf+2agPBgnOFE= +github.com/charmbracelet/x/exp/ordered v0.1.0/go.mod h1:5UHwmG+is5THxMyCJHNPCn2/ecI07aKNrW+LcResjJ8= github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0 h1:qko3AQ4gK1MTS/de7F5hPGx6/k1u0w4TeYmBFwzYVP4= github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0/go.mod h1:pBhA0ybfXv6hDjQUZ7hk1lVxBiUbupdw5R31yPUViVQ= github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk= github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI= github.com/charmbracelet/x/termios v0.1.1 h1:o3Q2bT8eqzGnGPOYheoYS8eEleT5ZVNYNy8JawjaNZY= github.com/charmbracelet/x/termios v0.1.1/go.mod h1:rB7fnv1TgOPOyyKRJ9o+AsTU/vK5WHJ2ivHeut/Pcwo= -github.com/charmbracelet/x/xpty v0.1.2 h1:Pqmu4TEJ8KeA9uSkISKMU3f+C1F6OGBn8ABuGlqCbtI= -github.com/charmbracelet/x/xpty v0.1.2/go.mod h1:XK2Z0id5rtLWcpeNiMYBccNNBrP2IJnzHI0Lq13Xzq4= +github.com/charmbracelet/x/windows v0.2.2 h1:IofanmuvaxnKHuV04sC0eBy/smG6kIKrWG2/jYn2GuM= +github.com/charmbracelet/x/windows v0.2.2/go.mod h1:/8XtdKZzedat74NQFn0NGlGL4soHB0YQZrETF96h75k= +github.com/charmbracelet/x/xpty v0.1.3 h1:eGSitii4suhzrISYH50ZfufV3v085BXQwIytcOdFSsw= +github.com/charmbracelet/x/xpty v0.1.3/go.mod h1:poPYpWuLDBFCKmKLDnhBp51ATa0ooD8FhypRwEFtH3Y= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/cli/safeexec v1.0.0 h1:0VngyaIyqACHdcMNWfo6+KdUYnqEr2Sg+bSP1pdF+dI= github.com/cli/safeexec v1.0.0/go.mod h1:Z/D4tTN8Vs5gXYHDCbaM1S/anmEDnJb1iW0+EJ5zx3Q= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/clipperhouse/displaywidth v0.9.0 h1:Qb4KOhYwRiN3viMv1v/3cTBlz3AcAZX3+y9OLhMtAtA= -github.com/clipperhouse/displaywidth v0.9.0/go.mod h1:aCAAqTlh4GIVkhQnJpbL0T/WfcrJXHcj8C0yjYcjOZA= -github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfatpWHKCs= -github.com/clipperhouse/stringish v0.1.1/go.mod h1:v/WhFtE1q0ovMta2+m+UbpZ+2/HEXNWYXQgCt4hdOzA= -github.com/clipperhouse/uax29/v2 v2.5.0 h1:x7T0T4eTHDONxFJsL94uKNKPHrclyFI0lm7+w94cO8U= -github.com/clipperhouse/uax29/v2 v2.5.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g= +github.com/clipperhouse/displaywidth v0.11.0 h1:lBc6kY44VFw+TDx4I8opi/EtL9m20WSEFgwIwO+UVM8= +github.com/clipperhouse/displaywidth v0.11.0/go.mod h1:bkrFNkf81G8HyVqmKGxsPufD3JhNl3dSqnGhOoSD/o0= +github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk= +github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= github.com/cloudflare/cfssl v0.0.0-20181213083726-b94e044bb51e h1:Qux+lbuMaRzkQyTdzgtz8MgzPtzmaPQy6DXmxpdxT3U= github.com/cloudflare/cfssl v0.0.0-20181213083726-b94e044bb51e/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= @@ -264,10 +264,6 @@ github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go. github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v1.3.0 h1:TvGH1wof4H33rezVKWSpqKz5NXWg5VPuZ0uONDT6eb4= github.com/envoyproxy/protoc-gen-validate v1.3.0/go.mod h1:HvYl7zwPa5mffgyeTUHA9zHIH36nmrm7oCbo4YKoSWA= -github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4= -github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM= -github.com/erikgeiser/promptkit v0.9.0 h1:3qL1mS/ntCrXdb8sTP/ka82CJ9kEQaGuYXNrYJkWYBc= -github.com/erikgeiser/promptkit v0.9.0/go.mod h1:pU9dtogSe3Jlc2AY77EP7R4WFP/vgD4v+iImC83KsCo= github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= @@ -493,11 +489,8 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= -github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88= -github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= -github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw= -github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= +github.com/mattn/go-runewidth v0.0.20 h1:WcT52H91ZUAwy8+HUkdM3THM6gXqXuLJi9O3rjcQQaQ= +github.com/mattn/go-runewidth v0.0.20/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk= github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -538,14 +531,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= -github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI= -github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= -github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= -github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= -github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= -github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -615,8 +602,6 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1 github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= -github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= @@ -920,7 +905,6 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -930,8 +914,8 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= -golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= +golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= diff --git a/pkg/api/auth.go b/pkg/api/auth.go index af5415f3..5ca71f2d 100644 --- a/pkg/api/auth.go +++ b/pkg/api/auth.go @@ -7,9 +7,9 @@ import ( "runtime" "time" + "charm.land/huh/v2" "connectrpc.com/connect" "github.com/briandowns/spinner" - "github.com/charmbracelet/huh" cliv1beta1 "github.com/depot/cli/pkg/proto/depot/cli/v1beta1" ) diff --git a/pkg/api/request.go b/pkg/api/request.go index 6de180ec..ea42c4bf 100644 --- a/pkg/api/request.go +++ b/pkg/api/request.go @@ -7,7 +7,7 @@ import ( "io" "net/http" - "github.com/charmbracelet/lipgloss" + "charm.land/lipgloss/v2" "github.com/pkg/errors" ) @@ -56,12 +56,12 @@ func apiRequest[Response interface{}](method, url, token string, payload interfa infoMessage := resp.Header.Get("X-Depot-Info-Message") if infoMessage != "" { - fmt.Println(infoStyle.Render(infoMessage)) + lipgloss.Println(infoStyle.Render(infoMessage)) } warnMessage := resp.Header.Get("X-Depot-Warn-Message") if warnMessage != "" { - fmt.Println(warnStyle.Render(warnMessage)) + lipgloss.Println(warnStyle.Render(warnMessage)) } body, err := io.ReadAll(resp.Body) diff --git a/pkg/cmd/ci/migrate.go b/pkg/cmd/ci/migrate.go index 7e7e712a..5e0a058c 100644 --- a/pkg/cmd/ci/migrate.go +++ b/pkg/cmd/ci/migrate.go @@ -11,9 +11,10 @@ import ( "strings" "time" + "charm.land/huh/v2" + "charm.land/lipgloss/v2" "connectrpc.com/connect" - "github.com/charmbracelet/huh" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/colorprofile" "github.com/depot/cli/pkg/api" "github.com/depot/cli/pkg/ci/compat" "github.com/depot/cli/pkg/ci/migrate" @@ -277,6 +278,7 @@ func preflight(ctx context.Context, opts migrateOptions) (*preflightResult, erro if out == nil { out = os.Stdout } + out = colorprofile.NewWriter(out, os.Environ()) bold := lipgloss.NewStyle().Bold(true) @@ -369,6 +371,7 @@ func workflows(opts migrateOptions) error { if out == nil { out = os.Stdout } + out = colorprofile.NewWriter(out, os.Environ()) bold := lipgloss.NewStyle().Bold(true) @@ -409,7 +412,7 @@ func workflows(opts migrateOptions) error { } greenStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("#30a46c")) - dimStyle := lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "#9B9B9B", Dark: "#5C5C5C"}) + dimStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("8")) // Split workflows into supported (has at least one supported trigger) and unsupported-only var supportedWorkflows, unsupportedWorkflows []*migrate.WorkflowFile @@ -421,6 +424,8 @@ func workflows(opts migrateOptions) error { } } + // Huh v2 subtracts the title from the inferred option height, so each + // multi-select includes that row explicitly. var groups []*huh.Group // Supported triggers group @@ -439,6 +444,7 @@ func workflows(opts migrateOptions) error { huh.NewMultiSelect[string](). Title("These workflows have supported triggers. Which should we migrate?"). Options(opts...). + Height(len(opts)+1). Value(&selectedSupported), )) } @@ -455,6 +461,7 @@ func workflows(opts migrateOptions) error { huh.NewMultiSelect[string](). Title("These workflows have unsupported triggers. Migrate anyway?"). Options(opts...). + Height(len(opts)+1). Value(&selectedUnsupported), )) } diff --git a/pkg/cmd/ci/picker.go b/pkg/cmd/ci/picker.go index df4fe50d..eb45aa79 100644 --- a/pkg/cmd/ci/picker.go +++ b/pkg/cmd/ci/picker.go @@ -12,10 +12,10 @@ import ( "io" "strings" - "github.com/charmbracelet/bubbles/key" - "github.com/charmbracelet/bubbles/list" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" + "charm.land/bubbles/v2/key" + "charm.land/bubbles/v2/list" + tea "charm.land/bubbletea/v2" + "charm.land/lipgloss/v2" "github.com/charmbracelet/x/ansi" ) @@ -23,7 +23,6 @@ import ( var ( depotGreen = lipgloss.Color("#30a46c") depotGreenLight = lipgloss.Color("#3cb179") - dimColor = lipgloss.AdaptiveColor{Light: "#9B9B9B", Dark: "#5C5C5C"} ) // PickJobItem is the data that the picker displays for each selectable job. @@ -44,10 +43,12 @@ func PickJob(items []PickJobItem) (int, error) { listItems[i] = item } - delegate := newJobDelegate() + delegate := newJobDelegate(true) l := list.New(listItems, delegate, 72, min(len(items)+6, 20)) l.Title = "Select a job" - l.Styles = depotListStyles() + styles := depotListStyles(true) + l.Styles = styles + l.FilterInput.SetStyles(styles.Filter) l.SetFilteringEnabled(true) l.SetShowStatusBar(false) l.SetShowHelp(true) @@ -80,7 +81,7 @@ type pickerModel struct { } func (m pickerModel) Init() tea.Cmd { - return nil + return tea.RequestBackgroundColor } func (m pickerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { @@ -88,7 +89,13 @@ func (m pickerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { case tea.WindowSizeMsg: m.list.SetSize(msg.Width, msg.Height) return m, nil - case tea.KeyMsg: + case tea.BackgroundColorMsg: + styles := depotListStyles(msg.IsDark()) + m.list.Styles = styles + m.list.FilterInput.SetStyles(styles.Filter) + m.list.SetDelegate(newJobDelegate(msg.IsDark())) + return m, nil + case tea.KeyPressMsg: // Only intercept keys when not actively filtering — otherwise // enter/esc need to reach the inner list to confirm/cancel the filter. if m.list.FilterState() != list.Filtering { @@ -111,8 +118,8 @@ func (m pickerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, cmd } -func (m pickerModel) View() string { - return m.list.View() +func (m pickerModel) View() tea.View { + return tea.NewView(m.list.View()) } // jobDelegate is a single-line item delegate that renders each job as: @@ -128,17 +135,18 @@ type jobDelegate struct { filterMatch lipgloss.Style } -func newJobDelegate() jobDelegate { +func newJobDelegate(isDark bool) jobDelegate { + lightDark := lipgloss.LightDark(isDark) return jobDelegate{ normalStyle: lipgloss.NewStyle(). - Foreground(lipgloss.AdaptiveColor{Light: "#1a1a1a", Dark: "#dddddd"}). + Foreground(lightDark(lipgloss.Color("#1a1a1a"), lipgloss.Color("#dddddd"))). Padding(0, 0, 0, 2), selectedStyle: lipgloss.NewStyle(). Foreground(depotGreen). Bold(true). Padding(0, 0, 0, 1), dimStyle: lipgloss.NewStyle(). - Foreground(dimColor), + Foreground(lightDark(lipgloss.Color("#9B9B9B"), lipgloss.Color("#5C5C5C"))), cursorStyle: lipgloss.NewStyle(). Foreground(depotGreen). SetString("▸ "), @@ -201,8 +209,8 @@ func (d jobDelegate) Render(w io.Writer, m list.Model, index int, item list.Item } // depotListStyles returns list-level styles themed with Depot green. -func depotListStyles() list.Styles { - s := list.DefaultStyles() +func depotListStyles(isDark bool) list.Styles { + s := list.DefaultStyles(isDark) s.TitleBar = lipgloss.NewStyle().Padding(0, 0, 1, 0) @@ -210,11 +218,10 @@ func depotListStyles() list.Styles { Foreground(depotGreen). Bold(true) - s.FilterPrompt = lipgloss.NewStyle(). - Foreground(depotGreen) - - s.FilterCursor = lipgloss.NewStyle(). - Foreground(depotGreenLight) + filterPrompt := lipgloss.NewStyle().Foreground(depotGreen) + s.Filter.Focused.Prompt = filterPrompt + s.Filter.Blurred.Prompt = filterPrompt + s.Filter.Cursor.Color = depotGreenLight s.DefaultFilterCharacterMatch = lipgloss.NewStyle(). Foreground(depotGreen). diff --git a/pkg/cmd/claude/listsessions.go b/pkg/cmd/claude/listsessions.go index aad54734..4fa5cec7 100644 --- a/pkg/cmd/claude/listsessions.go +++ b/pkg/cmd/claude/listsessions.go @@ -10,10 +10,10 @@ import ( "strings" "time" + "charm.land/bubbles/v2/list" + tea "charm.land/bubbletea/v2" + "charm.land/lipgloss/v2" "connectrpc.com/connect" - "github.com/charmbracelet/bubbles/list" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" "github.com/depot/cli/pkg/api" "github.com/depot/cli/pkg/config" "github.com/depot/cli/pkg/helpers" @@ -185,13 +185,13 @@ func chooseSession(sessions []*agentv1.Session) (*agentv1.Session, error) { } m := sessionListModel{ - list: list.New(items, list.NewDefaultDelegate(), 0, 0), + list: list.New(items, sessionDelegate(true), 0, 0), sessions: sessions, ctrlC: false, } m.list.Title = "Choose a Claude session" - p := tea.NewProgram(m, tea.WithAltScreen()) + p := tea.NewProgram(m) final, err := p.Run() if err != nil { @@ -252,12 +252,12 @@ type sessionListModel struct { } func (m sessionListModel) Init() tea.Cmd { - return nil + return tea.RequestBackgroundColor } func (m sessionListModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { switch msg := msg.(type) { - case tea.KeyMsg: + case tea.KeyPressMsg: if msg.String() == "ctrl+c" { m.ctrlC = true return m, tea.Quit @@ -272,6 +272,11 @@ func (m sessionListModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { case tea.WindowSizeMsg: h, v := docStyle.GetFrameSize() m.list.SetSize(msg.Width-h, msg.Height-v) + case tea.BackgroundColorMsg: + styles := list.DefaultStyles(msg.IsDark()) + m.list.Styles = styles + m.list.FilterInput.SetStyles(styles.Filter) + m.list.SetDelegate(sessionDelegate(msg.IsDark())) } var cmd tea.Cmd @@ -279,8 +284,16 @@ func (m sessionListModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, cmd } -func (m sessionListModel) View() string { - return docStyle.Render(m.list.View()) +func (m sessionListModel) View() tea.View { + v := tea.NewView(docStyle.Render(m.list.View())) + v.AltScreen = true + return v +} + +func sessionDelegate(isDark bool) list.DefaultDelegate { + d := list.NewDefaultDelegate() + d.Styles = list.NewDefaultItemStyles(isDark) + return d } func sessionWriteJSON(sessions []*agentv1.Session) error { diff --git a/pkg/cmd/image/list.go b/pkg/cmd/image/list.go index b1c4a59f..1b15d0e0 100644 --- a/pkg/cmd/image/list.go +++ b/pkg/cmd/image/list.go @@ -9,10 +9,10 @@ import ( "sort" "time" + "charm.land/bubbles/v2/table" + tea "charm.land/bubbletea/v2" + "charm.land/lipgloss/v2" "connectrpc.com/connect" - "github.com/charmbracelet/bubbles/table" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" "github.com/depot/cli/pkg/api" "github.com/depot/cli/pkg/helpers" v1 "github.com/depot/cli/pkg/proto/depot/build/v1" @@ -111,7 +111,7 @@ func NewCmdList() *cobra.Command { token: token, } - _, err = tea.NewProgram(m, tea.WithAltScreen()).Run() + _, err = tea.NewProgram(m).Run() return err }, } @@ -242,12 +242,8 @@ func (m imagesModel) Init() tea.Cmd { func (m imagesModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { var cmd tea.Cmd switch msg := msg.(type) { - case tea.KeyMsg: - if msg.Type == tea.KeyCtrlC || msg.Type == tea.KeyEsc { - return m, tea.Quit - } - - if msg.String() == "q" { + case tea.KeyPressMsg: + if msg.String() == "ctrl+c" || msg.String() == "esc" || msg.String() == "q" { return m, tea.Quit } @@ -287,12 +283,14 @@ func (m *imagesModel) resizeTable(msg tea.WindowSizeMsg) { } } -func (m imagesModel) View() string { +func (m imagesModel) View() tea.View { s := baseStyle.Render(m.imagesTable.View()) + "\n" if m.err != nil { s = "Error: " + m.err.Error() + "\n" } - return s + v := tea.NewView(s) + v.AltScreen = true + return v } type imageRows []table.Row diff --git a/pkg/cmd/list/builds.go b/pkg/cmd/list/builds.go index 72aa64bd..a6707ffa 100644 --- a/pkg/cmd/list/builds.go +++ b/pkg/cmd/list/builds.go @@ -7,7 +7,7 @@ import ( "os" "time" - tea "github.com/charmbracelet/bubbletea" + tea "charm.land/bubbletea/v2" "github.com/depot/cli/pkg/api" "github.com/depot/cli/pkg/helpers" "github.com/pkg/errors" @@ -63,7 +63,7 @@ func NewCmdBuilds() *cobra.Command { } m := helpers.NewBuildsModel(projectID, token, client) - _, err = tea.NewProgram(m, tea.WithAltScreen()).Run() + _, err = tea.NewProgram(m).Run() return err }, } diff --git a/pkg/cmd/list/projects.go b/pkg/cmd/list/projects.go index 477981ec..4d3533fd 100644 --- a/pkg/cmd/list/projects.go +++ b/pkg/cmd/list/projects.go @@ -9,10 +9,10 @@ import ( "os" "time" + "charm.land/bubbles/v2/table" + tea "charm.land/bubbletea/v2" + "charm.land/lipgloss/v2" "connectrpc.com/connect" - "github.com/charmbracelet/bubbles/table" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" "github.com/depot/cli/pkg/api" "github.com/depot/cli/pkg/helpers" cliv1beta1 "github.com/depot/cli/pkg/proto/depot/cli/v1beta1" @@ -96,7 +96,7 @@ func NewCmdProjects(commandName, commandAlias string) *cobra.Command { token: token, } - _, err = tea.NewProgram(m, tea.WithAltScreen()).Run() + _, err = tea.NewProgram(m).Run() return err }, } @@ -128,7 +128,7 @@ func (m projectsModel) Init() tea.Cmd { func (m projectsModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { if m.state == "builds" { - if keyMsg, ok := msg.(tea.KeyMsg); ok && keyMsg.Type == tea.KeyEsc { + if keyMsg, ok := msg.(tea.KeyPressMsg); ok && keyMsg.String() == "esc" { // Return to projects m.state = "projects" } else { @@ -144,8 +144,8 @@ func (m projectsModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { var cmd tea.Cmd switch msg := msg.(type) { - case tea.KeyMsg: - if msg.Type == tea.KeyCtrlC { + case tea.KeyPressMsg: + if msg.String() == "ctrl+c" { return m, tea.Quit } @@ -157,7 +157,7 @@ func (m projectsModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, m.loadProjects() } - if msg.Type == tea.KeyEnter { + if msg.String() == "enter" { m.state = "builds" m.builds.ProjectID = m.projectsTable.SelectedRow()[0] cmd = m.builds.Init() @@ -195,7 +195,7 @@ func (m *projectsModel) resizeProjectTable(msg tea.WindowSizeMsg) { m.projectsTable.SetColumns(m.columns) } -func (m projectsModel) View() string { +func (m projectsModel) View() tea.View { if m.state == "builds" { return m.builds.View() } @@ -205,7 +205,9 @@ func (m projectsModel) View() string { s = "Error: " + m.err.Error() + "\n" } - return s + v := tea.NewView(s) + v.AltScreen = true + return v } type projects []table.Row diff --git a/pkg/cmd/list/ui.go b/pkg/cmd/list/ui.go index 8ae30a44..92b0380f 100644 --- a/pkg/cmd/list/ui.go +++ b/pkg/cmd/list/ui.go @@ -1,8 +1,6 @@ package list -import ( - "github.com/charmbracelet/lipgloss" -) +import "charm.land/lipgloss/v2" // Shared list UI code. diff --git a/pkg/cmd/org/list.go b/pkg/cmd/org/list.go index 85d69e6f..7f3d29ae 100644 --- a/pkg/cmd/org/list.go +++ b/pkg/cmd/org/list.go @@ -5,9 +5,9 @@ import ( "encoding/json" "os" - "github.com/charmbracelet/bubbles/table" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" + "charm.land/bubbles/v2/table" + tea "charm.land/bubbletea/v2" + "charm.land/lipgloss/v2" "github.com/depot/cli/pkg/helpers" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -79,7 +79,7 @@ func NewCmdList() *cobra.Command { table: t, columns: columns, } - p := tea.NewProgram(m, tea.WithAltScreen()) + p := tea.NewProgram(m) _, err = p.Run() return err }, @@ -104,7 +104,7 @@ func (m model) Init() tea.Cmd { func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { var cmd tea.Cmd switch msg := msg.(type) { - case tea.KeyMsg: + case tea.KeyPressMsg: switch msg.String() { case "q", "ctrl+c", "esc": return m, tea.Quit @@ -127,12 +127,14 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, cmd } -func (m model) View() string { +func (m model) View() tea.View { s := baseStyle.Render(m.table.View()) + "\n" if m.err != nil { s = "Error: " + m.err.Error() + "\n" } - return s + v := tea.NewView(s) + v.AltScreen = true + return v } func writeCSV(orgs []*helpers.Organization) error { diff --git a/pkg/cmd/projects/delete.go b/pkg/cmd/projects/delete.go index 804f8644..4303e0e2 100644 --- a/pkg/cmd/projects/delete.go +++ b/pkg/cmd/projects/delete.go @@ -4,8 +4,8 @@ import ( "fmt" v1 "buf.build/gen/go/depot/api/protocolbuffers/go/depot/core/v1" + "charm.land/huh/v2" "connectrpc.com/connect" - "github.com/charmbracelet/huh" "github.com/depot/cli/pkg/api" "github.com/depot/cli/pkg/helpers" "github.com/spf13/cobra" diff --git a/pkg/helpers/buildlist.go b/pkg/helpers/buildlist.go index 8a5b40db..4f9605af 100644 --- a/pkg/helpers/buildlist.go +++ b/pkg/helpers/buildlist.go @@ -9,10 +9,10 @@ import ( "strings" "time" + "charm.land/bubbles/v2/table" + tea "charm.land/bubbletea/v2" + "charm.land/lipgloss/v2" "connectrpc.com/connect" - "github.com/charmbracelet/bubbles/table" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" "github.com/depot/cli/pkg/api" cliv1 "github.com/depot/cli/pkg/proto/depot/cli/v1" "github.com/depot/cli/pkg/proto/depot/cli/v1/cliv1connect" @@ -22,7 +22,7 @@ import ( func SelectBuildID(ctx context.Context, token, projectID string, client cliv1connect.BuildServiceClient) (string, error) { m := NewBuildsModel(projectID, token, client) - final, err := tea.NewProgram(m, tea.WithAltScreen()).Run() + final, err := tea.NewProgram(m).Run() if err != nil { return "", err } @@ -91,12 +91,8 @@ func (m BuildsModel) Init() tea.Cmd { func (m BuildsModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { var cmd tea.Cmd switch msg := msg.(type) { - case tea.KeyMsg: - if msg.Type == tea.KeyCtrlC || msg.Type == tea.KeyEsc { - return m, tea.Quit - } - - if msg.String() == "q" { + case tea.KeyPressMsg: + if msg.String() == "ctrl+c" || msg.String() == "esc" || msg.String() == "q" { return m, tea.Quit } @@ -157,13 +153,15 @@ func (m BuildsModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, cmd } -func (m BuildsModel) View() string { +func (m BuildsModel) View() tea.View { s := baseStyle.Render(m.table.View()) + "\n" if m.err != nil { s = "Error: " + m.err.Error() + "\n" } - return s + v := tea.NewView(s) + v.AltScreen = true + return v } type buildRows []table.Row diff --git a/pkg/helpers/onboarding.go b/pkg/helpers/onboarding.go index 1ba2fc98..3bcff39f 100644 --- a/pkg/helpers/onboarding.go +++ b/pkg/helpers/onboarding.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/erikgeiser/promptkit/confirmation" + "charm.land/huh/v2" ) // OnboardProject initializes a depot.json and saves it at the CWD if the user confirms. @@ -33,16 +33,11 @@ func ConfirmSaveProject(p *SelectedProject) bool { prompt := fmt.Sprintf("Selected project %s (%s)\nCreate a depot.json file to remember this project for future builds?", p.Name, p.ID) - input := confirmation.New(prompt, confirmation.NewValue(true)) - input.Template = confirmation.TemplateArrow - input.ResultTemplate = confirmation.ResultTemplateArrow - - // vim - input.KeyMap.SelectYes = append(input.KeyMap.SelectYes, "h") - input.KeyMap.SelectNo = append(input.KeyMap.SelectNo, "l") - - shouldSave, err := input.RunPrompt() - if err != nil { + shouldSave := true + if err := huh.NewConfirm(). + Title(prompt). + Value(&shouldSave). + Run(); err != nil { return false } diff --git a/pkg/helpers/organization.go b/pkg/helpers/organization.go index df0a8fb6..3ea82c79 100644 --- a/pkg/helpers/organization.go +++ b/pkg/helpers/organization.go @@ -5,8 +5,8 @@ import ( "errors" "fmt" + "charm.land/huh/v2" "connectrpc.com/connect" - "github.com/charmbracelet/huh" "github.com/depot/cli/pkg/api" "github.com/depot/cli/pkg/config" corev1 "github.com/depot/cli/pkg/proto/depot/core/v1" @@ -65,6 +65,7 @@ func SelectOrganization() (*Organization, error) { err = huh.NewSelect[*Organization](). Title("Select an organization"). Options(huhOptions...). + Height(len(huhOptions) + 1). Value(&selectedOrg). Run() if err != nil { diff --git a/pkg/helpers/project.go b/pkg/helpers/project.go index f69e4811..f7d9d9c9 100644 --- a/pkg/helpers/project.go +++ b/pkg/helpers/project.go @@ -8,11 +8,11 @@ import ( "path/filepath" "strings" + "charm.land/bubbles/v2/list" + tea "charm.land/bubbletea/v2" + "charm.land/huh/v2" + "charm.land/lipgloss/v2" "connectrpc.com/connect" - "github.com/charmbracelet/bubbles/list" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/huh" - "github.com/charmbracelet/lipgloss" "github.com/depot/cli/pkg/api" "github.com/depot/cli/pkg/project" cliv1beta1 "github.com/depot/cli/pkg/proto/depot/cli/v1beta1" @@ -211,10 +211,10 @@ func chooseProjectID(projects *cliv1beta1.ListProjectsResponse) (string, error) items = append(items, item{id: p.Id, title: p.Name, desc: p.OrgName}) } - m := model{list: list.New(items, list.NewDefaultDelegate(), 0, 0), ctrlC: false} + m := model{list: list.New(items, projectDelegate(true), 0, 0), ctrlC: false} m.list.Title = "Choose a project" - p := tea.NewProgram(m, tea.WithAltScreen()) + p := tea.NewProgram(m) final, err := p.Run() if err != nil { @@ -254,12 +254,12 @@ type model struct { } func (m model) Init() tea.Cmd { - return nil + return tea.RequestBackgroundColor } func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { switch msg := msg.(type) { - case tea.KeyMsg: + case tea.KeyPressMsg: if msg.String() == "ctrl+c" { m.ctrlC = true return m, tea.Quit @@ -274,6 +274,11 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { case tea.WindowSizeMsg: h, v := docStyle.GetFrameSize() m.list.SetSize(msg.Width-h, msg.Height-v) + case tea.BackgroundColorMsg: + styles := list.DefaultStyles(msg.IsDark()) + m.list.Styles = styles + m.list.FilterInput.SetStyles(styles.Filter) + m.list.SetDelegate(projectDelegate(msg.IsDark())) } var cmd tea.Cmd @@ -281,8 +286,16 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, cmd } -func (m model) View() string { - return docStyle.Render(m.list.View()) +func (m model) View() tea.View { + v := tea.NewView(docStyle.Render(m.list.View())) + v.AltScreen = true + return v +} + +func projectDelegate(isDark bool) list.DefaultDelegate { + d := list.NewDefaultDelegate() + d.Styles = list.NewDefaultItemStyles(isDark) + return d } // SelectProject allows selecting a project using huh library @@ -302,6 +315,7 @@ func SelectProject(projects []*cliv1beta1.ListProjectsResponse_Project) (string, huh.NewSelect[string](). Title("Choose a project"). Options(options...). + Height(len(options) + 1). Value(&selectedID), ), )