mission control for agent skills
Go agent-skillsagent-toolsai-agentsai-toolsai-workflowclaude-codeclicoding-agentscommand-line-tooldeveloper-toolsgoopencodeproductivity-toolsskill-discoveryskill-managementskillsterminal-appterminal-uituiworkflow-automation
fix(tui): report no-op symlink cleanup
Alvin Unreale8e78dd55a41
diff --git a/internal/tui/tui.go b/internal/tui/tui.goindex 14db713..7e4b8df 100644--- a/internal/tui/tui.go+++ b/internal/tui/tui.go@@ -162,8 +162,9 @@ var ()type snapshotMsg struct {- result model.ScanResult- err error+ result model.ScanResult+ err error+ actionResult *runner.Result}type discoveryResultMsg struct {@@ -227,3 +228,10 @@ func loadSnapshot(cwd string) tea.Cmd {return snapshotMsg{result: result, err: err}}}++func loadSnapshotWithActionResult(cwd string, actionResult runner.Result) tea.Cmd {+ return func() tea.Msg {+ result, err := scan.Snapshot(cwd)+ return snapshotMsg{result: result, err: err, actionResult: &actionResult}+ }+}diff --git a/internal/tui/tui_test.go b/internal/tui/tui_test.goindex 5c86ec5..24976af 100644--- a/internal/tui/tui_test.go+++ b/internal/tui/tui_test.go@@ -710,6 +710,31 @@ func TestDeleteBrokenSymlinkRechecksPathBeforeRemove(t *testing.T) {}}+func TestDeleteBrokenSymlinkNoopReportsAndRescans(t *testing.T) {+ cwd := t.TempDir()+ missingLink := filepath.Join(cwd, "already-gone")+ m := appModel{cwd: cwd, width: 120, height: 32, selected: 1, result: model.ScanResult{Skills: []*model.Skill{{+ Name: "Broken",+ Scope: model.ScopeProject,+ ObservedPaths: []model.ObservedPath{{Path: missingLink, Status: model.StatusBrokenSymlink}},+ }}}}+ action := actions.CommandPreview{ID: "delete_broken_symlink", ConfirmValue: "Broken", Exec: actions.ExecSpec{Internal: "delete_broken_symlink", Args: []string{string(model.ScopeProject), "Broken"}}}++ updated, cmd := m.executeAction(action)+ next := updated.(appModel)+ if cmd == nil {+ t.Fatal("expected no-op delete to trigger a rescan")+ }+ if next.actionResult == nil || !strings.Contains(next.actionResult.Stdout, "0 broken symlink") {+ t.Fatalf("expected no-op informational action result, got %#v", next.actionResult)+ }+ updated, _ = next.Update(cmd())+ next = updated.(appModel)+ if next.actionResult == nil || !strings.Contains(next.actionResult.Stdout, "0 broken symlink") {+ t.Fatalf("expected no-op informational result to survive rescan, got %#v", next.actionResult)+ }+}+func TestDirectUpdateHotkeyStartsCurrentOrBulkAction(t *testing.T) {m := actionTestModel(t.TempDir())updated, cmd := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'u'}})diff --git a/internal/tui/update.go b/internal/tui/update.goindex 75a7da7..49ce38a 100644--- a/internal/tui/update.go+++ b/internal/tui/update.go@@ -77,7 +77,7 @@ func (m appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {}m.clampSelection()m.pruneSelected()- m.actionResult = nil+ m.actionResult = msg.actionResult// Seed with an empty (non-nil) slice so View's footer path doesn't// fall back to currentActions (which calls exec.LookPath ≈4s on WSL2).// clampAction in a later Update will populate the real actions.@@ -1197,18 +1197,29 @@ func (m appModel) executeAction(action actions.CommandPreview) (tea.Model, tea.Cbreak}if failed > 0 {- m.actionResult = &runner.Result{+ result := runner.Result{Program: "delete-broken-symlink",Args: []string{action.ConfirmValue},ExitCode: -1,Err: fmt.Sprintf("removed %d broken symlink(s), %d failed: %s", removed, failed, compat.SanitizeMetadata(firstErr)),}+ m.actionResult = &resultm.syncViewport()if removed > 0 {- return m, loadSnapshot(m.cwd)+ return m, loadSnapshotWithActionResult(m.cwd, result)}return m, nil}+ if removed == 0 {+ result := runner.Result{+ Program: "delete-broken-symlink",+ Args: []string{action.ConfirmValue},+ Stdout: "0 broken symlink(s) found at deletion time",+ }+ m.actionResult = &result+ m.syncViewport()+ return m, loadSnapshotWithActionResult(m.cwd, result)+ }m.actionResult = nilreturn m, loadSnapshot(m.cwd)}