Self-healing autopoietic shell: f(), tests, docs, interactive demo, fx fix-source layer

This commit is contained in:
2026-08-17 22:30:18 -04:00
commit 8b30120fba
14 changed files with 767 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
#!/bin/sh
# History source: suggests the closest-looking command you've actually
# typed and moved on from before (thefuck's history.py idea). Reads
# HISTFILE directly since a separate process doesn't inherit the parent
# shell's in-memory history.
cmd="$1"
first_word=$(printf '%s' "$cmd" | awk '{print $1}')
[ -n "$first_word" ] || exit 0
hf="${HISTFILE:-$HOME/.bash_history}"
[ -r "$hf" ] || exit 0
tail -n 300 "$hf" 2>/dev/null | grep -F -- "$first_word " | grep -vF -- "$cmd" | awk '!seen[$0]++' | tail -5