commit-check 2.20.2__py3-none-any.whl → 2.20.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
commit_check/__init__.py CHANGED
@@ -49,6 +49,8 @@ RED = "\033[91m" if _colored else ""
49
49
  GREEN = "\033[92m" if _colored else ""
50
50
  YELLOW = "\033[93m" if _colored else ""
51
51
  RESET_COLOR = "\033[0m" if _colored else ""
52
+ BOLD = "\033[1m" if _colored else ""
53
+ DIM = "\033[2m" if _colored else ""
52
54
 
53
55
  # Follow conventional commits
54
56
  DEFAULT_COMMIT_TYPES = [
commit_check/engine.py CHANGED
@@ -247,7 +247,7 @@ class BaseValidator(ABC):
247
247
  # Populated by _print_failure() on every failure, regardless of mode.
248
248
  self._last_failure: dict[str, str] | None = None
249
249
  # The failure blocks as the printer takes them, (rule dict, value),
250
- # kept so the engine can print them after the banner.
250
+ # kept so the engine can print them after the header.
251
251
  self._failure_blocks: list[tuple[dict, str]] = []
252
252
  # Populated by subclasses on every validation (pass or fail) with the
253
253
  # concrete value that was checked (subject, branch, author, ...), so
@@ -278,7 +278,7 @@ class BaseValidator(ABC):
278
278
  is unrelated — the relevant identity is the one git would record:
279
279
  ``GIT_AUTHOR_NAME`` when set (how a tool commits under its own name,
280
280
  and how the Action passes on the author of a commit it pipes in),
281
- else ``user.name``.
281
+ else ``author.name``, else ``user.name``.
282
282
 
283
283
  *Existing commit* (no ``stdin_text``, no ``commit_file``):
284
284
  the last commit is the one being validated. Use its own author
@@ -292,6 +292,7 @@ class BaseValidator(ABC):
292
292
  if context.stdin_text is not None or context.commit_file is not None:
293
293
  return (
294
294
  os.environ.get("GIT_AUTHOR_NAME", "").strip()
295
+ or get_git_config_value("author.name")
295
296
  or get_git_config_value(_USER_NAME)
296
297
  or get_commit_info("an")
297
298
  )
@@ -703,8 +704,8 @@ class AuthorValidator(BaseValidator):
703
704
  def _get_author_value(self, context: ValidationContext) -> str:
704
705
  """Get author value based on rule type.
705
706
 
706
- Checks git config first (for pre-commit validation of the configured identity),
707
- then falls back to the last commit's author info.
707
+ Reads the identity git would record for a new commit first (for
708
+ pre-commit validation), then falls back to the last commit's author.
708
709
  """
709
710
  supplied = context.piped_name
710
711
  if supplied is not None:
@@ -726,12 +727,20 @@ class AuthorValidator(BaseValidator):
726
727
  format_str = git_log_map.get(self.rule.check, "")
727
728
  return get_commit_info(format_str, context.rev) if format_str else ""
728
729
 
729
- # Try git config first (validates configured identity for new commits)
730
+ # The identity git would record for the next commit, in git's order:
731
+ # GIT_AUTHOR_NAME / GIT_AUTHOR_EMAIL (set for the hooks by
732
+ # ``git commit --author``, and by tools that commit under their own
733
+ # name), then author.name / author.email, then user.name / user.email.
730
734
  config_key = git_config_map.get(self.rule.check, "")
731
735
  if config_key:
732
- config_value = get_git_config_value(config_key)
733
- if config_value:
734
- return config_value
736
+ field = config_key.split(".")[1]
737
+ from_env = os.environ.get(f"GIT_AUTHOR_{field.upper()}", "").strip()
738
+ if from_env:
739
+ return from_env
740
+ for key in (f"author.{field}", config_key):
741
+ config_value = get_git_config_value(key)
742
+ if config_value:
743
+ return config_value
735
744
 
736
745
  # Fall back to last commit's author info
737
746
  format_str = git_log_map.get(self.rule.check, "")
@@ -1189,6 +1198,34 @@ class SignoffValidator(BaseValidator):
1189
1198
  return name, email
1190
1199
 
1191
1200
 
1201
+ #: A trailer line: a key with a hyphen (``Signed-off-by``, ``Change-Id``)
1202
+ #: or one of the common one-word keys, then a colon. A one-word key such as
1203
+ #: ``Note:`` is left as body text, since a sentence can start that way.
1204
+ _BODY_TRAILER_LINE = re.compile(
1205
+ r"^(?:[a-z]\w*-[\w-]+|Fixes|Closes|Resolves|Refs|Link|Cc|Bug)[ \t]*:",
1206
+ re.IGNORECASE,
1207
+ )
1208
+
1209
+
1210
+ def _body_without_trailers(message: str) -> str:
1211
+ """The body of *message*: what follows the subject, minus the trailer block.
1212
+
1213
+ ``git commit -s`` adds a ``Signed-off-by:`` line, so a message with only
1214
+ trailers after its subject used to count as having a body.
1215
+ """
1216
+ paragraphs = [
1217
+ p.strip() for p in re.split(r"\n[ \t]*\n", message.strip()) if p.strip()
1218
+ ]
1219
+ # The subject is the first line, even when the body follows it directly.
1220
+ rest = paragraphs[0].partition("\n")[2] if paragraphs else ""
1221
+ body = ([rest.strip()] if rest.strip() else []) + paragraphs[1:]
1222
+ if body and all(
1223
+ _BODY_TRAILER_LINE.match(ln.strip()) for ln in body[-1].splitlines()
1224
+ ):
1225
+ body = body[:-1]
1226
+ return "\n\n".join(body).strip()
1227
+
1228
+
1192
1229
  class BodyValidator(BaseValidator):
1193
1230
  """Validates that commit messages contain a body when required."""
1194
1231
 
@@ -1202,24 +1239,9 @@ class BodyValidator(BaseValidator):
1202
1239
 
1203
1240
  self._checked_value = message
1204
1241
 
1205
- # Split message into lines and check if there's content after the subject
1206
- lines = message.strip().split("\n")
1207
-
1208
- # Filter out empty lines
1209
- non_empty_lines = [line.strip() for line in lines if line.strip()]
1210
-
1211
- # If there's more than just the subject line, we have a body
1212
- if len(non_empty_lines) > 1:
1242
+ if _body_without_trailers(message):
1213
1243
  return ValidationResult.PASS
1214
1244
 
1215
- # Check if there's content after the first line (even if separated by empty lines)
1216
- # Unreachable: the message is stripped, so two or more lines always
1217
- # hold two non-empty ones and have passed above.
1218
- if len(lines) > 1: # pragma: no cover
1219
- body_content = "\n".join(lines[1:]).strip()
1220
- if body_content:
1221
- return ValidationResult.PASS
1222
-
1223
1245
  self._print_failure(message)
1224
1246
  return ValidationResult.FAIL
1225
1247
 
@@ -1642,13 +1664,18 @@ def _author_identity(context: ValidationContext) -> tuple[str, str]:
1642
1664
  An existing commit (``--rev``, or HEAD) by its recorded author; a message
1643
1665
  not yet committed by the author git would record for it.
1644
1666
  """
1645
- if context.rev is None and (
1646
- context.stdin_text is not None or context.commit_file is not None
1647
- ):
1667
+ if _is_pending(context):
1648
1668
  return get_pending_author_identity()
1649
1669
  return get_commit_author_identity(context.rev or "HEAD")
1650
1670
 
1651
1671
 
1672
+ def _is_pending(context: ValidationContext) -> bool:
1673
+ """Whether the message under test is not committed yet (stdin or a file)."""
1674
+ return context.rev is None and (
1675
+ context.stdin_text is not None or context.commit_file is not None
1676
+ )
1677
+
1678
+
1652
1679
  def ai_tools_in(context: ValidationContext, *, author: bool) -> list[str]:
1653
1680
  """The AI tools the message under test names, sorted, whatever the policy.
1654
1681
 
@@ -1687,7 +1714,19 @@ class AiAuthorValidator(BaseValidator):
1687
1714
  if tool is None:
1688
1715
  return ValidationResult.PASS
1689
1716
 
1690
- suggest = "Author the commit yourself: git commit --amend --reset-author"
1717
+ if _is_pending(context):
1718
+ # Usually no commit exists yet (a hook, a piped message): --amend
1719
+ # would rewrite the one before it, and --reset-author on its own
1720
+ # records this same identity again. The Action pipes existing
1721
+ # pull request commits this way too, hence the last clause.
1722
+ suggest = (
1723
+ "Commit as yourself: set git config user.name and user.email "
1724
+ "to your own, and unset GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL "
1725
+ "if a tool set them; a commit that already exists then needs "
1726
+ "git commit --amend --reset-author"
1727
+ )
1728
+ else:
1729
+ suggest = "Author the commit yourself: git commit --amend --reset-author"
1691
1730
  if self.rule.value == "disclose":
1692
1731
  trailers = self.rule.allowed or list(DEFAULT_AI_DISCLOSURE_TRAILERS)
1693
1732
  suggest += f', and disclose the tool with "{trailers[0]}: {tool}"'
@@ -1739,7 +1778,7 @@ class ValidationEngine:
1739
1778
  """Run all validations, print the findings, and return the overall result.
1740
1779
 
1741
1780
  The failure blocks are printed once every rule has run, not as each
1742
- rule fails: the banner above them names what was rejected, and that
1781
+ rule fails: the header above them names what was rejected, and that
1743
1782
  is only known once it is clear whether the failures are all about the
1744
1783
  commit, all about the branch, or spread across both.
1745
1784
  """
@@ -1769,7 +1808,7 @@ class ValidationEngine:
1769
1808
  continue # Skip unknown validators
1770
1809
 
1771
1810
  validator: BaseValidator = validator_class(rule)
1772
- validator._suppress_output = True # printed later, after the banner
1811
+ validator._suppress_output = True # printed later, after the header
1773
1812
  result = validator.validate(context)
1774
1813
  blocks.extend(validator._failure_blocks)
1775
1814
  if result == ValidationResult.SKIP:
@@ -1786,11 +1825,11 @@ class ValidationEngine:
1786
1825
  def _print_blocks(
1787
1826
  context: ValidationContext, failed: list[str], blocks: list[tuple[dict, str]]
1788
1827
  ) -> None:
1789
- """Print the banner, named for *failed*, then every failure block."""
1828
+ """Print the header, named for *failed*, then every failure block."""
1790
1829
  if not blocks:
1791
1830
  return
1792
1831
 
1793
- # Only an enforced failure earns the banner; a warning rejects
1832
+ # Only an enforced failure earns the header; a warning rejects
1794
1833
  # nothing. --compact and --no-banner keep it off entirely.
1795
1834
  if (
1796
1835
  failed
@@ -1798,7 +1837,7 @@ class ValidationEngine:
1798
1837
  and not context.compact
1799
1838
  and not print_error_header.has_been_called
1800
1839
  ):
1801
- print_error_header(rejection_headline(failed))
1840
+ print_error_header(rejection_headline(failed), failed=len(failed))
1802
1841
  for rule_dict, value in blocks:
1803
1842
  _print_failure(
1804
1843
  rule_dict,
commit_check/main.py CHANGED
@@ -286,7 +286,7 @@ def _get_parser() -> argparse.ArgumentParser:
286
286
  "--no-banner",
287
287
  action="store_true",
288
288
  default=False,
289
- help="suppress the ASCII art banner on failure",
289
+ help="suppress the one-line rejection header on failure",
290
290
  )
291
291
 
292
292
  check_group.add_argument(
@@ -620,6 +620,11 @@ def _resolve_commit_message_source(
620
620
  return None, args.commit_msg_file
621
621
 
622
622
  stdin_content = stdin_reader.read_piped_input()
623
+ if args.ai_attribution_only:
624
+ # The text under test is what was piped, a pull request description
625
+ # say. None of it, an empty description, is empty text: falling back
626
+ # to HEAD would judge the last commit's message in its place.
627
+ return stdin_content or "", None
623
628
  return stdin_content or None, None
624
629
 
625
630
 
@@ -865,7 +870,7 @@ def main() -> int:
865
870
  if args.fix and commit_file_path and not args.dry_run:
866
871
  _fix_message_file(commit_file_path, filtered_rules, config_data)
867
872
 
868
- # Reset banner state for this run
873
+ # Reset header state for this run
869
874
  print_error_header.has_been_called = False
870
875
 
871
876
  context = ValidationContext(
@@ -222,6 +222,22 @@ def _check_booleans(config: dict[str, Any]) -> None:
222
222
  )
223
223
 
224
224
 
225
+ def _check_author_lists(config: dict[str, Any]) -> None:
226
+ """Make each ``ignore_authors`` a list, or refuse it.
227
+
228
+ A string such as ``"renovate[bot], Bot User"`` was tested with ``in``,
229
+ which on a string is a substring match: any author whose name was part
230
+ of it, ``bot`` or ``Bot``, skipped every check. A comma-separated string
231
+ is now split, as ``--ignore-authors`` and ``CCHK_IGNORE_AUTHORS`` split it.
232
+ """
233
+ for section in ("commit", "branch"):
234
+ values = config.get(section)
235
+ if isinstance(values, dict) and "ignore_authors" in values:
236
+ values["ignore_authors"] = _string_list(
237
+ values, "ignore_authors", [], f"[{section}] ignore_authors"
238
+ )
239
+
240
+
225
241
  class RuleBuilder:
226
242
  """Builds validation rules from config and catalog entries."""
227
243
 
@@ -233,6 +249,7 @@ class RuleBuilder:
233
249
  self.tag_config = config.get("tag", {})
234
250
  self.files_config = config.get("files", {})
235
251
  _check_booleans(config)
252
+ _check_author_lists(config)
236
253
  self.warn_checks = self._resolve_warn_list(config.get("warn", []))
237
254
 
238
255
  def build_all_rules(self) -> list[ValidationRule]:
commit_check/util.py CHANGED
@@ -14,7 +14,7 @@ import sys
14
14
  from collections.abc import Iterable
15
15
  from subprocess import CalledProcessError
16
16
 
17
- from commit_check import GREEN, RED, RESET_COLOR, YELLOW
17
+ from commit_check import BOLD, DIM, GREEN, RED, RESET_COLOR, YELLOW
18
18
  from commit_check.rules_catalog import display_name
19
19
 
20
20
  # C0 and C1 control characters, and DEL, except the newline and tab that a
@@ -55,7 +55,7 @@ def _print_failure(
55
55
  """Print a standardized failure message.
56
56
 
57
57
  A rule whose ``severity`` is ``"warn"`` prints the same block with the
58
- word ``warning`` in place of ``failed``, no rejection banner, and one
58
+ word ``warning`` in place of ``failed``, no rejection header, and one
59
59
  closing line saying the run is not failed by it.
60
60
  """
61
61
  rule_id = check.get("rule_id", "")
@@ -66,7 +66,7 @@ def _print_failure(
66
66
  label = f"{rule_id} {name}" if rule_id else name
67
67
  print(f"[{'WARN' if warn else 'FAIL'}] {label}: {compact_value}")
68
68
  return
69
- # The banner announces a rejection; a warning rejects nothing.
69
+ # The header announces a rejection; a warning rejects nothing.
70
70
  if not warn and not no_banner and not print_error_header.has_been_called:
71
71
  print_error_header(rejection_headline([check["check"]]))
72
72
  docs_url = check.get("docs_url", "") or ""
@@ -88,9 +88,14 @@ def _print_failure(
88
88
  # to read. Without hyperlink support — a pipe, a CI log — it is the only
89
89
  # way the reader gets the address at all, so it stays.
90
90
  if docs_url and not (rule_id and supports_hyperlinks()):
91
- print(f"Docs: {docs_url}")
91
+ print(
92
+ f"{_DETAIL_INDENT}{DIM}Docs:{RESET_COLOR} {DIM}{docs_url}{RESET_COLOR}"
93
+ )
92
94
  if warn:
93
- print("This rule is set to warn in the config; it does not fail the run.")
95
+ print(
96
+ f"{_DETAIL_INDENT}{DIM}This rule is set to warn in the config; "
97
+ f"it does not fail the run.{RESET_COLOR}"
98
+ )
94
99
  # Blank line closes the whole block, rather than splitting it before the
95
100
  # documentation link.
96
101
  print()
@@ -786,7 +791,7 @@ def track_print_call(func):
786
791
  return wrapper
787
792
 
788
793
 
789
- #: What the banner says was rejected, by the check that failed. A check not
794
+ #: What the header says was rejected, by the check that failed. A check not
790
795
  #: listed here is about the commit itself: its message, its author, the files
791
796
  #: it touches.
792
797
  _REJECTED_SUBJECTS = {
@@ -796,12 +801,26 @@ _REJECTED_SUBJECTS = {
796
801
  "no_force_push": "Push",
797
802
  }
798
803
 
799
- #: Width of the banner's ASCII art; the text lines are padded to match it.
800
- _BANNER_WIDTH = 66
804
+ #: Detail lines (explanation, suggestion, docs) sit under the failing value,
805
+ #: indented past the marker so the rule IDs form a column to scan down.
806
+ _DETAIL_INDENT = " "
807
+
808
+
809
+ def _symbol(fancy: str, plain: str) -> str:
810
+ """*fancy* when stdout can encode it, else *plain*.
811
+
812
+ A Windows console on a legacy code page cannot print every symbol, and a
813
+ failure report that crashes with UnicodeEncodeError reports nothing.
814
+ """
815
+ try:
816
+ fancy.encode(getattr(sys.stdout, "encoding", None) or "ascii")
817
+ except (UnicodeEncodeError, LookupError):
818
+ return plain
819
+ return fancy
801
820
 
802
821
 
803
822
  def rejection_headline(checks: Iterable[str]) -> str:
804
- """The banner's first line, naming what the failing *checks* rejected.
823
+ """The header's text, naming what the failing *checks* rejected.
805
824
 
806
825
  A developer who pushed a badly named branch reads "Commit rejected" and
807
826
  goes looking at their commit, so the line names the branch, tag or push
@@ -810,27 +829,25 @@ def rejection_headline(checks: Iterable[str]) -> str:
810
829
  """
811
830
  subjects = {_REJECTED_SUBJECTS.get(check, "Commit") for check in checks}
812
831
  if len(subjects) == 1:
813
- return f"{subjects.pop()} rejected by Commit-Check."
814
- return "Checks failed - rejected by Commit-Check."
832
+ return f"{subjects.pop()} rejected by Commit Check"
833
+ return "Rejected by Commit Check"
815
834
 
816
835
 
817
836
  @track_print_call
818
- def print_error_header(headline: str = "Commit rejected by Commit-Check.") -> None:
819
- """Print the rejection banner: *headline*, then the ASCII art.
837
+ def print_error_header(
838
+ headline: str = "Commit rejected by Commit Check", failed: int = 0
839
+ ) -> None:
840
+ """Print the one-line rejection header, then a blank line.
820
841
 
821
- :param headline: the first line, from :func:`rejection_headline`
842
+ :param headline: the text, from :func:`rejection_headline`
843
+ :param failed: how many enforced checks failed; named when given
822
844
  """
823
- print(headline.ljust(_BANNER_WIDTH))
824
- print(" ")
825
- print(r" (c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c) ")
826
- print(r" / ._. \ / ._. \ / ._. \ / ._. \ / ._. \ ")
827
- print(r" __\( C )/__ __\( H )/__ __\( E )/__ __\( C )/__ __\( K )/__ ")
828
- print(r"(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)")
829
- print(r" || E || || R || || R || || O || || R || ")
830
- print(r" _.' '-' '._ _.' '-' '._ _.' '-' '._ _.' '-' '._ _.' '-' '._ ")
831
- print(r"(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)")
832
- print(r" `-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´ ")
833
- print(" ")
845
+ count = ""
846
+ if failed:
847
+ noun = "check" if failed == 1 else "checks"
848
+ count = f" {DIM}· {failed} {noun} failed{RESET_COLOR}"
849
+ print(f"{BOLD}{RED}{_symbol('✖', 'x')} {headline}{RESET_COLOR}{count}")
850
+ print()
834
851
 
835
852
 
836
853
  #: Terminals known to render OSC 8 hyperlinks, by ``TERM_PROGRAM``.
@@ -908,10 +925,21 @@ def print_error_message(
908
925
  label = rule_id
909
926
  if rule_id and docs_url and supports_hyperlinks():
910
927
  label = hyperlink(rule_id, docs_url)
911
- prefix = f"{YELLOW}{label}{RESET_COLOR} " if rule_id else ""
912
- verdict, colour = ("warning", YELLOW) if warn else ("failed", RED)
928
+ prefix = f"{BOLD}{label}{RESET_COLOR} " if rule_id else ""
929
+ if warn:
930
+ marker, verdict, colour = _symbol("▲", "!"), "warning", YELLOW
931
+ else:
932
+ marker, verdict, colour = _symbol("✖", "x"), "failed", RED
933
+ # A whole commit message is the value of several rules; its subject names
934
+ # the commit, and the rest would push the explanation off the screen.
935
+ first, _, rest = reason.partition("\n")
936
+ more = sum(1 for line in rest.splitlines() if line.strip())
937
+ tail = ""
938
+ if more:
939
+ tail = f" {DIM}(+{more} more line{'s' if more > 1 else ''}){RESET_COLOR}"
913
940
  print(
914
- f"{prefix}{YELLOW}{name}{RESET_COLOR} check {verdict} ==> {colour}{reason}{RESET_COLOR}"
941
+ f"{colour}{marker}{RESET_COLOR} {prefix}{YELLOW}{name}{RESET_COLOR} "
942
+ f"{verdict}: {colour}{first}{RESET_COLOR}{tail}"
915
943
  )
916
944
  if error:
917
945
  # Same trade-off as the Docs: line above — once the spec name is a
@@ -920,7 +948,7 @@ def print_error_message(
920
948
  if spec_name and spec_url and supports_hyperlinks():
921
949
  error = error.replace(f". See {spec_url}", "")
922
950
  error = error.replace(spec_name, hyperlink(spec_name, spec_url))
923
- print(error)
951
+ print(f"{_DETAIL_INDENT}{error}")
924
952
 
925
953
 
926
954
  def print_suggestion(suggest: str) -> None:
@@ -928,4 +956,6 @@ def print_suggestion(suggest: str) -> None:
928
956
  :param suggest: what message to print out
929
957
  """
930
958
  if suggest:
931
- print(f"Suggest: {GREEN}{suggest}{RESET_COLOR}")
959
+ print(
960
+ f"{_DETAIL_INDENT}{BOLD}{GREEN}Suggest:{RESET_COLOR} {GREEN}{suggest}{RESET_COLOR}"
961
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commit-check
3
- Version: 2.20.2
3
+ Version: 2.20.4
4
4
  Summary: Commit policy as code for teams and AI agents: check commit messages, branch names, authors, tags, files and AI attribution.
5
5
  Author-email: Xianpeng Shen <xianpeng.shen@gmail.com>
6
6
  License-Expression: MIT
@@ -87,7 +87,7 @@ Stop bad commits before they exist. In `.pre-commit-config.yaml`:
87
87
  ```yaml
88
88
  repos:
89
89
  - repo: https://github.com/commit-check/commit-check
90
- rev: v2.20.2
90
+ rev: v2.20.4
91
91
  hooks:
92
92
  - id: check-message
93
93
  - id: check-branch
@@ -107,7 +107,7 @@ The same `cchk.toml` drives all of them:
107
107
  |---|---|
108
108
  | GitHub, no workflow | [Install the GitHub App](https://github.com/apps/commit-check) — one check run per commit |
109
109
  | GitHub Actions | `uses: commit-check/commit-check-action@v2` — see [commit-check-action](https://github.com/commit-check/commit-check-action) |
110
- | AI agents | `--format json`, the [Python API](#ai-native-usage), or the [MCP server](https://github.com/commit-check/commit-check-mcp) |
110
+ | AI agents | The [agent skill](#agent-skill), `--format json`, the [Python API](#ai-native-usage), or the [MCP server](https://github.com/commit-check/commit-check-mcp) |
111
111
 
112
112
  ## What it checks
113
113
 
@@ -252,6 +252,21 @@ a value of the wrong type (`subject_max_length = "abc"`), or git cannot read the
252
252
  repository (not a repository, or "dubious ownership"). A `[files]` value it
253
253
  cannot use turns that rule off with a notice instead. `--dry-run` reports everything and exits `0`. More output formats: [examples](https://commit-check.com/example/).
254
254
 
255
+ ### Agent skill
256
+
257
+ [`skills/commit-check`](https://github.com/commit-check/commit-check/blob/main/skills/commit-check/SKILL.md) teaches a coding agent
258
+ to read the project's `cchk.toml`, check a message before it commits, follow
259
+ the AI attribution policy and never skip the hook. It uses the
260
+ [Agent Skills](https://agentskills.io) format, which Claude Code, GitHub
261
+ Copilot, Codex, Cursor and others load:
262
+
263
+ ```bash
264
+ npx skills add https://github.com/commit-check/commit-check --skill commit-check
265
+ ```
266
+
267
+ Or copy the folder into your agent's skills directory, such as
268
+ `.claude/skills/commit-check/` for Claude Code.
269
+
255
270
  ## Why Commit Check
256
271
 
257
272
  | | Commit Check | commitlint | GitHub Rulesets |
@@ -280,3 +295,8 @@ Questions and ideas go to [Discussions](https://github.com/commit-check/commit-c
280
295
  bugs to [Issues](https://github.com/commit-check/commit-check/issues).
281
296
  Releases follow [Semantic Versioning](https://semver.org/). Released under the
282
297
  [MIT License](https://github.com/commit-check/commit-check/blob/main/LICENSE).
298
+
299
+ Thanks to everyone who has contributed. Want to join them? Start with
300
+ [CONTRIBUTING.md](https://github.com/commit-check/commit-check/blob/main/CONTRIBUTING.md).
301
+
302
+ [![Contributors](https://contrib.rocks/image?repo=commit-check/commit-check)](https://github.com/commit-check/commit-check/graphs/contributors)
@@ -1,21 +1,21 @@
1
- commit_check/__init__.py,sha256=UAg0cSgL4QKAOc9GEbqFdoQ94JejOupRGoGgaDwIcF0,5456
1
+ commit_check/__init__.py,sha256=rzJMSqdTrxg7PmxRDY4yWhCbGkEXAT3hK4C9Y6NwxSU,5529
2
2
  commit_check/ai_policy.py,sha256=gYC3ROLgGL1TDyhPkFXkV-NiYbvMt80Qt0MFrJcbJY4,8131
3
3
  commit_check/ai_signatures.py,sha256=qPbyVndU5egHRtDtu3S2vEO5_lKyDsz1PLUWqKPMMvU,11054
4
4
  commit_check/ai_signatures_data.py,sha256=lvJDZ_-eH2RYqVn8MMry9oNXVv27u9okLawPZx_y4XA,22851
5
5
  commit_check/api.py,sha256=07bvBtV8PrhZIOwCDHiHfu_7CXsX_4U2_K2xMAucd6c,12905
6
6
  commit_check/config.py,sha256=I7yMZBJynjVUuY-GWAkuu9a59aT9fDTJsGh4znu2hDU,13941
7
7
  commit_check/config_merger.py,sha256=52m45cPOVzQnjvxgjf8pHPbK3BKVHPrvBMmtocztU-0,13707
8
- commit_check/engine.py,sha256=x4vOON6I7IEid3M7YWhgrE9spvGwfK902myKlRc0J-0,77528
8
+ commit_check/engine.py,sha256=O1h3X9C297GUFJvXXj2B8Ke8Hmf9qX8QtdtO3cMuri0,79358
9
9
  commit_check/fixes.py,sha256=BpbdoHsKDyw2WfsqymwYpnrW73aHdCDGr8tMF6Ho2RU,7305
10
10
  commit_check/imperatives.py,sha256=dEd_ssu4G0j6Cann6jqPdB97lw5Adua43K0_Odg_FyA,9518
11
- commit_check/main.py,sha256=Bq1ThH0KVdS1MAeNcvvBLASPEkIVD3dbyKnYF_BkTh0,30859
11
+ commit_check/main.py,sha256=5nchWwh4axbrVBkUCVtedjccEBHxm9ynKSJjSq5VcvQ,31165
12
12
  commit_check/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- commit_check/rule_builder.py,sha256=kujszrki8VKXAarrmUwOCu0Yv7QzIiu5lm5mRBAQVns,34950
13
+ commit_check/rule_builder.py,sha256=N_3qkZpLG1Yb_hUTMFNro2w7VsWtXLGjjyGPEOEPs88,35708
14
14
  commit_check/rules_catalog.py,sha256=KtP64QRFSI_p3fRtaF1XDx3MUikIU__p1o-XmQBpSMY,12736
15
- commit_check/util.py,sha256=dCMbRKMPiysjxcOQWOIM-vJT2DdE2BsnGDgvTJsgnFs,34486
16
- commit_check-2.20.2.dist-info/licenses/LICENSE,sha256=9mdTva71kQhrpWh_nZulxrdCnUrl5c6xJYh5hdo4p_s,1070
17
- commit_check-2.20.2.dist-info/METADATA,sha256=7OVmIeAbGVUFIy9IEo3H3CPjSx-A7jXP_Rw7eec1zSM,17135
18
- commit_check-2.20.2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
19
- commit_check-2.20.2.dist-info/entry_points.txt,sha256=YMrkFGeub-3-IanV1d9qnopXVaRQM7MA9foXKW9iZ88,86
20
- commit_check-2.20.2.dist-info/top_level.txt,sha256=Wf46u-ooHBMJNHbhfrBNQw3wC5_m8wt-o_Lfbc4QpRg,13
21
- commit_check-2.20.2.dist-info/RECORD,,
15
+ commit_check/util.py,sha256=pl_UZIgluo9wGdqlaePWNbULKqAlQpZd3LTHm9OytCc,35170
16
+ commit_check-2.20.4.dist-info/licenses/LICENSE,sha256=9mdTva71kQhrpWh_nZulxrdCnUrl5c6xJYh5hdo4p_s,1070
17
+ commit_check-2.20.4.dist-info/METADATA,sha256=hHNsaefNqZv9iNVR6Scnl6GGV_ntjyFnyRYhAatiwl8,18084
18
+ commit_check-2.20.4.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
19
+ commit_check-2.20.4.dist-info/entry_points.txt,sha256=YMrkFGeub-3-IanV1d9qnopXVaRQM7MA9foXKW9iZ88,86
20
+ commit_check-2.20.4.dist-info/top_level.txt,sha256=Wf46u-ooHBMJNHbhfrBNQw3wC5_m8wt-o_Lfbc4QpRg,13
21
+ commit_check-2.20.4.dist-info/RECORD,,