AbdulElahGwaith commited on
Commit
80bf953
Β·
verified Β·
1 Parent(s): ae4107c

Enhance setup-config.sh with curl/pipx checks and improved error handling

Browse files
Files changed (1) hide show
  1. scripts/setup-config.sh +32 -13
scripts/setup-config.sh CHANGED
@@ -1,7 +1,6 @@
1
  #!/bin/bash
2
  # Mini Agent Configuration Setup Script
3
  # This script helps you set up Mini Agent configuration files
4
-
5
  set -e
6
 
7
  # Colors for output
@@ -20,8 +19,16 @@ echo -e "${CYAN}β•‘ Mini Agent Configuration Setup β•‘${NC}"
20
  echo -e "${CYAN}β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•${NC}"
21
  echo ""
22
 
 
 
 
 
 
 
 
 
23
  # Step 1: Create config directory
24
- echo -e "${BLUE}[1/2]${NC} Creating configuration directory..."
25
  if [ -d "$CONFIG_DIR" ]; then
26
  # Auto backup existing config
27
  BACKUP_DIR="$HOME/.mini-agent/config.backup.$(date +%Y%m%d_%H%M%S)"
@@ -35,40 +42,52 @@ else
35
  fi
36
 
37
  # Step 2: Download configuration files from GitHub
38
- echo -e "${BLUE}[2/2]${NC} Downloading configuration files..."
39
-
40
  FILES_COPIED=0
41
- GITHUB_RAW_URL="https://raw.githubusercontent.com/MiniMax-AI/Mini-Agent/main/mini_agent/config"
42
 
43
  # Download config-example.yaml as config.yaml
44
- if curl -fsSL "$GITHUB_RAW_URL/config-example.yaml" -o "$CONFIG_DIR/config.yaml" 2>/dev/null; then
45
  echo -e "${GREEN} βœ“ Downloaded: config.yaml${NC}"
46
  FILES_COPIED=$((FILES_COPIED + 1))
47
  else
48
- echo -e "${RED} βœ— Failed to download: config.yaml${NC}"
49
  fi
50
 
51
  # Download mcp-example.json as mcp.json (optional, user should customize)
52
- if curl -fsSL "$GITHUB_RAW_URL/mcp-example.json" -o "$CONFIG_DIR/mcp.json" 2>/dev/null; then
53
  echo -e "${GREEN} βœ“ Downloaded: mcp.json (from template)${NC}"
54
  FILES_COPIED=$((FILES_COPIED + 1))
 
 
55
  fi
56
 
57
  # Download system_prompt.md (optional)
58
- if curl -fsSL "$GITHUB_RAW_URL/system_prompt.md" -o "$CONFIG_DIR/system_prompt.md" 2>/dev/null; then
59
  echo -e "${GREEN} βœ“ Downloaded: system_prompt.md${NC}"
60
  FILES_COPIED=$((FILES_COPIED + 1))
 
 
61
  fi
62
 
63
  if [ $FILES_COPIED -eq 0 ]; then
64
- echo -e "${RED} βœ— Failed to download configuration files${NC}"
65
- echo -e "${YELLOW} Please check your internet connection${NC}"
66
  exit 1
67
  fi
68
-
69
  echo -e "${GREEN} βœ“ Configuration files ready${NC}"
 
70
 
 
 
 
 
 
 
 
 
 
71
  echo ""
 
72
  echo -e "${GREEN}╔════════════════════════════════════════════════╗${NC}"
73
  echo -e "${GREEN}β•‘ Setup Complete! ✨ β•‘${NC}"
74
  echo -e "${GREEN}β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•${NC}"
@@ -82,7 +101,7 @@ echo ""
82
  echo -e "${YELLOW}Next Steps:${NC}"
83
  echo ""
84
  echo -e "${YELLOW}1. Install Mini Agent:${NC}"
85
- echo -e " ${GREEN}pipx install git+https://github.com/MiniMax-AI/Mini-Agent.git${NC}"
86
  echo ""
87
  echo -e "${YELLOW}2. Configure your API Key:${NC}"
88
  echo -e " Edit config.yaml and add your MiniMax API Key:"
 
1
  #!/bin/bash
2
  # Mini Agent Configuration Setup Script
3
  # This script helps you set up Mini Agent configuration files
 
4
  set -e
5
 
6
  # Colors for output
 
19
  echo -e "${CYAN}β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•${NC}"
