MCPcopy Index your code
hub / github.com/anomalyco/opencode / title

Function title

packages/opencode/src/cli/cmd/run/splash.ts:72–98  ·  view source on GitHub ↗
(text: string | undefined)

Source from the content-addressed store, hash-verified

70}
71
72function title(text: string | undefined): string {
73 if (!text) {
74 return SPLASH_TITLE_FALLBACK
75 }
76
77 let value = ""
78 let gap = false
79 for (const char of text.trim()) {
80 if (char === " " || char === "\n" || char === "\r" || char === "\t") {
81 gap = true
82 continue
83 }
84
85 if (gap && value.length > 0) {
86 value += " "
87 }
88
89 value += char
90 gap = false
91 }
92
93 if (!value) {
94 return SPLASH_TITLE_FALLBACK
95 }
96
97 return Locale.truncate(value, SPLASH_TITLE_LIMIT)
98}
99
100function write(
101 root: BoxRenderable,

Callers 3

RunFooterSubagentBodyFunction · 0.70
RunPermissionBodyFunction · 0.70
splashMetaFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected