-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathinstall-skills.sh
More file actions
executable file
·150 lines (136 loc) · 4.05 KB
/
install-skills.sh
File metadata and controls
executable file
·150 lines (136 loc) · 4.05 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
#!/bin/bash
# (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
# Install DAT SDK AI development config into your project.
# Usage:
# ./install-skills.sh # Interactive menu (when run with a tty)
# ./install-skills.sh claude # Claude Code only
# ./install-skills.sh copilot # GitHub Copilot only
# ./install-skills.sh cursor # Cursor only
# ./install-skills.sh agents # AGENTS.md only
# ./install-skills.sh all # All tools
# curl -sL ...install-skills.sh | bash # Defaults to "all" (no tty)
set -euo pipefail
REPO="facebook/meta-wearables-dat-android"
BRANCH="main"
ARCHIVE_URL="https://github.com/${REPO}/archive/refs/heads/${BRANCH}.tar.gz"
EXTRACT_DIR="meta-wearables-dat-android-${BRANCH}"
safe_cleanup() {
if [ -z "${EXTRACT_DIR:-}" ]; then
echo "Warning: EXTRACT_DIR is empty, skipping cleanup." >&2
return 0
fi
if [[ ! "$EXTRACT_DIR" =~ ^meta-wearables-dat-android- ]]; then
echo "Warning: EXTRACT_DIR does not match expected pattern, skipping cleanup." >&2
return 0
fi
if [ -d "$EXTRACT_DIR" ]; then
rm -rf "$EXTRACT_DIR"
fi
}
trap safe_cleanup EXIT
download_archive() {
if [ ! -d "${EXTRACT_DIR}" ]; then
curl -sL "$ARCHIVE_URL" | tar xz 2>/dev/null
fi
}
install_claude() {
echo "Installing Claude Code config for Android..."
download_archive
if [ -d "${EXTRACT_DIR}/.claude" ]; then
mkdir -p .claude
cp -R "${EXTRACT_DIR}/.claude/." .claude/
echo "Installed .claude/ with $(find .claude -name '*.md' | wc -l | tr -d ' ') files."
else
echo "Error: Failed to download .claude/ config." >&2
return 1
fi
}
install_copilot() {
echo "Installing GitHub Copilot config for Android..."
download_archive
if [ -d "${EXTRACT_DIR}/.github" ]; then
mkdir -p .github
cp -R "${EXTRACT_DIR}/.github/." .github/
echo "Installed .github/copilot-instructions.md."
else
echo "Error: Failed to download .github/ config." >&2
return 1
fi
}
install_cursor() {
echo "Installing Cursor config for Android..."
download_archive
if [ -d "${EXTRACT_DIR}/.cursor" ]; then
mkdir -p .cursor
cp -R "${EXTRACT_DIR}/.cursor/." .cursor/
echo "Installed .cursor/rules/ with $(find .cursor -name '*.mdc' | wc -l | tr -d ' ') files."
else
echo "Error: Failed to download .cursor/ config." >&2
return 1
fi
}
install_agents() {
echo "Installing AGENTS.md..."
download_archive
if [ -f "${EXTRACT_DIR}/AGENTS.md" ]; then
cp "${EXTRACT_DIR}/AGENTS.md" AGENTS.md
echo "Installed AGENTS.md"
else
echo "Error: Failed to download AGENTS.md." >&2
return 1
fi
}
install_all() {
local failed=0
install_claude || failed=1
install_copilot || failed=1
install_cursor || failed=1
install_agents || failed=1
if [ "$failed" -eq 1 ]; then
return 1
fi
}
show_menu() {
echo ""
echo "DAT SDK AI Config Installer (Android)"
echo "======================================"
echo ""
echo "Which tool do you want to install config for?"
echo ""
echo " 1) Claude Code (.claude/)"
echo " 2) GitHub Copilot (.github/)"
echo " 3) Cursor (.cursor/)"
echo " 4) AGENTS.md (universal — Codex, Gemini CLI, Devin, Windsurf, etc.)"
echo " 5) All tools"
echo " 6) Cancel"
echo ""
read -rp "Enter choice [1-6]: " choice
case "$choice" in
1) install_claude ;;
2) install_copilot ;;
3) install_cursor ;;
4) install_agents ;;
5) install_all ;;
6) echo "Cancelled." ; exit 0 ;;
*) echo "Invalid choice." >&2 ; exit 1 ;;
esac
}
# Main
TOOL="${1:-}"
if [ -n "$TOOL" ]; then
case "$TOOL" in
claude) install_claude ;;
copilot) install_copilot ;;
cursor) install_cursor ;;
agents) install_agents ;;
all) install_all ;;
*) echo "Unknown tool: $TOOL. Use: claude, copilot, cursor, agents, or all." >&2 ; exit 1 ;;
esac
elif [ -t 0 ]; then
show_menu
else
# Piped via curl — default to all for backward compatibility
install_all
fi
echo ""
echo "Your AI assistant will auto-discover the config when you open this project."