@mergesignal/shared 0.4.3 → 0.6.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/buildGitHubCheckRunOutput.d.ts +20 -0
- package/dist/presentation/buildGitHubCheckRunOutput.d.ts.map +1 -0
- package/dist/presentation/buildGitHubCheckRunOutput.js +42 -0
- package/dist/presentation/buildGitHubCheckRunOutput.test.d.ts +2 -0
- package/dist/presentation/buildGitHubCheckRunOutput.test.d.ts.map +1 -0
- package/dist/presentation/buildGitHubCheckRunOutput.test.js +188 -0
- 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 +2 -2
- package/dist/presentation/index.d.ts.map +1 -1
- package/dist/presentation/index.js +2 -2
- 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 +1 -0
- package/dist/presentation/presenters/presentDashboardCard.d.ts.map +1 -1
- package/dist/presentation/presenters/presentDashboardCard.js +18 -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 +10 -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/scanSurfaceCopy.d.ts +2 -0
- package/dist/scanSurfaceCopy.d.ts.map +1 -1
- package/dist/scanSurfaceCopy.js +2 -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
package/dist/formatInsight.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MERGE_POSTURE_LABEL } from "./riskVocabulary.js";
|
|
1
2
|
const DECISION_TITLES = {
|
|
2
3
|
safe: "No significant dependency risks detected",
|
|
3
4
|
needs_review: "Elevated dependency merge risk",
|
|
@@ -41,4 +42,28 @@ function renderInsightAsMarkdown(f) {
|
|
|
41
42
|
f.action,
|
|
42
43
|
].join("\n");
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
+
function renderInsightBlock(f) {
|
|
46
|
+
return [
|
|
47
|
+
f.message,
|
|
48
|
+
"",
|
|
49
|
+
"**Where it shows up**",
|
|
50
|
+
"",
|
|
51
|
+
f.where,
|
|
52
|
+
"",
|
|
53
|
+
"**What to do**",
|
|
54
|
+
"",
|
|
55
|
+
f.action,
|
|
56
|
+
].join("\n");
|
|
57
|
+
}
|
|
58
|
+
/** Legacy markdown renderer for raw PR insights (format-only; no bundle inference). */
|
|
59
|
+
export function renderInsightsAsMarkdown(insights, decision) {
|
|
60
|
+
const title = MERGE_POSTURE_LABEL[decision.recommendation];
|
|
61
|
+
const lines = [`**${title}**`, "", "---", ""];
|
|
62
|
+
for (const insight of insights) {
|
|
63
|
+
lines.push(renderInsightBlock(formatInsight(insight)), "", "---", "");
|
|
64
|
+
}
|
|
65
|
+
for (const reason of decision.reasoning) {
|
|
66
|
+
lines.push(reason);
|
|
67
|
+
}
|
|
68
|
+
return lines.join("\n");
|
|
69
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
export * from "./types.js";
|
|
2
|
+
export * from "./assessmentSchema.js";
|
|
3
|
+
export * from "./assessmentLabels.js";
|
|
4
|
+
export * from "./assessmentProjection.js";
|
|
2
5
|
export * from "./formatInsight.js";
|
|
3
6
|
export * from "./riskVocabulary.js";
|
|
4
7
|
export * from "./selectTopAffectedAreas.js";
|
|
5
|
-
export * from "./deriveScanSummaryText.js";
|
|
6
8
|
export * from "./cardSummaryCopy.js";
|
|
7
9
|
export * from "./truncateCardSummary.js";
|
|
8
10
|
export * from "./formatCardAreaLabels.js";
|
|
9
|
-
export * from "./formatCardEvidenceCounts.js";
|
|
10
11
|
export * from "./formatCardExposureDisplay.js";
|
|
11
12
|
export * from "./cardObservationCatalog.js";
|
|
12
|
-
export * from "./deriveCardOperationalObservations.js";
|
|
13
|
-
export * from "./deriveCardDisplaySummary.js";
|
|
14
13
|
export * from "./scanNarrativeFacts.js";
|
|
15
14
|
export * from "./repoIntelligenceSchema.js";
|
|
16
15
|
export * from "./repoIntelligenceMappers.js";
|
|
@@ -20,17 +19,14 @@ export * from "./deriveScanNarrative.js";
|
|
|
20
19
|
export * from "./extractRepositoryContextFacts.js";
|
|
21
20
|
export * from "./narrativePresentation.js";
|
|
22
21
|
export * from "./normalizeGeneratedText.js";
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export * from "./
|
|
26
|
-
export * from "./deriveScanDetailRecommendations.js";
|
|
27
|
-
export * from "./deriveRiskScoreSummary.js";
|
|
28
|
-
export * from "./scanDetailViewModel.js";
|
|
22
|
+
export { presentGitHubPrCommentMarkdownFromResult } from "./presentGitHubPrComment.js";
|
|
23
|
+
export * from "./scanDetailViewModelTypes.js";
|
|
24
|
+
export * from "./scanCardPresentationState.js";
|
|
29
25
|
export * from "./scanResultSchema.js";
|
|
30
26
|
export * from "./scanSurfaceCopy.js";
|
|
27
|
+
export * from "./resolvePipelineStatus.js";
|
|
31
28
|
export * from "./trustedScanGuards.js";
|
|
32
29
|
export * from "./actionsStepSummary.js";
|
|
33
|
-
export * from "./prCheckRunPresentation.js";
|
|
34
30
|
export * from "./productMessaging.js";
|
|
35
31
|
export * from "./presentation/index.js";
|
|
36
32
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,wCAAwC,EAAE,MAAM,6BAA6B,CAAC;AACvF,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
export * from "./types.js";
|
|
2
|
+
export * from "./assessmentSchema.js";
|
|
3
|
+
export * from "./assessmentLabels.js";
|
|
4
|
+
export * from "./assessmentProjection.js";
|
|
2
5
|
export * from "./formatInsight.js";
|
|
3
6
|
export * from "./riskVocabulary.js";
|
|
4
7
|
export * from "./selectTopAffectedAreas.js";
|
|
5
|
-
export * from "./deriveScanSummaryText.js";
|
|
6
8
|
export * from "./cardSummaryCopy.js";
|
|
7
9
|
export * from "./truncateCardSummary.js";
|
|
8
10
|
export * from "./formatCardAreaLabels.js";
|
|
9
|
-
export * from "./formatCardEvidenceCounts.js";
|
|
10
11
|
export * from "./formatCardExposureDisplay.js";
|
|
11
12
|
export * from "./cardObservationCatalog.js";
|
|
12
|
-
export * from "./deriveCardOperationalObservations.js";
|
|
13
|
-
export * from "./deriveCardDisplaySummary.js";
|
|
14
13
|
export * from "./scanNarrativeFacts.js";
|
|
15
14
|
export * from "./repoIntelligenceSchema.js";
|
|
16
15
|
export * from "./repoIntelligenceMappers.js";
|
|
@@ -20,16 +19,13 @@ export * from "./deriveScanNarrative.js";
|
|
|
20
19
|
export * from "./extractRepositoryContextFacts.js";
|
|
21
20
|
export * from "./narrativePresentation.js";
|
|
22
21
|
export * from "./normalizeGeneratedText.js";
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export * from "./
|
|
26
|
-
export * from "./deriveScanDetailRecommendations.js";
|
|
27
|
-
export * from "./deriveRiskScoreSummary.js";
|
|
28
|
-
export * from "./scanDetailViewModel.js";
|
|
22
|
+
export { presentGitHubPrCommentMarkdownFromResult } from "./presentGitHubPrComment.js";
|
|
23
|
+
export * from "./scanDetailViewModelTypes.js";
|
|
24
|
+
export * from "./scanCardPresentationState.js";
|
|
29
25
|
export * from "./scanResultSchema.js";
|
|
30
26
|
export * from "./scanSurfaceCopy.js";
|
|
27
|
+
export * from "./resolvePipelineStatus.js";
|
|
31
28
|
export * from "./trustedScanGuards.js";
|
|
32
29
|
export * from "./actionsStepSummary.js";
|
|
33
|
-
export * from "./prCheckRunPresentation.js";
|
|
34
30
|
export * from "./productMessaging.js";
|
|
35
31
|
export * from "./presentation/index.js";
|
|
@@ -5,44 +5,13 @@ import { presentScanDetails } from "./presentation/presenters/presentScanDetails
|
|
|
5
5
|
import { presentGitHubPrComment } from "./presentation/presenters/presentGitHubPrComment.js";
|
|
6
6
|
import { renderGitHubCheckRunMarkdown } from "./presentation/render/renderGitHubCheckRunMarkdown.js";
|
|
7
7
|
import { presentGitHubCheckRun } from "./presentation/presenters/presentGitHubCheckRun.js";
|
|
8
|
-
import {
|
|
9
|
-
import { analysisPreparationWithValidRepoIntel } from "./fixtures/repoIntelligenceTestHelpers.js";
|
|
8
|
+
import { scanResultFastifyRuntime } from "./presentation/fixtures/scanResultFixtures.js";
|
|
10
9
|
const ORIGIN = "https://app.example.com";
|
|
11
10
|
const SCAN_ID = "22222222-2222-4222-8222-222222222222";
|
|
12
11
|
describe("narrative parity across consumers", () => {
|
|
13
12
|
it("card, detail, GitHub share primary package and reachability story", () => {
|
|
14
|
-
const result = {
|
|
15
|
-
totalScore: 55,
|
|
16
|
-
layerScores: {
|
|
17
|
-
security: 10,
|
|
18
|
-
maintainability: 20,
|
|
19
|
-
ecosystem: 30,
|
|
20
|
-
upgradeImpact: 15,
|
|
21
|
-
},
|
|
22
|
-
findings: [],
|
|
23
|
-
generatedAt: "2026-01-01T00:00:00.000Z",
|
|
24
|
-
changedPackages: ["fastify"],
|
|
25
|
-
analysisPreparation: analysisPreparationWithValidRepoIntel(),
|
|
26
|
-
repoIntelligence: fixtureRepoIntelligenceFastify,
|
|
27
|
-
decision: {
|
|
28
|
-
recommendation: "needs_review",
|
|
29
|
-
confidence: "medium",
|
|
30
|
-
reasoning: [],
|
|
31
|
-
},
|
|
32
|
-
insights: [
|
|
33
|
-
{
|
|
34
|
-
type: "usage_risk",
|
|
35
|
-
priority: "high",
|
|
36
|
-
confidence: "confirmed",
|
|
37
|
-
scope: "changed",
|
|
38
|
-
message: "Review fastify middleware ordering",
|
|
39
|
-
context: "apps/api/src/middleware/auth.ts",
|
|
40
|
-
remediation: "Run auth smoke tests",
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
};
|
|
44
13
|
const bundle = buildScanPresentationBundle({
|
|
45
|
-
result,
|
|
14
|
+
result: scanResultFastifyRuntime,
|
|
46
15
|
pipelineStatus: "done",
|
|
47
16
|
});
|
|
48
17
|
const card = presentDashboardCard(bundle);
|
|
@@ -56,7 +25,8 @@ describe("narrative parity across consumers", () => {
|
|
|
56
25
|
}));
|
|
57
26
|
const prComment = presentGitHubPrComment(bundle);
|
|
58
27
|
expect(detail.narrative.primaryPackage).toBe("fastify");
|
|
59
|
-
expect(card.
|
|
28
|
+
expect(card.reachVisibility).toBe("prominent");
|
|
29
|
+
expect(card.verdict?.scopeLabel).toBeTruthy();
|
|
60
30
|
const asciiOnly = /^[\x00-\x7F]*$/;
|
|
61
31
|
expect(asciiOnly.test(checkRun)).toBe(true);
|
|
62
32
|
expect(checkRun.toLowerCase()).toContain("fastify");
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ScanResult } from "./types.js";
|
|
2
2
|
/**
|
|
3
3
|
* PR comment markdown from a completed scan (via presentation bundle).
|
|
4
4
|
*/
|
|
5
5
|
export declare function presentGitHubPrCommentMarkdownFromResult(result: ScanResult): string;
|
|
6
|
-
/** Backward-compatible entry: derives bundle then renders markdown. */
|
|
7
|
-
export declare function renderInsightsAsMarkdown(insights: PRInsight[], decision: PRDecision): string;
|
|
8
6
|
//# sourceMappingURL=presentGitHubPrComment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentGitHubPrComment.d.ts","sourceRoot":"","sources":["../src/presentGitHubPrComment.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"presentGitHubPrComment.d.ts","sourceRoot":"","sources":["../src/presentGitHubPrComment.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;GAEG;AACH,wBAAgB,wCAAwC,CACtD,MAAM,EAAE,UAAU,GACjB,MAAM,CAWR"}
|
|
@@ -15,20 +15,3 @@ export function presentGitHubPrCommentMarkdownFromResult(result) {
|
|
|
15
15
|
return "";
|
|
16
16
|
return renderGitHubPrCommentMarkdown(presentGitHubPrCommentFromBundle(bundle));
|
|
17
17
|
}
|
|
18
|
-
/** Backward-compatible entry: derives bundle then renders markdown. */
|
|
19
|
-
export function renderInsightsAsMarkdown(insights, decision) {
|
|
20
|
-
const result = {
|
|
21
|
-
totalScore: 0,
|
|
22
|
-
layerScores: {
|
|
23
|
-
security: 0,
|
|
24
|
-
maintainability: 0,
|
|
25
|
-
ecosystem: 0,
|
|
26
|
-
upgradeImpact: 0,
|
|
27
|
-
},
|
|
28
|
-
findings: [],
|
|
29
|
-
generatedAt: new Date().toISOString(),
|
|
30
|
-
insights,
|
|
31
|
-
decision,
|
|
32
|
-
};
|
|
33
|
-
return presentGitHubPrCommentMarkdownFromResult(result);
|
|
34
|
-
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ScanResult } from "../types.js";
|
|
2
|
+
export type GitHubCheckRunConclusion = "success" | "neutral" | "failure";
|
|
3
|
+
export type GitHubCheckRunOutput = {
|
|
4
|
+
/** Short title shown in the checks bar (≤72 chars). */
|
|
5
|
+
title: string;
|
|
6
|
+
/** Markdown summary shown in the check run detail panel (≤2000 chars). */
|
|
7
|
+
summary: string;
|
|
8
|
+
conclusion: GitHubCheckRunConclusion;
|
|
9
|
+
};
|
|
10
|
+
export declare function resolveWebAppOrigin(): string;
|
|
11
|
+
export type BuildGitHubCheckRunOutputOptions = {
|
|
12
|
+
scanId: string;
|
|
13
|
+
webAppOrigin?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Formats GitHub Check Run output from a persisted ScanResult via Assessment presentation.
|
|
17
|
+
* Presentation-only — callers own Octokit checks.create.
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildGitHubCheckRunOutput(result: ScanResult, options: BuildGitHubCheckRunOutputOptions | string): GitHubCheckRunOutput;
|
|
20
|
+
//# sourceMappingURL=buildGitHubCheckRunOutput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildGitHubCheckRunOutput.d.ts","sourceRoot":"","sources":["../../src/presentation/buildGitHubCheckRunOutput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAK9C,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAEzE,MAAM,MAAM,oBAAoB,GAAG;IACjC,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,wBAAwB,CAAC;CACtC,CAAC;AAKF,wBAAgB,mBAAmB,IAAI,MAAM,CAM5C;AAED,MAAM,MAAM,gCAAgC,GAAG;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,gCAAgC,GAAG,MAAM,GACjD,oBAAoB,CAkCtB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { buildScanPresentationBundle } from "./orchestration/buildScanPresentationBundle.js";
|
|
2
|
+
import { presentGitHubCheckRun } from "./presenters/presentGitHubCheckRun.js";
|
|
3
|
+
import { renderGitHubCheckRunMarkdown } from "./render/renderGitHubCheckRunMarkdown.js";
|
|
4
|
+
/** Default Fly web app origin when `MERGESIGNAL_WEB_URL` is unset. */
|
|
5
|
+
const DEFAULT_WEB_APP_ORIGIN = "https://mergesignal-web.fly.dev";
|
|
6
|
+
export function resolveWebAppOrigin() {
|
|
7
|
+
const url = typeof process !== "undefined"
|
|
8
|
+
? process.env.MERGESIGNAL_WEB_URL?.trim()
|
|
9
|
+
: undefined;
|
|
10
|
+
return (url || DEFAULT_WEB_APP_ORIGIN).replace(/\/+$/, "");
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Formats GitHub Check Run output from a persisted ScanResult via Assessment presentation.
|
|
14
|
+
* Presentation-only — callers own Octokit checks.create.
|
|
15
|
+
*/
|
|
16
|
+
export function buildGitHubCheckRunOutput(result, options) {
|
|
17
|
+
const scanId = typeof options === "string" ? options : options.scanId;
|
|
18
|
+
const webAppOrigin = typeof options === "string"
|
|
19
|
+
? resolveWebAppOrigin()
|
|
20
|
+
: (options.webAppOrigin ?? resolveWebAppOrigin());
|
|
21
|
+
if (!result.decision) {
|
|
22
|
+
throw new Error("buildGitHubCheckRunOutput requires ScanResult.decision");
|
|
23
|
+
}
|
|
24
|
+
const bundle = buildScanPresentationBundle({
|
|
25
|
+
result,
|
|
26
|
+
pipelineStatus: "done",
|
|
27
|
+
});
|
|
28
|
+
if (!bundle) {
|
|
29
|
+
throw new Error("buildGitHubCheckRunOutput requires ScanResult.assessment for presentation bundle");
|
|
30
|
+
}
|
|
31
|
+
const baseline = result.reportPresentation?.mode === "lightweight_pr_graph_baseline";
|
|
32
|
+
const presentation = presentGitHubCheckRun(bundle, {
|
|
33
|
+
scanId,
|
|
34
|
+
webAppOrigin,
|
|
35
|
+
baseline,
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
title: presentation.title,
|
|
39
|
+
summary: renderGitHubCheckRunMarkdown(presentation),
|
|
40
|
+
conclusion: presentation.conclusion,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildGitHubCheckRunOutput.test.d.ts","sourceRoot":"","sources":["../../src/presentation/buildGitHubCheckRunOutput.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { buildScanPresentationBundle, presentDashboardCard } from "./index.js";
|
|
3
|
+
import { buildGitHubCheckRunOutput } from "./buildGitHubCheckRunOutput.js";
|
|
4
|
+
const safeAssessment = {
|
|
5
|
+
posture: "safe",
|
|
6
|
+
confidence: "high",
|
|
7
|
+
primaryConcern: null,
|
|
8
|
+
concerns: [],
|
|
9
|
+
factors: ["tooling_maintenance"],
|
|
10
|
+
changeClasses: ["tooling_maintenance"],
|
|
11
|
+
presentation: {
|
|
12
|
+
narrativeIntensity: "minimal",
|
|
13
|
+
reachVisibility: "hidden",
|
|
14
|
+
verificationIntensity: "advisory",
|
|
15
|
+
insightEmissionFloor: "none",
|
|
16
|
+
reportMode: "high_signal_pr",
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const baselineAssessment = {
|
|
20
|
+
posture: "safe",
|
|
21
|
+
confidence: "medium",
|
|
22
|
+
primaryConcern: "graph_baseline_only",
|
|
23
|
+
concerns: [
|
|
24
|
+
{
|
|
25
|
+
kind: "graph_baseline_only",
|
|
26
|
+
rank: 1,
|
|
27
|
+
evidenceRefs: ["fixture:baseline"],
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
factors: ["graph_baseline_only"],
|
|
31
|
+
changeClasses: ["tooling_maintenance"],
|
|
32
|
+
presentation: {
|
|
33
|
+
narrativeIntensity: "minimal",
|
|
34
|
+
reachVisibility: "hidden",
|
|
35
|
+
verificationIntensity: "none",
|
|
36
|
+
insightEmissionFloor: "none",
|
|
37
|
+
reportMode: "lightweight_pr_graph_baseline",
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
const needsReviewAssessment = {
|
|
41
|
+
posture: "needs_review",
|
|
42
|
+
confidence: "medium",
|
|
43
|
+
primaryConcern: "confirmed_runtime_usage",
|
|
44
|
+
concerns: [
|
|
45
|
+
{
|
|
46
|
+
kind: "confirmed_runtime_usage",
|
|
47
|
+
rank: 1,
|
|
48
|
+
packages: ["fastify"],
|
|
49
|
+
evidenceRefs: ["fixture:fastify"],
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
factors: ["confirmed_runtime_usage", "http_framework_infrastructure"],
|
|
53
|
+
changeClasses: ["runtime_upgrade"],
|
|
54
|
+
presentation: {
|
|
55
|
+
narrativeIntensity: "elevated",
|
|
56
|
+
reachVisibility: "prominent",
|
|
57
|
+
verificationIntensity: "required",
|
|
58
|
+
insightEmissionFloor: "full",
|
|
59
|
+
reportMode: "high_signal_pr",
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
const riskyAssessment = {
|
|
63
|
+
posture: "risky",
|
|
64
|
+
confidence: "high",
|
|
65
|
+
primaryConcern: "breaking_or_major",
|
|
66
|
+
concerns: [
|
|
67
|
+
{
|
|
68
|
+
kind: "breaking_or_major",
|
|
69
|
+
rank: 1,
|
|
70
|
+
packages: ["react"],
|
|
71
|
+
evidenceRefs: ["fixture:breaking"],
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
factors: ["breaking_or_major"],
|
|
75
|
+
changeClasses: ["breaking_change"],
|
|
76
|
+
presentation: {
|
|
77
|
+
narrativeIntensity: "elevated",
|
|
78
|
+
reachVisibility: "prominent",
|
|
79
|
+
verificationIntensity: "required",
|
|
80
|
+
insightEmissionFloor: "full",
|
|
81
|
+
reportMode: "high_signal_pr",
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
function assertNoLegacyCheckRunMarkers(summary) {
|
|
85
|
+
expect(summary).not.toContain("Risk index");
|
|
86
|
+
expect(summary).not.toContain("Layer scores");
|
|
87
|
+
expect(summary).not.toContain("<details>");
|
|
88
|
+
expect(summary).not.toMatch(/\d+\/100/);
|
|
89
|
+
}
|
|
90
|
+
function minimalScanResult(overrides = {}) {
|
|
91
|
+
return {
|
|
92
|
+
totalScore: 72,
|
|
93
|
+
layerScores: {
|
|
94
|
+
security: 10,
|
|
95
|
+
maintainability: 20,
|
|
96
|
+
ecosystem: 30,
|
|
97
|
+
upgradeImpact: 15,
|
|
98
|
+
},
|
|
99
|
+
findings: [],
|
|
100
|
+
methodologyVersion: "mergesignal-engine/test",
|
|
101
|
+
generatedAt: new Date().toISOString(),
|
|
102
|
+
assessment: safeAssessment,
|
|
103
|
+
decision: {
|
|
104
|
+
recommendation: "safe",
|
|
105
|
+
confidence: "medium",
|
|
106
|
+
reasoning: [],
|
|
107
|
+
},
|
|
108
|
+
...overrides,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
describe("buildGitHubCheckRunOutput", () => {
|
|
112
|
+
it("maps safe posture to success conclusion with scan link", () => {
|
|
113
|
+
const out = buildGitHubCheckRunOutput(minimalScanResult(), {
|
|
114
|
+
scanId: "scan-safe",
|
|
115
|
+
webAppOrigin: "https://app.test",
|
|
116
|
+
});
|
|
117
|
+
expect(out.conclusion).toBe("success");
|
|
118
|
+
expect(out.summary).toContain("/scan/scan-safe");
|
|
119
|
+
expect(out.summary).toContain("Full scan:");
|
|
120
|
+
assertNoLegacyCheckRunMarkers(out.summary);
|
|
121
|
+
});
|
|
122
|
+
it("maps needs_review posture to neutral conclusion", () => {
|
|
123
|
+
const out = buildGitHubCheckRunOutput(minimalScanResult({
|
|
124
|
+
assessment: needsReviewAssessment,
|
|
125
|
+
decision: {
|
|
126
|
+
recommendation: "needs_review",
|
|
127
|
+
confidence: "medium",
|
|
128
|
+
reasoning: ["Runtime usage confirmed"],
|
|
129
|
+
},
|
|
130
|
+
changedPackages: ["fastify"],
|
|
131
|
+
}), { scanId: "scan-review", webAppOrigin: "https://app.test" });
|
|
132
|
+
expect(out.conclusion).toBe("neutral");
|
|
133
|
+
expect(out.summary).toContain("/scan/scan-review");
|
|
134
|
+
assertNoLegacyCheckRunMarkers(out.summary);
|
|
135
|
+
});
|
|
136
|
+
it("maps risky posture to failure conclusion", () => {
|
|
137
|
+
const out = buildGitHubCheckRunOutput(minimalScanResult({
|
|
138
|
+
assessment: riskyAssessment,
|
|
139
|
+
decision: {
|
|
140
|
+
recommendation: "risky",
|
|
141
|
+
confidence: "high",
|
|
142
|
+
reasoning: ["Breaking change"],
|
|
143
|
+
},
|
|
144
|
+
}), { scanId: "scan-risky", webAppOrigin: "https://app.test" });
|
|
145
|
+
expect(out.conclusion).toBe("failure");
|
|
146
|
+
assertNoLegacyCheckRunMarkers(out.summary);
|
|
147
|
+
});
|
|
148
|
+
it("produces success conclusion for lightweight baseline presentation", () => {
|
|
149
|
+
const out = buildGitHubCheckRunOutput(minimalScanResult({
|
|
150
|
+
assessment: baselineAssessment,
|
|
151
|
+
reportPresentation: { mode: "lightweight_pr_graph_baseline" },
|
|
152
|
+
changedPackages: ["@types/minimist"],
|
|
153
|
+
decision: {
|
|
154
|
+
recommendation: "safe",
|
|
155
|
+
confidence: "medium",
|
|
156
|
+
reasoning: [],
|
|
157
|
+
},
|
|
158
|
+
}), { scanId: "scan-lw", webAppOrigin: "https://app.test" });
|
|
159
|
+
expect(out.conclusion).toBe("success");
|
|
160
|
+
expect(out.summary).toContain("/scan/scan-lw");
|
|
161
|
+
assertNoLegacyCheckRunMarkers(out.summary);
|
|
162
|
+
});
|
|
163
|
+
it("throws when assessment is missing", () => {
|
|
164
|
+
expect(() => buildGitHubCheckRunOutput(minimalScanResult({ assessment: undefined }), "scan-no-assessment")).toThrow(/assessment/i);
|
|
165
|
+
});
|
|
166
|
+
it("title matches dashboard card headline from the same bundle", () => {
|
|
167
|
+
const result = minimalScanResult({
|
|
168
|
+
assessment: needsReviewAssessment,
|
|
169
|
+
decision: {
|
|
170
|
+
recommendation: "needs_review",
|
|
171
|
+
confidence: "medium",
|
|
172
|
+
reasoning: ["Runtime usage confirmed"],
|
|
173
|
+
},
|
|
174
|
+
changedPackages: ["fastify"],
|
|
175
|
+
});
|
|
176
|
+
const out = buildGitHubCheckRunOutput(result, {
|
|
177
|
+
scanId: "scan-parity",
|
|
178
|
+
webAppOrigin: "https://app.test",
|
|
179
|
+
});
|
|
180
|
+
const bundle = buildScanPresentationBundle({
|
|
181
|
+
result,
|
|
182
|
+
pipelineStatus: "done",
|
|
183
|
+
});
|
|
184
|
+
expect(bundle).not.toBeNull();
|
|
185
|
+
const card = presentDashboardCard(bundle);
|
|
186
|
+
expect(out.title).toBe(card.headline);
|
|
187
|
+
});
|
|
188
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"narrativeChannels.d.ts","sourceRoot":"","sources":["../../../src/presentation/compose/narrativeChannels.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"narrativeChannels.d.ts","sourceRoot":"","sources":["../../../src/presentation/compose/narrativeChannels.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAGzF,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,EAAE,uBAAuB,EAAE,CAAC;IACpC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAqBF,yFAAyF;AACzF,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,sBAAsB,GAC7B,iBAAiB,CAmBnB;AAED,mGAAmG;AACnG,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,iBAAiB,EAC3B,GAAG,EAAE,MAAM,GACV,MAAM,EAAE,CAyBV"}
|
|
@@ -1,61 +1,31 @@
|
|
|
1
|
-
import { deriveDetailReachChip } from "../../formatCardExposureDisplay.js";
|
|
2
1
|
import { scanSurfaceCopy } from "../../scanSurfaceCopy.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { labelBlastRadiusLevel
|
|
2
|
+
import { applicationAreaLabels, formatAssessmentHeadline, projectInsightLines, projectVerificationActions, reachVisibilityLabel, } from "../../assessmentProjection.js";
|
|
3
|
+
import { safeParseRepoIntelligence } from "../../repoIntelligenceSchema.js";
|
|
4
|
+
import { labelBlastRadiusLevel } from "../../narrativePresentation.js";
|
|
6
5
|
function composeScopeAreaLabels(bundle, max) {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (formatted[0])
|
|
11
|
-
labels.push(formatted[0]);
|
|
12
|
-
if (labels.length >= max)
|
|
13
|
-
break;
|
|
14
|
-
}
|
|
15
|
-
return labels;
|
|
16
|
-
}
|
|
17
|
-
function isTautologicalEvidenceRow(row) {
|
|
18
|
-
const label = row.label.trim().toLowerCase();
|
|
19
|
-
const value = row.value.trim().toLowerCase();
|
|
20
|
-
if (label === "runtime" && value === "runtime")
|
|
21
|
-
return true;
|
|
22
|
-
return false;
|
|
6
|
+
const parsed = safeParseRepoIntelligence(bundle.result.repoIntelligence);
|
|
7
|
+
const labels = parsed.ok ? applicationAreaLabels(parsed.value) : [];
|
|
8
|
+
return labels.slice(0, max);
|
|
23
9
|
}
|
|
24
10
|
function composeChannelEvidence(bundle, max) {
|
|
25
|
-
const
|
|
11
|
+
const blast = labelBlastRadiusLevel(bundle.facts);
|
|
26
12
|
const rows = [];
|
|
27
|
-
if (!profile.interpretation.suppressRuntimeNarrative) {
|
|
28
|
-
const reach = labelReachabilityKind(facts);
|
|
29
|
-
if (reach)
|
|
30
|
-
rows.push({ label: "Reachability", value: reach });
|
|
31
|
-
}
|
|
32
|
-
const blast = labelBlastRadiusLevel(facts);
|
|
33
13
|
if (blast)
|
|
34
14
|
rows.push({ label: "Blast radius", value: blast });
|
|
35
|
-
return rows.
|
|
36
|
-
}
|
|
37
|
-
function shouldShowReachLabel(bundle) {
|
|
38
|
-
const { profile } = bundle;
|
|
39
|
-
if (profile.status === "safe" && profile.density === "minimal") {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
return profile.status !== "safe" || profile.density !== "minimal";
|
|
15
|
+
return rows.slice(0, max);
|
|
43
16
|
}
|
|
44
17
|
/** Canonical non-redundant narrative channels — single dedupe point for all surfaces. */
|
|
45
18
|
export function buildNarrativeChannels(bundle) {
|
|
46
|
-
const {
|
|
47
|
-
const
|
|
48
|
-
const reachLabel = shouldShowReachLabel(bundle) && riskIndex != null
|
|
49
|
-
? (deriveDetailReachChip(riskIndex) ?? undefined)
|
|
50
|
-
: undefined;
|
|
19
|
+
const { assessment, presentation, profile, result } = bundle;
|
|
20
|
+
const reachLabel = reachVisibilityLabel(presentation.reachVisibility);
|
|
51
21
|
return {
|
|
52
|
-
headline:
|
|
22
|
+
headline: formatAssessmentHeadline(assessment, result, profile.status),
|
|
53
23
|
limitedContextMessage: profile.degradedMessage ?? undefined,
|
|
54
24
|
reachLabel,
|
|
55
|
-
insights:
|
|
25
|
+
insights: projectInsightLines(assessment, result),
|
|
56
26
|
scopeAreas: composeScopeAreaLabels(bundle, 4),
|
|
57
27
|
evidence: composeChannelEvidence(bundle, 4),
|
|
58
|
-
verification:
|
|
28
|
+
verification: projectVerificationActions(assessment, presentation, result, 6),
|
|
59
29
|
};
|
|
60
30
|
}
|
|
61
31
|
/** Merge distinct channels into one bullet list for single-column surfaces (GitHub check, CLI). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"narrativeCompose.d.ts","sourceRoot":"","sources":["../../../src/presentation/compose/narrativeCompose.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"narrativeCompose.d.ts","sourceRoot":"","sources":["../../../src/presentation/compose/narrativeCompose.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAMzF,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAShC,wBAAgB,eAAe,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAEtE;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,sBAAsB,GAC7B,MAAM,GAAG,SAAS,CAIpB;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,sBAAsB,EAC9B,GAAG,EAAE,MAAM,GACV,MAAM,EAAE,CAEV;AAED,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,sBAAsB,EAC9B,GAAG,EAAE,MAAM,GACV,MAAM,EAAE,CAEV;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,sBAAsB,EAC9B,GAAG,EAAE,MAAM,GACV,MAAM,EAAE,CAQV;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,sBAAsB,EAC9B,GAAG,EAAE,MAAM,GACV,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAmBzC;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,sBAAsB,GAC7B,MAAM,EAAE,GAAG,SAAS,CAwBtB;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,sBAAsB,GAAG;IAC1E,QAAQ,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAKA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { formatCardAreaLabels } from "../../formatCardAreaLabels.js";
|
|
2
2
|
import { formatChangedPackagesShort, labelBlastRadiusLevel, labelReachabilityKind, labelRuntimeSurface, } from "../../narrativePresentation.js";
|
|
3
3
|
import { scanSurfaceCopy } from "../../scanSurfaceCopy.js";
|
|
4
|
-
import { formatPresentationHeadline, formatPresentationVerification, } from "../intent/formatPresentationCopy.js";
|
|
5
4
|
import { buildNarrativeChannels, projectCompactKeyPoints, } from "./narrativeChannels.js";
|
|
6
5
|
export { buildNarrativeChannels, projectCompactKeyPoints, } from "./narrativeChannels.js";
|
|
7
6
|
function topAreaLabel(bundle) {
|
|
@@ -12,8 +11,7 @@ function topAreaLabel(bundle) {
|
|
|
12
11
|
return formatted[0] ?? area.label;
|
|
13
12
|
}
|
|
14
13
|
export function composeHeadline(bundle) {
|
|
15
|
-
|
|
16
|
-
return formatPresentationHeadline(profile.interpretation, facts, profile.status);
|
|
14
|
+
return buildNarrativeChannels(bundle).headline;
|
|
17
15
|
}
|
|
18
16
|
export function composeSubheadline(bundle) {
|
|
19
17
|
const { profile } = bundle;
|
|
@@ -25,8 +23,7 @@ export function composeKeyPoints(bundle, max) {
|
|
|
25
23
|
return projectCompactKeyPoints(buildNarrativeChannels(bundle), max);
|
|
26
24
|
}
|
|
27
25
|
export function composeVerificationActions(bundle, max) {
|
|
28
|
-
|
|
29
|
-
return formatPresentationVerification(profile.interpretation, profile.status, max);
|
|
26
|
+
return buildNarrativeChannels(bundle).verification.slice(0, max);
|
|
30
27
|
}
|
|
31
28
|
export function composeAffectedAreaLabels(bundle, max) {
|
|
32
29
|
const labels = [];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MergeConcernKind } from "../../assessmentSchema.js";
|
|
2
|
+
import type { NarrativeIntensity, ReachVisibility } from "../../assessmentSchema.js";
|
|
3
|
+
/** Assessment-aligned fields projected identically across surfaces. */
|
|
4
|
+
export type AssessmentPresentationFields = {
|
|
5
|
+
posture: "safe" | "needs_review" | "risky";
|
|
6
|
+
primaryConcern: MergeConcernKind | null;
|
|
7
|
+
factors: string[];
|
|
8
|
+
reasoning: string[];
|
|
9
|
+
verificationFocus: string[];
|
|
10
|
+
reachVisibility: ReachVisibility;
|
|
11
|
+
narrativeIntensity: NarrativeIntensity;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=assessmentPresentationFields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assessmentPresentationFields.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/assessmentPresentationFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EAEhB,MAAM,2BAA2B,CAAC;AAEnC,uEAAuE;AACvE,MAAM,MAAM,4BAA4B,GAAG;IACzC,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,OAAO,CAAC;IAC3C,cAAc,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACxC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,eAAe,EAAE,eAAe,CAAC;IACjC,kBAAkB,EAAE,kBAAkB,CAAC;CACxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { AssessmentPresentationFields } from "./assessmentPresentationFields.js";
|
|
1
2
|
import type { PresentationEvidenceRow, PresentationStatus } from "./types.js";
|
|
2
3
|
export type DashboardCardLayout = "quiet" | "standard" | "expanded";
|
|
3
|
-
export type DashboardCardPresentation = {
|
|
4
|
+
export type DashboardCardPresentation = Partial<AssessmentPresentationFields> & {
|
|
4
5
|
verdict?: {
|
|
5
6
|
posture: PresentationStatus;
|
|
6
7
|
postureLabel: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboardCardPresentation.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/dashboardCardPresentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE9E,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;AAEpE,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,CAAC,EAAE;QACR,OAAO,EAAE,kBAAkB,CAAC;QAC5B,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IAEF,QAAQ,EAAE,MAAM,CAAC;IAEjB,QAAQ,CAAC,EAAE;QACT,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;QACxC,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IAEF,cAAc,CAAC,EAAE;QACf,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAE1C,MAAM,EAAE,mBAAmB,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAE1B,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"dashboardCardPresentation.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/dashboardCardPresentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,KAAK,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE9E,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;AAEpE,MAAM,MAAM,yBAAyB,GACnC,OAAO,CAAC,4BAA4B,CAAC,GAAG;IACtC,OAAO,CAAC,EAAE;QACR,OAAO,EAAE,kBAAkB,CAAC;QAC5B,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IAEF,QAAQ,EAAE,MAAM,CAAC;IAEjB,QAAQ,CAAC,EAAE;QACT,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;QACxC,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IAEF,cAAc,CAAC,EAAE;QACf,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAE1C,MAAM,EAAE,mBAAmB,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAE1B,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,CAAC"}
|