| 123456789101112131415161718192021222324252627 |
- #!/bin/zsh
- set -euo pipefail
- has_sandbox() {
- local dir="$1/agent"
- [[ -f "${dir}/Dockerfile" && -x "${dir}/start-claude-sandbox.sh" ]]
- }
- if git rev-parse --is-inside-work-tree &>/dev/null; then
- repo="$(git rev-parse --show-toplevel)"
- if has_sandbox "$repo"; then
- exec "${repo}/agent/start-claude-sandbox.sh" "$@"
- exit 0
- fi
- git_common="$(cd "$(git rev-parse --git-common-dir)" && pwd)"
- main_repo="$(dirname "$git_common")"
- if [[ "$main_repo" != "$repo" ]] && has_sandbox "$main_repo"; then
- exec "${main_repo}/agent/start-claude-sandbox.sh" "$@"
- exit 0
- fi
- fi
- exec claude "$@"
- exit 0
|