mirror of
https://github.com/hanzoai/insights.git
synced 2026-10-30 16:15:31 +00:00
The tree was a debranded snapshot of upstream taken around 2026-02-20, and upstream has moved about five months since. This replaces it with upstream master, mechanically re-derived: bin/debrand does the rename, and the pipeline and squashed migrations are restored from the shipped tree. Not a merge. The previous import replaced the tree wholesale in a single commit, so there is no shared content history to merge against. Reproducing the rename on the new tree is what actually converges. What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints, compose files, LLM.md, and insights/migrations. The squashed initial migration is load-bearing — the live database records it by name, so upstream's ~918 individual migrations cannot come back. Nine products are dropped as unreferenced. Twenty-one more that we do not run are kept anyway because the core app still imports them; unpicking those is a refactor and does not belong in a rebase. This base does not build yet, and the reasons are not in the rename: upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against our 4.2, and the dependency manifests still name upstream packages that we republish under our own names. Those are decisions, not renames.
208 lines
5.1 KiB
Go
208 lines
5.1 KiB
Go
package tui
|
|
|
|
import "charm.land/bubbles/v2/key"
|
|
|
|
type keyMap struct {
|
|
PrevProc key.Binding
|
|
NextProc key.Binding
|
|
KeyUp key.Binding
|
|
KeyDown key.Binding
|
|
ScrollUp key.Binding
|
|
ScrollDown key.Binding
|
|
GotoTop key.Binding
|
|
GotoBottom key.Binding
|
|
NextPane key.Binding
|
|
PrevPane key.Binding
|
|
Start key.Binding
|
|
Stop key.Binding
|
|
Restart key.Binding
|
|
RestartAllFailed key.Binding
|
|
ClearLogs key.Binding
|
|
CopyMode key.Binding
|
|
InfoMode key.Binding
|
|
SearchMode key.Binding
|
|
SearchNext key.Binding
|
|
SearchPrev key.Binding
|
|
CommitFilter key.Binding
|
|
ToggleFilter key.Binding
|
|
InputMode key.Binding
|
|
Quit key.Binding
|
|
Help key.Binding
|
|
Backspace key.Binding
|
|
Mascot key.Binding
|
|
Sort key.Binding
|
|
Group key.Binding
|
|
LazyDocker key.Binding
|
|
ProcViewer key.Binding
|
|
SetupMode key.Binding
|
|
ShowAll key.Binding
|
|
}
|
|
|
|
func defaultKeyMap() keyMap {
|
|
return keyMap{
|
|
PrevProc: key.NewBinding(
|
|
key.WithKeys("k"),
|
|
),
|
|
NextProc: key.NewBinding(
|
|
key.WithKeys("j"),
|
|
),
|
|
KeyUp: key.NewBinding(
|
|
key.WithKeys("up"),
|
|
key.WithHelp("↑:", "prev"),
|
|
),
|
|
KeyDown: key.NewBinding(
|
|
key.WithKeys("down"),
|
|
key.WithHelp("↓:", "next"),
|
|
),
|
|
ScrollUp: key.NewBinding(
|
|
key.WithKeys("pgup"),
|
|
key.WithHelp("pgup:", "↥"),
|
|
),
|
|
ScrollDown: key.NewBinding(
|
|
key.WithKeys("pgdn"),
|
|
key.WithHelp("pgdn:", "↧"),
|
|
),
|
|
GotoTop: key.NewBinding(
|
|
key.WithKeys("home"),
|
|
key.WithHelp("home:", "⤒"),
|
|
),
|
|
GotoBottom: key.NewBinding(
|
|
key.WithKeys("end"),
|
|
key.WithHelp("end:", "⤓"),
|
|
),
|
|
NextPane: key.NewBinding(
|
|
key.WithKeys("tab"),
|
|
key.WithHelp("↹:", "next pane"),
|
|
),
|
|
PrevPane: key.NewBinding(
|
|
key.WithKeys("shift+tab"),
|
|
key.WithHelp("⇧↹:", "prev pane"),
|
|
),
|
|
Start: key.NewBinding(
|
|
key.WithKeys("s"),
|
|
key.WithHelp("s:", "start"),
|
|
),
|
|
Stop: key.NewBinding(
|
|
key.WithKeys("x"),
|
|
key.WithHelp("x:", "stop"),
|
|
),
|
|
Restart: key.NewBinding(
|
|
key.WithKeys("r"),
|
|
key.WithHelp("r:", "restart"),
|
|
),
|
|
RestartAllFailed: key.NewBinding(
|
|
// Capital R mirrors the lowercase-vs-uppercase pattern used by
|
|
// many TUIs to distinguish "single" vs "bulk" actions.
|
|
// Restarts every proc currently in StatusCrashed (non-zero exit
|
|
// or killed by a signal). Manually-stopped, clean-exit, never-
|
|
// started, and standby procs are all naturally excluded — they
|
|
// sit in different status states.
|
|
key.WithKeys("R"),
|
|
key.WithHelp("R:", "restart all failed"),
|
|
key.WithDisabled(),
|
|
),
|
|
ClearLogs: key.NewBinding(
|
|
key.WithKeys("l"),
|
|
key.WithHelp("l:", "clear"),
|
|
),
|
|
CopyMode: key.NewBinding(
|
|
key.WithKeys("c"),
|
|
key.WithHelp("c:", "copy"),
|
|
),
|
|
SearchMode: key.NewBinding(
|
|
key.WithKeys("/"),
|
|
key.WithHelp("/:", "search"),
|
|
),
|
|
SearchNext: key.NewBinding(
|
|
key.WithKeys("down"),
|
|
key.WithHelp("↓:", "next match"),
|
|
),
|
|
SearchPrev: key.NewBinding(
|
|
key.WithKeys("up"),
|
|
key.WithHelp("↑:", "prev match"),
|
|
),
|
|
CommitFilter: key.NewBinding(
|
|
key.WithKeys("tab"),
|
|
key.WithHelp("↹:", "filter"),
|
|
),
|
|
ToggleFilter: key.NewBinding(
|
|
key.WithKeys("tab"),
|
|
key.WithHelp("↹:", "back to search"),
|
|
),
|
|
InputMode: key.NewBinding(
|
|
key.WithKeys("enter"),
|
|
key.WithHelp("↵:", "input"),
|
|
),
|
|
Quit: key.NewBinding(
|
|
key.WithKeys("q", "ctrl+c"),
|
|
key.WithHelp("q:", "quit"),
|
|
),
|
|
Help: key.NewBinding(
|
|
key.WithKeys("?"),
|
|
key.WithHelp("?:", "help"),
|
|
),
|
|
Backspace: key.NewBinding(
|
|
key.WithKeys("backspace"),
|
|
key.WithHelp("⌫:", "del char"),
|
|
),
|
|
Mascot: key.NewBinding(
|
|
key.WithKeys("h"),
|
|
key.WithHelp("h:", "mascot"),
|
|
),
|
|
InfoMode: key.NewBinding(
|
|
key.WithKeys("i"),
|
|
key.WithHelp("i:", "info"),
|
|
),
|
|
Sort: key.NewBinding(
|
|
key.WithKeys("o"),
|
|
key.WithHelp("o:", "sort"),
|
|
),
|
|
Group: key.NewBinding(
|
|
key.WithKeys("g"),
|
|
key.WithHelp("g:", "group"),
|
|
),
|
|
LazyDocker: key.NewBinding(
|
|
key.WithKeys("d"),
|
|
key.WithHelp("d:", "lazydocker"),
|
|
key.WithDisabled(),
|
|
),
|
|
ProcViewer: key.NewBinding(
|
|
key.WithKeys("p"),
|
|
key.WithHelp("p:", "htop"),
|
|
key.WithDisabled(),
|
|
),
|
|
SetupMode: key.NewBinding(
|
|
key.WithKeys("t"),
|
|
key.WithHelp("t:", "setup"),
|
|
),
|
|
ShowAll: key.NewBinding(
|
|
key.WithKeys("a"),
|
|
key.WithHelp("a:", "show all"),
|
|
),
|
|
}
|
|
}
|
|
|
|
func (k keyMap) ShortHelp() []key.Binding {
|
|
return []key.Binding{k.Start, k.Stop, k.Restart, k.ClearLogs, k.SearchMode, k.CopyMode, k.InfoMode, k.SetupMode, k.Quit, k.Help}
|
|
}
|
|
|
|
func (k keyMap) SearchModeHelp() []key.Binding {
|
|
return []key.Binding{k.SearchNext, k.SearchPrev, k.CommitFilter}
|
|
}
|
|
|
|
func (k keyMap) FilterModeHelp() []key.Binding {
|
|
return []key.Binding{k.ToggleFilter}
|
|
}
|
|
|
|
func (k keyMap) FullHelp() [][]key.Binding {
|
|
return [][]key.Binding{
|
|
{k.KeyDown, k.KeyUp, k.Sort},
|
|
{k.ScrollUp, k.ScrollDown, k.Group},
|
|
{k.GotoTop, k.GotoBottom, k.ClearLogs},
|
|
{k.NextPane, k.PrevPane, k.LazyDocker, k.ProcViewer},
|
|
{k.Start, k.Stop, k.Restart, k.InfoMode},
|
|
{k.SearchMode, k.CopyMode, k.SetupMode},
|
|
{k.Quit, k.Help, k.ShowAll},
|
|
}
|
|
}
|