-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathsetup-dmtools.sh
More file actions
executable file
·167 lines (144 loc) · 5.64 KB
/
Copy pathsetup-dmtools.sh
File metadata and controls
executable file
·167 lines (144 loc) · 5.64 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#!/bin/bash
# DMtools Setup Helper Script
# This script helps AI assistants set up DMtools for first-time users
# Usage: bash setup-dmtools.sh
set -e
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m'
echo -e "${BLUE}╔════════════════════════════════════════════╗${NC}"
echo -e "${BLUE}║ DMtools Setup Helper ║${NC}"
echo -e "${BLUE}╚════════════════════════════════════════════╝${NC}"
echo ""
# Step 1: Check if DMtools is installed
echo -e "${YELLOW}[1/5]${NC} Checking DMtools installation..."
if command -v dmtools &> /dev/null; then
echo -e "${GREEN}✓${NC} DMtools is installed"
dmtools --version 2>/dev/null || echo " Version: $(ls ~/.dmtools/dmtools.jar 2>/dev/null | xargs basename)"
else
echo -e "${RED}✗${NC} DMtools is not installed"
echo ""
echo "Installing DMtools..."
curl -fsSL https://github.com/epam/dm.ai/releases/latest/download/install.sh | bash
if command -v dmtools &> /dev/null; then
echo -e "${GREEN}✓${NC} DMtools installed successfully"
else
echo -e "${RED}✗${NC} DMtools installation failed. Please check the error messages above."
exit 1
fi
fi
echo ""
# Step 2: Check for dmtools.env
echo -e "${YELLOW}[2/5]${NC} Checking dmtools.env configuration..."
if [ -f "dmtools.env" ]; then
echo -e "${GREEN}✓${NC} dmtools.env found in current directory"
elif [ -f "$HOME/.dmtools/dmtools.env" ]; then
echo -e "${GREEN}✓${NC} dmtools.env found in ~/.dmtools/"
else
echo -e "${RED}✗${NC} dmtools.env not found"
echo ""
echo "Creating dmtools.env template..."
cat > dmtools.env << 'EOF'
# dmtools.env - NEVER commit this file
# Generated by DMtools setup helper
# ================================
# INTEGRATIONS (uncomment what you need)
# ================================
# Jira
#JIRA_BASE_PATH=https://your-company.atlassian.net
#JIRA_EMAIL=your-email@company.com
#JIRA_API_TOKEN=your-jira-api-token
#JIRA_AUTH_TYPE=Basic
# Azure DevOps
#ADO_BASE_PATH=https://dev.azure.com/your-org
#ADO_PAT_TOKEN=your-ado-pat-token
# ================================
# AI PROVIDER (required - choose one)
# ================================
# Gemini (RECOMMENDED - free tier available)
#GEMINI_API_KEY=your-gemini-api-key
# Get free key: https://aistudio.google.com/app/apikey
# OR OpenAI
#OPENAI_API_KEY=your-openai-api-key
# OR AWS Bedrock
#BEDROCK_ACCESS_KEY_ID=your-aws-key
#BEDROCK_SECRET_ACCESS_KEY=your-aws-secret
# ================================
# DEFAULTS
# ================================
#DEFAULT_LLM=gemini
#DEFAULT_TRACKER=jira
EOF
echo -e "${GREEN}✓${NC} Created dmtools.env template"
echo ""
echo -e "${YELLOW}⚠${NC} You need to edit dmtools.env and add your credentials"
echo ""
echo "Quick links for API tokens:"
echo " • Jira: https://id.atlassian.com/manage-profile/security/api-tokens"
echo " • Gemini (FREE): https://aistudio.google.com/app/apikey"
echo " • OpenAI: https://platform.openai.com/api-keys"
echo " • ADO: https://dev.azure.com → User Settings → Personal Access Tokens"
fi
echo ""
# Step 3: Check .gitignore
echo -e "${YELLOW}[3/5]${NC} Checking .gitignore..."
if [ -f ".gitignore" ]; then
if grep -q "dmtools.env" .gitignore 2>/dev/null; then
echo -e "${GREEN}✓${NC} dmtools.env is in .gitignore"
else
echo -e "${RED}✗${NC} dmtools.env is NOT in .gitignore"
echo ""
echo "Adding DMtools files to .gitignore..."
cat >> .gitignore << 'EOF'
# DMtools configuration (contains secrets)
dmtools.env
dmtools-local.env
EOF
echo -e "${GREEN}✓${NC} Added DMtools files to .gitignore"
fi
else
echo -e "${YELLOW}⚠${NC} No .gitignore found (not a git repo?)"
echo "Creating .gitignore..."
cat > .gitignore << 'EOF'
# DMtools configuration (contains secrets)
dmtools.env
dmtools-local.env
EOF
echo -e "${GREEN}✓${NC} Created .gitignore with DMtools files"
fi
echo ""
# Step 4: Check Java
echo -e "${YELLOW}[4/5]${NC} Checking Java installation..."
if command -v java &> /dev/null; then
JAVA_VERSION=$(java -version 2>&1 | head -n 1 | cut -d'"' -f2)
echo -e "${GREEN}✓${NC} Java is installed: $JAVA_VERSION"
else
echo -e "${RED}✗${NC} Java is not found in PATH"
echo ""
echo "DMtools installer should have installed Java locally."
echo "Try running: source ~/.bashrc (or ~/.zshrc)"
fi
echo ""
# Step 5: Test DMtools
echo -e "${YELLOW}[5/5]${NC} Testing DMtools..."
if dmtools list > /dev/null 2>&1; then
echo -e "${GREEN}✓${NC} DMtools is working"
TOOL_COUNT=$(dmtools list 2>/dev/null | grep -c "^[a-z]" || echo "unknown")
echo " Available MCP tools: $TOOL_COUNT"
else
echo -e "${YELLOW}⚠${NC} DMtools command failed (this is normal if dmtools.env is not configured yet)"
fi
echo ""
echo -e "${GREEN}════════════════════════════════════════════════════${NC}"
echo -e "${GREEN} DMtools Setup Complete! ${NC}"
echo -e "${GREEN}════════════════════════════════════════════════════${NC}"
echo ""
echo "Next steps:"
echo " 1. Edit dmtools.env and add your credentials"
echo " 2. Run: dmtools list (to verify configuration)"
echo " 3. Start using DMtools!"
echo ""
echo "Documentation: https://github.com/epam/dm.ai/tree/main/dmtools-ai-docs"