cardeditor

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package cardeditor implements the direct-store create and edit overlay.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMessage

func IsMessage(message tea.Msg) bool

IsMessage identifies editor-owned asynchronous results without exporting implementation messages into the root package.

Types

type Model

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

Model owns every mutable editor field and all asynchronous generations.

func New

func New(st Store, user string) Model

New creates a closed editor. A nil store keeps the feature unavailable in lightweight root-model tests.

func (Model) BrandMounted

func (m Model) BrandMounted() bool

BrandMounted reports whether the editor's branded engine is ticking.

func (*Model) CancelAsync

func (m *Model) CancelAsync()

CancelAsync stops work whose result no longer has a live program to receive it. It is used by the root shutdown path and is otherwise idempotent.

func (*Model) ConsumeSaved

func (m *Model) ConsumeSaved() (string, bool)

ConsumeSaved reports one acknowledged mutation and its durable task id to the root exactly once.

func (Model) Dirty

func (m Model) Dirty() bool

Dirty reports whether the current fields differ from the last store-backed snapshot. Returning to the original values disarms the close guard.

func (Model) Enabled

func (m Model) Enabled() bool

Enabled reports whether the root has a writable direct-store backend.

func (Model) IsOpen

func (m Model) IsOpen() bool

IsOpen reports whether the overlay owns input and rendering.

func (*Model) MouseHandler

func (m *Model) MouseHandler(width, height int) func(tea.MouseMsg) tea.Cmd

MouseHandler maps clicks in the rendered editor to symbolic control targets. The root model can install this callback while the editor owns the screen; the resulting message is routed through Update just like a key press.

func (*Model) OpenAdd

func (m *Model) OpenAdd(status board.Status) tea.Cmd

OpenAdd resets the form for a card appended to status.

func (*Model) OpenEdit

func (m *Model) OpenEdit(task board.Task) tea.Cmd

OpenEdit resets the form from task and starts label and similar loads.

func (*Model) Overlay

func (m *Model) Overlay(background string, width, height int) string

Overlay composes the editor over the board/detail surface. Spec section 4: the panel is an elevation over what is behind it, never a frame, so it takes the shade step and the shadow with it.

func (Model) PointerSession

func (m Model) PointerSession() uint64

PointerSession identifies this open editor owner across harmless renders.

func (*Model) PointerSurface

func (m *Model) PointerSurface(width, height int) pointer.Surface

PointerSurface publishes the rendered handler together with its immutable stable-control topology for root-level stale-generation admission.

func (*Model) Refresh

func (m *Model) Refresh(task board.Task, found bool) tea.Cmd

Refresh adopts an external store snapshot only while the form is clean. Dirty input remains authoritative and receives a scoped stale warning.

func (*Model) Resize added in v1.7.3

func (m *Model) Resize(width, height int)

Resize keeps terminal-native snapshot navigation aligned with the latest root dimensions even while the ordinary overlay renderer is bypassed.

func (*Model) SetAIRunner

func (m *Model) SetAIRunner(runner SkillRunner, ctx context.Context)

SetAIRunner wires the shared runner and the root program context. A nil runner hides the draft controls while leaving ordinary editing available.

func (*Model) SetFrontMost

func (m *Model) SetFrontMost(front bool) tea.Cmd

SetFrontMost is the background handoff of spec section 10.2.6. At most spin.MaxEngines branded engines tick at once and the one that does belongs to the front-most open surface, so a backgrounded editor stops its engine - the draft keeps running, only the animation stops - and remounts at step 0 when it comes back to front.

func (*Model) SetProjectDefault

func (m *Model) SetProjectDefault(name string)

SetProjectDefault hands the editor the project a new card belongs to. The board keeps it current as the switcher moves; an open form is left alone, because the project on screen is the one the user is editing.

func (*Model) SetStyles

func (m *Model) SetStyles(styles *theme.Styles)

SetStyles hands the editor the resolved design system. Spec section 6.2: the root builds it once per terminal background and threads it down; the editor never constructs one per frame.

func (Model) TaskID

func (m Model) TaskID() string

TaskID returns the edited durable task id, or empty for add/closed modes.

func (Model) TerminalSelectionActive added in v1.7.3

func (m Model) TerminalSelectionActive() bool

func (Model) TerminalSelectionView added in v1.7.3

func (m Model) TerminalSelectionView(width, height int) string

func (*Model) Update

func (m *Model) Update(message tea.Msg) tea.Cmd

Update handles form input, store results, and stale-result generations.

func (*Model) View

func (m *Model) View(width, height int) string

View renders the editor pane centered on the terminal. The panel carries no shadow here: a shadow needs something to fall on, and this path has no board behind it.

type SkillRunner

type SkillRunner interface {
	RunSkill(context.Context, string, ai.Scope, string, string, int, int64) (ai.RunResult, error)
}

SkillRunner is the shared direct-store AI runner used by the editor. The narrow interface keeps model tests deterministic.

type Store

type Store interface {
	AddTask(string, board.Task) (board.Task, error)
	UpdateTaskIfFieldsMatch(string, string, store.TaskPatch, store.TaskPatch) (board.Task, error)
	Labels(string) ([]string, error)
	SearchSimilar(string, string, string, []string, int) ([]store.SimilarHit, error)
}

Store is the direct SQLite projection used by the editor. It deliberately mirrors the store package instead of introducing another adapter.

Jump to

Keyboard shortcuts

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