@ckpack/ai-commit 1.0.0 → 1.0.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 +74 -1
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -1 +1,74 @@
|
|
|
1
|
-
|
|
1
|
+
# ai-commit
|
|
2
|
+
|
|
3
|
+
使用 Codex 根据 git diff 生成符合 Conventional Commits 的提交信息。
|
|
4
|
+
|
|
5
|
+
## 功能
|
|
6
|
+
|
|
7
|
+
- 读取暂存区或工作区 diff(优先暂存区)
|
|
8
|
+
- 自动忽略常见锁文件与日志文件
|
|
9
|
+
- 生成单行 commit message,长度不超过 50 个字符
|
|
10
|
+
- Codex 失败时自动回退为本地摘要
|
|
11
|
+
|
|
12
|
+
## 安装
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add -D @ckpack/ai-commit
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
或全局安装:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pnpm add -g @ckpack/ai-commit
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 使用
|
|
25
|
+
|
|
26
|
+
在包含变更的 git 仓库中运行:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
ai-commit
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
输出示例:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
feat: add commit message generator
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
你也可以直接调用源码(开发时):
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pnpm dev
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 环境变量
|
|
45
|
+
|
|
46
|
+
- `CODEX_BIN`:Codex 可执行文件名,默认 `codex`
|
|
47
|
+
- `CODEX_ARGS`:传给 Codex 的参数,默认 `exec`
|
|
48
|
+
|
|
49
|
+
示例:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
CODEX_BIN=codex CODEX_ARGS="exec" ai-commit
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 生成逻辑
|
|
56
|
+
|
|
57
|
+
- 优先读取 `git diff --staged`,为空则读取 `git diff`
|
|
58
|
+
- 默认忽略:`**/*.log`、`**/pnpm-lock.yaml`、`**/package-lock.json`、`**/yarn.lock`
|
|
59
|
+
- 生成的消息需匹配 Conventional Commits:
|
|
60
|
+
`type(scope?): description`,描述不超过 50 个字符
|
|
61
|
+
- Codex 返回异常或不符合规范时,回退为 `chore: update <files>`
|
|
62
|
+
|
|
63
|
+
## 开发
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pnpm dev # 运行源码
|
|
67
|
+
pnpm build # 构建 dist
|
|
68
|
+
pnpm typecheck # TS 类型检查
|
|
69
|
+
pnpm lint # 修复 lint
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## 许可
|
|
73
|
+
|
|
74
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckpack/ai-commit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"packageManager": "pnpm@10.12.1+sha512.f0dda8580f0ee9481c5c79a1d927b9164f2c478e90992ad268bbb2465a736984391d6333d2c327913578b2804af33474ca554ba29c04a8b13060a717675ae3ac",
|
|
7
|
-
"description": "
|
|
7
|
+
"description": "使用 Codex 根据 git diff 生成符合 Conventional Commits 的提交信息.",
|
|
8
8
|
"author": "ckvv",
|
|
9
9
|
"license": "MIT",
|
|
10
|
-
"repository": "https://github.com/
|
|
10
|
+
"repository": "https://github.com/ckpack/ai-commit",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": "./dist/index.js",
|
|
13
13
|
"./package.json": "./package.json"
|
|
@@ -22,12 +22,13 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
|
-
"commit
|
|
25
|
+
"ai-commit": "node --experimental-strip-types src/index.ts",
|
|
26
26
|
"dev": "node --import=tsx src/index.ts",
|
|
27
27
|
"build": "tsdown",
|
|
28
28
|
"typecheck": "tsc --noEmit",
|
|
29
29
|
"lint": "eslint --fix",
|
|
30
|
-
"publish:npm": "npm run build && npm publish --registry https://registry.npmjs.org/ --access public"
|
|
30
|
+
"publish:npm": "npm run build && npm publish --registry https://registry.npmjs.org/ --access public",
|
|
31
|
+
"release": "npx changelogen --release --push"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@types/node": "^24",
|