@mergesignal/shared 0.4.3 → 0.5.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/actionsStepSummary.d.ts +1 -22
- package/dist/actionsStepSummary.d.ts.map +1 -1
- package/dist/actionsStepSummary.js +19 -716
- package/dist/actionsStepSummary.test.js +34 -329
- package/dist/assessmentLabels.d.ts +6 -0
- package/dist/assessmentLabels.d.ts.map +1 -0
- package/dist/assessmentLabels.js +33 -0
- package/dist/assessmentProjection.d.ts +12 -0
- package/dist/assessmentProjection.d.ts.map +1 -0
- package/dist/assessmentProjection.js +100 -0
- package/dist/assessmentSchema.d.ts +155 -0
- package/dist/assessmentSchema.d.ts.map +1 -0
- package/dist/assessmentSchema.js +110 -0
- package/dist/cardObservationCatalog.d.ts +2 -0
- package/dist/cardObservationCatalog.d.ts.map +1 -1
- package/dist/cardObservationCatalog.js +47 -1
- package/dist/engineWireRegression.test.js +22 -2
- package/dist/fixtures/assessmentFixtures.d.ts +13 -0
- package/dist/fixtures/assessmentFixtures.d.ts.map +1 -0
- package/dist/fixtures/assessmentFixtures.js +164 -0
- package/dist/formatCardExposureDisplay.d.ts +0 -4
- package/dist/formatCardExposureDisplay.d.ts.map +1 -1
- package/dist/formatCardExposureDisplay.js +0 -15
- package/dist/formatInsight.d.ts +3 -2
- package/dist/formatInsight.d.ts.map +1 -1
- package/dist/formatInsight.js +26 -1
- package/dist/index.d.ts +7 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -11
- package/dist/narrativeParity.test.js +4 -34
- package/dist/presentGitHubPrComment.d.ts +1 -3
- package/dist/presentGitHubPrComment.d.ts.map +1 -1
- package/dist/presentGitHubPrComment.js +0 -17
- package/dist/presentation/compose/narrativeChannels.d.ts.map +1 -1
- package/dist/presentation/compose/narrativeChannels.js +13 -43
- package/dist/presentation/compose/narrativeCompose.d.ts.map +1 -1
- package/dist/presentation/compose/narrativeCompose.js +2 -5
- package/dist/presentation/dto/assessmentPresentationFields.d.ts +13 -0
- package/dist/presentation/dto/assessmentPresentationFields.d.ts.map +1 -0
- package/dist/presentation/dto/assessmentPresentationFields.js +1 -0
- package/dist/presentation/dto/dashboardCardPresentation.d.ts +2 -1
- package/dist/presentation/dto/dashboardCardPresentation.d.ts.map +1 -1
- package/dist/presentation/dto/githubAndCliPresentation.d.ts +4 -3
- package/dist/presentation/dto/githubAndCliPresentation.d.ts.map +1 -1
- package/dist/presentation/dto/scanDetailsPresentation.d.ts +2 -1
- package/dist/presentation/dto/scanDetailsPresentation.d.ts.map +1 -1
- package/dist/presentation/fixtures/dashboardCardGolden.test.js +21 -14
- package/dist/presentation/fixtures/presentationPersonaFixtures.d.ts.map +1 -1
- package/dist/presentation/fixtures/presentationPersonaFixtures.js +31 -24
- package/dist/presentation/fixtures/scanResultFixtures.d.ts.map +1 -1
- package/dist/presentation/fixtures/scanResultFixtures.js +14 -3
- package/dist/presentation/index.d.ts +0 -1
- package/dist/presentation/index.d.ts.map +1 -1
- package/dist/presentation/index.js +0 -1
- package/dist/presentation/orchestration/buildScanCardPresentation.d.ts.map +1 -1
- package/dist/presentation/orchestration/buildScanCardPresentation.js +8 -3
- package/dist/presentation/orchestration/buildScanPresentationBundle.d.ts +1 -1
- package/dist/presentation/orchestration/buildScanPresentationBundle.d.ts.map +1 -1
- package/dist/presentation/orchestration/buildScanPresentationBundle.js +12 -10
- package/dist/presentation/orchestration/scanPresentationBundle.d.ts +8 -3
- package/dist/presentation/orchestration/scanPresentationBundle.d.ts.map +1 -1
- package/dist/presentation/presentationPersonas.test.js +6 -6
- package/dist/presentation/presenters/presentCliScanSummary.d.ts.map +1 -1
- package/dist/presentation/presenters/presentCliScanSummary.js +2 -0
- package/dist/presentation/presenters/presentDashboardCard.d.ts.map +1 -1
- package/dist/presentation/presenters/presentDashboardCard.js +2 -0
- package/dist/presentation/presenters/presentGitHubCheckRun.d.ts.map +1 -1
- package/dist/presentation/presenters/presentGitHubCheckRun.js +2 -0
- package/dist/presentation/presenters/presentGitHubPrComment.d.ts.map +1 -1
- package/dist/presentation/presenters/presentGitHubPrComment.js +15 -21
- package/dist/presentation/presenters/presentScanDetails.d.ts.map +1 -1
- package/dist/presentation/presenters/presentScanDetails.js +52 -129
- package/dist/presentation/profile/buildProfileFromAssessment.d.ts +5 -0
- package/dist/presentation/profile/buildProfileFromAssessment.d.ts.map +1 -0
- package/dist/presentation/profile/buildProfileFromAssessment.js +58 -0
- package/dist/presentation/projectAssessmentFields.d.ts +4 -0
- package/dist/presentation/projectAssessmentFields.d.ts.map +1 -0
- package/dist/presentation/projectAssessmentFields.js +13 -0
- package/dist/presentation/surfaceParity.test.d.ts +2 -0
- package/dist/presentation/surfaceParity.test.d.ts.map +1 -0
- package/dist/presentation/surfaceParity.test.js +74 -0
- package/dist/productMessaging.d.ts +4 -4
- package/dist/productMessaging.d.ts.map +1 -1
- package/dist/productMessaging.js +4 -4
- package/dist/productMessaging.test.js +2 -2
- package/dist/repoIntelligenceSchema.d.ts +2 -2
- package/dist/resolvePipelineStatus.d.ts +15 -0
- package/dist/resolvePipelineStatus.d.ts.map +1 -0
- package/dist/resolvePipelineStatus.js +37 -0
- package/dist/scanCardPresentationState.d.ts +4 -0
- package/dist/scanCardPresentationState.d.ts.map +1 -0
- package/dist/scanCardPresentationState.js +4 -0
- package/dist/{scanDetailViewModel.d.ts → scanDetailViewModelTypes.d.ts} +60 -32
- package/dist/scanDetailViewModelTypes.d.ts.map +1 -0
- package/dist/scanDetailViewModelTypes.js +4 -0
- package/dist/scanResultSchema.d.ts +75 -2
- package/dist/scanResultSchema.d.ts.map +1 -1
- package/dist/scanResultSchema.js +4 -2
- package/dist/scanResultSchema.test.js +16 -0
- package/dist/trustedScanGuards.test.js +7 -0
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/collectNarrativeWhyBullets.d.ts +0 -12
- package/dist/collectNarrativeWhyBullets.d.ts.map +0 -1
- package/dist/collectNarrativeWhyBullets.js +0 -104
- package/dist/deriveCardDisplaySummary.d.ts +0 -16
- package/dist/deriveCardDisplaySummary.d.ts.map +0 -1
- package/dist/deriveCardDisplaySummary.js +0 -56
- package/dist/deriveCardDisplaySummary.test.d.ts +0 -2
- package/dist/deriveCardDisplaySummary.test.d.ts.map +0 -1
- package/dist/deriveCardDisplaySummary.test.js +0 -89
- package/dist/deriveCardOperationalObservations.d.ts +0 -19
- package/dist/deriveCardOperationalObservations.d.ts.map +0 -1
- package/dist/deriveCardOperationalObservations.js +0 -180
- package/dist/deriveCardOperationalObservations.test.d.ts +0 -2
- package/dist/deriveCardOperationalObservations.test.d.ts.map +0 -1
- package/dist/deriveCardOperationalObservations.test.js +0 -268
- package/dist/deriveRiskScoreSummary.d.ts +0 -33
- package/dist/deriveRiskScoreSummary.d.ts.map +0 -1
- package/dist/deriveRiskScoreSummary.js +0 -90
- package/dist/deriveRiskScoreSummary.test.d.ts +0 -2
- package/dist/deriveRiskScoreSummary.test.d.ts.map +0 -1
- package/dist/deriveRiskScoreSummary.test.js +0 -47
- package/dist/deriveScanDetailRecommendations.d.ts +0 -63
- package/dist/deriveScanDetailRecommendations.d.ts.map +0 -1
- package/dist/deriveScanDetailRecommendations.js +0 -725
- package/dist/deriveScanDetailRecommendations.test.d.ts +0 -2
- package/dist/deriveScanDetailRecommendations.test.d.ts.map +0 -1
- package/dist/deriveScanDetailRecommendations.test.js +0 -181
- package/dist/deriveScanSummaryText.d.ts +0 -7
- package/dist/deriveScanSummaryText.d.ts.map +0 -1
- package/dist/deriveScanSummaryText.js +0 -24
- package/dist/deriveScanSummaryText.test.d.ts +0 -2
- package/dist/deriveScanSummaryText.test.d.ts.map +0 -1
- package/dist/deriveScanSummaryText.test.js +0 -77
- package/dist/formatCardEvidenceCounts.d.ts +0 -7
- package/dist/formatCardEvidenceCounts.d.ts.map +0 -1
- package/dist/formatCardEvidenceCounts.js +0 -19
- package/dist/prCheckRunPresentation.d.ts +0 -68
- package/dist/prCheckRunPresentation.d.ts.map +0 -1
- package/dist/prCheckRunPresentation.js +0 -319
- package/dist/prCheckRunPresentation.test.d.ts +0 -2
- package/dist/prCheckRunPresentation.test.d.ts.map +0 -1
- package/dist/prCheckRunPresentation.test.js +0 -278
- package/dist/presentation/intent/derivePresentationInterpretation.d.ts +0 -4
- package/dist/presentation/intent/derivePresentationInterpretation.d.ts.map +0 -1
- package/dist/presentation/intent/derivePresentationInterpretation.js +0 -202
- package/dist/presentation/intent/formatPresentationCopy.d.ts +0 -8
- package/dist/presentation/intent/formatPresentationCopy.d.ts.map +0 -1
- package/dist/presentation/intent/formatPresentationCopy.js +0 -140
- package/dist/presentation/intent/presentationIntent.test.d.ts +0 -2
- package/dist/presentation/intent/presentationIntent.test.d.ts.map +0 -1
- package/dist/presentation/intent/presentationIntent.test.js +0 -29
- package/dist/presentation/intent/verificationFocusLabels.d.ts +0 -2
- package/dist/presentation/intent/verificationFocusLabels.d.ts.map +0 -1
- package/dist/presentation/intent/verificationFocusLabels.js +0 -45
- package/dist/presentation/profile/derivePresentationProfile.d.ts +0 -12
- package/dist/presentation/profile/derivePresentationProfile.d.ts.map +0 -1
- package/dist/presentation/profile/derivePresentationProfile.js +0 -85
- package/dist/scanCardSummary.d.ts +0 -58
- package/dist/scanCardSummary.d.ts.map +0 -1
- package/dist/scanCardSummary.js +0 -146
- package/dist/scanCardSummary.test.d.ts +0 -2
- package/dist/scanCardSummary.test.d.ts.map +0 -1
- package/dist/scanCardSummary.test.js +0 -234
- package/dist/scanDetailViewModel.d.ts.map +0 -1
- package/dist/scanDetailViewModel.js +0 -636
- package/dist/scanDetailViewModel.test.d.ts +0 -2
- package/dist/scanDetailViewModel.test.d.ts.map +0 -1
- package/dist/scanDetailViewModel.test.js +0 -530
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deriveScanDetailRecommendations.test.d.ts","sourceRoot":"","sources":["../src/deriveScanDetailRecommendations.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { primaryPrExample } from "./productMessaging.js";
|
|
3
|
-
import { deriveScanDetailRecommendations, RECOMMENDATION_MAX_ITEMS, } from "./deriveScanDetailRecommendations.js";
|
|
4
|
-
import { deriveScanDetailViewModel } from "./scanDetailViewModel.js";
|
|
5
|
-
const baseResult = {
|
|
6
|
-
totalScore: 10,
|
|
7
|
-
layerScores: {
|
|
8
|
-
security: 1,
|
|
9
|
-
maintainability: 2,
|
|
10
|
-
ecosystem: 3,
|
|
11
|
-
upgradeImpact: 4,
|
|
12
|
-
},
|
|
13
|
-
findings: [],
|
|
14
|
-
generatedAt: "2026-01-01T00:00:00.000Z",
|
|
15
|
-
};
|
|
16
|
-
function minimalResult(overrides = {}) {
|
|
17
|
-
return {
|
|
18
|
-
totalScore: 42,
|
|
19
|
-
layerScores: {
|
|
20
|
-
security: 10,
|
|
21
|
-
maintainability: 20,
|
|
22
|
-
ecosystem: 30,
|
|
23
|
-
upgradeImpact: 15,
|
|
24
|
-
},
|
|
25
|
-
findings: [],
|
|
26
|
-
generatedAt: new Date().toISOString(),
|
|
27
|
-
decision: {
|
|
28
|
-
recommendation: "needs_review",
|
|
29
|
-
confidence: "medium",
|
|
30
|
-
reasoning: ["Lockfile adds transitive depth on shared utilities."],
|
|
31
|
-
},
|
|
32
|
-
...overrides,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
describe("deriveScanDetailRecommendations", () => {
|
|
36
|
-
it("always returns 1–3 enriched items with detail fields", () => {
|
|
37
|
-
const archetypes = [
|
|
38
|
-
{
|
|
39
|
-
...baseResult,
|
|
40
|
-
decision: { recommendation: "safe", confidence: "high", reasoning: [] },
|
|
41
|
-
},
|
|
42
|
-
minimalResult(),
|
|
43
|
-
{
|
|
44
|
-
...minimalResult(),
|
|
45
|
-
decision: {
|
|
46
|
-
recommendation: "risky",
|
|
47
|
-
confidence: "high",
|
|
48
|
-
reasoning: [],
|
|
49
|
-
},
|
|
50
|
-
findings: [
|
|
51
|
-
{
|
|
52
|
-
id: "f1",
|
|
53
|
-
severity: "critical",
|
|
54
|
-
title: "Critical vulnerability",
|
|
55
|
-
description: "Transitive CVE",
|
|
56
|
-
packageName: "lodash",
|
|
57
|
-
recommendation: "Upgrade lodash",
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
},
|
|
61
|
-
];
|
|
62
|
-
for (const result of archetypes) {
|
|
63
|
-
const center = deriveScanDetailRecommendations(result);
|
|
64
|
-
expect(center.items.length).toBeGreaterThanOrEqual(1);
|
|
65
|
-
expect(center.items.length).toBeLessThanOrEqual(RECOMMENDATION_MAX_ITEMS);
|
|
66
|
-
expect(center.defaultSelectedId).toBe(center.items[0]?.id);
|
|
67
|
-
for (const item of center.items) {
|
|
68
|
-
expect(item.detail.why.length).toBeGreaterThan(0);
|
|
69
|
-
expect(item.detail.whyNow.length).toBeGreaterThan(0);
|
|
70
|
-
expect(item.detail.expectedBenefit.length).toBeGreaterThan(0);
|
|
71
|
-
expect(item.detail.why).not.toMatch(/CVE-\d|@\d|\d+\.\d+\.\d+/);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
it("quiet safe scan uses posture playbook with scan context", () => {
|
|
76
|
-
const center = deriveScanDetailRecommendations({
|
|
77
|
-
...baseResult,
|
|
78
|
-
decision: { recommendation: "safe", confidence: "high", reasoning: [] },
|
|
79
|
-
});
|
|
80
|
-
expect(center.posture).toBe("safe");
|
|
81
|
-
expect(center.scanContext).toBeTruthy();
|
|
82
|
-
expect(center.items[0]?.priority).toBe("low");
|
|
83
|
-
expect(center.items[0]?.title).toBe("Merge normally");
|
|
84
|
-
});
|
|
85
|
-
it("duplicate recommendation includes whyNow and signals with packages", () => {
|
|
86
|
-
const center = deriveScanDetailRecommendations({
|
|
87
|
-
...minimalResult(),
|
|
88
|
-
recommendations: [
|
|
89
|
-
{
|
|
90
|
-
id: "r1",
|
|
91
|
-
title: "Reduce duplicate dependency versions",
|
|
92
|
-
rationale: "semver overlap",
|
|
93
|
-
impact: "high",
|
|
94
|
-
packages: ["semver", "string-width", "@opentelemetry/api-logs"],
|
|
95
|
-
},
|
|
96
|
-
],
|
|
97
|
-
});
|
|
98
|
-
const dup = center.items.find((i) => i.title.toLowerCase().includes("duplicate"));
|
|
99
|
-
expect(dup?.detail.whyNow.toLowerCase()).toContain("semver");
|
|
100
|
-
expect(dup?.detail.signals.length).toBeGreaterThan(0);
|
|
101
|
-
expect(dup?.detail.affectedPackages?.names).toContain("semver");
|
|
102
|
-
});
|
|
103
|
-
it("insight-rich scan has high priority and scan-specific whyNow", () => {
|
|
104
|
-
const center = deriveScanDetailRecommendations({
|
|
105
|
-
...minimalResult(),
|
|
106
|
-
insights: [
|
|
107
|
-
{
|
|
108
|
-
type: "behavioral_change",
|
|
109
|
-
priority: "high",
|
|
110
|
-
confidence: "confirmed",
|
|
111
|
-
scope: "changed",
|
|
112
|
-
message: primaryPrExample.message,
|
|
113
|
-
context: primaryPrExample.where[0],
|
|
114
|
-
remediation: "Confirm auth guards still run before protected handlers",
|
|
115
|
-
affectedFiles: [...primaryPrExample.where],
|
|
116
|
-
},
|
|
117
|
-
],
|
|
118
|
-
});
|
|
119
|
-
expect(center.items[0]?.source).toBe("insight");
|
|
120
|
-
expect(center.items[0]?.priority).toBe("high");
|
|
121
|
-
expect(center.items[0]?.detail.whyNow).toContain("middleware");
|
|
122
|
-
});
|
|
123
|
-
it("risky scan with critical findings leads with resolve guidance", () => {
|
|
124
|
-
const center = deriveScanDetailRecommendations({
|
|
125
|
-
...minimalResult(),
|
|
126
|
-
decision: { recommendation: "risky", confidence: "high", reasoning: [] },
|
|
127
|
-
findings: [
|
|
128
|
-
{
|
|
129
|
-
id: "f1",
|
|
130
|
-
severity: "critical",
|
|
131
|
-
title: "Critical vulnerability",
|
|
132
|
-
description: "Transitive CVE",
|
|
133
|
-
packageName: "lodash",
|
|
134
|
-
recommendation: "Upgrade lodash",
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
});
|
|
138
|
-
expect(center.items[0]?.title).toContain("Resolve critical findings");
|
|
139
|
-
expect(center.items[0]?.priority).toBe("high");
|
|
140
|
-
expect(center.items[0]?.proofRefs?.findingIds).toContain("f1");
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
describe("recommendedActions on scan detail view model", () => {
|
|
144
|
-
it("includes recommendedActions slice on done scans", () => {
|
|
145
|
-
const vm = deriveScanDetailViewModel(minimalResult(), {
|
|
146
|
-
scanId: "s1",
|
|
147
|
-
status: "done",
|
|
148
|
-
});
|
|
149
|
-
expect(vm?.recommendedActions.items.length).toBeGreaterThanOrEqual(1);
|
|
150
|
-
});
|
|
151
|
-
it("strips duplicate finding recommendations covered by recommended actions", () => {
|
|
152
|
-
const vm = deriveScanDetailViewModel({
|
|
153
|
-
...minimalResult(),
|
|
154
|
-
decision: {
|
|
155
|
-
recommendation: "risky",
|
|
156
|
-
confidence: "high",
|
|
157
|
-
reasoning: [],
|
|
158
|
-
},
|
|
159
|
-
findings: [
|
|
160
|
-
{
|
|
161
|
-
id: "f1",
|
|
162
|
-
severity: "critical",
|
|
163
|
-
title: "Critical vulnerability",
|
|
164
|
-
description: "Transitive CVE",
|
|
165
|
-
packageName: "lodash",
|
|
166
|
-
recommendation: "Upgrade lodash",
|
|
167
|
-
},
|
|
168
|
-
],
|
|
169
|
-
}, { scanId: "dedupe", status: "done" });
|
|
170
|
-
const finding = vm?.evidence?.findings.find((f) => f.id === "f1");
|
|
171
|
-
expect(finding?.recommendation).toBeUndefined();
|
|
172
|
-
expect(finding?.coveredByRecommendationRank).toBeGreaterThan(0);
|
|
173
|
-
});
|
|
174
|
-
it("does not expose Act 4 next steps", () => {
|
|
175
|
-
const vm = deriveScanDetailViewModel(minimalResult(), {
|
|
176
|
-
scanId: "s1",
|
|
177
|
-
status: "done",
|
|
178
|
-
});
|
|
179
|
-
expect(vm).not.toHaveProperty("next");
|
|
180
|
-
});
|
|
181
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ScanResult } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* One-line summary for PR scan list cards (server or client).
|
|
4
|
-
* Prefers decision reasoning, then finding severity counts.
|
|
5
|
-
*/
|
|
6
|
-
export declare function deriveScanSummaryText(result: ScanResult | null | undefined): string | null;
|
|
7
|
-
//# sourceMappingURL=deriveScanSummaryText.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deriveScanSummaryText.d.ts","sourceRoot":"","sources":["../src/deriveScanSummaryText.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,GACpC,MAAM,GAAG,IAAI,CAqBf"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* One-line summary for PR scan list cards (server or client).
|
|
3
|
-
* Prefers decision reasoning, then finding severity counts.
|
|
4
|
-
*/
|
|
5
|
-
export function deriveScanSummaryText(result) {
|
|
6
|
-
if (!result)
|
|
7
|
-
return null;
|
|
8
|
-
const decision = result.decision;
|
|
9
|
-
const reasoning = decision?.reasoning;
|
|
10
|
-
if (Array.isArray(reasoning) && reasoning.length > 0) {
|
|
11
|
-
const first = String(reasoning[0]).trim();
|
|
12
|
-
return first.length > 120 ? first.slice(0, 119) + "…" : first;
|
|
13
|
-
}
|
|
14
|
-
const findings = result.findings;
|
|
15
|
-
if (Array.isArray(findings) && findings.length > 0) {
|
|
16
|
-
const high = findings.filter((f) => f.severity === "high").length;
|
|
17
|
-
const medium = findings.filter((f) => f.severity === "medium").length;
|
|
18
|
-
if (high > 0)
|
|
19
|
-
return `${high} high-severity finding${high > 1 ? "s" : ""} detected`;
|
|
20
|
-
if (medium > 0)
|
|
21
|
-
return `${medium} medium-severity finding${medium > 1 ? "s" : ""} detected`;
|
|
22
|
-
}
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deriveScanSummaryText.test.d.ts","sourceRoot":"","sources":["../src/deriveScanSummaryText.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { deriveScanSummaryText } from "./deriveScanSummaryText.js";
|
|
3
|
-
describe("deriveScanSummaryText", () => {
|
|
4
|
-
it("returns null for empty input", () => {
|
|
5
|
-
expect(deriveScanSummaryText(undefined)).toBeNull();
|
|
6
|
-
expect(deriveScanSummaryText(null)).toBeNull();
|
|
7
|
-
});
|
|
8
|
-
it("uses first decision reasoning", () => {
|
|
9
|
-
const r = {
|
|
10
|
-
totalScore: 10,
|
|
11
|
-
layerScores: {
|
|
12
|
-
security: 1,
|
|
13
|
-
maintainability: 2,
|
|
14
|
-
ecosystem: 3,
|
|
15
|
-
upgradeImpact: 4,
|
|
16
|
-
},
|
|
17
|
-
findings: [],
|
|
18
|
-
generatedAt: "2026-01-01T00:00:00.000Z",
|
|
19
|
-
decision: {
|
|
20
|
-
recommendation: "needs_review",
|
|
21
|
-
confidence: "medium",
|
|
22
|
-
reasoning: ["First reason line", "Second"],
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
expect(deriveScanSummaryText(r)).toBe("First reason line");
|
|
26
|
-
});
|
|
27
|
-
it("truncates long reasoning", () => {
|
|
28
|
-
const long = "a".repeat(130);
|
|
29
|
-
const r = {
|
|
30
|
-
totalScore: 10,
|
|
31
|
-
layerScores: {
|
|
32
|
-
security: 1,
|
|
33
|
-
maintainability: 2,
|
|
34
|
-
ecosystem: 3,
|
|
35
|
-
upgradeImpact: 4,
|
|
36
|
-
},
|
|
37
|
-
findings: [],
|
|
38
|
-
generatedAt: "2026-01-01T00:00:00.000Z",
|
|
39
|
-
decision: {
|
|
40
|
-
recommendation: "safe",
|
|
41
|
-
confidence: "high",
|
|
42
|
-
reasoning: [long],
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
expect(deriveScanSummaryText(r).length).toBe(120);
|
|
46
|
-
expect(deriveScanSummaryText(r).endsWith("…")).toBe(true);
|
|
47
|
-
});
|
|
48
|
-
it("falls back to high-severity findings", () => {
|
|
49
|
-
const r = {
|
|
50
|
-
totalScore: 80,
|
|
51
|
-
layerScores: {
|
|
52
|
-
security: 80,
|
|
53
|
-
maintainability: 10,
|
|
54
|
-
ecosystem: 10,
|
|
55
|
-
upgradeImpact: 10,
|
|
56
|
-
},
|
|
57
|
-
findings: [
|
|
58
|
-
{
|
|
59
|
-
id: "1",
|
|
60
|
-
title: "x",
|
|
61
|
-
description: "d",
|
|
62
|
-
severity: "high",
|
|
63
|
-
packageName: "p",
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
id: "2",
|
|
67
|
-
title: "y",
|
|
68
|
-
description: "d",
|
|
69
|
-
severity: "high",
|
|
70
|
-
packageName: "q",
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
generatedAt: "2026-01-01T00:00:00.000Z",
|
|
74
|
-
};
|
|
75
|
-
expect(deriveScanSummaryText(r)).toBe("2 high-severity findings detected");
|
|
76
|
-
});
|
|
77
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { FindingCountSummary } from "./scanCardSummary.js";
|
|
2
|
-
import type { MergePosture } from "./riskVocabulary.js";
|
|
3
|
-
/**
|
|
4
|
-
* One soft evidence phrase for dashboard cards (not scanner-style metrics).
|
|
5
|
-
*/
|
|
6
|
-
export declare function formatCardEvidenceCounts(counts: FindingCountSummary | null | undefined, posture: MergePosture | null): string | null;
|
|
7
|
-
//# sourceMappingURL=formatCardEvidenceCounts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatCardEvidenceCounts.d.ts","sourceRoot":"","sources":["../src/formatCardEvidenceCounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,EAC9C,OAAO,EAAE,YAAY,GAAG,IAAI,GAC3B,MAAM,GAAG,IAAI,CAaf"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* One soft evidence phrase for dashboard cards (not scanner-style metrics).
|
|
3
|
-
*/
|
|
4
|
-
export function formatCardEvidenceCounts(counts, posture) {
|
|
5
|
-
if (!counts || !posture || posture === "safe")
|
|
6
|
-
return null;
|
|
7
|
-
const { critical, high } = counts;
|
|
8
|
-
if (critical > 0 && posture === "risky") {
|
|
9
|
-
if (critical === 1)
|
|
10
|
-
return "1 critical finding";
|
|
11
|
-
return "Critical findings present";
|
|
12
|
-
}
|
|
13
|
-
if (high > 0 && (posture === "risky" || posture === "needs_review")) {
|
|
14
|
-
if (high === 1)
|
|
15
|
-
return "1 high-severity finding";
|
|
16
|
-
return `${high} high-severity findings`;
|
|
17
|
-
}
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import type { ScanNarrativeFacts } from "./scanNarrativeFacts.js";
|
|
2
|
-
import type { ScanResult } from "./types.js";
|
|
3
|
-
export declare const CHECK_RUN_MAX_WHY_BULLETS = 3;
|
|
4
|
-
export declare const CHECK_RUN_MAX_ACTION_BULLETS = 3;
|
|
5
|
-
export declare const CHECK_RUN_MAX_REPO_DRIVER_PHRASES = 2;
|
|
6
|
-
export declare const CHECK_RUN_ACTION_BULLET_MAX_CHARS = 220;
|
|
7
|
-
export declare const CHECK_RUN_SOFT_MAX_CHARS = 3800;
|
|
8
|
-
export type PrCheckRunTitleOptions = {
|
|
9
|
-
baselineOnly?: boolean;
|
|
10
|
-
};
|
|
11
|
-
export type PrCheckRunSummaryContext = {
|
|
12
|
-
result: ScanResult;
|
|
13
|
-
scanId: string;
|
|
14
|
-
webAppOrigin: string;
|
|
15
|
-
baseline: boolean;
|
|
16
|
-
};
|
|
17
|
-
/** Policy flags — one place per product rule. */
|
|
18
|
-
export type CheckRunPolicy = {
|
|
19
|
-
baseline: boolean;
|
|
20
|
-
showBaselineOutcome: boolean;
|
|
21
|
-
showRepoGraphContext: boolean;
|
|
22
|
-
showLayerScores: boolean;
|
|
23
|
-
useDetailsForLayers: boolean;
|
|
24
|
-
maxWhyBullets: number;
|
|
25
|
-
maxActionBullets: number;
|
|
26
|
-
maxRepoDriverPhrases: number;
|
|
27
|
-
};
|
|
28
|
-
export type CheckRunSection = {
|
|
29
|
-
kind: "lead";
|
|
30
|
-
posture: string;
|
|
31
|
-
riskIndexLine: string | null;
|
|
32
|
-
} | {
|
|
33
|
-
kind: "why";
|
|
34
|
-
bullets: string[];
|
|
35
|
-
} | {
|
|
36
|
-
kind: "actions";
|
|
37
|
-
bullets: string[];
|
|
38
|
-
} | {
|
|
39
|
-
kind: "baselineOutcome";
|
|
40
|
-
primary: string;
|
|
41
|
-
scope?: string;
|
|
42
|
-
} | {
|
|
43
|
-
kind: "repoContext";
|
|
44
|
-
score: number;
|
|
45
|
-
driverPhrases: string[];
|
|
46
|
-
} | {
|
|
47
|
-
kind: "layerScores";
|
|
48
|
-
rows: Array<{
|
|
49
|
-
label: string;
|
|
50
|
-
score: string;
|
|
51
|
-
driver: string;
|
|
52
|
-
}>;
|
|
53
|
-
} | {
|
|
54
|
-
kind: "footer";
|
|
55
|
-
url: string;
|
|
56
|
-
label: string;
|
|
57
|
-
};
|
|
58
|
-
export declare function formatScanDashboardUrl(webAppOrigin: string, scanId: string): string;
|
|
59
|
-
export declare function buildPrCheckRunTitle(opts?: PrCheckRunTitleOptions): string;
|
|
60
|
-
/** Strong drivers for optional repo-context line (full mode only). */
|
|
61
|
-
export declare function hasStrongRepoGraphDrivers(result: ScanResult, facts?: ScanNarrativeFacts): boolean;
|
|
62
|
-
export declare function deriveCheckRunPolicy(result: ScanResult, ctx: Pick<PrCheckRunSummaryContext, "baseline">, facts?: ScanNarrativeFacts): CheckRunPolicy;
|
|
63
|
-
export declare function buildPrCheckRunSections(policy: CheckRunPolicy, result: ScanResult, ctx: PrCheckRunSummaryContext, facts?: ScanNarrativeFacts): CheckRunSection[];
|
|
64
|
-
export declare function renderCheckRunMarkdown(sections: CheckRunSection[]): string;
|
|
65
|
-
export declare function buildPrCheckRunSummaryMarkdown(ctx: PrCheckRunSummaryContext): string;
|
|
66
|
-
/** Whether baseline scan has no actionable PR bullets (for tests / callers). */
|
|
67
|
-
export declare function checkRunHasActionableContent(result: ScanResult): boolean;
|
|
68
|
-
//# sourceMappingURL=prCheckRunPresentation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prCheckRunPresentation.d.ts","sourceRoot":"","sources":["../src/prCheckRunPresentation.ts"],"names":[],"mappings":"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"}
|