Skip to content

Commit ab17fcb

Browse files
committed
Tighten symlink removal in pack-skills.mjs
In the pre branch, replace rmSync({ recursive: true }) with unlinkSync when removing a confirmed symlink. rmSync with recursive is the right call for directories but misleading for a symlink; unlinkSync is the correct and explicit API. In the post branch, add force: true to rmSync so that a missing skillsPath (e.g. after a manual recovery or half-interrupted prepack) does not throw ENOENT and leave the sentinel file stranded. fedify-dev#756 (comment) fedify-dev#756 (comment) Assisted-by: Claude Code:claude-sonnet-4-6
1 parent 94676cf commit ab17fcb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎packages/fedify/scripts/pack-skills.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if (cmd === "pre") {
2525
const stat = lstatSync(skillsPath);
2626
if (stat.isSymbolicLink()) {
2727
const target = realpathSync(skillsPath);
28-
rmSync(skillsPath, { recursive: true });
28+
unlinkSync(skillsPath);
2929
cpSync(target, skillsPath, { recursive: true });
3030
writeFileSync(sentinel, "");
3131
} else if (!stat.isDirectory()) {
@@ -38,7 +38,7 @@ if (cmd === "pre") {
3838
}
3939
} else if (cmd === "post") {
4040
if (existsSync(sentinel)) {
41-
rmSync(skillsPath, { recursive: true });
41+
rmSync(skillsPath, { recursive: true, force: true });
4242
symlinkSync("../../../claude-plugin/skills/fedify", skillsPath, "dir");
4343
unlinkSync(sentinel);
4444
}

0 commit comments

Comments
 (0)