md-review-server 0.1.0 → 0.1.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 +79 -3
- package/bin/skill-manager.js +5 -14
- package/package.json +11 -4
- package/server/app.js +5 -1
- package/server/comment-store.js +1 -7
- package/skills/markdown-review-loop/SKILL.md +1 -0
- package/skills/markdown-review-loop/agents/openai.yaml +3 -3
- package/skills/markdown-review-loop/references/review-template.md +3 -0
package/README.md
CHANGED
|
@@ -1,13 +1,55 @@
|
|
|
1
1
|
# md-review-server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/md-review-server)
|
|
4
|
+
[](./LICENSE)
|
|
5
|
+
[](https://github.com/tracyxiong1/md-review-server)
|
|
4
6
|
|
|
5
7
|

|
|
6
8
|
|
|
7
|
-
`md-review-server`
|
|
9
|
+
`md-review-server` 是面向 Codex 文档迭代的本地 Markdown 可视化评审服务。它提供浏览器预览、选区批注、sidecar 评论文件、HTTP API 和内置 `markdown-review-loop` Codex skill,用于把“用户可视化评论 -> agent 读取评论 -> 生成下一版 Markdown -> 回写评论状态”串成一个本地评审循环。
|
|
10
|
+
|
|
11
|
+
## 快速开始
|
|
12
|
+
|
|
13
|
+
### 使用 Codex Skill
|
|
14
|
+
|
|
15
|
+
安装或更新内置 `markdown-review-loop` skill:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npx -y md-review-server@latest skill install
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
检查本机 skill 状态:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npx -y md-review-server@latest skill doctor
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
在 Codex 中显式触发:
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
使用 $markdown-review-loop 帮我启动这份 Markdown 的评审循环。
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
skill 会启动或复用本地 review server,读取 open 评论,生成下一版 Markdown,并通过 HTTP API 回写 `resolved`、`partially_resolved` 或 `unresolved` 状态。
|
|
34
|
+
|
|
35
|
+
### 手动启动 Review Server
|
|
36
|
+
|
|
37
|
+
无需全局安装时可直接运行:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
npx -y md-review-server@latest docs --port 3030 --active-file docs/guide.md
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
也可以全局安装:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
npm install -g md-review-server
|
|
47
|
+
md-review-server docs --port 3030
|
|
48
|
+
```
|
|
8
49
|
|
|
9
50
|
## 功能
|
|
10
51
|
|
|
52
|
+
- 内置 `markdown-review-loop` Codex skill,可通过 npm 安装和更新
|
|
11
53
|
- 按原始结构预览 Markdown 和 MDX 文件
|
|
12
54
|
- 解析并展示 Frontmatter 元数据
|
|
13
55
|
- 对选中文本和指定行范围创建评论
|
|
@@ -26,7 +68,7 @@
|
|
|
26
68
|
npm install -g md-review-server
|
|
27
69
|
```
|
|
28
70
|
|
|
29
|
-
|
|
71
|
+
也可以在仓库中直接运行:
|
|
30
72
|
|
|
31
73
|
```sh
|
|
32
74
|
pnpm install
|
|
@@ -231,6 +273,40 @@ pnpm build
|
|
|
231
273
|
pnpm lint
|
|
232
274
|
```
|
|
233
275
|
|
|
276
|
+
## 发布流程
|
|
277
|
+
|
|
278
|
+
项目使用 GitHub Actions 和 npm Trusted Publishing 发布 npm 包,不需要在 GitHub Secrets 中保存长期 `NPM_TOKEN`。
|
|
279
|
+
|
|
280
|
+
npm 包后台需要配置 Trusted Publisher:
|
|
281
|
+
|
|
282
|
+
- Package:`md-review-server`
|
|
283
|
+
- Publisher:GitHub Actions
|
|
284
|
+
- Owner:`tracyxiong1`
|
|
285
|
+
- Repository:`md-review-server`
|
|
286
|
+
- Workflow filename:`release-please.yml`
|
|
287
|
+
|
|
288
|
+
发布步骤:
|
|
289
|
+
|
|
290
|
+
1. 使用语义化 commit 合并改动到 `main`
|
|
291
|
+
2. `release-please` 自动创建或更新 release PR
|
|
292
|
+
3. 合并 release PR 后,workflow 创建 GitHub Release 和版本 tag
|
|
293
|
+
4. 同一个 workflow 在 tag 对应代码上执行 `lint`、`test`、`build`
|
|
294
|
+
5. 验证 npm 上不存在同版本后,通过 OIDC 发布到 npm
|
|
295
|
+
|
|
296
|
+
也可以手动创建版本 tag 触发同一个发布流程:
|
|
297
|
+
|
|
298
|
+
```sh
|
|
299
|
+
npm version patch
|
|
300
|
+
git push origin main --tags
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
发布完成后可验证:
|
|
304
|
+
|
|
305
|
+
```sh
|
|
306
|
+
npm view md-review-server version --registry=https://registry.npmjs.org/
|
|
307
|
+
npx -y md-review-server@latest skill doctor
|
|
308
|
+
```
|
|
309
|
+
|
|
234
310
|
## License
|
|
235
311
|
|
|
236
312
|
[MIT](./LICENSE)
|
package/bin/skill-manager.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cpSync,
|
|
3
|
-
existsSync,
|
|
4
|
-
mkdirSync,
|
|
5
|
-
readFileSync,
|
|
6
|
-
rmSync,
|
|
7
|
-
writeFileSync,
|
|
8
|
-
} from 'fs';
|
|
1
|
+
import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'fs';
|
|
9
2
|
import { dirname, join, resolve } from 'path';
|
|
10
3
|
|
|
11
4
|
export const SKILL_NAME = 'markdown-review-loop';
|
|
@@ -98,7 +91,9 @@ export function printSkillStatus(status) {
|
|
|
98
91
|
console.log(`Bundled: ${status.bundledVersion || 'missing'}`);
|
|
99
92
|
console.log(`Installed: ${status.installedVersion || 'missing'}`);
|
|
100
93
|
console.log(`Path: ${status.target}`);
|
|
101
|
-
console.log(
|
|
94
|
+
console.log(
|
|
95
|
+
`Status: ${status.upToDate ? 'up to date' : status.installed ? 'update available' : 'not installed'}`,
|
|
96
|
+
);
|
|
102
97
|
}
|
|
103
98
|
|
|
104
99
|
export function printSkillHelp() {
|
|
@@ -115,11 +110,7 @@ Examples:
|
|
|
115
110
|
`);
|
|
116
111
|
}
|
|
117
112
|
|
|
118
|
-
export function handleSkillCommand({
|
|
119
|
-
packageRoot,
|
|
120
|
-
argv,
|
|
121
|
-
env = process.env,
|
|
122
|
-
} = {}) {
|
|
113
|
+
export function handleSkillCommand({ packageRoot, argv, env = process.env } = {}) {
|
|
123
114
|
const subcommand = argv[0] || 'doctor';
|
|
124
115
|
const force = argv.includes('--force');
|
|
125
116
|
const quiet = argv.includes('--quiet');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "md-review-server",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Visual Markdown review server with Codex skill, sidecar comments, and HTTP APIs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"md-review-server": "bin/md-review.js"
|
|
@@ -51,14 +51,21 @@
|
|
|
51
51
|
"keywords": [
|
|
52
52
|
"markdown",
|
|
53
53
|
"review",
|
|
54
|
+
"codex",
|
|
55
|
+
"skill",
|
|
56
|
+
"agent",
|
|
54
57
|
"cli",
|
|
55
58
|
"preview",
|
|
56
59
|
"comments",
|
|
60
|
+
"http-api",
|
|
61
|
+
"sidecar",
|
|
57
62
|
"documentation"
|
|
58
63
|
],
|
|
59
|
-
"author": "
|
|
64
|
+
"author": "tracyxiong1",
|
|
65
|
+
"contributors": [
|
|
66
|
+
"ryo-manba"
|
|
67
|
+
],
|
|
60
68
|
"license": "MIT",
|
|
61
|
-
"funding": "https://github.com/ryo-manba/md-review?sponsor=1",
|
|
62
69
|
"packageManager": "pnpm@10.23.0",
|
|
63
70
|
"dependencies": {
|
|
64
71
|
"@hono/node-server": "^1.19.6",
|
package/server/app.js
CHANGED
|
@@ -137,7 +137,11 @@ export function createApp(options = {}) {
|
|
|
137
137
|
|
|
138
138
|
try {
|
|
139
139
|
const files = await scanMarkdownFiles(baseDir);
|
|
140
|
-
return c.json({
|
|
140
|
+
return c.json({
|
|
141
|
+
files,
|
|
142
|
+
baseDir,
|
|
143
|
+
selectedFile: resolveSelectedFile(files, options.activeFile),
|
|
144
|
+
});
|
|
141
145
|
} catch (err) {
|
|
142
146
|
console.error('Error scanning markdown files:', err.message);
|
|
143
147
|
return jsonError(c, 'Failed to scan markdown files');
|
package/server/comment-store.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { mkdir, readFile, readdir, rename, writeFile } from 'fs/promises';
|
|
2
2
|
import { dirname, extname, isAbsolute, join, resolve } from 'path';
|
|
3
3
|
|
|
4
|
-
const VALID_STATUSES = new Set([
|
|
5
|
-
'open',
|
|
6
|
-
'resolved',
|
|
7
|
-
'partially_resolved',
|
|
8
|
-
'unresolved',
|
|
9
|
-
'ignored',
|
|
10
|
-
]);
|
|
4
|
+
const VALID_STATUSES = new Set(['open', 'resolved', 'partially_resolved', 'unresolved', 'ignored']);
|
|
11
5
|
|
|
12
6
|
function normalizeReviewFile(file) {
|
|
13
7
|
if (!file || typeof file !== 'string') {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
interface:
|
|
2
|
-
display_name:
|
|
3
|
-
short_description:
|
|
4
|
-
default_prompt:
|
|
2
|
+
display_name: 'Markdown 评审循环'
|
|
3
|
+
short_description: '可视化批注、修订并跟踪 Markdown 评审。'
|
|
4
|
+
default_prompt: '使用 $markdown-review-loop 打开可视化 Markdown 评审,收集批注并生成下一版修订稿。'
|
|
@@ -9,6 +9,7 @@ document: docs/example.v1.md
|
|
|
9
9
|
next_version: docs/example.v2.md
|
|
10
10
|
|
|
11
11
|
## C001
|
|
12
|
+
|
|
12
13
|
source: docs/example.v1.md:L42-L48
|
|
13
14
|
quote: "ABase 写入不在 RDS 事务内"
|
|
14
15
|
status: open
|
|
@@ -16,6 +17,7 @@ comment: 需要补充 RDS 与 ABase 一致性边界。
|
|
|
16
17
|
resolution:
|
|
17
18
|
|
|
18
19
|
## C002
|
|
20
|
+
|
|
19
21
|
source: docs/example.v1.md:L77
|
|
20
22
|
quote:
|
|
21
23
|
status: open
|
|
@@ -27,6 +29,7 @@ resolution:
|
|
|
27
29
|
|
|
28
30
|
```md
|
|
29
31
|
## C001
|
|
32
|
+
|
|
30
33
|
source: docs/example.v1.md:L42-L48
|
|
31
34
|
quote: "ABase 写入不在 RDS 事务内"
|
|
32
35
|
status: resolved
|