-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·100 lines (86 loc) · 3.51 KB
/
setup.sh
File metadata and controls
executable file
·100 lines (86 loc) · 3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
# Claude Code Guidelines Setup Script
# Installs Sabrina Ramonov's Claude Code guidelines globally
set -e
echo "🚀 Setting up Claude Code Guidelines..."
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if git is installed
if ! command -v git &> /dev/null; then
echo -e "${RED}Error: git is required but not installed.${NC}"
echo "Please install git and try again."
exit 1
fi
# Create .claude directory if it doesn't exist
echo -e "${BLUE}Creating ~/.claude directory...${NC}"
mkdir -p ~/.claude
# Backup existing CLAUDE.md if it exists
if [ -f ~/.claude/CLAUDE.md ]; then
echo -e "${YELLOW}Backing up existing CLAUDE.md to CLAUDE.md.backup...${NC}"
mv ~/.claude/CLAUDE.md ~/.claude/CLAUDE.md.backup
fi
# Download the latest CLAUDE.md directly
echo -e "${BLUE}Downloading latest Claude Code guidelines...${NC}"
if command -v curl &> /dev/null; then
curl -s -o ~/.claude/CLAUDE.md https://raw.githubusercontent.com/ekodevapps/Claude-Code-Guidelines/main/CLAUDE.md
elif command -v wget &> /dev/null; then
wget -q -O ~/.claude/CLAUDE.md https://raw.githubusercontent.com/ekodevapps/Claude-Code-Guidelines/main/CLAUDE.md
else
echo -e "${RED}Error: Neither curl nor wget is available.${NC}"
echo "Please install curl or wget and try again."
exit 1
fi
# Verify the file was downloaded
if [ ! -f ~/.claude/CLAUDE.md ]; then
echo -e "${RED}Error: Failed to download CLAUDE.md${NC}"
exit 1
fi
# Check file size to ensure it's not empty
if [ ! -s ~/.claude/CLAUDE.md ]; then
echo -e "${RED}Error: Downloaded CLAUDE.md is empty${NC}"
exit 1
fi
echo -e "${GREEN}✅ Claude Code Guidelines installed successfully!${NC}"
echo
echo -e "${BLUE}Location:${NC} ~/.claude/CLAUDE.md"
echo -e "${BLUE}File size:${NC} $(wc -c < ~/.claude/CLAUDE.md) bytes"
echo
echo -e "${GREEN}🎉 Ready to use! Your Claude Code sessions will now follow Sabrina Ramonov's guidelines.${NC}"
echo
echo -e "${BLUE}Quick commands available:${NC}"
echo -e " • ${YELLOW}QNEW${NC} - Initialize with best practices"
echo -e " • ${YELLOW}QPLAN${NC} - Analyze codebase for implementation plan"
echo -e " • ${YELLOW}QCODE${NC} - Implement with tests and formatting"
echo -e " • ${YELLOW}QCHECK${NC} - Comprehensive code review"
echo -e " • ${YELLOW}QGIT${NC} - Conventional commit and push"
echo
echo -e "${BLUE}To update guidelines in the future, just run this script again.${NC}"
# Optional: Create an alias for easy updates
echo
read -p "Create 'update-claude-guidelines' alias for easy updates? (y/N): " -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Determine shell config file
if [ -n "$ZSH_VERSION" ]; then
SHELL_CONFIG="$HOME/.zshrc"
elif [ -n "$BASH_VERSION" ]; then
SHELL_CONFIG="$HOME/.bashrc"
else
SHELL_CONFIG="$HOME/.profile"
fi
# Add alias if not already present
if ! grep -q "update-claude-guidelines" "$SHELL_CONFIG" 2>/dev/null; then
echo "" >> "$SHELL_CONFIG"
echo "# Claude Code Guidelines updater" >> "$SHELL_CONFIG"
echo "alias update-claude-guidelines='curl -s https://raw.githubusercontent.com/ekodevapps/Claude-Code-Guidelines/main/setup.sh | bash'" >> "$SHELL_CONFIG"
echo -e "${GREEN}✅ Alias added to $SHELL_CONFIG${NC}"
echo -e "${BLUE}Run 'source $SHELL_CONFIG' or restart your terminal to use the alias.${NC}"
else
echo -e "${YELLOW}Alias already exists in $SHELL_CONFIG${NC}"
fi
fi
echo
echo -e "${GREEN}Setup complete! 🎊${NC}"