surshar / claude-code
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
Built by Anthropic · github.com/anthropics
| 1 | import type { On, RenderElement } from 'claude-code' |
| 2 | import type { Engine } from 'claude-code/testing' |
| 3 | |
| 4 | import PaneState from '../../../hooks/pane-state' |
| 5 | import Views from '../../../hooks/views' |
| 6 | import { drawsPane } from './draws-pane.js' |
| 7 | import { VIEW_PANE } from './view-pane.js' |
| 8 | |
| 9 | /** |
| 10 | * The pane seated beneath the plugin over whichever model the test hands |
| 11 | * next: docked on a 160-column terminal unless the overrides say inline. |
| 12 | * |
| 13 | * Each call draws VIEW_PANE through the engine with `paneView` over that |
| 14 | * model and answers the tree the engine took. |
| 15 | * |
| 16 | * @param $ the test's `$` |
| 17 | * @param on the test's `on` |
| 18 | * @param overrides kit members and the seat that differ from the ordinary |
| 19 | * @returns draws the pane over a model |
| 20 | */ |
| 21 | export function docksPane( |
| 22 | $: Engine, |
| 23 | on: On, |
| 24 | overrides: Partial<Omit<Views.Kit, 'ui'> & Views.PaneSeat> = {}, |
| 25 | ): (model: PaneState.PaneModel) => Promise<RenderElement> { |
| 26 | const { |
| 27 | placement = 'dock', |
| 28 | terminalColumns = VIEW_PANE.viewport?.columns ?? null, |
| 29 | ...kit |
| 30 | } = overrides |
| 31 | |
| 32 | const seat: Views.PaneSeat = { placement, terminalColumns } |
| 33 | |
| 34 | let model = PaneState.INITIAL_MODEL |
| 35 | |
| 36 | drawsPane(on, drawn => Views.paneView(drawn, model, seat), kit) |
| 37 | |
| 38 | return next => { |
| 39 | model = next |
| 40 | |
| 41 | return $.ui.render(VIEW_PANE) |
| 42 | } |
| 43 | } |