Files
2026-04-24 02:20:06 -05:00

42 lines
935 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
SOURCE_DIR="${ROOT_DIR}/codex/scripts"
TARGETS=(
"claude-code"
"cursor"
"opencode"
"pi"
)
replace_dir() {
local source=$1
local target=$2
if [[ -z "$target" || "$target" == "/" || "$target" == "." || "$target" == ".." ]]; then
echo "Refusing to sync into unsafe target: $target" >&2
exit 1
fi
case "$target" in
"${ROOT_DIR}"/*) ;;
*)
echo "Refusing to remove target outside root: $target" >&2
exit 1
;;
esac
rm -rf "$target"
mkdir -p "$target"
cp -R "${source}/." "$target/"
}
if [[ ! -d "$SOURCE_DIR" ]]; then
echo "Missing canonical source directory: $SOURCE_DIR" >&2
exit 1
fi
for variant in "${TARGETS[@]}"; do
replace_dir "$SOURCE_DIR" "${ROOT_DIR}/${variant}/scripts"
done
echo "Synced web-automation scripts from codex into ${#TARGETS[@]} variant directories."