proof-pr 0.1.11 → 0.1.12
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 +10 -2
- package/dist/index.js +51 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,15 @@ ProofPR 是给开源维护者和工程团队使用的 PR 证据门禁。它在
|
|
|
12
12
|
npx proof-pr@latest --version
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
当前应输出 `0.1.
|
|
15
|
+
当前应输出 `0.1.12`。
|
|
16
|
+
|
|
17
|
+
不知道用哪个功能时:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx proof-pr@latest
|
|
21
|
+
# 或
|
|
22
|
+
npx proof-pr@latest guide
|
|
23
|
+
```
|
|
16
24
|
|
|
17
25
|
初始化配置和 GitHub Action:
|
|
18
26
|
|
|
@@ -49,7 +57,7 @@ npx proof-pr@latest benchmark --cases benchmarks/cases
|
|
|
49
57
|
## GitHub Action
|
|
50
58
|
|
|
51
59
|
```yaml
|
|
52
|
-
- uses: linsk27/proof-pr@v0.1.
|
|
60
|
+
- uses: linsk27/proof-pr@v0.1.12
|
|
53
61
|
with:
|
|
54
62
|
fail-on: high
|
|
55
63
|
comment: "true"
|
package/dist/index.js
CHANGED
|
@@ -25732,7 +25732,13 @@ const build_program = new Command();
|
|
|
25732
25732
|
build_program
|
|
25733
25733
|
.name("proof-pr")
|
|
25734
25734
|
.description("Review pull request evidence, scope, and safety before maintainers spend time on it.")
|
|
25735
|
-
.version("0.1.
|
|
25735
|
+
.version("0.1.12");
|
|
25736
|
+
build_program
|
|
25737
|
+
.command("guide")
|
|
25738
|
+
.description("Show a copy-paste friendly guide for common ProofPR tasks.")
|
|
25739
|
+
.action(() => {
|
|
25740
|
+
process.stdout.write(renderGuide());
|
|
25741
|
+
});
|
|
25736
25742
|
build_program
|
|
25737
25743
|
.command("scan", { isDefault: true })
|
|
25738
25744
|
.description("Scan a git diff and print a ProofPR report.")
|
|
@@ -25781,7 +25787,7 @@ build_program
|
|
|
25781
25787
|
.action(async (options) => {
|
|
25782
25788
|
await writeIfMissing(options.configPath, renderConfigTemplate(options.preset), options.force);
|
|
25783
25789
|
await writeIfMissing(options.workflowPath, renderWorkflowTemplate(options.failOn), options.force);
|
|
25784
|
-
process.stdout.write(`ProofPR initialized.\n\nCreated:\n- ${options.configPath}\n- ${options.workflowPath}\n\nNext:\n1. Commit these files.\n2. Open or update a pull request.\n3. Read the ProofPR comment or Actions summary.\n\nLocal check:\nnpx proof-pr@latest scan --base origin/main --head HEAD --locale zh-CN\n`);
|
|
25790
|
+
process.stdout.write(`ProofPR initialized.\n\nCreated:\n- ${options.configPath}\n- ${options.workflowPath}\n\nNext:\n1. Commit these files.\n2. Open or update a pull request.\n3. Read the ProofPR comment or Actions summary.\n\nLocal check:\nnpx proof-pr@latest scan --base origin/main --head HEAD --locale zh-CN\n\nNeed another task?\nnpx proof-pr@latest guide\n`);
|
|
25785
25791
|
});
|
|
25786
25792
|
build_program
|
|
25787
25793
|
.command("benchmark")
|
|
@@ -25812,11 +25818,52 @@ build_program
|
|
|
25812
25818
|
process.exitCode = 1;
|
|
25813
25819
|
}
|
|
25814
25820
|
});
|
|
25815
|
-
|
|
25821
|
+
const args = process.argv.slice(2);
|
|
25822
|
+
const parseTask = args.length === 0
|
|
25823
|
+
? Promise.resolve(process.stdout.write(renderGuide()))
|
|
25824
|
+
: build_program.parseAsync(process.argv);
|
|
25825
|
+
parseTask.catch((error) => {
|
|
25816
25826
|
const message = error instanceof Error ? error.message : String(error);
|
|
25817
25827
|
process.stderr.write(`ProofPR failed: ${message}\n`);
|
|
25818
25828
|
process.exitCode = 1;
|
|
25819
25829
|
});
|
|
25830
|
+
function renderGuide() {
|
|
25831
|
+
return `ProofPR 功能菜单
|
|
25832
|
+
|
|
25833
|
+
最推荐先做第 1 步。已经接入过的项目,按目标复制下面的命令即可。
|
|
25834
|
+
|
|
25835
|
+
1. 接入 GitHub PR 自动检查
|
|
25836
|
+
npx proof-pr@latest init
|
|
25837
|
+
然后提交 .proofpr.yml 和 .github/workflows/proofpr.yml,打开 PR 后看评论和 Actions summary。
|
|
25838
|
+
|
|
25839
|
+
2. 本地检查当前分支
|
|
25840
|
+
npx proof-pr@latest scan --base origin/main --head HEAD --locale zh-CN
|
|
25841
|
+
适合在发 PR 前先看风险、证据评分和 Review 行动清单。
|
|
25842
|
+
|
|
25843
|
+
3. 生成可分享 HTML 报告
|
|
25844
|
+
npx proof-pr@latest scan --base origin/main --head HEAD --locale zh-CN --format html --output proofpr-report.html
|
|
25845
|
+
生成后用浏览器打开 proofpr-report.html。
|
|
25846
|
+
|
|
25847
|
+
4. 生成 GitHub Code Scanning 的 SARIF
|
|
25848
|
+
npx proof-pr@latest scan --base origin/main --head HEAD --format sarif --output proofpr.sarif
|
|
25849
|
+
适合在 CI 里配合 github/codeql-action/upload-sarif 使用。
|
|
25850
|
+
|
|
25851
|
+
5. 试跑内置风险案例
|
|
25852
|
+
npx proof-pr@latest scan --diff-file examples/cases/workflow-untrusted-checkout.diff --locale zh-CN
|
|
25853
|
+
不需要改项目代码,也能快速看到 ProofPR 会抓什么风险。
|
|
25854
|
+
|
|
25855
|
+
6. 验证规则样本是否仍然命中
|
|
25856
|
+
npx proof-pr@latest benchmark --cases benchmarks/cases
|
|
25857
|
+
适合维护 ProofPR 规则或发版前回归。
|
|
25858
|
+
|
|
25859
|
+
7. 调整审查强度
|
|
25860
|
+
打开 .proofpr.yml,把 preset 改成 security-strict、dependency-careful 或 mcp-security。
|
|
25861
|
+
|
|
25862
|
+
结果在哪里看:
|
|
25863
|
+
- GitHub Action:PR Conversation 评论、Actions summary、Checks 状态。
|
|
25864
|
+
- 本地 CLI:终端输出;如果用了 --output,就看写出的 HTML / JSON / SARIF / Markdown 文件。
|
|
25865
|
+
`;
|
|
25866
|
+
}
|
|
25820
25867
|
async function readGitDiff(base, head) {
|
|
25821
25868
|
const args = ["diff", "--no-ext-diff", "--unified=0"];
|
|
25822
25869
|
if (base) {
|
|
@@ -25878,7 +25925,7 @@ jobs:
|
|
|
25878
25925
|
runs-on: ubuntu-latest
|
|
25879
25926
|
steps:
|
|
25880
25927
|
- uses: actions/checkout@v4
|
|
25881
|
-
- uses: linsk27/proof-pr@v0.1.
|
|
25928
|
+
- uses: linsk27/proof-pr@v0.1.12
|
|
25882
25929
|
with:
|
|
25883
25930
|
fail-on: ${failOn}
|
|
25884
25931
|
comment: "true"
|