v0.3.71 0dbbc58

settings_store_test.go RawHistoryFolder

1package agent
2
3import "testing"
4
5func TestConfigSettingsStorePersistsShowInstructionsAtStartup(t *testing.T) {
6	t.Setenv("ZOT_HOME", t.TempDir())
7	if err := SaveConfig(Config{Theme: "dark"}); err != nil {
8		t.Fatal(err)
9	}
10
11	if err := (configSettingsStore{}).SetShowInstructionsAtStartup(true); err != nil {
12		t.Fatal(err)
13	}
14	cfg, err := LoadConfig()
15	if err != nil {
16		t.Fatal(err)
17	}
18	if cfg.ShowInstructionsAtStartup == nil || !*cfg.ShowInstructionsAtStartup {
19		t.Fatal("show_instructions_at_startup was not persisted as enabled")
20	}
21	if cfg.Theme != "dark" {
22		t.Fatalf("unrelated config changed: theme = %q, want dark", cfg.Theme)
23	}
24}
25
26func TestConfigSettingsStorePersistsOpenRouterServerTools(t *testing.T) {
27	t.Setenv("ZOT_HOME", t.TempDir())
28	if err := SaveConfig(Config{Theme: "dark"}); err != nil {
29		t.Fatal(err)
30	}
31
32	if err := (configSettingsStore{}).SetOpenRouterServerTools(false); err != nil {
33		t.Fatal(err)
34	}
35	cfg, err := LoadConfig()
36	if err != nil {
37		t.Fatal(err)
38	}
39	if cfg.OpenRouterServerToolsEnabled == nil || *cfg.OpenRouterServerToolsEnabled {
40		t.Fatal("openrouter_server_tools_enabled was not persisted as disabled")
41	}
42	if cfg.Theme != "dark" {
43		t.Fatalf("unrelated config changed: theme = %q, want dark", cfg.Theme)
44	}
45}
46
47func TestOpenRouterServerToolsEnabledDefaultsOff(t *testing.T) {
48	t.Setenv("ZOT_HOME", t.TempDir())
49	if err := SaveConfig(Config{}); err != nil {
50		t.Fatal(err)
51	}
52	if OpenRouterServerToolsEnabled() {
53		t.Fatal("nil preference should default to disabled")
54	}
55}
56
57func TestConfigSettingsStorePersistsJailByDefault(t *testing.T) {
58	t.Setenv("ZOT_HOME", t.TempDir())
59	if err := SaveConfig(Config{Theme: "dark"}); err != nil {
60		t.Fatal(err)
61	}
62
63	if err := (configSettingsStore{}).SetJailByDefault(true); err != nil {
64		t.Fatal(err)
65	}
66	cfg, err := LoadConfig()
67	if err != nil {
68		t.Fatal(err)
69	}
70	if cfg.JailByDefault == nil || !*cfg.JailByDefault {
71		t.Fatal("jail_by_default was not persisted as enabled")
72	}
73	if cfg.Theme != "dark" {
74		t.Fatalf("unrelated config changed: theme = %q, want dark", cfg.Theme)
75	}
76}
77
78func TestConfigSettingsStorePersistsAutoCompactThreshold(t *testing.T) {
79	t.Setenv("ZOT_HOME", t.TempDir())
80	if err := SaveConfig(Config{Theme: "dark"}); err != nil {
81		t.Fatal(err)
82	}
83
84	if err := (configSettingsStore{}).SetAutoCompactThreshold(70); err != nil {
85		t.Fatal(err)
86	}
87	cfg, err := LoadConfig()
88	if err != nil {
89		t.Fatal(err)
90	}
91	if cfg.AutoCompactThreshold == nil || *cfg.AutoCompactThreshold != 70 {
92		t.Fatalf("auto_compact_threshold = %v, want 70", cfg.AutoCompactThreshold)
93	}
94	if cfg.Theme != "dark" {
95		t.Fatalf("unrelated config changed: theme = %q, want dark", cfg.Theme)
96	}
97}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 476

↑↓ moveenter openesc close