MCPcopy Create free account
hub / github.com/Kong/insomnia / statusWithIntelligentDiff

Method statusWithIntelligentDiff

packages/insomnia/src/sync/git/git-vcs.ts:942–991  ·  view source on GitHub ↗

* Enhanced status method that includes intelligent diff analysis * * This method extends the regular statusWithContent() to include intelligent * change detection that can distinguish between meaningful changes and * cosmetic changes like property reordering or timestamp updates. *

()

Source from the content-addressed store, hash-verified

940 * @returns Promise<GitStatusWithIntelligentDiff[]> Array of status objects with intelligent diff analysis
941 */
942 async statusWithIntelligentDiff(): Promise<GitStatusWithIntelligentDiff[]> {
943 // Get the regular status first
944 const status = await this.filesStatus();
945
946 // Enhance each status entry with intelligent diff analysis
947 const enhancedStatus = await Promise.all(
948 status.map(async entry => {
949 const { filepath, head, workdir, stage } = entry;
950
951 // Only analyze files that have changes and are YAML files
952 const hasChanges = head.status !== workdir.status || workdir.status !== stage.status;
953
954 const isYamlFile = path.extname(filepath) === '.yaml';
955
956 if (!hasChanges || !isYamlFile) {
957 return {
958 ...entry,
959 includesSignificantChanges: hasChanges,
960 };
961 }
962
963 try {
964 // Get the actual file content for comparison
965 const fileStatus = await this.fileStatus(filepath);
966
967 if (!fileStatus.head || !fileStatus.workdir) {
968 return {
969 ...entry,
970 includesSignificantChanges: hasChanges,
971 };
972 }
973
974 // Analyze the changes using intelligent diff detection
975 const includesSignificantChanges = hasSignificantChanges(fileStatus.head, fileStatus.workdir, filepath);
976
977 return {
978 ...entry,
979 includesSignificantChanges,
980 };
981 } catch {
982 return {
983 ...entry,
984 includesSignificantChanges: hasChanges,
985 };
986 }
987 }),
988 );
989
990 return enhancedStatus;
991 }
992
993 async readFileAtHead(filepath: string): Promise<string | null> {
994 try {

Callers 1

statusMethod · 0.95

Calls 5

filesStatusMethod · 0.95
fileStatusMethod · 0.95
hasSignificantChangesFunction · 0.90
mapMethod · 0.80
allMethod · 0.65

Tested by

no test coverage detected