MCPcopy
hub / github.com/bombshell-dev/clack / message

Function message

packages/prompts/src/task-log.ts:140–161  ·  view source on GitHub ↗
(buffer: BufferEntry, msg: string, mopts?: TaskLogMessageOptions)

Source from the content-addressed store, hash-verified

138 }
139 };
140 const message = (buffer: BufferEntry, msg: string, mopts?: TaskLogMessageOptions) => {
141 clear(false);
142 if ((mopts?.raw !== true || !lastMessageWasRaw) && buffer.value !== '') {
143 buffer.value += '\n';
144 }
145 buffer.value += stripDestructiveANSI(msg);
146 lastMessageWasRaw = mopts?.raw === true;
147 if (opts.limit !== undefined) {
148 const lines = buffer.value.split('\n');
149 const linesToRemove = lines.length - opts.limit;
150 if (linesToRemove > 0) {
151 const removedLines = lines.splice(0, linesToRemove);
152 if (retainLog) {
153 buffer.full += (buffer.full === '' ? '' : '\n') + removedLines.join('\n');
154 }
155 }
156 buffer.value = lines.join('\n');
157 }
158 if (isTTY) {
159 printBuffers();
160 }
161 };
162 const printBuffers = (): void => {
163 for (const buffer of buffers) {
164 if (buffer.result) {

Callers

nothing calls this directly

Calls 3

stripDestructiveANSIFunction · 0.85
printBuffersFunction · 0.85
clearFunction · 0.70

Tested by

no test coverage detected