mission control for agent skills
Go agent-skillsagent-toolsai-agentsai-toolsai-workflowclaude-codeclicoding-agentscommand-line-tooldeveloper-toolsgoopencodeproductivity-toolsskill-discoveryskill-managementskillsterminal-appterminal-uituiworkflow-automation
Implement three-pane TUI layout, focus cycling, preflight dependency checks, and help modal
alvinrealc8ec6bc4d84b
diff --git a/internal/actions/actions.go b/internal/actions/actions.goindex a8c8227..2db343e 100644--- a/internal/actions/actions.go+++ b/internal/actions/actions.go@@ -70,6 +70,56 @@ func ForSkillsWithResolver(skills []*model.Skill, resolve SkillsResolver) []Commreturn previews}+func AppLevelActions() []CommandPreview {+ return AppLevelActionsWithResolver(ResolveSkillsCommand)+}++func AppLevelActionsWithResolver(resolve SkillsResolver) []CommandPreview {+ if resolve == nil {+ resolve = ResolveSkillsCommand+ }+ program, baseArgs := resolve()++ // Check availability: gate if neither skills nor npx is in PATH+ available, reason := HasSkillsOrNpx()++ previews := []CommandPreview{}++ // skills init+ initArgs := append([]string{}, baseArgs...)+ initArgs = append(initArgs, "init")+ initPreview := newPreview("skills_init", "Initialize skills in project", program, initArgs, "Initialize local skills configuration.", true, true, false, "yes")+ if !available {+ initPreview.Available = false+ initPreview.Reason = reason+ }+ previews = append(previews, initPreview)++ // skills find+ findArgs := append([]string{}, baseArgs...)+ findArgs = append(findArgs, "find")+ findPreview := newPreview("skills_find", "Find new skills (interactive)", program, findArgs, "Interactively discover and install skills.", true, false, false, "")+ if !available {+ findPreview.Available = false+ findPreview.Reason = reason+ } else {+ findPreview.Exec.Interactive = true+ }+ previews = append(previews, findPreview)++ // skills update+ updateArgs := append([]string{}, baseArgs...)+ updateArgs = append(updateArgs, "update")+ updatePreview := newPreview("skills_update", "Update project-local skills", program, updateArgs, "Check for and install updates for project-local skills.", true, true, false, "yes")+ if !available {+ updatePreview.Available = false+ updatePreview.Reason = reason+ }+ previews = append(previews, updatePreview)++ return previews+}+func bulkBatch(skills []*model.Skill, resolve SkillsResolver, actionID string) ([]ExecSpec, bool, string) {batch := make([]ExecSpec, 0, len(skills))for _, skill := range skills {@@ -99,6 +149,7 @@ func ForSkillWithResolver(sk *model.Skill, resolve SkillsResolver) []CommandPrevif resolve == nil {resolve = ResolveSkillsCommand}+ available, reason := HasSkillsOrNpx()previews := []CommandPreview{}if open, ok, reason := openEditorAction(sk); ok {previews = append(previews, open)@@ -106,7 +157,7 @@ func ForSkillWithResolver(sk *model.Skill, resolve SkillsResolver) []CommandPrevpreviews = append(previews, unavailablePreview("Open selected skill", reason))}- if addSource, skillFilter, ok, reason := addIdentity(sk); ok {+ if addSource, skillFilter, ok, reasonAdd := addIdentity(sk); ok {program, baseArgs := resolve()args := append([]string{}, baseArgs...)args = append(args, "add", addSource, "--skill", skillFilter, "--yes")@@ -114,21 +165,30 @@ func ForSkillWithResolver(sk *model.Skill, resolve SkillsResolver) []CommandPrevargs = append(args, "-g")}preview := newPreview("reinstall_update", "Reinstall/update selected skill", program, args, "Refresh this skill from its source.", true, true, false, "yes")+ if !available {+ preview.Available = false+ preview.Reason = reason+ }previews = append(previews, preview)} else {- previews = append(previews, unavailablePreview("Reinstall/update selected skill", reason))+ previews = append(previews, unavailablePreview("Reinstall/update selected skill", reasonAdd))}- if target, ok, reason := removeIdentity(sk); ok {+ if target, ok, reasonRemove := removeIdentity(sk); ok {program, baseArgs := resolve()args := append([]string{}, baseArgs...)args = append(args, "remove", target, "--yes")if sk.Scope == model.ScopeGlobal {args = append(args, "-g")}- previews = append(previews, newPreview("remove", "Remove selected skill", program, args, "Delete this installed skill.", true, true, true, target))+ preview := newPreview("remove", "Remove selected skill", program, args, "Delete this installed skill.", true, true, true, target)+ if !available {+ preview.Available = false+ preview.Reason = reason+ }+ previews = append(previews, preview)} else {- previews = append(previews, unavailablePreview("Remove selected skill", reason))+ previews = append(previews, unavailablePreview("Remove selected skill", reasonRemove))}return previews}@@ -164,8 +224,20 @@ func openEditorAction(sk *model.Skill) (CommandPreview, bool, string) {return preview, true, ""}+var LookPath = exec.LookPath++func HasSkillsOrNpx() (bool, string) {+ if _, err := LookPath("skills"); err == nil {+ return true, ""+ }+ if _, err := LookPath("npx"); err == nil {+ return true, ""+ }+ return false, "neither 'skills' nor 'npx' is available in your PATH"+}+func ResolveSkillsCommand() (string, []string) {- if _, err := exec.LookPath("skills"); err == nil {+ if _, err := LookPath("skills"); err == nil {return "skills", nil}return "npx", []string{"--yes", "skills"}diff --git a/internal/actions/actions_test.go b/internal/actions/actions_test.goindex 136beb0..a97c253 100644--- a/internal/actions/actions_test.go+++ b/internal/actions/actions_test.go@@ -1,12 +1,19 @@package actionsimport (+ "os""strings""testing""lazyskills/internal/model")+func init() {+ LookPath = func(name string) (string, error) {+ return "/mock/bin/" + name, nil+ }+}+func TestForSkillBuildsStructuredSanitizedCommandPreviews(t *testing.T) {t.Setenv("EDITOR", "")sk := &model.Skill{@@ -228,3 +235,56 @@ func containsArg(args []string, want string) bool {}return false}++func TestAppLevelActions(t *testing.T) {+ previews := AppLevelActions()+ if len(previews) != 3 {+ t.Fatalf("expected 3 app-level actions, got %d", len(previews))+ }+ initAct := previewByTitle(t, previews, "Initialize skills in project")+ if initAct.ID != "skills_init" || !initAct.Mutates || !initAct.RequiresConfirm {+ t.Errorf("unexpected skills init preview: %+v", initAct)+ }++ findAct := previewByTitle(t, previews, "Find new skills (interactive)")+ if findAct.ID != "skills_find" || !findAct.Mutates || findAct.RequiresConfirm || !findAct.Exec.Interactive {+ t.Errorf("unexpected skills find preview: %+v", findAct)+ }++ updateAct := previewByTitle(t, previews, "Update project-local skills")+ if updateAct.ID != "skills_update" || !updateAct.Mutates || !updateAct.RequiresConfirm {+ t.Errorf("unexpected skills update preview: %+v", updateAct)+ }+}++func TestMissingDepsDisablesActions(t *testing.T) {+ oldLookPath := LookPath+ defer func() { LookPath = oldLookPath }()++ // Simulate missing dependencies+ LookPath = func(name string) (string, error) {+ return "", os.ErrNotExist+ }++ sk := &model.Skill{+ Name: "Deploy Skill",+ Scope: model.ScopeGlobal,+ CanonicalPath: "/tmp/deploy-skill",+ GlobalLock: &model.GlobalLockEntry{Source: "owner/repo", SkillPath: "skills/deploy/SKILL.md", Ref: "v1"},+ }++ previews := ForSkill(sk)+ add := previewByTitle(t, previews, "Reinstall/update selected skill")+ if add.Available {+ t.Errorf("expected reinstall action to be unavailable when deps are missing")+ }+ if !strings.Contains(add.Reason, "neither 'skills' nor 'npx'") {+ t.Errorf("expected missing dependency reason, got %q", add.Reason)+ }++ appPreviews := AppLevelActions()+ appInit := previewByTitle(t, appPreviews, "Initialize skills in project")+ if appInit.Available {+ t.Errorf("expected app-level init to be unavailable when deps are missing")+ }+}diff --git a/internal/model/model.go b/internal/model/model.goindex e3f4229..835dc1a 100644--- a/internal/model/model.go+++ b/internal/model/model.go@@ -118,6 +118,18 @@ type Skill struct {HealthIssues []HealthIssue `json:"health_issues"`}+// ToolStatus represents the location and status of a development tool.+type ToolStatus struct {+ Exists bool `json:"exists"`+ Path string `json:"path,omitempty"`+}++// Preflight details the health and status of critical CLI dependencies.+type Preflight struct {+ CanRunSkills bool `json:"can_run_skills"`+ Tools map[string]ToolStatus `json:"tools"`+}+// ScanResult is the root schema produced by lazyskills scan --json.type ScanResult struct {Cwd string `json:"cwd"`@@ -126,4 +138,5 @@ type ScanResult struct {Agents []AgentState `json:"agents,omitempty"`Skills []*Skill `json:"skills"`HealthIssues []HealthIssue `json:"health_issues,omitempty"`+ Preflight *Preflight `json:"preflight,omitempty"`}diff --git a/internal/scan/scan.go b/internal/scan/scan.goindex d55f3e8..0030e97 100644--- a/internal/scan/scan.go+++ b/internal/scan/scan.go@@ -4,6 +4,7 @@ import ("errors""fmt""os"+ "os/exec""path/filepath""sort""strings"@@ -15,6 +16,32 @@ import ("lazyskills/internal/model")+var LookPath = exec.LookPath++func checkPreflight() *model.Preflight {+ tools := []string{"skills", "npx", "node", "npm"}+ toolStates := make(map[string]model.ToolStatus)+ for _, t := range tools {+ p, err := LookPath(t)+ toolStates[t] = model.ToolStatus{+ Exists: err == nil,+ Path: p,+ }+ }++ canRunSkills := false+ if toolStates["skills"].Exists {+ canRunSkills = true+ } else {+ canRunSkills = toolStates["npx"].Exists && toolStates["node"].Exists && toolStates["npm"].Exists+ }++ return &model.Preflight{+ CanRunSkills: canRunSkills,+ Tools: toolStates,+ }+}+func Run(cwd string) (model.ScanResult, error) {absCwd, err := filepath.Abs(cwd)if err != nil {@@ -26,7 +53,12 @@ func Run(cwd string) (model.ScanResult, error) {return model.ScanResult{}, fmt.Errorf("cwd is not a directory: %s", absCwd)}- res := model.ScanResult{Cwd: absCwd, ProjectLock: locks.ProjectLockPath(absCwd), GlobalLock: locks.GlobalLockPath()}+ res := model.ScanResult{+ Cwd: absCwd,+ ProjectLock: locks.ProjectLockPath(absCwd),+ GlobalLock: locks.GlobalLockPath(),+ Preflight: checkPreflight(),+ }res.Agents = agentStates(absCwd)skills := map[string]*model.Skill{}diff --git a/internal/scan/scan_test.go b/internal/scan/scan_test.goindex d270acd..43e683c 100644--- a/internal/scan/scan_test.go+++ b/internal/scan/scan_test.go@@ -480,3 +480,81 @@ func TestCorruptLockProducesTopLevelWarningAndJSONEncodes(t *testing.T) {t.Fatalf("result should JSON encode: %v", err)}}++func TestPreflightChecking(t *testing.T) {+ oldLookPath := LookPath+ defer func() { LookPath = oldLookPath }()++ LookPath = func(name string) (string, error) {+ if name == "skills" {+ return "/usr/local/bin/skills", nil+ }+ if name == "node" {+ return "/usr/local/bin/node", nil+ }+ return "", os.ErrNotExist+ }++ withHome(t)+ cwd := t.TempDir()+ res, err := Run(cwd)+ if err != nil {+ t.Fatal(err)+ }++ if res.Preflight == nil {+ t.Fatal("expected Preflight to not be nil")+ }++ if !res.Preflight.CanRunSkills {+ t.Error("expected CanRunSkills to be true when skills exists")+ }++ if !res.Preflight.Tools["skills"].Exists || res.Preflight.Tools["skills"].Path != "/usr/local/bin/skills" {+ t.Errorf("expected skills tool status to reflect exists/path, got %+v", res.Preflight.Tools["skills"])+ }++ if res.Preflight.Tools["npx"].Exists {+ t.Error("expected npx to not exist")+ }++ // Now check when skills does not exist, but npx/node/npm exist+ LookPath = func(name string) (string, error) {+ if name == "npx" {+ return "/usr/local/bin/npx", nil+ }+ if name == "node" {+ return "/usr/local/bin/node", nil+ }+ if name == "npm" {+ return "/usr/local/bin/npm", nil+ }+ return "", os.ErrNotExist+ }++ res, err = Run(cwd)+ if err != nil {+ t.Fatal(err)+ }+ if !res.Preflight.CanRunSkills {+ t.Error("expected CanRunSkills to be true when npx, node, npm exist but skills does not")+ }++ // Now check when skills does not exist and npx exists, but node is missing+ LookPath = func(name string) (string, error) {+ if name == "npx" {+ return "/usr/local/bin/npx", nil+ }+ if name == "npm" {+ return "/usr/local/bin/npm", nil+ }+ return "", os.ErrNotExist+ }+ res, err = Run(cwd)+ if err != nil {+ t.Fatal(err)+ }+ if res.Preflight.CanRunSkills {+ t.Error("expected CanRunSkills to be false when npx exists but node is missing")+ }+}diff --git a/internal/tui/tui.go b/internal/tui/tui.goindex edc6953..298aa60 100644--- a/internal/tui/tui.go+++ b/internal/tui/tui.go@@ -28,28 +28,42 @@ const (scopeGlobal)+type focusState int++const (+ focusSkills focusState = iota+ focusMetadata+ focusPreview+)+type appModel struct {- cwd string- result model.ScanResult- err error- selected int- filter scopeFilter- agent string- search string- searching bool- commands bool- selectedKeys map[string]bool- help bool- action int- confirming bool- confirmInput string- confirmError string- running bool- runningTitle string- actionResult *runner.Result- width int- height int- viewport viewport.Model+ cwd string+ result model.ScanResult+ err error+ selected int+ filter scopeFilter+ agent string+ search string+ searching bool+ commands bool+ selectedKeys map[string]bool+ help bool+ action int+ confirming bool+ confirmInput string+ confirmError string+ running bool+ runningTitle string+ actionResult *runner.Result+ width int+ height int+ viewport viewport.Model+ metadataViewport viewport.Model+ previewViewport viewport.Model+ detailsFocused bool+ detailModal bool+ helpOpen bool+ focus focusState}type paneLayout struct {@@ -94,8 +108,8 @@ var (normalActionSubStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("243"))actionNormalStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("255"))actionBorderColor = lipgloss.Color("62")- runningStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("208")).Bold(true)- successStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("114")).Bold(true)+ runningStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("208")).Bold(true)+ successStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("114")).Bold(true)// Metadata / Details stylingmetaKeyStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("243"))@@ -121,7 +135,13 @@ func Run(cwd string) error {}func newModel(cwd string) appModel {- return appModel{cwd: cwd, help: true, viewport: viewport.New(0, 0)}+ return appModel{+ cwd: cwd,+ help: true,+ viewport: viewport.New(0, 0),+ metadataViewport: viewport.New(0, 0),+ previewViewport: viewport.New(0, 0),+ }}func (m appModel) Init() tea.Cmd {@@ -183,6 +203,49 @@ func (m appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {}return m, nil}+ if m.detailModal {+ switch key {+ case "esc", "q":+ m.detailModal = false+ m.syncViewport()+ case "ctrl+c":+ return m, tea.Quit+ case "o":+ m.detailModal = false+ return m.startCurrentSkillActionByID("open_skill")+ case "c":+ m.detailModal = false+ m.commands = true+ m.action = 0+ m.syncViewport()+ case "down", "j":+ m.viewport.LineDown(1)+ m.clampViewportOffset()+ case "up", "k":+ m.viewport.LineUp(1)+ m.clampViewportOffset()+ case "pgdown", "ctrl+d":+ var cmd tea.Cmd+ m.viewport, cmd = m.viewport.Update(msg)+ return m, cmd+ case "pgup", "ctrl+u":+ var cmd tea.Cmd+ m.viewport, cmd = m.viewport.Update(msg)+ return m, cmd+ case "home":+ m.viewport.GotoTop()+ }+ return m, nil+ }+ if m.helpOpen {+ switch key {+ case "esc", "q", "?":+ m.helpOpen = false+ case "ctrl+c":+ return m, tea.Quit+ }+ return m, nil+ }if m.confirming {switch key {case "esc":@@ -290,7 +353,7 @@ func (m appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {case "q", "ctrl+c":return m, tea.Quitcase "?":- m.help = !m.help+ m.helpOpen = truecase "c":m.commands = !m.commandsm.action = 0@@ -302,6 +365,14 @@ func (m appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {m.selectCurrentSourceGroup()m.action = 0m.actionResult = nil+ case "enter":+ items := m.filteredSkills()+ if len(items) > 0 && m.selected < len(items) {+ m.detailModal = true+ m.detailsFocused = true+ m.viewport.GotoTop()+ m.syncViewport()+ }case "o":return m.startCurrentSkillActionByID("open_skill")case "u":@@ -329,38 +400,122 @@ func (m appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {m.action = 0m.actionResult = nilm.viewport.GotoTop()- case "tab":- m.filter = (m.filter + 1) % 3+ case "tab", "shift+tab":+ if key == "tab" {+ m.focus = (m.focus + 1) % 3+ } else {+ m.focus = (m.focus + 2) % 3+ }+ m.detailsFocused = (m.focus != focusSkills)+ case "1":+ m.focus = focusSkills+ m.detailsFocused = false+ case "2":+ m.focus = focusMetadata+ m.detailsFocused = true+ case "3":+ m.focus = focusPreview+ m.detailsFocused = true+ case "P":+ m.filter = scopeProjectm.selected = 0m.actionResult = nilm.viewport.GotoTop()- case "shift+tab":- m.filter = (m.filter + 2) % 3+ case "G":+ m.filter = scopeGlobalm.selected = 0m.actionResult = nilm.viewport.GotoTop()- case "right", "l":- m.jumpSourceGroup(1)- case "left", "h":- m.jumpSourceGroup(-1)- case "down", "j":- m.selected+++ case "f":+ m.filter = (m.filter + 1) % 3+ m.selected = 0m.actionResult = nilm.viewport.GotoTop()- case "up", "k":- m.selected--+ case "F":+ m.filter = scopeAll+ m.selected = 0m.actionResult = nilm.viewport.GotoTop()+ case "[":+ m.jumpSourceGroup(-1)+ case "]":+ m.jumpSourceGroup(1)+ case "l":+ if m.focus == focusSkills {+ m.jumpSourceGroup(1)+ }+ case "h":+ if m.focus == focusSkills {+ m.jumpSourceGroup(-1)+ }+ case "right":+ if m.focus == focusSkills {+ m.jumpSourceGroup(1)+ } else {+ m.focus = (m.focus + 1) % 3+ m.detailsFocused = (m.focus != focusSkills)+ }+ case "left":+ if m.focus == focusSkills {+ m.jumpSourceGroup(-1)+ } else {+ m.focus = (m.focus + 2) % 3+ m.detailsFocused = (m.focus != focusSkills)+ }+ case "down", "j":+ if m.focus == focusMetadata {+ m.metadataViewport.LineDown(1)+ m.clampViewportOffset()+ } else if m.focus == focusPreview {+ m.previewViewport.LineDown(1)+ m.clampViewportOffset()+ } else {+ m.selected+++ m.actionResult = nil+ m.metadataViewport.GotoTop()+ m.previewViewport.GotoTop()+ }+ case "up", "k":+ if m.focus == focusMetadata {+ m.metadataViewport.LineUp(1)+ m.clampViewportOffset()+ } else if m.focus == focusPreview {+ m.previewViewport.LineUp(1)+ m.clampViewportOffset()+ } else {+ m.selected--+ m.actionResult = nil+ m.metadataViewport.GotoTop()+ m.previewViewport.GotoTop()+ }case "pgdown", "ctrl+d":var cmd tea.Cmd- m.viewport, cmd = m.viewport.Update(msg)+ if m.focus == focusMetadata {+ m.metadataViewport, cmd = m.metadataViewport.Update(msg)+ } else if m.focus == focusPreview {+ m.previewViewport, cmd = m.previewViewport.Update(msg)+ } else {+ m.previewViewport, cmd = m.previewViewport.Update(msg)+ }return m, cmdcase "pgup", "ctrl+u":var cmd tea.Cmd- m.viewport, cmd = m.viewport.Update(msg)+ if m.focus == focusMetadata {+ m.metadataViewport, cmd = m.metadataViewport.Update(msg)+ } else if m.focus == focusPreview {+ m.previewViewport, cmd = m.previewViewport.Update(msg)+ } else {+ m.previewViewport, cmd = m.previewViewport.Update(msg)+ }return m, cmdcase "home":- m.viewport.GotoTop()+ if m.focus == focusMetadata {+ m.metadataViewport.GotoTop()+ } else if m.focus == focusPreview {+ m.previewViewport.GotoTop()+ } else {+ m.previewViewport.GotoTop()+ }}m.clampSelection()m.clampAction()@@ -390,9 +545,9 @@ func (m appModel) currentActions() []actions.CommandPreview {}items := m.filteredSkills()if len(items) == 0 || m.selected >= len(items) {- return nil+ return actions.AppLevelActions()}- return actions.ForSkill(items[m.selected])+ return append(actions.ForSkill(items[m.selected]), actions.AppLevelActions()...)}func (m appModel) startAction() (tea.Model, tea.Cmd) {@@ -477,7 +632,10 @@ func (m appModel) confirmAction() (tea.Model, tea.Cmd) {func confirmationAccepted(input, confirmValue string) bool {value := strings.TrimSpace(strings.ToLower(input))- return value == "" || value == "y" || value == "yes" || input == confirmValue+ if value == "" {+ return false+ }+ return value == "y" || value == "yes" || input == confirmValue}func (m appModel) executeAction(action actions.CommandPreview) (tea.Model, tea.Cmd) {@@ -555,11 +713,49 @@ func (m *appModel) syncViewport() {m.viewport.Height = 0m.viewport.SetContent("")m.viewport.SetYOffset(0)++ m.metadataViewport.Width = 0+ m.metadataViewport.Height = 0+ m.metadataViewport.SetContent("")+ m.metadataViewport.SetYOffset(0)++ m.previewViewport.Width = 0+ m.previewViewport.Height = 0+ m.previewViewport.SetContent("")+ m.previewViewport.SetYOffset(0)return}- m.viewport.Width = layout.Detail.ContentWidth- m.viewport.Height = layout.Detail.ContentHeight- m.viewport.SetContent(m.detailText(layout.Detail.ContentWidth))+ if m.detailModal || m.commands {+ modalWidth := 80+ if layout.Width < modalWidth+4 {+ modalWidth = layout.Width - 4+ }+ if modalWidth < 20 {+ modalWidth = 20+ }+ modalHeight := 24+ if layout.Height < modalHeight+4 {+ modalHeight = layout.Height - 4+ }+ if modalHeight < 7 {+ modalHeight = 7+ }+ m.viewport.Width = modalWidth - 4+ m.viewport.Height = modalHeight - 6+ m.viewport.SetContent(m.detailText(modalWidth - 4))+ } else {+ _, rightWidth, topHeight, bottomHeight := m.getThreePaneLayout()++ // For metadata viewport:+ m.metadataViewport.Width = max(1, rightWidth-4)+ m.metadataViewport.Height = max(1, topHeight-2)+ m.metadataViewport.SetContent(strings.Join(m.metadataLines(rightWidth-4), "\n"))++ // For preview viewport:+ m.previewViewport.Width = max(1, rightWidth-4)+ m.previewViewport.Height = max(1, bottomHeight-2)+ m.previewViewport.SetContent(strings.Join(m.previewLines(rightWidth-4), "\n"))+ }m.clampViewportOffset()}@@ -794,6 +990,13 @@ func sourceDetailLines(skill *model.Skill, width int) []string {if info.Ref != "" {lines = append(lines, formatMetaLine("Ref:", info.Ref, width))}+ if skill.LocalLock != nil && skill.LocalLock.ComputedHash != "" {+ lines = append(lines, formatMetaLine("Hash:", skill.LocalLock.ComputedHash, width))+ } else if skill.GlobalLock != nil && skill.GlobalLock.SkillFolderHash != "" {+ lines = append(lines, formatMetaLine("Hash:", skill.GlobalLock.SkillFolderHash, width))+ }+ lines = append(lines, "", dimStyle.Render("Note: Live update status is not checked here."))+ lines = append(lines, dimStyle.Render("Use update actions ('u' or 'c' menu) to check for updates."))return lines}@@ -815,6 +1018,32 @@ func (m *appModel) pruneSelected() {}}+func (m appModel) getThreePaneLayout() (listWidth, rightWidth, topHeight, bottomHeight int) {+ width := viewWidth(m.width)+ height := viewHeight(m.height) - 1 // Deduct 1 for persistent footer+ listWidth = width * 4 / 10+ if listWidth < 25 {+ listWidth = 25+ }+ if listWidth > width-30 {+ listWidth = width - 30+ }+ if listWidth < 10 {+ listWidth = 10+ }+ rightWidth = width - listWidth++ topHeight = height * 4 / 10+ if topHeight < 5 {+ topHeight = 5+ }+ if topHeight > height-5 {+ topHeight = height - 5+ }+ bottomHeight = height - topHeight+ return+}+func (m appModel) View() string {if m.err != nil {return fitToScreen(errorStyle.Render(fmt.Sprintf("LazySkills error: %s\n\nPress q to quit.", compat.SanitizeMetadata(m.err.Error()))), viewWidth(m.width), viewHeight(m.height))@@ -831,13 +1060,34 @@ func (m appModel) View() string {viewModel.height = layout.HeightviewModel.syncViewport()- leftStyle := paneStyle(layout.Left)- listStyle := paneStyle(layout.List)- detailStyle := paneStyle(layout.Detail)- left := leftStyle.Render(fitLines(viewModel.filterPane(layout.Left.ContentWidth), layout.Left.ContentHeight))- list := listStyle.Render(fitLines(viewModel.listPane(layout.List.ContentHeight, layout.List.ContentWidth), layout.List.ContentHeight))- detail := detailStyle.Render(viewModel.detailPane())- view := lipgloss.JoinHorizontal(lipgloss.Top, left, list, detail)+ listWidth, rightWidth, topHeight, bottomHeight := viewModel.getThreePaneLayout()++ listLayout := newPaneLayout(listWidth, viewModel.height - 1)+ metadataLayout := newPaneLayout(rightWidth, topHeight)+ previewLayout := newPaneLayout(rightWidth, bottomHeight)++ listStyle := paneStyle(listLayout, viewModel.focus == focusSkills)+ metadataStyle := paneStyle(metadataLayout, viewModel.focus == focusMetadata)+ previewStyle := paneStyle(previewLayout, viewModel.focus == focusPreview)++ listContent := fitLines(viewModel.listPane(listLayout.ContentHeight, listLayout.ContentWidth), listLayout.ContentHeight)+ list := decoratePane(listStyle.Render(listContent), listLayout, viewModel.focus == focusSkills, viewModel.listTitle())++ metadataContent := fitLines(viewModel.metadataViewport.View(), metadataLayout.ContentHeight)+ metadata := decoratePane(metadataStyle.Render(metadataContent), metadataLayout, viewModel.focus == focusMetadata, "2 Metadata")++ previewContent := fitLines(viewModel.previewViewport.View(), previewLayout.ContentHeight)+ preview := decoratePane(previewStyle.Render(previewContent), previewLayout, viewModel.focus == focusPreview, "3 Preview")++ rightSide := lipgloss.JoinVertical(lipgloss.Left, metadata, preview)+ view := lipgloss.JoinHorizontal(lipgloss.Top, list, rightSide)++ if viewModel.detailModal {+ return viewModel.detailModalOverlay(layout)+ }+ if viewModel.helpOpen {+ return viewModel.helpModalOverlay(layout)+ }if viewModel.running {return viewModel.runningOverlay(layout)}@@ -847,7 +1097,8 @@ func (m appModel) View() string {if viewModel.commands {return viewModel.commandsOverlay(layout)}- return view+ footer := viewModel.footerText(layout.Width)+ return view + "\n" + footer}func (m appModel) filterPane(width int) string {@@ -870,6 +1121,23 @@ func (m appModel) filterPane(width int) string {fmt.Sprintf("Issues: %d", issues),fmt.Sprintf("Agent: %s", m.agentLabel()),}+ if m.result.Preflight != nil {+ lines = append(lines, "", titleStyle.Render("Dependencies"))+ if m.result.Preflight.CanRunSkills {+ lines = append(lines, successStyle.Render(" ✓ Ready"))+ } else {+ lines = append(lines, errorStyle.Render(" ✗ Missing"))+ for _, tool := range []string{"skills", "npx", "node", "npm"} {+ status := "✓"+ style := successStyle+ if !m.result.Preflight.Tools[tool].Exists {+ status = "✗"+ style = errorStyle+ }+ lines = append(lines, style.Render(fmt.Sprintf(" %s %s", status, tool)))+ }+ }+ }if len(m.result.HealthIssues) > 0 {lines = append(lines, "", errorStyle.Render("Scan health"))for _, issue := range m.result.HealthIssues {@@ -884,7 +1152,31 @@ func (m appModel) filterPane(width int) string {lines = append(lines, "", "Search", prompt)}if m.help {- lines = append(lines, "", "Keys", "↑/↓ j/k select", "space mark", "s source mark", "o open", "u update", "x remove", "tab scope", "a agent", "A all agents", "c actions", "/ search", "r refresh", "? help", "q quit")+ lines = append(lines, "", "Keys",+ "↑/↓ j/k select/scroll",+ "1 / 2 focus pane",+ "tab cycle focus",+ "→/l focus det",+ "←/h focus list",+ "enter details modal",+ "P project scope",+ "G global scope",+ "f cycle scope",+ "F clear scope",+ "[ / ] grp jump",+ "space mark",+ "s source mark",+ "o open",+ "u update",+ "x remove",+ "a agent",+ "A all agents",+ "c actions",+ "/ search",+ "r refresh",+ "? help",+ "q quit",+ )}return strings.Join(lines, "\n")}@@ -907,24 +1199,79 @@ func scopeBadge(scope string) string {}}-func (m appModel) listPane(height, width int) string {- items := m.filteredSkills()- title := "All Skills"+func (m appModel) listTitle() string {+ title := "1 Skills"if m.agent != "" {- title = m.agentLabel() + " Skills"+ title = "1 Skills (" + m.agentLabel() + ")"}- lines := []string{titleStyle.Render(title)}+ return title+}++func (m appModel) listPane(height, width int) string {+ items := m.filteredSkills()+ var lines []stringif len(items) == 0 {- detail := "No skills match."- if m.agent != "" {- detail += fmt.Sprintf(" %s has no visible skills for this view.", m.agentLabel())+ var detail []string+ if m.result.Preflight != nil && !m.result.Preflight.CanRunSkills {+ detail = append(detail,+ errorStyle.Render("Missing Dependencies:"),+ "LazySkills cannot execute commands because required",+ "tools are missing.",+ "",+ "Please install Node.js & npm (which provides npx),",+ "or install the 'skills' CLI directly.",+ )+ } else if len(m.result.Skills) == 0 {+ detail = append(detail,+ "No skills found on your machine or project.",+ "",+ "To get started:",+ "1. Press 'c' to open actions and select 'skills init'.",+ "2. Or run 'skills find' to discover online skills.",+ "3. Or check documentation to manually link skills.",+ )+ } else {+ // Filters are active+ detail = append(detail, "No skills matched active filters.")+ if m.search != "" {+ detail = append(detail, "", fmt.Sprintf("• Search: '%s' (press Backspace to clear)", m.search))+ }+ if m.agent != "" {+ detail = append(detail, "", fmt.Sprintf("• Agent: '%s' has no compatible/visible skills in this view.", m.agentLabel()))+ }+ if m.filter == scopeProject {+ detail = append(detail, "", "• Scope: Project (press Tab to switch to Global)")+ } else if m.filter == scopeGlobal {+ detail = append(detail, "", "• Scope: Global (press Tab to switch to Project)")+ }}- if m.search != "" {- detail += " Clear search with backspace."++ wrappedLines := []string{""}+ for _, line := range detail {+ if line == "" {+ wrappedLines = append(wrappedLines, "")+ } else {+ wrappedLines = append(wrappedLines, dimStyle.Render(truncate(line, width)))+ }}- return strings.Join(append(lines, "", dimStyle.Render(detail)), "\n")+ return strings.Join(wrappedLines, "\n")+ }++ // Active status headers (clean, non-verbose)+ if m.search != "" {+ lines = append(lines, dimStyle.Render("Search: /"+m.search))}- visible := max(1, height-3)+ if m.agent != "" {+ lines = append(lines, dimStyle.Render("Agent: "+m.agentLabel()))+ }+ if m.result.Preflight != nil && !m.result.Preflight.CanRunSkills {+ lines = append(lines, errorStyle.Render("✗ Missing dependencies (press ? for help)"))+ }+ if len(lines) > 0 {+ lines = append(lines, "")+ }++ visible := max(1, height-len(lines))rows := []listRow{}previousGroup := ""selectedRow := 0@@ -1047,17 +1394,71 @@ func (m appModel) detailText(width int) string {return strings.Join(m.detailLines(width), "\n")}-func (m appModel) detailLines(width int) []string {+func (m appModel) detailTitle() string {+ items := m.filteredSkills()+ if len(items) == 0 {+ return "2 Details"+ }+ view := display.Skill(items[m.selected])+ return "2 Details: " + view.Name+}++func (m appModel) metadataLines(width int) []string {items := m.filteredSkills()if len(items) == 0 {- return []string{titleStyle.Render("Details"), "", dimStyle.Render("Select a skill to inspect it.")}+ var lines []string++ if len(m.result.HealthIssues) > 0 {+ lines = append(lines, errorStyle.Render("Scan health:"), "")+ for _, issue := range m.result.HealthIssues {+ lines = append(lines, truncate(fmt.Sprintf("- %s: %s", compat.SanitizeMetadata(issue.Type), compat.SanitizeMetadata(issue.Message)), width))+ }+ lines = append(lines, "")+ }++ if m.result.Preflight != nil && !m.result.Preflight.CanRunSkills {+ lines = append(lines,+ errorStyle.Render("Dependency Issue"),+ wrapText("LazySkills requires the 'skills' CLI or Node.js/npm (npx) to be installed and available in your PATH.", width),+ "",+ dimStyle.Render("Status:"),+ )+ for _, tool := range []string{"skills", "npx", "node", "npm"} {+ status := "missing"+ style := errorStyle+ if m.result.Preflight.Tools[tool].Exists {+ status = "available"+ style = successStyle+ }+ lines = append(lines, style.Render(fmt.Sprintf(" • %s: %s", tool, status)))+ }+ } else if len(m.result.Skills) == 0 {+ lines = append(lines,+ sectionHeaderStyle.Render("Welcome to LazySkills!"),+ "",+ wrapText("No skills were found in your project or global directory.", width),+ "",+ dimStyle.Render("Quick Onboarding:"),+ wrapText("1. Press 'c' to open actions and choose 'Initialize skills in project' to create a local skills directory.", width),+ wrapText("2. Choose 'Find new skills (interactive)' to search and install online skills.", width),+ wrapText("3. Link your existing skills using symlinks.", width),+ )+ } else {+ lines = append(lines,+ dimStyle.Render("Select a skill to inspect it."),+ )+ if m.search != "" {+ lines = append(lines, "", dimStyle.Render(fmt.Sprintf("Active search: '%s'", m.search)))+ }+ if m.agent != "" {+ lines = append(lines, "", dimStyle.Render(fmt.Sprintf("Active agent filter: '%s'", m.agentLabel())))+ }+ }++ return lines}view := display.Skill(items[m.selected])lines := []string{- titleStyle.Render(view.Name),- wrapText(view.Description, width),- "",- sectionHeaderStyle.Render("Metadata"),formatMetaLine("Scope:", string(view.Scope), width),formatMetaLine("Lock:", display.LockSummary(view), width),}@@ -1124,15 +1525,60 @@ func (m appModel) detailLines(width int) []string {}}+ if len(m.result.HealthIssues) > 0 {+ lines = append(lines, "", errorStyle.Render("Scan health"))+ for _, issue := range m.result.HealthIssues {+ lines = append(lines, truncate(fmt.Sprintf("- %s: %s", compat.SanitizeMetadata(issue.Type), compat.SanitizeMetadata(issue.Message)), width))+ }+ }++ return lines+}++func (m appModel) previewLines(width int) []string {+ items := m.filteredSkills()+ if len(items) == 0 {+ if m.result.Preflight != nil && !m.result.Preflight.CanRunSkills {+ return []string{+ errorStyle.Render("Preview Unavailable"),+ "Dependencies are missing.",+ }+ }+ return []string{+ dimStyle.Render("No skill selected for preview."),+ }+ }++ view := display.Skill(items[m.selected])+ if view.Preview == "" {+ return []string{dimStyle.Render("No preview available for this skill.")}+ }++ lines := []string{}+ previewLines := strings.Split(view.Preview, "\n")+ for _, line := range previewLines {+ lines = append(lines, wrapText(line, width))+ }+ return lines+}++func (m appModel) detailLines(width int) []string {+ items := m.filteredSkills()+ if len(items) == 0 {+ return m.metadataLines(width)+ }+ view := display.Skill(items[m.selected])+ lines := []string{+ titleStyle.Render(view.Name),+ "",+ }+ lines = append(lines, m.metadataLines(width)...)if view.Preview != "" {lines = append(lines, "")previewDivider := lipgloss.NewStyle().Foreground(lipgloss.Color("241")).Render(strings.Repeat("─", max(1, width)))lines = append(lines, previewDivider)lines = append(lines, sectionHeaderStyle.Render("Preview"), "")- previewLines := strings.Split(view.Preview, "\n")- for _, line := range previewLines {- lines = append(lines, wrapText(line, width))- }+ lines = append(lines, m.previewLines(width)...)}return lines}@@ -1321,7 +1767,7 @@ func (m appModel) commandPreview(sk *model.Skill, width int) []string {lines = append(lines, "", titleLine)cmdText := truncate(compat.SanitizeMetadata(preview.Command), width-4)- cmdLine := normalActionSubStyle.Render(" "+cmdText)+ cmdLine := normalActionSubStyle.Render(" " + cmdText)lines = append(lines, cmdLine)}}@@ -1361,31 +1807,161 @@ func (m appModel) renderActionResult(width int) []string {return lines}+func (m appModel) footerText(width int) string {+ var text string+ if m.running {+ text = "Working…"+ } else if m.confirming {+ text = "type y/yes/phrase · enter confirm · esc cancel"+ } else if m.searching {+ text = "type search · enter apply · esc cancel · backspace edit"+ } else if m.detailModal {+ text = "↑/↓ scroll · o edit · c commands · esc/q close"+ } else if m.commands {+ text = "↑/↓ choose · enter run · esc close"+ } else if m.helpOpen {+ text = "esc/q/? close help"+ } else if m.focus == focusMetadata {+ text = "↑/↓ scroll metadata · enter open · c commands · o edit · ? help"+ } else if m.focus == focusPreview {+ text = "↑/↓ scroll preview · enter open · c commands · o edit · ? help"+ } else {+ // focusSkills+ text = "enter open · c commands · / search · f scope · a agent · r reload · ? help"+ }+ return dimStyle.Render(truncate(text, width))+}++func (m appModel) helpModalOverlay(layout appLayout) string {+ modalWidth := 74+ if layout.Width < modalWidth+4 {+ modalWidth = layout.Width - 4+ }+ if modalWidth < 20 {+ modalWidth = 20+ }++ sections := []string{+ titleStyle.Render(" LazySkills Keyboard Help "),+ "",+ sectionHeaderStyle.Render("Navigation & Focus:"),+ " ↑/↓, j/k Move selection (Skills focus) or scroll (Metadata/Preview)",+ " 1 / 2 / 3 Focus Skills (1), Metadata (2), or Preview (3) pane",+ " tab / shift-tab Cycle focus forward / backward through panes",+ " →/l / ←/h Cycle focus forward / backward through panes",+ " [ / ] Jump to previous / next source group",+ "",+ sectionHeaderStyle.Render("Filters:"),+ " P / G Filter Project-only / Global-only scope",+ " f / F Cycle scope filter / Clear scope filter (All)",+ " a / A Cycle agent filter / Clear agent filter",+ " / Initiate text search",+ "",+ sectionHeaderStyle.Render("Actions & Selection:"),+ " enter Open scrollable read-only skill detail modal",+ " space Mark / unmark selected skill for bulk actions",+ " s Mark all skills in the current source group",+ " o Open selected skill directly in editor",+ " c Open command picker menu",+ " u / x Quick reinstall-update / remove for selection",+ " r Refresh scan snapshot",+ "",+ sectionHeaderStyle.Render("Safety & Modals:"),+ " esc Cancel action confirmation, search, picker, or modals",+ " q Close help modal, detail modal, or quit the app",+ }++ box := lipgloss.NewStyle().+ Border(lipgloss.RoundedBorder()).+ BorderForeground(actionBorderColor).+ Padding(1, 2).+ Width(modalWidth).+ Render(strings.Join(sections, "\n"))++ return fitToScreen(lipgloss.Place(layout.Width, layout.Height, lipgloss.Center, lipgloss.Center, box), layout.Width, layout.Height)+}++func (m appModel) detailModalOverlay(layout appLayout) string {+ modalWidth := 80+ if layout.Width < modalWidth+4 {+ modalWidth = layout.Width - 4+ }+ if modalWidth < 20 {+ modalWidth = 20+ }+ modalHeight := 24+ if layout.Height < modalHeight+4 {+ modalHeight = layout.Height - 4+ }+ if modalHeight < 7 {+ modalHeight = 7+ }++ m.viewport.Width = modalWidth - 4+ m.viewport.Height = modalHeight - 6+ m.viewport.SetContent(m.detailText(modalWidth - 4))++ helpLine := dimStyle.Render("esc/q close · o open in editor · c command picker · ↑/↓ scroll")++ content := []string{+ titleStyle.Render("Skill Detail View"),+ "",+ m.viewport.View(),+ "",+ helpLine,+ }++ box := lipgloss.NewStyle().+ Border(lipgloss.RoundedBorder()).+ BorderForeground(actionBorderColor).+ Padding(1, 2).+ Width(modalWidth).+ Height(modalHeight).+ Render(strings.Join(content, "\n"))++ return fitToScreen(lipgloss.Place(layout.Width, layout.Height, lipgloss.Center, lipgloss.Center, box), layout.Width, layout.Height)+}+func (m appModel) confirmationOverlay(layout appLayout) string {actions := m.currentActions()title := "Confirm action"phrase := ""+ command := ""if len(actions) > 0 && m.action < len(actions) {action := actions[m.action]title = compat.SanitizeMetadata(action.Title)phrase = compat.SanitizeMetadata(action.ConfirmValue)+ command = compat.SanitizeMetadata(action.Command)}lines := []string{- errorStyle.Bold(true).Render("Confirm"),- wrapText(title, 44),+ errorStyle.Bold(true).Render("Confirm Action"),+ "",+ sectionHeaderStyle.Render("Action:"),+ wrapText(title, 48),+ "",+ sectionHeaderStyle.Render("Command:"),+ dimStyle.Render(wrapText(command, 48)),"",- "Press Enter or y to confirm.",- "Type n or Esc to cancel.",}- if phrase != "" {- lines = append(lines, dimStyle.Render("Also accepted: "+phrase))+ if phrase == "yes" || phrase == "y" {+ lines = append(lines, "Type 'y' or 'yes' and press Enter to confirm.")+ } else if phrase != "" {+ lines = append(lines, "Type 'y', 'yes', or '"+phrase+"' and press Enter to confirm.")+ } else {+ lines = append(lines, "Type 'y' or 'yes' and press Enter to confirm.")}+ lines = append(lines, "Press Esc to cancel.")+if m.confirmError != "" {lines = append(lines, "", errorStyle.Render(m.confirmError))}input := compat.SanitizeMetadata(m.confirmInput)if input == "" {- input = dimStyle.Render("yes")+ placeholder := "y / yes"+ if phrase != "yes" && phrase != "y" && phrase != "" {+ placeholder = fmt.Sprintf("y / yes / %s", phrase)+ }+ input = dimStyle.Render(placeholder)}lines = append(lines, "", "> "+input+"_")box := lipgloss.NewStyle().Border(lipgloss.RoundedBorder()).BorderForeground(actionBorderColor).Padding(1, 2).Width(52).Render(strings.Join(lines, "\n"))@@ -1689,8 +2265,13 @@ func newPaneLayout(outerWidth, outerHeight int) paneLayout {}}-func paneStyle(p paneLayout) lipgloss.Style {- return borderStyle.+func paneStyle(p paneLayout, focused bool) lipgloss.Style {+ borderColor := lipgloss.Color("241")+ if focused {+ borderColor = actionBorderColor+ }+ return borderStyle.Copy().+ BorderForeground(borderColor).Width(p.StyleWidth).Height(p.StyleHeight).MaxWidth(p.OuterWidth).@@ -1760,3 +2341,78 @@ func firstNonEmpty(values ...string) string {}return ""}++func decoratePane(rendered string, p paneLayout, focused bool, title string) string {+ if title == "" {+ return rendered+ }+ lines := strings.Split(rendered, "\n")+ if len(lines) == 0 {+ return rendered+ }++ borderColor := lipgloss.Color("241")+ if focused {+ borderColor = actionBorderColor+ }+ borderStyle := lipgloss.NewStyle().Foreground(borderColor)++ formattedTitle := " " + title + " "+ titleWidth := lipgloss.Width(formattedTitle)++ leftCorner := "╭"+ leftLine := "─"+ rightCorner := "╮"++ totalWidth := p.OuterWidth++ rightLinesLen := totalWidth - 3 - titleWidth+ if rightLinesLen < 0 {+ // Truncate title+ maxTitleWidth := totalWidth - 5+ if maxTitleWidth > 0 {+ formattedTitle = " " + truncateTitle(title, maxTitleWidth) + " "+ titleWidth = lipgloss.Width(formattedTitle)+ rightLinesLen = totalWidth - 3 - titleWidth+ } else {+ formattedTitle = ""+ titleWidth = 0+ rightLinesLen = totalWidth - 2+ }+ }++ var styledTitle string+ if focused {+ styledTitle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("230")).Background(lipgloss.Color("62")).Render(formattedTitle)+ } else {+ styledTitle = lipgloss.NewStyle().Foreground(lipgloss.Color("241")).Render(formattedTitle)+ }++ var topLine string+ if rightLinesLen > 0 {+ topLine = borderStyle.Render(leftCorner) ++ borderStyle.Render(leftLine) ++ styledTitle ++ borderStyle.Render(strings.Repeat("─", rightLinesLen)) ++ borderStyle.Render(rightCorner)+ } else {+ topLine = borderStyle.Render(leftCorner) ++ borderStyle.Render(leftLine) ++ styledTitle ++ borderStyle.Render(rightCorner)+ }++ lines[0] = topLine+ return strings.Join(lines, "\n")+}++func truncateTitle(s string, width int) string {+ runes := []rune(s)+ if len(runes) <= width {+ return s+ }+ if width <= 1 {+ return "…"+ }+ return string(runes[:width-1]) + "…"+}diff --git a/internal/tui/tui_test.go b/internal/tui/tui_test.goindex c8e4c82..daed0ab 100644--- a/internal/tui/tui_test.go+++ b/internal/tui/tui_test.go@@ -9,6 +9,7 @@ import (tea "github.com/charmbracelet/bubbletea""github.com/charmbracelet/lipgloss"+ "lazyskills/internal/actions""lazyskills/internal/compat""lazyskills/internal/display""lazyskills/internal/model"@@ -61,13 +62,21 @@ func TestAgentFilterLimitsVisibleSkills(t *testing.T) {}func TestListTitleReflectsAgentFilter(t *testing.T) {- m := appModel{result: model.ScanResult{Skills: []*model.Skill{{Name: "Build", Scope: model.ScopeProject}}}}- if out := m.listPane(20, 80); !strings.Contains(out, "All Skills") {- t.Fatalf("expected all-skills title, got %q", out)+ m := appModel{width: 100, height: 20, result: model.ScanResult{Skills: []*model.Skill{{Name: "Build", Scope: model.ScopeProject}}}}+ if title := m.listTitle(); !strings.Contains(title, "1 Skills") {+ t.Fatalf("expected all-skills title, got %q", title)+ }+ out := m.View()+ if !strings.Contains(out, "1 Skills") {+ t.Fatalf("expected view to contain all-skills title in border, got %q", out)}m.agent = "opencode"- if out := m.listPane(20, 80); !strings.Contains(out, "OpenCode Skills") {- t.Fatalf("expected agent-specific title, got %q", out)+ if title := m.listTitle(); !strings.Contains(title, "1 Skills (OpenCode)") {+ t.Fatalf("expected agent-specific title, got %q", title)+ }+ out = m.View()+ if !strings.Contains(out, "1 Skills (OpenCode)") {+ t.Fatalf("expected view to contain agent-specific title in border, got %q", out)}}@@ -138,7 +147,7 @@ func TestAgentFilterCanSelectSupportedAgentWithNoSkills(t *testing.T) {t.Fatalf("expected no skills for claude-code, got %#v", items)}out := m.View()- if !strings.Contains(out, "Claude Code") || !strings.Contains(out, "has no visible skills") {+ if !strings.Contains(out, "Claude Code") || !strings.Contains(out, "No skills matched") {t.Fatalf("expected zero-skill agent empty state, got %q", out)}}@@ -320,7 +329,6 @@ func TestConfirmationAcceptsDefaultYAndYes(t *testing.T) {name stringinput string}{- {"default_enter", ""},{"y", "y"},{"yes", "yes"},}@@ -353,6 +361,29 @@ func TestConfirmationAcceptsDefaultYAndYes(t *testing.T) {}}+func TestConfirmationRejectsEmptyInput(t *testing.T) {+ called := false+ old := runExec+ runExec = func(spec runner.ExecSpec) runner.Result { called = true; return runner.Result{ExitCode: 0} }+ t.Cleanup(func() { runExec = old })++ m := actionTestModel(t.TempDir())+ m.commands = true+ m.action = actionIndex(t, m, "Reinstall/update selected skill")+ updated, _ := m.Update(tea.KeyMsg{Type: tea.KeyEnter})+ m = updated.(appModel)++ // Just press Enter with empty/whitespace input+ updated, cmd := m.Update(tea.KeyMsg{Type: tea.KeyEnter})+ m = updated.(appModel)+ if cmd != nil || m.running || !m.confirming {+ t.Fatalf("expected empty/whitespace input to be rejected, running=%v confirming=%v cmd=%v", m.running, m.confirming, cmd)+ }+ if called {+ t.Fatalf("expected command execution to not occur")+ }+}+func TestConfirmationRendersCenteredModal(t *testing.T) {m := actionTestModel(t.TempDir())m.commands = true@@ -360,7 +391,7 @@ func TestConfirmationRendersCenteredModal(t *testing.T) {updated, _ := m.Update(tea.KeyMsg{Type: tea.KeyEnter})m = updated.(appModel)out := m.View()- if !strings.Contains(out, "Confirm") || !strings.Contains(out, "Press Enter or y to confirm") || strings.Contains(out, "Bulk actions") {+ if !strings.Contains(out, "Confirm") || !strings.Contains(out, "press Enter to confirm") || strings.Contains(out, "Bulk actions") {t.Fatalf("expected standalone confirmation modal, got %q", out)}}@@ -658,7 +689,7 @@ func TestSkillListSeparatesNoSourceMetadata(t *testing.T) {}}-func TestLeftRightJumpSourceGroupsWithoutChangingScope(t *testing.T) {+func TestBracketJumpSourceGroupsWithoutChangingScope(t *testing.T) {m := appModel{width: 120, height: 32, result: model.ScanResult{Skills: []*model.Skill{{Name: "One", Scope: model.ScopeProject, LocalLock: &model.LocalLockEntry{Source: "owner/one"}},{Name: "Two", Scope: model.ScopeProject, LocalLock: &model.LocalLockEntry{Source: "owner/one"}},@@ -666,29 +697,148 @@ func TestLeftRightJumpSourceGroupsWithoutChangingScope(t *testing.T) {{Name: "Manual", Scope: model.ScopeProject},}}}- updated, _ := m.Update(tea.KeyMsg{Type: tea.KeyRight})+ updated, _ := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{']'}})next := updated.(appModel)if next.filter != scopeAll || next.selected != 2 {- t.Fatalf("expected right arrow to jump to next source group without changing scope, filter=%d selected=%d", next.filter, next.selected)+ t.Fatalf("expected ] to jump to next source group without changing scope, filter=%d selected=%d", next.filter, next.selected)}- updated, _ = next.Update(tea.KeyMsg{Type: tea.KeyLeft})+ updated, _ = next.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'['}})next = updated.(appModel)if next.filter != scopeAll || next.selected != 0 {- t.Fatalf("expected left arrow to jump to previous source group without changing scope, filter=%d selected=%d", next.filter, next.selected)+ t.Fatalf("expected [ to jump to previous source group without changing scope, filter=%d selected=%d", next.filter, next.selected)}}-func TestTabChangesScopeFilter(t *testing.T) {+func TestPaneFocusAndScroll(t *testing.T) {+ m := appModel{width: 120, height: 32, result: model.ScanResult{Skills: []*model.Skill{+ {Name: "One", Scope: model.ScopeProject},+ {Name: "Two", Scope: model.ScopeProject},+ }}}++ if m.detailsFocused {+ t.Fatal("expected detailsFocused to start false")+ }++ // Press 2 to focus metadata/details area.+ updated, _ := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'2'}})+ next := updated.(appModel)+ if !next.detailsFocused {+ t.Fatal("expected detailsFocused to be true after pressing 2")+ }++ // Press 1 to return to skills list.+ updated, _ = next.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'1'}})+ next = updated.(appModel)+ if next.detailsFocused {+ t.Fatal("expected detailsFocused to be false after pressing 1")+ }+}++func TestScopeFilterKeys(t *testing.T) {m := appModel{width: 120, height: 32, result: model.ScanResult{Skills: []*model.Skill{{Name: "Project", Scope: model.ScopeProject},{Name: "Global", Scope: model.ScopeGlobal},}}}- updated, _ := m.Update(tea.KeyMsg{Type: tea.KeyTab})+ // Test 'f' cycles scope All -> Project -> Global -> All+ updated, _ := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'f'}})next := updated.(appModel)if next.filter != scopeProject {- t.Fatalf("expected tab to switch to project scope, got %d", next.filter)+ t.Fatalf("expected f to switch to project scope, got %d", next.filter)+ }++ updated, _ = next.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'f'}})+ next = updated.(appModel)+ if next.filter != scopeGlobal {+ t.Fatalf("expected f to switch to global scope, got %d", next.filter)+ }++ // Test 'F' resets scope to All+ updated, _ = next.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'F'}})+ next = updated.(appModel)+ if next.filter != scopeAll {+ t.Fatalf("expected F to reset scope to All, got %d", next.filter)+ }++ // Test 'P' sets Project-only+ updated, _ = next.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'P'}})+ next = updated.(appModel)+ if next.filter != scopeProject {+ t.Fatalf("expected P to set project scope, got %d", next.filter)+ }++ // Test 'G' sets Global-only+ updated, _ = next.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'G'}})+ next = updated.(appModel)+ if next.filter != scopeGlobal {+ t.Fatalf("expected G to set global scope, got %d", next.filter)+ }+}++func TestFocusControls(t *testing.T) {+ m := appModel{width: 120, height: 32}++ if m.detailsFocused {+ t.Fatal("expected detailsFocused to start false")+ }++ // '2' focuses details+ updated, _ := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'2'}})+ m = updated.(appModel)+ if !m.detailsFocused {+ t.Fatal("expected 2 to focus details")+ }++ // '1' focuses list+ updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'1'}})+ m = updated.(appModel)+ if m.detailsFocused {+ t.Fatal("expected 1 to focus list")+ }++ // 'tab' cycles focus+ updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyTab})+ m = updated.(appModel)+ if !m.detailsFocused {+ t.Fatal("expected tab to cycle focus")+ }++ // 'shift+tab' cycles focus back+ updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyShiftTab})+ m = updated.(appModel)+ if m.detailsFocused {+ t.Fatal("expected shift+tab to cycle focus")+ }+}++func TestEnterSkillModal(t *testing.T) {+ m := appModel{width: 120, height: 32, result: model.ScanResult{Skills: []*model.Skill{+ {Name: "One", Scope: model.ScopeProject},+ }}}++ // Press Enter to open modal+ updated, _ := m.Update(tea.KeyMsg{Type: tea.KeyEnter})+ m = updated.(appModel)+ if !m.detailModal {+ t.Fatal("expected enter to open skill detail modal")+ }++ // Render modal view+ out := m.View()+ if !strings.Contains(out, "Skill Detail View") {+ t.Fatalf("expected modal title in View, got %s", out)+ }++ // Scroll down in modal+ updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'j'}})+ m = updated.(appModel)++ // Press Esc to close modal+ updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyEsc})+ m = updated.(appModel)+ if m.detailModal {+ t.Fatal("expected esc to close modal")}}@@ -826,10 +976,10 @@ func TestDetailPaneClipsLongPreview(t *testing.T) {preview := strings.Repeat("line\n", 80)m := appModel{width: 100, height: 20, result: model.ScanResult{Skills: []*model.Skill{{Name: "Long", Description: "desc", Scope: model.ScopeProject, Preview: preview}}}}m.syncViewport()- out := m.detailPane()+ out := m.previewViewport.View()lines := strings.Split(out, "\n")- if len(lines) > m.viewport.Height {- t.Fatalf("detail pane overflowed: got %d lines\n%s", len(lines), out)+ if len(lines) > m.previewViewport.Height {+ t.Fatalf("preview pane overflowed: got %d lines\n%s", len(lines), out)}}@@ -839,13 +989,113 @@ func TestDetailScrollKeysMoveViewport(t *testing.T) {m.syncViewport()updated, _ := m.Update(tea.KeyMsg{Type: tea.KeyPgDown})next := updated.(appModel)- if next.viewport.YOffset <= 0 {- t.Fatalf("expected detail scroll to move down, got %d", next.viewport.YOffset)+ if next.previewViewport.YOffset <= 0 {+ t.Fatalf("expected preview scroll to move down, got %d", next.previewViewport.YOffset)}updated, _ = next.Update(tea.KeyMsg{Type: tea.KeyHome})next = updated.(appModel)- if next.viewport.YOffset != 0 {- t.Fatalf("expected home to reset detail scroll, got %d", next.viewport.YOffset)+ if next.previewViewport.YOffset != 0 {+ t.Fatalf("expected home to reset preview scroll, got %d", next.previewViewport.YOffset)+ }+}++func TestThreePaneLayoutFocusAndScroll(t *testing.T) {+ m := appModel{width: 120, height: 32, result: model.ScanResult{Skills: []*model.Skill{+ {Name: "One", Scope: model.ScopeProject, Preview: "preview content", LocalLock: &model.LocalLockEntry{Source: "owner/one"}},+ {Name: "Two", Scope: model.ScopeProject, LocalLock: &model.LocalLockEntry{Source: "owner/two"}},+ }}}+ m.syncViewport()++ // Initial focus is focusSkills (0)+ if m.focus != focusSkills {+ t.Fatalf("expected initial focus to be focusSkills, got %v", m.focus)+ }++ // In Skills focus, h/l or left/right jump source groups instead of changing focus.+ updated, _ := m.Update(tea.KeyMsg{Type: tea.KeyRight})+ m = updated.(appModel)+ if m.focus != focusSkills || m.selected != 1 {+ t.Fatalf("expected right in skills focus to jump source group, got focus %v selection %d", m.focus, m.selected)+ }+ updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyLeft})+ m = updated.(appModel)+ if m.focus != focusSkills || m.selected != 0 {+ t.Fatalf("expected left in skills focus to jump source group back, got focus %v selection %d", m.focus, m.selected)+ }++ // Press 2 to focus Metadata+ updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'2'}})+ m = updated.(appModel)+ if m.focus != focusMetadata {+ t.Fatalf("expected 2 to focus metadata, got %v", m.focus)+ }++ // Press 3 to focus Preview+ updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'3'}})+ m = updated.(appModel)+ if m.focus != focusPreview {+ t.Fatalf("expected 3 to focus preview, got %v", m.focus)+ }++ // Press tab to cycle: Preview -> Skills+ updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyTab})+ m = updated.(appModel)+ if m.focus != focusSkills {+ t.Fatalf("expected tab cycle to Skills, got %v", m.focus)+ }++ // Press shift+tab to cycle backward: Skills -> Preview+ updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyShiftTab})+ m = updated.(appModel)+ if m.focus != focusPreview {+ t.Fatalf("expected shift+tab cycle to Preview, got %v", m.focus)+ }++ // Press left to cycle backward: Preview -> Metadata+ updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyLeft})+ m = updated.(appModel)+ if m.focus != focusMetadata {+ t.Fatalf("expected left cycle to Metadata, got %v", m.focus)+ }++ // Press right to cycle forward: Metadata -> Preview+ updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyRight})+ m = updated.(appModel)+ if m.focus != focusPreview {+ t.Fatalf("expected right cycle to Preview, got %v", m.focus)+ }++ // h/l should never change focus outside the Skills pane.+ updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'h'}})+ m = updated.(appModel)+ if m.focus != focusPreview {+ t.Fatalf("expected h to keep Preview focus, got %v", m.focus)+ }+ updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'l'}})+ m = updated.(appModel)+ if m.focus != focusPreview {+ t.Fatalf("expected l to keep Preview focus, got %v", m.focus)+ }++ // In Preview focus, scrolling j/k should change previewViewport offset, not skill selection+ m.selected = 0+ updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'j'}})+ m = updated.(appModel)+ if m.selected != 0 {+ t.Fatalf("expected preview scroll to not change skill selection, got selection %d", m.selected)+ }++ // Check View output has border titles+ out := m.View()+ if !strings.Contains(out, "1 Skills") || !strings.Contains(out, "2 Metadata") || !strings.Contains(out, "3 Preview") {+ t.Fatalf("expected border titles in View, got:\n%s", out)+ }++ // Enter opens modal+ updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyEnter})+ m = updated.(appModel)+ if !m.detailModal {+ t.Fatal("expected enter to open modal")}}@@ -962,3 +1212,127 @@ func TestVisibilityReasonTranslation(t *testing.T) {t.Errorf("expected filtered agent translation, got %v", linesFiltered)}}++func TestStaticUpdateAwarenessDisclaimers(t *testing.T) {+ m := appModel{width: 120, height: 32, result: model.ScanResult{Skills: []*model.Skill{{+ Name: "One", Scope: model.ScopeProject, LocalLock: &model.LocalLockEntry{Source: "owner/repo", ComputedHash: "abcdef123456"},+ }}}}+ out := m.View()+ if !strings.Contains(out, "Hash:") || !strings.Contains(out, "abcdef123456") {+ t.Fatalf("expected lock hash in metadata, got: %s", out)+ }+ if !strings.Contains(out, "Live update status is not checked here") {+ t.Fatalf("expected live update status disclaimer, got: %s", out)+ }+}++func TestDetailsOnboardingEmptyState(t *testing.T) {+ mEmpty := appModel{+ result: model.ScanResult{+ Skills: []*model.Skill{},+ },+ }+ lines := mEmpty.detailLines(80)+ joined := strings.Join(lines, "\n")+ if !strings.Contains(joined, "Welcome to LazySkills!") || !strings.Contains(joined, "No skills were found") {+ t.Fatalf("expected onboarding instructions in details pane, got %q", joined)+ }++ mMissingDeps := appModel{+ result: model.ScanResult{+ Skills: []*model.Skill{},+ Preflight: &model.Preflight{+ CanRunSkills: false,+ Tools: map[string]model.ToolStatus{+ "skills": {Exists: false},+ "npx": {Exists: false},+ "node": {Exists: false},+ "npm": {Exists: false},+ },+ },+ },+ }+ linesMissing := mMissingDeps.detailLines(80)+ joinedMissing := strings.Join(linesMissing, "\n")+ if !strings.Contains(joinedMissing, "Dependency Issue") || !strings.Contains(joinedMissing, "skills: missing") {+ t.Fatalf("expected dependency error details, got %q", joinedMissing)+ }+}++func TestSkillsFindTriggersRescan(t *testing.T) {+ m := appModel{}+ previews := m.currentActions()+ var findAct *actions.CommandPreview+ for _, p := range previews {+ if p.ID == "skills_find" {+ findAct = &p+ break+ }+ }+ if findAct == nil {+ t.Fatal("expected skills_find action in app-level actions")+ }+ if !findAct.Mutates {+ t.Error("expected skills_find to have Mutates = true to trigger TUI rescan")+ }+}++func TestContextualFooterAndHelpModal(t *testing.T) {+ m := appModel{+ width: 100,+ height: 30,+ result: model.ScanResult{+ Skills: []*model.Skill{+ {Name: "Build", Scope: model.ScopeProject},+ },+ },+ }+ m.syncViewport()++ // 1. Default footer (Skills focused)+ outDefault := m.View()+ if !strings.Contains(outDefault, "enter open · c commands") {+ t.Fatalf("expected default footer in View, got:\n%s", outDefault)+ }++ // 2. Metadata focus footer+ m.focus = focusMetadata+ outMeta := m.View()+ if !strings.Contains(outMeta, "scroll metadata") {+ t.Fatalf("expected metadata footer in View, got:\n%s", outMeta)+ }++ // 3. Preview focus footer+ m.focus = focusPreview+ outPreview := m.View()+ if !strings.Contains(outPreview, "scroll preview") {+ t.Fatalf("expected preview footer in View, got:\n%s", outPreview)+ }++ // 4. Search active footer+ m.searching = true+ outSearch := m.View()+ if !strings.Contains(outSearch, "type search · enter apply") {+ t.Fatalf("expected search footer in View, got:\n%s", outSearch)+ }+ m.searching = false++ // 5. Help modal open+ updated, _ := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'?'}})+ m = updated.(appModel)+ if !m.helpOpen {+ t.Fatal("expected ? to open help modal")+ }++ outHelp := m.View()+ if !strings.Contains(outHelp, "LazySkills Keyboard Help") || !strings.Contains(outHelp, "Navigation & Focus:") {+ t.Fatalf("expected help modal content in View, got:\n%s", outHelp)+ }++ // 6. Help modal close with 'q'+ updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'q'}})+ m = updated.(appModel)+ if m.helpOpen {+ t.Fatal("expected q to close help modal")+ }+}