@clix-so/clix-agent-skills 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -0
- package/dist/bin/cli.js +29 -0
- package/dist/bin/commands/install.js +108 -0
- package/dist/bin/utils/mcp.js +131 -0
- package/package.json +53 -0
- package/skills/integration/LICENSE.txt +202 -0
- package/skills/integration/SKILL.md +426 -0
- package/skills/integration/examples/android-integration.kt +38 -0
- package/skills/integration/examples/flutter-integration.dart +81 -0
- package/skills/integration/examples/ios-integration.swift +36 -0
- package/skills/integration/examples/react-native-integration.tsx +18 -0
- package/skills/integration/references/error-handling.md +265 -0
- package/skills/integration/references/framework-patterns.md +201 -0
- package/skills/integration/references/mcp-integration.md +284 -0
- package/skills/integration/references/sdk-reference.md +217 -0
- package/skills/integration/scripts/install-mcp.sh +244 -0
- package/skills/integration/scripts/validate-sdk.sh +380 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# Clix MCP Server Installer
|
|
4
|
+
#
|
|
5
|
+
# Usage:
|
|
6
|
+
# bash scripts/install-mcp.sh
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
set -euo pipefail
|
|
10
|
+
|
|
11
|
+
BLUE='\033[34m'
|
|
12
|
+
GREEN='\033[32m'
|
|
13
|
+
RED='\033[31m'
|
|
14
|
+
YELLOW='\033[33m'
|
|
15
|
+
RESET='\033[0m'
|
|
16
|
+
|
|
17
|
+
log() {
|
|
18
|
+
printf "%b\n" "$1"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
# Detect platform
|
|
22
|
+
detect_platform() {
|
|
23
|
+
case "$(uname -s)" in
|
|
24
|
+
Darwin*) echo "darwin" ;;
|
|
25
|
+
Linux*) echo "linux" ;;
|
|
26
|
+
MINGW*|MSYS*|CYGWIN*) echo "win32" ;;
|
|
27
|
+
*) echo "unknown" ;;
|
|
28
|
+
esac
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# Get config path for different clients
|
|
32
|
+
get_config_path() {
|
|
33
|
+
local client=$1
|
|
34
|
+
local home="${HOME:-$HOME}"
|
|
35
|
+
local platform=$(detect_platform)
|
|
36
|
+
|
|
37
|
+
case "$client" in
|
|
38
|
+
codex)
|
|
39
|
+
echo "${home}/.codex/config.toml"
|
|
40
|
+
;;
|
|
41
|
+
cursor)
|
|
42
|
+
# Check project-level first
|
|
43
|
+
if [ -f ".cursor/mcp.json" ]; then
|
|
44
|
+
echo ".cursor/mcp.json"
|
|
45
|
+
else
|
|
46
|
+
echo "${home}/.cursor/mcp.json"
|
|
47
|
+
fi
|
|
48
|
+
;;
|
|
49
|
+
claude)
|
|
50
|
+
if [ "$platform" = "darwin" ]; then
|
|
51
|
+
echo "${home}/Library/Application Support/Claude/claude_desktop_config.json"
|
|
52
|
+
elif [ "$platform" = "win32" ]; then
|
|
53
|
+
echo "${APPDATA:-}/Claude/claude_desktop_config.json"
|
|
54
|
+
else
|
|
55
|
+
echo "${home}/.config/claude/claude_desktop_config.json"
|
|
56
|
+
fi
|
|
57
|
+
;;
|
|
58
|
+
vscode)
|
|
59
|
+
echo "${home}/.vscode/mcp.json"
|
|
60
|
+
;;
|
|
61
|
+
*)
|
|
62
|
+
echo ""
|
|
63
|
+
;;
|
|
64
|
+
esac
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
# Configure MCP for Codex (TOML format)
|
|
68
|
+
configure_codex() {
|
|
69
|
+
local config_path="$1"
|
|
70
|
+
local config_dir=$(dirname "$config_path")
|
|
71
|
+
|
|
72
|
+
mkdir -p "$config_dir"
|
|
73
|
+
|
|
74
|
+
if [ ! -f "$config_path" ]; then
|
|
75
|
+
cat > "$config_path" <<'EOF'
|
|
76
|
+
[mcp_servers]
|
|
77
|
+
EOF
|
|
78
|
+
log "${GREEN}✔ Created Codex config file${RESET}"
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
# Check if already configured
|
|
82
|
+
if grep -q "clix-mcp-server" "$config_path" 2>/dev/null; then
|
|
83
|
+
log "${GREEN}✔ Clix MCP Server already configured in Codex${RESET}"
|
|
84
|
+
return 0
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
# If user previously configured Codex under a different name (e.g. "clix"),
|
|
88
|
+
# tools will appear as "clix:*" instead of the expected "clix-mcp-server:*".
|
|
89
|
+
# We add the correct server name, but also warn.
|
|
90
|
+
if grep -q "\[mcp_servers\.clix\]" "$config_path" 2>/dev/null && \
|
|
91
|
+
grep -q "@clix-so/clix-mcp-server" "$config_path" 2>/dev/null; then
|
|
92
|
+
log "${YELLOW}⚠️ Found an existing Codex MCP entry named \"clix\".${RESET}"
|
|
93
|
+
log "${YELLOW} This makes tools show up as \"clix:*\" (not \"clix-mcp-server:*\").${RESET}"
|
|
94
|
+
log "${YELLOW} Adding the correct \"clix-mcp-server\" entry now.${RESET}"
|
|
95
|
+
fi
|
|
96
|
+
|
|
97
|
+
# Add configuration
|
|
98
|
+
if grep -q "\[mcp_servers\]" "$config_path"; then
|
|
99
|
+
# Append to existing [mcp_servers] section
|
|
100
|
+
cat >> "$config_path" <<'EOF'
|
|
101
|
+
|
|
102
|
+
[mcp_servers."clix-mcp-server"]
|
|
103
|
+
command = "npx"
|
|
104
|
+
args = ["-y", "@clix-so/clix-mcp-server@latest"]
|
|
105
|
+
EOF
|
|
106
|
+
else
|
|
107
|
+
# Create new section
|
|
108
|
+
cat >> "$config_path" <<'EOF'
|
|
109
|
+
[mcp_servers]
|
|
110
|
+
[mcp_servers."clix-mcp-server"]
|
|
111
|
+
command = "npx"
|
|
112
|
+
args = ["-y", "@clix-so/clix-mcp-server@latest"]
|
|
113
|
+
EOF
|
|
114
|
+
fi
|
|
115
|
+
|
|
116
|
+
log "${GREEN}✔ Configured Clix MCP Server in Codex config${RESET}"
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
# Configure MCP for JSON-based clients
|
|
120
|
+
configure_json_client() {
|
|
121
|
+
local config_path="$1"
|
|
122
|
+
local config_dir=$(dirname "$config_path")
|
|
123
|
+
|
|
124
|
+
mkdir -p "$config_dir"
|
|
125
|
+
|
|
126
|
+
if [ ! -f "$config_path" ]; then
|
|
127
|
+
echo '{"mcpServers": {}}' > "$config_path"
|
|
128
|
+
log "${GREEN}✔ Created config file${RESET}"
|
|
129
|
+
fi
|
|
130
|
+
|
|
131
|
+
# Check if already configured
|
|
132
|
+
if grep -q "clix-mcp-server" "$config_path" 2>/dev/null; then
|
|
133
|
+
log "${GREEN}✔ Clix MCP Server already configured${RESET}"
|
|
134
|
+
return 0
|
|
135
|
+
fi
|
|
136
|
+
|
|
137
|
+
# Use node to safely update JSON
|
|
138
|
+
if command -v node &> /dev/null; then
|
|
139
|
+
node <<EOF
|
|
140
|
+
const fs = require('fs');
|
|
141
|
+
const path = '$config_path';
|
|
142
|
+
const config = JSON.parse(fs.readFileSync(path, 'utf8'));
|
|
143
|
+
if (!config.mcpServers) config.mcpServers = {};
|
|
144
|
+
config.mcpServers['clix-mcp-server'] = {
|
|
145
|
+
command: 'npx',
|
|
146
|
+
args: ['-y', '@clix-so/clix-mcp-server@latest']
|
|
147
|
+
};
|
|
148
|
+
fs.writeFileSync(path, JSON.stringify(config, null, 2) + '\n');
|
|
149
|
+
EOF
|
|
150
|
+
log "${GREEN}✔ Configured Clix MCP Server${RESET}"
|
|
151
|
+
else
|
|
152
|
+
log "${YELLOW}⚠️ Node.js not found. Please manually add to $config_path:${RESET}"
|
|
153
|
+
log "${BLUE}{${RESET}"
|
|
154
|
+
log "${BLUE} \"mcpServers\": {${RESET}"
|
|
155
|
+
log "${BLUE} \"clix-mcp-server\": {${RESET}"
|
|
156
|
+
log "${BLUE} \"command\": \"npx\",${RESET}"
|
|
157
|
+
log "${BLUE} \"args\": [\"-y\", \"@clix-so/clix-mcp-server@latest\"]${RESET}"
|
|
158
|
+
log "${BLUE} }${RESET}"
|
|
159
|
+
log "${BLUE} }${RESET}"
|
|
160
|
+
log "${BLUE}}${RESET}"
|
|
161
|
+
fi
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
# Auto-detect client
|
|
165
|
+
detect_client() {
|
|
166
|
+
# Check for Codex
|
|
167
|
+
if [ -f "${HOME}/.codex/config.toml" ] || command -v codex &> /dev/null; then
|
|
168
|
+
echo "codex"
|
|
169
|
+
return
|
|
170
|
+
fi
|
|
171
|
+
|
|
172
|
+
# Check for Cursor
|
|
173
|
+
if [ -f "${HOME}/.cursor/mcp.json" ] || [ -f ".cursor/mcp.json" ]; then
|
|
174
|
+
echo "cursor"
|
|
175
|
+
return
|
|
176
|
+
fi
|
|
177
|
+
|
|
178
|
+
# Check for Claude Desktop
|
|
179
|
+
if [ -f "${HOME}/Library/Application Support/Claude/claude_desktop_config.json" ] 2>/dev/null || \
|
|
180
|
+
[ -f "${APPDATA:-}/Claude/claude_desktop_config.json" ] 2>/dev/null; then
|
|
181
|
+
echo "claude"
|
|
182
|
+
return
|
|
183
|
+
fi
|
|
184
|
+
|
|
185
|
+
# Check for VS Code
|
|
186
|
+
if [ -f "${HOME}/.vscode/mcp.json" ]; then
|
|
187
|
+
echo "vscode"
|
|
188
|
+
return
|
|
189
|
+
fi
|
|
190
|
+
|
|
191
|
+
echo "unknown"
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
log "${BLUE}📦 Installing Clix MCP Server...${RESET}"
|
|
195
|
+
|
|
196
|
+
# Check for npm
|
|
197
|
+
if ! command -v npm &> /dev/null; then
|
|
198
|
+
log "${RED}❌ npm is not installed or not in PATH.${RESET}"
|
|
199
|
+
log "${YELLOW}Please install Node.js and npm first: https://nodejs.org/${RESET}"
|
|
200
|
+
exit 1
|
|
201
|
+
fi
|
|
202
|
+
|
|
203
|
+
# Install package (using npx, no need for global install)
|
|
204
|
+
log "${BLUE}Verifying @clix-so/clix-mcp-server is available...${RESET}"
|
|
205
|
+
if npm view @clix-so/clix-mcp-server@latest version &> /dev/null; then
|
|
206
|
+
log "${GREEN}✅ Package is available${RESET}"
|
|
207
|
+
else
|
|
208
|
+
log "${RED}❌ Package not found on npm${RESET}"
|
|
209
|
+
exit 1
|
|
210
|
+
fi
|
|
211
|
+
|
|
212
|
+
# Auto-detect and configure
|
|
213
|
+
log "${BLUE}🔍 Detecting MCP client...${RESET}"
|
|
214
|
+
detected_client=$(detect_client)
|
|
215
|
+
|
|
216
|
+
if [ "$detected_client" != "unknown" ]; then
|
|
217
|
+
log "${GREEN}Detected: $detected_client${RESET}"
|
|
218
|
+
config_path=$(get_config_path "$detected_client")
|
|
219
|
+
|
|
220
|
+
if [ -n "$config_path" ]; then
|
|
221
|
+
log "${BLUE}Configuring MCP server for $detected_client...${RESET}"
|
|
222
|
+
|
|
223
|
+
if [ "$detected_client" = "codex" ]; then
|
|
224
|
+
configure_codex "$config_path"
|
|
225
|
+
else
|
|
226
|
+
configure_json_client "$config_path"
|
|
227
|
+
fi
|
|
228
|
+
|
|
229
|
+
log "${GREEN}✅ Successfully configured Clix MCP Server!${RESET}"
|
|
230
|
+
log "${YELLOW}⚠️ IMPORTANT: Please RESTART $detected_client for the changes to take effect.${RESET}"
|
|
231
|
+
else
|
|
232
|
+
log "${YELLOW}⚠️ Could not determine config path for $detected_client${RESET}"
|
|
233
|
+
log "${YELLOW}Please configure manually. See references/mcp-integration.md for instructions.${RESET}"
|
|
234
|
+
fi
|
|
235
|
+
else
|
|
236
|
+
log "${YELLOW}⚠️ Could not auto-detect MCP client.${RESET}"
|
|
237
|
+
log "${BLUE}The package is ready to use. Configure manually:${RESET}"
|
|
238
|
+
log "${BLUE} - Codex: Add to ~/.codex/config.toml${RESET}"
|
|
239
|
+
log "${BLUE} - Cursor: Add to .cursor/mcp.json or ~/.cursor/mcp.json${RESET}"
|
|
240
|
+
log "${BLUE} - Claude Desktop: Add to config file${RESET}"
|
|
241
|
+
log "${BLUE}See references/mcp-integration.md for detailed instructions.${RESET}"
|
|
242
|
+
fi
|
|
243
|
+
|
|
244
|
+
log "${GREEN}✅ Setup complete!${RESET}"
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# Clix SDK Validation Script (bash)
|
|
4
|
+
#
|
|
5
|
+
# Validates that Clix SDK is properly installed and initialized for mobile platforms:
|
|
6
|
+
# - iOS (Swift Package Manager or CocoaPods)
|
|
7
|
+
# - Android (Gradle)
|
|
8
|
+
# - Flutter (pubspec.yaml)
|
|
9
|
+
# - React Native (package.json)
|
|
10
|
+
#
|
|
11
|
+
# Usage:
|
|
12
|
+
# bash scripts/validate-sdk.sh
|
|
13
|
+
# bash scripts/validate-sdk.sh --check-install
|
|
14
|
+
# bash scripts/validate-sdk.sh --check-init
|
|
15
|
+
#
|
|
16
|
+
# Exit codes:
|
|
17
|
+
# 0 = success
|
|
18
|
+
# 1 = validation failed
|
|
19
|
+
|
|
20
|
+
set -euo pipefail
|
|
21
|
+
|
|
22
|
+
BLUE='\033[34m'
|
|
23
|
+
GREEN='\033[32m'
|
|
24
|
+
YELLOW='\033[33m'
|
|
25
|
+
RED='\033[31m'
|
|
26
|
+
RESET='\033[0m'
|
|
27
|
+
|
|
28
|
+
log() {
|
|
29
|
+
# shellcheck disable=SC2059
|
|
30
|
+
printf "%b\n" "$1"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
die() {
|
|
34
|
+
log "${RED}❌ $1${RESET}"
|
|
35
|
+
exit 1
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
usage() {
|
|
39
|
+
cat <<'EOF'
|
|
40
|
+
Clix SDK Validation Script (bash)
|
|
41
|
+
|
|
42
|
+
Usage:
|
|
43
|
+
bash scripts/validate-sdk.sh [--check-install] [--check-init]
|
|
44
|
+
|
|
45
|
+
If no flags are provided, all checks run.
|
|
46
|
+
|
|
47
|
+
Checks:
|
|
48
|
+
--check-install Validate Clix SDK dependency is present (iOS Podfile/Package.swift, Android build.gradle.kts, Flutter pubspec.yaml, React Native package.json)
|
|
49
|
+
--check-init Search platform-specific entrypoints for Clix.initialize(...) calls
|
|
50
|
+
|
|
51
|
+
EOF
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
detect_platform() {
|
|
55
|
+
if [[ -f "Podfile" ]] || [[ -f "Package.swift" ]] || find . -maxdepth 2 -name "*.xcodeproj" -o -name "*.xcworkspace" 2>/dev/null | grep -q .; then
|
|
56
|
+
echo "ios"
|
|
57
|
+
elif [[ -f "build.gradle.kts" ]] || [[ -f "build.gradle" ]] || [[ -f "settings.gradle.kts" ]] || [[ -f "settings.gradle" ]]; then
|
|
58
|
+
echo "android"
|
|
59
|
+
elif [[ -f "pubspec.yaml" ]]; then
|
|
60
|
+
echo "flutter"
|
|
61
|
+
elif [[ -f "package.json" ]] && (grep -q "react-native" package.json 2>/dev/null || [[ -d "ios" ]] && [[ -d "android" ]]); then
|
|
62
|
+
echo "react-native"
|
|
63
|
+
else
|
|
64
|
+
echo "unknown"
|
|
65
|
+
fi
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
check_install_ios() {
|
|
69
|
+
log "${BLUE}📦 Checking iOS SDK installation...${RESET}"
|
|
70
|
+
|
|
71
|
+
local found=0
|
|
72
|
+
|
|
73
|
+
# Check CocoaPods Podfile
|
|
74
|
+
if [[ -f "Podfile" ]] || [[ -f "ios/Podfile" ]]; then
|
|
75
|
+
local podfile="${PODFILE:-Podfile}"
|
|
76
|
+
[[ -f "ios/Podfile" ]] && podfile="ios/Podfile"
|
|
77
|
+
|
|
78
|
+
if grep -Eq "pod\s+['\"]ClixSDK['\"]|pod\s+['\"]Clix['\"]|:git\s*=>\s*['\"].*clix-ios-sdk" "$podfile" 2>/dev/null; then
|
|
79
|
+
log "${GREEN}✓ Clix SDK found in Podfile${RESET}"
|
|
80
|
+
found=1
|
|
81
|
+
fi
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
# Check Swift Package Manager (Package.swift or Xcode project)
|
|
85
|
+
if [[ -f "Package.swift" ]]; then
|
|
86
|
+
if grep -Eq "clix-ios-sdk|github.com/clix-so/clix-ios-sdk" Package.swift 2>/dev/null; then
|
|
87
|
+
log "${GREEN}✓ Clix SDK found in Package.swift${RESET}"
|
|
88
|
+
found=1
|
|
89
|
+
fi
|
|
90
|
+
fi
|
|
91
|
+
|
|
92
|
+
if [[ "$found" -eq 0 ]]; then
|
|
93
|
+
log "${RED}✗ Clix SDK not found in Podfile or Package.swift${RESET}"
|
|
94
|
+
log "${YELLOW} iOS: Add 'pod \"ClixSDK\"' to Podfile or add package via Xcode${RESET}"
|
|
95
|
+
return 1
|
|
96
|
+
fi
|
|
97
|
+
|
|
98
|
+
return 0
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
check_install_android() {
|
|
102
|
+
log "${BLUE}📦 Checking Android SDK installation...${RESET}"
|
|
103
|
+
|
|
104
|
+
local found=0
|
|
105
|
+
local gradle_files=()
|
|
106
|
+
|
|
107
|
+
# Find build.gradle.kts or build.gradle files
|
|
108
|
+
if [[ -f "app/build.gradle.kts" ]]; then
|
|
109
|
+
gradle_files+=("app/build.gradle.kts")
|
|
110
|
+
elif [[ -f "build.gradle.kts" ]]; then
|
|
111
|
+
gradle_files+=("build.gradle.kts")
|
|
112
|
+
elif [[ -f "app/build.gradle" ]]; then
|
|
113
|
+
gradle_files+=("app/build.gradle")
|
|
114
|
+
elif [[ -f "build.gradle" ]]; then
|
|
115
|
+
gradle_files+=("build.gradle")
|
|
116
|
+
fi
|
|
117
|
+
|
|
118
|
+
for gradle_file in "${gradle_files[@]}"; do
|
|
119
|
+
if grep -Eq "so\.clix:clix-android-sdk|so\.clix:clix-android-sdk" "$gradle_file" 2>/dev/null; then
|
|
120
|
+
log "${GREEN}✓ Clix SDK found in ${gradle_file}${RESET}"
|
|
121
|
+
found=1
|
|
122
|
+
break
|
|
123
|
+
fi
|
|
124
|
+
done
|
|
125
|
+
|
|
126
|
+
if [[ "$found" -eq 0 ]]; then
|
|
127
|
+
log "${RED}✗ Clix SDK not found in build.gradle files${RESET}"
|
|
128
|
+
log "${YELLOW} Android: Add 'implementation(\"so.clix:clix-android-sdk:1.X.X\")' to build.gradle.kts${RESET}"
|
|
129
|
+
return 1
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
return 0
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
check_install_flutter() {
|
|
136
|
+
log "${BLUE}📦 Checking Flutter SDK installation...${RESET}"
|
|
137
|
+
|
|
138
|
+
if [[ ! -f "pubspec.yaml" ]]; then
|
|
139
|
+
log "${YELLOW}⚠️ No pubspec.yaml found${RESET}"
|
|
140
|
+
return 0
|
|
141
|
+
fi
|
|
142
|
+
|
|
143
|
+
if grep -Eq "clix_flutter:" pubspec.yaml 2>/dev/null; then
|
|
144
|
+
log "${GREEN}✓ clix_flutter found in pubspec.yaml${RESET}"
|
|
145
|
+
return 0
|
|
146
|
+
else
|
|
147
|
+
log "${RED}✗ clix_flutter not found in pubspec.yaml${RESET}"
|
|
148
|
+
log "${YELLOW} Flutter: Add 'clix_flutter: ^0.0.1' to pubspec.yaml dependencies${RESET}"
|
|
149
|
+
return 1
|
|
150
|
+
fi
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
check_install_react_native() {
|
|
154
|
+
log "${BLUE}📦 Checking React Native SDK installation...${RESET}"
|
|
155
|
+
|
|
156
|
+
if [[ ! -f "package.json" ]]; then
|
|
157
|
+
log "${YELLOW}⚠️ No package.json found${RESET}"
|
|
158
|
+
return 0
|
|
159
|
+
fi
|
|
160
|
+
|
|
161
|
+
if grep -Eq "@clix-so/react-native-sdk" package.json 2>/dev/null; then
|
|
162
|
+
log "${GREEN}✓ @clix-so/react-native-sdk found in package.json${RESET}"
|
|
163
|
+
return 0
|
|
164
|
+
else
|
|
165
|
+
log "${RED}✗ @clix-so/react-native-sdk not found in package.json${RESET}"
|
|
166
|
+
log "${YELLOW} React Native: Run 'npm install @clix-so/react-native-sdk'${RESET}"
|
|
167
|
+
return 1
|
|
168
|
+
fi
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
check_init_ios() {
|
|
172
|
+
log "${BLUE}🔍 Checking iOS SDK initialization...${RESET}"
|
|
173
|
+
|
|
174
|
+
local entrypoints=(
|
|
175
|
+
"AppDelegate.swift"
|
|
176
|
+
"ios/AppDelegate.swift"
|
|
177
|
+
"Sources/AppDelegate.swift"
|
|
178
|
+
"*.swift"
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
# Search for Clix.initialize in Swift files
|
|
182
|
+
local found=0
|
|
183
|
+
while IFS= read -r -d '' file; do
|
|
184
|
+
if grep -Eq "Clix\.initialize|ClixConfiguration\.shared\.config" "$file" 2>/dev/null; then
|
|
185
|
+
log "${GREEN}✓ Found initialization in ${file}${RESET}"
|
|
186
|
+
found=1
|
|
187
|
+
break
|
|
188
|
+
fi
|
|
189
|
+
done < <(find . -maxdepth 4 -name "AppDelegate.swift" -o -name "*App*.swift" 2>/dev/null | head -5 | tr '\n' '\0' 2>/dev/null || true)
|
|
190
|
+
|
|
191
|
+
if [[ "$found" -eq 0 ]]; then
|
|
192
|
+
log "${YELLOW}⚠️ SDK initialization not found in AppDelegate or app entry point${RESET}"
|
|
193
|
+
log "${YELLOW} iOS: Ensure Clix.initialize(config: ClixConfiguration.shared.config) is called in AppDelegate${RESET}"
|
|
194
|
+
return 1
|
|
195
|
+
fi
|
|
196
|
+
|
|
197
|
+
return 0
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
check_init_android() {
|
|
201
|
+
log "${BLUE}🔍 Checking Android SDK initialization...${RESET}"
|
|
202
|
+
|
|
203
|
+
local entrypoints=(
|
|
204
|
+
"src/main/kotlin/**/Application.kt"
|
|
205
|
+
"src/main/java/**/Application.java"
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
local found=0
|
|
209
|
+
while IFS= read -r -d '' file; do
|
|
210
|
+
if grep -Eq "Clix\.initialize|so\.clix\.core\.Clix" "$file" 2>/dev/null; then
|
|
211
|
+
log "${GREEN}✓ Found initialization in ${file}${RESET}"
|
|
212
|
+
found=1
|
|
213
|
+
break
|
|
214
|
+
fi
|
|
215
|
+
done < <(find . -path "*/src/main/kotlin/*/*Application.kt" -o -path "*/src/main/java/*/*Application.java" 2>/dev/null | head -5 | tr '\n' '\0' 2>/dev/null || true)
|
|
216
|
+
|
|
217
|
+
if [[ "$found" -eq 0 ]]; then
|
|
218
|
+
log "${YELLOW}⚠️ SDK initialization not found in Application class${RESET}"
|
|
219
|
+
log "${YELLOW} Android: Ensure Clix.initialize(applicationContext, config) is called in Application.onCreate()${RESET}"
|
|
220
|
+
return 1
|
|
221
|
+
fi
|
|
222
|
+
|
|
223
|
+
return 0
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
check_init_flutter() {
|
|
227
|
+
log "${BLUE}🔍 Checking Flutter SDK initialization...${RESET}"
|
|
228
|
+
|
|
229
|
+
local entrypoints=(
|
|
230
|
+
"lib/main.dart"
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
if [[ -f "lib/main.dart" ]]; then
|
|
234
|
+
if grep -Eq "Clix\.initialize|clix_flutter" lib/main.dart 2>/dev/null; then
|
|
235
|
+
log "${GREEN}✓ Found initialization in lib/main.dart${RESET}"
|
|
236
|
+
return 0
|
|
237
|
+
fi
|
|
238
|
+
fi
|
|
239
|
+
|
|
240
|
+
log "${YELLOW}⚠️ SDK initialization not found in lib/main.dart${RESET}"
|
|
241
|
+
log "${YELLOW} Flutter: Ensure await Clix.initialize(config) is called before runApp()${RESET}"
|
|
242
|
+
return 1
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
check_init_react_native() {
|
|
246
|
+
log "${BLUE}🔍 Checking React Native SDK initialization...${RESET}"
|
|
247
|
+
|
|
248
|
+
local entrypoints=(
|
|
249
|
+
"index.js"
|
|
250
|
+
"index.ts"
|
|
251
|
+
"src/index.js"
|
|
252
|
+
"src/index.ts"
|
|
253
|
+
"App.tsx"
|
|
254
|
+
"src/App.tsx"
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
local found=0
|
|
258
|
+
for entrypoint in "${entrypoints[@]}"; do
|
|
259
|
+
if [[ -f "$entrypoint" ]]; then
|
|
260
|
+
if grep -Eq "Clix\.initialize|@clix-so/react-native-sdk" "$entrypoint" 2>/dev/null; then
|
|
261
|
+
log "${GREEN}✓ Found initialization in ${entrypoint}${RESET}"
|
|
262
|
+
found=1
|
|
263
|
+
break
|
|
264
|
+
fi
|
|
265
|
+
fi
|
|
266
|
+
done
|
|
267
|
+
|
|
268
|
+
if [[ "$found" -eq 0 ]]; then
|
|
269
|
+
log "${YELLOW}⚠️ SDK initialization not found in common entry points${RESET}"
|
|
270
|
+
log "${YELLOW} React Native: Ensure Clix.initialize(config) is called in index.js or App.tsx${RESET}"
|
|
271
|
+
return 1
|
|
272
|
+
fi
|
|
273
|
+
|
|
274
|
+
return 0
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
check_install() {
|
|
278
|
+
local platform
|
|
279
|
+
platform="$(detect_platform)"
|
|
280
|
+
|
|
281
|
+
case "$platform" in
|
|
282
|
+
ios)
|
|
283
|
+
check_install_ios
|
|
284
|
+
;;
|
|
285
|
+
android)
|
|
286
|
+
check_install_android
|
|
287
|
+
;;
|
|
288
|
+
flutter)
|
|
289
|
+
check_install_flutter
|
|
290
|
+
;;
|
|
291
|
+
react-native)
|
|
292
|
+
check_install_react_native
|
|
293
|
+
;;
|
|
294
|
+
*)
|
|
295
|
+
log "${YELLOW}⚠️ Could not detect platform (iOS/Android/Flutter/React Native)${RESET}"
|
|
296
|
+
log "${YELLOW} Skipping installation check${RESET}"
|
|
297
|
+
return 0
|
|
298
|
+
;;
|
|
299
|
+
esac
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
check_init() {
|
|
303
|
+
local platform
|
|
304
|
+
platform="$(detect_platform)"
|
|
305
|
+
|
|
306
|
+
case "$platform" in
|
|
307
|
+
ios)
|
|
308
|
+
check_init_ios
|
|
309
|
+
;;
|
|
310
|
+
android)
|
|
311
|
+
check_init_android
|
|
312
|
+
;;
|
|
313
|
+
flutter)
|
|
314
|
+
check_init_flutter
|
|
315
|
+
;;
|
|
316
|
+
react-native)
|
|
317
|
+
check_init_react_native
|
|
318
|
+
;;
|
|
319
|
+
*)
|
|
320
|
+
log "${YELLOW}⚠️ Could not detect platform (iOS/Android/Flutter/React Native)${RESET}"
|
|
321
|
+
log "${YELLOW} Skipping initialization check${RESET}"
|
|
322
|
+
return 0
|
|
323
|
+
;;
|
|
324
|
+
esac
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
main() {
|
|
328
|
+
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then
|
|
329
|
+
usage
|
|
330
|
+
exit 0
|
|
331
|
+
fi
|
|
332
|
+
|
|
333
|
+
local run_install=0
|
|
334
|
+
local run_init=0
|
|
335
|
+
|
|
336
|
+
if [[ "$#" -eq 0 ]]; then
|
|
337
|
+
run_install=1
|
|
338
|
+
run_init=1
|
|
339
|
+
else
|
|
340
|
+
while [[ "$#" -gt 0 ]]; do
|
|
341
|
+
case "$1" in
|
|
342
|
+
--check-install) run_install=1 ;;
|
|
343
|
+
--check-init) run_init=1 ;;
|
|
344
|
+
*)
|
|
345
|
+
usage
|
|
346
|
+
die "Unknown option: $1"
|
|
347
|
+
;;
|
|
348
|
+
esac
|
|
349
|
+
shift
|
|
350
|
+
done
|
|
351
|
+
fi
|
|
352
|
+
|
|
353
|
+
log "${BLUE}🔍 Clix SDK Validation${RESET}"
|
|
354
|
+
log "${BLUE}========================================${RESET}"
|
|
355
|
+
|
|
356
|
+
local platform
|
|
357
|
+
platform="$(detect_platform)"
|
|
358
|
+
log "${BLUE}Detected platform: ${platform}${RESET}"
|
|
359
|
+
|
|
360
|
+
local all_ok=1
|
|
361
|
+
|
|
362
|
+
if [[ "$run_install" -eq 1 ]]; then
|
|
363
|
+
if ! check_install; then all_ok=0; fi
|
|
364
|
+
fi
|
|
365
|
+
|
|
366
|
+
if [[ "$run_init" -eq 1 ]]; then
|
|
367
|
+
if ! check_init; then all_ok=0; fi
|
|
368
|
+
fi
|
|
369
|
+
|
|
370
|
+
log "${BLUE}\n========================================${RESET}"
|
|
371
|
+
if [[ "$all_ok" -eq 1 ]]; then
|
|
372
|
+
log "${GREEN}✅ Validation passed!${RESET}"
|
|
373
|
+
exit 0
|
|
374
|
+
else
|
|
375
|
+
log "${RED}❌ Validation failed. Please fix the issues above.${RESET}"
|
|
376
|
+
exit 1
|
|
377
|
+
fi
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
main "$@"
|