Skip to content

getToolPreviewLines

getToolPreviewLines(config, toolName, command, fallback): number

Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/config/shell-policy.ts:216

TUI-C105 — how many lines of toolName’s output the COLLAPSED preview shows, resolved per-tool override → global default → fallback.

The per-tool override rides the GthConfig.builtInTools registry through the SAME per-command-then-root pick as every other entry here, so a tool’s display depth is configured beside its other knobs rather than on a second per-tool surface (CFG-18’s whole point). The global default is a root key, because the issue behind this asks for less tool-output noise generally and the review tool is only the worst offender.

0 is a legitimate value — it means “summary line only”, which is the setting this exists to provide. So the guard is >= 0, deliberately NOT the > 0 that getGhReadFileMaxBytes applies to a byte cap where zero would mean “return nothing”. A negative, non-finite or non-numeric value is meaningless here and falls back, the same way every other resolver in this module treats an out-of-range value.

fallback is passed in rather than read from a constant here because the canonical cap belongs to the render layer (core/toolDisplay’s TOOL_OUTPUT_PREVIEW_LINES), and importing it into config would close a cycle — the render layer is what calls this. Duplicating the number instead would give the project two sources of truth for one cap.

command is the run’s command when one is known; undefined reads the root registry only.

Pick<GthConfig, "commands" | "builtInTools" | "toolOutputPreviewLines"> | undefined

string

GthCommand | undefined

number

number