MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / getLineSnippet

Method getLineSnippet

src/core/tools/ReadFileTool.ts:551–567  ·  view source on GitHub ↗

* Generate a human-readable line snippet for approval messages.

(entry: InternalFileEntry)

Source from the content-addressed store, hash-verified

549 * Generate a human-readable line snippet for approval messages.
550 */
551 private getLineSnippet(entry: InternalFileEntry): string {
552 if (entry.mode === "indentation") {
553 // Always show indentation mode with the effective anchor line
554 const effectiveAnchor = entry.anchor_line ?? entry.offset ?? 1
555 return `(indentation mode at line ${effectiveAnchor})`
556 }
557
558 const limit = entry.limit ?? DEFAULT_LINE_LIMIT
559 const offset1 = entry.offset ?? 1
560
561 if (offset1 > 1) {
562 return `(lines ${offset1}-${offset1 + limit - 1})`
563 }
564
565 // Always show the line limit, even when using the default
566 return `(up to ${limit} lines)`
567 }
568
569 /**
570 * Build and push the final result to the tool output.

Callers 1

requestApprovalMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected