MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / buildSyntaxRejectMessage

Function buildSyntaxRejectMessage

src/tools/ast/syntax-check.ts:117–127  ·  view source on GitHub ↗
(filePath: string, language: string, issues: SyntaxIssue[])

Source from the content-addressed store, hash-verified

115
116/** Pure: the observation the model receives on refusal. */
117export function buildSyntaxRejectMessage(filePath: string, language: string, issues: SyntaxIssue[]): string {
118 const head = issues[0];
119 const more = issues.length > 1 ? ` (+${issues.length - 1} more)` : '';
120 const what = head.kind === 'missing' ? 'missing token' : 'syntax error';
121 return (
122 `[SYNTAX_REJECTED] This edit would break ${filePath}: ${language} ${what} at line ${head.line}` +
123 (head.excerpt ? `: "${head.excerpt}"` : '') + more + '. ' +
124 `The file on disk was NOT modified. Re-check your old_string/new_string boundaries ` +
125 `(a brace, quote, or tag is likely unbalanced), fix the edit so the full file parses, then retry.`
126 );
127}
128
129/**
130 * Orchestrator used by Transaction.write / multi_file_edit.

Callers 2

checkSyntaxForWriteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected