app

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ViewWorkspace  = "workspace"
	ViewMigrations = "migrations"
	ViewDetails    = "details"
	ViewOutputs    = "outputs"
	ViewStatusbar  = "statusbar"
)

View identifiers

Variables

View Source
var (
	PrimaryFrameColor = gocui.ColorWhite
	FocusedFrameColor = gocui.ColorGreen

	PrimaryTitleColor = gocui.ColorWhite | gocui.AttrNone
	FocusedTitleColor = gocui.ColorGreen | gocui.AttrBold

	// Tab styling
	FocusedActiveTabColor = gocui.ColorGreen | gocui.AttrBold // Active tab when panel is focused
	PrimaryActiveTabColor = gocui.ColorGreen | gocui.AttrNone // Active tab when panel is not focused

	// List selection color
	SelectionBgColor = gocui.ColorBlue
)

Frame and title styling

Functions

func AdjustOrigin

func AdjustOrigin(v *gocui.View, originY *int)

AdjustOrigin adjusts the origin to ensure it's within valid bounds Call this after content is rendered but before SetOrigin

func Black

func Black(text string) string

Black colors text black

func Blink(text string) string

Blink makes text blink

func Blue

func Blue(text string) string

Blue colors text blue

func Bold

func Bold(text string) string

Bold makes text bold

func Colorize

func Colorize(text string, color Color) string

Colorize applies a foreground color to text

func CopyToClipboard

func CopyToClipboard(text string) error

CopyToClipboard copies text to the system clipboard

func Cyan

func Cyan(text string) string

Cyan colors text cyan

func Dim

func Dim(text string) string

Dim makes text dim/faint

func Gray

func Gray(text string) string

Gray colors text gray (using 256-color ANSI code)

func Green

func Green(text string) string

Green colors text green

func Italic

func Italic(text string) string

Italic makes text italic

func Magenta

func Magenta(text string) string

Magenta colors text magenta

func Orange

func Orange(text string) string

Orange colors text orange (using 256-color ANSI code)

func Red

func Red(text string) string

Red colors text red

func Reverse

func Reverse(text string) string

Reverse reverses foreground and background colors

func StrikeThru

func StrikeThru(text string) string

StrikeThru strikes through text

func Stylize

func Stylize(text string, style Style) string

Stylize applies the given style to text using ANSI escape codes

func Underline

func Underline(text string) string

Underline underlines text

func White

func White(text string) string

White colors text white

func Yellow

func Yellow(text string) string

Yellow colors text yellow

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func NewApp

func NewApp(config AppConfig) (*App, error)

func (*App) CloseModal

func (a *App) CloseModal()

CloseModal closes the active modal and restores focus

func (*App) CopyMigrationInfo

func (a *App) CopyMigrationInfo()

CopyMigrationInfo copies migration info to clipboard

func (*App) DeleteMigration

func (a *App) DeleteMigration()

DeleteMigration deletes a pending migration

func (*App) FocusNext

func (a *App) FocusNext()

func (*App) FocusPrevious

func (a *App) FocusPrevious()

func (*App) Generate

func (a *App) Generate()

Generate runs prisma generate and shows result in modal

func (*App) GetCurrentPanel

func (a *App) GetCurrentPanel() Panel

GetCurrentPanel returns the currently focused panel

func (*App) GetGui

func (a *App) GetGui() *gocui.Gui

func (*App) HasActiveModal

func (a *App) HasActiveModal() bool

HasActiveModal returns true if a modal is currently active

func (*App) MigrateDeploy

func (a *App) MigrateDeploy()

MigrateDeploy runs npx prisma migrate deploy

func (*App) MigrateDev

func (a *App) MigrateDev()

MigrateDev opens a list modal to choose migration type

func (*App) MigrateResolve

func (a *App) MigrateResolve()

MigrateResolve resolves a failed migration

func (*App) OpenModal

func (a *App) OpenModal(modal Modal)

OpenModal opens a modal and saves current focus state

