refactor(cli,core): foundational layout, identity management, and type safety (#23286)

This commit is contained in:
Jarrod Whelan
2026-03-23 18:49:51 -07:00
committed by GitHub
parent 57a66f5f0d
commit 89ca78837e
31 changed files with 477 additions and 182 deletions
+26 -1
View File
@@ -900,11 +900,36 @@ class EditToolInvocation
DEFAULT_DIFF_OPTIONS,
);
// Determine the full content as originally proposed by the AI to ensure accurate diff stats.
let fullAiProposedContent = editData.newContent;
if (
this.params.modified_by_user &&
this.params.ai_proposed_content !== undefined
) {
try {
const aiReplacement = await calculateReplacement(this.config, {
params: {
...this.params,
new_string: this.params.ai_proposed_content,
},
currentContent: editData.currentContent ?? '',
abortSignal: signal,
});
fullAiProposedContent = aiReplacement.newContent;
} catch (error) {
const errorMsg =
error instanceof Error ? error.message : String(error);
debugLogger.log(`AI replacement fallback: ${errorMsg}`);
// Fallback to newContent if speculative calculation fails
fullAiProposedContent = editData.newContent;
}
}
const diffStat = getDiffStat(
fileName,
editData.currentContent ?? '',
fullAiProposedContent,
editData.newContent,
this.params.new_string,
);
displayResult = {
fileDiff,