MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / createRenderHooks

Function createRenderHooks

src/rendering/render.ts:90–178  ·  view source on GitHub ↗
(
  strategy: RenderStrategy,
  options: {
    interactive: boolean;
    runtime?: RuntimeKind;
    outputStyle?: OutputStyle;
    filePathRenderStyle?: FilePathRenderStyle;
    includeHeaderDetails?: boolean;
    includeNextSteps?: boolean;
  },
)

Source from the content-addressed store, hash-verified

88}
89
90function createRenderHooks(
91 strategy: RenderStrategy,
92 options: {
93 interactive: boolean;
94 runtime?: RuntimeKind;
95 outputStyle?: OutputStyle;
96 filePathRenderStyle?: FilePathRenderStyle;
97 includeHeaderDetails?: boolean;
98 includeNextSteps?: boolean;
99 },
100): RenderSessionHooks {
101 const suppressWarnings = sessionStore.get('suppressWarnings');
102 const config = getConfig();
103 const showTestTiming = config.showTestTiming;
104 const outputStyle = options.outputStyle ?? (options.runtime === 'mcp' ? 'minimal' : 'normal');
105 const filePathRenderStyle = resolveFilePathRenderStyle({
106 explicit: options.filePathRenderStyle,
107 configured: config.filePathRenderStyle,
108 outputStyle,
109 });
110 const includeHeaderDetails = options.includeHeaderDetails ?? outputStyle !== 'minimal';
111
112 switch (strategy) {
113 case 'text':
114 return {
115 finalize: (input) =>
116 renderCliTextTranscript({
117 ...input,
118 suppressWarnings: suppressWarnings ?? false,
119 showTestTiming,
120 filePathRenderStyle,
121 includeHeaderDetails,
122 includeNextSteps: options.includeNextSteps ?? true,
123 }),
124 };
125 case 'raw':
126 return {
127 onEmit: (fragment) => {
128 if (fragment.kind === 'transcript') {
129 if (fragment.fragment === 'process-command') {
130 const dim = process.stderr.isTTY ? '\x1B[2m' : '';
131 const reset = process.stderr.isTTY ? '\x1B[0m' : '';
132 process.stderr.write(`${dim}$ ${fragment.displayCommand}${reset}\n`);
133 } else if (fragment.fragment === 'process-line') {
134 process.stderr.write(fragment.line);
135 }
136 }
137 },
138 finalize: (input) => {
139 const nonTranscriptItems = (input.items ?? []).filter((f) => f.kind !== 'transcript');
140 const text = renderCliTextTranscript({
141 items: nonTranscriptItems,
142 structuredOutput: input.structuredOutput,
143 nextSteps: input.nextSteps,
144 nextStepsRuntime: input.nextStepsRuntime,
145 suppressWarnings: suppressWarnings ?? false,
146 showTestTiming,
147 filePathRenderStyle,

Callers 2

createRenderSessionFunction · 0.85
renderTranscriptFunction · 0.85

Calls 10

getConfigFunction · 0.90
renderCliTextTranscriptFunction · 0.90
createCliTextRendererFunction · 0.90
getMethod · 0.80
onFragmentMethod · 0.80
writeMethod · 0.65
setStructuredOutputMethod · 0.65
setNextStepsMethod · 0.65
finalizeMethod · 0.65

Tested by

no test coverage detected