graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
fix(install): put graff on PATH in ~/.zshrc (and bashrc/fish)
Cursor Agentef0f2f8cae5a
diff --git a/install.sh b/install.shindex 1db534ca..baa6e096 100644--- a/install.sh+++ b/install.sh@@ -11,7 +11,8 @@ set -euo pipefail# Env overrides: HARNESS_REPO (source repo), HARNESS_DIR (install dir),# HARNESS_BUILD=source (skip the release download and compile),# HARNESS_NO_GRAFF=1 (skip the codedb/zigrep companion suite),-# HARNESS_NO_KURI=1 (skip kuri browser automation).+# HARNESS_NO_KURI=1 (skip kuri browser automation),+# HARNESS_NO_PATH=1 (do not append the install dir to ~/.zshrc / ~/.bashrc).REPO="${HARNESS_REPO:-https://github.com/justrach/codegraff}"INSTALL_DIR="${HARNESS_DIR:-$HOME/bin}"@@ -255,15 +256,95 @@ main() {printf " ${D}kuri skipped (HARNESS_NO_KURI) — /skills add kuri any time${N}\n"fi- case ":$PATH:" in- *":$INSTALL_DIR:"*) ;;+ ensure_path++ printf "\n ${W}done!${N} run ${C}$BIN${N} to start, or ${C}$BIN --help${N}\n\n"+}++# Persist $INSTALL_DIR on PATH so the next terminal finds `graff`.+# curl|sh often runs under bash while the login shell is zsh (macOS default),+# which is why people saw "graff: command not found" after a successful+# install — we only printed an export they never pasted. Write every rc that+# exists, and create ~/.zshrc / ~/.bashrc when that is the login shell.+# HARNESS_NO_PATH=1 skips. Idempotent via the marker comment.+ensure_path() {+ if [ -n "${HARNESS_NO_PATH:-}" ]; then+ printf " ${D}PATH skipped (HARNESS_NO_PATH)${N}\n"+ return 0+ fi+ if [ -z "${HOME:-}" ]; then+ printf " ${Y}HOME unset — could not persist PATH${N}\n"+ return 0+ fi++ local marker="# codegraff PATH (install.sh) — do not duplicate"+ local export_line="export PATH=\"${INSTALL_DIR}:\$PATH\""+ local fish_line="fish_add_path -m \"${INSTALL_DIR}\""+ local wrote=0+ local shell_name zshrc bashrc profile fishrc+ shell_name="$(basename "${SHELL:-sh}")"+ zshrc="${ZDOTDIR:-$HOME}/.zshrc"+ bashrc="$HOME/.bashrc"+ profile="$HOME/.profile"+ fishrc="$HOME/.config/fish/config.fish"++ append_rc() {+ local file="$1"+ local payload="$2"+ mkdir -p "$(dirname "$file")" 2>/dev/null || return 0+ if [ -f "$file" ] && grep -F "$marker" "$file" >/dev/null 2>&1; then+ return 0+ fi+ if ! printf "\n%s\n%s\n" "$marker" "$payload" >> "$file" 2>/dev/null; then+ return 0+ fi+ wrote=1+ printf " ${D}│${N} %-10s ${G}✓${N} (PATH → %s)\n" "PATH" "$file"+ }++ case "$shell_name" in+ zsh)+ touch "$zshrc" 2>/dev/null || true+ append_rc "$zshrc" "$export_line"+ ;;+ bash)+ touch "$bashrc" 2>/dev/null || true+ append_rc "$bashrc" "$export_line"+ ;;+ fish)+ mkdir -p "$(dirname "$fishrc")" 2>/dev/null || true+ touch "$fishrc" 2>/dev/null || true+ append_rc "$fishrc" "$fish_line"+ ;;*)- printf "\n ${Y}add to PATH:${N}\n"- printf " ${C}export PATH=\"$INSTALL_DIR:\$PATH\"${N} ${D}(add to ~/.zshrc or ~/.bashrc)${N}\n"+ touch "$profile" 2>/dev/null || true+ append_rc "$profile" "$export_line";;esac- printf "\n ${W}done!${N} run ${C}$BIN${N} to start, or ${C}$BIN --help${N}\n\n"+ if [ "$shell_name" != zsh ] && [ -f "$zshrc" ]; then+ append_rc "$zshrc" "$export_line"+ fi+ if [ "$shell_name" != bash ] && [ -f "$bashrc" ]; then+ append_rc "$bashrc" "$export_line"+ fi++ if [ "$wrote" = 1 ]; then+ printf "\n ${Y}open a new terminal${N} or ${C}source${N} the rc file above — otherwise ${C}$BIN${N} is not on PATH yet.\n"+ else+ case ":$PATH:" in+ *":$INSTALL_DIR:"*) ;;+ *)+ printf "\n ${Y}add to PATH:${N}\n"+ printf " ${C}export PATH=\"$INSTALL_DIR:\$PATH\"${N} ${D}(add to ~/.zshrc or ~/.bashrc)${N}\n"+ ;;+ esac+ fi}+if [ "${1:-}" = "--path-only" ]; then+ ensure_path+ exit 0+fi+maindiff --git a/scripts/test-install-path.sh b/scripts/test-install-path.shnew file mode 100755index 00000000..c8a1ed11--- /dev/null+++ b/scripts/test-install-path.sh@@ -0,0 +1,45 @@+#!/usr/bin/env bash+# Prove install.sh persists ~/bin (or HARNESS_DIR) onto the login shell PATH+# so a new terminal finds `graff` without a pasted export.+set -euo pipefail+ROOT="$(cd "$(dirname "$0")/.." && pwd)"+INSTALLER="$ROOT/install.sh"+tmp="$(mktemp -d)"+trap 'rm -rf "$tmp"' EXIT++fail() { printf 'FAIL: %s\n' "$*" >&2; exit 1; }++# Login zsh: create ~/.zshrc and append PATH.+home1="$tmp/zsh"+mkdir -p "$home1/bin"+HOME="$home1" SHELL=/bin/zsh HARNESS_DIR="$home1/bin" bash "$INSTALLER" --path-only >/dev/null+grep -F 'codegraff PATH (install.sh) — do not duplicate' "$home1/.zshrc" >/dev/null || fail "zshrc missing marker"+grep -F "$home1/bin" "$home1/.zshrc" >/dev/null || fail "zshrc missing install dir"++# Idempotent: a second run does not duplicate the block.+HOME="$home1" SHELL=/bin/zsh HARNESS_DIR="$home1/bin" bash "$INSTALLER" --path-only >/dev/null+test "$(grep -c 'codegraff PATH (install.sh)' "$home1/.zshrc")" = 1 || fail "zshrc duplicated PATH block"++# curl|sh often runs under bash while the login shell is zsh — update both+# when ~/.zshrc already exists.+home2="$tmp/both"+mkdir -p "$home2"+printf '# existing zsh\n' > "$home2/.zshrc"+printf '# existing bash\n' > "$home2/.bashrc"+HOME="$home2" SHELL=/bin/bash HARNESS_DIR="$home2/bin" bash "$INSTALLER" --path-only >/dev/null+grep -F "$home2/bin" "$home2/.bashrc" >/dev/null || fail "bashrc missing install dir"+grep -F "$home2/bin" "$home2/.zshrc" >/dev/null || fail "existing zshrc not updated from bash installer"++# Opt-out.+home3="$tmp/skip"+mkdir -p "$home3"+HOME="$home3" SHELL=/bin/zsh HARNESS_NO_PATH=1 HARNESS_DIR="$home3/bin" bash "$INSTALLER" --path-only >/dev/null+test ! -e "$home3/.zshrc" || fail "HARNESS_NO_PATH still wrote zshrc"++# fish.+home4="$tmp/fish"+mkdir -p "$home4"+HOME="$home4" SHELL=/usr/bin/fish HARNESS_DIR="$home4/bin" bash "$INSTALLER" --path-only >/dev/null+grep -F 'fish_add_path' "$home4/.config/fish/config.fish" >/dev/null || fail "fish config missing fish_add_path"++printf 'ok\n'