@prism-d1/cli 1.1.2 → 1.3.0
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/dist/assets/github-workflows/prism-agent-eval.yml +2 -1
- package/dist/assets/github-workflows/prism-eval-gate-kiro.yml +12 -2
- package/dist/assets/gitlab-workflows/prism-eval-gate.yml +8 -0
- package/dist/assets/infra/bin/app.ts +61 -37
- package/dist/assets/infra/lib/constructs/otel-collector-construct.ts +96 -0
- package/dist/assets/infra/lib/constructs/security-agent-construct.ts +35 -30
- package/dist/assets/infra/lib/dashboard-stack.ts +27 -0
- package/dist/assets/infra/lib/lambda/otel-receiver.ts +278 -8
- package/dist/assets/infra/lib/lambda/pricing/litellm-snapshot.json +3769 -0
- package/dist/assets/infra/lib/lambda/pricing/price-source.ts +56 -0
- package/dist/assets/infra/lib/lambda/pricing/price-table.ts +240 -0
- package/dist/assets/infra/lib/lambda/pricing/prices-key.ts +6 -0
- package/dist/assets/infra/lib/lambda/pricing/reprice.ts +108 -0
- package/dist/assets/infra/lib/lambda/pricing-refresh.ts +352 -0
- package/dist/assets/infra/lib/lambda/velocity-widget.ts +124 -1
- package/dist/assets/infra/lib/metrics-pipeline-stack.ts +2 -110
- package/dist/assets/infra/lib/security-agent-resources.ts +136 -0
- package/dist/assets/infra/lib/security-agent-stack.ts +69 -0
- package/dist/assets/infra/package.json +4 -1
- package/dist/assets/metric-hooks/prepare-commit-msg +3 -1
- package/dist/assets/pentest-cdk/bin/app.ts +12 -0
- package/dist/assets/pentest-cdk/cdk.json +7 -0
- package/dist/assets/pentest-cdk/lib/pentest-target-stack.ts +206 -0
- package/dist/assets/pentest-cdk/package.json +18 -0
- package/dist/assets/pentest-cdk/tsconfig.json +12 -0
- package/dist/src/codewatch/config.d.ts +17 -0
- package/dist/src/codewatch/config.d.ts.map +1 -0
- package/dist/src/codewatch/config.js +40 -0
- package/dist/src/codewatch/config.js.map +1 -0
- package/dist/src/codewatch/gitleaks.d.ts +49 -0
- package/dist/src/codewatch/gitleaks.d.ts.map +1 -0
- package/dist/src/codewatch/gitleaks.js +160 -0
- package/dist/src/codewatch/gitleaks.js.map +1 -0
- package/dist/src/codewatch/globalHooks.d.ts +52 -0
- package/dist/src/codewatch/globalHooks.d.ts.map +1 -0
- package/dist/src/codewatch/globalHooks.js +235 -0
- package/dist/src/codewatch/globalHooks.js.map +1 -0
- package/dist/src/codewatch/hooks.d.ts +38 -0
- package/dist/src/codewatch/hooks.d.ts.map +1 -0
- package/dist/src/codewatch/hooks.js +176 -0
- package/dist/src/codewatch/hooks.js.map +1 -0
- package/dist/src/codewatch/prepush.d.ts +37 -0
- package/dist/src/codewatch/prepush.d.ts.map +1 -0
- package/dist/src/codewatch/prepush.js +231 -0
- package/dist/src/codewatch/prepush.js.map +1 -0
- package/dist/src/codewatch/results.d.ts +210 -0
- package/dist/src/codewatch/results.d.ts.map +1 -0
- package/dist/src/codewatch/results.js +127 -0
- package/dist/src/codewatch/results.js.map +1 -0
- package/dist/src/codewatch/reviewers/claude.d.ts +9 -0
- package/dist/src/codewatch/reviewers/claude.d.ts.map +1 -0
- package/dist/src/codewatch/reviewers/claude.js +48 -0
- package/dist/src/codewatch/reviewers/claude.js.map +1 -0
- package/dist/src/codewatch/reviewers/index.d.ts +39 -0
- package/dist/src/codewatch/reviewers/index.d.ts.map +1 -0
- package/dist/src/codewatch/reviewers/index.js +97 -0
- package/dist/src/codewatch/reviewers/index.js.map +1 -0
- package/dist/src/codewatch/reviewers/kiro.d.ts +14 -0
- package/dist/src/codewatch/reviewers/kiro.d.ts.map +1 -0
- package/dist/src/codewatch/reviewers/kiro.js +32 -0
- package/dist/src/codewatch/reviewers/kiro.js.map +1 -0
- package/dist/src/codewatch/reviewers/types.d.ts +56 -0
- package/dist/src/codewatch/reviewers/types.d.ts.map +1 -0
- package/dist/src/codewatch/reviewers/types.js +91 -0
- package/dist/src/codewatch/reviewers/types.js.map +1 -0
- package/dist/src/codewatch/rules.d.ts +12 -0
- package/dist/src/codewatch/rules.d.ts.map +1 -0
- package/dist/src/codewatch/rules.js +27 -0
- package/dist/src/codewatch/rules.js.map +1 -0
- package/dist/src/commands/_top/dashboard.d.ts +17 -0
- package/dist/src/commands/_top/dashboard.d.ts.map +1 -0
- package/dist/src/commands/_top/dashboard.js +76 -0
- package/dist/src/commands/_top/dashboard.js.map +1 -0
- package/dist/src/commands/_top/version.d.ts +62 -0
- package/dist/src/commands/_top/version.d.ts.map +1 -0
- package/dist/src/commands/_top/version.js +175 -0
- package/dist/src/commands/_top/version.js.map +1 -0
- package/dist/src/commands/bedrock-protection/scan-account.d.ts.map +1 -1
- package/dist/src/commands/bedrock-protection/scan-account.js +2 -1
- package/dist/src/commands/bedrock-protection/scan-account.js.map +1 -1
- package/dist/src/commands/bedrock-protection/scan-org.d.ts.map +1 -1
- package/dist/src/commands/bedrock-protection/scan-org.js +16 -4
- package/dist/src/commands/bedrock-protection/scan-org.js.map +1 -1
- package/dist/src/commands/bootstrapper/install-eval-harness.d.ts.map +1 -1
- package/dist/src/commands/bootstrapper/install-eval-harness.js +15 -48
- package/dist/src/commands/bootstrapper/install-eval-harness.js.map +1 -1
- package/dist/src/commands/bootstrapper/install-git-hooks.d.ts +13 -0
- package/dist/src/commands/bootstrapper/install-git-hooks.d.ts.map +1 -1
- package/dist/src/commands/bootstrapper/install-git-hooks.js +28 -147
- package/dist/src/commands/bootstrapper/install-git-hooks.js.map +1 -1
- package/dist/src/commands/bootstrapper/setup-otel-sync.d.ts +12 -6
- package/dist/src/commands/bootstrapper/setup-otel-sync.d.ts.map +1 -1
- package/dist/src/commands/bootstrapper/setup-otel-sync.js +18 -443
- package/dist/src/commands/bootstrapper/setup-otel-sync.js.map +1 -1
- package/dist/src/commands/codewatch/pre-commit.d.ts +7 -0
- package/dist/src/commands/codewatch/pre-commit.d.ts.map +1 -0
- package/dist/src/commands/codewatch/pre-commit.js +30 -0
- package/dist/src/commands/codewatch/pre-commit.js.map +1 -0
- package/dist/src/commands/codewatch/pre-push.d.ts +16 -0
- package/dist/src/commands/codewatch/pre-push.d.ts.map +1 -0
- package/dist/src/commands/codewatch/pre-push.js +32 -0
- package/dist/src/commands/codewatch/pre-push.js.map +1 -0
- package/dist/src/commands/codewatch/report.d.ts +22 -0
- package/dist/src/commands/codewatch/report.d.ts.map +1 -0
- package/dist/src/commands/codewatch/report.js +64 -0
- package/dist/src/commands/codewatch/report.js.map +1 -0
- package/dist/src/commands/enable/codeburn.d.ts +59 -0
- package/dist/src/commands/enable/codeburn.d.ts.map +1 -0
- package/dist/src/commands/enable/codeburn.js +531 -0
- package/dist/src/commands/enable/codeburn.js.map +1 -0
- package/dist/src/commands/enable/codewatch.d.ts +15 -0
- package/dist/src/commands/enable/codewatch.d.ts.map +1 -0
- package/dist/src/commands/enable/codewatch.js +186 -0
- package/dist/src/commands/enable/codewatch.js.map +1 -0
- package/dist/src/commands/enable/security.d.ts +41 -0
- package/dist/src/commands/enable/security.d.ts.map +1 -0
- package/dist/src/commands/enable/security.js +130 -0
- package/dist/src/commands/enable/security.js.map +1 -0
- package/dist/src/commands/export/otel.d.ts +31 -0
- package/dist/src/commands/export/otel.d.ts.map +1 -0
- package/dist/src/commands/export/otel.js +52 -0
- package/dist/src/commands/export/otel.js.map +1 -0
- package/dist/src/commands/git/claude-session-context.d.ts.map +1 -1
- package/dist/src/commands/git/claude-session-context.js +2 -1
- package/dist/src/commands/git/claude-session-context.js.map +1 -1
- package/dist/src/commands/git/commit-trailers.js +1 -1
- package/dist/src/commands/git/commit-trailers.js.map +1 -1
- package/dist/src/commands/security/code-review.d.ts +22 -0
- package/dist/src/commands/security/code-review.d.ts.map +1 -0
- package/dist/src/commands/security/code-review.js +43 -0
- package/dist/src/commands/security/code-review.js.map +1 -0
- package/dist/src/commands/security/findings.d.ts +15 -0
- package/dist/src/commands/security/findings.d.ts.map +1 -0
- package/dist/src/commands/security/findings.js +31 -0
- package/dist/src/commands/security/findings.js.map +1 -0
- package/dist/src/commands/security/pentest.d.ts +18 -0
- package/dist/src/commands/security/pentest.d.ts.map +1 -0
- package/dist/src/commands/security/pentest.js +32 -0
- package/dist/src/commands/security/pentest.js.map +1 -0
- package/dist/src/commands/security/threat-model.d.ts +16 -0
- package/dist/src/commands/security/threat-model.d.ts.map +1 -0
- package/dist/src/commands/security/threat-model.js +24 -0
- package/dist/src/commands/security/threat-model.js.map +1 -0
- package/dist/src/commands/security/threats.d.ts +12 -0
- package/dist/src/commands/security/threats.d.ts.map +1 -0
- package/dist/src/commands/security/threats.js +23 -0
- package/dist/src/commands/security/threats.js.map +1 -0
- package/dist/src/commands/securityagent/setup.d.ts +19 -5
- package/dist/src/commands/securityagent/setup.d.ts.map +1 -1
- package/dist/src/commands/securityagent/setup.js +25 -189
- package/dist/src/commands/securityagent/setup.js.map +1 -1
- package/dist/src/commands/workshop/verify-setup.d.ts.map +1 -1
- package/dist/src/commands/workshop/verify-setup.js +5 -3
- package/dist/src/commands/workshop/verify-setup.js.map +1 -1
- package/dist/src/dashboard/codewatch.d.ts +106 -0
- package/dist/src/dashboard/codewatch.d.ts.map +1 -0
- package/dist/src/dashboard/codewatch.js +120 -0
- package/dist/src/dashboard/codewatch.js.map +1 -0
- package/dist/src/dashboard/commits.d.ts +96 -0
- package/dist/src/dashboard/commits.d.ts.map +1 -0
- package/dist/src/dashboard/commits.js +207 -0
- package/dist/src/dashboard/commits.js.map +1 -0
- package/dist/src/dashboard/page.d.ts +10 -0
- package/dist/src/dashboard/page.d.ts.map +1 -0
- package/dist/src/dashboard/page.js +470 -0
- package/dist/src/dashboard/page.js.map +1 -0
- package/dist/src/dashboard/payload.d.ts +114 -0
- package/dist/src/dashboard/payload.d.ts.map +1 -0
- package/dist/src/dashboard/payload.js +96 -0
- package/dist/src/dashboard/payload.js.map +1 -0
- package/dist/src/dashboard/report.d.ts +99 -0
- package/dist/src/dashboard/report.d.ts.map +1 -0
- package/dist/src/dashboard/report.js +300 -0
- package/dist/src/dashboard/report.js.map +1 -0
- package/dist/src/dashboard/repos.d.ts +58 -0
- package/dist/src/dashboard/repos.d.ts.map +1 -0
- package/dist/src/dashboard/repos.js +111 -0
- package/dist/src/dashboard/repos.js.map +1 -0
- package/dist/src/dashboard/security.d.ts +130 -0
- package/dist/src/dashboard/security.d.ts.map +1 -0
- package/dist/src/dashboard/security.js +144 -0
- package/dist/src/dashboard/security.js.map +1 -0
- package/dist/src/dashboard/server.d.ts +52 -0
- package/dist/src/dashboard/server.d.ts.map +1 -0
- package/dist/src/dashboard/server.js +163 -0
- package/dist/src/dashboard/server.js.map +1 -0
- package/dist/src/dashboard/setup.d.ts +67 -0
- package/dist/src/dashboard/setup.d.ts.map +1 -0
- package/dist/src/dashboard/setup.js +146 -0
- package/dist/src/dashboard/setup.js.map +1 -0
- package/dist/src/dashboard/usage.d.ts +43 -0
- package/dist/src/dashboard/usage.d.ts.map +1 -0
- package/dist/src/dashboard/usage.js +88 -0
- package/dist/src/dashboard/usage.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +48 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/security/cfn-diff.d.ts +57 -0
- package/dist/src/security/cfn-diff.d.ts.map +1 -0
- package/dist/src/security/cfn-diff.js +112 -0
- package/dist/src/security/cfn-diff.js.map +1 -0
- package/dist/src/security/errors.d.ts +45 -0
- package/dist/src/security/errors.d.ts.map +1 -0
- package/dist/src/security/errors.js +116 -0
- package/dist/src/security/errors.js.map +1 -0
- package/dist/src/security/marker.d.ts +46 -0
- package/dist/src/security/marker.d.ts.map +1 -0
- package/dist/src/security/marker.js +120 -0
- package/dist/src/security/marker.js.map +1 -0
- package/dist/src/security/pentest-dockerfile.d.ts +8 -0
- package/dist/src/security/pentest-dockerfile.d.ts.map +1 -0
- package/dist/src/security/pentest-dockerfile.js +163 -0
- package/dist/src/security/pentest-dockerfile.js.map +1 -0
- package/dist/src/security/pentest.d.ts +233 -0
- package/dist/src/security/pentest.d.ts.map +1 -0
- package/dist/src/security/pentest.js +1057 -0
- package/dist/src/security/pentest.js.map +1 -0
- package/dist/src/security/repo.d.ts +25 -0
- package/dist/src/security/repo.d.ts.map +1 -0
- package/dist/src/security/repo.js +38 -0
- package/dist/src/security/repo.js.map +1 -0
- package/dist/src/security/review.d.ts +202 -0
- package/dist/src/security/review.d.ts.map +1 -0
- package/dist/src/security/review.js +706 -0
- package/dist/src/security/review.js.map +1 -0
- package/dist/src/security/setup.d.ts +193 -0
- package/dist/src/security/setup.d.ts.map +1 -0
- package/dist/src/security/setup.js +728 -0
- package/dist/src/security/setup.js.map +1 -0
- package/dist/src/security/threat-model.d.ts +133 -0
- package/dist/src/security/threat-model.d.ts.map +1 -0
- package/dist/src/security/threat-model.js +653 -0
- package/dist/src/security/threat-model.js.map +1 -0
- package/dist/src/utils/audit-bedrock.d.ts +1 -0
- package/dist/src/utils/audit-bedrock.d.ts.map +1 -1
- package/dist/src/utils/audit-bedrock.js +133 -0
- package/dist/src/utils/audit-bedrock.js.map +1 -1
- package/dist/src/utils/audit-org.d.ts +1 -0
- package/dist/src/utils/audit-org.d.ts.map +1 -1
- package/dist/src/utils/audit-org.js +155 -0
- package/dist/src/utils/audit-org.js.map +1 -1
- package/dist/src/utils/exec.d.ts +6 -0
- package/dist/src/utils/exec.d.ts.map +1 -1
- package/dist/src/utils/exec.js +12 -1
- package/dist/src/utils/exec.js.map +1 -1
- package/dist/src/utils/otel-sync-schedule.d.ts +41 -0
- package/dist/src/utils/otel-sync-schedule.d.ts.map +1 -0
- package/dist/src/utils/otel-sync-schedule.js +90 -0
- package/dist/src/utils/otel-sync-schedule.js.map +1 -0
- package/dist/src/utils/tool-check.d.ts +14 -0
- package/dist/src/utils/tool-check.d.ts.map +1 -0
- package/dist/src/utils/tool-check.js +42 -0
- package/dist/src/utils/tool-check.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one data document behind both `prism-cli dashboard --json` and the
|
|
3
|
+
* web UI's /api/data, so the two can never disagree. The overview rows are
|
|
4
|
+
* sorted here, not in the page, so `--json` carries the same order.
|
|
5
|
+
*/
|
|
6
|
+
import { collectCodewatch, combineSecretScanning } from './codewatch.js';
|
|
7
|
+
import { discoverRepos } from './repos.js';
|
|
8
|
+
import { codewatchSetup, GLOBAL_FORCE_CMD, GLOBAL_INSTALL_CMD, machineChecks, securitySetup } from './setup.js';
|
|
9
|
+
import { globalStatus } from '../codewatch/globalHooks.js';
|
|
10
|
+
import { findOnPath } from '../utils/tool-check.js';
|
|
11
|
+
import { homedir } from 'node:os';
|
|
12
|
+
import { sep } from 'node:path';
|
|
13
|
+
export function tildeHome(p, home) {
|
|
14
|
+
if (p === home)
|
|
15
|
+
return '~';
|
|
16
|
+
return p.startsWith(home + sep) ? '~' + p.slice(home.length) : p;
|
|
17
|
+
}
|
|
18
|
+
import { collectUsage } from './usage.js';
|
|
19
|
+
import { collectSecurity } from './security.js';
|
|
20
|
+
export const PAYLOAD_SCHEMA = 'prism.dashboard.v2';
|
|
21
|
+
/** Minimum missing repos before the global install is suggested; one repo is served by its own fix line. */
|
|
22
|
+
export const SUGGEST_GLOBAL_MIN_MISSING = 2;
|
|
23
|
+
export function globalSuggestion(g, missing) {
|
|
24
|
+
if (g.state === 'installed' || missing < SUGGEST_GLOBAL_MIN_MISSING)
|
|
25
|
+
return null;
|
|
26
|
+
if (g.state === 'elsewhere') {
|
|
27
|
+
return {
|
|
28
|
+
id: 'codewatch-global', style: 'warn', command: GLOBAL_FORCE_CMD, missing, currentHooksPath: g.hooksPath,
|
|
29
|
+
reason: `${missing} repos don't have codewatch. Your global core.hooksPath is set to ${g.hooksPath}, so --global alone would refuse; --force saves that value and still runs its hooks after codewatch.`,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
id: 'codewatch-global', style: 'info', command: GLOBAL_INSTALL_CMD, missing, currentHooksPath: null,
|
|
34
|
+
reason: `${missing} repos don't have codewatch. Cover all of them at once.`,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const byName = (a, b) => a.name.localeCompare(b.name) || a.path.localeCompare(b.path);
|
|
38
|
+
const STATUS_ORDER = { ok: 0, warn: 1, missing: 2, 'opted-out': 3 };
|
|
39
|
+
/** The current repo first, then installed, bypassed (warn), missing and opted-out repos, each by name. */
|
|
40
|
+
export function sortSetupRows(rows) {
|
|
41
|
+
return [...rows].sort((a, b) => Number(b.current) - Number(a.current) || STATUS_ORDER[a.status] - STATUS_ORDER[b.status] || byName(a, b));
|
|
42
|
+
}
|
|
43
|
+
/** Most high findings first, then medium, then low, then by name. */
|
|
44
|
+
export function sortCodewatchRows(rows) {
|
|
45
|
+
return [...rows].sort((a, b) => b.high - a.high || b.medium - a.medium || b.low - a.low || byName(a, b));
|
|
46
|
+
}
|
|
47
|
+
export async function buildPayload(opts) {
|
|
48
|
+
const d = discoverRepos(opts);
|
|
49
|
+
const usage = await collectUsage({ exporter: opts.exporter, pathEnv: opts.pathEnv });
|
|
50
|
+
const gitleaksAvailable = findOnPath('gitleaks', opts.pathEnv) !== null;
|
|
51
|
+
const g = globalStatus(opts.home || homedir());
|
|
52
|
+
const repos = d.repos.map((r) => ({
|
|
53
|
+
name: r.name,
|
|
54
|
+
path: r.path,
|
|
55
|
+
current: r.current,
|
|
56
|
+
hasPrism: r.hasPrism,
|
|
57
|
+
codewatch: collectCodewatch(r.path, opts.trendRuns, gitleaksAvailable),
|
|
58
|
+
setup: codewatchSetup(r.path, { pathEnv: opts.pathEnv, global: g }),
|
|
59
|
+
security: securitySetup(r.path),
|
|
60
|
+
}));
|
|
61
|
+
const setupRows = sortSetupRows(repos.map((r) => ({
|
|
62
|
+
name: r.name, path: r.path, current: r.current, status: r.setup.status, reviewer: r.setup.reviewer, detail: r.setup.detail, fix: r.setup.fix,
|
|
63
|
+
global: r.setup.global,
|
|
64
|
+
security: r.security,
|
|
65
|
+
// Bypassed repos (warn) need attention, so they stay visible.
|
|
66
|
+
collapsed: !r.current && (r.setup.status === 'missing' || r.setup.status === 'opted-out'),
|
|
67
|
+
})));
|
|
68
|
+
// The summary lists only repos where codewatch is installed or has left
|
|
69
|
+
// results; the rest have nothing to summarize and appear in the setup list.
|
|
70
|
+
const active = repos.filter((r) => r.setup.status === 'ok' || r.codewatch.hasResults);
|
|
71
|
+
const cwRows = sortCodewatchRows(active.map((r) => ({
|
|
72
|
+
name: r.name, path: r.path, current: r.current,
|
|
73
|
+
high: r.codewatch.bySeverity.high, medium: r.codewatch.bySeverity.medium, low: r.codewatch.bySeverity.low,
|
|
74
|
+
lastRunAt: r.codewatch.lastRunAt,
|
|
75
|
+
lastReviewId: r.codewatch.lastReviewId,
|
|
76
|
+
reviewer: r.codewatch.lastReviewer ?? r.setup.reviewer,
|
|
77
|
+
unscannedCommits: r.codewatch.secretScanning.unscannedCommits,
|
|
78
|
+
gitleaksWarning: r.codewatch.secretScanning.unscannedCommits > 0,
|
|
79
|
+
})));
|
|
80
|
+
return {
|
|
81
|
+
schema: PAYLOAD_SCHEMA,
|
|
82
|
+
generated_at: new Date().toISOString(),
|
|
83
|
+
scope: { root: d.scannedRoot, root_display: tildeHome(d.scannedRoot, opts.home || homedir()), current_repo: d.currentRepo, scan_ms: d.scanMs, truncated: d.truncated, error: d.error },
|
|
84
|
+
repos,
|
|
85
|
+
overview: { counts: { repos: repos.length, codewatch: setupRows.filter((r) => r.status === 'ok').length }, setup: setupRows, codewatch: cwRows },
|
|
86
|
+
machine: {
|
|
87
|
+
setup: machineChecks({ pathEnv: opts.pathEnv, global: g, ...opts.machineDeps }),
|
|
88
|
+
globalHooks: g,
|
|
89
|
+
secretScanning: combineSecretScanning(repos.map((r) => r.codewatch.secretScanning), gitleaksAvailable),
|
|
90
|
+
},
|
|
91
|
+
suggestions: [globalSuggestion(g, setupRows.filter((r) => r.status === 'missing').length)].filter((x) => x !== null),
|
|
92
|
+
usage,
|
|
93
|
+
security: collectSecurity(repos),
|
|
94
|
+
};
|
|
95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CAAC;YAC/E,WAAW,EAAE,CAAC;YACd,cAAc,EAAE,qBAAqB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,iBAAiB,CAAC;SACvG;QACD,WAAW,EAAE,CAAC,gBAAgB,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAmB,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC;QACrI,KAAK;QACL,QAAQ,EAAE,eAAe,CAAC,KAAK,CAAC;KACjC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { type PrismResult, type ResultEntry, type Severity } from '../codewatch/results.js';
|
|
2
|
+
import { Blamer, type CommitFinding, type LogEntry, type SecretScanState } from './commits.js';
|
|
3
|
+
/** The listing entry whose id equals `id`, or null. Unknown, malformed and traversal ids all return null. */
|
|
4
|
+
export declare function findResultById(repoRoot: string, id: string, entries?: ResultEntry[]): ResultEntry | null;
|
|
5
|
+
/** Newest review entries, newest first. */
|
|
6
|
+
export declare function reviewEntries(entries: ResultEntry[]): ResultEntry[];
|
|
7
|
+
export interface ReportCommit {
|
|
8
|
+
sha: string;
|
|
9
|
+
short: string;
|
|
10
|
+
subject: string | null;
|
|
11
|
+
authorDate: string | null;
|
|
12
|
+
secretScan: SecretScanState;
|
|
13
|
+
secretScanReason: string | null;
|
|
14
|
+
high: number;
|
|
15
|
+
medium: number;
|
|
16
|
+
low: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ReportFinding extends CommitFinding {
|
|
19
|
+
commit: string | null;
|
|
20
|
+
commitSubject: string | null;
|
|
21
|
+
}
|
|
22
|
+
export interface ReportBlock {
|
|
23
|
+
at: string;
|
|
24
|
+
branch: string | null;
|
|
25
|
+
/** rule id and location only; never the secret. */
|
|
26
|
+
items: {
|
|
27
|
+
rule: string;
|
|
28
|
+
file: string;
|
|
29
|
+
line: number | null;
|
|
30
|
+
}[];
|
|
31
|
+
}
|
|
32
|
+
export interface ScanReport {
|
|
33
|
+
schema: 'prism.codewatch.report.v1';
|
|
34
|
+
id: string;
|
|
35
|
+
repo: {
|
|
36
|
+
name: string;
|
|
37
|
+
path: string;
|
|
38
|
+
};
|
|
39
|
+
branch: string | null;
|
|
40
|
+
upstream: string | null;
|
|
41
|
+
range: {
|
|
42
|
+
base: string | null;
|
|
43
|
+
tip: string;
|
|
44
|
+
commits: number;
|
|
45
|
+
};
|
|
46
|
+
reviewer: {
|
|
47
|
+
tool: string;
|
|
48
|
+
version: string | null;
|
|
49
|
+
model: string | null;
|
|
50
|
+
};
|
|
51
|
+
startedAt: string;
|
|
52
|
+
finishedAt: string;
|
|
53
|
+
durationSeconds: number | null;
|
|
54
|
+
status: PrismResult['status'];
|
|
55
|
+
/** Display state: findings, clean, error or skipped. */
|
|
56
|
+
state: 'findings' | 'clean' | 'error' | 'skipped';
|
|
57
|
+
reason: string | null;
|
|
58
|
+
score: number | null;
|
|
59
|
+
truncated: boolean;
|
|
60
|
+
summary: string | null;
|
|
61
|
+
totals: {
|
|
62
|
+
severity: Record<Severity, number>;
|
|
63
|
+
category: {
|
|
64
|
+
security: number;
|
|
65
|
+
quality: number;
|
|
66
|
+
};
|
|
67
|
+
findings: number;
|
|
68
|
+
};
|
|
69
|
+
files: {
|
|
70
|
+
file: string;
|
|
71
|
+
findings: ReportFinding[];
|
|
72
|
+
}[];
|
|
73
|
+
secretScans: ReportCommit[];
|
|
74
|
+
gitleaksBlocks: ReportBlock[];
|
|
75
|
+
commits: ReportCommit[];
|
|
76
|
+
}
|
|
77
|
+
/** Resolves `--commit <sha>`: the newest review whose range includes it (prefix match allowed). */
|
|
78
|
+
export declare function reviewForCommit(entries: ResultEntry[], sha: string, log: Map<string, LogEntry>): ResultEntry | null;
|
|
79
|
+
export declare function buildReport(repoRoot: string, entry: ResultEntry, all: ResultEntry[], deps?: {
|
|
80
|
+
log?: Map<string, LogEntry>;
|
|
81
|
+
blamer?: Blamer;
|
|
82
|
+
}): ScanReport;
|
|
83
|
+
export declare function renderReportJson(r: ScanReport): string;
|
|
84
|
+
export declare function renderReportMarkdown(r: ScanReport): string;
|
|
85
|
+
export declare function escapeHtml(s: unknown): string;
|
|
86
|
+
export interface HtmlOptions {
|
|
87
|
+
/** CSP nonce for the inline style, when served by the dashboard. */
|
|
88
|
+
nonce?: string;
|
|
89
|
+
/** Show the back and Download Markdown links (served page only). */
|
|
90
|
+
links?: {
|
|
91
|
+
back: string;
|
|
92
|
+
markdown: string;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/** Self-contained HTML: inline CSS, no script, every value escaped. */
|
|
96
|
+
export declare function renderReportHtml(r: ScanReport, opts?: HtmlOptions): string;
|
|
97
|
+
/** Finds `id` in any of `repos` and builds its report; null when unknown or not a review. */
|
|
98
|
+
export declare function reportFromRepos(repos: string[], id: string): ScanReport | null;
|
|
99
|
+
//# sourceMappingURL=report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../src/dashboard/report.ts"],"names":[],"mappings":"AAWA,OAAO,EAAmC,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7H,OAAO,EAAqB,MAAM,EAAwC,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAKxJ,6GAA6G;AAC7G,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,EAAE,GAAG,WAAW,GAAG,IAAI,CAGxG;AAKD,2CAA2C;AAC3C,wBAAgB,aAAa,CAAC,OAAO,EAA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QAAQ,CAAC,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,UAAU,CA2E7J;AAcD,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,CAEtD;AAOD,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,CAuC1D;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAE7C;AA6BD,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C;AAED,uEAAuE;AACvE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,GAAE,WAAgB,GAAG,MAAM,CA4D9E;AAED,6FAA6F;AAC7F,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAS9E"}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scan report: one pre-push review plus the pre-commit secret scans of the
|
|
3
|
+
* commits it covers. One module builds the data and renders it three ways,
|
|
4
|
+
* shared by GET /report/<id>, GET /report/<id>.md and `prism-cli codewatch report`.
|
|
5
|
+
*
|
|
6
|
+
* Ids are result file names without `.json`. They are only ever looked up in
|
|
7
|
+
* the directory listing of `.prism/results/`; no path is built from one.
|
|
8
|
+
* Secret values never appear: results do not store them, and the secret
|
|
9
|
+
* section projects rule id and location only.
|
|
10
|
+
*/
|
|
11
|
+
import { basename } from 'node:path';
|
|
12
|
+
import { readResultEntries } from '../codewatch/results.js';
|
|
13
|
+
import { attributeFindings, Blamer, collectCommits, expandRange, readLog } from './commits.js';
|
|
14
|
+
/** Shape of a result id. Checked before the listing lookup, which is what actually decides. */
|
|
15
|
+
const ID_SHAPE = /^[A-Za-z0-9_-]{1,120}$/;
|
|
16
|
+
/** The listing entry whose id equals `id`, or null. Unknown, malformed and traversal ids all return null. */
|
|
17
|
+
export function findResultById(repoRoot, id, entries) {
|
|
18
|
+
if (typeof id !== 'string' || !ID_SHAPE.test(id))
|
|
19
|
+
return null;
|
|
20
|
+
return (entries ?? readResultEntries(repoRoot)).find((e) => e.id === id) ?? null;
|
|
21
|
+
}
|
|
22
|
+
const isReview = (r) => r.kind === 'review' && r.hook === 'pre-push';
|
|
23
|
+
const byTime = (a, b) => String(a.result.started_at).localeCompare(String(b.result.started_at));
|
|
24
|
+
/** Newest review entries, newest first. */
|
|
25
|
+
export function reviewEntries(entries) {
|
|
26
|
+
return entries.filter((e) => isReview(e.result) && e.result.commit).sort(byTime).reverse();
|
|
27
|
+
}
|
|
28
|
+
const SEV_ORDER = { high: 0, medium: 1, low: 2 };
|
|
29
|
+
/** Resolves `--commit <sha>`: the newest review whose range includes it (prefix match allowed). */
|
|
30
|
+
export function reviewForCommit(entries, sha, log) {
|
|
31
|
+
const want = sha.toLowerCase();
|
|
32
|
+
for (const e of reviewEntries(entries)) {
|
|
33
|
+
if (e.result.status === 'skipped')
|
|
34
|
+
continue;
|
|
35
|
+
const tip = e.result.commit;
|
|
36
|
+
if (tip.startsWith(want))
|
|
37
|
+
return e;
|
|
38
|
+
if (expandRange(log, e.result.base, tip).some((c) => c.startsWith(want)))
|
|
39
|
+
return e;
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
export function buildReport(repoRoot, entry, all, deps = {}) {
|
|
44
|
+
const rev = entry.result;
|
|
45
|
+
if (!isReview(rev) || !rev.commit)
|
|
46
|
+
throw new Error('not a pre-push review');
|
|
47
|
+
const log = deps.log ?? readLog(repoRoot);
|
|
48
|
+
const blamer = deps.blamer ?? new Blamer(repoRoot);
|
|
49
|
+
const pushed = rev.status !== 'skipped';
|
|
50
|
+
const { range, byCommit } = pushed ? attributeFindings(rev, log, blamer) : { range: [], byCommit: new Map() };
|
|
51
|
+
const subj = (sha) => (sha ? log.get(sha)?.subject ?? null : null);
|
|
52
|
+
// Findings with their commit, grouped by file, worst first.
|
|
53
|
+
const findings = [];
|
|
54
|
+
for (const [sha, fs] of byCommit)
|
|
55
|
+
for (const f of fs)
|
|
56
|
+
findings.push({ ...f, commit: sha, commitSubject: subj(sha) });
|
|
57
|
+
if (!pushed)
|
|
58
|
+
for (const f of rev.findings || [])
|
|
59
|
+
findings.push({ ...f, attributed: 'tip', inPushOf: null, commit: null, commitSubject: null });
|
|
60
|
+
const groups = new Map();
|
|
61
|
+
for (const f of findings) {
|
|
62
|
+
const k = f.file || '(no file)';
|
|
63
|
+
if (!groups.has(k))
|
|
64
|
+
groups.set(k, []);
|
|
65
|
+
groups.get(k).push(f);
|
|
66
|
+
}
|
|
67
|
+
const files = [...groups.entries()].map(([file, fs]) => ({
|
|
68
|
+
file,
|
|
69
|
+
findings: fs.sort((a, b) => SEV_ORDER[a.severity] - SEV_ORDER[b.severity] || (a.line ?? 0) - (b.line ?? 0)),
|
|
70
|
+
}));
|
|
71
|
+
const worst = (fs) => Math.min(...fs.map((f) => SEV_ORDER[f.severity]));
|
|
72
|
+
files.sort((a, b) => worst(a.findings) - worst(b.findings) || b.findings.length - a.findings.length || a.file.localeCompare(b.file));
|
|
73
|
+
const severity = { high: 0, medium: 0, low: 0 };
|
|
74
|
+
const category = { security: 0, quality: 0 };
|
|
75
|
+
for (const f of findings) {
|
|
76
|
+
severity[f.severity]++;
|
|
77
|
+
category[f.category]++;
|
|
78
|
+
}
|
|
79
|
+
// Secret scan state per commit, from the same matching the Commits table uses.
|
|
80
|
+
const rows = collectCommits(repoRoot, all.map((e) => e.result), { log, blamer, maxRows: Number.MAX_SAFE_INTEGER });
|
|
81
|
+
const rowBy = new Map(rows.rows.map((r) => [r.sha, r]));
|
|
82
|
+
const commits = range.map((sha) => {
|
|
83
|
+
const fs = byCommit.get(sha) || [];
|
|
84
|
+
const r = rowBy.get(sha);
|
|
85
|
+
return {
|
|
86
|
+
sha, short: sha.slice(0, 8), subject: subj(sha), authorDate: log.get(sha)?.authorDate ?? null,
|
|
87
|
+
secretScan: r?.secretScan.state ?? 'none', secretScanReason: r?.secretScan.reason ?? null,
|
|
88
|
+
high: fs.filter((f) => f.severity === 'high').length,
|
|
89
|
+
medium: fs.filter((f) => f.severity === 'medium').length,
|
|
90
|
+
low: fs.filter((f) => f.severity === 'low').length,
|
|
91
|
+
};
|
|
92
|
+
}).sort((a, b) => String(b.authorDate ?? '').localeCompare(String(a.authorDate ?? '')));
|
|
93
|
+
// Gitleaks blocks on this branch during the push window: after the previous
|
|
94
|
+
// review of this branch, up to this one.
|
|
95
|
+
const prev = reviewEntries(all).find((e) => e.result.branch === rev.branch && e.result.started_at < rev.started_at);
|
|
96
|
+
const from = prev ? prev.result.started_at : '';
|
|
97
|
+
const gitleaksBlocks = all.map((e) => e.result)
|
|
98
|
+
.filter((r) => r.kind === 'secrets' && r.hook === 'pre-commit' && r.status === 'findings' && r.branch === rev.branch && r.started_at > from && r.started_at <= rev.started_at)
|
|
99
|
+
.sort((a, b) => a.started_at.localeCompare(b.started_at))
|
|
100
|
+
.map((r) => ({ at: r.started_at, branch: r.branch, items: (r.findings || []).map((f) => ({ rule: f.rule, file: f.file, line: f.line })) }));
|
|
101
|
+
const started = Date.parse(rev.started_at);
|
|
102
|
+
const finished = Date.parse(rev.finished_at);
|
|
103
|
+
const state = rev.status === 'error' ? 'error' : rev.status === 'skipped' ? 'skipped' : findings.length ? 'findings' : 'clean';
|
|
104
|
+
return {
|
|
105
|
+
schema: 'prism.codewatch.report.v1',
|
|
106
|
+
id: entry.id,
|
|
107
|
+
repo: { name: basename(repoRoot), path: repoRoot },
|
|
108
|
+
branch: rev.branch, upstream: rev.upstream,
|
|
109
|
+
range: { base: rev.base, tip: rev.commit, commits: range.length },
|
|
110
|
+
reviewer: { tool: rev.tool, version: rev.tool_version, model: rev.model },
|
|
111
|
+
startedAt: rev.started_at, finishedAt: rev.finished_at,
|
|
112
|
+
durationSeconds: Number.isFinite(started) && Number.isFinite(finished) ? Math.max(0, Math.round((finished - started) / 1000)) : null,
|
|
113
|
+
status: rev.status, state, reason: rev.reason, score: rev.score,
|
|
114
|
+
truncated: /diff truncated/i.test(rev.reason || ''),
|
|
115
|
+
summary: rev.summary,
|
|
116
|
+
totals: { severity, category, findings: findings.length },
|
|
117
|
+
files,
|
|
118
|
+
secretScans: commits,
|
|
119
|
+
gitleaksBlocks,
|
|
120
|
+
commits,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
// ---------------------------------------------------------------- renderers
|
|
124
|
+
const SCAN_TEXT = {
|
|
125
|
+
ok: 'ok', 'not-scanned': 'not scanned', 'no-verify': 'no-verify', flagged: 'secrets found', none: 'no record',
|
|
126
|
+
};
|
|
127
|
+
const short = (s) => (s ? s.slice(0, 8) : '-');
|
|
128
|
+
const oneLine = (s) => String(s ?? '').replace(/\s+/g, ' ').trim();
|
|
129
|
+
const loc = (f) => (f.line ? `line ${f.line}` : 'no line');
|
|
130
|
+
const counts = (c) => `${c.high} high, ${c.medium} medium, ${c.low} low`;
|
|
131
|
+
const dur = (s) => (s === null ? '-' : s < 60 ? `${s}s` : `${Math.floor(s / 60)}m ${s % 60}s`);
|
|
132
|
+
export function renderReportJson(r) {
|
|
133
|
+
return JSON.stringify(r, null, 2) + '\n';
|
|
134
|
+
}
|
|
135
|
+
/** Markdown: escapes the characters that would change structure inside list items and code spans. */
|
|
136
|
+
function md(s) {
|
|
137
|
+
return oneLine(s).replace(/([\\`*_[\]<>|#])/g, '\\$1');
|
|
138
|
+
}
|
|
139
|
+
export function renderReportMarkdown(r) {
|
|
140
|
+
const L = [];
|
|
141
|
+
L.push(`# Codewatch scan report: ${md(r.repo.name)}`, '');
|
|
142
|
+
if (r.truncated)
|
|
143
|
+
L.push(`> **Warning:** the diff was truncated before review, so later changes were not reviewed. (${md(r.reason)})`, '');
|
|
144
|
+
L.push(`- **Status:** ${r.state}${r.state === 'error' || r.state === 'skipped' ? ` (${md(r.reason)})` : ''}`);
|
|
145
|
+
L.push(`- **Branch:** ${md(r.branch ?? '-')}${r.upstream ? ` (against ${md(r.upstream)})` : ''}`);
|
|
146
|
+
L.push(`- **Pushed range:** ${short(r.range.base)}..${short(r.range.tip)} (${r.range.commits} commit${r.range.commits === 1 ? '' : 's'})`);
|
|
147
|
+
L.push(`- **Reviewer:** ${md(r.reviewer.tool)}${r.reviewer.model ? ` / ${md(r.reviewer.model)}` : ''}${r.reviewer.version ? ` (${md(r.reviewer.version)})` : ''}`);
|
|
148
|
+
L.push(`- **Started:** ${r.startedAt} · **Finished:** ${r.finishedAt} · **Duration:** ${dur(r.durationSeconds)}`);
|
|
149
|
+
if (r.score !== null)
|
|
150
|
+
L.push(`- **Score:** ${r.score}`);
|
|
151
|
+
L.push(`- **Report id:** ${md(r.id)}`, '');
|
|
152
|
+
L.push('## Summary', '', r.summary ? md(r.summary) : '_No summary._', '');
|
|
153
|
+
L.push('## Totals', '');
|
|
154
|
+
L.push(`- **By severity:** ${counts(r.totals.severity)}`);
|
|
155
|
+
L.push(`- **By category:** ${r.totals.category.security} security, ${r.totals.category.quality} quality`, '');
|
|
156
|
+
L.push('## Findings by file', '');
|
|
157
|
+
if (!r.files.length)
|
|
158
|
+
L.push('_No findings._', '');
|
|
159
|
+
for (const g of r.files) {
|
|
160
|
+
L.push(`### ${md(g.file)}`, '');
|
|
161
|
+
for (const f of g.findings) {
|
|
162
|
+
const who = f.commit ? `${short(f.commit)} "${md(f.commitSubject ?? '')}"${f.inPushOf ? ' (in push of tip; blame could not place this line)' : ''}` : 'not attributed';
|
|
163
|
+
L.push(`- **${f.severity}** · ${f.category} · ${loc(f)} · ${md(f.rule)} · commit ${who}`);
|
|
164
|
+
L.push(` ${md(f.message)}`);
|
|
165
|
+
}
|
|
166
|
+
L.push('');
|
|
167
|
+
}
|
|
168
|
+
L.push('## Secret scan', '');
|
|
169
|
+
if (!r.secretScans.length)
|
|
170
|
+
L.push('_No commits in range._');
|
|
171
|
+
for (const c of r.secretScans)
|
|
172
|
+
L.push(`- ${c.short} ${md(c.subject ?? '(no longer in history)')}: **${SCAN_TEXT[c.secretScan]}**${c.secretScanReason && c.secretScan !== 'ok' ? ` (${md(c.secretScanReason)})` : ''}`);
|
|
173
|
+
L.push('');
|
|
174
|
+
L.push('### Gitleaks blocks during this push', '');
|
|
175
|
+
if (!r.gitleaksBlocks.length)
|
|
176
|
+
L.push('_None._');
|
|
177
|
+
for (const b of r.gitleaksBlocks)
|
|
178
|
+
L.push(`- ${b.at}: ${b.items.map((i) => `${md(i.rule)} at ${md(i.file)}${i.line ? `:${i.line}` : ''}`).join('; ')}`);
|
|
179
|
+
L.push('');
|
|
180
|
+
L.push('## Commits', '');
|
|
181
|
+
if (!r.commits.length)
|
|
182
|
+
L.push('_No commits in range._');
|
|
183
|
+
for (const c of r.commits)
|
|
184
|
+
L.push(`- ${c.short} ${md(c.subject ?? '(no longer in history)')}${c.authorDate ? ` (${c.authorDate})` : ''}: ${counts(c)}`);
|
|
185
|
+
L.push('');
|
|
186
|
+
return L.join('\n');
|
|
187
|
+
}
|
|
188
|
+
export function escapeHtml(s) {
|
|
189
|
+
return String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
190
|
+
}
|
|
191
|
+
const REPORT_CSS = `
|
|
192
|
+
:root { color-scheme: light dark; --bg:#f7f7f8; --card:#fff; --text:#1d1d1f; --muted:#6b6b73; --line:#e3e3e8; --high:#cf222e; --medium:#9a6700; --low:#57606a; --ok:#1a7f37; --warn:#9a6700; --accent:#0969da; }
|
|
193
|
+
@media (prefers-color-scheme: dark) { :root { --bg:#0d1117; --card:#161b22; --text:#e6edf3; --muted:#8b949e; --line:#30363d; --high:#f85149; --medium:#d29922; --low:#8b949e; --ok:#3fb950; --warn:#d29922; --accent:#58a6ff; } }
|
|
194
|
+
* { box-sizing: border-box; }
|
|
195
|
+
body { margin:0; background:var(--bg); color:var(--text); font:14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif; }
|
|
196
|
+
main { max-width:1100px; margin:0 auto; padding:20px; }
|
|
197
|
+
nav { margin-bottom:12px; font-size:13px; } nav a { color:var(--accent); margin-right:14px; }
|
|
198
|
+
section { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:14px 18px; margin-bottom:14px; }
|
|
199
|
+
h1 { font-size:20px; margin:0 0 8px; } h2 { font-size:15px; margin:0 0 10px; } h3 { font-size:13px; margin:14px 0 6px; } h3.file { font-family: ui-monospace, Menlo, monospace; }
|
|
200
|
+
dl { display:grid; grid-template-columns: max-content 1fr; gap:4px 16px; margin:0; } dt { color:var(--muted); } dd { margin:0; overflow-wrap:anywhere; }
|
|
201
|
+
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size:12px; }
|
|
202
|
+
table { width:100%; border-collapse:collapse; font-size:13px; } th, td { text-align:left; padding:5px 6px; border-bottom:1px solid var(--line); vertical-align:top; overflow-wrap:anywhere; } th { color:var(--muted); white-space:nowrap; }
|
|
203
|
+
.sev-high, .sev-medium, .sev-low { white-space:nowrap; } .sev-high { color:var(--high); font-weight:600; } .sev-medium { color:var(--medium); font-weight:600; } .sev-low { color:var(--low); }
|
|
204
|
+
.state { display:inline-block; padding:0 8px; border-radius:10px; border:1px solid currentColor; font-size:12px; font-weight:600; }
|
|
205
|
+
.s-findings, .s-error { color:var(--high); } .s-clean { color:var(--ok); } .s-skipped { color:var(--muted); }
|
|
206
|
+
.alert { border:1px solid var(--warn); border-left-width:4px; border-radius:6px; padding:10px 12px; margin:10px 0; font-weight:600; }
|
|
207
|
+
.muted { color:var(--muted); } .totals { display:flex; gap:24px; flex-wrap:wrap; } .totals b { font-size:20px; display:block; }
|
|
208
|
+
.summary { white-space:pre-wrap; }
|
|
209
|
+
@media print {
|
|
210
|
+
:root { --bg:#fff; --card:#fff; --text:#000; --muted:#444; --line:#bbb; }
|
|
211
|
+
body { font-size:11pt; } main { max-width:none; padding:0; } nav { display:none; }
|
|
212
|
+
section { border:none; border-radius:0; padding:0; margin:0 0 14pt; break-inside:avoid-page; }
|
|
213
|
+
table { page-break-inside:auto; } tr { break-inside:avoid; }
|
|
214
|
+
a { color:inherit; text-decoration:none; }
|
|
215
|
+
}
|
|
216
|
+
`;
|
|
217
|
+
/** Self-contained HTML: inline CSS, no script, every value escaped. */
|
|
218
|
+
export function renderReportHtml(r, opts = {}) {
|
|
219
|
+
const e = escapeHtml;
|
|
220
|
+
const nonce = opts.nonce ? ` nonce="${e(opts.nonce)}"` : '';
|
|
221
|
+
const rows = (cells) => cells.map((c) => `<tr>${c.map((x) => `<td>${x}</td>`).join('')}</tr>`).join('');
|
|
222
|
+
const sev = (s) => `<span class="sev-${s}">${s}</span>`;
|
|
223
|
+
const p = [];
|
|
224
|
+
p.push(`<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">`);
|
|
225
|
+
p.push(`<title>Codewatch report: ${e(r.repo.name)} ${e(short(r.range.tip))}</title><style${nonce}>${REPORT_CSS}</style></head><body><main>`);
|
|
226
|
+
if (opts.links)
|
|
227
|
+
p.push(`<nav><a href="${e(opts.links.back)}">← Dashboard</a><a href="${e(opts.links.markdown)}" download>Download Markdown</a><span class="muted">Print to PDF from the browser's Print dialog.</span></nav>`);
|
|
228
|
+
p.push(`<section><h1>Codewatch scan report: ${e(r.repo.name)}</h1>`);
|
|
229
|
+
if (r.truncated)
|
|
230
|
+
p.push(`<div class="alert" role="alert">The diff was truncated before review, so later changes were not reviewed. ${e(r.reason)}</div>`);
|
|
231
|
+
p.push('<dl>');
|
|
232
|
+
const dd = (k, v) => p.push(`<dt>${k}</dt><dd>${v}</dd>`);
|
|
233
|
+
dd('Status', `<span class="state s-${e(r.state)}">${e(r.state)}</span>${r.state === 'error' || r.state === 'skipped' ? ` ${e(r.reason)}` : ''}`);
|
|
234
|
+
dd('Branch', `${e(r.branch ?? '-')}${r.upstream ? ` <span class="muted">against ${e(r.upstream)}</span>` : ''}`);
|
|
235
|
+
dd('Pushed range', `<code>${e(short(r.range.base))}..${e(short(r.range.tip))}</code> (${r.range.commits} commit${r.range.commits === 1 ? '' : 's'})`);
|
|
236
|
+
dd('Reviewer', `${e(r.reviewer.tool)}${r.reviewer.model ? ` / ${e(r.reviewer.model)}` : ''}${r.reviewer.version ? ` <span class="muted">${e(r.reviewer.version)}</span>` : ''}`);
|
|
237
|
+
dd('Started', e(r.startedAt));
|
|
238
|
+
dd('Finished', `${e(r.finishedAt)} <span class="muted">(${e(dur(r.durationSeconds))})</span>`);
|
|
239
|
+
if (r.score !== null)
|
|
240
|
+
dd('Score', e(r.score));
|
|
241
|
+
dd('Repository', `<code>${e(r.repo.path)}</code>`);
|
|
242
|
+
p.push('</dl></section>');
|
|
243
|
+
p.push(`<section><h2>Summary</h2><p class="summary">${r.summary ? e(r.summary) : '<span class="muted">No summary.</span>'}</p></section>`);
|
|
244
|
+
const t = r.totals;
|
|
245
|
+
p.push(`<section><h2>Totals</h2><div class="totals">`
|
|
246
|
+
+ `<div><b class="sev-high">${t.severity.high}</b>high</div><div><b class="sev-medium">${t.severity.medium}</b>medium</div><div><b class="sev-low">${t.severity.low}</b>low</div>`
|
|
247
|
+
+ `<div><b>${t.category.security}</b>security</div><div><b>${t.category.quality}</b>quality</div></div></section>`);
|
|
248
|
+
p.push('<section><h2>Findings by file</h2>');
|
|
249
|
+
if (!r.files.length)
|
|
250
|
+
p.push('<p class="muted">No findings.</p>');
|
|
251
|
+
for (const g of r.files) {
|
|
252
|
+
p.push(`<h3 class="file">${e(g.file)}</h3><table><thead><tr><th>Severity</th><th>Category</th><th>Line</th><th>Rule</th><th>Message</th><th>Commit</th></tr></thead><tbody>`);
|
|
253
|
+
p.push(rows(g.findings.map((f) => [
|
|
254
|
+
sev(f.severity), e(f.category), e(f.line ?? '-'), e(f.rule), e(f.message),
|
|
255
|
+
f.commit ? `<code>${e(short(f.commit))}</code> ${e(f.commitSubject ?? '')}${f.inPushOf ? '<br><span class="muted">in push of tip; blame could not place this line</span>' : ''}` : '<span class="muted">not attributed</span>',
|
|
256
|
+
])));
|
|
257
|
+
p.push('</tbody></table>');
|
|
258
|
+
}
|
|
259
|
+
p.push('</section>');
|
|
260
|
+
p.push('<section><h2>Secret scan</h2>');
|
|
261
|
+
if (!r.secretScans.length)
|
|
262
|
+
p.push('<p class="muted">No commits in range.</p>');
|
|
263
|
+
else
|
|
264
|
+
p.push(`<table><thead><tr><th>Commit</th><th>Subject</th><th>Pre-commit scan</th></tr></thead><tbody>${rows(r.secretScans.map((c) => [
|
|
265
|
+
`<code>${e(c.short)}</code>`, e(c.subject ?? '(no longer in history)'),
|
|
266
|
+
`${e(SCAN_TEXT[c.secretScan])}${c.secretScanReason && c.secretScan !== 'ok' ? `<br><span class="muted">${e(c.secretScanReason)}</span>` : ''}`,
|
|
267
|
+
]))}</tbody></table>`);
|
|
268
|
+
p.push('<h3>Gitleaks blocks during this push</h3>');
|
|
269
|
+
if (!r.gitleaksBlocks.length)
|
|
270
|
+
p.push('<p class="muted">None.</p>');
|
|
271
|
+
else
|
|
272
|
+
p.push(`<table><thead><tr><th>When</th><th>Rule</th><th>Location</th></tr></thead><tbody>${rows(r.gitleaksBlocks.flatMap((b) => b.items.map((i) => [
|
|
273
|
+
e(b.at), e(i.rule), `<code>${e(i.file)}${i.line ? `:${e(i.line)}` : ''}</code>`
|
|
274
|
+
])))}</tbody></table>`);
|
|
275
|
+
p.push('</section>');
|
|
276
|
+
p.push('<section><h2>Commits</h2>');
|
|
277
|
+
if (!r.commits.length)
|
|
278
|
+
p.push('<p class="muted">No commits in range.</p>');
|
|
279
|
+
else
|
|
280
|
+
p.push(`<table><thead><tr><th>Commit</th><th>Subject</th><th>Date</th><th>High</th><th>Medium</th><th>Low</th></tr></thead><tbody>${rows(r.commits.map((c) => [
|
|
281
|
+
`<code>${e(c.short)}</code>`, e(c.subject ?? '(no longer in history)'), e(c.authorDate ?? '-'), e(c.high), e(c.medium), e(c.low)
|
|
282
|
+
]))}</tbody></table>`);
|
|
283
|
+
p.push(`<p class="muted">Report id ${e(r.id)} · generated by prism-cli codewatch</p></section>`);
|
|
284
|
+
p.push('</main></body></html>');
|
|
285
|
+
return p.join('');
|
|
286
|
+
}
|
|
287
|
+
/** Finds `id` in any of `repos` and builds its report; null when unknown or not a review. */
|
|
288
|
+
export function reportFromRepos(repos, id) {
|
|
289
|
+
for (const repo of repos) {
|
|
290
|
+
const entries = readResultEntries(repo);
|
|
291
|
+
const hit = findResultById(repo, id, entries);
|
|
292
|
+
if (!hit)
|
|
293
|
+
continue;
|
|
294
|
+
if (!isReview(hit.result) || !hit.result.commit)
|
|
295
|
+
return null;
|
|
296
|
+
return buildReport(repo, hit, entries);
|
|
297
|
+
}
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
//# sourceMappingURL=report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../../src/dashboard/report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAmE,MAAM,yBAAyB,CAAC;AAC7H,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAA2D,MAAM,cAAc,CAAC;AAExJ,+FAA+F;AAC/F,MAAM,QAAQ,GAAG,wBAAwB,CAAC;AAE1C,6GAA6G;AAC7G,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,EAAU,EAAE,OAAuB;IAClF,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,OAAO,IAAI,CAAC;IAC9D,OAAO,CAAC,OAAO,IAAI,iBAAiB,CA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|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export interface RepoRef {
|
|
2
|
+
name: string;
|
|
3
|
+
/** Real path (symlinks resolved), so the current repo and a scanned one compare equal. */
|
|
4
|
+
path: string;
|
|
5
|
+
/** Contains the working directory the dashboard was started in. */
|
|
6
|
+
current: boolean;
|
|
7
|
+
/** Has a `.prism/` directory (codewatch or another PRISM installer has run here). */
|
|
8
|
+
hasPrism: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Directory names never descended into. Hidden names (leading `.`) are skipped
|
|
12
|
+
* separately, which covers `.git`, `.cache`, `.venv` and the like.
|
|
13
|
+
*/
|
|
14
|
+
export declare const SKIP_DIRS: Set<string>;
|
|
15
|
+
export declare const DEFAULT_SCAN_DEPTH = 3;
|
|
16
|
+
export declare const MAX_REPOS = 200;
|
|
17
|
+
/** Hard cap on directories listed, so an unusually wide home cannot stall the page. */
|
|
18
|
+
export declare const MAX_DIRS_VISITED = 20000;
|
|
19
|
+
export declare function gitToplevel(cwd: string): string | null;
|
|
20
|
+
export interface ScanResult {
|
|
21
|
+
repos: RepoRef[];
|
|
22
|
+
/** Directories listed. */
|
|
23
|
+
visited: number;
|
|
24
|
+
/** A cap (MAX_REPOS or MAX_DIRS_VISITED) stopped the scan early. */
|
|
25
|
+
truncated: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Git repos under `root`, at most `depth` levels below it. `.git` may be a
|
|
29
|
+
* directory or a file (a linked worktree's or submodule's pointer).
|
|
30
|
+
*
|
|
31
|
+
* - The walk stops at any git repo: nothing inside a repo is scanned, so
|
|
32
|
+
* nested repos and big working trees are skipped.
|
|
33
|
+
* - Hidden directories and SKIP_DIRS are never entered.
|
|
34
|
+
* - Symlinks are not followed (Dirent.isDirectory() is false for a link).
|
|
35
|
+
* - An unreadable directory is skipped, not an error.
|
|
36
|
+
* - `root` itself is never treated as a repo, so a home directory kept under
|
|
37
|
+
* git (dotfiles) does not end the scan before it starts.
|
|
38
|
+
*/
|
|
39
|
+
export declare function scanForRepos(root: string, depth?: number): ScanResult;
|
|
40
|
+
export interface DiscoverOptions {
|
|
41
|
+
cwd: string;
|
|
42
|
+
/** Scan root; default the home directory. */
|
|
43
|
+
root?: string;
|
|
44
|
+
/** Injected in tests instead of os.homedir(). */
|
|
45
|
+
home?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface Discovery {
|
|
48
|
+
repos: RepoRef[];
|
|
49
|
+
scannedRoot: string;
|
|
50
|
+
/** Path of the repo containing cwd, or null. */
|
|
51
|
+
currentRepo: string | null;
|
|
52
|
+
scanMs: number;
|
|
53
|
+
truncated: boolean;
|
|
54
|
+
/** Set when the scan root could not be used. */
|
|
55
|
+
error: string | null;
|
|
56
|
+
}
|
|
57
|
+
export declare function discoverRepos(opts: DiscoverOptions): Discovery;
|
|
58
|
+
//# sourceMappingURL=repos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repos.d.ts","sourceRoot":"","sources":["../../../src/dashboard/repos.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,0FAA0F;IAC1F,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,OAAO,EAAE,OAAO,CAAC;IACjB,qFAAqF;IACrF,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,aAAoG,CAAC;AAC3H,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,SAAS,MAAM,CAAC;AAC7B,uFAAuF;AACvF,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAEvC,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGtD;AAUD,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,oEAA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