func (*App) RefreshAll

func (a *App) RefreshAll(onComplete ...func()) bool

RefreshAll refreshes all panels asynchronously

func (*App) RegisterKeybindings

func (a *App) RegisterKeybindings() error

func (*App) RegisterMouseBindings

func (a *App) RegisterMouseBindings()

RegisterMouseBindings registers mouse click handlers for all panels

func (*App) RegisterPanel

func (a *App) RegisterPanel(panel Panel)

func (*App) Run

func (a *App) Run() error

func (*App) SchemaDiffMigration

func (a *App) SchemaDiffMigration()

SchemaDiffMigration performs schema diff-based migration with validation checks

func (*App) Studio

func (a *App) Studio()

Studio toggles Prisma Studio

func (*App) TestConfirmModal

func (a *App) TestConfirmModal()

TestConfirmModal opens a test confirm modal (temporary for testing)

func (*App) TestInputModal

func (a *App) TestInputModal()

TestInputModal opens a test input modal (temporary for testing)

func (*App) TestListModal

func (a *App) TestListModal()

TestListModal opens a test list modal (temporary for testing)

func (*App) TestModal

func (a *App) TestModal()

TestModal opens a test modal (temporary for testing)

func (*App) TestPing

func (a *App) TestPing()

TestPing tests network connectivity by pinging google.com

type AppConfig

type AppConfig struct {
	DebugMode bool
	AppName   string
	Version   string
	Developer string
}

type BasePanel

type BasePanel struct {
	// contains filtered or unexported fields
}

func NewBasePanel

func NewBasePanel(id string, g *gocui.Gui) BasePanel

func (*BasePanel) ID

func (bp *BasePanel) ID() string

func (*BasePanel) OnBlur

func (bp *BasePanel) OnBlur()

func (*BasePanel) OnFocus

func (bp *BasePanel) OnFocus()

func (*BasePanel) SetupView

func (bp *BasePanel) SetupView(v *gocui.View, title string)

SetupView는 공통 뷰 설정을 처리합니다

type Color

type Color int

Color represents terminal colors

const (
	ColorDefault Color = iota
	ColorBlack
	ColorRed
	ColorGreen
	ColorYellow
	ColorBlue
	ColorMagenta
	ColorCyan
	ColorWhite
)

type ConfirmModal

type ConfirmModal struct {
	// contains filtered or unexported fields
}

ConfirmModal displays a confirmation dialog with Yes/No options

func NewConfirmModal

func NewConfirmModal(g *gocui.Gui, title string, message string, onYes func(), onNo func()) *ConfirmModal

NewConfirmModal creates a new confirmation modal

func (*ConfirmModal) Draw

func (m *ConfirmModal) Draw(dim boxlayout.Dimensions) error

Draw renders the modal

func (*ConfirmModal) HandleKey

func (m *ConfirmModal) HandleKey(key any, mod gocui.Modifier) error

HandleKey handles keyboard input

func (*ConfirmModal) ID

func (m *ConfirmModal) ID() string

ID returns the modal's view ID

func (*ConfirmModal) OnClose

func (m *ConfirmModal) OnClose()

OnClose is called when the modal is closed

func (*ConfirmModal) WithStyle

func (m *ConfirmModal) WithStyle(style MessageModalStyle) *ConfirmModal

WithStyle sets the modal style

type DetailsPanel

type DetailsPanel struct {
	BasePanel
	// contains filtered or unexported fields
}

func NewDetailsPanel

func NewDetailsPanel(g *gocui.Gui) *DetailsPanel

func (*DetailsPanel) Draw

func (d *DetailsPanel) Draw(dim boxlayout.Dimensions) error

func (*DetailsPanel) LoadActionNeededData

func (d *DetailsPanel) LoadActionNeededData()

LoadActionNeededData loads migrations that require action (Empty + Mismatch) and validates schema

func (*DetailsPanel) NextTab

func (d *DetailsPanel) NextTab()

NextTab switches to the next tab

