MCPcopy
hub / github.com/OpenCoworkAI/open-codesign / buildApplyCommentUserPrompt

Function buildApplyCommentUserPrompt

packages/core/src/index.ts:332–353  ·  view source on GitHub ↗
(input: BuildApplyCommentPromptInput)

Source from the content-addressed store, hash-verified

330}
331
332export function buildApplyCommentUserPrompt(input: BuildApplyCommentPromptInput): string {
333 const selectedElementContext = formatUntrustedContext(
334 'selected_element',
335 'The following DOM metadata and HTML snippet identify the selected element for the requested edit.',
336 [
337 `Selected element tag: <${input.selection.tag}>`,
338 `Selected element selector: ${input.selection.selector}`,
339 `Selected element snippet:\n${input.selection.outerHTML || '(empty)'}`,
340 ].join('\n'),
341 );
342 const parts = [
343 'Revise the design source that is already in the workspace at `App.jsx`.',
344 'Keep the overall structure, copy, and layout intact unless the user request requires a broader change.',
345 'Prioritize the selected element first and avoid unrelated edits.',
346 `User request: ${input.comment.trim()}`,
347 selectedElementContext,
348 ];
349 parts.push(
350 'Edit the file with `str_replace_based_edit_tool` using `command: "view"` and `command: "str_replace"` — do NOT paste HTML in chat. When done, call the `done` tool. Keep the reply short; no narration beyond the required ≤15-word tool-call intros.',
351 );
352 return parts.join('\n\n');
353}
354
355export { composeSystemPrompt } from './prompts/index.js';
356

Callers 3

generate.test.tsFile · 0.90
registerGenerateIpcFunction · 0.90
applyCommentFunction · 0.85

Calls 1

formatUntrustedContextFunction · 0.85

Tested by

no test coverage detected