local-diff-reviewer 1.0.1 → 1.0.4

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.
Files changed (3) hide show
  1. package/README.md +24 -53
  2. package/SKILL.md +2 -2
  3. package/package.json +8 -4
package/README.md CHANGED
@@ -9,7 +9,7 @@ AI chat 里的本地代码审查工具。可以直接用 CLI 打开,也可以
9
9
  Try it first:
10
10
 
11
11
  ```bash
12
- npx local-diff-reviewer
12
+ npx --yes local-diff-reviewer
13
13
  ```
14
14
 
15
15
  Install and use:
@@ -36,53 +36,6 @@ npx skills add Mone-Lee/diff-review
36
36
  - 支持通过内部 `--comment` 参数预置 agent findings / replies。
37
37
  - 支持复制极简 AI prompt。
38
38
 
39
- ## 评论定位原理(新手友好版)
40
-
41
- 很多人会直觉认为:评论只和“第几行”绑定。
42
- 比如删掉第 10 行后,原来第 11 行顶上来变成第 10 行,评论也应该跟着走。
43
-
44
- 这个工具不是这样做的。它用的是“锚点”定位,锚点至少包含:
45
-
46
- - 文件路径(`filePath`)
47
- - 行号(`lineNumber`)
48
- - 行所在版本(`side`:旧版本 `old` / 新版本 `new`,代码 Diff 专用)
49
-
50
- 这意味着评论绑定的是“哪一个版本里的哪一行”,而不是“屏幕上现在第几行”。
51
-
52
- ### 为什么删除内容后评论可能不显示?
53
-
54
- - 对代码 Diff 行评论:
55
- - 如果评论当时加在被删除的旧行上,它的锚点是 `old + 行号`。
56
- - 删除后右侧展示的是新版本内容(`new`),`old` 锚点找不到对应渲染位置时,就不会显示在行内。
57
- - 对 Markdown 行评论:
58
- - 评论绑定的是 source line(源文件行号)。
59
- - 被评论的那段 Markdown 真被删掉后,预览里没有对应块可挂载,行内自然不显示。
60
-
61
- ### 一个非常短的例子
62
-
63
- 1. 你在 `old` 版本第 20 行加了评论。
64
- 2. 后续改动把第 20 行删除,并让后面内容上移。
65
- 3. 新内容虽然“占了第 20 行的位置”,但它属于 `new` 版本,不是原来的 `old` 行。
66
- 4. 所以系统不会把旧评论自动贴到新内容上。
67
-
68
- 这样做的好处是:避免评论“串行”到语义完全不同的内容上,减少误导。
69
-
70
- 复制出的 prompt 包含 thread id、定位信息和评论内容。thread id 用于让 agent 后续通过 `--comment '{"type":"reply",...}'` 精确回复原评论:
71
-
72
- ```text
73
- [thread:<thread-id>]
74
- 文件路径:行号
75
- 评论内容
76
- ```
77
-
78
- 文件级评论不包含行号:
79
-
80
- ```text
81
- [thread:<thread-id>]
82
- 文件路径
83
- 评论内容
84
- ```
85
-
86
39
  ## CLI 使用方式
87
40
 
88
41
  ```bash
@@ -113,7 +66,7 @@ local-diff-reviewer HEAD~1 HEAD
113
66
  npx skills add Mone-Lee/diff-review
114
67
  ```
115
68
 
116
- skill 会从目标 workspace 运行 `npx local-diff-reviewer [args...]`。
69
+ skill 会从目标 workspace 运行 `npx --yes local-diff-reviewer [args...]`。
117
70
 
118
71
  ### 预置 agent 评论
119
72
 
@@ -122,28 +75,28 @@ CLI 支持重复传入 `--comment <json>`,用于在打开 UI 前把 agent 审
122
75
  代码 diff 行评论:
123
76
 
124
77
  ```bash
125
- npx local-diff-reviewer \
78
+ npx --yes local-diff-reviewer \
126
79
  --comment '{"type":"thread","filePath":"src/foo.ts","position":{"side":"new","line":36},"body":"这里没有处理空数组,可能导致运行时报错。"}'
127
80
  ```
128
81
 
129
82
  Markdown source line 评论:
130
83
 
131
84
  ```bash
132
- npx local-diff-reviewer \
85
+ npx --yes local-diff-reviewer \
133
86
  --comment '{"type":"thread","filePath":"README.md","position":{"type":"markdown","line":22},"body":"这里可以补充 old/new side 的例子。"}'
134
87
  ```
135
88
 
136
89
  文件级评论:
137
90
 
138
91
  ```bash
139
- npx local-diff-reviewer \
92
+ npx --yes local-diff-reviewer \
140
93
  --comment '{"type":"thread","filePath":"src/foo.ts","body":"这个文件的错误处理策略需要统一。"}'
141
94
  ```
142
95
 
143
96
  回复已有 thread:
144
97
 
145
98
  ```bash
146
- npx local-diff-reviewer \
99
+ npx --yes local-diff-reviewer \
147
100
  --comment '{"type":"reply","threadId":"<thread-id>","body":"同意,这里应该按 repoRoot 隔离评论存储。"}'
148
101
  ```
149
102
 
@@ -157,6 +110,24 @@ npx local-diff-reviewer \
157
110
  - `replied`:已有 agent 内容,或从 resolved 重新打开。
158
111
  - `resolved`:用户确认完成后的状态。
159
112
 
113
+ ## 发布流程
114
+
115
+ ```bash
116
+ npm run release
117
+ npm run release minor
118
+ npm run release major
119
+ ```
120
+
121
+ 该命令会按顺序执行:
122
+
123
+ - `npm run release:check`
124
+ - `npm version <patch|minor|major>`(默认 `patch`)
125
+ - `npm publish`
126
+ - `git push`
127
+ - `git push --tags`
128
+
129
+ 只有在 `npm publish` 成功后,才会自动推送提交和标签到 GitHub。
130
+
160
131
  ## 本地开发
161
132
 
162
133
  ```bash
package/SKILL.md CHANGED
@@ -19,13 +19,13 @@ Use this skill when the user asks for `/diff-review`, wants to inspect current w
19
19
  Do not ask the user to run a shell CLI manually. Run the package command from the workspace root:
20
20
 
21
21
  ```bash
22
- npx local-diff-reviewer [args...]
22
+ npx --yes local-diff-reviewer [args...]
23
23
  ```
24
24
 
25
25
  When you have concrete review findings or answers to existing review comments, preload them with one `--comment` JSON argument per comment before launching the viewer:
26
26
 
27
27
  ```bash
28
- npx local-diff-reviewer [args...] \
28
+ npx --yes local-diff-reviewer [args...] \
29
29
  --comment '{"type":"thread","filePath":"src/foo.ts","position":{"side":"new","line":36},"body":"Explain the finding in the user language."}' \
30
30
  --comment '{"type":"reply","threadId":"existing-thread-id","body":"Answer the existing thread as the agent."}'
31
31
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "local-diff-reviewer",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
4
4
  "private": false,
5
5
  "description": "Open a local GitHub-style diff review Web UI for the current repository.",
6
6
  "repository": {
@@ -12,8 +12,11 @@
12
12
  "url": "https://github.com/Mone-Lee/diff-review/issues"
13
13
  },
14
14
  "type": "module",
15
+ "publishConfig": {
16
+ "registry": "https://registry.npmjs.org/"
17
+ },
15
18
  "bin": {
16
- "local-diff-reviewer": "./dist/cli/start.js"
19
+ "local-diff-reviewer": "dist/cli/start.js"
17
20
  },
18
21
  "files": [
19
22
  "dist",
@@ -29,7 +32,8 @@
29
32
  "typecheck": "tsc -p tsconfig.json --noEmit",
30
33
  "skill:check": "node scripts/validate-skill.mjs",
31
34
  "release:check": "node scripts/release-check.mjs",
32
- "prepack": "npm run build"
35
+ "prepack": "npm run build",
36
+ "release": "node scripts/release.mjs"
33
37
  },
34
38
  "dependencies": {
35
39
  "express": "^5.2.1",
@@ -55,4 +59,4 @@
55
59
  "typescript": "^5.9.3",
56
60
  "vite": "^8.0.12"
57
61
  }
58
- }
62
+ }