20
  echo ""
21
 
22
+ # Check for curl
23
+ if ! command -v curl &> /dev/null
24
+ then
25
+ echo -e "${RED}Error: curl is not installed. Please install curl to proceed.${NC}"
26
+ echo -e "${YELLOW} e.g., sudo apt-get install curl or sudo yum install curl${NC}"
27
+ exit 1
28
+ fi
29
+
30
  # Step 1: Create config directory
31
+ echo -e "${BLUE}[1/3]${NC} Creating configuration directory..."
32
  if [ -d "$CONFIG_DIR" ]; then
33
  # Auto backup existing config
34
  BACKUP_DIR="$HOME/.mini-agent/config.backup.$(date +%Y%m%d_%H%M%S)"
 
42
  fi
43
 
44
  # Step 2: Download configuration files from GitHub
45
+ echo -e "${BLUE}[2/3]${NC} Downloading configuration files..."
 
46
  FILES_COPIED=0
47
+ GITHUB_RAW_URL="https://raw.githubusercontent.com/AbdulElahGwaith/Mini-Agent/main/mini_agent/config"
48
 
49
  # Download config-example.yaml as config.yaml
50
+ if curl -fsSL "$GITHUB_RAW_URL/config-example.yaml" -o "$CONFIG_DIR/config.yaml"; then
51
  echo -e "${GREEN} βœ“ Downloaded: config.yaml${NC}"
52
  FILES_COPIED=$((FILES_COPIED + 1))
53
  else
54
+ echo -e "${RED} βœ— Failed to download: config.yaml. Please check the URL or your internet connection.${NC}"
55
  fi
56
 
57
  # Download mcp-example.json as mcp.json (optional, user should customize)
58
+ if curl -fsSL "$GITHUB_RAW_URL/mcp-example.json" -o "$CONFIG_DIR/mcp.json"; then
59
  echo -e "${GREEN} βœ“ Downloaded: mcp.json (from template)${NC}"
60
  FILES_COPIED=$((FILES_COPIED + 1))
61
+ else
62
+ echo -e "${YELLOW} Skipped: mcp.json not found or failed to download. This is optional.${NC}"
63
  fi
64
 
65
  # Download system_prompt.md (optional)
66
+ if curl -fsSL "$GITHUB_RAW_URL/system_prompt.md" -o "$CONFIG_DIR/system_prompt.md"; then
67
  echo -e "${GREEN} βœ“ Downloaded: system_prompt.md${NC}"
68
  FILES_COPIED=$((FILES_COPIED + 1))
69
+ else
70
+ echo -e "${YELLOW} Skipped: system_prompt.md not found or failed to download. This is optional.${NC}"
71
  fi
72
 
73
  if [ $FILES_COPIED -eq 0 ]; then
74
+ echo -e "${RED} βœ— Failed to download any configuration files. Please check your internet connection and the repository path.${NC}"
 
75
  exit 1
76
  fi
 
77
  echo -e "${GREEN} βœ“ Configuration files ready${NC}"
78
+ echo ""
79
 
80
+ # Step 3: Check for pipx
81
+ echo -e "${BLUE}[3/3]${NC} Checking for pipx installation..."
82
+ if ! command -v pipx &> /dev/null
83
+ then
84
+ echo -e "${YELLOW} Warning: pipx is not installed. It is recommended for installing Python applications in isolated environments.${NC}"
85
+ echo -e "${YELLOW} You can install it with: python3 -m pip install --user pipx && python3 -m pipx ensurepath${NC}"
86
+ else
87
+ echo -e "${GREEN} βœ“ pipx is installed.${NC}"
88
+ fi
89
  echo ""
90
+
91
  echo -e "${GREEN}╔════════════════════════════════════════════════╗${NC}"
92
  echo -e "${GREEN}β•‘ Setup Complete! ✨ β•‘${NC}"
93
  echo -e "${GREEN}β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•${NC}"
 
101
  echo -e "${YELLOW}Next Steps:${NC}"
102
  echo ""
103
  echo -e "${YELLOW}1. Install Mini Agent:${NC}"
104
+ echo -e " ${GREEN}pipx install git+https://huggingface.co/AbdulElahGwaith/Mini-Agent${NC}"
105
  echo ""
106
  echo -e "${YELLOW}2. Configure your API Key:${NC}"
107
  echo -e " Edit config.yaml and add your MiniMax API Key:"