Commit b1e5a08
authored
feat: Telescope-inspired SearchPicker for all search commands (#886)
## Summary
Closes #866.
Replace the flat fzf-style `SearchTUI` with a new `SearchPicker`
component inspired by Neovim's Telescope plugin. All 12 search commands
now show a split-pane interface with a results list on the left and a
live preview of the selected item on the right.
### Key features
- **Three-region layout**: branding line (matching workflow run tree
style), search prompt, and split results/preview panes separated by
clean separator lines
- **Async preview loading** with 100ms debounce and LRU cache (10 items)
— previews show actual content (YAML with syntax highlighting, JSON with
syntax highlighting, rendered markdown reports) not just metadata
- **Alternate screen buffer** so the picker disappears cleanly on exit,
leaving only the selected item's detail in scrollback
- **Graceful degradation** across four tiers (bordered-split → stacked →
inline → minimal) based on terminal dimensions
- **Ctrl-u/d** scrolls the preview pane, stops at end of content
- **Domain-specific action keys** (e.g. `r` to run a workflow, `i` to
install an extension)
### Architecture
- New shared components in `renderers/components/`: `SearchPicker`,
`PickerBorders`, `ResultsList`, `PreviewPane`, `HelpBar`
- New hooks: `usePreviewFetch` (debounced async + LRU),
`usePreviewScroll`
- Pure `computePickerLayout()` function for tier selection (15 unit
tests)
- `LruCache` with 7 unit tests
- All search renderers migrated from `renderInteractiveSearch` to
`renderInteractivePicker` with `fetchPreview` callbacks
- Everything in the `renderers/` pattern, nothing in legacy `output/`
### Simplifications
- **Extension search**: eliminated the two-phase detail view +
while-loop back pattern
- **Workflow search**: removed action select menu and in-process
execution; `r` key shells out to `swamp workflow run` instead; preview
shows raw YAML with syntax highlighting
### Commands migrated
| Command | Preview content |
|---------|----------------|
| `model search` | Methods with arg types, data output specs |
| `data search` | Actual file content (JSON highlighted, markdown
rendered) |
| `extension search` | Full description, platforms, labels, dates |
| `type search` | Methods, global arguments schema |
| `vault search` | Vault config as formatted JSON |
| `vault type search` | Type, name, description |
| `workflow search` | Raw YAML with syntax highlighting |
| `workflow run search` | Job/step status tree with icons |
| `workflow history search` | Job/step status tree with icons |
| `model output search` | Provenance, artifacts, errors |
| `model method history search` | Same as model output |
| `report search` | Rendered markdown report content |
## Test Plan
- All 3574 existing tests pass
- 22 new unit tests (15 for picker layout tiers, 7 for LRU cache)
- Manual testing of all 12 search commands at various terminal sizes
- Verified: alternate screen buffer, scrollback output, Ctrl-u/d scroll,
action keys, cancel behavior
🤖 Generated with [Claude Code](https://claude.com/claude-code)1 parent 208a2da commit b1e5a08
31 files changed
Lines changed: 3893 additions & 735 deletions
File tree
- src
- cli/commands
- presentation/renderers
- components
- hooks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
46 | 49 | | |
47 | 50 | | |
48 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
49 | 99 | | |
50 | 100 | | |
51 | 101 | | |
| |||
185 | 235 | | |
186 | 236 | | |
187 | 237 | | |
188 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
189 | 244 | | |
190 | 245 | | |
191 | 246 | | |
| |||
207 | 262 | | |
208 | 263 | | |
209 | 264 | | |
210 | | - | |
211 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
212 | 270 | | |
213 | 271 | | |
214 | 272 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
43 | 72 | | |
44 | 73 | | |
45 | 74 | | |
| |||
69 | 98 | | |
70 | 99 | | |
71 | 100 | | |
72 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
73 | 110 | | |
74 | 111 | | |
75 | 112 | | |
| |||
78 | 115 | | |
79 | 116 | | |
80 | 117 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
87 | 129 | | |
88 | 130 | | |
89 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
41 | 70 | | |
42 | 71 | | |
43 | 72 | | |
| |||
56 | 85 | | |
57 | 86 | | |
58 | 87 | | |
59 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
60 | 94 | | |
61 | 95 | | |
62 | 96 | | |
| |||
65 | 99 | | |
66 | 100 | | |
67 | 101 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
74 | 113 | | |
75 | 114 | | |
76 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
97 | 133 | | |
98 | 134 | | |
99 | 135 | | |
| |||
146 | 182 | | |
147 | 183 | | |
148 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
149 | 189 | | |
150 | 190 | | |
151 | 191 | | |
| 192 | + | |
152 | 193 | | |
153 | 194 | | |
154 | 195 | | |
| |||
164 | 205 | | |
165 | 206 | | |
166 | 207 | | |
167 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
168 | 219 | | |
169 | 220 | | |
170 | 221 | | |
| |||
0 commit comments