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 <tamiraw808@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
0xJayHK
2026-06-07 13:26:25 +08:00
committed by GitHub
parent e4dfc1679b
commit 54578415cd
+5 -1
View File
@@ -151,12 +151,16 @@ do_install() {
if [ -d "$REPO_ROOT/skills" ]; then if [ -d "$REPO_ROOT/skills" ]; then
for d in "$REPO_ROOT/skills"/*/; do for d in "$REPO_ROOT/skills"/*/; do
[ -d "$d" ] || continue [ -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")" skill_name="$(basename "$d")"
target_skill_dir="$trae_full_path/skills/$skill_name" target_skill_dir="$trae_full_path/skills/$skill_name"
skill_copied=0 skill_copied=0
while IFS= read -r source_file; do while IFS= read -r source_file; do
relative_path="${source_file#$d}" relative_path="${source_file#$d/}"
target_path="$target_skill_dir/$relative_path" target_path="$target_skill_dir/$relative_path"
mkdir -p "$(dirname "$target_path")" mkdir -p "$(dirname "$target_path")"