<commit_before>bash_prompt () {
    local EXIT_STATUS=$?
    
    local WHITE="\[\033[0;37m\]"
    local BLACK="\[\033[1;30m\]"
    local RED="\[\033[0;31m\]"
    local YELLOW="\[\033[0;33m\]"
    local GREEN="\[\033[0;32m\]"
    local BLUE="\[\033[0;34m\]"
    local RESET="\[\033[0m\]"

    # PWD
    PROMPT_DIRTRIM=3
    local NEW_PWD=${PWD/#$HOME/\~}

    # title bar
    case $TERM in
        xterm*)
            local TITLEBAR='\[\033]0;\u@\h:\w\007\]'
            ;;
        *)
            local TITLEBAR=""
            ;;
    esac

    local PWDCOLOR=$BLACK
    local USRSYMBOL="\$"

    if is_root; then
        local PWDCOLOR=$RED
        local USRSYMBOL="#"
    fi

    if is_ssh; then
        local HOST="$BLUE[ $WHITE\h $BLUE] "
    fi

    
    if [ $EXIT_STATUS != 0 ]; then 
        EXIT_CODE="$RED✖"
    else
        EXIT_CODE="$GREEN✔"
    fi
    EXIT_CODE="$BLUE[$EXIT_CODE$BLUE]"



    local GIT="$(prompt_git)"

    export PS1="$TITLEBAR$EXIT_CODE$HOST$BLUE[ $PWDCOLOR$NEW_PWD$GIT $BLUE]$WHITE$USRSYMBOL$RESET "
    export PS2='> '
    export PS4='+ '
}

##
## $PS1 prompt functions
##

prompt_git() {
    local SYMBOL=""

    # check if the current directory is in a git repository
    if [ $(git rev-parse --is-inside-work-tree &>/dev/null; printf "%s" $?) == 0 ]; then

        # check if the current directory is in .git before running git checks
        if [ "$(git rev-parse --is-inside-git-dir 2> /dev/null)" == "false" ]; then
            local SYMBOL=""

            # ensure index is up to date
            git update-index --really-refresh  -q &>/dev/null

            # c
            if `git status | grep ahead > /dev/null`; then
                local SYMBOL="${SYMBOL}${YELLOW}↺"
            fi
            
            #  uncommitted changes
            if ! $(git diff --quiet --ignore-submodules --cached); then
                local SYMBOL="${SYMBOL}${YELLOW}+"
            fi

            # unstaged changes
            if ! $(git diff-files --quiet --ignore-submodules --); then
                local SYMBOL="${SYMBOL}${RED}!"
            fi

            # untracked files
            if [ -n "$(git ls-files --others --exclude-standard)" ]; then
                local SYMBOL="${SYMBOL}${RED}?"
            fi
        
            #
            if [[ -z "$SYMBOL" ]]; then
                local SYMBOL="${SYMBOL}${GREEN}✓"
            fi

            echo " $BLACK($SYMBOL$BLACK)$RESET"<commit_msg>simplify char for ahead of git origin in bash prompt<commit_after>bash_prompt () {
    local EXIT_STATUS=$?
    
    local WHITE="\[\033[0;37m\]"
    local BLACK="\[\033[1;30m\]"
    local RED="\[\033[0;31m\]"
    local YELLOW="\[\033[0;33m\]"
    local GREEN="\[\033[0;32m\]"
    local BLUE="\[\033[0;34m\]"
    local RESET="\[\033[0m\]"

    # PWD
    PROMPT_DIRTRIM=3
    local NEW_PWD=${PWD/#$HOME/\~}

    # title bar
    case $TERM in
        xterm*)
            local TITLEBAR='\[\033]0;\u@\h:\w\007\]'
            ;;
        *)
            local TITLEBAR=""
            ;;
    esac

    local PWDCOLOR=$BLACK
    local USRSYMBOL="\$"

    if is_root; then
        local PWDCOLOR=$RED
        local USRSYMBOL="#"
    fi

    if is_ssh; then
        local HOST="$BLUE[ $WHITE\h $BLUE] "
    fi

    
    if [ $EXIT_STATUS != 0 ]; then 
        EXIT_CODE="$RED✖"
    else
        EXIT_CODE="$GREEN✔"
    fi
    EXIT_CODE="$BLUE[$EXIT_CODE$BLUE]"



    local GIT="$(prompt_git)"

    export PS1="$TITLEBAR$EXIT_CODE$HOST$BLUE[ $PWDCOLOR$NEW_PWD$GIT $BLUE]$WHITE$USRSYMBOL$RESET "
    export PS2='> '
    export PS4='+ '
}

##
## $PS1 prompt functions
##

prompt_git() {
    local SYMBOL=""

    # check if the current directory is in a git repository
    if [ $(git rev-parse --is-inside-work-tree &>/dev/null; printf "%s" $?) == 0 ]; then

        # check if the current directory is in .git before running git checks
        if [ "$(git rev-parse --is-inside-git-dir 2> /dev/null)" == "false" ]; then
            local SYMBOL=""

            # ensure index is up to date
            git update-index --really-refresh  -q &>/dev/null

            # c
            if `git status | grep ahead > /dev/null`; then
                local SYMBOL="${SYMBOL}${YELLOW}^"
            fi
            
            #  uncommitted changes
            if ! $(git diff --quiet --ignore-submodules --cached); then
                local SYMBOL="${SYMBOL}${YELLOW}+"
            fi

            # unstaged changes
            if ! $(git diff-files --quiet --ignore-submodules --); then
                local SYMBOL="${SYMBOL}${RED}!"
            fi

            # untracked files
            if [ -n "$(git ls-files --others --exclude-standard)" ]; then
                local SYMBOL="${SYMBOL}${RED}?"
            fi
        
            #
            if [[ -z "$SYMBOL" ]]; then
                local SYMBOL="${SYMBOL}${GREEN}✓"
            fi

            echo " $BLACK($SYMBOL$BLACK)$RESET"
{'fraction_non_alphanumeric': 0.1589754015043708, 'fraction_numerical': 0.02236226875381175, 'mean_word_length': 1.673913043478261, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1979756', 'n_tokens_mistral': 1766, 'n_tokens_neox': 1618, 'n_words': 376}