Nu e chiar un alias dar postarea m-a inspirat așa că poate vă interesează. Săptămâna trecută cred mă uitam pe un repo și încercam să înțeleg ce schimbări s-au întâmplat între două tag-uri și mi-a venit ideea să-i dau lui Chat GPT să-mi facă un sumar. Mi s-a părut foarte utilă chestia așa că mi-am făcut un script.
function git_summary() {
set +o noclobber
is_inside_git=$(git rev-parse --is-inside-work-tree)
if [ "$is_inside_git" != "true" ]; then
echo "Error, not in git repo"
return 1
fi
changes=$(git log $1..$2 | jq -Rsa .)
changes=${changes#\"} # Remove leading double quote
changes=${changes%\"} # Remove trailing double quote
first_part='{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "I will give you logs about git commits and I want you to summarize as best as possible in a release notes format.\n'
second_part='"
}
]
}
],
"temperature": 1,
"max_tokens": 2048,
"top_p": 1,
"frequency_penalty": 0,
"presence_penalty": 0,
"response_format": {
"type": "text"
}
}'
temp_file=$(mktemp)
echo "$first_part$changes$second_part" > $temp_file
answer=$(curl https://api.openai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR-API-KEY" \
-H "OpenAI-Organization: org-YOUR-ORG" \
-H "OpenAI-Project: proj_YOUR-PROJ" \
-d "@$temp_file")
content=$(echo $answer | jq .choices[0].message.content)
content=${content#\"}
content=${content%\"}
printf '%b\n' "$content"
}
E foarte quick and dirty dar merge! De exemplu am rulat snippet-ul pe Microsoft Terminal repository între ultimele tag-uri și-mi dă următorul text.
git_summary v1.22.2362.0 v1.22.2702.0
# Release Notes
## Version 1.22
### New Features and Enhancements
- **Input Scope Setting**: Added a \"defaultInputScope\" setting that can be configured during startup and supports languages like Chinese. This setting is now accessible under the startup page in the user interface. ([#17953](https://github.com/microsoft/terminal/pull/17953))
- **Color Scheme Resetting**: Expanded the functionality of the `RIS` (hard reset) command to reset changes made to color tables and aliases. This update is a step towards implementing the `OSC` sequences for individual color resets. ([#17879](https://github.com/microsoft/terminal/pull/17879))
- **Localization Updates**: Continued to enhance localization support across the application. ([#17958](https://github.com/microsoft/terminal/pull/17958))
- **Settings UI Improvements**: Enhanced the color contrast for the reset button in the Settings UI and addressed text scaling issues ensuring better UI scaling at 200% text. ([#17912](https://github.com/microsoft/terminal/pull/17912), [#17910](https://github.com/microsoft/terminal/pull/17910))
- **Tab Color Indicator**: Introduced a tab color indicator for the tab switch menu (CTRL+Tab), improving the visual cue for tab navigation. ([#17820](https://github.com/microsoft/terminal/pull/17820))
- **Action IDs for Color Commands**: Incorporated action IDs for color selection commands, which now appear in the command palette. ([#17821](https://github.com/microsoft/terminal/pull/17821))
### Bug Fixes
- **Suggestion Box Handling**: Resolved an issue with the `AutoSuggestBox` event handling, ensuring it only updates on submission rather than suggestion highlight. ([#17961](https://github.com/microsoft/terminal/pull/17961))
- **Buffer and Pane Management**: Fixed a bug causing a crash when closing panes and enhanced the buffer clearing command to work consistently. Also addressed issues preventing crashes when buffers overflow or reflow and restored screen content when it's closed. ([#17886](https://github.com/microsoft/terminal/pull/17886), [#17884](https://github.com/microsoft/terminal/pull/17884))
- **Hex Numpad Support**: Implemented a registry check for `EnableHexNumpad`, ensuring proper activation when configured. ([#17954](https://github.com/microsoft/terminal/pull/17954))
- **Escape Character Handling**: Resolved issues with dropping `Esc` characters from VT responses, ensuring accurate VT sequences processing. ([#17833](https://github.com/microsoft/terminal/pull/17833))
- **Miscellaneous Fixes**: Addressed multiple minor bugs including fixes for focus issues with ConPTY HWND, a Sixel crash related to buffer reflow, and a crash in AppHost::_QuitRequested. ([#17828](https://github.com/microsoft/terminal/pull/17828), [#17951](https://github.com/microsoft/terminal/pull/17951), [#17848](https://github.com/microsoft/terminal/pull/17848))
### General Maintenance
- **Code Cleanup**: Removed unnecessary format calls and deprecated components, and applied deduplication in command history handling. ([#17795](https://github.com/microsoft/terminal/pull/17795), [#17852](https://github.com/microsoft/terminal/pull/17852))
- **Preview Build Features**: Enabled new features such as `Feature_QuickFix` and `Feature_SaveSnippet` in preview builds, offering early access to experimental functionality. ([#17888](https://github.com/microsoft/terminal/pull/17888), [#17881](https://github.com/microsoft/terminal/pull/17881))
These updates reflect our ongoing commitment to enhancing user experience, expanding functionality, and maintaining robust application stability. Enjoy the new version!
Are niște limitări. De exemplu am încercat să rulez și pe repo-ul de linux și se adună cam 100000 de tokeni, iar momentan API-ul OpenAI e limitat la 30000. În cazul ăsta trebuie redus înainte cumva textul și apoi trimis. Dar cred că ăsta e un caz extrem pentru că devii de kernel pun multă informație în descrierea commit-urilor.