@mergesignal/shared 0.2.8 → 0.4.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/deriveScanNarrative.d.ts +0 -3
- package/dist/deriveScanNarrative.d.ts.map +1 -1
- package/dist/deriveScanNarrative.js +30 -19
- package/dist/deriveScanNarrative.test.js +37 -8
- package/dist/engineWireRegression.test.d.ts +2 -0
- package/dist/engineWireRegression.test.d.ts.map +1 -0
- package/dist/engineWireRegression.test.js +57 -0
- package/dist/fixtures/legacyEngineRepoIntelligence.d.ts +28 -0
- package/dist/fixtures/legacyEngineRepoIntelligence.d.ts.map +1 -0
- package/dist/fixtures/legacyEngineRepoIntelligence.js +28 -0
- package/dist/fixtures/repoIntelligenceFixtures.d.ts +0 -2
- package/dist/fixtures/repoIntelligenceFixtures.d.ts.map +1 -1
- package/dist/fixtures/repoIntelligenceFixtures.js +14 -4
- package/dist/fixtures/repoIntelligenceTestHelpers.d.ts +5 -0
- package/dist/fixtures/repoIntelligenceTestHelpers.d.ts.map +1 -0
- package/dist/fixtures/repoIntelligenceTestHelpers.js +28 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/narrativeParity.test.js +21 -19
- package/dist/narrativePresentation.test.js +2 -1
- package/dist/presentGitHubPrComment.d.ts +3 -4
- package/dist/presentGitHubPrComment.d.ts.map +1 -1
- package/dist/presentGitHubPrComment.js +15 -61
- package/dist/presentation/compose/narrativeCompose.d.ts +16 -0
- package/dist/presentation/compose/narrativeCompose.d.ts.map +1 -0
- package/dist/presentation/compose/narrativeCompose.js +167 -0
- package/dist/presentation/dto/githubAndCliPresentation.d.ts +53 -0
- package/dist/presentation/dto/githubAndCliPresentation.d.ts.map +1 -0
- package/dist/presentation/dto/githubAndCliPresentation.js +1 -0
- package/dist/presentation/dto/scanCardPresentation.d.ts +25 -0
- package/dist/presentation/dto/scanCardPresentation.d.ts.map +1 -0
- package/dist/presentation/dto/scanCardPresentation.js +1 -0
- package/dist/presentation/dto/scanDetailsPresentation.d.ts +111 -0
- package/dist/presentation/dto/scanDetailsPresentation.d.ts.map +1 -0
- package/dist/presentation/dto/scanDetailsPresentation.js +1 -0
- package/dist/presentation/dto/types.d.ts +24 -0
- package/dist/presentation/dto/types.d.ts.map +1 -0
- package/dist/presentation/dto/types.js +22 -0
- package/dist/presentation/fixtures/scanResultFixtures.d.ts +5 -0
- package/dist/presentation/fixtures/scanResultFixtures.d.ts.map +1 -0
- package/dist/presentation/fixtures/scanResultFixtures.js +83 -0
- package/dist/presentation/index.d.ts +25 -0
- package/dist/presentation/index.d.ts.map +1 -0
- package/dist/presentation/index.js +13 -0
- package/dist/presentation/orchestration/buildScanCardPresentation.d.ts +11 -0
- package/dist/presentation/orchestration/buildScanCardPresentation.d.ts.map +1 -0
- package/dist/presentation/orchestration/buildScanCardPresentation.js +44 -0
- package/dist/presentation/orchestration/buildScanDetailsPresentation.d.ts +14 -0
- package/dist/presentation/orchestration/buildScanDetailsPresentation.d.ts.map +1 -0
- package/dist/presentation/orchestration/buildScanDetailsPresentation.js +19 -0
- package/dist/presentation/orchestration/buildScanPresentationBundle.d.ts +15 -0
- package/dist/presentation/orchestration/buildScanPresentationBundle.d.ts.map +1 -0
- package/dist/presentation/orchestration/buildScanPresentationBundle.js +23 -0
- package/dist/presentation/orchestration/scanPresentationBundle.d.ts +15 -0
- package/dist/presentation/orchestration/scanPresentationBundle.d.ts.map +1 -0
- package/dist/presentation/orchestration/scanPresentationBundle.js +1 -0
- package/dist/presentation/presentation.test.d.ts +2 -0
- package/dist/presentation/presentation.test.d.ts.map +1 -0
- package/dist/presentation/presentation.test.js +95 -0
- package/dist/presentation/presenters/presentCliScanSummary.d.ts +6 -0
- package/dist/presentation/presenters/presentCliScanSummary.d.ts.map +1 -0
- package/dist/presentation/presenters/presentCliScanSummary.js +30 -0
- package/dist/presentation/presenters/presentGitHubCheckRun.d.ts +8 -0
- package/dist/presentation/presenters/presentGitHubCheckRun.d.ts.map +1 -0
- package/dist/presentation/presenters/presentGitHubCheckRun.js +32 -0
- package/dist/presentation/presenters/presentGitHubPrComment.d.ts +4 -0
- package/dist/presentation/presenters/presentGitHubPrComment.d.ts.map +1 -0
- package/dist/presentation/presenters/presentGitHubPrComment.js +40 -0
- package/dist/presentation/presenters/presentPipelineScanCard.d.ts +3 -0
- package/dist/presentation/presenters/presentPipelineScanCard.d.ts.map +1 -0
- package/dist/presentation/presenters/presentPipelineScanCard.js +23 -0
- package/dist/presentation/presenters/presentScanCard.d.ts +7 -0
- package/dist/presentation/presenters/presentScanCard.d.ts.map +1 -0
- package/dist/presentation/presenters/presentScanCard.js +43 -0
- package/dist/presentation/presenters/presentScanDetails.d.ts +9 -0
- package/dist/presentation/presenters/presentScanDetails.d.ts.map +1 -0
- package/dist/presentation/presenters/presentScanDetails.js +177 -0
- package/dist/presentation/profile/derivePresentationProfile.d.ts +12 -0
- package/dist/presentation/profile/derivePresentationProfile.d.ts.map +1 -0
- package/dist/presentation/profile/derivePresentationProfile.js +86 -0
- package/dist/presentation/profile/presentationProfile.d.ts +9 -0
- package/dist/presentation/profile/presentationProfile.d.ts.map +1 -0
- package/dist/presentation/profile/presentationProfile.js +1 -0
- package/dist/presentation/render/renderCliScanSummaryText.d.ts +3 -0
- package/dist/presentation/render/renderCliScanSummaryText.d.ts.map +1 -0
- package/dist/presentation/render/renderCliScanSummaryText.js +30 -0
- package/dist/presentation/render/renderGitHubCheckRunMarkdown.d.ts +3 -0
- package/dist/presentation/render/renderGitHubCheckRunMarkdown.d.ts.map +1 -0
- package/dist/presentation/render/renderGitHubCheckRunMarkdown.js +23 -0
- package/dist/presentation/render/renderGitHubPrCommentMarkdown.d.ts +3 -0
- package/dist/presentation/render/renderGitHubPrCommentMarkdown.d.ts.map +1 -0
- package/dist/presentation/render/renderGitHubPrCommentMarkdown.js +24 -0
- package/dist/repoIntelligenceMappers.d.ts +20 -0
- package/dist/repoIntelligenceMappers.d.ts.map +1 -0
- package/dist/repoIntelligenceMappers.js +60 -0
- package/dist/repoIntelligenceSchema.contract.test.d.ts +2 -0
- package/dist/repoIntelligenceSchema.contract.test.d.ts.map +1 -0
- package/dist/repoIntelligenceSchema.contract.test.js +19 -0
- package/dist/repoIntelligenceSchema.d.ts +52 -83
- package/dist/repoIntelligenceSchema.d.ts.map +1 -1
- package/dist/repoIntelligenceSchema.js +99 -141
- package/dist/repoIntelligenceValidation.d.ts +18 -0
- package/dist/repoIntelligenceValidation.d.ts.map +1 -0
- package/dist/repoIntelligenceValidation.js +76 -0
- package/dist/repoIntelligenceValidation.persist.test.d.ts +2 -0
- package/dist/repoIntelligenceValidation.persist.test.d.ts.map +1 -0
- package/dist/repoIntelligenceValidation.persist.test.js +44 -0
- package/dist/scanCardSummary.d.ts +4 -35
- package/dist/scanCardSummary.d.ts.map +1 -1
- package/dist/scanCardSummary.js +12 -63
- package/dist/scanCardSummary.test.js +56 -75
- package/dist/scanDetailViewModel.d.ts +1 -0
- package/dist/scanDetailViewModel.d.ts.map +1 -1
- package/dist/scanDetailViewModel.js +1 -1
- package/dist/scanDetailViewModel.test.js +2 -1
- package/dist/scanNarrativeFacts.d.ts +2 -0
- package/dist/scanNarrativeFacts.d.ts.map +1 -1
- package/dist/scanNarrativeFacts.js +1 -0
- package/dist/scanSurfaceCopy.d.ts +25 -0
- package/dist/scanSurfaceCopy.d.ts.map +1 -1
- package/dist/scanSurfaceCopy.js +25 -0
- package/dist/types.d.ts +15 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/presentScanCardSummary.d.ts +0 -16
- package/dist/presentScanCardSummary.d.ts.map +0 -1
- package/dist/presentScanCardSummary.js +0 -212
|
@@ -1,66 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { MERGE_POSTURE_LABEL, mergePostureFromDecision, } from "./riskVocabulary.js";
|
|
5
|
-
import { scanSurfaceCopy } from "./scanSurfaceCopy.js";
|
|
6
|
-
function renderGuidanceBlock(message, where, action) {
|
|
7
|
-
return [
|
|
8
|
-
normalizeGeneratedText(message),
|
|
9
|
-
"",
|
|
10
|
-
"**Where it shows up**",
|
|
11
|
-
"",
|
|
12
|
-
normalizeGeneratedText(where),
|
|
13
|
-
"",
|
|
14
|
-
"**What to do**",
|
|
15
|
-
"",
|
|
16
|
-
normalizeGeneratedText(action),
|
|
17
|
-
].join("\n");
|
|
18
|
-
}
|
|
1
|
+
import { buildScanPresentationBundle } from "./presentation/orchestration/buildScanPresentationBundle.js";
|
|
2
|
+
import { presentGitHubPrComment as presentGitHubPrCommentFromBundle } from "./presentation/presenters/presentGitHubPrComment.js";
|
|
3
|
+
import { renderGitHubPrCommentMarkdown } from "./presentation/render/renderGitHubPrCommentMarkdown.js";
|
|
19
4
|
/**
|
|
20
|
-
* PR comment markdown from
|
|
5
|
+
* PR comment markdown from a completed scan (via presentation bundle).
|
|
21
6
|
*/
|
|
22
|
-
export function
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
:
|
|
28
|
-
const introLines = [];
|
|
29
|
-
const changed = formatChangedPackagesShort(facts, 3);
|
|
30
|
-
if (changed)
|
|
31
|
-
introLines.push(`Changed: ${changed}`);
|
|
32
|
-
const usage = formatUsageSummaryLine(facts, 1);
|
|
33
|
-
if (usage)
|
|
34
|
-
introLines.push(usage);
|
|
35
|
-
const verify = composeVerificationPrompt(facts);
|
|
36
|
-
if (verify)
|
|
37
|
-
introLines.push(`Verify: ${verify}`);
|
|
38
|
-
const guidance = selectReviewerGuidance(facts, { scope: "changed", max: 3 });
|
|
39
|
-
if (guidance.length === 0) {
|
|
40
|
-
const fallback = selectReviewerGuidance(facts, { max: 3 });
|
|
41
|
-
guidance.push(...fallback.slice(0, 3 - guidance.length));
|
|
42
|
-
}
|
|
43
|
-
const blocks = guidance.map((g) => {
|
|
44
|
-
const where = g.context?.trim() ||
|
|
45
|
-
facts.packageUsage
|
|
46
|
-
.flatMap((u) => u.paths.slice(0, 1))
|
|
47
|
-
.filter(Boolean)[0] ||
|
|
48
|
-
"See scan detail for affected paths.";
|
|
49
|
-
const action = g.remediation?.trim() ||
|
|
50
|
-
composeVerificationPrompt(facts) ||
|
|
51
|
-
"Review before merge.";
|
|
52
|
-
return renderGuidanceBlock(g.message, where, action);
|
|
7
|
+
export function presentGitHubPrCommentMarkdownFromResult(result) {
|
|
8
|
+
const bundle = buildScanPresentationBundle({
|
|
9
|
+
result,
|
|
10
|
+
pipelineStatus: "done",
|
|
11
|
+
decision: result.decision?.recommendation,
|
|
12
|
+
totalScore: result.totalScore,
|
|
53
13
|
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
if (blocks.length > 0) {
|
|
59
|
-
parts.push("", ...blocks);
|
|
60
|
-
}
|
|
61
|
-
return parts.join("\n\n---\n\n").trimEnd();
|
|
14
|
+
if (!bundle)
|
|
15
|
+
return "";
|
|
16
|
+
return renderGitHubPrCommentMarkdown(presentGitHubPrCommentFromBundle(bundle));
|
|
62
17
|
}
|
|
63
|
-
/** Backward-compatible entry: derives
|
|
18
|
+
/** Backward-compatible entry: derives bundle then renders markdown. */
|
|
64
19
|
export function renderInsightsAsMarkdown(insights, decision) {
|
|
65
20
|
const result = {
|
|
66
21
|
totalScore: 0,
|
|
@@ -75,6 +30,5 @@ export function renderInsightsAsMarkdown(insights, decision) {
|
|
|
75
30
|
insights,
|
|
76
31
|
decision,
|
|
77
32
|
};
|
|
78
|
-
|
|
79
|
-
return presentGitHubPrComment(facts, result);
|
|
33
|
+
return presentGitHubPrCommentMarkdownFromResult(result);
|
|
80
34
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ScanPresentationBundle } from "../orchestration/scanPresentationBundle.js";
|
|
2
|
+
export declare function composeHeadline(bundle: ScanPresentationBundle): string;
|
|
3
|
+
export declare function composeSubheadline(bundle: ScanPresentationBundle): string | undefined;
|
|
4
|
+
export declare function composeKeyPoints(bundle: ScanPresentationBundle, max: number): string[];
|
|
5
|
+
export declare function composeVerificationActions(bundle: ScanPresentationBundle, max: number): string[];
|
|
6
|
+
export declare function composeAffectedAreaLabels(bundle: ScanPresentationBundle, max: number): string[];
|
|
7
|
+
export declare function composeEvidenceRows(bundle: ScanPresentationBundle, max: number): Array<{
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function composeSupportingContext(bundle: ScanPresentationBundle): string[] | undefined;
|
|
12
|
+
export declare function evidenceContextFromProfile(bundle: ScanPresentationBundle): {
|
|
13
|
+
priority: "pr_intelligence" | "limited";
|
|
14
|
+
degradedMessage?: string;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=narrativeCompose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"narrativeCompose.d.ts","sourceRoot":"","sources":["../../../src/presentation/compose/narrativeCompose.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AASzF,wBAAgB,eAAe,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAwCtE;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,CA2EV;AAED,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,sBAAsB,EAC9B,GAAG,EAAE,MAAM,GACV,MAAM,EAAE,CA0BV;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,CAiBzC;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"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { formatCardAreaLabels } from "../../formatCardAreaLabels.js";
|
|
2
|
+
import { composeVerificationPrompt, formatChangedPackagesShort, labelBlastRadiusLevel, labelReachabilityKind, labelRuntimeSurface, selectReviewerGuidance, summarizeBlastRadius, summarizePackageUsage, } from "../../narrativePresentation.js";
|
|
3
|
+
import { scanSurfaceCopy } from "../../scanSurfaceCopy.js";
|
|
4
|
+
function topAreaLabel(bundle) {
|
|
5
|
+
const area = bundle.facts.affectedAreas[0];
|
|
6
|
+
if (!area)
|
|
7
|
+
return null;
|
|
8
|
+
const formatted = formatCardAreaLabels([area.label], 1);
|
|
9
|
+
return formatted[0] ?? area.label;
|
|
10
|
+
}
|
|
11
|
+
export function composeHeadline(bundle) {
|
|
12
|
+
const { facts, profile } = bundle;
|
|
13
|
+
const primary = facts.changedPackages.primary;
|
|
14
|
+
if (profile.priority === "limited") {
|
|
15
|
+
return scanSurfaceCopy.presentation.limitedContextHeadline;
|
|
16
|
+
}
|
|
17
|
+
if (!primary) {
|
|
18
|
+
return scanSurfaceCopy.presentation.noChangedPackagesHeadline;
|
|
19
|
+
}
|
|
20
|
+
const runtime = facts.runtimeSurface?.kind === "runtime";
|
|
21
|
+
const area = topAreaLabel(bundle);
|
|
22
|
+
if (facts.changedPackages.all.length > 1 && runtime) {
|
|
23
|
+
return scanSurfaceCopy.presentation.multiRuntimeHeadline;
|
|
24
|
+
}
|
|
25
|
+
if (facts.runtimeSurface?.kind === "build" ||
|
|
26
|
+
facts.reachability?.kind === "build_only") {
|
|
27
|
+
return scanSurfaceCopy.presentation.buildOnlyHeadline.replace("{package}", primary);
|
|
28
|
+
}
|
|
29
|
+
if (runtime) {
|
|
30
|
+
const surface = area ?? labelRuntimeSurface(facts) ?? "application code";
|
|
31
|
+
return scanSurfaceCopy.presentation.runtimeHeadline
|
|
32
|
+
.replace("{package}", primary)
|
|
33
|
+
.replace("{surface}", surface);
|
|
34
|
+
}
|
|
35
|
+
return scanSurfaceCopy.presentation.defaultUpgradeHeadline.replace("{package}", primary);
|
|
36
|
+
}
|
|
37
|
+
export function composeSubheadline(bundle) {
|
|
38
|
+
const { profile } = bundle;
|
|
39
|
+
if (profile.degradedMessage)
|
|
40
|
+
return profile.degradedMessage;
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
export function composeKeyPoints(bundle, max) {
|
|
44
|
+
const { facts, profile } = bundle;
|
|
45
|
+
const points = [];
|
|
46
|
+
if (profile.priority === "limited") {
|
|
47
|
+
points.push(scanSurfaceCopy.presentation.limitedContextKeyPoint);
|
|
48
|
+
if (facts.changedPackages.primary) {
|
|
49
|
+
points.push(scanSurfaceCopy.presentation.changedPackageKeyPoint.replace("{package}", facts.changedPackages.primary));
|
|
50
|
+
}
|
|
51
|
+
return points.slice(0, max);
|
|
52
|
+
}
|
|
53
|
+
const usage = summarizePackageUsage(facts, { maxPaths: 2 });
|
|
54
|
+
if (usage && usage.pathCount > 0) {
|
|
55
|
+
if (usage.pathCount === 1 && usage.pathSamples[0]) {
|
|
56
|
+
points.push(scanSurfaceCopy.presentation.usedInPathsSingle.replace("{path}", usage.pathSamples[0]));
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
points.push(scanSurfaceCopy.presentation.usedInPathsMultiple.replace("{count}", String(usage.pathCount)));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else if (profile.density === "minimal") {
|
|
63
|
+
points.push(scanSurfaceCopy.presentation.noRuntimePathsKeyPoint);
|
|
64
|
+
}
|
|
65
|
+
const blast = summarizeBlastRadius(facts, 2);
|
|
66
|
+
if (blast.levelLabel) {
|
|
67
|
+
if (blast.levelLabel.toLowerCase().includes("wide")) {
|
|
68
|
+
points.push(scanSurfaceCopy.presentation.blastRadiusWideKeyPoint);
|
|
69
|
+
}
|
|
70
|
+
else if (profile.density === "rich") {
|
|
71
|
+
points.push(scanSurfaceCopy.presentation.blastRadiusLevelKeyPoint.replace("{level}", blast.levelLabel));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (facts.affectedAreas.length === 0 && profile.density === "minimal") {
|
|
75
|
+
points.push(scanSurfaceCopy.presentation.noAffectedAreasKeyPoint);
|
|
76
|
+
}
|
|
77
|
+
else if (facts.affectedAreas.length > 0) {
|
|
78
|
+
const labels = facts.affectedAreas
|
|
79
|
+
.slice(0, 2)
|
|
80
|
+
.map((a) => a.label)
|
|
81
|
+
.join(", ");
|
|
82
|
+
points.push(scanSurfaceCopy.presentation.affectedAreasKeyPoint.replace("{areas}", labels));
|
|
83
|
+
}
|
|
84
|
+
const guidance = selectReviewerGuidance(facts, { scope: "changed", max: 2 });
|
|
85
|
+
for (const g of guidance) {
|
|
86
|
+
const msg = g.message.trim();
|
|
87
|
+
if (msg && !points.includes(msg))
|
|
88
|
+
points.push(msg);
|
|
89
|
+
if (points.length >= max)
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
return points.slice(0, max);
|
|
93
|
+
}
|
|
94
|
+
export function composeVerificationActions(bundle, max) {
|
|
95
|
+
const { facts, profile } = bundle;
|
|
96
|
+
const actions = [];
|
|
97
|
+
const guidance = selectReviewerGuidance(facts, { scope: "changed", max: 4 });
|
|
98
|
+
for (const g of guidance) {
|
|
99
|
+
const rem = g.remediation?.trim();
|
|
100
|
+
if (rem)
|
|
101
|
+
actions.push(rem);
|
|
102
|
+
}
|
|
103
|
+
const prompt = composeVerificationPrompt(facts);
|
|
104
|
+
if (prompt && !actions.includes(prompt))
|
|
105
|
+
actions.push(prompt);
|
|
106
|
+
if (actions.length === 0) {
|
|
107
|
+
if (profile.density === "minimal" ||
|
|
108
|
+
facts.runtimeSurface?.kind === "build") {
|
|
109
|
+
actions.push(scanSurfaceCopy.presentation.verifyCiTypecheck);
|
|
110
|
+
}
|
|
111
|
+
else if (profile.density === "rich") {
|
|
112
|
+
actions.push(scanSurfaceCopy.presentation.verifyAuthFlow);
|
|
113
|
+
actions.push(scanSurfaceCopy.presentation.verifyErrorResponses);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return actions.slice(0, max);
|
|
117
|
+
}
|
|
118
|
+
export function composeAffectedAreaLabels(bundle, max) {
|
|
119
|
+
const labels = [];
|
|
120
|
+
for (const area of bundle.facts.affectedAreas) {
|
|
121
|
+
const formatted = formatCardAreaLabels([area.label], 1);
|
|
122
|
+
if (formatted[0])
|
|
123
|
+
labels.push(formatted[0]);
|
|
124
|
+
if (labels.length >= max)
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
return labels;
|
|
128
|
+
}
|
|
129
|
+
export function composeEvidenceRows(bundle, max) {
|
|
130
|
+
const { facts } = bundle;
|
|
131
|
+
const rows = [];
|
|
132
|
+
const runtime = labelRuntimeSurface(facts);
|
|
133
|
+
if (runtime)
|
|
134
|
+
rows.push({ label: "Runtime", value: runtime });
|
|
135
|
+
const reach = labelReachabilityKind(facts);
|
|
136
|
+
if (reach)
|
|
137
|
+
rows.push({ label: "Reachability", value: reach });
|
|
138
|
+
const blast = labelBlastRadiusLevel(facts);
|
|
139
|
+
if (blast)
|
|
140
|
+
rows.push({ label: "Blast radius", value: blast });
|
|
141
|
+
const changed = formatChangedPackagesShort(facts, 3);
|
|
142
|
+
if (changed)
|
|
143
|
+
rows.push({ label: "Changed", value: changed });
|
|
144
|
+
return rows.slice(0, max);
|
|
145
|
+
}
|
|
146
|
+
export function composeSupportingContext(bundle) {
|
|
147
|
+
const { facts, profile, result } = bundle;
|
|
148
|
+
if (profile.density === "minimal")
|
|
149
|
+
return undefined;
|
|
150
|
+
const lines = [];
|
|
151
|
+
const graph = result.graphInsights;
|
|
152
|
+
if (graph?.maxDepth != null) {
|
|
153
|
+
lines.push(scanSurfaceCopy.presentation.graphDepthContext.replace("{depth}", String(graph.maxDepth)));
|
|
154
|
+
}
|
|
155
|
+
if (graph?.nodes != null && graph?.edges != null) {
|
|
156
|
+
lines.push(scanSurfaceCopy.presentation.graphSizeContext
|
|
157
|
+
.replace("{nodes}", String(graph.nodes))
|
|
158
|
+
.replace("{edges}", String(graph.edges)));
|
|
159
|
+
}
|
|
160
|
+
return lines.length > 0 ? lines.slice(0, 3) : undefined;
|
|
161
|
+
}
|
|
162
|
+
export function evidenceContextFromProfile(bundle) {
|
|
163
|
+
return {
|
|
164
|
+
priority: bundle.profile.priority,
|
|
165
|
+
degradedMessage: bundle.profile.degradedMessage,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { PresentationConfidence, PresentationDensity, PresentationEvidenceContext, PresentationStatus } from "./types.js";
|
|
2
|
+
export type GitHubCheckRunPresentation = {
|
|
3
|
+
status: PresentationStatus;
|
|
4
|
+
density: PresentationDensity;
|
|
5
|
+
confidence: PresentationConfidence;
|
|
6
|
+
evidenceContext: PresentationEvidenceContext;
|
|
7
|
+
title: string;
|
|
8
|
+
conclusion: "success" | "neutral" | "failure";
|
|
9
|
+
summaryLead: string;
|
|
10
|
+
sections: Array<{
|
|
11
|
+
id: "why" | "actions" | "usage" | "repoContext" | "layers" | "footer";
|
|
12
|
+
title?: string;
|
|
13
|
+
bullets: string[];
|
|
14
|
+
collapsed?: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
detailsUrl: string;
|
|
17
|
+
};
|
|
18
|
+
export type GitHubPrCommentPresentation = {
|
|
19
|
+
status: PresentationStatus;
|
|
20
|
+
density: PresentationDensity;
|
|
21
|
+
confidence: PresentationConfidence;
|
|
22
|
+
evidenceContext: PresentationEvidenceContext;
|
|
23
|
+
title: string;
|
|
24
|
+
introLines: string[];
|
|
25
|
+
guidanceBlocks: Array<{
|
|
26
|
+
message: string;
|
|
27
|
+
where?: string;
|
|
28
|
+
action?: string;
|
|
29
|
+
}>;
|
|
30
|
+
};
|
|
31
|
+
export type CliScanPresentation = {
|
|
32
|
+
header: {
|
|
33
|
+
repoLabel: string;
|
|
34
|
+
methodology?: string;
|
|
35
|
+
confidence?: string;
|
|
36
|
+
};
|
|
37
|
+
status: PresentationStatus;
|
|
38
|
+
density: PresentationDensity;
|
|
39
|
+
confidence: PresentationConfidence;
|
|
40
|
+
evidenceContext: PresentationEvidenceContext;
|
|
41
|
+
headline: string;
|
|
42
|
+
subheadline?: string;
|
|
43
|
+
keyPoints: string[];
|
|
44
|
+
verificationActions: string[];
|
|
45
|
+
metrics?: {
|
|
46
|
+
riskIndex: number;
|
|
47
|
+
layerLine: string;
|
|
48
|
+
findingCount: number;
|
|
49
|
+
recommendationCount: number;
|
|
50
|
+
};
|
|
51
|
+
supportingContext?: string[];
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=githubAndCliPresentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"githubAndCliPresentation.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/githubAndCliPresentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,mBAAmB,EACnB,2BAA2B,EAC3B,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,mBAAmB,CAAC;IAC7B,UAAU,EAAE,sBAAsB,CAAC;IACnC,eAAe,EAAE,2BAA2B,CAAC;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IAC9C,WAAW,EAAE,MAAM,CAAC;IAC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;QACrB,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FindingCountSummary, PresentationConfidence, PresentationDensity, PresentationEvidenceContext, PresentationEvidenceRow, PresentationStatus } from "./types.js";
|
|
2
|
+
export type ScanCardPresentation = {
|
|
3
|
+
pipeline?: {
|
|
4
|
+
status: "queued" | "running" | "failed";
|
|
5
|
+
headline: string;
|
|
6
|
+
subheadline?: string;
|
|
7
|
+
};
|
|
8
|
+
status?: PresentationStatus;
|
|
9
|
+
density?: PresentationDensity;
|
|
10
|
+
confidence?: PresentationConfidence;
|
|
11
|
+
evidenceContext?: PresentationEvidenceContext;
|
|
12
|
+
headline: string;
|
|
13
|
+
subheadline?: string;
|
|
14
|
+
changedPackages: string[];
|
|
15
|
+
primaryPackage?: string;
|
|
16
|
+
keyPoints: string[];
|
|
17
|
+
affectedAreas: string[];
|
|
18
|
+
verificationActions: string[];
|
|
19
|
+
evidence: PresentationEvidenceRow[];
|
|
20
|
+
supportingContext?: string[];
|
|
21
|
+
riskIndex?: number | null;
|
|
22
|
+
findingCounts?: FindingCountSummary | null;
|
|
23
|
+
actionLabel?: string;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=scanCardPresentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanCardPresentation.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/scanCardPresentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,2BAA2B,EAC3B,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,oBAAoB,GAAG;IACjC,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,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,UAAU,CAAC,EAAE,sBAAsB,CAAC;IACpC,eAAe,CAAC,EAAE,2BAA2B,CAAC;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,QAAQ,EAAE,uBAAuB,EAAE,CAAC;IAEpC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE7B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,aAAa,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { PresentationConfidence, PresentationDensity, PresentationEvidenceContext, PresentationStatus } from "./types.js";
|
|
2
|
+
import type { FindingSeverity, ScoreLayer } from "../../types.js";
|
|
3
|
+
export type ScanDetailsPresentation = {
|
|
4
|
+
evidenceContext: PresentationEvidenceContext;
|
|
5
|
+
status: PresentationStatus;
|
|
6
|
+
density: PresentationDensity;
|
|
7
|
+
confidence: PresentationConfidence;
|
|
8
|
+
hero: {
|
|
9
|
+
headline: string;
|
|
10
|
+
subheadline?: string;
|
|
11
|
+
verdictLine: string;
|
|
12
|
+
scopeChip?: string;
|
|
13
|
+
postureLabel: string;
|
|
14
|
+
riskIndex?: number | null;
|
|
15
|
+
};
|
|
16
|
+
narrative: {
|
|
17
|
+
keyPoints: string[];
|
|
18
|
+
changedPackages: string[];
|
|
19
|
+
primaryPackage?: string;
|
|
20
|
+
};
|
|
21
|
+
usage?: {
|
|
22
|
+
summary?: string;
|
|
23
|
+
items: Array<{
|
|
24
|
+
packageName: string;
|
|
25
|
+
paths: string[];
|
|
26
|
+
areas: string[];
|
|
27
|
+
criticalPaths?: string[];
|
|
28
|
+
}>;
|
|
29
|
+
frameworks: string[];
|
|
30
|
+
};
|
|
31
|
+
verification: {
|
|
32
|
+
actions: Array<{
|
|
33
|
+
title: string;
|
|
34
|
+
detail?: string;
|
|
35
|
+
affectedFiles?: string[];
|
|
36
|
+
}>;
|
|
37
|
+
};
|
|
38
|
+
signalSummary?: {
|
|
39
|
+
riskIndex: number;
|
|
40
|
+
band: "low" | "medium" | "high";
|
|
41
|
+
layers: Array<{
|
|
42
|
+
layer: ScoreLayer;
|
|
43
|
+
score: number;
|
|
44
|
+
band: string;
|
|
45
|
+
label: string;
|
|
46
|
+
}>;
|
|
47
|
+
};
|
|
48
|
+
operationalImpact: {
|
|
49
|
+
status: "rich" | "compact" | "hidden";
|
|
50
|
+
items: Array<{
|
|
51
|
+
message: string;
|
|
52
|
+
where?: string;
|
|
53
|
+
verify?: string;
|
|
54
|
+
affectedFiles?: string[];
|
|
55
|
+
}>;
|
|
56
|
+
fallbackMessage?: string;
|
|
57
|
+
};
|
|
58
|
+
recommendations: {
|
|
59
|
+
items: Array<{
|
|
60
|
+
rank: number;
|
|
61
|
+
title: string;
|
|
62
|
+
priority: "high" | "medium" | "low";
|
|
63
|
+
rationale?: string;
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
66
|
+
evidence: {
|
|
67
|
+
defaultCollapsed: boolean;
|
|
68
|
+
attentionAreas: Array<{
|
|
69
|
+
problemLabel: string;
|
|
70
|
+
problemDescription: string;
|
|
71
|
+
packages: Array<{
|
|
72
|
+
name: string;
|
|
73
|
+
version?: string;
|
|
74
|
+
direct: boolean;
|
|
75
|
+
severity?: FindingSeverity;
|
|
76
|
+
evidence?: string;
|
|
77
|
+
}>;
|
|
78
|
+
overflowCount: number;
|
|
79
|
+
}>;
|
|
80
|
+
findings: Array<{
|
|
81
|
+
id: string;
|
|
82
|
+
severity: FindingSeverity;
|
|
83
|
+
title: string;
|
|
84
|
+
description: string;
|
|
85
|
+
packageName: string;
|
|
86
|
+
recommendation?: string;
|
|
87
|
+
source: "dependency" | "code";
|
|
88
|
+
}>;
|
|
89
|
+
findingsOverflowCount: number;
|
|
90
|
+
topology?: {
|
|
91
|
+
summaryLine: string;
|
|
92
|
+
deepest: Array<{
|
|
93
|
+
packageName: string;
|
|
94
|
+
depth: number;
|
|
95
|
+
direct: boolean;
|
|
96
|
+
via: string[];
|
|
97
|
+
}>;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
supportingContext?: {
|
|
101
|
+
title: string;
|
|
102
|
+
lines: string[];
|
|
103
|
+
};
|
|
104
|
+
metadata: {
|
|
105
|
+
scanId: string;
|
|
106
|
+
generatedAt?: string;
|
|
107
|
+
methodologyVersion?: string | null;
|
|
108
|
+
changedPackagesSummary?: string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=scanDetailsPresentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanDetailsPresentation.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/scanDetailsPresentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,mBAAmB,EACnB,2BAA2B,EAC3B,kBAAkB,EACnB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAElE,MAAM,MAAM,uBAAuB,GAAG;IACpC,eAAe,EAAE,2BAA2B,CAAC;IAC7C,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE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AC;QAC9B,QAAQ,CAAC,EAAE;YACT,WAAW,EAAE,MAAM,CAAC;YACpB,OAAO,EAAE,KAAK,CAAC;gBACb,WAAW,EAAE,MAAM,CAAC;gBACpB,KAAK,EAAE,MAAM,CAAC;gBACd,MAAM,EAAE,OAAO,CAAC;gBAChB,GAAG,EAAE,MAAM,EAAE,CAAC;aACf,CAAC,CAAC;SACJ,CAAC;KACH,CAAC;IAEF,iBAAiB,CAAC,EAAE;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,CAAC;IAEF,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACnC,sBAAsB,CAAC,EAAE,MAAM,CAAC;KACjC,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type PipelineStatus = "queued" | "running" | "done" | "failed";
|
|
2
|
+
export type PresentationStatus = "safe" | "needs_review" | "risky";
|
|
3
|
+
export type PresentationDensity = "minimal" | "standard" | "rich";
|
|
4
|
+
export type PresentationConfidence = "high" | "medium" | "low";
|
|
5
|
+
export type PresentationPriority = "pr_intelligence" | "limited";
|
|
6
|
+
export type PresentationEvidenceRow = {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
/** User-facing evidence summary - mirrors profile.priority */
|
|
11
|
+
export type PresentationEvidenceContext = {
|
|
12
|
+
priority: PresentationPriority;
|
|
13
|
+
degradedMessage?: string;
|
|
14
|
+
};
|
|
15
|
+
export type FindingCountSummary = {
|
|
16
|
+
critical: number;
|
|
17
|
+
high: number;
|
|
18
|
+
medium: number;
|
|
19
|
+
low: number;
|
|
20
|
+
};
|
|
21
|
+
export declare function aggregateFindingCounts(findings: Array<{
|
|
22
|
+
severity: string;
|
|
23
|
+
}> | null | undefined): FindingCountSummary;
|
|
24
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEtE,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,cAAc,GAAG,OAAO,CAAC;AAEnE,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;AAElE,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE/D,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,GAAG,SAAS,CAAC;AAEjE,MAAM,MAAM,uBAAuB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE,8DAA8D;AAC9D,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,IAAI,GAAG,SAAS,GACvD,mBAAmB,CAgBrB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function aggregateFindingCounts(findings) {
|
|
2
|
+
const counts = {
|
|
3
|
+
critical: 0,
|
|
4
|
+
high: 0,
|
|
5
|
+
medium: 0,
|
|
6
|
+
low: 0,
|
|
7
|
+
};
|
|
8
|
+
if (!Array.isArray(findings))
|
|
9
|
+
return counts;
|
|
10
|
+
for (const f of findings) {
|
|
11
|
+
const s = f.severity;
|
|
12
|
+
if (s === "critical")
|
|
13
|
+
counts.critical += 1;
|
|
14
|
+
else if (s === "high")
|
|
15
|
+
counts.high += 1;
|
|
16
|
+
else if (s === "medium")
|
|
17
|
+
counts.medium += 1;
|
|
18
|
+
else if (s === "low")
|
|
19
|
+
counts.low += 1;
|
|
20
|
+
}
|
|
21
|
+
return counts;
|
|
22
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ScanResult } from "../../types.js";
|
|
2
|
+
export declare const scanResultFastifyRuntime: ScanResult;
|
|
3
|
+
export declare const scanResultTypescriptPatch: ScanResult;
|
|
4
|
+
export declare const scanResultLimitedContext: ScanResult;
|
|
5
|
+
//# sourceMappingURL=scanResultFixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanResultFixtures.d.ts","sourceRoot":"","sources":["../../../src/presentation/fixtures/scanResultFixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAOjD,eAAO,MAAM,wBAAwB,EAAE,UA6BtC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,UAwBvC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,UAyBtC,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { fixtureRepoIntelligenceFastify, fixtureRepoIntelligenceTypescript, } from "../../fixtures/repoIntelligenceFixtures.js";
|
|
2
|
+
import { analysisPreparationWithValidRepoIntel } from "../../fixtures/repoIntelligenceTestHelpers.js";
|
|
3
|
+
export const scanResultFastifyRuntime = {
|
|
4
|
+
totalScore: 55,
|
|
5
|
+
layerScores: {
|
|
6
|
+
security: 10,
|
|
7
|
+
maintainability: 20,
|
|
8
|
+
ecosystem: 30,
|
|
9
|
+
upgradeImpact: 15,
|
|
10
|
+
},
|
|
11
|
+
findings: [],
|
|
12
|
+
generatedAt: "2026-01-01T00:00:00.000Z",
|
|
13
|
+
changedPackages: ["fastify"],
|
|
14
|
+
analysisPreparation: analysisPreparationWithValidRepoIntel(),
|
|
15
|
+
repoIntelligence: fixtureRepoIntelligenceFastify,
|
|
16
|
+
decision: {
|
|
17
|
+
recommendation: "needs_review",
|
|
18
|
+
confidence: "medium",
|
|
19
|
+
reasoning: [],
|
|
20
|
+
},
|
|
21
|
+
insights: [
|
|
22
|
+
{
|
|
23
|
+
type: "usage_risk",
|
|
24
|
+
priority: "high",
|
|
25
|
+
confidence: "confirmed",
|
|
26
|
+
scope: "changed",
|
|
27
|
+
message: "Review fastify middleware ordering",
|
|
28
|
+
context: "apps/api/src/middleware/auth.ts",
|
|
29
|
+
remediation: "Run auth smoke tests",
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
export const scanResultTypescriptPatch = {
|
|
34
|
+
totalScore: 18,
|
|
35
|
+
layerScores: {
|
|
36
|
+
security: 5,
|
|
37
|
+
maintainability: 8,
|
|
38
|
+
ecosystem: 10,
|
|
39
|
+
upgradeImpact: 5,
|
|
40
|
+
},
|
|
41
|
+
findings: [],
|
|
42
|
+
generatedAt: "2026-01-01T00:00:00.000Z",
|
|
43
|
+
changedPackages: ["typescript"],
|
|
44
|
+
analysisPreparation: analysisPreparationWithValidRepoIntel(),
|
|
45
|
+
repoIntelligence: fixtureRepoIntelligenceTypescript,
|
|
46
|
+
decision: {
|
|
47
|
+
recommendation: "safe",
|
|
48
|
+
confidence: "high",
|
|
49
|
+
reasoning: [],
|
|
50
|
+
},
|
|
51
|
+
graphInsights: {
|
|
52
|
+
maxDepth: 4,
|
|
53
|
+
nodes: 120,
|
|
54
|
+
edges: 340,
|
|
55
|
+
hotspots: [],
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
export const scanResultLimitedContext = {
|
|
59
|
+
totalScore: 40,
|
|
60
|
+
layerScores: {
|
|
61
|
+
security: 10,
|
|
62
|
+
maintainability: 10,
|
|
63
|
+
ecosystem: 10,
|
|
64
|
+
upgradeImpact: 10,
|
|
65
|
+
},
|
|
66
|
+
findings: [],
|
|
67
|
+
generatedAt: "2026-01-01T00:00:00.000Z",
|
|
68
|
+
changedPackages: ["lodash"],
|
|
69
|
+
repoIntelligence: { invalid: true },
|
|
70
|
+
graphInsights: {
|
|
71
|
+
maxDepth: 5,
|
|
72
|
+
nodes: 200,
|
|
73
|
+
edges: 500,
|
|
74
|
+
hotspots: [
|
|
75
|
+
{ kind: "hotspot", packageName: "lodash", direct: true, depth: 2 },
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
decision: {
|
|
79
|
+
recommendation: "needs_review",
|
|
80
|
+
confidence: "low",
|
|
81
|
+
reasoning: [],
|
|
82
|
+
},
|
|
83
|
+
};
|