Skip to content

fix: use git root for correct source links in monorepo layouts#35

Merged
zzstoatzz merged 1 commit intozzstoatzz:mainfrom
desertaxle:fix/monorepo-source-links
Feb 17, 2026
Merged

fix: use git root for correct source links in monorepo layouts#35
zzstoatzz merged 1 commit intozzstoatzz:mainfrom
desertaxle:fix/monorepo-source-links

Conversation

@desertaxle
Copy link
Copy Markdown
Contributor

@desertaxle desertaxle commented Feb 16, 2026

Summary

This is to fix incorrect GitHub URLs for nested packages which I encountered in PrefectHQ/prefect#20679.

  • Uses git rev-parse --show-toplevel to compute correct relative paths for GitHub source links, fixing incorrect paths in monorepo layouts (e.g., PrefectHQ/prefect where prefect-aws is nested under src/integrations/)
  • Adds --source-prefix CLI flag as a manual override for edge cases (non-git environments)
  • Falls back to the existing pattern-matching heuristic when neither option is available

Test plan

  • Existing tests updated and passing
  • New tests for git root detection, monorepo paths, source prefix, priority, and fallback
  • Full test suite passes (83 passed)
  • Manual test against PrefectHQ/prefect monorepo with prefect-aws

🤖 Generated with Claude Code

In monorepos the package can be nested deeper than the pattern-matching
heuristic expects, producing incorrect GitHub source links. Use
`git rev-parse --show-toplevel` to compute the actual relative path and
add `--source-prefix` as a manual override for edge cases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@desertaxle desertaxle marked this pull request as ready for review February 16, 2026 04:22
@zzstoatzz zzstoatzz merged commit 50f97d5 into zzstoatzz:main Feb 17, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants