Add shared live run graphs, debugging, editor choice and draft cleanup

This commit is contained in:
2026-10-09 19:17:43 +01:00
parent 9b8afc874f
commit 0f80ff4e95
33 changed files with 1162 additions and 72 deletions
+40 -16
View File
@@ -38,21 +38,22 @@ type socketMsg struct {
type reconnectMsg struct{}
type keyMap struct {
ping key.Binding
quit key.Binding
create key.Binding
enter key.Binding
cancel key.Binding
commands key.Binding
logs bool
palette bool
search key.Binding
detail bool
versions bool
confirm bool
runs bool
templates bool
drafts bool
ping key.Binding
quit key.Binding
create key.Binding
enter key.Binding
cancel key.Binding
commands key.Binding
logs bool
palette bool
search key.Binding
detail bool
versions bool
confirm bool
runs bool
retryAvailable bool
templates bool
drafts bool
}
func (k keyMap) ShortHelp() []key.Binding {
@@ -75,7 +76,11 @@ func (k keyMap) ShortHelp() []key.Binding {
return []key.Binding{key.NewBinding(key.WithKeys("n", "p"), key.WithHelp("n/p", "template")), key.NewBinding(key.WithKeys("v"), key.WithHelp("v", "render/source")), key.NewBinding(key.WithKeys("enter"), key.WithHelp("Enter", "use template")), k.cancel}
}
if k.runs {
return []key.Binding{k.commands, key.NewBinding(key.WithKeys("p"), key.WithHelp("p", "pipeline")), key.NewBinding(key.WithKeys("r"), key.WithHelp("r", "retry failed")), key.NewBinding(key.WithKeys("tab"), key.WithHelp("Tab", "pane")), key.NewBinding(key.WithKeys("j", "k"), key.WithHelp("j/k", "select/scroll")), key.NewBinding(key.WithKeys("pgup", "pgdown"), key.WithHelp("PgUp/Dn", "page")), key.NewBinding(key.WithKeys("esc"), key.WithHelp("Esc", "back"))}
bindings := []key.Binding{k.commands, key.NewBinding(key.WithKeys("g"), key.WithHelp("g", "graph")), key.NewBinding(key.WithKeys("D"), key.WithHelp("D", "debug")), key.NewBinding(key.WithKeys("p"), key.WithHelp("p", "pipeline"))}
if k.retryAvailable {
bindings = append(bindings, key.NewBinding(key.WithKeys("r"), key.WithHelp("r", "retry failed")))
}
return append(bindings, key.NewBinding(key.WithKeys("tab"), key.WithHelp("Tab", "pane")), key.NewBinding(key.WithKeys("j", "k"), key.WithHelp("j/k", "select/scroll")), key.NewBinding(key.WithKeys("esc"), key.WithHelp("Esc", "back")))
}
if k.detail {
return []key.Binding{k.commands, k.search, key.NewBinding(key.WithKeys("n", "p"), key.WithHelp("n/p", "next/prev stage")), key.NewBinding(key.WithKeys("tab"), key.WithHelp("Tab", "pane")), key.NewBinding(key.WithKeys("r"), key.WithHelp("r", "runs")), key.NewBinding(key.WithKeys("j", "k"), key.WithHelp("j/k", "scroll")), key.NewBinding(key.WithKeys("esc"), key.WithHelp("esc", "home"))}
@@ -151,6 +156,14 @@ type Model struct {
runError string
runPipelineID int64
runFailedOnly bool
runGraphFocus bool
runGraphTop int
runGraphPan int
editorOpen bool
editorInput textinput.Model
editorIndex int
editorDraft *editedMsg
draftDeletingPath string
runSpinner spinner.Model
templates []protocol.Template
templateOpen, templateRaw bool
@@ -210,6 +223,11 @@ func (m Model) read() tea.Cmd {
func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case debugClosedMsg:
if msg.err != nil {
m.appendLine("OpenCode debug: " + msg.err.Error())
}
return m, nil
case spinner.TickMsg:
var cmd tea.Cmd
m.runSpinner, cmd = m.runSpinner.Update(msg)
@@ -436,6 +454,9 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if msg.String() == "ctrl+c" {
return m, tea.Quit
}
if m.editorOpen {
return m.updateEditorPicker(msg)
}
if m.logOpen {
return m.updateLogs(msg)
}
@@ -649,6 +670,9 @@ func (m Model) View() string {
} else if m.confirmOpen {
content = m.confirmView(bodyHeight)
}
if m.editorOpen {
content = m.editorPickerView(bodyHeight)
}
parts = append(parts, content)
}
return strings.Join(append(parts, footer), "\n")