func (*DetailsPanel) PrevTab

func (d *DetailsPanel) PrevTab()

PrevTab switches to the previous tab

func (*DetailsPanel) ScrollDown

func (d *DetailsPanel) ScrollDown()

ScrollDown scrolls the details panel down

func (*DetailsPanel) ScrollDownByWheel

func (d *DetailsPanel) ScrollDownByWheel()

ScrollDownByWheel scrolls the details panel down by 2 lines (mouse wheel)

func (*DetailsPanel) ScrollToBottom

func (d *DetailsPanel) ScrollToBottom()

ScrollToBottom scrolls to the bottom of the details panel

func (*DetailsPanel) ScrollToTop

func (d *DetailsPanel) ScrollToTop()

ScrollToTop scrolls to the top of the details panel

func (*DetailsPanel) ScrollUp

func (d *DetailsPanel) ScrollUp()

ScrollUp scrolls the details panel up

func (*DetailsPanel) ScrollUpByWheel

func (d *DetailsPanel) ScrollUpByWheel()

ScrollUpByWheel scrolls the details panel up by 2 lines (mouse wheel)

func (*DetailsPanel) SetApp

func (d *DetailsPanel) SetApp(app *App)

SetApp sets the app reference for modal checking

func (*DetailsPanel) SetContent

func (d *DetailsPanel) SetContent(content string)

func (*DetailsPanel) UpdateFromMigration

func (d *DetailsPanel) UpdateFromMigration(migration *prisma.Migration, tabName string)

UpdateFromMigration updates the details panel with migration information

type InputModal

type InputModal struct {
	// contains filtered or unexported fields
}

InputModal displays an input field for user text entry

func NewInputModal

func NewInputModal(g *gocui.Gui, title string, onSubmit func(string), onCancel func()) *InputModal

NewInputModal creates a new input modal

func (*InputModal) Draw

func (m *InputModal) Draw(dim boxlayout.Dimensions) error

Draw renders the input modal

func (*InputModal) HandleKey

func (m *InputModal) HandleKey(key any, mod gocui.Modifier) error

HandleKey handles keyboard input

func (*InputModal) ID

func (m *InputModal) ID() string

ID returns the modal's view ID

func (*InputModal) OnClose

func (m *InputModal) OnClose()

OnClose is called when the modal is closed

func (*InputModal) OnValidationFail

func (m *InputModal) OnValidationFail(callback func(string)) *InputModal

OnValidationFail sets the callback for validation failures

func (*InputModal) WithRequired

func (m *InputModal) WithRequired(required bool) *InputModal

WithRequired sets whether the input is required (non-empty)

func (*InputModal) WithStyle

func (m *InputModal) WithStyle(style MessageModalStyle) *InputModal

WithStyle sets the modal style

func (*InputModal) WithSubtitle

func (m *InputModal) WithSubtitle(subtitle string) *InputModal

WithSubtitle sets the modal subtitle

type ListModal

type ListModal struct {
	// contains filtered or unexported fields
}

ListModal displays a list of items with descriptions

func NewListModal

func NewListModal(g *gocui.Gui, title string, items []ListModalItem, onCancel func()) *ListModal

NewListModal creates a new list modal

func (*ListModal) Draw

func (m *ListModal) Draw(dim boxlayout.Dimensions) error

Draw renders the list modal with two views (list on top, description on bottom)

func (*ListModal) HandleKey

func (m *ListModal) HandleKey(key any, mod gocui.Modifier) error

HandleKey handles keyboard input

func (*ListModal) ID

func (m *ListModal) ID() string

ID returns the modal's view ID

func (*ListModal) OnClose

func (m *ListModal) OnClose()

OnClose is called when the modal is closed

func (*ListModal) WithStyle

func (m *ListModal) WithStyle(style MessageModalStyle) *ListModal

WithStyle sets the modal style

type ListModalItem

type ListModalItem struct {
	Label       string       // Display text in the list
	Description string       // Description shown in the bottom view
	OnSelect    func() error // Callback when item is selected with Enter
}

