proof-pr 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 +14 -4
- package/dist/index.js +19 -68
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,12 +6,22 @@ ProofPR 是给开源维护者和工程团队使用的 PR 证据门禁。它在
|
|
|
6
6
|
|
|
7
7
|
## 快速使用
|
|
8
8
|
|
|
9
|
+
确认 latest 版本:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx proof-pr@latest --version
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
当前应输出 `0.1.11`。
|
|
16
|
+
|
|
9
17
|
初始化配置和 GitHub Action:
|
|
10
18
|
|
|
11
19
|
```bash
|
|
12
|
-
npx proof-pr@latest init
|
|
20
|
+
npx proof-pr@latest init
|
|
13
21
|
```
|
|
14
22
|
|
|
23
|
+
这个命令会生成 `.proofpr.yml` 和 `.github/workflows/proofpr.yml`,提交后打开 PR 即可看到报告。
|
|
24
|
+
|
|
15
25
|
本地扫描当前分支:
|
|
16
26
|
|
|
17
27
|
```bash
|
|
@@ -27,7 +37,7 @@ npx proof-pr@latest scan --diff-file examples/cases/workflow-untrusted-checkout.
|
|
|
27
37
|
生成独立 HTML 可视化报告:
|
|
28
38
|
|
|
29
39
|
```bash
|
|
30
|
-
npx proof-pr@latest scan --base origin/main --head HEAD --locale zh-CN --format html
|
|
40
|
+
npx proof-pr@latest scan --base origin/main --head HEAD --locale zh-CN --format html --output proofpr-report.html
|
|
31
41
|
```
|
|
32
42
|
|
|
33
43
|
运行 benchmark:
|
|
@@ -39,7 +49,7 @@ npx proof-pr@latest benchmark --cases benchmarks/cases
|
|
|
39
49
|
## GitHub Action
|
|
40
50
|
|
|
41
51
|
```yaml
|
|
42
|
-
- uses: linsk27/proof-pr@v0.1.
|
|
52
|
+
- uses: linsk27/proof-pr@v0.1.11
|
|
43
53
|
with:
|
|
44
54
|
fail-on: high
|
|
45
55
|
comment: "true"
|
|
@@ -52,7 +62,7 @@ npx proof-pr@latest benchmark --cases benchmarks/cases
|
|
|
52
62
|
- 证据评分:0-100 分。
|
|
53
63
|
- Review 门禁:正常 review、重点 review、先补证据、风险处理前不要合并。
|
|
54
64
|
- Review 行动清单:维护者可直接执行的 checklist。
|
|
55
|
-
- 可选输出:GitHub annotations、SARIF、benchmark report、独立 HTML
|
|
65
|
+
- 可选输出:GitHub annotations、SARIF、benchmark report、独立 HTML 可视化报告;CLI 可用 `--output` 直接写文件。
|
|
56
66
|
|
|
57
67
|
## 常用预设
|
|
58
68
|
|
package/dist/index.js
CHANGED
|
@@ -23726,14 +23726,13 @@ function renderHtmlReport(result, locale = "en") {
|
|
|
23726
23726
|
<h2>${labels.reviewPlan}</h2>
|
|
23727
23727
|
<div class="action-list">
|
|
23728
23728
|
${result.reviewPlan.actionItems.length > 0
|
|
23729
|
-
? result.reviewPlan.actionItems.map((action) =>
|
|
23730
|
-
<div class="action">
|
|
23729
|
+
? result.reviewPlan.actionItems.map((action) => `<div class="action">
|
|
23731
23730
|
<span class="box"></span>
|
|
23732
23731
|
<div>
|
|
23733
23732
|
<div class="action-title">${escapeHtml(localizeActionTitle(action.actionId, action.title, locale))}<span class="priority">${escapeHtml(formatPriority(action.priority, locale))}</span></div>
|
|
23734
23733
|
<div class="muted">${escapeHtml(localizeActionDetail(action.actionId, action.detail, locale))}</div>
|
|
23735
23734
|
</div>
|
|
23736
|
-
</div>`).join("\n")
|
|
23735
|
+
</div>`).join("\n ")
|
|
23737
23736
|
: `<div class="muted">${labels.noActions}</div>`}
|
|
23738
23737
|
</div>
|
|
23739
23738
|
</article>
|
|
@@ -23752,11 +23751,10 @@ function renderHtmlReport(result, locale = "en") {
|
|
|
23752
23751
|
<h2>${labels.focusFiles}</h2>
|
|
23753
23752
|
<div class="focus-list">
|
|
23754
23753
|
${result.reviewPlan.focusFiles.length > 0
|
|
23755
|
-
? result.reviewPlan.focusFiles.map((file) =>
|
|
23756
|
-
<div class="focus">
|
|
23754
|
+
? result.reviewPlan.focusFiles.map((file) => `<div class="focus">
|
|
23757
23755
|
<div><code>${escapeHtml(file.path)}</code></div>
|
|
23758
23756
|
<div class="muted">${escapeHtml(localizeFocusReason(file.reasonId, file.reason, locale))}</div>
|
|
23759
|
-
</div>`).join("\n")
|
|
23757
|
+
</div>`).join("\n ")
|
|
23760
23758
|
: `<div class="muted">${labels.noFocusFiles}</div>`}
|
|
23761
23759
|
</div>
|
|
23762
23760
|
</article>
|
|
@@ -23765,11 +23763,10 @@ function renderHtmlReport(result, locale = "en") {
|
|
|
23765
23763
|
<h2>${labels.scoreDetails}</h2>
|
|
23766
23764
|
<div class="deduction-list">
|
|
23767
23765
|
${result.evidenceScore.deductions.length > 0
|
|
23768
|
-
? result.evidenceScore.deductions.map((deduction) =>
|
|
23769
|
-
<div class="deduction">
|
|
23766
|
+
? result.evidenceScore.deductions.map((deduction) => `<div class="deduction">
|
|
23770
23767
|
<strong>-${deduction.points}</strong>
|
|
23771
23768
|
<div class="muted">${escapeHtml(localizeDeduction(deduction.reasonId, deduction.message, locale))}</div>
|
|
23772
|
-
</div>`).join("\n")
|
|
23769
|
+
</div>`).join("\n ")
|
|
23773
23770
|
: `<div class="muted">${labels.noDeductions}</div>`}
|
|
23774
23771
|
</div>
|
|
23775
23772
|
</article>
|
|
@@ -25735,7 +25732,7 @@ const build_program = new Command();
|
|
|
25735
25732
|
build_program
|
|
25736
25733
|
.name("proof-pr")
|
|
25737
25734
|
.description("Review pull request evidence, scope, and safety before maintainers spend time on it.")
|
|
25738
|
-
.version("0.1.
|
|
25735
|
+
.version("0.1.11");
|
|
25739
25736
|
build_program
|
|
25740
25737
|
.command("scan", { isDefault: true })
|
|
25741
25738
|
.description("Scan a git diff and print a ProofPR report.")
|
|
@@ -25747,6 +25744,7 @@ build_program
|
|
|
25747
25744
|
.option("--pr-body-file <path>", "Read a pull request body from a Markdown file.")
|
|
25748
25745
|
.option("--config <path>", "Path to .proofpr.yml.", ".proofpr.yml")
|
|
25749
25746
|
.option("--format <format>", "Output format: markdown, json, sarif, or html.", parseFormat, "markdown")
|
|
25747
|
+
.option("--output <path>", "Write report output to a file instead of stdout.")
|
|
25750
25748
|
.option("--locale <locale>", "Report language: en or zh-CN.")
|
|
25751
25749
|
.option("--fail-on <level>", "Exit with code 1 on risk level: low, medium, high, or never.", parseFailLevel, "never")
|
|
25752
25750
|
.action(async (options) => {
|
|
@@ -25761,7 +25759,13 @@ build_program
|
|
|
25761
25759
|
const result = scanDiff(diffText, { config, pullRequest });
|
|
25762
25760
|
const locale = parseLocale(options.locale, config.locale);
|
|
25763
25761
|
const output = renderOutput(result, options.format, locale);
|
|
25764
|
-
|
|
25762
|
+
if (options.output) {
|
|
25763
|
+
await writeOutput(options.output, `${output}\n`);
|
|
25764
|
+
process.stdout.write(`ProofPR ${options.format} report written to ${options.output}\n`);
|
|
25765
|
+
}
|
|
25766
|
+
else {
|
|
25767
|
+
process.stdout.write(`${output}\n`);
|
|
25768
|
+
}
|
|
25765
25769
|
if (riskMeetsThreshold(result.risk, options.failOn)) {
|
|
25766
25770
|
process.exitCode = 1;
|
|
25767
25771
|
}
|
|
@@ -25777,7 +25781,7 @@ build_program
|
|
|
25777
25781
|
.action(async (options) => {
|
|
25778
25782
|
await writeIfMissing(options.configPath, renderConfigTemplate(options.preset), options.force);
|
|
25779
25783
|
await writeIfMissing(options.workflowPath, renderWorkflowTemplate(options.failOn), options.force);
|
|
25780
|
-
process.stdout.write(`ProofPR initialized:\n- ${options.configPath}\n- ${options.workflowPath}\n`);
|
|
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`);
|
|
25781
25785
|
});
|
|
25782
25786
|
build_program
|
|
25783
25787
|
.command("benchmark")
|
|
@@ -25854,61 +25858,8 @@ preset: ${preset}
|
|
|
25854
25858
|
comment:
|
|
25855
25859
|
enabled: true
|
|
25856
25860
|
|
|
25857
|
-
#
|
|
25858
|
-
#
|
|
25859
|
-
#
|
|
25860
|
-
# 可用预设:
|
|
25861
|
-
# - balanced
|
|
25862
|
-
# - open-source-maintainer
|
|
25863
|
-
# - security-strict
|
|
25864
|
-
# - ai-generated-pr
|
|
25865
|
-
# - mcp-security
|
|
25866
|
-
# - dependency-careful
|
|
25867
|
-
#
|
|
25868
|
-
# 也可以取消注释下面这些字段,覆盖 preset 的默认值。
|
|
25869
|
-
# riskThreshold: high
|
|
25870
|
-
#
|
|
25871
|
-
# sensitivePaths:
|
|
25872
|
-
# - ".github/workflows/**"
|
|
25873
|
-
# - ".github/actions/**"
|
|
25874
|
-
# - "**/.env*"
|
|
25875
|
-
# - "**/mcp*.json"
|
|
25876
|
-
# - "**/*mcp*.json"
|
|
25877
|
-
# - "Dockerfile"
|
|
25878
|
-
# - "**/Dockerfile"
|
|
25879
|
-
# - "package.json"
|
|
25880
|
-
# - "pnpm-lock.yaml"
|
|
25881
|
-
# - "package-lock.json"
|
|
25882
|
-
# - "yarn.lock"
|
|
25883
|
-
# - "bun.lockb"
|
|
25884
|
-
#
|
|
25885
|
-
# requireTests:
|
|
25886
|
-
# enabled: true
|
|
25887
|
-
# paths:
|
|
25888
|
-
# - "src/**"
|
|
25889
|
-
# - "packages/**/src/**"
|
|
25890
|
-
# - "app/**"
|
|
25891
|
-
# - "lib/**"
|
|
25892
|
-
#
|
|
25893
|
-
# secrets:
|
|
25894
|
-
# enabled: true
|
|
25895
|
-
#
|
|
25896
|
-
# dependencies:
|
|
25897
|
-
# flagNewPackages: true
|
|
25898
|
-
# flagMajorUpgrades: true
|
|
25899
|
-
# flagLifecycleScripts: true
|
|
25900
|
-
#
|
|
25901
|
-
# evidence:
|
|
25902
|
-
# contracts:
|
|
25903
|
-
# - id: ui-screenshot
|
|
25904
|
-
# title: UI changes need screenshots
|
|
25905
|
-
# paths:
|
|
25906
|
-
# - "src/components/**"
|
|
25907
|
-
# - "app/**"
|
|
25908
|
-
# requires:
|
|
25909
|
-
# - screenshot
|
|
25910
|
-
# - verification
|
|
25911
|
-
# severity: medium
|
|
25861
|
+
# 想更严格时,把 preset 改成 security-strict / dependency-careful / mcp-security。
|
|
25862
|
+
# 详细配置见 docs/configuration.md。
|
|
25912
25863
|
`;
|
|
25913
25864
|
}
|
|
25914
25865
|
function renderWorkflowTemplate(failOn) {
|
|
@@ -25927,7 +25878,7 @@ jobs:
|
|
|
25927
25878
|
runs-on: ubuntu-latest
|
|
25928
25879
|
steps:
|
|
25929
25880
|
- uses: actions/checkout@v4
|
|
25930
|
-
- uses: linsk27/proof-pr@v0.1.
|
|
25881
|
+
- uses: linsk27/proof-pr@v0.1.11
|
|
25931
25882
|
with:
|
|
25932
25883
|
fail-on: ${failOn}
|
|
25933
25884
|
comment: "true"
|