From 54578415cd6798025387fe3695cfe4a3a5c059ed Mon Sep 17 00:00:00 2001 From: 0xJayHK Date: Sun, 7 Jun 2026 13:26:25 +0800 Subject: [PATCH] fix(trae): strip trailing slash so skill manifest entries are single-slash (#2126) The Trae installer recorded nested skill files with a doubled slash (e.g. `skills/skill-comply//pyproject.toml`). The skills loop used the glob variable `$d`, which carries a trailing slash, both as the `find` root and as the prefix removed from each file path. Under bash, BSD `find` with a trailing-slash argument emits `.../skill-comply//file`, so `${source_file#$d}` left a leading slash, producing double-slash manifest entries that did not match the single-slash paths uninstall.sh expects. Strip the trailing slash from `$d` and remove the `$d/` prefix so `find` emits clean paths and manifest entries are single-slash. Fixes the previously failing test in tests/scripts/trae-install.test.js ("records nested skill files and the full rules tree in the manifest"). Co-authored-by: affaan-m Co-authored-by: Claude Opus 4.8 (1M context) --- .trae/install.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.trae/install.sh b/.trae/install.sh index 959579e7..a4bcfc6c 100755 --- a/.trae/install.sh +++ b/.trae/install.sh @@ -151,12 +151,16 @@ do_install() { if [ -d "$REPO_ROOT/skills" ]; then for d in "$REPO_ROOT/skills"/*/; do [ -d "$d" ] || continue + # Strip trailing slash so find emits single-slash paths and the + # prefix removal below does not leave a leading slash (which would + # produce double-slash manifest entries like skills/foo//bar). + d="${d%/}" skill_name="$(basename "$d")" target_skill_dir="$trae_full_path/skills/$skill_name" skill_copied=0 while IFS= read -r source_file; do - relative_path="${source_file#$d}" + relative_path="${source_file#$d/}" target_path="$target_skill_dir/$relative_path" mkdir -p "$(dirname "$target_path")"