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