MCPcopy Index your code
hub / github.com/codeaashu/claude-code / formatTaskOutput

Function formatTaskOutput

src/utils/task/outputFormatting.ts:22–38  ·  view source on GitHub ↗
(
  output: string,
  taskId: string,
)

Source from the content-addressed store, hash-verified

20 * the last N characters that fit within the limit.
21 */
22export function formatTaskOutput(
23 output: string,
24 taskId: string,
25): { content: string; wasTruncated: boolean } {
26 const maxLen = getMaxTaskOutputLength()
27
28 if (output.length <= maxLen) {
29 return { content: output, wasTruncated: false }
30 }
31
32 const filePath = getTaskOutputPath(taskId)
33 const header = `[Truncated. Full output: ${filePath}]\n\n`
34 const availableSpace = maxLen - header.length
35 const truncated = output.slice(-availableSpace)
36
37 return { content: header + truncated, wasTruncated: true }
38}
39

Callers 1

Calls 2

getMaxTaskOutputLengthFunction · 0.85
getTaskOutputPathFunction · 0.85

Tested by

no test coverage detected