Skip to content

scripts/delete-merged-branches.sh: add existence/executable guard before exec #978

@coderabbitai

Description

@coderabbitai

Summary

The compatibility wrapper at scripts/delete-merged-branches.sh directly execs a user-local path without first checking whether the target script exists and is executable. On fresh dev or CI environments where the global Cursor Skill has not been installed, this causes a hard, non-descriptive shell failure.

Proposed improvement

Before calling exec, resolve the target path and verify it is executable. If not, print a clear error message to stderr and exit cleanly so the failure is easy to diagnose.

#!/usr/bin/env bash
# 後方互換ラッパー。実体はグローバル Skill に移行済み。
TARGET="${DELETE_MERGED_BRANCHES_SCRIPT:-$HOME/.cursor/skills/delete-merged-branches/scripts/delete-merged-branches.sh}"
if [[ ! -x "$TARGET" ]]; then
  echo "delete-merged-branches: target script not found or not executable: $TARGET" >&2
  echo "Set DELETE_MERGED_BRANCHES_SCRIPT to a valid path." >&2
  exit 1
fi
exec "$TARGET" "$@"

Context

/cc @otomatty

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions