Implement agentic link following for contributing guidelines#60
Merged
Implement agentic link following for contributing guidelines#60
Conversation
- Add recursive markdown link parsing and following - Support relative and absolute GitHub URLs with depth limiting (max 3 levels) - Implement URL resolution to raw.githubusercontent.com for direct content fetching - Extend caching system with composite keys for aggregated content - Update AI prompt to handle content from multiple linked documents - Add comprehensive test coverage for link extraction and URL resolution - Maintain backward compatibility with existing function signature - Add graceful error handling and detailed logging for debugging The enhanced loadContributingGuidelines function now: - Parses markdown links using regex /\[([^\]]+)\]\(([^)]+)\)/g - Follows GitHub links within the same repository - Aggregates content from linked documents with clear separation - Prevents infinite loops with depth limiting and visited URL tracking - Caches aggregated results for performance optimization Tested with real data from jacquez repository CONTRIBUTING.md -> README.md link following. Co-Authored-By: Sahil Lavingia <sahil@gumroad.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Implement agentic link following for contributing guidelines
Summary
Enhanced the
loadContributingGuidelinesfunction to parse markdown links in CONTRIBUTING.md files and recursively fetch referenced documents to provide comprehensive context for AI analysis. The bot can now follow links like[README](README.md)to aggregate content from multiple related documents.Key Features:
/\[([^\]]+)\]\(([^)]+)\)/graw.githubusercontent.comFiles Modified:
app/api/webhook/route.ts: EnhancedloadContributingGuidelineswith 4 new helper functionstests/webhook.test.ts: Added comprehensive test suite for link following functionalityReview & Testing Checklist for Human
/blob/,/tree/, external links) to ensure proper handlingRecommended End-to-End Test Plan:
Diagram
%%{ init : { "theme" : "default" }}%% flowchart TD PR["GitHub PR Event"] --> Webhook["app/api/webhook/route.ts"] Webhook --> LoadGuidelines["loadContributingGuidelines()"] LoadGuidelines --> ExtractLinks["extractMarkdownLinks()"] ExtractLinks --> ResolveURL["resolveGitHubUrl()"] ResolveURL --> FetchContent["fetchUrlContent()"] FetchContent --> ProcessLinked["processLinkedContent()"] ProcessLinked --> Cache["Enhanced Caching"] Cache --> AIPrompt["Updated AI System Prompt"] AIPrompt --> Response["Bot Response"] Tests["tests/webhook.test.ts"] --> LoadGuidelines LoadGuidelines:::major-edit ExtractLinks:::major-edit ResolveURL:::major-edit FetchContent:::major-edit ProcessLinked:::major-edit Tests:::major-edit AIPrompt:::minor-edit Cache:::minor-edit Webhook:::context PR:::context Response:::context subgraph Legend L1["Major Edit"]:::major-edit L2["Minor Edit"]:::minor-edit L3["Context/No Edit"]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes
loadContributingGuidelinescallsLink to Devin session: https://app.devin.ai/sessions/ec0555de1c364310b2477f92be708c3f
Requested by: Sahil Lavingia (@slavingia)