@mergesignal/shared 0.3.0 → 0.4.1
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 +20 -3
- package/dist/deriveScanNarrative.test.js +6 -3
- package/dist/engineWireRegression.test.js +2 -2
- package/dist/fixtures/repoIntelligenceFixtures.d.ts.map +1 -1
- package/dist/fixtures/repoIntelligenceFixtures.js +13 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/narrativeParity.test.js +19 -18
- package/dist/narrativePresentation.d.ts.map +1 -1
- package/dist/narrativePresentation.js +6 -3
- 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 +94 -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.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/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/scanNarrativeFacts.d.ts +7 -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/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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repoIntelligenceMappers.d.ts","sourceRoot":"","sources":["../src/repoIntelligenceMappers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,gEAAgE;AAChE,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC;AAEpE,mDAAmD;AACnD,MAAM,MAAM,wBAAwB,GAAG,UAAU,GAAG,KAAK,GAAG,UAAU,GAAG,MAAM,CAAC;AAEhF,8CAA8C;AAC9C,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,IAAI,CAAC;AAE/E,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,sBAAsB,GAC5B,gBAAgB,CAalB;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,oBAAoB,GAC5B,kBAAkB,CAapB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,MAAM,EAAE,wBAAwB,CAAC;IACjC,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,oBAAoB,CAAC;CACvC,GAAG,gBAAgB,
|
|
1
|
+
{"version":3,"file":"repoIntelligenceMappers.d.ts","sourceRoot":"","sources":["../src/repoIntelligenceMappers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,gEAAgE;AAChE,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC;AAEpE,mDAAmD;AACnD,MAAM,MAAM,wBAAwB,GAAG,UAAU,GAAG,KAAK,GAAG,UAAU,GAAG,MAAM,CAAC;AAEhF,8CAA8C;AAC9C,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,IAAI,CAAC;AAE/E,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,sBAAsB,GAC5B,gBAAgB,CAalB;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,oBAAoB,GAC5B,kBAAkB,CAapB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,MAAM,EAAE,wBAAwB,CAAC;IACjC,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,oBAAoB,CAAC;CACvC,GAAG,gBAAgB,CAgCnB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKpD"}
|
|
@@ -48,7 +48,14 @@ export function mapReachabilityKind(input) {
|
|
|
48
48
|
return "unreachable";
|
|
49
49
|
}
|
|
50
50
|
if (bucket === "moderate" || bucket === "high") {
|
|
51
|
-
|
|
51
|
+
if (dominantSurface === "test")
|
|
52
|
+
return "test_only";
|
|
53
|
+
if (dominantSurface === "build" ||
|
|
54
|
+
dominantSurface === "dev" ||
|
|
55
|
+
dominantSurface === "ci") {
|
|
56
|
+
return "build_only";
|
|
57
|
+
}
|
|
58
|
+
return "unknown";
|
|
52
59
|
}
|
|
53
60
|
return "unknown";
|
|
54
61
|
}
|
|
@@ -9,7 +9,7 @@ import { z } from "zod";
|
|
|
9
9
|
import type { ScanResult } from "./types.js";
|
|
10
10
|
import type { BlastRadiusLevel } from "./scanNarrativeFacts.js";
|
|
11
11
|
/** Bump when wire schema changes incompatibly. */
|
|
12
|
-
export declare const REPO_INTELLIGENCE_ABI: "
|
|
12
|
+
export declare const REPO_INTELLIGENCE_ABI: "2";
|
|
13
13
|
/** Strict canonical wire schema — single source of truth. */
|
|
14
14
|
export declare const repoIntelligenceWireSchema: z.ZodObject<{
|
|
15
15
|
packages: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -34,6 +34,73 @@ export declare const repoIntelligenceWireSchema: z.ZodObject<{
|
|
|
34
34
|
areas: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
35
|
}, z.core.$strip>;
|
|
36
36
|
areas: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
37
|
+
dependencyClass: z.ZodOptional<z.ZodEnum<{
|
|
38
|
+
unknown: "unknown";
|
|
39
|
+
runtime: "runtime";
|
|
40
|
+
build: "build";
|
|
41
|
+
test: "test";
|
|
42
|
+
format: "format";
|
|
43
|
+
tooling: "tooling";
|
|
44
|
+
lint: "lint";
|
|
45
|
+
ci: "ci";
|
|
46
|
+
}>>;
|
|
47
|
+
packageRole: z.ZodOptional<z.ZodEnum<{
|
|
48
|
+
unknown: "unknown";
|
|
49
|
+
typechecker: "typechecker";
|
|
50
|
+
compiler: "compiler";
|
|
51
|
+
bundler: "bundler";
|
|
52
|
+
linter: "linter";
|
|
53
|
+
formatter: "formatter";
|
|
54
|
+
test_runner: "test_runner";
|
|
55
|
+
http_framework: "http_framework";
|
|
56
|
+
auth: "auth";
|
|
57
|
+
queue: "queue";
|
|
58
|
+
orm: "orm";
|
|
59
|
+
}>>;
|
|
60
|
+
lockfileKind: z.ZodOptional<z.ZodEnum<{
|
|
61
|
+
unknown: "unknown";
|
|
62
|
+
optional: "optional";
|
|
63
|
+
production: "production";
|
|
64
|
+
development: "development";
|
|
65
|
+
}>>;
|
|
66
|
+
runtimeImpact: z.ZodOptional<z.ZodEnum<{
|
|
67
|
+
unknown: "unknown";
|
|
68
|
+
confirmed: "confirmed";
|
|
69
|
+
none: "none";
|
|
70
|
+
possible: "possible";
|
|
71
|
+
}>>;
|
|
72
|
+
expectedImpact: z.ZodOptional<z.ZodEnum<{
|
|
73
|
+
unknown: "unknown";
|
|
74
|
+
runtime: "runtime";
|
|
75
|
+
build_time: "build_time";
|
|
76
|
+
typecheck: "typecheck";
|
|
77
|
+
test_time: "test_time";
|
|
78
|
+
development_only: "development_only";
|
|
79
|
+
}>>;
|
|
80
|
+
evidenceStrength: z.ZodOptional<z.ZodEnum<{
|
|
81
|
+
low: "low";
|
|
82
|
+
medium: "medium";
|
|
83
|
+
high: "high";
|
|
84
|
+
}>>;
|
|
85
|
+
confidenceReason: z.ZodOptional<z.ZodString>;
|
|
86
|
+
verificationFocus: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
87
|
+
suppressRuntimeNarrative: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
+
classificationProvenance: z.ZodOptional<z.ZodObject<{
|
|
89
|
+
dependencyClass: z.ZodEnum<{
|
|
90
|
+
unknown: "unknown";
|
|
91
|
+
graph: "graph";
|
|
92
|
+
registry: "registry";
|
|
93
|
+
lockfile: "lockfile";
|
|
94
|
+
heuristic: "heuristic";
|
|
95
|
+
}>;
|
|
96
|
+
packageRole: z.ZodEnum<{
|
|
97
|
+
unknown: "unknown";
|
|
98
|
+
graph: "graph";
|
|
99
|
+
registry: "registry";
|
|
100
|
+
heuristic: "heuristic";
|
|
101
|
+
}>;
|
|
102
|
+
registryEntryId: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, z.core.$strip>>;
|
|
37
104
|
}, z.core.$strip>>;
|
|
38
105
|
packageUsage: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
39
106
|
packageName: z.ZodString;
|
|
@@ -69,6 +136,13 @@ export declare const repoIntelligenceWireSchema: z.ZodObject<{
|
|
|
69
136
|
paths: z.ZodArray<z.ZodString>;
|
|
70
137
|
}, z.core.$strip>>>;
|
|
71
138
|
frameworks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
139
|
+
semanticDiagnostics: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
140
|
+
packageName: z.ZodString;
|
|
141
|
+
ruleId: z.ZodString;
|
|
142
|
+
before: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
143
|
+
after: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
144
|
+
reason: z.ZodString;
|
|
145
|
+
}, z.core.$strip>>>;
|
|
72
146
|
}, z.core.$strip>;
|
|
73
147
|
export type RepoIntelligence = z.infer<typeof repoIntelligenceWireSchema>;
|
|
74
148
|
export type ParseRepoIntelligenceSuccess = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repoIntelligenceSchema.d.ts","sourceRoot":"","sources":["../src/repoIntelligenceSchema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,kDAAkD;AAClD,eAAO,MAAM,qBAAqB,EAAG,GAAY,CAAC;AA+
|
|
1
|
+
{"version":3,"file":"repoIntelligenceSchema.d.ts","sourceRoot":"","sources":["../src/repoIntelligenceSchema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,kDAAkD;AAClD,eAAO,MAAM,qBAAqB,EAAG,GAAY,CAAC;AA+HlD,6DAA6D;AAC7D,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBASrC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE1E,MAAM,MAAM,4BAA4B,GAAG;IACzC,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,gBAAgB,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GACnC,4BAA4B,GAC5B,4BAA4B,CAAC;AAQjC,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAUlE;AAED,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,OAAO,GACX,2BAA2B,CAyC7B;AAED,uEAAuE;AACvE,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAM3E;AAED,mFAAmF;AACnF,wBAAgB,uCAAuC,CACrD,IAAI,EAAE,UAAU,GACf,IAAI,CAGN;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,gBAAgB,GAAG,SAAS,GAClC,gBAAgB,GAAG,IAAI,CAKzB"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
/** Bump when wire schema changes incompatibly. */
|
|
10
|
-
export const REPO_INTELLIGENCE_ABI = "
|
|
10
|
+
export const REPO_INTELLIGENCE_ABI = "2";
|
|
11
11
|
const surfaceKindSchema = z.enum(["runtime", "build", "test", "unknown"]);
|
|
12
12
|
const reachabilityKindSchema = z.enum([
|
|
13
13
|
"on_runtime_paths",
|
|
@@ -24,11 +24,83 @@ const packageUsageWireSchema = z.object({
|
|
|
24
24
|
criticalPaths: z.array(z.string()).optional(),
|
|
25
25
|
areas: z.array(z.string()).optional(),
|
|
26
26
|
});
|
|
27
|
+
const dependencyClassSchema = z.enum([
|
|
28
|
+
"runtime",
|
|
29
|
+
"tooling",
|
|
30
|
+
"test",
|
|
31
|
+
"lint",
|
|
32
|
+
"format",
|
|
33
|
+
"build",
|
|
34
|
+
"ci",
|
|
35
|
+
"unknown",
|
|
36
|
+
]);
|
|
37
|
+
const packageRoleSchema = z.enum([
|
|
38
|
+
"typechecker",
|
|
39
|
+
"compiler",
|
|
40
|
+
"bundler",
|
|
41
|
+
"linter",
|
|
42
|
+
"formatter",
|
|
43
|
+
"test_runner",
|
|
44
|
+
"http_framework",
|
|
45
|
+
"auth",
|
|
46
|
+
"queue",
|
|
47
|
+
"orm",
|
|
48
|
+
"unknown",
|
|
49
|
+
]);
|
|
50
|
+
const lockfileKindSchema = z.enum([
|
|
51
|
+
"production",
|
|
52
|
+
"development",
|
|
53
|
+
"optional",
|
|
54
|
+
"unknown",
|
|
55
|
+
]);
|
|
56
|
+
const runtimeImpactSchema = z.enum([
|
|
57
|
+
"none",
|
|
58
|
+
"possible",
|
|
59
|
+
"confirmed",
|
|
60
|
+
"unknown",
|
|
61
|
+
]);
|
|
62
|
+
const expectedImpactSchema = z.enum([
|
|
63
|
+
"runtime",
|
|
64
|
+
"build_time",
|
|
65
|
+
"typecheck",
|
|
66
|
+
"test_time",
|
|
67
|
+
"development_only",
|
|
68
|
+
"unknown",
|
|
69
|
+
]);
|
|
70
|
+
const evidenceStrengthSchema = z.enum(["high", "medium", "low"]);
|
|
71
|
+
const classificationProvenanceSchema = z.object({
|
|
72
|
+
dependencyClass: z.enum([
|
|
73
|
+
"registry",
|
|
74
|
+
"graph",
|
|
75
|
+
"lockfile",
|
|
76
|
+
"heuristic",
|
|
77
|
+
"unknown",
|
|
78
|
+
]),
|
|
79
|
+
packageRole: z.enum(["registry", "graph", "heuristic", "unknown"]),
|
|
80
|
+
registryEntryId: z.string().optional(),
|
|
81
|
+
});
|
|
82
|
+
const semanticDiagnosticSchema = z.object({
|
|
83
|
+
packageName: z.string().min(1),
|
|
84
|
+
ruleId: z.string().min(1),
|
|
85
|
+
before: z.record(z.string(), z.unknown()),
|
|
86
|
+
after: z.record(z.string(), z.unknown()),
|
|
87
|
+
reason: z.string().min(1),
|
|
88
|
+
});
|
|
27
89
|
const packageIntelWireSchema = z.object({
|
|
28
90
|
runtimeSurface: surfaceKindSchema,
|
|
29
91
|
reachability: reachabilityKindSchema,
|
|
30
92
|
usage: packageUsageWireSchema,
|
|
31
93
|
areas: z.array(z.string()).optional(),
|
|
94
|
+
dependencyClass: dependencyClassSchema.optional(),
|
|
95
|
+
packageRole: packageRoleSchema.optional(),
|
|
96
|
+
lockfileKind: lockfileKindSchema.optional(),
|
|
97
|
+
runtimeImpact: runtimeImpactSchema.optional(),
|
|
98
|
+
expectedImpact: expectedImpactSchema.optional(),
|
|
99
|
+
evidenceStrength: evidenceStrengthSchema.optional(),
|
|
100
|
+
confidenceReason: z.string().optional(),
|
|
101
|
+
verificationFocus: z.array(z.string()).optional(),
|
|
102
|
+
suppressRuntimeNarrative: z.boolean().optional(),
|
|
103
|
+
classificationProvenance: classificationProvenanceSchema.optional(),
|
|
32
104
|
});
|
|
33
105
|
const areaSchema = z.object({
|
|
34
106
|
id: z.string().min(1),
|
|
@@ -54,6 +126,7 @@ export const repoIntelligenceWireSchema = z.object({
|
|
|
54
126
|
affectedAreas: z.array(areaSchema).optional(),
|
|
55
127
|
hotspots: z.array(hotspotWireSchema).optional(),
|
|
56
128
|
frameworks: z.array(z.string().min(1)).optional(),
|
|
129
|
+
semanticDiagnostics: z.array(semanticDiagnosticSchema).optional(),
|
|
57
130
|
});
|
|
58
131
|
function formatZodIssues(error) {
|
|
59
132
|
return error.issues.map((i) => `${i.path.join(".") || "(root)"}: ${i.message}`);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { RepoIntelligence } from "./repoIntelligenceSchema.js";
|
|
2
|
+
export type DependencyClass = "runtime" | "tooling" | "test" | "lint" | "format" | "build" | "ci" | "unknown";
|
|
3
|
+
export type PackageRole = "typechecker" | "compiler" | "bundler" | "linter" | "formatter" | "test_runner" | "http_framework" | "auth" | "queue" | "orm" | "unknown";
|
|
4
|
+
export type LockfileKind = "production" | "development" | "optional" | "unknown";
|
|
5
|
+
export type RuntimeImpact = "none" | "possible" | "confirmed" | "unknown";
|
|
6
|
+
export type ExpectedImpact = "runtime" | "build_time" | "typecheck" | "test_time" | "development_only" | "unknown";
|
|
7
|
+
export type EvidenceStrength = "high" | "medium" | "low";
|
|
8
|
+
export type ClassificationSource = "registry" | "graph" | "lockfile" | "heuristic" | "unknown";
|
|
9
|
+
export type SemanticDiagnostic = {
|
|
10
|
+
packageName: string;
|
|
11
|
+
ruleId: string;
|
|
12
|
+
before: Record<string, unknown>;
|
|
13
|
+
after: Record<string, unknown>;
|
|
14
|
+
reason: string;
|
|
15
|
+
};
|
|
16
|
+
export type SanitizeRepoIntelligenceResult = {
|
|
17
|
+
wire: RepoIntelligence;
|
|
18
|
+
diagnostics: SemanticDiagnostic[];
|
|
19
|
+
degradedPackages: string[];
|
|
20
|
+
};
|
|
21
|
+
type PackageRow = RepoIntelligence["packages"][string];
|
|
22
|
+
/**
|
|
23
|
+
* Hard gate: normalize contradictory package intelligence before wire emit.
|
|
24
|
+
*/
|
|
25
|
+
export declare function sanitizeRepoIntelligenceSemantics(draft: RepoIntelligence): SanitizeRepoIntelligenceResult;
|
|
26
|
+
/** Returns true when wire is safe for runtime narrative tier1. */
|
|
27
|
+
export declare function isRuntimeNarrativeSafe(row: PackageRow | undefined): boolean;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=repoIntelligenceSemantics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repoIntelligenceSemantics.d.ts","sourceRoot":"","sources":["../src/repoIntelligenceSemantics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,SAAS,GACT,MAAM,GACN,MAAM,GACN,QAAQ,GACR,OAAO,GACP,IAAI,GACJ,SAAS,CAAC;AAEd,MAAM,MAAM,WAAW,GACnB,aAAa,GACb,UAAU,GACV,SAAS,GACT,QAAQ,GACR,WAAW,GACX,aAAa,GACb,gBAAgB,GAChB,MAAM,GACN,OAAO,GACP,KAAK,GACL,SAAS,CAAC;AAEd,MAAM,MAAM,YAAY,GACpB,YAAY,GACZ,aAAa,GACb,UAAU,GACV,SAAS,CAAC;AAEd,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,CAAC;AAE1E,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,YAAY,GACZ,WAAW,GACX,WAAW,GACX,kBAAkB,GAClB,SAAS,CAAC;AAEd,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEzD,MAAM,MAAM,oBAAoB,GAC5B,UAAU,GACV,OAAO,GACP,UAAU,GACV,WAAW,GACX,SAAS,CAAC;AAEd,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,gBAAgB,CAAC;IACvB,WAAW,EAAE,kBAAkB,EAAE,CAAC;IAClC,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAyBF,KAAK,UAAU,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AA+IvD;;GAEG;AACH,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,gBAAgB,GACtB,8BAA8B,CAoBhC;AAED,kEAAkE;AAClE,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAa3E"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
const TOOLING_CLASSES = new Set([
|
|
2
|
+
"tooling",
|
|
3
|
+
"test",
|
|
4
|
+
"lint",
|
|
5
|
+
"format",
|
|
6
|
+
"build",
|
|
7
|
+
"ci",
|
|
8
|
+
]);
|
|
9
|
+
const RUNTIME_VERIFICATION = new Set([
|
|
10
|
+
"auth_flow",
|
|
11
|
+
"route_handlers",
|
|
12
|
+
"routes",
|
|
13
|
+
"handlers",
|
|
14
|
+
"serialization",
|
|
15
|
+
"hooks",
|
|
16
|
+
"plugins",
|
|
17
|
+
"session",
|
|
18
|
+
"auth",
|
|
19
|
+
"queue",
|
|
20
|
+
"workers",
|
|
21
|
+
]);
|
|
22
|
+
function cloneWire(wire) {
|
|
23
|
+
return structuredClone(wire);
|
|
24
|
+
}
|
|
25
|
+
function isToolingClass(dc) {
|
|
26
|
+
return dc != null && TOOLING_CLASSES.has(dc);
|
|
27
|
+
}
|
|
28
|
+
function stripRuntimeVerification(focus) {
|
|
29
|
+
if (!focus?.length)
|
|
30
|
+
return [];
|
|
31
|
+
return focus.filter((f) => !RUNTIME_VERIFICATION.has(f));
|
|
32
|
+
}
|
|
33
|
+
function applyS1(row) {
|
|
34
|
+
return row.runtimeSurface === "runtime" && row.reachability === "unreachable";
|
|
35
|
+
}
|
|
36
|
+
function applyS2(row) {
|
|
37
|
+
return (row.runtimeImpact === "none" && row.reachability === "on_runtime_paths");
|
|
38
|
+
}
|
|
39
|
+
function applyS3(row) {
|
|
40
|
+
return (isToolingClass(row.dependencyClass) && row.runtimeImpact === "confirmed");
|
|
41
|
+
}
|
|
42
|
+
function applyS4(row) {
|
|
43
|
+
return (row.runtimeImpact === "confirmed" && (row.usage?.files?.length ?? 0) === 0);
|
|
44
|
+
}
|
|
45
|
+
function applyS5(row) {
|
|
46
|
+
if (!row.suppressRuntimeNarrative)
|
|
47
|
+
return false;
|
|
48
|
+
const focus = row.verificationFocus ?? [];
|
|
49
|
+
return focus.some((f) => RUNTIME_VERIFICATION.has(f));
|
|
50
|
+
}
|
|
51
|
+
function sanitizePackageRow(packageName, row) {
|
|
52
|
+
const diagnostics = [];
|
|
53
|
+
let degraded = false;
|
|
54
|
+
const next = { ...row };
|
|
55
|
+
const record = (ruleId, before, after, reason) => {
|
|
56
|
+
diagnostics.push({ packageName, ruleId, before, after, reason });
|
|
57
|
+
degraded = true;
|
|
58
|
+
};
|
|
59
|
+
if (applyS1(next)) {
|
|
60
|
+
const before = {
|
|
61
|
+
runtimeSurface: next.runtimeSurface,
|
|
62
|
+
reachability: next.reachability,
|
|
63
|
+
};
|
|
64
|
+
next.runtimeSurface = "build";
|
|
65
|
+
next.reachability = "build_only";
|
|
66
|
+
next.runtimeImpact = next.runtimeImpact ?? "none";
|
|
67
|
+
next.suppressRuntimeNarrative = true;
|
|
68
|
+
record("S1", before, { runtimeSurface: next.runtimeSurface, reachability: next.reachability }, "runtime_surface_unreachable");
|
|
69
|
+
}
|
|
70
|
+
if (applyS3(next)) {
|
|
71
|
+
const before = { runtimeImpact: next.runtimeImpact };
|
|
72
|
+
next.runtimeImpact = "none";
|
|
73
|
+
next.suppressRuntimeNarrative = true;
|
|
74
|
+
record("S3", before, { runtimeImpact: next.runtimeImpact }, "tooling_confirmed_without_proof");
|
|
75
|
+
}
|
|
76
|
+
if (applyS4(next)) {
|
|
77
|
+
const before = { runtimeImpact: next.runtimeImpact };
|
|
78
|
+
next.runtimeImpact = "none";
|
|
79
|
+
next.evidenceStrength = "low";
|
|
80
|
+
next.suppressRuntimeNarrative = true;
|
|
81
|
+
record("S4", before, { runtimeImpact: next.runtimeImpact }, "confirmed_without_imports");
|
|
82
|
+
}
|
|
83
|
+
if (applyS2(next)) {
|
|
84
|
+
const before = { reachability: next.reachability };
|
|
85
|
+
next.reachability = "unknown";
|
|
86
|
+
record("S2", before, { reachability: next.reachability }, "none_but_on_runtime_paths");
|
|
87
|
+
}
|
|
88
|
+
if (applyS5(next)) {
|
|
89
|
+
const before = { verificationFocus: next.verificationFocus };
|
|
90
|
+
next.verificationFocus = stripRuntimeVerification(next.verificationFocus);
|
|
91
|
+
record("S5", before, { verificationFocus: next.verificationFocus }, "runtime_focus_while_suppressed");
|
|
92
|
+
}
|
|
93
|
+
if (next.runtimeSurface === "runtime" &&
|
|
94
|
+
next.reachability === "unreachable") {
|
|
95
|
+
next.runtimeSurface = "unknown";
|
|
96
|
+
next.reachability = "unknown";
|
|
97
|
+
next.suppressRuntimeNarrative = true;
|
|
98
|
+
degraded = true;
|
|
99
|
+
}
|
|
100
|
+
if (next.suppressRuntimeNarrative && next.runtimeImpact === "confirmed") {
|
|
101
|
+
next.runtimeImpact = "unknown";
|
|
102
|
+
degraded = true;
|
|
103
|
+
}
|
|
104
|
+
return { row: next, diagnostics, degraded };
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Hard gate: normalize contradictory package intelligence before wire emit.
|
|
108
|
+
*/
|
|
109
|
+
export function sanitizeRepoIntelligenceSemantics(draft) {
|
|
110
|
+
const wire = cloneWire(draft);
|
|
111
|
+
const diagnostics = [];
|
|
112
|
+
const degradedPackages = [];
|
|
113
|
+
for (const [packageName, row] of Object.entries(wire.packages)) {
|
|
114
|
+
const result = sanitizePackageRow(packageName, row);
|
|
115
|
+
wire.packages[packageName] = result.row;
|
|
116
|
+
diagnostics.push(...result.diagnostics);
|
|
117
|
+
if (result.degraded)
|
|
118
|
+
degradedPackages.push(packageName);
|
|
119
|
+
}
|
|
120
|
+
if (diagnostics.length > 0) {
|
|
121
|
+
wire.semanticDiagnostics = [
|
|
122
|
+
...(wire.semanticDiagnostics ?? []),
|
|
123
|
+
...diagnostics,
|
|
124
|
+
];
|
|
125
|
+
}
|
|
126
|
+
return { wire, diagnostics, degradedPackages };
|
|
127
|
+
}
|
|
128
|
+
/** Returns true when wire is safe for runtime narrative tier1. */
|
|
129
|
+
export function isRuntimeNarrativeSafe(row) {
|
|
130
|
+
if (!row)
|
|
131
|
+
return false;
|
|
132
|
+
if (row.suppressRuntimeNarrative === true)
|
|
133
|
+
return false;
|
|
134
|
+
if (row.runtimeImpact === "none")
|
|
135
|
+
return false;
|
|
136
|
+
if (row.runtimeSurface === "runtime" && row.reachability === "unreachable") {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
if (row.runtimeImpact === "confirmed" || row.runtimeImpact === "possible") {
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
if (row.runtimeImpact === "unknown")
|
|
143
|
+
return false;
|
|
144
|
+
// ABI 1 wire without semantic fields: allow non-contradictory surface/reach pairs.
|
|
145
|
+
return row.runtimeSurface != null && row.reachability != null;
|
|
146
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repoIntelligenceSemantics.test.d.ts","sourceRoot":"","sources":["../src/repoIntelligenceSemantics.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { isRuntimeNarrativeSafe, sanitizeRepoIntelligenceSemantics, } from "./repoIntelligenceSemantics.js";
|
|
3
|
+
function basePkg(overrides = {}) {
|
|
4
|
+
return {
|
|
5
|
+
runtimeSurface: "runtime",
|
|
6
|
+
reachability: "unreachable",
|
|
7
|
+
usage: { packageName: "typescript", files: [] },
|
|
8
|
+
...overrides,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
describe("sanitizeRepoIntelligenceSemantics", () => {
|
|
12
|
+
it("S1: neutralizes runtime + unreachable", () => {
|
|
13
|
+
const draft = {
|
|
14
|
+
packages: {
|
|
15
|
+
typescript: basePkg({
|
|
16
|
+
runtimeImpact: "unknown",
|
|
17
|
+
}),
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
const { wire, diagnostics } = sanitizeRepoIntelligenceSemantics(draft);
|
|
21
|
+
expect(wire.packages.typescript?.runtimeSurface).not.toBe("runtime");
|
|
22
|
+
expect(wire.packages.typescript?.reachability).not.toBe("unreachable");
|
|
23
|
+
expect(wire.packages.typescript?.suppressRuntimeNarrative).toBe(true);
|
|
24
|
+
expect(diagnostics.some((d) => d.ruleId === "S1")).toBe(true);
|
|
25
|
+
});
|
|
26
|
+
it("S3: tooling class cannot stay confirmed", () => {
|
|
27
|
+
const draft = {
|
|
28
|
+
packages: {
|
|
29
|
+
typescript: basePkg({
|
|
30
|
+
dependencyClass: "tooling",
|
|
31
|
+
runtimeImpact: "confirmed",
|
|
32
|
+
runtimeSurface: "build",
|
|
33
|
+
reachability: "build_only",
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
const { wire } = sanitizeRepoIntelligenceSemantics(draft);
|
|
38
|
+
expect(wire.packages.typescript?.runtimeImpact).toBe("none");
|
|
39
|
+
});
|
|
40
|
+
it("S4: confirmed without imports downgrades", () => {
|
|
41
|
+
const draft = {
|
|
42
|
+
packages: {
|
|
43
|
+
fastify: basePkg({
|
|
44
|
+
runtimeImpact: "confirmed",
|
|
45
|
+
usage: { packageName: "fastify", files: [] },
|
|
46
|
+
}),
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
const { wire } = sanitizeRepoIntelligenceSemantics(draft);
|
|
50
|
+
expect(wire.packages.fastify?.runtimeImpact).toBe("none");
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
describe("isRuntimeNarrativeSafe", () => {
|
|
54
|
+
it("returns false for suppressed runtime narrative", () => {
|
|
55
|
+
expect(isRuntimeNarrativeSafe({
|
|
56
|
+
runtimeSurface: "runtime",
|
|
57
|
+
reachability: "on_runtime_paths",
|
|
58
|
+
usage: { packageName: "x", files: ["src/a.ts"] },
|
|
59
|
+
suppressRuntimeNarrative: true,
|
|
60
|
+
runtimeImpact: "none",
|
|
61
|
+
})).toBe(false);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { NarrativeAvailabilityMode } from "./scanNarrativeFacts.js";
|
|
3
|
-
import { type MergePosture } from "./riskVocabulary.js";
|
|
1
|
+
import type { ScanCardPresentation } from "./presentation/dto/scanCardPresentation.js";
|
|
4
2
|
import type { Finding, ScanResult } from "./types.js";
|
|
5
3
|
export type ScanPipelineStatus = "queued" | "running" | "done" | "failed";
|
|
6
4
|
export type ScanCardPresentationState = "not_scanned" | "scanning" | "analysis_failed" | "ready" | "stale";
|
|
@@ -11,38 +9,9 @@ export type FindingCountSummary = {
|
|
|
11
9
|
medium: number;
|
|
12
10
|
low: number;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
riskIndexBand: RiskIndexBand | null;
|
|
18
|
-
headline: string;
|
|
19
|
-
/** @deprecated Use operationalObservations */
|
|
20
|
-
summaryLine: string | null;
|
|
21
|
-
findingCounts: FindingCountSummary | null;
|
|
22
|
-
/** @deprecated Use affectedAreas */
|
|
23
|
-
topAffectedAreas: string[];
|
|
24
|
-
/** Catalog-mapped topology observations (0–3). Tier 3 repo context — legacy wire field. */
|
|
25
|
-
operationalObservations: CatalogPhrase[];
|
|
26
|
-
/** Optional quiet subline when exactly one observation is shown. */
|
|
27
|
-
supportingLine: string | null;
|
|
28
|
-
narrativeMode: NarrativeAvailabilityMode;
|
|
29
|
-
codeIntelligenceAvailable: boolean;
|
|
30
|
-
changedPackagesDisplay: string | null;
|
|
31
|
-
runtimeSurfaceLabel: string | null;
|
|
32
|
-
reachabilityLabel: string | null;
|
|
33
|
-
blastRadiusLabel: string | null;
|
|
34
|
-
affectedAreas: string[];
|
|
35
|
-
primaryInsight: string | null;
|
|
36
|
-
structuralOnlyDisclaimer: string | null;
|
|
37
|
-
/** One-line usage hint from packageUsage paths or areas. */
|
|
38
|
-
usageSummary: string | null;
|
|
39
|
-
/** Single verification prompt from changed-scope guidance or usage. */
|
|
40
|
-
verificationLine: string | null;
|
|
41
|
-
/** Optional blast factor subline when factors exist. */
|
|
42
|
-
blastRadiusDetail: string | null;
|
|
43
|
-
/** Short framework list (max 2 on card). */
|
|
44
|
-
frameworksSummary: string | null;
|
|
45
|
-
};
|
|
12
|
+
/** @deprecated Use ScanCardPresentation */
|
|
13
|
+
export type ScanCardSummary = ScanCardPresentation;
|
|
14
|
+
export { ScanCardPresentation };
|
|
46
15
|
export declare const SCAN_CARD_SCANNING_SUMMARY = "Waiting for results...";
|
|
47
16
|
export type PipelineCompletionEvidence = {
|
|
48
17
|
scannedAt?: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scanCardSummary.d.ts","sourceRoot":"","sources":["../src/scanCardSummary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scanCardSummary.d.ts","sourceRoot":"","sources":["../src/scanCardSummary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAMvF,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE1E,MAAM,MAAM,yBAAyB,GACjC,aAAa,GACb,UAAU,GACV,iBAAiB,GACjB,OAAO,GACP,OAAO,CAAC;AAEZ,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEtD,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,2CAA2C;AAC3C,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAEnD,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAGhC,eAAO,MAAM,0BAA0B,2BAA2B,CAAC;AAEnE,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAsBF,wFAAwF;AACxF,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,0BAA0B,GACnC,OAAO,CAQT;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,QAAQ,EAAE,0BAA0B,GACnC,kBAAkB,CAKpB;AAED,8EAA8E;AAC9E,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC9B,OAAO,CAST;AAED,wEAAwE;AACxE,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAEvE;AAED,mFAAmF;AACnF,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC/B,aAAa,GAAG,IAAI,CAKtB;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,GAAG,SAAS,GACrC,mBAAmB,CAgBrB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,EACrC,cAAc,EAAE,kBAAkB,GACjC,eAAe,CAOjB;AAED,wEAAwE;AACxE,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,2FAA2F;AAC3F,wBAAgB,qCAAqC,CACnD,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,cAAc,EAAE,kBAAkB,GACjC,eAAe,CAuBjB;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,sBAAsB,GAC5B,eAAe,CAcjB"}
|
package/dist/scanCardSummary.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { presentScanCardSummary } from "./presentScanCardSummary.js";
|
|
1
|
+
import { buildScanCardPresentation } from "./presentation/orchestration/buildScanCardPresentation.js";
|
|
3
2
|
import { mergePostureFromDecision, } from "./riskVocabulary.js";
|
|
4
3
|
import { scanSurfaceCopy } from "./scanSurfaceCopy.js";
|
|
5
4
|
const STALE_SUBLINE = "Based on earlier commit";
|
|
@@ -53,14 +52,7 @@ export function isPipelinePlaceholderCopy(text) {
|
|
|
53
52
|
}
|
|
54
53
|
/** True when summary reflects pipeline lifecycle, not merge posture. */
|
|
55
54
|
export function isPipelineCardSummary(summary) {
|
|
56
|
-
|
|
57
|
-
return true;
|
|
58
|
-
return (summary.mergePosture === null &&
|
|
59
|
-
summary.riskIndex === null &&
|
|
60
|
-
(summary.headline === scanSurfaceCopy.pipeline.scanRunning ||
|
|
61
|
-
summary.headline === scanSurfaceCopy.pipeline.analysisIncomplete ||
|
|
62
|
-
summary.headline === scanSurfaceCopy.pipeline.scanUnavailable) &&
|
|
63
|
-
summary.narrativeMode === "denormalized");
|
|
55
|
+
return summary.pipeline != null;
|
|
64
56
|
}
|
|
65
57
|
/** Single source for risk index color bands (aligns with decision score bands). */
|
|
66
58
|
export function deriveRiskIndexBand(score) {
|
|
@@ -101,26 +93,11 @@ export function aggregateFindingCounts(findings) {
|
|
|
101
93
|
* Quiet safe cards with no mappable signals show posture + exposure only.
|
|
102
94
|
*/
|
|
103
95
|
export function deriveScanCardSummary(result, pipelineStatus) {
|
|
104
|
-
|
|
105
|
-
return presentScanCardSummary(deriveScanNarrative(null), {
|
|
106
|
-
pipelineStatus,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
if (pipelineStatus === "failed") {
|
|
110
|
-
return presentScanCardSummary(deriveScanNarrative(null), {
|
|
111
|
-
pipelineStatus: "failed",
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
if (!result) {
|
|
115
|
-
return {
|
|
116
|
-
...presentScanCardSummary(deriveScanNarrative(null), { pipelineStatus }),
|
|
117
|
-
headline: scanSurfaceCopy.pipeline.scanUnavailable,
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
const facts = deriveScanNarrative(result);
|
|
121
|
-
return presentScanCardSummary(facts, {
|
|
96
|
+
return buildScanCardPresentation({
|
|
122
97
|
pipelineStatus,
|
|
123
|
-
|
|
98
|
+
result: result ?? null,
|
|
99
|
+
decision: result?.decision?.recommendation,
|
|
100
|
+
totalScore: result?.totalScore,
|
|
124
101
|
});
|
|
125
102
|
}
|
|
126
103
|
/** Subline appended when scan results are stale (head SHA mismatch). */
|
|
@@ -160,38 +137,10 @@ export function resolvePrScanCardSummary(input) {
|
|
|
160
137
|
hasResult: input.result != null,
|
|
161
138
|
scannedAt: input.scannedAt,
|
|
162
139
|
});
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
})
|
|
170
|
-
? {
|
|
171
|
-
totalScore: input.totalScore ?? 0,
|
|
172
|
-
layerScores: {
|
|
173
|
-
security: 0,
|
|
174
|
-
maintainability: 0,
|
|
175
|
-
ecosystem: 0,
|
|
176
|
-
upgradeImpact: 0,
|
|
177
|
-
},
|
|
178
|
-
findings: [],
|
|
179
|
-
generatedAt: new Date().toISOString(),
|
|
180
|
-
decision: mergePostureFromDecision(input.decision)
|
|
181
|
-
? {
|
|
182
|
-
recommendation: mergePostureFromDecision(input.decision),
|
|
183
|
-
confidence: "medium",
|
|
184
|
-
reasoning: [],
|
|
185
|
-
}
|
|
186
|
-
: undefined,
|
|
187
|
-
}
|
|
188
|
-
: null);
|
|
189
|
-
if (scanResult) {
|
|
190
|
-
const fromResult = deriveScanCardSummary(scanResult, "done");
|
|
191
|
-
if (!isPipelineCardSummary(fromResult))
|
|
192
|
-
return fromResult;
|
|
193
|
-
}
|
|
194
|
-
return deriveScanCardSummaryFromDenormalized(input.decision, input.totalScore, input.summaryText, "done");
|
|
195
|
-
}
|
|
196
|
-
return deriveScanCardSummary(input.result, effectivePipeline);
|
|
140
|
+
return buildScanCardPresentation({
|
|
141
|
+
pipelineStatus: effectivePipeline,
|
|
142
|
+
result: input.result,
|
|
143
|
+
decision: input.decision,
|
|
144
|
+
totalScore: input.totalScore,
|
|
145
|
+
});
|
|
197
146
|
}
|