fix(build): rewrite rule-relative links when inlining rules into AGENTS.md - #312
Open
sgaabdu4 wants to merge 2 commits into
Open
fix(build): rewrite rule-relative links when inlining rules into AGENTS.md#312sgaabdu4 wants to merge 2 commits into
sgaabdu4 wants to merge 2 commits into
Conversation
…TS.md Rule bodies in rules/ cross-reference sibling rules with same-directory links like ./async-defer-await.md. The build inlines those bodies into the skill-root AGENTS.md without rewriting the links, so they 404 from the output location (react-best-practices AGENTS.md currently has three such broken links). Rewrite same-directory .md links to the rules directory, computed relative to the output file, during the build. Regenerated output for all skills; only the three previously-broken links changed.
|
@sgaabdu4 is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
This PR fixes broken intra-rule markdown links that occur when rule bodies from skills/*/rules/ are inlined into a skill’s root AGENTS.md, by rewriting same-directory ./<rule>.md links to be valid from the output file’s location.
Changes:
- Add a post-generation rewrite pass in
packages/react-best-practices-build/src/build.tsto adjust](./<file>.md[#anchor])links to point into the configuredrulesDir. - Regenerate
skills/react-best-practices/AGENTS.mdso the previously broken rule cross-references now use./rules/<file>.md.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| skills/react-best-practices/AGENTS.md | Updates three inlined rule cross-links to point to ./rules/*.md so they resolve from the skill root. |
| packages/react-best-practices-build/src/build.ts | Implements link rewriting during build output generation to keep inlined rule-relative links valid. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…on parent-relative paths
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Rule files in
rules/cross-reference sibling rules with same-directory links, e.g. inasync-cheap-condition-before-await.md:build.tsinlines rule bodies into the skill-rootAGENTS.mdwithout rewriting these links, so they break from the output file's location.skills/react-best-practices/AGENTS.mdcurrently contains three such broken links (./async-defer-await.md,./async-cheap-condition-before-await.md,./server-hoist-static-io.md) — consumers vendoring the skill see 404 links.Fix
A post-generation pass in
build.tsrewrites same-directory.mdlinks to the rules directory, computed viarelative(dirname(outputFile), rulesDir)so it holds for any skill config. Links that already contain a path segment (e.g../rules/x.md) and external links are untouched; anchors are preserved.Verification
Ran
tsx src/build.ts --all: the only content change across all three skills' regeneratedAGENTS.mdis the three previously-broken links now resolving (./rules/<file>.md). A link-resolution check over the regenerated files reports zero broken relative links.