Merge pull request #1673 from entireio/nina/palette-remaining-huh-forms · Entire
Merge pull request #1673 from entireio/nina/palette-remaining-huh-forms
99b82cf→main· computermode·1w ago·4 files·+13 added/-26 removed
Route remaining huh forms through the base16 palette theme
Changes
4
cmd/entire/cli
strategy
Mmanual_commit_opf_prompt.go+9/-11
Mmanual_commit_reset.go-7
Mmanual_commit_rewind.go+2/-4
versioncheck
Mautoupdate.go+2/-4
13 unmodified lines
14
15
16
17
18
19
20
50 unmodified lines
71
72
73
73
74
75
76
77
8 unmodified lines
86
87
88
88
89
90
91
92
89
90
91
92
93
94
95
96
97
98
99
99
100
101
102
103
5 unmodified lines
109
110
111
111
112
113
114
112
113
114
115
13 unmodified lines
"github.com/entireio/cli/cmd/entire/cli/interactive"
"github.com/entireio/cli/cmd/entire/cli/logging"
"github.com/entireio/cli/cmd/entire/cli/settings"
"github.com/entireio/cli/cmd/entire/cli/uiform"
// OPFDecision is the resolved gate for a single pre-push OPF run.
50 unmodified lines
os.Getenv(envOPF),
promptDefault,
hasTTY,
func() (OPFDecision, error) { return askOPFPrompt(ctx, isAccessibleMode()) },
func() (OPFDecision, error) { return askOPFPrompt(ctx) },
)
if err != nil {
return OPFAbort, err
8 unmodified lines
// OPFAbort. Selecting "Always" persists prompt_default=always to
// .entire/settings.local.json so future pushes don't ask.
//
// Style matches other entire CLI prompts: Dracula theme via
// huh.ThemeDracula (the same theme cli.NewAccessibleForm applies for
// callers in the cli package). Strategy can't import cli (cycle), so
// we apply the theme inline.
func askOPFPrompt(ctx context.Context, accessible bool) (OPFDecision, error) {
// Style matches other entire CLI prompts via uiform.New, which applies the
// shared base16 palette theme and accessibility handling (the same wiring
// cli.NewAccessibleForm uses). uiform is a leaf package, so strategy can
// import it without the cycle that importing cli would create.
func askOPFPrompt(ctx context.Context) (OPFDecision, error) {
const (
choiceYes = "yes"
choiceNo = "no"
choiceAlways = "always"
)
choice := choiceYes
form := huh.NewForm(
form := uiform.New(
huh.NewGroup(
huh.NewSelect[string]().
Title("Run OpenAI Privacy Filter on these checkpoints?").
5 unmodified lines
).
Value(&choice),
),
).WithTheme(huh.ThemeFunc(huh.ThemeDracula))
if accessible {
form = form.WithAccessible(true)
}
)
if err := form.RunWithContext(ctx); err != nil {
if errors.Is(err, huh.ErrUserAborted) {
return OPFAbort, nil
Mcmd/entire/cli/strategy/manual_commit_opf_prompt.go+9/-11
3 unmodified lines
4 5 6 7 7 8 9 10 11 12 14 15 16 17 18 19 13 14 15
3 unmodified lines
"context" "fmt" "io" "os"
"github.com/entireio/cli/cmd/entire/cli/paths"
"github.com/go-git/go-git/v6/plumbing"
// isAccessibleMode returns true if accessibility mode should be enabled. // This checks the ACCESSIBLE environment variable. func isAccessibleMode() bool { return os.Getenv("ACCESSIBLE") != "" }
// Reset deletes the shadow branch and session state for the current HEAD. // This allows starting fresh without existing checkpoints. func (s *ManualCommitStrategy) Reset(ctx context.Context, w, errW io.Writer) error {
Mcmd/entire/cli/strategy/manual_commit_reset.go-7
19 unmodified lines
20 21 22 23 24 25 26 1036 unmodified lines
1063 1064 1065 1065 1066 1067 1068 1069 1070 1071 1072 1072 1073 1074 1073 1074 1075
19 unmodified lines
"github.com/entireio/cli/cmd/entire/cli/osroot" "github.com/entireio/cli/cmd/entire/cli/paths" "github.com/entireio/cli/cmd/entire/cli/trailers" "github.com/entireio/cli/cmd/entire/cli/uiform" "github.com/entireio/cli/cmd/entire/cli/validation"
"charm.land/huh/v2" 1036 unmodified lines
fmt.Fprintf(errW, "\nOverwriting will lose the newer local entries.\n\n")
var confirmed bool form := huh.NewForm( form := uiform.New( huh.NewGroup( huh.NewConfirm(). Title("Overwrite local session logs with checkpoint versions?"). Value(&confirmed), ), ) if isAccessibleMode() { form = form.WithAccessible(true) }
if err := form.Run(); err != nil { if errors.Is(err, huh.ErrUserAborted) {
Mcmd/entire/cli/strategy/manual_commit_rewind.go+2/-4
12 unmodified lines
13 14 15 16 17 18 19 95 unmodified lines
115 116 117 117 118 119 120 118 119 120 121
12 unmodified lines
"github.com/entireio/cli/cmd/entire/cli/interactive" "github.com/entireio/cli/cmd/entire/cli/logging" "github.com/entireio/cli/cmd/entire/cli/uiform"
// envKillSwitch disables the interactive update prompt regardless of TTY. 95 unmodified lines
huh.NewOption("Skip until next version", autoUpdateActionSkipUntilNextVersion), ). .Value(&action) form := huh.NewForm(huh.NewGroup(sel)).WithTheme(huh.ThemeFunc(huh.ThemeDracula)) if os.Getenv("ACCESSIBLE") != "" { form = form.WithAccessible(true) } form := uiform.New(huh.NewGroup(sel)) if err := form.RunWithContext(ctx); err != nil { if errors.Is(err, huh.ErrUserAborted) || errors.Is(err, huh.ErrTimeout) { return autoUpdateActionSkip, nil