diff --git a/src/core/diff/strategies/new-unified/index.ts b/src/core/diff/strategies/new-unified/index.ts index 5b385616f6f..cc72da25510 100644 --- a/src/core/diff/strategies/new-unified/index.ts +++ b/src/core/diff/strategies/new-unified/index.ts @@ -130,8 +130,8 @@ Generate a unified diff that can be cleanly applied to modify code files. - Preserve exact indentation 3. Group related changes: - - Keep related modifications in the same hunk - - Start new hunks for logically separate changes + - Keep related modifications in the same chunk + - Start new chunks for logically separate changes - When modifying functions/methods, include the entire block ## Requirements: @@ -246,7 +246,7 @@ Your diff here if (!parsedDiff.hunks.length) { return { success: false, - error: "No hunks found in diff. Please ensure your diff includes actual changes and follows the unified diff format.", + error: "No chunks found in diff. Please ensure your diff includes actual changes and follows the unified diff format.", } } @@ -259,7 +259,7 @@ Your diff here } = findBestMatch(contextStr, result, 0, this.confidenceThreshold) if (confidence < this.confidenceThreshold) { - console.log("Full hunk application failed, trying sub-hunks strategy") + console.log("Full chunk application failed, trying sub-chunks strategy") // Try splitting the hunk into smaller hunks const subHunks = this.splitHunk(hunk) let subHunkSuccess = true @@ -304,7 +304,7 @@ Your diff here errorMsg += `- Context Lines: ${contextLines} out of ${totalLines} total lines (${Math.floor( contextRatio * 100, )}%)\n` - errorMsg += `- Attempted to split into ${subHunks.length} sub-hunks but still failed\n` + errorMsg += `- Attempted to split into ${subHunks.length} sub-chunks but still failed\n` if (contextRatio < 0.2) { errorMsg += "\nPossible Issues:\n" @@ -318,7 +318,7 @@ Your diff here errorMsg += "\nPossible Issues:\n" errorMsg += "- The diff may be targeting a different version of the file\n" errorMsg += - "- There may be too many changes in a single hunk, try splitting the changes into multiple hunks\n" + "- There may be too many changes in a single chunk, try splitting the changes into multiple chunks\n" } if (startLine && endLine) { diff --git a/src/core/diff/strategies/unified.ts b/src/core/diff/strategies/unified.ts index f4d6ead6aab..e3ae8642d9c 100644 --- a/src/core/diff/strategies/unified.ts +++ b/src/core/diff/strategies/unified.ts @@ -24,13 +24,13 @@ Format Requirements: - Use actual file paths - NO timestamps after paths -2. Hunks: +2. Chunks: \`\`\` @@ -lineStart,lineCount +lineStart,lineCount @@ -removed line +added line \`\`\` - - Each hunk starts with @@ showing line numbers for changes + - Each chunk starts with @@ showing line numbers for changes - Format: @@ -originalStart,originalCount +newStart,newCount @@ - Use - for removed/changed lines - Use + for new/modified lines @@ -96,10 +96,10 @@ Best Practices: - Remove complete old version with - lines - Add complete new version with + lines - Include correct line numbers -2. Moving code requires two hunks: - - First hunk: Remove from old location - - Second hunk: Add to new location -3. One hunk per logical change +2. Moving code requires two chunks: + - First chunk: Remove from old location + - Second chunk: Add to new location +3. One chunk per logical change 4. Verify line numbers match the line numbers you have in the file Usage: