panel

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScanAllCmd added in v0.1.1

func ScanAllCmd(r *Registry, cwd, home string, agents []agent.Agent) tea.Cmd

ScanAllCmd triggers scan for every panel in the registry.

func ScanCmd added in v0.1.1

func ScanCmd(p Core, cwd, home string, agents []agent.Agent) tea.Cmd

ScanCmd wraps Core.Scan as a Bubble Tea command.

func SyncPreviewCmd added in v0.1.1

func SyncPreviewCmd(p Core, selected Item, width int, previewGen *int) tea.Cmd

SyncPreviewCmd loads preview markdown asynchronously and returns PreviewLoadedMsg.

func VisibleListCount

func VisibleListCount(items []Item) int

VisibleListCount returns how many real rows are shown (excludes empty placeholders).

Types

type BindEffect added in v0.1.1

type BindEffect struct {
	Skill      *skilldomain.Skill
	MCPKey     string
	MCPMembers []*mcpdomain.Server
}

BindEffect describes starting the agent bind flow.

type Capabilities

type Capabilities struct {
	Inspect       bool
	Disable       bool
	Bind          bool
	Remove        bool
	Update        bool
	Find          bool
	Add           bool
	Init          bool
	SearchInstall bool
}

Capabilities describes which actions the active panel supports.

type Core added in v0.1.1

type Core interface {
	Tab() Tab
	Count() int
	CountLabel() string
	Capabilities() Capabilities

	Scan(ctx context.Context, cwd, home string, agents []agent.Agent) ScannedMsg
	ApplyScan(msg ScannedMsg) bool

	ListItems(agentFilter []string) []Item
	SearchItems(query string, agentFilter []string) []Item

	PanelTitle(state ViewState) string
	ReloadHint() string
	StaticPreview() string
	PreviewMarkdown(selected Item, width int) (string, error)

	SelectedSkill(item Item) bool
	SelectedMCP(item Item) bool
}

Core drives list content, scanning, and preview for one extension tab (no Bubble Tea).

type DisableEffect added in v0.1.1

type DisableEffect struct {
	Skill      *skilldomain.Skill
	MCPMembers []*mcpdomain.Server
}

DisableEffect describes a disable/enable toggle target.

type InspectEffect added in v0.1.1

type InspectEffect struct {
	SkillPath  string
	MCPKey     string
	MCPMembers []*mcpdomain.Server
}

InspectEffect describes how to open inspection for a list item.

type Item

type Item struct {
	Kind        ItemKind
	Title       string
	Desc        string
	Meta        string
	DetailLines []string
	Command     commands.Spec
	Skill       *skilldomain.Skill
	MCP         *mcpdomain.Server   // representative instance for mutations
	MCPKey      string              // config key (level-1 list selection)
	MCPMembers  []*mcpdomain.Server // all config files using this key
}

Item is the panel-neutral list row model used directly in the app layer.

func CommandItems

func CommandItems(specs []commands.Spec) []Item

CommandItems builds list rows for the help command catalog.

func (Item) BindEffect added in v0.1.1

func (i Item) BindEffect() (BindEffect, bool)

func (Item) CanBind

func (i Item) CanBind() bool

func (Item) CanDisable

func (i Item) CanDisable() bool

func (Item) CanInspect

func (i Item) CanInspect() bool

func (Item) CanRemove

func (i Item) CanRemove() bool

func (Item) CanUpdate

func (i Item) CanUpdate() bool

func (Item) DisableEffect added in v0.1.1

func (i Item) DisableEffect() (DisableEffect, bool)

func (Item) FilterValue

func (i Item) FilterValue() string

func (Item) InspectEffect added in v0.1.1

func (i Item) InspectEffect() (InspectEffect, bool)

func (Item) MCPConfigKey added in v0.1.1

func (i Item) MCPConfigKey() string

MCPConfigKey returns the MCP config key for this row, if any.

func (Item) RemoveEffect added in v0.1.1

func (i Item) RemoveEffect() (RemoveEffect, bool)

func (Item) Render added in v0.1.1

func (i Item) Render(styles theme.Styles, width int, selected bool) string

func (Item) UpdateEffect added in v0.1.1

func (i Item) UpdateEffect() (UpdateEffect, bool)

type ItemKind

type ItemKind int

ItemKind classifies list rows built by panels.

const (
	ItemCommand ItemKind = iota
	ItemSkill
	ItemMCP
	ItemMessage
)

type MCPKeyGroup

type MCPKeyGroup struct {
	ConfigKey string
	Members   []*mcpdomain.Server
}

MCPKeyGroup is one MCP config key and every on-disk instance (backend stays per file).

type MCPProvider

type MCPProvider interface {
	Servers() []*mcpdomain.Server
}

MCPProvider is optionally implemented by a Panel to expose scanned MCP servers.

type Panel

type Panel = Core

Panel is the extension tab contract used by the app (framework-agnostic core).

func NewMCPPanel

func NewMCPPanel() Panel

NewMCPPanel creates the MCP extension panel.

func NewSkillPanel

func NewSkillPanel(mgr manager.ExtensionManager[*skilldomain.Skill]) Panel

NewSkillPanel creates the skills extension panel.

type Placement

type Placement struct {
	Agent      string
	AgentName  string
	Scope      string
	ConfigPath string
	Disabled   bool
}

Placement is one agent/scope/path row for preview (levels 2+3 merged).

func PlacementsForKey

func PlacementsForKey(members []*mcpdomain.Server, home string) []Placement

type PreviewLoadedMsg

type PreviewLoadedMsg struct {
	Tab     Tab
	Content string
	Err     error
	Gen     int
}

PreviewLoadedMsg delivers async preview content.

type Registry

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

Registry holds all extension panels keyed by tab. Panels are registered by position; Tab is auto-assigned from registration order.

func NewRegistry

func NewRegistry(panels ...Panel) *Registry

NewRegistry builds a registry from the given panels. Tabs are assigned in registration order: the first panel gets TabSkills, second gets TabMCP, etc.

func (*Registry) Get

func (r *Registry) Get(tab Tab) Panel

Get returns the panel for a tab.

func (*Registry) MCPServers

func (r *Registry) MCPServers() []*mcpdomain.Server

MCPServers returns scanned MCP servers from the first panel that implements MCPProvider.

func (*Registry) Skills

func (r *Registry) Skills() []*skilldomain.Skill

Skills returns scanned skills from the first panel that implements SkillProvider.

func (*Registry) Tabs

func (r *Registry) Tabs() []Tab

Tabs returns tab order for rendering.

type RemoveEffect added in v0.1.1

type RemoveEffect struct {
	Skill      *skilldomain.Skill
	MCPName    string
	MCPMembers []*mcpdomain.Server
}

RemoveEffect describes a remove confirmation target.

type ScannedMsg added in v0.1.1

type ScannedMsg struct {
	Gen     uint64
	Tab     Tab
	Skills  []*skilldomain.Skill
	Servers []*mcpdomain.Server
	Err     error
}

ScannedMsg delivers panel scan results to the TUI (one message type per batch).

func MCPScan added in v0.1.1

func MCPScan(servers []*mcpdomain.Server, err error) ScannedMsg

MCPScan builds an MCP-tab scan result (Gen is set by the scan coordinator).

func SkillsScan added in v0.1.1

func SkillsScan(skills []*skilldomain.Skill, err error) ScannedMsg

SkillsScan builds a skills-tab scan result (Gen is set by the scan coordinator).

type SkillProvider

type SkillProvider interface {
	Skills() []*skilldomain.Skill
}

SkillProvider is optionally implemented by a Panel to expose scanned skills.

type Tab

type Tab int

Tab identifies an extension category shown in the left panel.

const (
	TabSkills Tab = iota
	TabMCP
)

func (Tab) Next

func (t Tab) Next() Tab

Next returns the next tab in cycle order.

func (Tab) Prev

func (t Tab) Prev() Tab

Prev returns the previous tab in cycle order.

func (Tab) String

func (t Tab) String() string

String returns the human-readable tab label.

type UpdateEffect added in v0.1.1

type UpdateEffect struct {
	Skill *skilldomain.Skill
}

UpdateEffect describes a skill update target.

type ViewState

type ViewState int

ViewState mirrors app session states relevant to panel titles.

const (
	ViewHome ViewState = iota
	ViewListing
	ViewSearching
	ViewInstalling
	ViewHelp
	ViewBinding
	ViewInspecting
)

Jump to

Keyboard shortcuts

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