Skip to main content
Glama

DollhouseMCP

by DollhouseMCP
post-checkoutโ€ข16.9 kB
#!/bin/bash # GitFlow Guardian - Post-checkout Hook # Provides helpful reminders when switching branches # Get the directory where this hook is located HOOK_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Load configuration if it exists CONFIG_FILE="$HOOK_DIR/config" if [ -f "$CONFIG_FILE" ]; then source "$CONFIG_FILE" else # Default configuration USE_COLORS=true SHOW_CHECKOUT_MESSAGES=true MAX_DISPLAY_LENGTH=50 fi # Exit early if messages are disabled if [ "$SHOW_CHECKOUT_MESSAGES" != "true" ]; then exit 0 fi # Colors (only if enabled) if [ "$USE_COLORS" = "true" ]; then RED='\033[0;31m' YELLOW='\033[1;33m' GREEN='\033[0;32m' BLUE='\033[0;34m' CYAN='\033[0;36m' NC='\033[0m' else RED='' YELLOW='' GREEN='' BLUE='' CYAN='' NC='' fi # Get the branch we just switched to BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null) # Check if this is actually a branch switch (not a file checkout) # $3 is 1 for branch checkout, 0 for file checkout if [ "$3" != "1" ]; then exit 0 fi # Get the previous and new commit hashes PREV_HEAD=$1 NEW_HEAD=$2 # Function to check if a branch was just created is_new_branch() { # Check if the previous HEAD is the same as the current branch's parent # and if we're on a feature branch if [[ "$BRANCH" == feature/* ]] || [[ "$BRANCH" == fix/* ]] || [[ "$BRANCH" == bugfix/* ]]; then # Get the parent branch (where this branch was created from) PARENT_BRANCH=$(git show-branch -a 2>/dev/null | grep '\*' | grep -v "\[$BRANCH" | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//') # Alternative method: check if this is the first commit on the branch BRANCH_BASE=$(git merge-base HEAD main 2>/dev/null) DEVELOP_BASE=$(git merge-base HEAD develop 2>/dev/null) # If the branch base is the same as main's HEAD, it was created from main MAIN_HEAD=$(git rev-parse main 2>/dev/null) if [ "$BRANCH_BASE" = "$MAIN_HEAD" ] && [ "$BRANCH_BASE" != "$DEVELOP_BASE" ]; then return 0 # Branch was created from main fi fi return 1 # Not a new branch from main } # Check if this is a new feature branch created from main if is_new_branch; then echo -e "${RED}โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—${NC}" echo -e "${RED}โ•‘ โš ๏ธ WARNING โš ๏ธ โ•‘${NC}" echo -e "${RED}โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ${NC}" echo -e "${RED}โ•‘ โ•‘${NC}" echo -e "${RED}โ•‘ This feature branch appears to be created from MAIN! โ•‘${NC}" echo -e "${RED}โ•‘ โ•‘${NC}" echo -e "${RED}โ•‘ Feature branches should be created from DEVELOP: โ•‘${NC}" echo -e "${RED}โ•‘ โ•‘${NC}" echo -e "${RED}โ•‘ To fix this: โ•‘${NC}" echo -e "${RED}โ•‘ 1. ${YELLOW}git checkout develop${RED} โ•‘${NC}" echo -e "${RED}โ•‘ 2. ${YELLOW}git checkout -b $BRANCH${RED} โ•‘${NC}" echo -e "${RED}โ•‘ 3. Cherry-pick your commits if needed โ•‘${NC}" echo -e "${RED}โ•‘ โ•‘${NC}" echo -e "${RED}โ•‘ GitFlow workflow: โ•‘${NC}" echo -e "${RED}โ•‘ โ€ข feature/* branches โ†’ from develop โ•‘${NC}" echo -e "${RED}โ•‘ โ€ข hotfix/* branches โ†’ from main โ•‘${NC}" echo -e "${RED}โ•‘ โ€ข release/* branches โ†’ from develop โ•‘${NC}" echo -e "${RED}โ•‘ โ•‘${NC}" echo -e "${RED}โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•${NC}" echo "" fi # Provide helpful messages based on branch case "$BRANCH" in main|master) echo -e "${RED}โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—${NC}" echo -e "${RED}โ•‘ ๐Ÿ“ You are now on the MAIN branch โ•‘${NC}" echo -e "${RED}โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ${NC}" echo -e "${RED}โ•‘ โ•‘${NC}" echo -e "${RED}โ•‘ โš ๏ธ This is the PRODUCTION branch! โ•‘${NC}" echo -e "${RED}โ•‘ โ•‘${NC}" echo -e "${RED}โ•‘ You should rarely need to be on this branch. โ•‘${NC}" echo -e "${RED}โ•‘ โ•‘${NC}" echo -e "${RED}โ•‘ Common tasks and where to do them: โ•‘${NC}" echo -e "${RED}โ•‘ โ€ข New features โ†’ ${GREEN}git checkout develop${RED} โ•‘${NC}" echo -e "${RED}โ•‘ โ€ข Bug fixes โ†’ ${GREEN}git checkout develop${RED} โ•‘${NC}" echo -e "${RED}โ•‘ โ€ข Hotfixes โ†’ ${YELLOW}git checkout -b hotfix/issue-name${RED} โ•‘${NC}" echo -e "${RED}โ•‘ โ•‘${NC}" echo -e "${RED}โ•‘ Remember: โ•‘${NC}" echo -e "${RED}โ•‘ โ€ข DO NOT commit directly here โ•‘${NC}" echo -e "${RED}โ•‘ โ€ข DO NOT create feature branches from here โ•‘${NC}" echo -e "${RED}โ•‘ โ€ข Only merge from release/* or hotfix/* branches โ•‘${NC}" echo -e "${RED}โ•‘ โ•‘${NC}" echo -e "${RED}โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•${NC}" ;; develop) echo -e "${YELLOW}โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—${NC}" echo -e "${YELLOW}โ•‘ ๐Ÿ“ You are now on the DEVELOP branch โ•‘${NC}" echo -e "${YELLOW}โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ${NC}" echo -e "${YELLOW}โ•‘ โ•‘${NC}" echo -e "${YELLOW}โ•‘ This is the integration branch for new features. โ•‘${NC}" echo -e "${YELLOW}โ•‘ โ•‘${NC}" echo -e "${YELLOW}โ•‘ Remember: โ•‘${NC}" echo -e "${YELLOW}โ•‘ โ€ข Create feature branches for new work: โ•‘${NC}" echo -e "${YELLOW}โ•‘ ${GREEN}git checkout -b feature/your-feature${YELLOW} โ•‘${NC}" echo -e "${YELLOW}โ•‘ โ€ข Don't commit directly unless it's a merge โ•‘${NC}" echo -e "${YELLOW}โ•‘ โ€ข Keep this branch stable for other developers โ•‘${NC}" echo -e "${YELLOW}โ•‘ โ•‘${NC}" echo -e "${YELLOW}โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•${NC}" ;; feature/*) # Truncate long branch names to fit in the box if [ ${#BRANCH} -gt $MAX_DISPLAY_LENGTH ]; then TRUNCATE_LENGTH=$((MAX_DISPLAY_LENGTH - 3)) DISPLAY_BRANCH="${BRANCH:0:$TRUNCATE_LENGTH}..." else DISPLAY_BRANCH="$BRANCH" fi echo -e "${GREEN}โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—${NC}" echo -e "${GREEN}โ•‘ โœ… You are on a FEATURE branch โ•‘${NC}" echo -e "${GREEN}โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ${NC}" echo -e "${GREEN}โ•‘ โ•‘${NC}" echo -e "${GREEN}โ•‘ Branch: ${CYAN}$DISPLAY_BRANCH${GREEN}${NC}" echo -e "${GREEN}โ•‘ โ•‘${NC}" echo -e "${GREEN}โ•‘ You can safely commit and experiment here! โ•‘${NC}" echo -e "${GREEN}โ•‘ โ•‘${NC}" echo -e "${GREEN}โ•‘ When ready: โ•‘${NC}" echo -e "${GREEN}โ•‘ 1. Push your branch: ${CYAN}git push -u origin $BRANCH${GREEN} โ•‘${NC}" echo -e "${GREEN}โ•‘ 2. Create a PR: ${CYAN}gh pr create${GREEN} โ•‘${NC}" echo -e "${GREEN}โ•‘ โ•‘${NC}" echo -e "${GREEN}โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•${NC}" ;; fix/*|bugfix/*) # Truncate long branch names to fit in the box if [ ${#BRANCH} -gt $MAX_DISPLAY_LENGTH ]; then TRUNCATE_LENGTH=$((MAX_DISPLAY_LENGTH - 3)) DISPLAY_BRANCH="${BRANCH:0:$TRUNCATE_LENGTH}..." else DISPLAY_BRANCH="$BRANCH" fi echo -e "${BLUE}โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—${NC}" echo -e "${BLUE}โ•‘ ๐Ÿ”ง You are on a FIX branch โ•‘${NC}" echo -e "${BLUE}โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ${NC}" echo -e "${BLUE}โ•‘ โ•‘${NC}" echo -e "${BLUE}โ•‘ Branch: ${CYAN}$DISPLAY_BRANCH${BLUE}${NC}" echo -e "${BLUE}โ•‘ โ•‘${NC}" echo -e "${BLUE}โ•‘ Good practices for fixes: โ•‘${NC}" echo -e "${BLUE}โ•‘ โ€ข Keep changes focused on the specific bug โ•‘${NC}" echo -e "${BLUE}โ•‘ โ€ข Add tests to prevent regression โ•‘${NC}" echo -e "${BLUE}โ•‘ โ€ข Update documentation if needed โ•‘${NC}" echo -e "${BLUE}โ•‘ โ•‘${NC}" echo -e "${BLUE}โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•${NC}" ;; hotfix/*) # Truncate long branch names to fit in the box if [ ${#BRANCH} -gt $MAX_DISPLAY_LENGTH ]; then TRUNCATE_LENGTH=$((MAX_DISPLAY_LENGTH - 3)) DISPLAY_BRANCH="${BRANCH:0:$TRUNCATE_LENGTH}..." else DISPLAY_BRANCH="$BRANCH" fi echo -e "${RED}โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—${NC}" echo -e "${RED}โ•‘ ๐Ÿšจ You are on a HOTFIX branch โ•‘${NC}" echo -e "${RED}โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ${NC}" echo -e "${RED}โ•‘ โ•‘${NC}" echo -e "${RED}โ•‘ Branch: ${CYAN}$DISPLAY_BRANCH${RED}${NC}" echo -e "${RED}โ•‘ โ•‘${NC}" echo -e "${RED}โ•‘ This is for URGENT production fixes only! โ•‘${NC}" echo -e "${RED}โ•‘ โ•‘${NC}" echo -e "${RED}โ•‘ Remember to: โ•‘${NC}" echo -e "${RED}โ•‘ โ€ข Fix ONLY the critical issue โ•‘${NC}" echo -e "${RED}โ•‘ โ€ข Test thoroughly โ•‘${NC}" echo -e "${RED}โ•‘ โ€ข Merge to both main AND develop โ•‘${NC}" echo -e "${RED}โ•‘ โ•‘${NC}" echo -e "${RED}โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•${NC}" ;; release/*) # Truncate long branch names to fit in the box if [ ${#BRANCH} -gt $MAX_DISPLAY_LENGTH ]; then TRUNCATE_LENGTH=$((MAX_DISPLAY_LENGTH - 3)) DISPLAY_BRANCH="${BRANCH:0:$TRUNCATE_LENGTH}..." else DISPLAY_BRANCH="$BRANCH" fi echo -e "${CYAN}โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—${NC}" echo -e "${CYAN}โ•‘ ๐Ÿ“ฆ You are on a RELEASE branch โ•‘${NC}" echo -e "${CYAN}โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ${NC}" echo -e "${CYAN}โ•‘ โ•‘${NC}" echo -e "${CYAN}โ•‘ Branch: ${CYAN}$DISPLAY_BRANCH${CYAN}${NC}" echo -e "${CYAN}โ•‘ โ•‘${NC}" echo -e "${CYAN}โ•‘ Only bug fixes and release prep allowed here! โ•‘${NC}" echo -e "${CYAN}โ•‘ โ•‘${NC}" echo -e "${CYAN}โ•‘ No new features! โ•‘${NC}" echo -e "${CYAN}โ•‘ โ•‘${NC}" echo -e "${CYAN}โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•${NC}" ;; esac # Show current status echo "" git status -sb

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DollhouseMCP/DollhouseMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server