-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·117 lines (103 loc) · 3.5 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·117 lines (103 loc) · 3.5 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo -e "${GREEN}======================================${NC}"
echo -e "${GREEN}Kernel Knowledge RAG System Setup${NC}"
echo -e "${GREEN}======================================${NC}"
echo
# Get the directory where the script is located
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
VENV_DIR="$SCRIPT_DIR/venv"
# Check Python version
echo -e "${YELLOW}Checking Python version...${NC}"
if ! command -v python3 &> /dev/null; then
echo -e "${RED}Error: Python 3 is not installed${NC}"
exit 1
fi
PYTHON_VERSION=$(python3 --version | cut -d' ' -f2)
echo -e "${GREEN}Found Python $PYTHON_VERSION${NC}"
echo
# Create virtual environment
echo -e "${YELLOW}Creating virtual environment...${NC}"
if [ -d "$VENV_DIR" ]; then
echo -e "${YELLOW}Virtual environment already exists. Removing...${NC}"
rm -rf "$VENV_DIR"
fi
python3 -m venv "$VENV_DIR"
echo -e "${GREEN}Virtual environment created${NC}"
echo
# Activate virtual environment
echo -e "${YELLOW}Activating virtual environment...${NC}"
source "$VENV_DIR/bin/activate"
echo -e "${GREEN}Virtual environment activated${NC}"
echo
# Upgrade pip
echo -e "${YELLOW}Upgrading pip...${NC}"
pip install --upgrade pip
echo
# Install dependencies
echo -e "${YELLOW}Installing dependencies...${NC}"
pip install -r "$SCRIPT_DIR/requirements.txt"
echo -e "${GREEN}Dependencies installed${NC}"
echo
# Download embedding model
echo -e "${YELLOW}Downloading embedding model (this may take a few minutes)...${NC}"
python3 << EOF
from sentence_transformers import SentenceTransformer
print("Loading model...")
model = SentenceTransformer('all-MiniLM-L6-v2')
print("Model downloaded and cached successfully!")
EOF
echo -e "${GREEN}Embedding model ready${NC}"
echo
# Create directories if they don't exist
echo -e "${YELLOW}Ensuring directory structure...${NC}"
mkdir -p "$SCRIPT_DIR/journals"
mkdir -p "$SCRIPT_DIR/vector-db"
mkdir -p "$SCRIPT_DIR/mcp-server"
echo -e "${GREEN}Directories ready${NC}"
echo
# Make scripts executable
echo -e "${YELLOW}Setting executable permissions...${NC}"
chmod +x "$SCRIPT_DIR/mcp-server/indexer_service.py"
chmod +x "$SCRIPT_DIR/mcp-server/server.py"
chmod +x "$SCRIPT_DIR/start-indexer.sh"
chmod +x "$SCRIPT_DIR/stop-indexer.sh"
chmod +x "$SCRIPT_DIR/increase-inotify-limit.sh"
chmod +x "$SCRIPT_DIR/test-mcp-server.sh"
echo -e "${GREEN}Permissions set${NC}"
echo
echo -e "${GREEN}======================================${NC}"
echo -e "${GREEN}Setup Complete!${NC}"
echo -e "${GREEN}======================================${NC}"
echo
echo -e "${YELLOW}Next steps:${NC}"
echo
echo "1. Start the indexer service:"
echo -e " ${GREEN}./start-indexer.sh${NC}"
echo -e " ${YELLOW}Or with custom base directory:${NC}"
echo -e " ${GREEN}./start-indexer.sh --base-dir /path/to/knowledge-base${NC}"
echo
echo "2. Add your first journal entry:"
echo -e " ${GREEN}cd journals/${NC}"
echo -e " ${GREEN}vim my-first-note.md${NC}"
echo
echo "3. Configure GitHub Copilot to use the MCP server:"
echo -e " ${GREEN}./configure-vscode.sh${NC}"
echo
echo "4. Test the MCP server:"
echo -e " ${GREEN}./test-mcp-server.sh${NC}"
echo
echo "5. Stop the indexer service:"
echo -e " ${GREEN}./stop-indexer.sh${NC}"
echo
echo -e "${YELLOW}Note:${NC} If the indexer fails with 'inotify watch limit reached', run:"
echo -e " ${GREEN}./increase-inotify-limit.sh${NC}"
echo
echo -e "${YELLOW}Documentation is available in:${NC}"
echo -e " ${GREEN}README.md${NC}"
echo