MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / createRunTerminalToolResult

Function createRunTerminalToolResult

cli/src/utils/bash-messages.ts:7–36  ·  view source on GitHub ↗
(params: {
  command: string
  cwd: string
  stdout: string | null
  stderr: string | null
  exitCode: number
  errorMessage?: string
})

Source from the content-addressed store, hash-verified

5import type { ToolResultOutput } from '@codebuff/common/types/messages/content-part'
6
7export function createRunTerminalToolResult(params: {
8 command: string
9 cwd: string
10 stdout: string | null
11 stderr: string | null
12 exitCode: number
13 errorMessage?: string
14}): ToolResultOutput[] {
15 const { command, cwd, stdout, stderr, exitCode, errorMessage } = params
16 if (errorMessage) {
17 return [
18 {
19 type: 'json' as const,
20 value: { command, startingCwd: cwd, errorMessage },
21 },
22 ]
23 }
24 return [
25 {
26 type: 'json' as const,
27 value: {
28 command,
29 startingCwd: cwd,
30 stdout: stdout || null,
31 stderr: stderr || null,
32 exitCode,
33 },
34 },
35 ]
36}
37
38export function buildBashHistoryMessages(params: {
39 command: string

Callers 3

processBashContextFunction · 0.90
runBashCommandFunction · 0.90
addBashMessageToHistoryFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected