feat: bounded responses for get_pull_request_diff + get_file_content (closes #124) #131
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/OpenSpec
Kind/Security
Kind/Testing
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
RFC - Request For Comments
Reviewed/Confirmed
Reviewed/Duplicate
Reviewed/Invalid
Reviewed/Won't Fix
Status/Abandoned
Status/Blocked
Status/Need More Info
hermes-attempted
hermes-needs-clarification
hermes-ready
hermes-review
hermes-wip
human-required
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
agentic-forges/forgejo-mcp!131
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/131/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements the
add-bounded-text-responsesOpenSpec change (proposal → design → spec deltas → tasks → impl).Two MCP tools previously returned arbitrarily large text payloads with no caller-side bound. Both now honor the architectural rule in
docs/design/output-bounding.md:get_pull_request_diffgains optionalfile_path. When set, returns only that file's hunks (matched on thediff --gitboundary, accepts pre- or post-rename path). Missing path is a tool error — no silent fallback.get_file_contentgains optionalstart_line+end_line(1-indexed inclusive). Omit-defaults, clamping, inverted-range error,with_metadata=truebypass — all documented in the spec.Closes #124.
Implementation
pkg/diff/—FileSlice(rawDiff, filePath) (string, bool). Splits the diff ondiff --gitboundaries; matches eithera/<path>orb/<path>so renames Just Work.operation/pull/pull.go—GetPullRequestDiffFnadds thefile_pathbranch.operation/repo/file.go—GetFileContentFngains asliceLines(content, start, end)helper. Plain-text path only;with_metadata=truereturns the fullContentsResponseunchanged.Tests
pkg/diffoperation/pullfile_patherrorsoperation/repowith_metadatabypassgo test ./...+make buildboth green locally.Docs
README tool table updated:
get_pull_request_diff,list_pull_request_files,merge_pull_request,create_pull_reviewget_file_contentrow mentions the newstart_line/end_lineTest plan
go test ./...passesmake buildpassesopenspec validate add-bounded-text-responses --strictpassesget_pull_request_diffwithoutfile_pathreturns full diff; withfile_pathreturns one file's hunksget_file_contentwithstart_line=10,end_line=20returns 11 linesCloses #124.
op1st Pipelines as Code/on-pull-request-4p5pk is running.
Starting Pipelinerun on-pull-request-4p5pk in namespace op1st-pipelines
You can monitor the execution using the op1st Pipelines as Code PipelineRun viewer or through the command line by
using the tkn CLI with the following command:
tkn pr logs -n op1st-pipelines on-pull-request-4p5pk -fop1st Pipelines as Code/openspec-validate-pr-t5khd is running.
Starting Pipelinerun openspec-validate-pr-t5khd in namespace op1st-pipelines
You can monitor the execution using the op1st Pipelines as Code PipelineRun viewer or through the command line by
using the tkn CLI with the following command:
tkn pr logs -n op1st-pipelines openspec-validate-pr-t5khd -fop1st Pipelines as Code/openspec-validate-pr-t5khd has successfully validated your commit.
Task Statuses:
fetch-source
validate
op1st Pipelines as Code/on-pull-request-4p5pk has successfully validated your commit.
Task Statuses:
fetch-source
build-and-test
op1st Pipelines as Code/openspec-validate-pr-rr2jd is running.
Starting Pipelinerun openspec-validate-pr-rr2jd in namespace op1st-pipelines
You can monitor the execution using the op1st Pipelines as Code PipelineRun viewer or through the command line by
using the tkn CLI with the following command:
tkn pr logs -n op1st-pipelines openspec-validate-pr-rr2jd -fop1st Pipelines as Code/on-pull-request-8p772 is running.
Starting Pipelinerun on-pull-request-8p772 in namespace op1st-pipelines
You can monitor the execution using the op1st Pipelines as Code PipelineRun viewer or through the command line by
using the tkn CLI with the following command:
tkn pr logs -n op1st-pipelines on-pull-request-8p772 -fop1st Pipelines as Code/openspec-validate-pr-rr2jd has successfully validated your commit.
Task Statuses:
fetch-source
validate
op1st Pipelines as Code/on-pull-request-8p772 has successfully validated your commit.
Task Statuses:
fetch-source
build-and-test
Sorry, I was traveling abroad last week with limited connectivity and time and thus didn't get around to looking at this yet. Thank you for the prompt implementation!
@fiesh no worries — travel beats CI any day. landed in main last week. when you get a moment, give it a spin and let me know if
file_pathonget_pull_request_diffandstart_line/end_lineonget_file_contentactually solve what you ran into in #124. happy to iterate if something feels off.