Nimbin[12]?SDL & Graphics / sdl_runtime_compiler / commits / 154aa0b

sdl_runtime_compiler git · main

SDL3 game for running and compiling code at runtime

sdl3 c++ compiler dlopen cmake · first commit 2026-04-19 · last commit 2026-07-03 (3 months ago) · synced 3 days ago · upstream: git.ide3.de/hsnr/sdl-runtime-compiler

C++ 72.3% C 26.2%
git clone https://git.christianimmanuel.de/sdl-graphics/sdl_runtime_compiler.gitwget https://git.christianimmanuel.de/sdl-graphics/sdl_runtime_compiler/archive/sdl_runtime_compiler.tar.gz

Add blame AI With ChatGPT

Christian Immanuel · 2026-06-27 10:50 · 154aa0b3983040d1b492ffa42ad41af475d84758

 README.md   |  18 ++++++++++
 blame_ai.sh | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 130 insertions(+)

diff --git a/README.md b/README.md
index 1102f10..4f3ddc3 100644
--- a/README.md
+++ b/README.md
@@ -53,3 +53,21 @@ cmake --build build
 ```
 
 and you should find the game in the created build dir
+
+
+
+# Blame AI
+
+I am using ClaudeCode for some programming tasks (rarely any other AI you can see in the note below). As i **try** to always commit with "With Claude", or something like that, we can blame my source and find out how much and what is written by ai. So ChatGPT wrote me a blame scipt: [blame\_ai.sh](blame_ai.sh)
+
+```bash
+# per file ai usage AND total ai usage of src dir
+bash blame_ai.sh
+
+# ai usage per file (highlight ai pink) and total usage at the end of the file
+bash blame_ai.sh src/states/game_state.cpp
+```
+
+> this script is dumb and just checks for matching "claude|chatgpt|deepseek|gemini" in commit messages (at last thats what i told chatgpt to do)
+> So its in no way accurate as i sometimes merged my own stuff with AI or the other way arround OR i refractor stuff of AI or the other way arround..,- but it gives a brief idea of where AI was involved.
+> Which you can already see if you checkout if that comment was written by AI...
diff --git a/blame_ai.sh b/blame_ai.sh
new file mode 100644
index 0000000..2d06ecb
--- /dev/null
+++ b/blame_ai.sh
@@ -0,0 +1,112 @@
+#!/usr/bin/env bash
+
+AI_BG=$'\e[45m'
+RESET=$'\e[0m'
+
+declare -A ai_cache
+
+is_ai_commit() {
+    local c="$1"
+
+    if [[ -n "${ai_cache[$c]+x}" ]]; then
+        return "${ai_cache[$c]}"
+    fi
+
+    local subject
+    subject=$(git show -s --format=%s "$c" 2>/dev/null)
+
+    shopt -s nocasematch
+    if [[ $subject =~ (claude|chatgpt|deepseek|gemini) ]]; then
+        ai_cache["$c"]=0
+        return 0
+    else
+        ai_cache["$c"]=1
+        return 1
+    fi
+}
+
+file_ai_usage() {
+    local file="$1"
+
+    git ls-files --error-unmatch "$file" >/dev/null 2>&1 || {
+        echo "file not tracked by git"
+            return 1
+    }
+
+    mapfile -t content < "$file"
+    mapfile -t commits < <(git blame -l -- "$file" | awk '{print $1}')
+
+    local total=0 ai=0 i=0
+
+    for c in "${commits[@]}"; do
+        line="${content[$i]}"
+        ((i++))
+        ((total++))
+
+        if is_ai_commit "$c"; then
+            ((ai++))
+            printf "%s%s%s\n" "$AI_BG" "$line" "$RESET"
+        else
+            printf "%s\n" "$line"
+        fi
+    done
+
+    printf "\nAI usage: %.2f%% (%d/%d)\n" \
+        "$(awk -v a="$ai" -v t="$total" 'BEGIN{print (t? a*100/t : 0)}')" \
+        "$ai" "$total"
+}
+
+repo_ai_usage() {
+    local total_all=0 ai_all=0
+
+    declare -A file_ai
+    declare -A file_total
+
+    while read -r file; do
+        [[ "$file" != src/* ]] && continue
+        [[ ! -f "$file" ]] && continue
+
+        mapfile -t commits < <(git blame -l -- "$file" | awk '{print $1}')
+
+        local ai=0 total=0
+
+        for c in "${commits[@]}"; do
+            ((total++))
+            if is_ai_commit "$c"; then
+                ((ai++))
+            fi
+        done
+
+        file_ai["$file"]=$ai
+        file_total["$file"]=$total
+
+        ((ai_all += ai))
+        ((total_all += total))
+
+    done < <(git ls-files src)
+
+    printf "%-50s %-10s %-10s\n" "file" "human%" "ai%"
+
+    for f in "${!file_total[@]}"; do
+        t=${file_total[$f]}
+        a=${file_ai[$f]}
+        h=$((t - a))
+
+        hp=$(awk -v h="$h" -v t="$t" 'BEGIN{printf "%.2f", (t? h*100/t : 0)}')
+        ap=$(awk -v a="$a" -v t="$t" 'BEGIN{printf "%.2f", (t? a*100/t : 0)}')
+
+        printf "%-50s %-10s %-10s\n" "$f" "$hp" "$ap"
+    done | sort -k3 -n
+
+
+    printf "%-50s %-10s %-10s\n" "file" "human%" "ai%"
+
+    printf "\nTOTAL AI USAGE (src/ only): %.2f%%\n" \
+        "$(awk -v a="$ai_all" -v t="$total_all" 'BEGIN{print (t? a*100/t : 0)}')"
+}
+
+if [[ -n "$1" ]]; then
+    file_ai_usage "$1"
+else
+    repo_ai_usage
+fi