ListModalItem represents a selectable item in the list modal

type MessageModal

type MessageModal struct {
	// contains filtered or unexported fields
}

MessageModal displays a message with title and content

func NewMessageModal

func NewMessageModal(g *gocui.Gui, title string, lines ...string) *MessageModal

NewMessageModal creates a new message modal

func (*MessageModal) Draw

func (m *MessageModal) Draw(dim boxlayout.Dimensions) error

Draw renders the modal

func (*MessageModal) HandleKey

func (m *MessageModal) HandleKey(key any, mod gocui.Modifier) error

HandleKey handles keyboard input

func (*MessageModal) ID

func (m *MessageModal) ID() string

ID returns the modal's view ID

func (*MessageModal) OnClose

func (m *MessageModal) OnClose()

OnClose is called when the modal is closed

func (*MessageModal) WithStyle

func (m *MessageModal) WithStyle(style MessageModalStyle) *MessageModal

WithStyle sets the modal style

type MessageModalStyle

type MessageModalStyle struct {
	TitleColor  Color // Color for title (default: ColorDefault)
	BorderColor Color // Color for border (default: ColorDefault)
}

MessageModalStyle holds styling options for the modal

type MigrationsPanel

type MigrationsPanel struct {
	BasePanel
	// contains filtered or unexported fields
}

func NewMigrationsPanel

func NewMigrationsPanel(g *gocui.Gui) *MigrationsPanel

func (*MigrationsPanel) Draw

func (*MigrationsPanel) GetCurrentTab

func (m *MigrationsPanel) GetCurrentTab() string

GetCurrentTab returns the name of the current tab

func (*MigrationsPanel) GetSelectedMigration

func (m *MigrationsPanel) GetSelectedMigration() *prisma.Migration

GetSelectedMigration returns the currently selected migration

func (*MigrationsPanel) NextTab

func (m *MigrationsPanel) NextTab()

NextTab switches to the next tab

func (*MigrationsPanel) PrevTab

func (m *MigrationsPanel) PrevTab()

PrevTab switches to the previous tab

func (*MigrationsPanel) Refresh

func (m *MigrationsPanel) Refresh()

Refresh reloads all migration data

func (*MigrationsPanel) ScrollDownByWheel

func (m *MigrationsPanel) ScrollDownByWheel()

ScrollDownByWheel scrolls the migrations list down by 2 lines (mouse wheel)

func (*MigrationsPanel) ScrollToBottom

func (m *MigrationsPanel) ScrollToBottom()

ScrollToBottom scrolls to the bottom of the migrations list

func (*MigrationsPanel) ScrollToTop

func (m *MigrationsPanel) ScrollToTop()

ScrollToTop scrolls to the top of the migrations list

func (*MigrationsPanel) ScrollUpByWheel

func (m *MigrationsPanel) ScrollUpByWheel()

ScrollUpByWheel scrolls the migrations list up by 2 lines (mouse wheel)

func (*MigrationsPanel) SelectNext

func (m *MigrationsPanel) SelectNext()

func (*MigrationsPanel) SelectPrev

func (m *MigrationsPanel) SelectPrev()

func (*MigrationsPanel) SetApp

func (m *MigrationsPanel) SetApp(app *App)

SetApp sets the app reference for modal checking

func (*MigrationsPanel) SetDetailsPanel

func (m *MigrationsPanel) SetDetailsPanel(details *DetailsPanel)

SetDetailsPanel sets the details panel reference and performs initial update

type Modal interface {
	ID() string
	Draw(dim boxlayout.Dimensions) error
	HandleKey(key any, mod gocui.Modifier) error
	OnClose()
}

Modal represents a modal dialog

type OutputPanel

type OutputPanel struct {
	BasePanel
	// contains filtered or unexported fields
}

func NewOutputPanel

func NewOutputPanel(g *gocui.Gui) *OutputPanel

func (*OutputPanel) AppendOutput

