v0.15.0 6b178f8

systemprompt_test.go RawHistoryFolder

1package agent
2
3import (
4	"strings"
5	"testing"
6	"time"
7)
8
9func TestBuildSystemPromptAddsCompactionHandoffToCustomPrompt(t *testing.T) {
10	prompt := BuildSystemPrompt(SystemPromptOpts{Custom: "custom identity"})
11	if !strings.Contains(prompt, "custom identity") {
12		t.Fatalf("custom prompt missing:\n%s", prompt)
13	}
14	if !strings.Contains(prompt, compactedSummaryHandoffInstruction) {
15		t.Fatalf("custom prompt missing compaction handoff:\n%s", prompt)
16	}
17	if count := strings.Count(prompt, compactedSummaryHandoffInstruction); count != 1 {
18		t.Fatalf("compaction handoff count = %d, want 1:\n%s", count, prompt)
19	}
20	for _, want := range []string{"most recent unresolved user request", "newer user request", "without waiting for the user to type \"continue\""} {
21		if !strings.Contains(prompt, want) {
22			t.Fatalf("compaction handoff missing %q:\n%s", want, prompt)
23		}
24	}
25}
26
27func TestBuildSystemPromptCustomOmitsBuiltInDocs(t *testing.T) {
28	got := BuildSystemPrompt(SystemPromptOpts{
29		CWD:        "/workspace",
30		Custom:     "Custom instructions",
31		Append:     []string{"Additional context"},
32		Now:        time.Date(2026, time.August, 6, 0, 0, 0, 0, time.UTC),
33		ZutDocsDir: "/zut/docs",
34	})
35
36	if strings.Contains(got, "Zut's own docs") || strings.Contains(got, "/zut/docs") {
37		t.Fatalf("custom prompt includes built-in docs guidance:\n%s", got)
38	}
39	for _, want := range []string{
40		"Custom instructions",
41		"Additional context",
42		"Current date: 2026-08-06",
43		"Current working directory: /workspace",
44	} {
45		if !strings.Contains(got, want) {
46			t.Errorf("custom prompt missing %q:\n%s", want, got)
47		}
48	}
49}
50
51func TestBuildSystemPromptDefaultIncludesBuiltInDocs(t *testing.T) {
52	got := BuildSystemPrompt(SystemPromptOpts{
53		CWD:        "/workspace",
54		Now:        time.Date(2026, time.August, 6, 0, 0, 0, 0, time.UTC),
55		ZutDocsDir: "/zut/docs",
56	})
57
58	if !strings.Contains(got, "Zut's own docs are installed under /zut/docs") {
59		t.Fatalf("default prompt missing built-in docs guidance:\n%s", got)
60	}
61}

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