feat: add ccpr_comment MCP tool#62
Merged
Merged
Conversation
Expose ccpr comment over MCP as ccpr_comment, the first write-side tool served by ccpr-mcp. Extract the comment pipeline into internal/app so the CLI and MCP paths share input parsing, AWS resolution, PR-metadata fetching, and the PostComment call, preserving the existing comment --format json schema. Introduce app.SystemError so the use case can mark AWS-side failures and the CLI's exitCode router keeps exiting 2 on those, matching the pre-migration CLI behavior. Body-file and stdin (-) input forms remain CLI-only.
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.
Summary
ccpr comment --format jsonover MCP as a newccpr_commenttool, served by the existingccpr-mcpbinary alongsideccpr_listandccpr_review. This is the first write-side MCP tool: each successful call posts a real comment to CodeCommit, so the tool description and README explicitly call this out for the MCP host's per-call approval gate.internal/app/comment.goso the CLI and MCP paths share input validation, AWS profile/region resolution, PR-metadata fetching (for thebefore/aftercommits), and thePostCommentcall. The existingccpr comment --format jsonschema is preserved unchanged.app.SystemErrorso the shared use case can mark AWS-side failures and the CLI'sexitCoderouter keeps exiting2on those, preserving pre-migration CLI behavior.--body-fileand stdin (-) input forms remain CLI-only.docs/use-cases.md(UC-13),docs/requirements.md(FR-18),docs/spec.md,docs/json-schema.md, and the READMEs. The "no write-side MCP tools" constraint is removed;create/open/doctorremain out of scope.Type of change
fix:)feat:)docs:)refactor:/chore:)test:)(Primary type:
feat:. Refactor extracts the comment pipeline; docs and tests are part of the same change.)Test plan
make build/make build-mcp/make test/make vet/make lintall passgo test ./internal/app/...coversPostCommenthappy path, validation errors, region precedence, andSystemErrorwrapping for AWS failurescmd/ccpr/testdata/continue to pass (no JSON output regression)initialize+tools/listreturns all three tools (ccpr_list,ccpr_review,ccpr_comment) withoutputSchema.type == "object"Spec-driven checklist
docs/use-cases.md,docs/requirements.md,docs/spec.mdupdated before codedocs/versioning.md); the CLIccpr comment --format jsonpayload is unchanged. The MCP tool returns the same object directly (no wrapper needed because it is already an object).Related issues
Closes #60.