27 lines
977 B
Bash
Executable File
27 lines
977 B
Bash
Executable File
#!/bin/bash
|
|
# This runs every time a container starts. Keep it generic — anything specific
|
|
# to a project (language versions, installing dependencies, and so on) belongs
|
|
# in that project's .safeclaude/hooks/, not here.
|
|
set -e
|
|
|
|
# Install Claude if it isn't already here. The home folder is saved between
|
|
# runs, so this only actually downloads the first time.
|
|
if ! command -v claude &>/dev/null; then
|
|
echo "[safeclaude] Claude Code not found — installing..."
|
|
curl -fsSL https://claude.ai/install.sh | bash
|
|
fi
|
|
|
|
# Run the project's setup scripts, in name order. They're read straight from the
|
|
# project folder, so editing one takes effect next launch — no rebuild needed.
|
|
# If a script fails we stop here, rather than start in a half-set-up container.
|
|
HOOK_DIR="/code/.safeclaude/hooks"
|
|
if [ -d "$HOOK_DIR" ]; then
|
|
for hook in "$HOOK_DIR"/*.sh; do
|
|
[ -e "$hook" ] || continue
|
|
echo "[safeclaude] hook: $(basename "$hook")"
|
|
bash "$hook"
|
|
done
|
|
fi
|
|
|
|
exec "$@"
|