MCPcopy
hub / github.com/anomalyco/opencode / normalizePromptContent

Function normalizePromptContent

packages/tui/src/editor.ts:12–24  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

10type EditorStdio = "inherit" | "pipe" | "ignore" | number | Stream
11
12export function normalizePromptContent(content: string) {
13 if (content.endsWith("\r\n")) {
14 const body = content.slice(0, -2)
15 return !body.includes("\n") && !body.includes("\r") ? body : content
16 }
17
18 if (content.endsWith("\n")) {
19 const body = content.slice(0, -1)
20 return !body.includes("\n") && !body.includes("\r") ? body : content
21 }
22
23 return content
24}
25
26export async function openEditor(input: { value: string; renderer: CliRenderer; cwd?: string; stdin?: EditorStdio }) {
27 const editor = process.env.VISUAL || process.env.EDITOR

Callers 3

editor.test.tsFile · 0.90
PromptFunction · 0.90
openEditorFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected