Skip to content

Commit 283b965

Browse files
authored
release.sh: recognize anchored links in the bundle link check (#91)
The OpenAI bundle builder resolves every relative path a skill references to confirm it is in the archive, but the extraction regex required the path to be immediately followed by ')'. A markdown link carrying a #section anchor — ](references/foo.md#heading) — never matched, so a bundled file referenced only through an anchored link could be dropped from the archive without the check noticing. The regex now allows an optional #anchor and the sed strips it before resolving, so the target is checked. foundry already has such an anchored link in a skill (pagination-patterns.md#the-0-gotcha).
1 parent 4a8921d commit 283b965

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ build_bundle() {
158158
local missing
159159
missing=$(cd "$work" && find skills -name '*.md' | while read -r f; do
160160
d=$(dirname "$f")
161-
grep -ohE '\]\((\.\./)*[A-Za-z0-9_./-]+\.(md|py|sh|json|ya?ml)\)' "$f" 2>/dev/null \
162-
| sed 's/^](//; s/)$//' | while read -r link; do
161+
grep -ohE '\]\((\.\./)*[A-Za-z0-9_./-]+\.(md|py|sh|json|ya?ml)(#[^)]*)?\)' "$f" 2>/dev/null \
162+
| sed 's/^](//; s/)$//; s/#.*$//' | while read -r link; do
163163
target=$(python3 -c 'import os,sys; print(os.path.normpath(os.path.join(sys.argv[1], sys.argv[2])))' "$d" "$link")
164164
[[ -e "$target" ]] || printf '%s -> %s\n' "$f" "$link"
165165
done

0 commit comments

Comments
 (0)