-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·198 lines (168 loc) · 8.61 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·198 lines (168 loc) · 8.61 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#!/usr/bin/env bash
# Databricks Solution Builder — CLI installer
#
# One-liner:
# bash <(curl -sL https://raw.githubusercontent.com/databricks-solutions/solution-builder/main/install.sh)
#
# Installs the `databricks-solution-builder` and `databricks-architecture` skills
# into ~/.claude/skills/ (or ./.claude/skills/ with --project), then installs the
# Databricks Agent Skills (the per-resource build skills) via the Databricks CLI.
set -euo pipefail
# ─── Config ───────────────────────────────────────────────────────────────────
# Public location overridable for forks / private mirrors via env vars.
REPO_OWNER="${DSB_REPO_OWNER:-databricks-solutions}"
REPO_NAME="${DSB_REPO_NAME:-solution-builder}"
# Skills installed by this script (each is .claude/skills/<name> in the repo).
SKILLS=("databricks-solution-builder" "databricks-architecture")
BRANCH="${DSB_BRANCH:-main}"
DEST_MODE="${DSB_DEST:-user}" # "user" or "project"
# ─── Colors ───────────────────────────────────────────────────────────────────
if [ -t 1 ]; then
RED=$'\033[0;31m'
GREEN=$'\033[0;32m'
YELLOW=$'\033[1;33m'
BLUE=$'\033[0;34m'
CYAN=$'\033[0;36m'
BOLD=$'\033[1m'
NC=$'\033[0m'
else
RED=''; GREEN=''; YELLOW=''; BLUE=''; CYAN=''; BOLD=''; NC=''
fi
info() { printf '%s%s%s\n' "${CYAN}" "$*" "${NC}"; }
success() { printf '%s✓ %s%s\n' "${GREEN}" "$*" "${NC}"; }
warn() { printf '%s⚠ %s%s\n' "${YELLOW}" "$*" "${NC}"; }
err() { printf '%s✗ %s%s\n' "${RED}" "$*" "${NC}" >&2; }
# ─── Args ─────────────────────────────────────────────────────────────────────
while [ $# -gt 0 ]; do
case "$1" in
--project) DEST_MODE="project"; shift ;;
--user) DEST_MODE="user"; shift ;;
--branch) BRANCH="${2:-main}"; shift 2 ;;
-h|--help)
cat <<EOF
Databricks Solution Builder — CLI installer
Usage:
bash <(curl -sL .../install.sh) [flags]
Flags:
--project Install skill into ./.claude/skills (default: ~/.claude/skills)
--branch <name> Pull skill from this branch of ${REPO_NAME} (default: main)
-h, --help Show this help
Env equivalents: DSB_DEST=user|project, DSB_BRANCH=<name>
EOF
exit 0
;;
*) warn "Ignoring unknown argument: $1"; shift ;;
esac
done
# ─── Banner ───────────────────────────────────────────────────────────────────
cat <<EOF
${BLUE}╔═══════════════════════════════════════════════════════╗${NC}
${BLUE}║${NC} ${BLUE}║${NC}
${BLUE}║${NC} ${BOLD}Databricks Solution Builder — CLI installer${NC} ${BLUE}║${NC}
${BLUE}║${NC} ${BLUE}║${NC}
${BLUE}║${NC} Skills: ${GREEN}${#SKILLS[@]} skills${NC}$(printf '%*s' 33 '')${BLUE}║${NC}
${BLUE}║${NC} Branch: ${CYAN}${BRANCH}${NC}$(printf '%*s' $((40 - ${#BRANCH})) '')${BLUE}║${NC}
${BLUE}║${NC} ${BLUE}║${NC}
${BLUE}╚═══════════════════════════════════════════════════════╝${NC}
EOF
# ─── Preflight ────────────────────────────────────────────────────────────────
need_cmd() {
if ! command -v "$1" >/dev/null 2>&1; then
err "Required command not found: $1"
return 1
fi
}
need_cmd curl || exit 1
need_cmd tar || exit 1
if ! command -v claude >/dev/null 2>&1; then
warn "The 'claude' CLI was not detected on PATH. Install it from https://docs.claude.com/en/docs/claude-code to use the skill after install."
fi
# ─── Destination ──────────────────────────────────────────────────────────────
case "$DEST_MODE" in
user)
DEST_PARENT="$HOME/.claude/skills"
;;
project)
DEST_PARENT="$(pwd)/.claude/skills"
;;
*)
err "Unknown DSB_DEST: $DEST_MODE (expected 'user' or 'project')"
exit 1
;;
esac
info "Installing skills to: $DEST_PARENT"
mkdir -p "$DEST_PARENT"
# ─── Fetch repo tarball once ──────────────────────────────────────────────────
TMPDIR_INSTALL="$(mktemp -d -t dsb-install-XXXXXX)"
cleanup() { rm -rf "$TMPDIR_INSTALL"; }
trap cleanup EXIT
TARBALL_URL="${DSB_TARBALL_URL:-https://codeload.github.com/${REPO_OWNER}/${REPO_NAME}/tar.gz/refs/heads/${BRANCH}}"
TARBALL="$TMPDIR_INSTALL/repo.tar.gz"
info "Downloading ${REPO_NAME}@${BRANCH} …"
if ! curl -fsSL "$TARBALL_URL" -o "$TARBALL"; then
err "Failed to download tarball from $TARBALL_URL"
err "Check that the branch '$BRANCH' exists on ${REPO_OWNER}/${REPO_NAME}."
exit 1
fi
# tar emits ${REPO_NAME}-${BRANCH}/ as its top-level dir.
EXTRACT_DIR="$TMPDIR_INSTALL/extract"
mkdir -p "$EXTRACT_DIR"
# ─── Install each skill ───────────────────────────────────────────────────────
for SKILL_NAME in "${SKILLS[@]}"; do
SKILL_SUBPATH=".claude/skills/${SKILL_NAME}"
DEST="$DEST_PARENT/$SKILL_NAME"
info "Extracting ${SKILL_NAME} …"
if ! tar -xzf "$TARBALL" -C "$EXTRACT_DIR" \
"${REPO_NAME}-${BRANCH}/${SKILL_SUBPATH}" 2>/dev/null; then
err "Skill subpath not found in tarball: ${SKILL_SUBPATH}"
err "Repo layout may have changed on branch '${BRANCH}'."
exit 1
fi
SRC="$EXTRACT_DIR/${REPO_NAME}-${BRANCH}/${SKILL_SUBPATH}"
if [ ! -d "$SRC" ]; then
err "Extracted skill directory missing: $SRC"
exit 1
fi
# Idempotent install: remove existing, then copy.
if [ -d "$DEST" ]; then
warn "Removing existing skill at $DEST"
rm -rf "$DEST"
fi
cp -R "$SRC" "$DEST"
success "Installed ${SKILL_NAME} → $DEST"
done
# ─── Databricks Agent Skills ────────────────────────────────────────────────
# The per-resource build skills now ship in github.com/databricks/databricks-agent-skills
# and install via the Databricks CLI (`databricks aitools install`). --experimental
# includes the experimental skills we use (e.g. databricks-genie).
DAS_INSTALL_CMD="databricks aitools install --experimental"
echo
if command -v databricks >/dev/null 2>&1; then
info "Installing Databricks Agent Skills (databricks aitools install --experimental) …"
echo
if ! databricks aitools install --experimental; then
warn "Databricks Agent Skills install exited non-zero. The solution-builder skill is still installed."
warn "You can retry it later with:"
warn " ${DAS_INSTALL_CMD}"
else
success "Databricks Agent Skills installed"
fi
else
warn "Databricks CLI not found — skipping Databricks Agent Skills install."
warn "Install the CLI (https://docs.databricks.com/dev-tools/cli/install.html), then run:"
warn " ${DAS_INSTALL_CMD}"
fi
# ─── Post-install message ─────────────────────────────────────────────────────
echo
cat <<EOF
${GREEN}${BOLD}Done.${NC}
Skills: ${SKILLS[*]}
Location: ${DEST_PARENT}
Scope: $([ "$DEST_MODE" = "user" ] && echo 'user-global (~/.claude)' || echo 'current directory (./.claude)')
${BOLD}Next steps${NC}
1. cd into any project directory you want to work in
2. Run: ${CYAN}claude${NC}
3. Ask the agent to build a Databricks solution — the skill loads automatically
${BOLD}Update / reinstall${NC}
bash <(curl -sL https://raw.githubusercontent.com/${REPO_OWNER}/${REPO_NAME}/main/install.sh)
EOF