func (o *OutputPanel) AppendOutput(text string)

func (*OutputPanel) Draw

func (o *OutputPanel) Draw(dim boxlayout.Dimensions) error

func (*OutputPanel) LogAction

func (o *OutputPanel) LogAction(action string, details ...string)

LogAction logs an action with timestamp and optional details

func (*OutputPanel) LogActionRed

func (o *OutputPanel) LogActionRed(action string, details ...string)

LogActionRed logs an action in red (for errors/warnings)

func (*OutputPanel) ScrollDown

func (o *OutputPanel) ScrollDown()

ScrollDown scrolls the output panel down

func (*OutputPanel) ScrollDownByWheel

func (o *OutputPanel) ScrollDownByWheel()

ScrollDownByWheel scrolls the output panel down by 2 lines (mouse wheel)

func (*OutputPanel) ScrollToBottom

func (o *OutputPanel) ScrollToBottom()

ScrollToBottom scrolls to the bottom of the output panel

func (*OutputPanel) ScrollToTop

func (o *OutputPanel) ScrollToTop()

ScrollToTop scrolls to the top of the output panel

func (*OutputPanel) ScrollUp

func (o *OutputPanel) ScrollUp()

ScrollUp scrolls the output panel up

func (*OutputPanel) ScrollUpByWheel

func (o *OutputPanel) ScrollUpByWheel()

ScrollUpByWheel scrolls the output panel up by 2 lines (mouse wheel)

func (*OutputPanel) SetSubtitle

func (o *OutputPanel) SetSubtitle(subtitle string)

SetSubtitle sets the custom subtitle for the panel

type Panel

type Panel interface {
	ID() string
	Draw(dim boxlayout.Dimensions) error
	OnFocus()
	OnBlur()
}

type StatusBar

type StatusBar struct {
	BasePanel
	// contains filtered or unexported fields
}

func NewStatusBar

func NewStatusBar(g *gocui.Gui, app *App) *StatusBar

func (*StatusBar) Draw

func (s *StatusBar) Draw(dim boxlayout.Dimensions) error

func (*StatusBar) OnBlur

func (s *StatusBar) OnBlur()

func (*StatusBar) OnFocus

func (s *StatusBar) OnFocus()

상태바는 포커스를 받지 않음

type Style

type Style struct {
	FgColor    Color
	BgColor    Color
	Bold       bool
	Italic     bool
	Underline  bool
	Dim        bool
	Blink      bool
	Reverse    bool
	StrikeThru bool
}

Style represents text styling options

type WorkspacePanel

type WorkspacePanel struct {
	BasePanel
	// contains filtered or unexported fields
}

func NewWorkspacePanel

func NewWorkspacePanel(g *gocui.Gui) *WorkspacePanel

func (*WorkspacePanel) Draw

func (*WorkspacePanel) Refresh

func (w *WorkspacePanel) Refresh()

Refresh reloads all workspace information

func (*WorkspacePanel) ScrollDown

func (w *WorkspacePanel) ScrollDown()

ScrollDown scrolls the workspace panel down

func (*WorkspacePanel) ScrollDownByWheel

func (w *WorkspacePanel) ScrollDownByWheel()

ScrollDownByWheel scrolls the workspace panel down by 2 lines (mouse wheel)

func (*WorkspacePanel) ScrollToBottom

func (w *WorkspacePanel) ScrollToBottom()

ScrollToBottom scrolls to the bottom of the workspace panel

func (*WorkspacePanel) ScrollToTop

func (w *WorkspacePanel) ScrollToTop()

ScrollToTop scrolls to the top of the workspace panel

func (*WorkspacePanel) ScrollUp

func (w *WorkspacePanel) ScrollUp()

ScrollUp scrolls the workspace panel up

func (*WorkspacePanel) ScrollUpByWheel

func (w *WorkspacePanel) ScrollUpByWheel()

ScrollUpByWheel scrolls the workspace panel up by 2 lines (mouse wheel)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL