mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 08:03:39 +00:00
feat: add line number display to HTML export for read tool calls
Implements line number display in HTML exports for read tool calls, matching the TUI format. When offset/limit parameters are provided, displays path:startLine-endLine in yellow color. Fixes #166
This commit is contained in:
parent
cf2f5742cc
commit
09a48fd1c3
2 changed files with 16 additions and 1 deletions
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- **HTML export line numbers**: Read tool calls in HTML exports now display line number ranges (e.g., `file.txt:10-20`) when offset/limit parameters are used, matching the TUI display format. Line numbers appear in yellow color for better visibility. ([#166](https://github.com/badlogic/pi-mono/issues/166))
|
||||
|
||||
## [0.18.1] - 2025-12-10
|
||||
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -350,7 +350,18 @@ function formatToolExecution(
|
|||
|
||||
case "read": {
|
||||
const path = shortenPath((args?.file_path as string) || (args?.path as string) || "");
|
||||
html = `<div class="tool-header"><span class="tool-name">read</span> <span class="tool-path">${escapeHtml(path || "...")}</span></div>`;
|
||||
const offset = args?.offset as number | undefined;
|
||||
const limit = args?.limit as number | undefined;
|
||||
|
||||
// Build path display with offset/limit suffix (in yellow color if offset/limit used)
|
||||
let pathHtml = escapeHtml(path || "...");
|
||||
if (offset !== undefined || limit !== undefined) {
|
||||
const startLine = offset ?? 1;
|
||||
const endLine = limit !== undefined ? startLine + limit - 1 : "";
|
||||
pathHtml += `<span class="line-numbers" style="color: ${COLORS.yellow}">:${startLine}${endLine ? `-${endLine}` : ""}</span>`;
|
||||
}
|
||||
|
||||
html = `<div class="tool-header"><span class="tool-name">read</span> <span class="tool-path">${pathHtml}</span></div>`;
|
||||
if (result) {
|
||||
const output = getTextOutput();
|
||||
if (output) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue