@0xcraft/powershot 1.1.2 → 1.1.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.
- package/README.md +4 -3
- package/dist/cli/reports.js +4 -6
- package/dist/cli/review-command.js +4 -7
- package/dist/cli/session-command.js +5 -1
- package/dist/github/api.js +198 -0
- package/dist/github/inline-comments.js +3 -154
- package/dist/github/summary-comment.js +149 -0
- package/dist/ground.js +49 -8
- package/dist/langtest.js +93 -1
- package/dist/manifest.js +0 -17
- package/dist/package-smoke.js +4 -0
- package/dist/reinvention.js +109 -0
- package/dist/report/markdown.js +28 -16
- package/dist/report/sarif.js +1 -1
- package/dist/report/summary.js +103 -0
- package/dist/report/terminal.js +18 -11
- package/dist/report/viewer.js +18 -9
- package/dist/selftest.js +594 -22
- package/dist/session.js +6 -2
- package/dist/verifiers/foreign-reinvented.js +72 -26
- package/dist/verifiers/foreign-tokens.js +4 -1
- package/dist/verifiers/reinvented.js +28 -10
- package/docs/architecture.md +2 -1
- package/docs/ci.md +25 -0
- package/examples/github-actions/action.yml +4 -0
- package/package.json +1 -1
package/dist/report/viewer.js
CHANGED
|
@@ -1,20 +1,30 @@
|
|
|
1
|
+
import { modeNote, noFindingsLabel, scopeLine } from './summary.js';
|
|
1
2
|
const escape = (s) => s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
2
3
|
export function viewer(findings, meta) {
|
|
3
4
|
const verified = findings.filter((f) => f.class === 'verified').length;
|
|
4
5
|
const incomplete = meta.state !== 'complete';
|
|
5
|
-
const
|
|
6
|
+
const scope = scopeLine(meta);
|
|
7
|
+
const mode = modeNote(meta);
|
|
6
8
|
const warning = incomplete
|
|
7
9
|
? '<div class="warning"><strong>This review is ' + escape(meta.state) + ' — not a verdict.</strong>' +
|
|
8
10
|
(meta.notLookedAt.length > 0
|
|
9
11
|
? '<ul>' + meta.notLookedAt.map((reason) => '<li>' + escape(reason) + '</li>').join('') + '</ul>'
|
|
10
12
|
: '') + '</div>'
|
|
11
13
|
: '';
|
|
12
|
-
const
|
|
13
|
-
? '<div class="coverage"
|
|
14
|
-
(
|
|
15
|
-
|
|
14
|
+
const context = scope || mode || (meta.scopeDetails?.length ?? 0) > 0
|
|
15
|
+
? '<div class="coverage">' +
|
|
16
|
+
(scope ? '<strong>' + escape(scope) + '</strong>' : '') +
|
|
17
|
+
(mode ? '<p>' + escape(mode) + '</p>' : '') +
|
|
18
|
+
((meta.scopeDetails?.length ?? 0) > 0
|
|
19
|
+
? '<details><summary>' + (meta.coverage === 'portable' ? 'Coverage details' : 'Review scope') + '</summary><ul>' +
|
|
20
|
+
meta.scopeDetails.map((detail) => '<li>' + escape(detail) + '</li>').join('') +
|
|
21
|
+
'</ul></details>'
|
|
16
22
|
: '') + '</div>'
|
|
17
23
|
: '';
|
|
24
|
+
const verdict = findings.length === 0
|
|
25
|
+
? '<p class="none">' +
|
|
26
|
+
(incomplete ? 'No findings from what completed.' : escape(noFindingsLabel(meta)) + '.') + '</p>'
|
|
27
|
+
: '';
|
|
18
28
|
const rows = findings
|
|
19
29
|
.map((f) => {
|
|
20
30
|
const frame = f.frame
|
|
@@ -91,16 +101,15 @@ export function viewer(findings, meta) {
|
|
|
91
101
|
<p class="meta">${escape(meta.target)} · ${escape(meta.started.slice(0, 19).replace('T', ' '))} · session ${escape(meta.id)}<br>
|
|
92
102
|
${findings.length} finding(s) — ${verified} verified, ${findings.length - verified} judged</p>
|
|
93
103
|
${warning}
|
|
94
|
-
${
|
|
104
|
+
${verdict}
|
|
105
|
+
${context}
|
|
95
106
|
<div class="bar">
|
|
96
107
|
<button data-filter="all" aria-pressed="true">all</button>
|
|
97
108
|
<button data-filter="verified" aria-pressed="false">verified</button>
|
|
98
109
|
<button data-filter="judged" aria-pressed="false">judged</button>
|
|
99
110
|
<button id="show-away" aria-pressed="false">show put away</button>
|
|
100
111
|
</div>
|
|
101
|
-
${findings.length === 0
|
|
102
|
-
? '<p class="none">' + (incomplete ? 'No findings from what completed.' : portable ? 'No findings in portable coverage.' : 'No findings.') + '</p>'
|
|
103
|
-
: rows}
|
|
112
|
+
${findings.length === 0 ? '' : rows}
|
|
104
113
|
</div>
|
|
105
114
|
<script>
|
|
106
115
|
// Putting a finding away is per-reader and per-browser on purpose: this page is a
|