dsh-commit-msg-check 0.2.0 → 0.3.1

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.
package/README.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Commit-message hygiene from a single message. A commit is decidable: it has a **type prefix** from a known set, a **subject that fits a git log line**, a **blank line before the body**, and **breaking changes announced in a trailer** rather than buried in the subject. This verifies exactly those — one file, no git history needed.
4
4
 
5
+ ## 前置要求
6
+
7
+ Node.js ≥ 22.19,就是 `package.json` 里 `engines.node` 写的那一条;CLI 只依赖 Node,别的不装也能跑。想在对话里用同一个检查,需要 DSH `>=0.2.2-rc.1 <0.3.0-0`。装之前 `node -v` 看一眼,比装完再猜为什么报错快。
8
+
9
+ 跑通大概 2 分钟。卡住了在仓库开 issue,别自己啃。
10
+
5
11
  <!-- example:start -->
6
12
  ## 真实输入输出
7
13
 
package/bin/cli.js CHANGED
File without changes
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Commit message check",
4
+ "description": "Commit-message hygiene from a single message: a type prefix from a known set, a subject that fits a git log line, no trailing period, a blank line before the body, and breaking changes announced in a trailer."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "提交信息检查清单",
4
+ "description": "一条提交信息就能判定:主题长度(git log 折行处)、标题不写句号、正文前必须有空行、破坏性变更用 trailer 而不是埋主题里、以及可选的类型前缀。可以直接挂 commit-msg 钩子。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "dsh-commit-msg-check",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Commit-message hygiene from a single message: a type prefix from a known set, a subject that fits a git log line, no trailing period, a blank line before the body, and breaking changes announced in a trailer.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
7
7
  "exports": {
8
8
  ".": "./src/index.js",
9
- "./package.json": "./package.json"
9
+ "./package.json": "./package.json",
10
+ "./locale/*.json": "./locale/*.json"
10
11
  },
11
12
  "bin": {
12
13
  "commit-msg-check": "./bin/cli.js"
@@ -25,7 +26,8 @@
25
26
  "bin",
26
27
  "cordis.patch.yml",
27
28
  "README.md",
28
- "LICENSE"
29
+ "LICENSE",
30
+ "locale"
29
31
  ],
30
32
  "keywords": [
31
33
  "dsh",
package/src/index.js CHANGED
@@ -24,7 +24,12 @@ export const TYPES = ['feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test'
24
24
 
25
25
  // `type(scope): subject` or `type: subject`. The colon is required; a bare
26
26
  // sentence with no prefix is the most common violation and the cheapest to fix.
27
- const HEADER = /^(\w+)(?:\(([^)]+)\))?(!)?:\s*(.+)$/
27
+ //
28
+ // The subject is `.*`, not `.+`, on purpose: with `.+` a header of `feat:` fails
29
+ // to parse, so `type` reads as null and the `subject-empty` rule below can never
30
+ // fire. It was dead code until the rules audit looked for a test that makes each
31
+ // rule fire and found none for this one.
32
+ const HEADER = /^(\w+)(?:\(([^)]+)\))?(!)?:\s*(.*)$/
28
33
 
29
34
  export function parseCommit(text) {
30
35
  const lines = String(text).split('\n')