feat(mcp): gittensory_lint_pr_text (commit/PR-body rubric linter) - #634
Conversation
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. |
ghost
left a comment
There was a problem hiding this comment.
Gittensory review · advisory — a maintainer merges
0 actionable · 5 nitpick(s) · 7 file(s) · two independent AI reviewers
Suggested action: ✅ Safe to merge — both reviewers found no blocking issues.
📋 Walkthrough
The change introduces a PR‑text linting tool that evaluates commit messages, PR bodies, and issue linkage, exposing a new /v1/lint/pr-text endpoint and MCP tool, with full schema validation and tests ensuring public‑safe output.
Changes
| File | Summary |
|---|---|
packages/gittensory-mcp/bin/gittensory-mcp.js |
Adds input schema for the new lint tool and registers the tool with description. |
src/api/routes.ts |
Defines request schema, adds POST /v1/lint/pr-text route, and returns lint report. |
src/mcp/server.ts |
Adds lint tool registration with input and output schemas, and implements tool handler. |
src/signals/engine.ts |
Implements deterministic PR‑text linting logic, defines types, and exports buildPrTextLint. |
test/integration/api.test.ts |
Tests the new lint endpoint for success and validation errors, and checks for forbidden terms. |
test/unit/mcp-output-schemas.test.ts |
Adds lint tool to the list of tools with output schemas and tests its schema compliance. |
test/unit/pr-text-lint.test.ts |
Adds extensive unit tests for the linting function covering various scenarios and public safety. |
🔍 Reviewer notes
Reviewer A · gpt-oss-120b — recommends ✅ merge
This PR adds a new MCP tool gittensory_lint_pr_text with API route, schema, server registration, implementation, and comprehensive tests. The implementation respects public‑safe sanitisation and integrates cleanly with existing tooling.
Suggestions
- Consider consolidating the duplicate
lintPrTextShapedefinition (present in both the CLI bin and server) into a shared module to avoid future drift. - Add a comment documenting the deterministic scoring weights (
PR_TEXT_LINT_WEIGHTS) for future maintainers. - Run the full test suite locally to confirm no other modules rely on a previous signature of
hasClearNoIssueRationale(though TypeScript should accept the narrowed type).
Worth double-checking
- Potential mismatch if future changes modify
lintPrTextShapein one location but not the other. - Ensure
sanitizePublicCommentis imported inengine.ts; missing import would cause a compile error.
Reviewer B · mistral-small-3.1-24b-instruct — recommends ✅ merge
This PR adds a new MCP tool for linting PR text, including commit messages and PR bodies. The changes are well-structured, with thorough testing and clear documentation. The implementation respects the project's privacy and safety model.
Suggestions
- Consider adding more detailed comments in the
buildPrTextLintfunction to explain the logic behind the scoring and verdicts. - Ensure that the
sanitizePublicCommentfunction is robust and covers all edge cases to prevent any forbidden terms from leaking into public output.
Worth double-checking
- Verify that the new tool does not introduce any performance bottlenecks, especially with large PR bodies or commit messages.
- Double-check that the
sanitizePublicCommentfunction is applied consistently across all public-facing outputs. - Ensure that the new tool handles edge cases, such as extremely long or empty inputs, gracefully.
🤖 Automated advisory review · a maintainer makes the final call.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
gittensory · advisory review Reviewed 7 changed file(s) — two independent AI reviewers. Suggested action: ✅ Safe to merge — both reviewers found no blocking issues. Reviewer A · Suggestions
Worth double-checking
Reviewer B · No blocking issues spotted. |
JSONbored
left a comment
There was a problem hiding this comment.
Solid, well-tested, privacy-clean, conflict-free. Two revisions before it ships as an anti-slop authority:
- It doesn't actually check Conventional Commit format (high). Despite the description,
buildPrTextLintonly checks length + token count + generic words — sofix(api): null checkis flagged weak while non-conventionalAdd stuff to endpoint here okpasses. Either add a real^(feat|fix|test|docs|refactor|build|ci|chore|revert)(\(scope\))?: …check (reuse CONTRIBUTING's type list) or drop the "Conventional-Commit" claim. - False positives on non-Latin text (medium).
tokenize()splits on[^a-z0-9]+, so a fully-written CJK/Cyrillic body yields 0 tokens → flagged "thin." Add a Unicode-aware fallback (\p{L}runs / non-whitespace length) before declaring a body thin.
Minor: score vs verdict can rank-disagree (traceability is a hard gate) — document it or omit score when traceability fails.
b1a8754 to
18c0b2e
Compare
1316b44 to
3f8950a
Compare
3f8950a to
e081815
Compare
Adds a deterministic MCP tool that lints a commit message + PR body against the gittensor traceability/no-issue-rationale rubric before submitting, returning a quality verdict (strong/adequate/weak) plus specific public-safe fixes. Catches generic/empty AI-slop text pre-submit. Metadata only; no source upload, no writes. - engine: buildPrTextLint scores three components (traceability, commit message, PR body) reusing the existing rubric helpers (hasClearNoIssueRationale, tokenize + STOPWORDS, hasValidationNote). Every reason/fix routed through sanitizePublicComment. - mcp(worker): register gittensory_lint_pr_text with input + output schema. - api: POST /v1/lint/pr-text backing the local bin tool. - mcp(local bin): proxy the tool to the API route. - tests: builder unit coverage (verdict + fix cases, public-safe assertions), MCP structured-content, and API route success/invalid. npm run validate green at 97%+. Fixes JSONbored#549 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
e081815 to
e6a1ba2
Compare
Fixes #549
What
Adds
gittensory_lint_pr_text, a deterministic MCP tool that lints a commit message + PR body against the gittensor traceability / no-issue-rationale rubric before submitting. It returns a quality verdict (strong/adequate/weak) plus specific, public-safe fixes — catching generic/empty AI-slop text pre-submit. Metadata only; no source upload, no GitHub writes.How
src/signals/engine.ts—buildPrTextLintscores three rubric components (traceability, commit message, PR body), reusing the existing rubric helpers:hasClearNoIssueRationale,tokenize+STOPWORDS, andhasValidationNote. Every reason/fix is routed throughsanitizePublicComment(public-safe, fail-closed).src/mcp/server.ts— registers the tool with aninputSchemaandoutputSchema.src/api/routes.ts—POST /v1/lint/pr-textbacking the local CLI tool.packages/gittensory-mcp/bin/gittensory-mcp.js— exposes the tool, proxying to the API route.Input:
{ commitMessages?, prBody?, linkedIssue? }. Output:{ verdict, score, components[], fixes[], summary }.Output boundaries
Public-safe verdict + fixes only; no source contents leave the process.
Tests
test/unit/pr-text-lint.test.ts— verdict cases (strong/adequate/weak), each rubric component's weak paths (generic/empty/short commit, empty/template/thin body, missing traceability), and forbidden-term assertions on all output.test/unit/mcp-output-schemas.test.ts— output-schema discovery + structured-content call.test/integration/api.test.ts— route success + invalid-body (400).npm run validate(typecheck + coverage) is green at the 97%+ branch threshold;build:mcp,test:mcp-pack,test:workers, andui:openapi:checkalso pass.🤖 Generated with Claude Code