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.
131 lines
3.0 KiB
Go
131 lines
3.0 KiB
Go
package steps
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
"github.com/charmbracelet/lipgloss"
|
|
"github.com/insights/insights/bin/hobby-installer/ui"
|
|
)
|
|
|
|
type CompleteModel struct {
|
|
success bool
|
|
error string
|
|
domain string
|
|
}
|
|
|
|
func NewCompleteModel(success bool, errorMsg, domain string) CompleteModel {
|
|
return CompleteModel{
|
|
success: success,
|
|
error: errorMsg,
|
|
domain: domain,
|
|
}
|
|
}
|
|
|
|
func (m CompleteModel) Init() tea.Cmd {
|
|
return nil
|
|
}
|
|
|
|
func (m CompleteModel) Update(msg tea.Msg) (CompleteModel, tea.Cmd) {
|
|
switch msg := msg.(type) {
|
|
case tea.KeyMsg:
|
|
switch msg.String() {
|
|
case "enter", "q", "ctrl+c":
|
|
return m, tea.Quit
|
|
}
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
func (m CompleteModel) View() string {
|
|
if m.success {
|
|
return m.successView()
|
|
}
|
|
return m.errorView()
|
|
}
|
|
|
|
func (m CompleteModel) successView() string {
|
|
successBox := lipgloss.NewStyle().
|
|
Border(lipgloss.RoundedBorder()).
|
|
BorderForeground(ui.ColorSuccess).
|
|
Padding(1, 3).
|
|
Render(lipgloss.JoinVertical(
|
|
lipgloss.Center,
|
|
ui.SuccessStyle.Render("🎉 Installation Complete! 🎉"),
|
|
"",
|
|
ui.DefaultStyle.Render("Insights is now running at:"),
|
|
"",
|
|
ui.BoldStyle.Foreground(ui.ColorPrimary).Render(fmt.Sprintf("https://%s", m.domain)),
|
|
))
|
|
|
|
tips := lipgloss.JoinVertical(
|
|
lipgloss.Left,
|
|
ui.SubtitleStyle.Render("Useful commands:"),
|
|
"",
|
|
ui.MutedStyle.Render(" Stop Insights: ")+"docker-compose stop",
|
|
ui.MutedStyle.Render(" Start Insights: ")+"docker-compose start",
|
|
ui.MutedStyle.Render(" View logs: ")+"docker-compose logs -f",
|
|
ui.MutedStyle.Render(" Upgrade: ")+"./hobby-installer",
|
|
"",
|
|
ui.MutedStyle.Render(" Clean up old images: ")+"docker system prune -a",
|
|
)
|
|
|
|
content := lipgloss.JoinVertical(
|
|
lipgloss.Center,
|
|
"",
|
|
successBox,
|
|
"",
|
|
tips,
|
|
"",
|
|
ui.MutedStyle.Render("It's dangerous to go alone! Take this: 🦔"),
|
|
"",
|
|
ui.HelpStyle.Render("Press enter or q to exit"),
|
|
)
|
|
|
|
return lipgloss.NewStyle().
|
|
Padding(2, 4).
|
|
Render(content)
|
|
}
|
|
|
|
func (m CompleteModel) errorView() string {
|
|
errorBox := lipgloss.NewStyle().
|
|
Border(lipgloss.RoundedBorder()).
|
|
BorderForeground(ui.ColorError).
|
|
Padding(1, 3).
|
|
Render(lipgloss.JoinVertical(
|
|
lipgloss.Center,
|
|
ui.ErrorStyle.Render("✗ Installation Failed"),
|
|
"",
|
|
ui.MutedStyle.Render("Error:"),
|
|
m.error,
|
|
))
|
|
|
|
tips := lipgloss.JoinVertical(
|
|
lipgloss.Left,
|
|
ui.SubtitleStyle.Render("Troubleshooting:"),
|
|
"",
|
|
ui.MutedStyle.Render(" • Check Docker is running: ")+"docker info",
|
|
ui.MutedStyle.Render(" • View logs: ")+"docker-compose logs",
|
|
ui.MutedStyle.Render(" • Check disk space: ")+"df -h",
|
|
ui.MutedStyle.Render(" • Check memory: ")+"free -h",
|
|
"",
|
|
ui.MutedStyle.Render(" • Delete everything and try again:"),
|
|
" rm -rf insights docker-compose.yml .env",
|
|
" ./hobby-installer",
|
|
)
|
|
|
|
content := lipgloss.JoinVertical(
|
|
lipgloss.Center,
|
|
"",
|
|
errorBox,
|
|
"",
|
|
tips,
|
|
"",
|
|
ui.HelpStyle.Render("Press enter or q to exit"),
|
|
)
|
|
|
|
return lipgloss.NewStyle().
|
|
Padding(2, 4).
|
|
Render(content)
|
|
}
|