tui: show no-yolo status tag
- commit
- 5a64f879180bd30811fee2eac6801208d0fed472
- author
- patriceckhart · · 2026-05-03 17:38 UTC
- parent
- 6ba41f2
- signature
- unsigned
- refs
- tag: v0.1.47
3 files · +25 -2
M internal/agent/modes/interactive.go +1 -0
| @@ -834,6 +834,7 @@ func (i *Interactive) redraw() { | |||
| 834 | 834 | BusyPrefix: busyPrefix, | |
| 835 | 835 | CWD: i.cfg.CWD, | |
| 836 | 836 | Locked: i.cfg.Sandbox.Locked(), | |
| 837 | + | NoYolo: i.cfg.NoYolo, | |
| 837 | 838 | Usage: i.cumUsage, | |
| 838 | 839 | Subscription: i.cfg.AuthMethod == "oauth", | |
| 839 | 840 | ContextUsed: i.lastCtxInput, | |
| @@ -834,6 +834,7 @@ func (i *Interactive) redraw() { | |||||
| 834 | BusyPrefix: busyPrefix, | 834 | BusyPrefix: busyPrefix, | ||
| 835 | CWD: i.cfg.CWD, | 835 | CWD: i.cfg.CWD, | ||
| 836 | Locked: i.cfg.Sandbox.Locked(), | 836 | Locked: i.cfg.Sandbox.Locked(), | ||
| 837 | + | NoYolo: i.cfg.NoYolo, | |||
| 837 | Usage: i.cumUsage, | 838 | Usage: i.cumUsage, | ||
| 838 | Subscription: i.cfg.AuthMethod == "oauth", | 839 | Subscription: i.cfg.AuthMethod == "oauth", | ||
| 839 | ContextUsed: i.lastCtxInput, | 840 | ContextUsed: i.lastCtxInput, | ||
M internal/tui/statusbar_test.go +18 -0
| @@ -56,3 +56,21 @@ func TestStatusBarNoCWD(t *testing.T) { | |||
| 56 | 56 | t.Fatalf("empty cwd: want 1 line, got %d: %q", len(lines), lines) | |
| 57 | 57 | } | |
| 58 | 58 | } | |
| 59 | + | ||
| 60 | + | func TestStatusBarNoYoloTagPrecedesCWD(t *testing.T) { | |
| 61 | + | lines := StatusBar(StatusBarParams{ | |
| 62 | + | Theme: Dark, | |
| 63 | + | Provider: "openai", | |
| 64 | + | Model: "gpt-5.5", | |
| 65 | + | CWD: "/tmp/x", | |
| 66 | + | NoYolo: true, | |
| 67 | + | Cols: 200, | |
| 68 | + | }) | |
| 69 | + | if len(lines) != 2 { | |
| 70 | + | t.Fatalf("want 2 lines, got %d: %q", len(lines), lines) | |
| 71 | + | } | |
| 72 | + | plain := stripANSI(lines[1]) | |
| 73 | + | if !strings.Contains(plain, "yolo mode disabled - /tmp/x") { | |
| 74 | + | t.Fatalf("cwd line should include no-yolo tag before cwd, got %q", plain) | |
| 75 | + | } | |
| 76 | + | } | |
| @@ -56,3 +56,21 @@ func TestStatusBarNoCWD(t *testing.T) { | |||||
| 56 | t.Fatalf("empty cwd: want 1 line, got %d: %q", len(lines), lines) | 56 | t.Fatalf("empty cwd: want 1 line, got %d: %q", len(lines), lines) | ||
| 57 | } | 57 | } | ||
| 58 | } | 58 | } | ||
| 59 | + | ||||
| 60 | + | func TestStatusBarNoYoloTagPrecedesCWD(t *testing.T) { | |||
| 61 | + | lines := StatusBar(StatusBarParams{ | |||
| 62 | + | Theme: Dark, | |||
| 63 | + | Provider: "openai", | |||
| 64 | + | Model: "gpt-5.5", | |||
| 65 | + | CWD: "/tmp/x", | |||
| 66 | + | NoYolo: true, | |||
| 67 | + | Cols: 200, | |||
| 68 | + | }) | |||
| 69 | + | if len(lines) != 2 { | |||
| 70 | + | t.Fatalf("want 2 lines, got %d: %q", len(lines), lines) | |||
| 71 | + | } | |||
| 72 | + | plain := stripANSI(lines[1]) | |||
| 73 | + | if !strings.Contains(plain, "yolo mode disabled - /tmp/x") { | |||
| 74 | + | t.Fatalf("cwd line should include no-yolo tag before cwd, got %q", plain) | |||
| 75 | + | } | |||
| 76 | + | } | |||
M internal/tui/view.go +6 -2
| @@ -1716,6 +1716,7 @@ type StatusBarParams struct { | |||
| 1716 | 1716 | BusyPrefix string // spinner + funny line when busy | |
| 1717 | 1717 | CWD string | |
| 1718 | 1718 | Locked bool // sandbox on? | |
| 1719 | + | NoYolo bool // confirmation mode enabled? | |
| 1719 | 1720 | ||
| 1720 | 1721 | // Cumulative session usage and cost. | |
| 1721 | 1722 | Usage provider.Usage | |
| @@ -1836,11 +1837,14 @@ func StatusBar(p StatusBarParams) []string { | |||
| 1836 | 1837 | ||
| 1837 | 1838 | cwd := shortenHome(p.CWD) | |
| 1838 | 1839 | tags := "" | |
| 1840 | + | if p.NoYolo { | |
| 1841 | + | tags += "yolo mode disabled " | |
| 1842 | + | } | |
| 1839 | 1843 | if p.Locked { | |
| 1840 | - | tags += "- jailed " | |
| 1844 | + | tags += "jailed " | |
| 1841 | 1845 | } | |
| 1842 | 1846 | if p.Telegram { | |
| 1843 | - | tags += "- tg " | |
| 1847 | + | tags += "telegram connected " | |
| 1844 | 1848 | } | |
| 1845 | 1849 | if tags != "" && cwd != "" { | |
| 1846 | 1850 | cwd = tags + "- " + cwd | |
| @@ -1716,6 +1716,7 @@ type StatusBarParams struct { | |||||
| 1716 | BusyPrefix string // spinner + funny line when busy | 1716 | BusyPrefix string // spinner + funny line when busy | ||
| 1717 | CWD string | 1717 | CWD string | ||
| 1718 | Locked bool // sandbox on? | 1718 | Locked bool // sandbox on? | ||
| 1719 | + | NoYolo bool // confirmation mode enabled? | |||
| 1719 | 1720 | ||||
| 1720 | // Cumulative session usage and cost. | 1721 | // Cumulative session usage and cost. | ||
| 1721 | Usage provider.Usage | 1722 | Usage provider.Usage | ||
| @@ -1836,11 +1837,14 @@ func StatusBar(p StatusBarParams) []string { | |||||
| 1836 | 1837 | ||||
| 1837 | cwd := shortenHome(p.CWD) | 1838 | cwd := shortenHome(p.CWD) | ||
| 1838 | tags := "" | 1839 | tags := "" | ||
| 1840 | + | if p.NoYolo { | |||
| 1841 | + | tags += "yolo mode disabled " | |||
| 1842 | + | } | |||
| 1839 | if p.Locked { | 1843 | if p.Locked { | ||
| 1840 | - | tags += "- jailed " | 1844 | + | tags += "jailed " |
| 1841 | } | 1845 | } | ||
| 1842 | if p.Telegram { | 1846 | if p.Telegram { | ||
| 1843 | - | tags += "- tg " | 1847 | + | tags += "telegram connected " |
| 1844 | } | 1848 | } | ||
| 1845 | if tags != "" && cwd != "" { | 1849 | if tags != "" && cwd != "" { | ||
| 1846 | cwd = tags + "- " + cwd | 1850 | cwd = tags + "- " + cwd | ||