Require Better Subject
court.require_better_subjectAnalyze commit subjects against code changes to enforce clarity and suggest improvements using conventional commit standards.
Instructions
Force a better commit subject and provide rewrite suggestions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| subject | Yes | Commit subject line to put on trial. | |
| body | No | Optional commit body. | |
| diff | Yes | Unified diff or patch text. | |
| pr_body | No | Optional PR description. | |
| style | No | Courtroom voice preset. | |
| language | No | Rendered verdict language. |
Implementation Reference
- src/court/shared.ts:8-17 (handler)The logic for the require_better_subject tool, which uses `evaluateCourtCase` to determine if a commit subject needs improvement and ensures the required actions include a subject-specific recommendation.
export function requireBetterSubject(input: CourtInput): CourtVerdict { const verdict = evaluateCourtCase({ ...input, style: input.style ?? "judge" }); return { ...verdict, required_actions: verdict.required_actions.includes("Replace the subject with a concrete action and scope.") ? verdict.required_actions : ["Replace the subject with a concrete action and scope.", ...verdict.required_actions], rewritten_subject: verdict.rewritten_subject ?? evaluateCourtCase({ ...input, style: "judge" }).rewritten_subject }; } - src/server.ts:40-50 (registration)The registration of the `court.require_better_subject` tool in the MCP server.
server.registerTool( "court.require_better_subject", { title: "Require Better Subject", description: "Force a better commit subject and provide rewrite suggestions.", inputSchema: toolInputShape, outputSchema: z.record(z.unknown()) }, async (args) => { const verdict = requireBetterSubject(courtInputSchema.parse(args)); return asToolResult(verdict, verdict.verdict !== "approved");