feat(zsh): Implement aliases for git diff, commit message generation, and AI-generated commits

This commit is contained in:
2025-09-11 15:11:34 +02:00
parent 5983f3154a
commit c022de5a1e
4 changed files with 45 additions and 2 deletions

View File

@@ -2,7 +2,7 @@
gtk-theme-name=rose-pine-gtk gtk-theme-name=rose-pine-gtk
gtk-icon-theme-name=rose-pine-icons gtk-icon-theme-name=rose-pine-icons
gtk-font-name=InconsolataGo Nerd Font 9 gtk-font-name=InconsolataGo Nerd Font 9
gtk-cursor-theme-name=AC-Volantes gtk-cursor-theme-name=volantes
gtk-cursor-theme-size=24 gtk-cursor-theme-size=24
gtk-toolbar-style=GTK_TOOLBAR_ICONS gtk-toolbar-style=GTK_TOOLBAR_ICONS
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
@@ -14,4 +14,4 @@ gtk-xft-antialias=1
gtk-xft-hinting=1 gtk-xft-hinting=1
gtk-xft-hintstyle=hintslight gtk-xft-hintstyle=hintslight
gtk-xft-rgba=rgb gtk-xft-rgba=rgb
gtk-application-prefer-dark-theme=1 gtk-application-prefer-dark-theme=0

1
.config/zsh/.zprofile Normal file
View File

@@ -0,0 +1 @@
emulate sh -c 'source /etc/profile'

View File

@@ -5,6 +5,11 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi fi
# Load personal aliases
if [[ -f "${HOME}/.config/zsh/aliases.zsh" ]]; then
source "${HOME}/.config/zsh/aliases.zsh"
fi
# Variables for ZIM # Variables for ZIM
ZIM_CONFIG_FILE=${ZDOTDIR}/.zimrc ZIM_CONFIG_FILE=${ZDOTDIR}/.zimrc
ZIM_HOME=${ZDOTDIR}/zim ZIM_HOME=${ZDOTDIR}/zim

37
.config/zsh/aliases.zsh Normal file
View File

@@ -0,0 +1,37 @@
# Basic git diff summarizer
alias gai-summary="git diff | ollama run git-diff-summarizer"
# Full git commit message generation pipeline
alias gai-msg="git diff --cached | ollama run git-diff-summarizer | ollama run commit-msg-generator"
# Alternative: analyze all changes (not just staged)
alias gai-all="git diff | ollama run git-diff-summarizer | ollama run commit-msg-generator"
# Interactive version - shows summary first, then generates commit message
alias gai-interactive='echo "=== DIFF SUMMARY ===" && git diff --cached | ollama run git-diff-summarizer && echo -e "\n=== COMMIT MESSAGE OPTIONS ===" && git diff --cached | ollama run git-diff-summarizer | ollama run commit-msg-generator'
# Shorter aliases for frequent use
alias gaids="git diff --cached | ollama run git-diff-summarizer"
alias gaicm="git diff --cached | ollama run git-diff-summarizer | ollama run commit-msg-generator"
# Function for creating commit with AI-generated message
gai-commit() {
if [[ -z $(git diff --cached --name-only) ]]; then
echo "No staged changes found. Stage your changes first with 'git add'."
return 1
fi
echo "Analyzing staged changes..."
local commit_msg=$(git diff --cached | ollama run git-diff-summarizer | ollama run commit-msg-generator)
echo -e "\nGenerated commit message:\n$commit_msg"
echo -e "\nProceed with this commit? (y/n)"
read -r response
if [[ "$response" =~ ^[Yy]$ ]]; then
git commit -m "$commit_msg"
echo "Committed successfully!"
else
echo "Commit cancelled."
fi
}