@mergesignal/shared 0.4.0 → 0.4.2
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.map +1 -1
- package/dist/deriveScanNarrative.js +52 -2
- package/dist/deriveScanNarrative.test.js +10 -3
- package/dist/fixtures/repoIntelligenceFixtures.d.ts.map +1 -1
- package/dist/fixtures/repoIntelligenceFixtures.js +21 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/narrativePresentation.d.ts.map +1 -1
- package/dist/narrativePresentation.js +6 -3
- package/dist/presentation/compose/narrativeCompose.d.ts.map +1 -1
- package/dist/presentation/compose/narrativeCompose.js +15 -101
- package/dist/presentation/dto/scanCardPresentation.d.ts +2 -0
- package/dist/presentation/dto/scanCardPresentation.d.ts.map +1 -1
- package/dist/presentation/dto/scanDetailsPresentation.d.ts +2 -0
- package/dist/presentation/dto/scanDetailsPresentation.d.ts.map +1 -1
- package/dist/presentation/fixtures/presentationPersonaFixtures.d.ts +11 -0
- package/dist/presentation/fixtures/presentationPersonaFixtures.d.ts.map +1 -0
- package/dist/presentation/fixtures/presentationPersonaFixtures.js +197 -0
- package/dist/presentation/index.d.ts +2 -0
- package/dist/presentation/index.d.ts.map +1 -1
- package/dist/presentation/index.js +1 -0
- package/dist/presentation/intent/applyPostureVocabularyGuard.d.ts +5 -0
- package/dist/presentation/intent/applyPostureVocabularyGuard.d.ts.map +1 -0
- package/dist/presentation/intent/applyPostureVocabularyGuard.js +44 -0
- package/dist/presentation/intent/derivePresentationInterpretation.d.ts +4 -0
- package/dist/presentation/intent/derivePresentationInterpretation.d.ts.map +1 -0
- package/dist/presentation/intent/derivePresentationInterpretation.js +202 -0
- package/dist/presentation/intent/formatPresentationCopy.d.ts +7 -0
- package/dist/presentation/intent/formatPresentationCopy.d.ts.map +1 -0
- package/dist/presentation/intent/formatPresentationCopy.js +153 -0
- package/dist/presentation/intent/packageDisplayName.d.ts +4 -0
- package/dist/presentation/intent/packageDisplayName.d.ts.map +1 -0
- package/dist/presentation/intent/packageDisplayName.js +17 -0
- package/dist/presentation/intent/postureVocabularyGuard.test.d.ts +2 -0
- package/dist/presentation/intent/postureVocabularyGuard.test.d.ts.map +1 -0
- package/dist/presentation/intent/postureVocabularyGuard.test.js +23 -0
- package/dist/presentation/intent/presentationIntent.d.ts +14 -0
- package/dist/presentation/intent/presentationIntent.d.ts.map +1 -0
- package/dist/presentation/intent/presentationIntent.js +1 -0
- package/dist/presentation/intent/presentationIntent.test.d.ts +2 -0
- package/dist/presentation/intent/presentationIntent.test.d.ts.map +1 -0
- package/dist/presentation/intent/presentationIntent.test.js +29 -0
- package/dist/presentation/intent/verificationFocusLabels.d.ts +2 -0
- package/dist/presentation/intent/verificationFocusLabels.d.ts.map +1 -0
- package/dist/presentation/intent/verificationFocusLabels.js +45 -0
- package/dist/presentation/presentation.test.js +3 -0
- package/dist/presentation/presentationPersonas.test.d.ts +2 -0
- package/dist/presentation/presentationPersonas.test.d.ts.map +1 -0
- package/dist/presentation/presentationPersonas.test.js +166 -0
- package/dist/presentation/presenters/presentScanCard.d.ts.map +1 -1
- package/dist/presentation/presenters/presentScanCard.js +1 -0
- package/dist/presentation/presenters/presentScanDetails.d.ts.map +1 -1
- package/dist/presentation/presenters/presentScanDetails.js +7 -1
- package/dist/presentation/profile/derivePresentationProfile.d.ts.map +1 -1
- package/dist/presentation/profile/derivePresentationProfile.js +18 -19
- package/dist/presentation/profile/presentationProfile.d.ts +2 -0
- package/dist/presentation/profile/presentationProfile.d.ts.map +1 -1
- package/dist/repoIntelligenceMappers.d.ts.map +1 -1
- package/dist/repoIntelligenceMappers.js +8 -1
- package/dist/repoIntelligenceSchema.d.ts +75 -1
- package/dist/repoIntelligenceSchema.d.ts.map +1 -1
- package/dist/repoIntelligenceSchema.js +74 -1
- package/dist/repoIntelligenceSemantics.d.ts +29 -0
- package/dist/repoIntelligenceSemantics.d.ts.map +1 -0
- package/dist/repoIntelligenceSemantics.js +146 -0
- package/dist/repoIntelligenceSemantics.test.d.ts +2 -0
- package/dist/repoIntelligenceSemantics.test.d.ts.map +1 -0
- package/dist/repoIntelligenceSemantics.test.js +63 -0
- package/dist/scanNarrativeFacts.d.ts +31 -0
- package/dist/scanNarrativeFacts.d.ts.map +1 -1
- package/dist/scanNarrativeFacts.js +2 -0
- package/dist/scanSurfaceCopy.d.ts +8 -0
- package/dist/scanSurfaceCopy.d.ts.map +1 -1
- package/dist/scanSurfaceCopy.js +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { fixtureRepoIntelligenceFastify, fixtureRepoIntelligenceTypescript, } from "../../fixtures/repoIntelligenceFixtures.js";
|
|
2
|
+
import { analysisPreparationWithValidRepoIntel } from "../../fixtures/repoIntelligenceTestHelpers.js";
|
|
3
|
+
import { scanResultFastifyRuntime, scanResultLimitedContext, scanResultTypescriptPatch, } from "./scanResultFixtures.js";
|
|
4
|
+
const basePrep = analysisPreparationWithValidRepoIntel();
|
|
5
|
+
const fixtureRepoIntelligenceEslint = {
|
|
6
|
+
packages: {
|
|
7
|
+
eslint: {
|
|
8
|
+
runtimeSurface: "build",
|
|
9
|
+
reachability: "build_only",
|
|
10
|
+
runtimeImpact: "none",
|
|
11
|
+
expectedImpact: "development_only",
|
|
12
|
+
evidenceStrength: "medium",
|
|
13
|
+
suppressRuntimeNarrative: true,
|
|
14
|
+
dependencyClass: "lint",
|
|
15
|
+
packageRole: "linter",
|
|
16
|
+
verificationFocus: ["ci", "lint"],
|
|
17
|
+
usage: { packageName: "eslint", files: [".eslintrc.cjs"], paths: [] },
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
blastRadius: { level: "narrow", changedPackageCount: 1 },
|
|
21
|
+
applicationAreas: [],
|
|
22
|
+
};
|
|
23
|
+
const fixtureRepoIntelligencePrettier = {
|
|
24
|
+
packages: {
|
|
25
|
+
prettier: {
|
|
26
|
+
runtimeSurface: "build",
|
|
27
|
+
reachability: "build_only",
|
|
28
|
+
runtimeImpact: "none",
|
|
29
|
+
expectedImpact: "development_only",
|
|
30
|
+
evidenceStrength: "medium",
|
|
31
|
+
suppressRuntimeNarrative: true,
|
|
32
|
+
dependencyClass: "format",
|
|
33
|
+
packageRole: "formatter",
|
|
34
|
+
verificationFocus: ["ci", "format"],
|
|
35
|
+
usage: { packageName: "prettier", files: [".prettierrc"], paths: [] },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
blastRadius: { level: "narrow", changedPackageCount: 1 },
|
|
39
|
+
applicationAreas: [],
|
|
40
|
+
};
|
|
41
|
+
const fixtureRepoIntelligenceVitest = {
|
|
42
|
+
packages: {
|
|
43
|
+
vitest: {
|
|
44
|
+
runtimeSurface: "test",
|
|
45
|
+
reachability: "test_only",
|
|
46
|
+
runtimeImpact: "none",
|
|
47
|
+
expectedImpact: "test_time",
|
|
48
|
+
evidenceStrength: "medium",
|
|
49
|
+
suppressRuntimeNarrative: true,
|
|
50
|
+
dependencyClass: "test",
|
|
51
|
+
packageRole: "test_runner",
|
|
52
|
+
verificationFocus: ["ci", "test_suite"],
|
|
53
|
+
usage: { packageName: "vitest", files: ["vitest.config.ts"], paths: [] },
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
blastRadius: { level: "narrow", changedPackageCount: 1 },
|
|
57
|
+
applicationAreas: [],
|
|
58
|
+
};
|
|
59
|
+
const fixtureRepoIntelligenceNextAuth = {
|
|
60
|
+
packages: {
|
|
61
|
+
"next-auth": {
|
|
62
|
+
runtimeSurface: "runtime",
|
|
63
|
+
reachability: "on_runtime_paths",
|
|
64
|
+
runtimeImpact: "confirmed",
|
|
65
|
+
expectedImpact: "runtime",
|
|
66
|
+
evidenceStrength: "high",
|
|
67
|
+
suppressRuntimeNarrative: false,
|
|
68
|
+
dependencyClass: "runtime",
|
|
69
|
+
packageRole: "auth",
|
|
70
|
+
verificationFocus: ["auth_flow", "session", "routes"],
|
|
71
|
+
usage: {
|
|
72
|
+
packageName: "next-auth",
|
|
73
|
+
files: ["apps/web/src/auth.ts"],
|
|
74
|
+
paths: ["apps/web/src/auth.ts"],
|
|
75
|
+
areas: ["Auth"],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
blastRadius: { level: "moderate", changedPackageCount: 1 },
|
|
80
|
+
applicationAreas: [{ id: "auth", label: "authentication flows" }],
|
|
81
|
+
};
|
|
82
|
+
const fixtureRepoIntelligenceBullmq = {
|
|
83
|
+
packages: {
|
|
84
|
+
bullmq: {
|
|
85
|
+
runtimeSurface: "runtime",
|
|
86
|
+
reachability: "on_runtime_paths",
|
|
87
|
+
runtimeImpact: "confirmed",
|
|
88
|
+
expectedImpact: "runtime",
|
|
89
|
+
evidenceStrength: "high",
|
|
90
|
+
suppressRuntimeNarrative: false,
|
|
91
|
+
dependencyClass: "runtime",
|
|
92
|
+
packageRole: "queue",
|
|
93
|
+
verificationFocus: ["workers", "queue", "serialization"],
|
|
94
|
+
usage: {
|
|
95
|
+
packageName: "bullmq",
|
|
96
|
+
files: ["apps/worker/src/queue.ts"],
|
|
97
|
+
paths: ["apps/worker/src/queue.ts"],
|
|
98
|
+
areas: ["Workers"],
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
blastRadius: { level: "moderate", changedPackageCount: 1 },
|
|
103
|
+
applicationAreas: [{ id: "workers", label: "background job processing" }],
|
|
104
|
+
};
|
|
105
|
+
const fixtureRepoIntelligenceUnknown = {
|
|
106
|
+
packages: {
|
|
107
|
+
"opaque-pkg": {
|
|
108
|
+
runtimeSurface: "unknown",
|
|
109
|
+
reachability: "unknown",
|
|
110
|
+
runtimeImpact: "unknown",
|
|
111
|
+
expectedImpact: "unknown",
|
|
112
|
+
evidenceStrength: "low",
|
|
113
|
+
suppressRuntimeNarrative: false,
|
|
114
|
+
dependencyClass: "unknown",
|
|
115
|
+
packageRole: "unknown",
|
|
116
|
+
verificationFocus: [],
|
|
117
|
+
usage: { packageName: "opaque-pkg", files: [], paths: [] },
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
blastRadius: { level: "narrow", changedPackageCount: 1 },
|
|
121
|
+
applicationAreas: [],
|
|
122
|
+
};
|
|
123
|
+
const fixtureRepoIntelligenceMixedToolingRuntime = {
|
|
124
|
+
packages: {
|
|
125
|
+
typescript: fixtureRepoIntelligenceTypescript.packages.typescript,
|
|
126
|
+
fastify: fixtureRepoIntelligenceFastify.packages.fastify,
|
|
127
|
+
},
|
|
128
|
+
blastRadius: fixtureRepoIntelligenceFastify.blastRadius,
|
|
129
|
+
applicationAreas: fixtureRepoIntelligenceFastify.applicationAreas,
|
|
130
|
+
};
|
|
131
|
+
function scanBase(over = {}) {
|
|
132
|
+
return {
|
|
133
|
+
totalScore: 18,
|
|
134
|
+
layerScores: {
|
|
135
|
+
security: 5,
|
|
136
|
+
maintainability: 8,
|
|
137
|
+
ecosystem: 10,
|
|
138
|
+
upgradeImpact: 5,
|
|
139
|
+
},
|
|
140
|
+
findings: [],
|
|
141
|
+
generatedAt: "2026-01-01T00:00:00.000Z",
|
|
142
|
+
decision: {
|
|
143
|
+
recommendation: "safe",
|
|
144
|
+
confidence: "high",
|
|
145
|
+
reasoning: [],
|
|
146
|
+
},
|
|
147
|
+
analysisPreparation: basePrep,
|
|
148
|
+
...over,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
export const scanResultEslint = scanBase({
|
|
152
|
+
changedPackages: ["eslint"],
|
|
153
|
+
repoIntelligence: fixtureRepoIntelligenceEslint,
|
|
154
|
+
});
|
|
155
|
+
export const scanResultPrettier = scanBase({
|
|
156
|
+
changedPackages: ["prettier"],
|
|
157
|
+
repoIntelligence: fixtureRepoIntelligencePrettier,
|
|
158
|
+
});
|
|
159
|
+
export const scanResultVitest = scanBase({
|
|
160
|
+
changedPackages: ["vitest"],
|
|
161
|
+
repoIntelligence: fixtureRepoIntelligenceVitest,
|
|
162
|
+
});
|
|
163
|
+
export const scanResultNextAuth = scanBase({
|
|
164
|
+
totalScore: 52,
|
|
165
|
+
changedPackages: ["next-auth"],
|
|
166
|
+
repoIntelligence: fixtureRepoIntelligenceNextAuth,
|
|
167
|
+
decision: {
|
|
168
|
+
recommendation: "needs_review",
|
|
169
|
+
confidence: "medium",
|
|
170
|
+
reasoning: [],
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
export const scanResultBullmq = scanBase({
|
|
174
|
+
totalScore: 48,
|
|
175
|
+
changedPackages: ["bullmq"],
|
|
176
|
+
repoIntelligence: fixtureRepoIntelligenceBullmq,
|
|
177
|
+
decision: {
|
|
178
|
+
recommendation: "needs_review",
|
|
179
|
+
confidence: "medium",
|
|
180
|
+
reasoning: [],
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
export const scanResultUnknownSafe = scanBase({
|
|
184
|
+
changedPackages: ["opaque-pkg"],
|
|
185
|
+
repoIntelligence: fixtureRepoIntelligenceUnknown,
|
|
186
|
+
});
|
|
187
|
+
export const scanResultMixedTypescriptFastify = scanBase({
|
|
188
|
+
totalScore: 55,
|
|
189
|
+
changedPackages: ["typescript", "fastify"],
|
|
190
|
+
repoIntelligence: fixtureRepoIntelligenceMixedToolingRuntime,
|
|
191
|
+
decision: {
|
|
192
|
+
recommendation: "needs_review",
|
|
193
|
+
confidence: "medium",
|
|
194
|
+
reasoning: [],
|
|
195
|
+
},
|
|
196
|
+
});
|
|
197
|
+
export { scanResultFastifyRuntime, scanResultLimitedContext, scanResultTypescriptPatch, };
|
|
@@ -6,6 +6,8 @@ export type { BuildScanCardPresentationInput } from "./orchestration/buildScanCa
|
|
|
6
6
|
export { buildScanDetailsPresentation } from "./orchestration/buildScanDetailsPresentation.js";
|
|
7
7
|
export type { BuildScanDetailsPresentationInput } from "./orchestration/buildScanDetailsPresentation.js";
|
|
8
8
|
export type { PresentationProfile } from "./profile/presentationProfile.js";
|
|
9
|
+
export type { PresentationIntent, PresentationInterpretation, } from "./intent/presentationIntent.js";
|
|
10
|
+
export { derivePresentationInterpretation } from "./intent/derivePresentationInterpretation.js";
|
|
9
11
|
export type { PipelineStatus, PresentationStatus, PresentationDensity, PresentationConfidence, PresentationPriority, PresentationEvidenceContext, PresentationEvidenceRow, } from "./dto/types.js";
|
|
10
12
|
export type { ScanCardPresentation } from "./dto/scanCardPresentation.js";
|
|
11
13
|
export type { ScanDetailsPresentation } from "./dto/scanDetailsPresentation.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/presentation/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACxF,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,YAAY,EAAE,gCAAgC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AACzF,YAAY,EAAE,8BAA8B,EAAE,MAAM,8CAA8C,CAAC;AACnG,OAAO,EAAE,4BAA4B,EAAE,MAAM,iDAAiD,CAAC;AAC/F,YAAY,EAAE,iCAAiC,EAAE,MAAM,iDAAiD,CAAC;AAEzG,YAAY,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,YAAY,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAChF,YAAY,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,YAAY,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,YAAY,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAE9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACxF,OAAO,EAAE,6BAA6B,EAAE,MAAM,2CAA2C,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,0BAA0B,EAC1B,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/presentation/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACxF,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,YAAY,EAAE,gCAAgC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AACzF,YAAY,EAAE,8BAA8B,EAAE,MAAM,8CAA8C,CAAC;AACnG,OAAO,EAAE,4BAA4B,EAAE,MAAM,iDAAiD,CAAC;AAC/F,YAAY,EAAE,iCAAiC,EAAE,MAAM,iDAAiD,CAAC;AAEzG,YAAY,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,YAAY,EACV,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;AAChG,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,YAAY,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAChF,YAAY,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,YAAY,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,YAAY,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAE9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACxF,OAAO,EAAE,6BAA6B,EAAE,MAAM,2CAA2C,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,0BAA0B,EAC1B,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { buildScanPresentationBundle } from "./orchestration/buildScanPresentationBundle.js";
|
|
2
2
|
export { buildScanCardPresentation } from "./orchestration/buildScanCardPresentation.js";
|
|
3
3
|
export { buildScanDetailsPresentation } from "./orchestration/buildScanDetailsPresentation.js";
|
|
4
|
+
export { derivePresentationInterpretation } from "./intent/derivePresentationInterpretation.js";
|
|
4
5
|
export { presentScanCard } from "./presenters/presentScanCard.js";
|
|
5
6
|
export { presentPipelineScanCard } from "./presenters/presentPipelineScanCard.js";
|
|
6
7
|
export { presentScanDetails } from "./presenters/presentScanDetails.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PresentationStatus } from "../dto/types.js";
|
|
2
|
+
export declare function guardHeadlineForPosture(headline: string, status: PresentationStatus, anchorPackage: string | null): string;
|
|
3
|
+
export declare function applyPostureVocabularyGuardHeadline(headline: string, status: PresentationStatus | undefined, anchorPackage: string | null): string;
|
|
4
|
+
export declare function applyPostureVocabularyGuardLines(lines: string[], status: PresentationStatus | undefined): string[];
|
|
5
|
+
//# sourceMappingURL=applyPostureVocabularyGuard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyPostureVocabularyGuard.d.ts","sourceRoot":"","sources":["../../../src/presentation/intent/applyPostureVocabularyGuard.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AA2B1D,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,kBAAkB,EAC1B,aAAa,EAAE,MAAM,GAAG,IAAI,GAC3B,MAAM,CAYR;AASD,wBAAgB,mCAAmC,CACjD,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,kBAAkB,GAAG,SAAS,EACtC,aAAa,EAAE,MAAM,GAAG,IAAI,GAC3B,MAAM,CAGR;AAED,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,MAAM,EAAE,EACf,MAAM,EAAE,kBAAkB,GAAG,SAAS,GACrC,MAAM,EAAE,CAGV"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { scanSurfaceCopy } from "../../scanSurfaceCopy.js";
|
|
2
|
+
import { formatPackageDisplayName } from "./packageDisplayName.js";
|
|
3
|
+
const SAFE_FORBIDDEN = /\b(needs\s+review|critical\s+concern|high\s+risk|significant\s+impact|urgent\s+verification|severe\s+exposure|review\s+before\s+merge|wide\s+blast\s+radius)\b/i;
|
|
4
|
+
const NEEDS_REVIEW_FORBIDDEN = /\b(no\s+action\s+required|no\s+verification\s+required|safe\s+to\s+merge|no\s+concerns)\b/i;
|
|
5
|
+
const RISKY_FORBIDDEN = /\b(no\s+action\s+required|minor\s+findings\s+only|low\s+risk|no\s+concerns)\b/i;
|
|
6
|
+
function violatesPosture(text, status) {
|
|
7
|
+
const t = text.trim();
|
|
8
|
+
if (!t)
|
|
9
|
+
return true;
|
|
10
|
+
switch (status) {
|
|
11
|
+
case "safe":
|
|
12
|
+
return SAFE_FORBIDDEN.test(t);
|
|
13
|
+
case "needs_review":
|
|
14
|
+
return NEEDS_REVIEW_FORBIDDEN.test(t);
|
|
15
|
+
case "risky":
|
|
16
|
+
return RISKY_FORBIDDEN.test(t);
|
|
17
|
+
default:
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function guardHeadlineForPosture(headline, status, anchorPackage) {
|
|
22
|
+
if (!violatesPosture(headline, status))
|
|
23
|
+
return headline;
|
|
24
|
+
const pkg = anchorPackage
|
|
25
|
+
? formatPackageDisplayName(anchorPackage)
|
|
26
|
+
: "Dependency";
|
|
27
|
+
if (status === "safe") {
|
|
28
|
+
return scanSurfaceCopy.presentation.safeNeutralHeadline.replace("{package}", pkg);
|
|
29
|
+
}
|
|
30
|
+
return headline;
|
|
31
|
+
}
|
|
32
|
+
function guardLinesForPosture(lines, status) {
|
|
33
|
+
return lines.filter((line) => !violatesPosture(line, status));
|
|
34
|
+
}
|
|
35
|
+
export function applyPostureVocabularyGuardHeadline(headline, status, anchorPackage) {
|
|
36
|
+
if (!status)
|
|
37
|
+
return headline;
|
|
38
|
+
return guardHeadlineForPosture(headline, status, anchorPackage);
|
|
39
|
+
}
|
|
40
|
+
export function applyPostureVocabularyGuardLines(lines, status) {
|
|
41
|
+
if (!status)
|
|
42
|
+
return lines;
|
|
43
|
+
return guardLinesForPosture(lines, status);
|
|
44
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ScanNarrativeFacts } from "../../scanNarrativeFacts.js";
|
|
2
|
+
import type { PresentationInterpretation } from "./presentationIntent.js";
|
|
3
|
+
export declare function derivePresentationInterpretation(facts: ScanNarrativeFacts): PresentationInterpretation;
|
|
4
|
+
//# sourceMappingURL=derivePresentationInterpretation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivePresentationInterpretation.d.ts","sourceRoot":"","sources":["../../../src/presentation/intent/derivePresentationInterpretation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAMV,kBAAkB,EACnB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,KAAK,EAEV,0BAA0B,EAC3B,MAAM,yBAAyB,CAAC;AAsJjC,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,kBAAkB,GACxB,0BAA0B,CAkG5B"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { formatCardAreaLabels } from "../../formatCardAreaLabels.js";
|
|
2
|
+
import { mergeVerificationFocusLabels } from "./verificationFocusLabels.js";
|
|
3
|
+
const TOOLING_CLASSES = new Set([
|
|
4
|
+
"tooling",
|
|
5
|
+
"test",
|
|
6
|
+
"lint",
|
|
7
|
+
"format",
|
|
8
|
+
"build",
|
|
9
|
+
"ci",
|
|
10
|
+
]);
|
|
11
|
+
const RUNTIME_IMPACT_RANK = {
|
|
12
|
+
confirmed: 3,
|
|
13
|
+
possible: 2,
|
|
14
|
+
unknown: 1,
|
|
15
|
+
none: 0,
|
|
16
|
+
};
|
|
17
|
+
const EVIDENCE_RANK = {
|
|
18
|
+
high: 3,
|
|
19
|
+
medium: 2,
|
|
20
|
+
low: 1,
|
|
21
|
+
};
|
|
22
|
+
function isRuntimeEligible(row) {
|
|
23
|
+
if (row.suppressRuntimeNarrative)
|
|
24
|
+
return false;
|
|
25
|
+
if (row.runtimeImpact === "confirmed" || row.runtimeImpact === "possible") {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
if (row.dependencyClass === "runtime")
|
|
29
|
+
return true;
|
|
30
|
+
if (row.usagePathCount > 0)
|
|
31
|
+
return true;
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
function isToolingOriented(row) {
|
|
35
|
+
if (row.suppressRuntimeNarrative)
|
|
36
|
+
return true;
|
|
37
|
+
if (row.dependencyClass && TOOLING_CLASSES.has(row.dependencyClass)) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
function compareRuntimePackages(a, b, order) {
|
|
43
|
+
const impactA = RUNTIME_IMPACT_RANK[a.runtimeImpact ?? "none"] ?? 0;
|
|
44
|
+
const impactB = RUNTIME_IMPACT_RANK[b.runtimeImpact ?? "none"] ?? 0;
|
|
45
|
+
if (impactB !== impactA)
|
|
46
|
+
return impactB - impactA;
|
|
47
|
+
const evA = EVIDENCE_RANK[a.evidenceStrength ?? "low"] ?? 0;
|
|
48
|
+
const evB = EVIDENCE_RANK[b.evidenceStrength ?? "low"] ?? 0;
|
|
49
|
+
if (evB !== evA)
|
|
50
|
+
return evB - evA;
|
|
51
|
+
return order.indexOf(a.packageName) - order.indexOf(b.packageName);
|
|
52
|
+
}
|
|
53
|
+
function pickAnchorPackage(rows, changedOrder) {
|
|
54
|
+
if (rows.length === 0)
|
|
55
|
+
return null;
|
|
56
|
+
const sorted = [...rows].sort((a, b) => compareRuntimePackages(a, b, changedOrder));
|
|
57
|
+
return sorted[0]?.packageName ?? null;
|
|
58
|
+
}
|
|
59
|
+
function pickToolingAnchor(rows, changedOrder) {
|
|
60
|
+
if (rows.length === 0)
|
|
61
|
+
return null;
|
|
62
|
+
const sorted = [...rows].sort((a, b) => changedOrder.indexOf(a.packageName) - changedOrder.indexOf(b.packageName));
|
|
63
|
+
return sorted[0]?.packageName ?? null;
|
|
64
|
+
}
|
|
65
|
+
function isToolingPatchSet(rows, facts) {
|
|
66
|
+
if (rows.length === 0)
|
|
67
|
+
return false;
|
|
68
|
+
const narrow = !facts.blastRadius || facts.blastRadius.level === "narrow";
|
|
69
|
+
if (!narrow)
|
|
70
|
+
return false;
|
|
71
|
+
return rows.every((row) => row.suppressRuntimeNarrative &&
|
|
72
|
+
(row.expectedImpact === "typecheck" ||
|
|
73
|
+
row.expectedImpact === "build_time"));
|
|
74
|
+
}
|
|
75
|
+
function runtimeSurfaceLabelFromFacts(facts, anchorRow) {
|
|
76
|
+
const area = facts.affectedAreas[0];
|
|
77
|
+
if (area) {
|
|
78
|
+
const formatted = formatCardAreaLabels([area.label], 1);
|
|
79
|
+
return formatted[0] ?? area.label;
|
|
80
|
+
}
|
|
81
|
+
if (anchorRow?.packageRole === "http_framework") {
|
|
82
|
+
return "API request handling";
|
|
83
|
+
}
|
|
84
|
+
if (anchorRow?.packageRole === "auth") {
|
|
85
|
+
return "authentication flows";
|
|
86
|
+
}
|
|
87
|
+
if (anchorRow?.packageRole === "queue") {
|
|
88
|
+
return "background job processing";
|
|
89
|
+
}
|
|
90
|
+
return "application code";
|
|
91
|
+
}
|
|
92
|
+
function collectVerificationLabels(rows) {
|
|
93
|
+
return mergeVerificationFocusLabels(rows.map((r) => r.verificationFocus));
|
|
94
|
+
}
|
|
95
|
+
function showLimitedEvidence(rows) {
|
|
96
|
+
return rows.some((r) => r.evidenceStrength === "low");
|
|
97
|
+
}
|
|
98
|
+
function dominantExpectedImpact(rows) {
|
|
99
|
+
for (const row of rows) {
|
|
100
|
+
if (row.expectedImpact && row.expectedImpact !== "unknown") {
|
|
101
|
+
return row.expectedImpact;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
function emptyInterpretation(intent) {
|
|
107
|
+
return {
|
|
108
|
+
intent,
|
|
109
|
+
anchorPackage: null,
|
|
110
|
+
suppressRuntimeNarrative: intent.startsWith("tooling"),
|
|
111
|
+
allowRuntimeNarrative: intent.includes("runtime"),
|
|
112
|
+
showLimitedEvidence: false,
|
|
113
|
+
expectedImpactKey: null,
|
|
114
|
+
verificationLabels: [],
|
|
115
|
+
runtimeSurfaceLabel: null,
|
|
116
|
+
runtimePackages: [],
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export function derivePresentationInterpretation(facts) {
|
|
120
|
+
const changedOrder = facts.changedPackages.all;
|
|
121
|
+
const semantics = facts.changedPackageSemantics.length > 0
|
|
122
|
+
? facts.changedPackageSemantics
|
|
123
|
+
: facts.packageSemantics && facts.changedPackages.primary
|
|
124
|
+
? [
|
|
125
|
+
{
|
|
126
|
+
packageName: facts.changedPackages.primary,
|
|
127
|
+
dependencyClass: facts.packageSemantics.dependencyClass,
|
|
128
|
+
packageRole: facts.packageSemantics.packageRole,
|
|
129
|
+
runtimeImpact: facts.packageSemantics.runtimeImpact,
|
|
130
|
+
expectedImpact: facts.packageSemantics.expectedImpact,
|
|
131
|
+
suppressRuntimeNarrative: facts.packageSemantics.suppressRuntimeNarrative,
|
|
132
|
+
evidenceStrength: facts.packageSemantics.evidenceStrength,
|
|
133
|
+
verificationFocus: facts.packageSemantics.verificationFocus,
|
|
134
|
+
usagePathCount: 0,
|
|
135
|
+
usageAreaCount: 0,
|
|
136
|
+
},
|
|
137
|
+
]
|
|
138
|
+
: [];
|
|
139
|
+
const tier1Ok = facts.availability.tiersPresent.tier1 &&
|
|
140
|
+
facts.availability.repoIntelligenceParse === "ok";
|
|
141
|
+
if (!tier1Ok) {
|
|
142
|
+
return emptyInterpretation("limited_context");
|
|
143
|
+
}
|
|
144
|
+
if (!facts.changedPackages.primary) {
|
|
145
|
+
return emptyInterpretation("no_changed_packages");
|
|
146
|
+
}
|
|
147
|
+
const runtimeEligible = semantics.filter(isRuntimeEligible);
|
|
148
|
+
if (runtimeEligible.length > 0) {
|
|
149
|
+
const anchorPackage = pickAnchorPackage(runtimeEligible, changedOrder);
|
|
150
|
+
const anchorRow = runtimeEligible.find((r) => r.packageName === anchorPackage);
|
|
151
|
+
const runtimeSurfaceLabel = runtimeSurfaceLabelFromFacts(facts, anchorRow);
|
|
152
|
+
const verificationLabels = collectVerificationLabels(runtimeEligible);
|
|
153
|
+
let intent = "runtime_upgrade";
|
|
154
|
+
if (runtimeEligible.length > 1) {
|
|
155
|
+
intent = "multi_runtime_upgrade";
|
|
156
|
+
}
|
|
157
|
+
else if (runtimeEligible.some((r) => r.packageRole === "auth")) {
|
|
158
|
+
intent = "auth_runtime_upgrade";
|
|
159
|
+
}
|
|
160
|
+
else if (runtimeEligible.some((r) => r.packageRole === "queue")) {
|
|
161
|
+
intent = "queue_runtime_upgrade";
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
intent,
|
|
165
|
+
anchorPackage,
|
|
166
|
+
suppressRuntimeNarrative: false,
|
|
167
|
+
allowRuntimeNarrative: true,
|
|
168
|
+
showLimitedEvidence: showLimitedEvidence(runtimeEligible),
|
|
169
|
+
expectedImpactKey: dominantExpectedImpact(runtimeEligible),
|
|
170
|
+
verificationLabels,
|
|
171
|
+
runtimeSurfaceLabel,
|
|
172
|
+
runtimePackages: runtimeEligible.map((r) => r.packageName),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
const toolingOnly = semantics.length > 0 && semantics.every(isToolingOriented);
|
|
176
|
+
if (toolingOnly) {
|
|
177
|
+
const anchorPackage = pickToolingAnchor(semantics, changedOrder);
|
|
178
|
+
const isPatch = isToolingPatchSet(semantics, facts);
|
|
179
|
+
const intent = isPatch
|
|
180
|
+
? "tooling_patch"
|
|
181
|
+
: "tooling_upgrade";
|
|
182
|
+
const anchorRow = semantics.find((r) => r.packageName === anchorPackage);
|
|
183
|
+
return {
|
|
184
|
+
intent,
|
|
185
|
+
anchorPackage,
|
|
186
|
+
suppressRuntimeNarrative: true,
|
|
187
|
+
allowRuntimeNarrative: false,
|
|
188
|
+
showLimitedEvidence: showLimitedEvidence(semantics),
|
|
189
|
+
expectedImpactKey: anchorRow?.expectedImpact ?? null,
|
|
190
|
+
verificationLabels: collectVerificationLabels(semantics),
|
|
191
|
+
runtimeSurfaceLabel: null,
|
|
192
|
+
runtimePackages: [],
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
...emptyInterpretation("unknown_upgrade"),
|
|
197
|
+
anchorPackage: facts.changedPackages.primary,
|
|
198
|
+
verificationLabels: collectVerificationLabels(semantics),
|
|
199
|
+
showLimitedEvidence: showLimitedEvidence(semantics),
|
|
200
|
+
expectedImpactKey: dominantExpectedImpact(semantics),
|
|
201
|
+
};
|
|
202
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ScanNarrativeFacts } from "../../scanNarrativeFacts.js";
|
|
2
|
+
import type { PresentationStatus } from "../dto/types.js";
|
|
3
|
+
import type { PresentationInterpretation } from "./presentationIntent.js";
|
|
4
|
+
export declare function formatPresentationHeadline(interpretation: PresentationInterpretation, facts: ScanNarrativeFacts, status: PresentationStatus | undefined): string;
|
|
5
|
+
export declare function formatPresentationKeyPoints(interpretation: PresentationInterpretation, facts: ScanNarrativeFacts, status: PresentationStatus | undefined, max: number): string[];
|
|
6
|
+
export declare function formatPresentationVerification(interpretation: PresentationInterpretation, status: PresentationStatus | undefined, max: number): string[];
|
|
7
|
+
//# sourceMappingURL=formatPresentationCopy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatPresentationCopy.d.ts","sourceRoot":"","sources":["../../../src/presentation/intent/formatPresentationCopy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAM1D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAa1E,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,0BAA0B,EAC1C,KAAK,EAAE,kBAAkB,EACzB,MAAM,EAAE,kBAAkB,GAAG,SAAS,GACrC,MAAM,CAmDR;AA0BD,wBAAgB,2BAA2B,CACzC,cAAc,EAAE,0BAA0B,EAC1C,KAAK,EAAE,kBAAkB,EACzB,MAAM,EAAE,kBAAkB,GAAG,SAAS,EACtC,GAAG,EAAE,MAAM,GACV,MAAM,EAAE,CAmEV;AAuBD,wBAAgB,8BAA8B,CAC5C,cAAc,EAAE,0BAA0B,EAC1C,MAAM,EAAE,kBAAkB,GAAG,SAAS,EACtC,GAAG,EAAE,MAAM,GACV,MAAM,EAAE,CAmBV"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { scanSurfaceCopy } from "../../scanSurfaceCopy.js";
|
|
2
|
+
import { applyPostureVocabularyGuardHeadline, applyPostureVocabularyGuardLines, } from "./applyPostureVocabularyGuard.js";
|
|
3
|
+
import { formatPackageDisplayName } from "./packageDisplayName.js";
|
|
4
|
+
function anchorSemantics(facts, interpretation) {
|
|
5
|
+
const name = interpretation.anchorPackage;
|
|
6
|
+
if (!name)
|
|
7
|
+
return null;
|
|
8
|
+
return (facts.changedPackageSemantics.find((r) => r.packageName === name) ?? null);
|
|
9
|
+
}
|
|
10
|
+
export function formatPresentationHeadline(interpretation, facts, status) {
|
|
11
|
+
const anchor = interpretation.anchorPackage ?? facts.changedPackages.primary;
|
|
12
|
+
const row = anchorSemantics(facts, interpretation);
|
|
13
|
+
const pkgDisplay = formatPackageDisplayName(anchor ?? "dependency", row?.packageRole);
|
|
14
|
+
const copy = scanSurfaceCopy.presentation;
|
|
15
|
+
let headline;
|
|
16
|
+
switch (interpretation.intent) {
|
|
17
|
+
case "limited_context":
|
|
18
|
+
headline = copy.limitedContextHeadline;
|
|
19
|
+
break;
|
|
20
|
+
case "no_changed_packages":
|
|
21
|
+
headline = copy.noChangedPackagesHeadline;
|
|
22
|
+
break;
|
|
23
|
+
case "tooling_patch":
|
|
24
|
+
headline = copy.toolingPatchHeadline.replace("{package}", pkgDisplay);
|
|
25
|
+
break;
|
|
26
|
+
case "tooling_upgrade":
|
|
27
|
+
headline = copy.toolingUpgradeHeadline.replace("{package}", pkgDisplay);
|
|
28
|
+
break;
|
|
29
|
+
case "multi_runtime_upgrade":
|
|
30
|
+
headline = copy.multiRuntimeHeadline;
|
|
31
|
+
break;
|
|
32
|
+
case "auth_runtime_upgrade":
|
|
33
|
+
case "queue_runtime_upgrade":
|
|
34
|
+
case "runtime_upgrade": {
|
|
35
|
+
const surface = interpretation.runtimeSurfaceLabel ?? "application code";
|
|
36
|
+
headline = copy.runtimeUpgradeHeadline
|
|
37
|
+
.replace("{package}", pkgDisplay)
|
|
38
|
+
.replace("{surface}", surface);
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case "unknown_upgrade":
|
|
42
|
+
if (status === "safe") {
|
|
43
|
+
headline = copy.safeNeutralHeadline.replace("{package}", pkgDisplay);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
headline = copy.defaultUpgradeHeadline.replace("{package}", pkgDisplay);
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
default:
|
|
50
|
+
headline = copy.safeNeutralHeadline.replace("{package}", pkgDisplay);
|
|
51
|
+
}
|
|
52
|
+
return applyPostureVocabularyGuardHeadline(headline, status, interpretation.anchorPackage);
|
|
53
|
+
}
|
|
54
|
+
function formatExpectedImpactKeyPoint(interpretation) {
|
|
55
|
+
if (interpretation.intent !== "tooling_patch" &&
|
|
56
|
+
interpretation.intent !== "tooling_upgrade") {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const key = interpretation.expectedImpactKey;
|
|
60
|
+
let workflows = "build and typecheck workflows";
|
|
61
|
+
if (key === "test_time")
|
|
62
|
+
workflows = "test workflows";
|
|
63
|
+
else if (key === "development_only")
|
|
64
|
+
workflows = "development workflows";
|
|
65
|
+
else if (key === "build_time")
|
|
66
|
+
workflows = "build workflows";
|
|
67
|
+
return scanSurfaceCopy.presentation.expectedImpactLimitedKeyPoint.replace("{workflows}", workflows);
|
|
68
|
+
}
|
|
69
|
+
function formatLimitedEvidenceKeyPoint() {
|
|
70
|
+
return scanSurfaceCopy.presentation.limitedEvidenceKeyPoint;
|
|
71
|
+
}
|
|
72
|
+
export function formatPresentationKeyPoints(interpretation, facts, status, max) {
|
|
73
|
+
const points = [];
|
|
74
|
+
if (interpretation.intent === "limited_context") {
|
|
75
|
+
points.push(scanSurfaceCopy.presentation.limitedContextKeyPoint);
|
|
76
|
+
if (facts.changedPackages.primary) {
|
|
77
|
+
points.push(scanSurfaceCopy.presentation.changedPackageKeyPoint.replace("{package}", facts.changedPackages.primary));
|
|
78
|
+
}
|
|
79
|
+
return applyPostureVocabularyGuardLines(points, status).slice(0, max);
|
|
80
|
+
}
|
|
81
|
+
if (interpretation.showLimitedEvidence) {
|
|
82
|
+
points.push(formatLimitedEvidenceKeyPoint());
|
|
83
|
+
}
|
|
84
|
+
if (interpretation.suppressRuntimeNarrative) {
|
|
85
|
+
points.push(scanSurfaceCopy.presentation.noRuntimePathsKeyPoint);
|
|
86
|
+
const impact = formatExpectedImpactKeyPoint(interpretation);
|
|
87
|
+
if (impact)
|
|
88
|
+
points.push(impact);
|
|
89
|
+
}
|
|
90
|
+
else if (interpretation.allowRuntimeNarrative) {
|
|
91
|
+
const usage = facts.packageUsage.find((u) => u.packageName === interpretation.anchorPackage);
|
|
92
|
+
const paths = [...(usage?.paths ?? []), ...(usage?.criticalPaths ?? [])];
|
|
93
|
+
if (paths.length > 0) {
|
|
94
|
+
points.push(scanSurfaceCopy.presentation.usedInRuntimePathsKeyPoint.replace("{count}", String(paths.length)));
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
points.push(scanSurfaceCopy.presentation.runtimeUsageKeyPoint);
|
|
98
|
+
}
|
|
99
|
+
if (facts.affectedAreas.length > 0) {
|
|
100
|
+
const labels = facts.affectedAreas
|
|
101
|
+
.slice(0, 2)
|
|
102
|
+
.map((a) => a.label)
|
|
103
|
+
.join(", ");
|
|
104
|
+
points.push(scanSurfaceCopy.presentation.affectedAreasKeyPoint.replace("{areas}", labels));
|
|
105
|
+
}
|
|
106
|
+
const blast = facts.blastRadius;
|
|
107
|
+
if (blast?.level === "wide") {
|
|
108
|
+
points.push(scanSurfaceCopy.presentation.blastRadiusWideKeyPoint);
|
|
109
|
+
}
|
|
110
|
+
else if (blast?.level === "moderate") {
|
|
111
|
+
points.push(scanSurfaceCopy.presentation.blastRadiusLevelKeyPoint.replace("{level}", "Moderate"));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return applyPostureVocabularyGuardLines(points, status).slice(0, max);
|
|
115
|
+
}
|
|
116
|
+
const AUTH_VERIFICATION = [
|
|
117
|
+
"routes",
|
|
118
|
+
"middleware/hooks",
|
|
119
|
+
"auth flow",
|
|
120
|
+
"serialization",
|
|
121
|
+
"error handling",
|
|
122
|
+
];
|
|
123
|
+
const QUEUE_VERIFICATION = [
|
|
124
|
+
"workers",
|
|
125
|
+
"queue",
|
|
126
|
+
"serialization",
|
|
127
|
+
"error handling",
|
|
128
|
+
];
|
|
129
|
+
const RUNTIME_DEFAULT_VERIFICATION = [
|
|
130
|
+
"routes",
|
|
131
|
+
"middleware/hooks",
|
|
132
|
+
"error handling",
|
|
133
|
+
];
|
|
134
|
+
export function formatPresentationVerification(interpretation, status, max) {
|
|
135
|
+
let actions = [];
|
|
136
|
+
if (interpretation.verificationLabels.length > 0) {
|
|
137
|
+
actions = [...interpretation.verificationLabels];
|
|
138
|
+
}
|
|
139
|
+
else if (interpretation.intent === "auth_runtime_upgrade") {
|
|
140
|
+
actions = [...AUTH_VERIFICATION];
|
|
141
|
+
}
|
|
142
|
+
else if (interpretation.intent === "queue_runtime_upgrade") {
|
|
143
|
+
actions = [...QUEUE_VERIFICATION];
|
|
144
|
+
}
|
|
145
|
+
else if (interpretation.allowRuntimeNarrative) {
|
|
146
|
+
actions = [...RUNTIME_DEFAULT_VERIFICATION];
|
|
147
|
+
}
|
|
148
|
+
else if (interpretation.intent === "tooling_patch" ||
|
|
149
|
+
interpretation.intent === "tooling_upgrade") {
|
|
150
|
+
actions = ["CI", "typecheck", "build"];
|
|
151
|
+
}
|
|
152
|
+
return applyPostureVocabularyGuardLines(actions, status).slice(0, max);
|
|
153
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PackageRoleKind } from "../../scanNarrativeFacts.js";
|
|
2
|
+
/** Display name from package role when engine classified it; else title-case package name. */
|
|
3
|
+
export declare function formatPackageDisplayName(packageName: string, packageRole?: PackageRoleKind | null): string;
|
|
4
|
+
//# sourceMappingURL=packageDisplayName.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packageDisplayName.d.ts","sourceRoot":"","sources":["../../../src/presentation/intent/packageDisplayName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AASnE,8FAA8F;AAC9F,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,eAAe,GAAG,IAAI,GACnC,MAAM,CAOR"}
|