( _args: string, context: ToolUseContext, )
| 319 | } |
| 320 | |
| 321 | export async function call( |
| 322 | _args: string, |
| 323 | context: ToolUseContext, |
| 324 | ): Promise<LocalCommandResult> { |
| 325 | const diagnosticPath = writeRepaintDiagnostic(context) |
| 326 | // The visible command result is appended after this function resolves. |
| 327 | // Repainting synchronously repairs the old frame, then the command result |
| 328 | // adds rows and can reintroduce a vertical viewport offset. Defer one turn |
| 329 | // so the repaint targets the final transcript state that includes this |
| 330 | // command's own output. |
| 331 | setTimeout(() => { |
| 332 | requestReplTranscriptResetRedraw(process.stdout) |
| 333 | setTimeout(() => { |
| 334 | try { |
| 335 | const fs = require('fs') as typeof import('fs') |
| 336 | const before = fs.existsSync(diagnosticPath) |
| 337 | ? JSON.parse(fs.readFileSync(diagnosticPath, 'utf8')) |
| 338 | : { kind: 'ncode-repaint-diagnostic' } |
| 339 | writePayload(diagnosticPath, { |
| 340 | ...before, |
| 341 | after: buildPayload(context, 'after'), |
| 342 | }) |
| 343 | } catch { |
| 344 | // Best-effort diagnostic update; repaint itself must not fail. |
| 345 | } |
| 346 | }, 75).unref?.() |
| 347 | }, 0).unref?.() |
| 348 | return { |
| 349 | type: 'text', |
| 350 | value: `Repaint requested. Renderer diagnostic written to:\n${diagnosticPath}`, |
| 351 | } |
| 352 | } |
nothing calls this directly
no test coverage detected