mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-26 21:14:35 -07:00
chore: upgrade dep: diff 7.0.0-> 8.0.3 (#17403)
This commit is contained in:
committed by
GitHub
parent
df379b523b
commit
25c0802b52
@@ -45,7 +45,7 @@
|
||||
"ajv": "^8.17.1",
|
||||
"ajv-formats": "^3.0.0",
|
||||
"chardet": "^2.1.0",
|
||||
"diff": "^7.0.0",
|
||||
"diff": "^8.0.3",
|
||||
"fast-levenshtein": "^2.0.6",
|
||||
"fdir": "^6.4.6",
|
||||
"fzf": "^0.5.2",
|
||||
@@ -83,7 +83,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@google/gemini-cli-test-utils": "file:../test-utils",
|
||||
"@types/diff": "^7.0.2",
|
||||
"@types/fast-levenshtein": "^0.0.4",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/minimatch": "^5.1.2",
|
||||
|
||||
@@ -7,7 +7,12 @@
|
||||
import * as Diff from 'diff';
|
||||
import type { DiffStat } from './tools.js';
|
||||
|
||||
export const DEFAULT_DIFF_OPTIONS: Diff.PatchOptions = {
|
||||
const DEFAULT_STRUCTURED_PATCH_OPTS: Diff.StructuredPatchOptionsNonabortable = {
|
||||
context: 3,
|
||||
ignoreWhitespace: false,
|
||||
};
|
||||
|
||||
export const DEFAULT_DIFF_OPTIONS: Diff.CreatePatchOptionsNonabortable = {
|
||||
context: 3,
|
||||
ignoreWhitespace: false,
|
||||
};
|
||||
@@ -18,13 +23,13 @@ export function getDiffStat(
|
||||
aiStr: string,
|
||||
userStr: string,
|
||||
): DiffStat {
|
||||
const getStats = (patch: Diff.ParsedDiff) => {
|
||||
const getStats = (patch: Diff.StructuredPatch) => {
|
||||
let addedLines = 0;
|
||||
let removedLines = 0;
|
||||
let addedChars = 0;
|
||||
let removedChars = 0;
|
||||
|
||||
patch.hunks.forEach((hunk: Diff.Hunk) => {
|
||||
patch.hunks.forEach((hunk: Diff.StructuredPatchHunk) => {
|
||||
hunk.lines.forEach((line: string) => {
|
||||
if (line.startsWith('+')) {
|
||||
addedLines++;
|
||||
@@ -45,7 +50,7 @@ export function getDiffStat(
|
||||
aiStr,
|
||||
'Current',
|
||||
'Proposed',
|
||||
DEFAULT_DIFF_OPTIONS,
|
||||
DEFAULT_STRUCTURED_PATCH_OPTS,
|
||||
);
|
||||
const modelStats = getStats(modelPatch);
|
||||
|
||||
@@ -56,7 +61,7 @@ export function getDiffStat(
|
||||
userStr,
|
||||
'Proposed',
|
||||
'User',
|
||||
DEFAULT_DIFF_OPTIONS,
|
||||
DEFAULT_STRUCTURED_PATCH_OPTS,
|
||||
);
|
||||
const userStats = getStats(userPatch);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user