Skip to content

feat(mcp): gittensory_lint_pr_text (commit/PR-body rubric linter) - #634

Merged
JSONbored merged 2 commits into
JSONbored:mainfrom
oktofeesh1:feat/issue-549-lint-pr-text
Jun 14, 2026
Merged

feat(mcp): gittensory_lint_pr_text (commit/PR-body rubric linter)#634
JSONbored merged 2 commits into
JSONbored:mainfrom
oktofeesh1:feat/issue-549-lint-pr-text

Conversation

@oktofeesh1

Copy link
Copy Markdown
Contributor

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.tsbuildPrTextLint scores three rubric components (traceability, commit message, PR body), reusing the existing rubric helpers: hasClearNoIssueRationale, tokenize + STOPWORDS, and hasValidationNote. Every reason/fix is routed through sanitizePublicComment (public-safe, fail-closed).
  • src/mcp/server.ts — registers the tool with an inputSchema and outputSchema.
  • src/api/routes.tsPOST /v1/lint/pr-text backing 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, and ui:openapi:check also pass.

🤖 Generated with Claude Code

@ghost

ghost commented Jun 12, 2026

Copy link
Copy Markdown

Note

Gittensory Gate skipped

PR closed before full evaluation. No late first comment was created.

Signal Result Evidence Action
Gate result ⚠️ Skipped #634 is no longer open. No action.

💰 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 ghost added the gittensory:reviewed label Jun 12, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 lintPrTextShape definition (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 lintPrTextShape in one location but not the other.
  • Ensure sanitizePublicComment is imported in engine.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 buildPrTextLint function to explain the logic behind the scoring and verdicts.
  • Ensure that the sanitizePublicComment function 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 sanitizePublicComment function 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.

@ghost ghost added the gittensory-review label Jun 12, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@ghost

ghost commented Jun 13, 2026

Copy link
Copy Markdown

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 · gpt-oss-120b — recommends ✅ merge
This PR introduces a deterministic PR‑text linting tool, adds API endpoint, schema, CLI registration, and comprehensive unit/integration tests. The implementation respects the public‑private sanitization boundary and integrates cleanly with existing MCP tooling.

Suggestions

  • Document the new PrTextLint* types in the public API docs for developers.
  • Consider defining a more specific Zod schema for components in the output rather than z.unknown() for stronger validation.
  • Verify that the replacement of hasClearNoIssueRationale does not leave a duplicate or stray function definition; keep a single implementation.

Worth double-checking

  • Ensure sanitizePublicComment is applied to all user‑visible strings to avoid accidental forbidden term leakage.
  • Confirm that the new endpoint respects the same authentication/authorization checks as other MCP tools.

Reviewer B · nemotron-3-120b-a12b — recommends ✅ merge
The PR adds a new MCP tool 'gittensory_lint_pr_text' that lints commit messages and PR bodies against a deterministic rubric (traceability, conventional commits, body substance). It includes types, helper functions, MCP/server integration, API route, and comprehensive unit/integration tests. Output is sanitized via sanitizePublicComment to prevent leaking forbidden terms. The change is well-tested, follows project conventions, and maintains the public/private boundary.

No blocking issues spotted.

@ghost ghost mentioned this pull request Jun 13, 2026

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid, well-tested, privacy-clean, conflict-free. Two revisions before it ships as an anti-slop authority:

  1. It doesn't actually check Conventional Commit format (high). Despite the description, buildPrTextLint only checks length + token count + generic words — so fix(api): null check is flagged weak while non-conventional Add stuff to endpoint here ok passes. 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.
  2. 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.

@JSONbored JSONbored added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jun 13, 2026
@oktofeesh1
oktofeesh1 force-pushed the feat/issue-549-lint-pr-text branch 2 times, most recently from b1a8754 to 18c0b2e Compare June 13, 2026 10:20
@oktofeesh1
oktofeesh1 force-pushed the feat/issue-549-lint-pr-text branch from 1316b44 to 3f8950a Compare June 14, 2026 12:47
@oktofeesh1
oktofeesh1 force-pushed the feat/issue-549-lint-pr-text branch from 3f8950a to e081815 Compare June 14, 2026 14:36
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>
@dosubot dosubot Bot added the lgtm label Jun 14, 2026
@JSONbored
JSONbored merged commit 408dc5a into JSONbored:main Jun 14, 2026
8 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 14, 2026
@github-actions github-actions Bot mentioned this pull request Jun 14, 2026
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

feat(mcp): gittensory_lint_pr_text (commit/PR-body rubric linter)

2 participants