The manual in the binary: llmgw docs, and Help in the console

Every document and a page for every command, built from their help, read
like info: topics, contents, find. ? opens the console's own page, which is
new and covers every screen.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-04 00:19:50 +02:00
1 parent 44425193bd
commit dac7ff0e99
7 files changed
+1129 -3

No files matched your search

+51 -3
View File
@@ -43,6 +43,7 @@ const (
cAccounts
cKeys
cOrgs
cManual
cSettings
cAddNode
cReplicate
@@ -54,7 +55,7 @@ const (
cCount
)
var consoleLabels = [cCount]string{"Overview", "Nodes", "GPUs", "Models", "Replicas", "Usage", "Quotas", "Mirror", "Logs", "Accounts", "API keys", "Organizations",
var consoleLabels = [cCount]string{"Overview", "Nodes", "GPUs", "Models", "Replicas", "Usage", "Quotas", "Mirror", "Logs", "Accounts", "API keys", "Organizations", "Manual",
"server.yaml", "Add a node", "Replicate the store", "Serve a model", "Upgrade the cluster",
"Restart all replicas", "Back up now", "Leave"}
@@ -154,13 +155,14 @@ type consoleModel struct {
people peopleData
mirror consoleMirrorMsg
hf hfState
docs docViewer
}
var usageGroupings = []string{"team", "project", "org"}
func newConsoleModel(addr, file string) consoleModel {
m := consoleModel{client: newCtlClient(addr), spin: newSpinner(), width: 100, height: 30, file: file,
st: &storeHolder{file: file}}
st: &storeHolder{file: file}, docs: newDocViewer()}
m.node = strings.HasSuffix(file, "agent.yaml")
if m.node {
m.menu = cSettings
@@ -329,7 +331,7 @@ func (m consoleModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
func (m consoleModel) entryOK(i int) bool {
if m.node {
return i == cSettings || i == cLeave
return i == cSettings || i == cManual || i == cLeave
}
return i != cReplicate || !m.storeReplicated()
}
@@ -346,6 +348,26 @@ func (m consoleModel) key(k tea.KeyMsg) (tea.Model, tea.Cmd) {
if mm, cmd, ok := m.actionKey(k); ok {
return mm, cmd
}
// The manual, from anywhere: its page about this screen.
if k.String() == "?" && !(m.menu == cManual && m.detail) {
m.menu, m.inPanel, m.detail = cManual, true, true
m.docs.show(max(0, findTopic(m.docs.topics, "console")))
return m, nil
}
if m.menu == cManual && m.inPanel && m.detail {
pw := max(40, m.width-navWidth-8)
if m.docs.key(k, pw-4, m.height) {
return m, nil
}
switch k.String() {
case "esc", "left", "h", "backspace":
m.detail = false
m.row = m.docs.open
case "q":
return m.leave()
}
return m, nil
}
switch k.Type {
case tea.KeyPgDown:
m.scroll += max(1, m.height-8)
@@ -434,6 +456,9 @@ func (m consoleModel) key(k tea.KeyMsg) (tea.Model, tea.Cmd) {
m.menuD = m.keyMenu(m.people.keys[m.row])
case cOrgs:
m.menuD = m.orgMenu(m.people.orgs[m.row])
case cManual:
m.docs.show(m.row)
m.detail = true
}
case "/":
if m.menu == cServe {
@@ -808,6 +833,8 @@ func (m consoleModel) rowCount() int {
return len(m.people.keys)
case cOrgs:
return len(m.people.orgs)
case cManual:
return len(m.docs.topics)
}
return 0
}
@@ -825,6 +852,8 @@ func (m consoleModel) View() string {
switch i {
case cAccounts:
nav = append(nav, navItem{Label: "", Heading: true}, navItem{Label: "People", Heading: true})
case cManual:
nav = append(nav, navItem{Label: "", Heading: true}, navItem{Label: "Help", Heading: true})
case cSettings:
nav = append(nav, navItem{Label: "", Heading: true}, navItem{Label: "Settings", Heading: true})
case cAddNode, cLeave:
@@ -850,6 +879,9 @@ func (m consoleModel) View() string {
Width: m.width, Height: m.height, Title: title0, Where: host,
NavTitle: "", Nav: nav, PanelTitle: title, Body: body, Scroll: m.scroll, Keys: keys,
}
if m.menu == cManual && m.detail {
f.Scroll = m.docs.scroll
}
// The selected row kept on screen.
if m.inPanel && !m.detail {
inner := m.height - 4
@@ -869,6 +901,8 @@ func (m consoleModel) View() string {
}
f.Dialog = q + "\n\n" + m.prompt.View() + "\n\n" + sDim.Render("Enter · Esc cancel")
}
} else if t, d := m.docs.dialog(); d != "" && m.menu == cManual {
f.DialogTitle, f.Dialog = t, d
} else if m.busy != "" {
f.DialogTitle, f.Dialog = m.busy, m.spin.View()+" asking the control plane…"
} else if t, d := m.actionDialog(); d != "" {
@@ -1004,6 +1038,20 @@ func (m consoleModel) panel() (title, body, keys string) {
return m.quotasPanel(pw)
case cAccounts, cKeys, cOrgs:
return m.peoplePanel(pw)
case cManual:
if m.detail && m.docs.open >= 0 {
k := docKeys
if m.docs.note != "" {
k = m.docs.note
}
return "Manual · " + m.docs.topics[m.docs.open].title, "\n" + m.docs.body(pw-4), k
}
d := m.docs
d.sel = m.row
if m.inPanel {
keys = "↑↓ topic · Enter read · ← back · ? the console's page · Q leave"
}
return "Manual", d.list(pw, m.inPanel), keys
case cMirror:
return m.mirrorPanel(pw)
case cServe: