Add confirmation prompt before overwriting existing installation

launchme.sh:
- Detects if .claude/ or CLAUDE.md already exist in the vault
- Shows the user what will be overwritten
- Asks for explicit confirmation before proceeding
- Clarifies that custom agents and vault notes are never touched

updateme.sh:
- Asks for confirmation before overwriting core files
- Same clarification about custom agents being preserved
This commit is contained in:
gnekt
2026-03-23 16:42:54 +01:00
parent 35e2c5cc75
commit 4c4843e396
2 changed files with 42 additions and 0 deletions

View File

@@ -60,6 +60,32 @@ if [[ "$CONFIRM" =~ ^[Nn]$ ]]; then
[[ -d "$VAULT_DIR" ]] || die "Directory not found: $VAULT_DIR"
fi
# ── Check for existing installation ───────────────────────────────────────
echo ""
EXISTING=0
if [[ -d "$VAULT_DIR/.claude" ]]; then EXISTING=1; fi
if [[ -f "$VAULT_DIR/CLAUDE.md" ]]; then EXISTING=1; fi
if [[ $EXISTING -eq 1 ]]; then
warn "An existing installation was detected:"
[[ -d "$VAULT_DIR/.claude" ]] && warn " .claude/ directory exists"
[[ -f "$VAULT_DIR/CLAUDE.md" ]] && warn " CLAUDE.md exists"
echo ""
echo -e " ${BOLD}The installer needs to overwrite these files.${NC}"
echo -e " ${DIM}Custom agents in .claude/agents/ will NOT be deleted.${NC}"
echo -e " ${DIM}Your vault notes are never touched.${NC}"
echo ""
echo -e " ${BOLD}c)${NC} Continue (overwrite core files, keep custom agents)"
echo -e " ${BOLD}q)${NC} Quit"
read -r -p " > " OVERWRITE_ANSWER
if [[ ! "$OVERWRITE_ANSWER" =~ ^[Cc]$ ]]; then
echo ""
info "Installation cancelled."
echo ""
exit 0
fi
fi
# ── Copy agents ─────────────────────────────────────────────────────────────
echo ""
info "Creating .claude/agents/ in vault..."

View File

@@ -45,6 +45,22 @@ echo -e "${BOLD}║ My Brain Is Full - Crew :: Update ║${NC}"
echo -e "${BOLD}╚══════════════════════════════════════════╝${NC}"
echo ""
# ── Confirm overwrite ────────────────────────────────────────────────────
echo -e "${BOLD}This will overwrite core agent files, references, and CLAUDE.md.${NC}"
echo -e " ${DIM}Custom agents in .claude/agents/ will NOT be touched.${NC}"
echo -e " ${DIM}Your vault notes are never touched.${NC}"
echo ""
echo -e " ${BOLD}c)${NC} Continue"
echo -e " ${BOLD}q)${NC} Quit"
read -r -p " > " UPDATE_ANSWER
if [[ ! "$UPDATE_ANSWER" =~ ^[Cc]$ ]]; then
echo ""
info "Update cancelled."
echo ""
exit 0
fi
echo ""
# ── Update agents ───────────────────────────────────────────────────────────
AGENT_COUNT=0
for agent in "$REPO_DIR/agents/"*.md; do