0
0

start-claude.zsh 654 B

123456789101112131415161718192021222324252627
  1. #!/bin/zsh
  2. set -euo pipefail
  3. has_sandbox() {
  4. local dir="$1/agent"
  5. [[ -f "${dir}/Dockerfile" && -x "${dir}/start-claude-sandbox.sh" ]]
  6. }
  7. if git rev-parse --is-inside-work-tree &>/dev/null; then
  8. repo="$(git rev-parse --show-toplevel)"
  9. if has_sandbox "$repo"; then
  10. exec "${repo}/agent/start-claude-sandbox.sh" "$@"
  11. exit 0
  12. fi
  13. git_common="$(cd "$(git rev-parse --git-common-dir)" && pwd)"
  14. main_repo="$(dirname "$git_common")"
  15. if [[ "$main_repo" != "$repo" ]] && has_sandbox "$main_repo"; then
  16. exec "${main_repo}/agent/start-claude-sandbox.sh" "$@"
  17. exit 0
  18. fi
  19. fi
  20. exec claude "$@"
  21. exit 0