@webywz/vibe-commit 0.1.9 → 0.1.11

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
@@ -17,8 +17,10 @@
17
17
  </p>
18
18
 
19
19
  Companion spirit to [diff-vibe](https://github.com/webywz/diff-vibe): commits here, pull requests there.
20
+ Pair walkthrough (EN/中文) and a copy-pasteable helper: [`examples/pair-workflow.md`](./examples/pair-workflow.md) · [`examples/commit-msg.sh`](./examples/commit-msg.sh) (ship in the npm tarball).
20
21
 
21
22
  与 [diff-vibe](https://github.com/webywz/diff-vibe) 成对:这边写 commit,那边写 PR。
23
+ 成对流程与可复制脚本见 [`examples/`](./examples/)(随 npm 包发布)。
22
24
 
23
25
  ---
24
26
 
@@ -65,6 +67,18 @@ Offline heuristic also marks breaking when the staged diff removes public `expor
65
67
 
66
68
  离线启发式在删掉公开 `export`、或 `package.json` 主版本升级时也会标 breaking;只要 `breaking` 为真就会补上 `BREAKING CHANGE:` footer(`--json` 的 body 与格式化输出一致)。强制 `--breaking` 时 footer 文本即 **subject**;启发式推断 breaking 时仍可用更具体的双语原因。干跑会打一行原因;`--json` 可带 `breakingReason`。
67
69
 
70
+ ### Pair with diff-vibe · 与 diff-vibe 成对
71
+
72
+ ```bash
73
+ git add -p
74
+ npx --yes @webywz/vibe-commit --commit
75
+ npx --yes @webywz/diff-vibe@^0.1.8 --base main --create
76
+ ```
77
+
78
+ Commits here · PRs there. Full walkthrough (EN/中文) and `commit-msg.sh` live in [`examples/pair-workflow.md`](./examples/pair-workflow.md) and [`examples/commit-msg.sh`](./examples/commit-msg.sh). Companion-side snippets: [diff-vibe examples](https://github.com/webywz/diff-vibe/tree/main/examples).
79
+
80
+ 这边写 commit,那边写 PR。完整成对流程与脚本见 [`examples/`](./examples/)。成对仓库示例:[diff-vibe examples](https://github.com/webywz/diff-vibe/tree/main/examples)。
81
+
68
82
  **Vibes** · 语气
69
83
 
70
84
  - **pro** — default. Imperative, review-ready. · 默认:祈使句,可进 review。
@@ -158,6 +172,7 @@ console.log(formatCommit(message));
158
172
  - npm · [`@webywz/vibe-commit`](https://www.npmjs.com/package/@webywz/vibe-commit)
159
173
  - Source · [github.com/webywz/vibe-commit](https://github.com/webywz/vibe-commit)
160
174
  - Related · [diff-vibe](https://github.com/webywz/diff-vibe) · [prompt-diff](https://github.com/webywz/prompt-diff)
175
+ - Pair workflow · [examples/pair-workflow.md](./examples/pair-workflow.md)
161
176
  - License · [MIT](./LICENSE)
162
177
 
163
178
  ```bash
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env bash
2
+ # Copy-pasteable: stage interactively, then propose / write a commit with vibe-commit.
3
+ # 可复制:交互暂存后,用 vibe-commit 提案 / 真正提交。
4
+ #
5
+ # Pin: @webywz/vibe-commit · Companion: @webywz/diff-vibe@^0.1.8
6
+ # Requires: Node.js 18.18+, git · 需要:Node 18.18+、git
7
+ #
8
+ # Typical pair flow · 成对流程:
9
+ # ./examples/commit-msg.sh
10
+ # npx --yes @webywz/diff-vibe@^0.1.8 --base main --create
11
+ #
12
+ # Preview only (default) · 只预览(默认):
13
+ # DRY_RUN=1 ./examples/commit-msg.sh
14
+ # Write the commit · 真正提交:
15
+ # COMMIT=1 ./examples/commit-msg.sh
16
+ # Skip interactive add · 跳过交互暂存:
17
+ # SKIP_ADD=1 COMMIT=1 ./examples/commit-msg.sh
18
+
19
+ set -euo pipefail
20
+
21
+ PKG="${PKG:-@webywz/vibe-commit}"
22
+
23
+ if [[ "${SKIP_ADD:-}" != "1" ]]; then
24
+ # Interactive stage · 交互暂存
25
+ git add -p
26
+ fi
27
+
28
+ if [[ "${COMMIT:-}" == "1" && "${DRY_RUN:-}" != "1" ]]; then
29
+ # Write the commit · 真正提交
30
+ npx --yes "$PKG" --commit
31
+ else
32
+ # Print proposal only · 只打印提案
33
+ npx --yes "$PKG" --dry-run
34
+ fi
@@ -0,0 +1,99 @@
1
+ # Pair workflow · 成对用法
2
+
3
+ `vibe-commit` writes the commit. `diff-vibe` drafts the PR.
4
+ Use them together on the same branch — offline by default, AI optional.
5
+
6
+ `vibe-commit` 写 commit,`diff-vibe` 写 PR。
7
+ 同一分支上成对用;默认离线,有 Key 再可选 AI。
8
+
9
+ Pinned packages for this walkthrough · 本示例钉包版本:
10
+
11
+ - `@webywz/vibe-commit` (this package · 本包)
12
+ - `@webywz/diff-vibe@^0.1.8`
13
+
14
+ Requires **Node.js 18.18+**, `git`, and (for open/update) [`gh`](https://cli.github.com/).
15
+
16
+ 需要 **Node.js 18.18+**、`git`;开/更新 PR 还需本机有 `gh`。
17
+
18
+ ---
19
+
20
+ ## 1. Commit · 提交
21
+
22
+ ```bash
23
+ git add -p
24
+ npx --yes @webywz/vibe-commit --dry-run # review the proposal · 先看提案
25
+ npx --yes @webywz/vibe-commit --commit # write the commit · 真正提交
26
+ ```
27
+
28
+ Or use the short binary / the copy-pasteable helper:
29
+
30
+ 也可全局安装后用短命令,或跑 [`commit-msg.sh`](./commit-msg.sh):
31
+
32
+ ```bash
33
+ npm i -g @webywz/vibe-commit @webywz/diff-vibe@^0.1.8
34
+ vibe-commit --commit
35
+ # or · 或
36
+ ./examples/commit-msg.sh
37
+ ```
38
+
39
+ ---
40
+
41
+ ## 2. PR draft · PR 草稿
42
+
43
+ Diff against the PR base (usually `main`) so commits already on the branch are included.
44
+
45
+ 对比 PR 基线(通常是 `main`),把分支上已提交的改动一并纳入:
46
+
47
+ ```bash
48
+ npx --yes @webywz/diff-vibe@^0.1.8 --base main
49
+ npx --yes @webywz/diff-vibe@^0.1.8 --base main --copy # clipboard when available · 能复制就复制
50
+ ```
51
+
52
+ Pipe into `gh` without posting yet · 管道进 `gh`(尚未发帖):
53
+
54
+ ```bash
55
+ gh pr create \
56
+ --title "$(npx --yes @webywz/diff-vibe@^0.1.8 --base main --title-only)" \
57
+ --body-file <(npx --yes @webywz/diff-vibe@^0.1.8 --base main --body-only) \
58
+ --dry-run
59
+ ```
60
+
61
+ Full walkthrough on the companion side: [`diff-vibe` examples/pair-workflow.md](https://github.com/webywz/diff-vibe/blob/main/examples/pair-workflow.md).
62
+
63
+ 成对仓库侧完整流程见 [diff-vibe `examples/pair-workflow.md`](https://github.com/webywz/diff-vibe/blob/main/examples/pair-workflow.md)。
64
+
65
+ ---
66
+
67
+ ## 3. Open or update · 开 PR / 更新
68
+
69
+ Opt-in flags shell out to `gh`. Nothing is posted without them.
70
+
71
+ 需显式传参才会调 `gh`;不加则只打印草稿。
72
+
73
+ ```bash
74
+ # open a new PR · 开新 PR
75
+ npx --yes @webywz/diff-vibe@^0.1.8 --base main --create
76
+
77
+ # draft PR · 草稿 PR
78
+ npx --yes @webywz/diff-vibe@^0.1.8 --base main --create --draft
79
+
80
+ # edit the open PR for this branch · 更新当前分支已开 PR
81
+ npx --yes @webywz/diff-vibe@^0.1.8 --base main --update
82
+ ```
83
+
84
+ `--create` and `--update` are mutually exclusive. `--draft` only pairs with `--create`.
85
+
86
+ `--create` 与 `--update` 互斥;`--draft` 仅配合 `--create`。
87
+
88
+ ---
89
+
90
+ ## Mental model · 心智模型
91
+
92
+ | Step · 步骤 | Tool · 工具 | Input · 输入 |
93
+ | --- | --- | --- |
94
+ | Commit message | `vibe-commit` | **staged** diff (`git diff --cached`) |
95
+ | PR title + body | `diff-vibe` | staged + unstaged vs `HEAD`, or vs `--base` merge-base |
96
+
97
+ Commits here · PRs there. Same offline heuristic family; vibes and AI keys stay optional.
98
+
99
+ 这边写 commit,那边写 PR。同一套离线启发式;文风与 AI Key 都可选。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webywz/vibe-commit",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Stylish conventional commit messages with personality. Offline-first, AI-optional.",
5
5
  "keywords": [
6
6
  "git",
@@ -40,7 +40,8 @@
40
40
  "dist",
41
41
  "!dist/**/*.map",
42
42
  "README.md",
43
- "LICENSE"
43
+ "LICENSE",
44
+ "examples"
44
45
  ],
45
46
  "engines": {
46
47
  "node": ">=18.18"