spacehub

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

claude-code / mods / diff / hooks / pane-state / turn-title-of / turn-title-of.ts
16 lines · 510 BRaw
1import type Turns from '../../turns'
2import type { DialogTitle } from '../dialog-title'
3
4/**
5 * A picked turn's heading, as the built-in dialog titles its tab: the
6 * turn's number, then its prompt's opening words in quotes when it has any.
7 *
8 * @param turn the turn
9 * @returns the title and its dim subtitle
10 */
11export const turnTitleOf = (
12 turn: Pick<Turns.TurnDiff, 'index' | 'preview'>,
13): DialogTitle => ({
14 title: `Turn ${turn.index}`,
15 subtitle: turn.preview === '' ? '' : `"${turn.preview}"`,
16})