Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,25 @@ ask() {

print_logo

# Install to a stable location so symlinks don't break when the original clone
# is moved or deleted. On re-runs (e.g. after git pull), this updates in-place.
Comment on lines +77 to +78
INSTALL_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/brain.md"

if [ "$SCRIPT_DIR" != "$INSTALL_DIR" ]; then
echo "setup: installing project to $INSTALL_DIR ..."
mkdir -p "$INSTALL_DIR"
Comment on lines +79 to +83
for f in "$SCRIPT_DIR"/* "$SCRIPT_DIR"/.[!.]*; do
case "$f" in
*/.) continue ;;
*/..) continue ;;
*/.git) continue ;;
esac
cp -R "$f" "$INSTALL_DIR/"
done
echo "setup: re-running from stable location ..."
exec "$INSTALL_DIR/setup" "$@"
fi

# Candidate agent runtimes: "<label>:<parent-config-dir>:<skills-dir>". A runtime
# counts as detected only when its parent config dir exists.
CANDIDATES="Claude:$HOME/.claude:$HOME/.claude/skills Codex:$HOME/.codex:$HOME/.codex/skills OpenCode:$HOME/.config/opencode:$HOME/.config/opencode/skills"
Expand Down
11 changes: 11 additions & 0 deletions uninstall
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,15 @@ else
echo "uninstall: removed manifest."
fi

# Optionally remove the stable install directory.
INSTALL_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/brain.md"
if [ -d "$INSTALL_DIR" ]; then
if ask "Remove the stable install at $INSTALL_DIR?"; then
rm -rf "$INSTALL_DIR"
echo "uninstall: removed $INSTALL_DIR"
Comment thread
tranch marked this conversation as resolved.
Outdated
else
echo "uninstall: kept $INSTALL_DIR (re-run setup later without re-cloning)"
fi
fi

echo "uninstall: done ($removed link(s) removed). Project brain/ data was not touched."