diff --git a/README.md b/README.md index 7b546fa..9f168ec 100644 --- a/README.md +++ b/README.md @@ -344,11 +344,6 @@ Config precedence is: | Directory | Link | |---|---| -| **Official MCP Registry** | [`io.github.commit-check/commit-check-mcp`](https://registry.modelcontextprotocol.io/) | +| **Official MCP Registry** | [`io.github.commit-check/commit-check-mcp`](https://registry.modelcontextprotocol.io/?q=commit-check-mcp) | | **Glama.ai** | [`github/commit-check/commit-check-mcp`](https://glama.ai/mcp/servers/github/commit-check/commit-check-mcp) | | **PyPI** | [`commit-check-mcp`](https://pypi.org/project/commit-check-mcp/) | - -To also add this server to your preferred directory, open a pull request at: - -- [punkpeye/awesome-mcp-servers](https://github.com/punkpeye/awesome-mcp-servers) — community-maintained list -- [Smithery.ai](https://smithery.ai/) — hosted MCP server registry diff --git a/tests/test_server.py b/tests/test_server.py index 6fb9b14..6f07456 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -148,6 +148,42 @@ def test_failing_message_due_to_subject_case(self) -> None: ) assert result["status"] == "fail" + def test_message_pattern_overrides_conventional_commits(self) -> None: + """When message_pattern is set via config, it takes precedence.""" + result = server._validate_message( + "PROJ-123: add new feature", + config={ + "commit": { + "message_pattern": r"^PROJ-\d+: .+", + "conventional_commits": False, + "allow_merge_commits": True, + "allow_revert_commits": True, + "allow_empty_commits": True, + "allow_fixup_commits": True, + "allow_wip_commits": True, + } + }, + ) + assert result["status"] == "pass" + + def test_message_pattern_fails_on_mismatch(self) -> None: + """A message that doesn't match message_pattern should fail.""" + result = server._validate_message( + "fix: some random change", + config={ + "commit": { + "message_pattern": r"^PROJ-\d+: .+", + "conventional_commits": False, + "allow_merge_commits": True, + "allow_revert_commits": True, + "allow_empty_commits": True, + "allow_fixup_commits": True, + "allow_wip_commits": True, + } + }, + ) + assert result["status"] == "fail" + # --------------------------------------------------------------------------- # _validate_branch (real engine call)