Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.
TypeScript adeagent-ideai-agentsautomationbotclaude-codecodexghosttygrok-bothermes-agentmobile-appmuseopenclawopencodeorchestrationpiruntimeterminalworktreesyc-backed
import type { DiffComment } from './diff-comment-types'
function isMarkdownComment(comment: Pick<DiffComment, 'source'>): boolean {
return comment.source === 'markdown'
}
// Keep the pasted review-note contract deterministic and quote-safe across clients/agents.
export function formatDiffComment(c: DiffComment): string {
const escaped = c.body
.replace(/\\/g, '\\\\')
.replace(/"/g, '\\"')
.replace(/\r/g, '\\r')
.replace(/\n/g, '\\n')
const locationLabel =
c.lineNumber === 0
? 'Scope: file'
: c.startLine !== undefined && c.startLine !== c.lineNumber
? `Lines: ${c.startLine}-${c.lineNumber}`
: `Line: ${c.lineNumber}`
if (!isMarkdownComment(c)) {
return [`File: ${c.filePath}`, locationLabel, `User comment: "${escaped}"`].join('\n')
}
return [
`File: ${c.filePath}`,
'Source: markdown',
locationLabel,
`User comment: "${escaped}"`
].join('\n')
}
export function formatDiffComments(comments: readonly DiffComment[]): string {
return comments.map(formatDiffComment).join('\n\n')
}