@gpzhang2001/sharpkit-reporting 0.2.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/lib/index.d.ts ADDED
@@ -0,0 +1,498 @@
1
+ import z from "@deepseek-ai/schemastery";
2
+ import { Context } from "@deepseek-ai/cordis";
3
+ //#region src/state.d.ts
4
+ var [VulnerabilityReport] = [
5
+ 40,
6
+ () => [],
7
+ [
8
+ "",
9
+ "",
10
+ "",
11
+ "",
12
+ ""
13
+ ]
14
+ ];
15
+ var [Clock] = [
16
+ 41,
17
+ () => [Date],
18
+ [""]
19
+ ];
20
+ var [cleanTitle] = [
21
+ 44,
22
+ () => [],
23
+ [""]
24
+ ];
25
+ var [severityRank] = [
26
+ 46,
27
+ () => [],
28
+ [""]
29
+ ];
30
+ var [AddReportInput] = [
31
+ 50,
32
+ () => [Record, Record],
33
+ [
34
+ "",
35
+ "",
36
+ "",
37
+ "",
38
+ "",
39
+ "",
40
+ "",
41
+ "",
42
+ ""
43
+ ]
44
+ ];
45
+ var [UpdateOutcome] = [
46
+ 51,
47
+ () => [VulnerabilityReport],
48
+ [
49
+ "",
50
+ "",
51
+ ""
52
+ ]
53
+ ];
54
+ var [ReportState] = [
55
+ 52,
56
+ () => [
57
+ VulnerabilityReport,
58
+ Set,
59
+ Clock,
60
+ AddReportInput,
61
+ VulnerabilityReport,
62
+ Record,
63
+ UpdateOutcome
64
+ ],
65
+ [
66
+ "",
67
+ "",
68
+ "",
69
+ "",
70
+ "",
71
+ "",
72
+ "",
73
+ "",
74
+ "",
75
+ "",
76
+ "",
77
+ "",
78
+ "",
79
+ "",
80
+ "",
81
+ "",
82
+ "",
83
+ "",
84
+ "",
85
+ "",
86
+ "",
87
+ "",
88
+ "",
89
+ "",
90
+ "",
91
+ "",
92
+ "",
93
+ "",
94
+ "",
95
+ "",
96
+ "",
97
+ "",
98
+ "",
99
+ "",
100
+ ""
101
+ ]
102
+ ];
103
+ //#endregion
104
+ //#region src/dedupe.d.ts
105
+ var [DependencyIdentity] = [
106
+ 32,
107
+ () => [],
108
+ [
109
+ "",
110
+ "",
111
+ ""
112
+ ]
113
+ ];
114
+ var [DuplicateVerdict] = [
115
+ 33,
116
+ () => [],
117
+ [
118
+ "",
119
+ "",
120
+ "",
121
+ ""
122
+ ]
123
+ ];
124
+ var [DedupeJudge] = [
125
+ 34,
126
+ () => [
127
+ Record,
128
+ VulnerabilityReport,
129
+ DuplicateVerdict,
130
+ Promise
131
+ ],
132
+ [
133
+ "",
134
+ "",
135
+ "",
136
+ "",
137
+ "",
138
+ ""
139
+ ]
140
+ ];
141
+ var [dependencyIdentity] = [
142
+ 35,
143
+ () => [DependencyIdentity],
144
+ ["", ""]
145
+ ];
146
+ var [checkDuplicate] = [
147
+ 39,
148
+ () => [
149
+ Record,
150
+ Record,
151
+ VulnerabilityReport,
152
+ DedupeJudge,
153
+ DuplicateVerdict,
154
+ Promise
155
+ ],
156
+ [
157
+ "",
158
+ "",
159
+ "",
160
+ "",
161
+ "",
162
+ "",
163
+ "",
164
+ "",
165
+ "",
166
+ ""
167
+ ]
168
+ ];
169
+ //#endregion
170
+ //#region src/writers.d.ts
171
+ var [renderVulnerabilityMd] = [
172
+ 58,
173
+ () => [VulnerabilityReport],
174
+ ["", ""]
175
+ ];
176
+ //#endregion
177
+ //#region src/cvss.d.ts
178
+ var [CVSS_VALID] = [
179
+ 64,
180
+ () => [],
181
+ [
182
+ "",
183
+ "",
184
+ "",
185
+ "",
186
+ "",
187
+ "",
188
+ "",
189
+ ""
190
+ ]
191
+ ];
192
+ var [CvssMetricName] = [
193
+ 65,
194
+ () => [CVSS_VALID],
195
+ [""]
196
+ ];
197
+ var [validateCvssBreakdown] = [
198
+ 66,
199
+ () => [Record],
200
+ ["", ""]
201
+ ];
202
+ var [buildCvssVector] = [
203
+ 67,
204
+ () => [
205
+ CvssMetricName,
206
+ Record,
207
+ Readonly
208
+ ],
209
+ [
210
+ "",
211
+ "",
212
+ "",
213
+ ""
214
+ ]
215
+ ];
216
+ var [cvssBaseScore] = [
217
+ 68,
218
+ () => [
219
+ CvssMetricName,
220
+ Record,
221
+ Readonly
222
+ ],
223
+ [
224
+ "",
225
+ "",
226
+ "",
227
+ ""
228
+ ]
229
+ ];
230
+ var [cvssSeverity] = [
231
+ 69,
232
+ () => [],
233
+ [""]
234
+ ];
235
+ var [calculateCvss] = [
236
+ 70,
237
+ () => [
238
+ CvssMetricName,
239
+ Record,
240
+ Readonly
241
+ ],
242
+ [
243
+ "",
244
+ "",
245
+ "",
246
+ "",
247
+ "",
248
+ "",
249
+ ""
250
+ ]
251
+ ];
252
+ var [dependencySeverity] = [
253
+ 71,
254
+ () => [],
255
+ [""]
256
+ ];
257
+ //#endregion
258
+ //#region src/sarif.d.ts
259
+ var [Json] = [
260
+ 16,
261
+ () => [Json, Json],
262
+ [
263
+ "",
264
+ "",
265
+ ""
266
+ ]
267
+ ];
268
+ var [ruleIdOf] = [
269
+ 17,
270
+ () => [VulnerabilityReport],
271
+ ["", ""]
272
+ ];
273
+ var [classKeyword] = [
274
+ 20,
275
+ () => [],
276
+ [""]
277
+ ];
278
+ var [sarifUri] = [
279
+ 23,
280
+ () => [],
281
+ [""]
282
+ ];
283
+ var [SarifCoverageEntry] = [
284
+ 26,
285
+ () => [],
286
+ [
287
+ "",
288
+ "",
289
+ "",
290
+ "",
291
+ ""
292
+ ]
293
+ ];
294
+ var [SarifCoverage] = [
295
+ 27,
296
+ () => [SarifCoverageEntry],
297
+ [
298
+ "",
299
+ "",
300
+ "",
301
+ "",
302
+ ""
303
+ ]
304
+ ];
305
+ var [SarifOptions] = [
306
+ 28,
307
+ () => [SarifCoverage],
308
+ [
309
+ "",
310
+ "",
311
+ "",
312
+ "",
313
+ "",
314
+ "",
315
+ "",
316
+ "",
317
+ ""
318
+ ]
319
+ ];
320
+ var [buildSarif] = [
321
+ 29,
322
+ () => [
323
+ VulnerabilityReport,
324
+ SarifOptions,
325
+ Json
326
+ ],
327
+ [
328
+ "",
329
+ "",
330
+ "",
331
+ "",
332
+ "",
333
+ ""
334
+ ]
335
+ ];
336
+ //#endregion
337
+ //#region src/index.d.ts
338
+ var [_0] = [
339
+ 0,
340
+ () => [ReportingHandle],
341
+ [
342
+ "",
343
+ "",
344
+ ""
345
+ ],
346
+ sideEffect(_0)
347
+ ];
348
+ var [Config] = [
349
+ 1,
350
+ () => [
351
+ Record,
352
+ DedupeJudge,
353
+ CoverageSource,
354
+ Record
355
+ ],
356
+ [
357
+ "",
358
+ "",
359
+ "",
360
+ "",
361
+ "",
362
+ "",
363
+ "",
364
+ "",
365
+ "",
366
+ "",
367
+ "",
368
+ "",
369
+ "",
370
+ "",
371
+ "",
372
+ "",
373
+ "",
374
+ "",
375
+ "",
376
+ ""
377
+ ]
378
+ ];
379
+ var [name] = [
380
+ 2,
381
+ () => [],
382
+ []
383
+ ];
384
+ var [inject] = [
385
+ 3,
386
+ () => [],
387
+ []
388
+ ];
389
+ var [Config] = [
390
+ 4,
391
+ () => [Config, z],
392
+ ["", ""]
393
+ ];
394
+ var [normalizeCodeLocations] = [
395
+ 5,
396
+ () => [Record],
397
+ [
398
+ "",
399
+ "",
400
+ "",
401
+ ""
402
+ ]
403
+ ];
404
+ var [normalizeCve] = [
405
+ 6,
406
+ () => [],
407
+ [""]
408
+ ];
409
+ var [normalizeCwe] = [
410
+ 7,
411
+ () => [],
412
+ [""]
413
+ ];
414
+ var [buildDependencyMetadata] = [
415
+ 8,
416
+ () => [Record, Record],
417
+ [
418
+ "",
419
+ "",
420
+ "",
421
+ "",
422
+ "",
423
+ "",
424
+ "",
425
+ "",
426
+ "",
427
+ "",
428
+ "",
429
+ "",
430
+ "",
431
+ "",
432
+ "",
433
+ "",
434
+ "",
435
+ ""
436
+ ]
437
+ ];
438
+ var [ReportingHandle] = [
439
+ 9,
440
+ () => [
441
+ ReportState,
442
+ Promise,
443
+ Promise,
444
+ Promise
445
+ ],
446
+ [
447
+ "",
448
+ "",
449
+ "",
450
+ "",
451
+ "",
452
+ "",
453
+ "",
454
+ "",
455
+ "",
456
+ "",
457
+ "",
458
+ "",
459
+ "",
460
+ "",
461
+ "",
462
+ ""
463
+ ]
464
+ ];
465
+ var [CoverageSource] = [
466
+ 10,
467
+ () => [
468
+ Record,
469
+ Array,
470
+ Record
471
+ ],
472
+ [
473
+ "",
474
+ "",
475
+ "",
476
+ "",
477
+ ""
478
+ ]
479
+ ];
480
+ var [apply] = [
481
+ 11,
482
+ () => [
483
+ Context,
484
+ Config,
485
+ ReportingHandle
486
+ ],
487
+ [
488
+ "",
489
+ "",
490
+ "",
491
+ "",
492
+ ""
493
+ ]
494
+ ];
495
+ //#endregion
496
+ export { Config, CoverageSource, ReportState, ReportingHandle, apply, buildCvssVector, buildDependencyMetadata, buildSarif, calculateCvss, checkDuplicate, classKeyword, cleanTitle, cvssBaseScore, cvssSeverity, dependencyIdentity, dependencySeverity, inject, name, normalizeCodeLocations, normalizeCve, normalizeCwe, renderVulnerabilityMd, ruleIdOf, sarifUri, severityRank, validateCvssBreakdown };
497
+
498
+ //# sourceMappingURL=index.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.ts","names":["Schema"],"sources":["../src/state.d.ts","../src/dedupe.d.ts","../src/writers.d.ts","../src/cvss.d.ts","../src/sarif.d.ts","../src/index.d.ts"],"sourcesContent":["/**\n * Report state — port of strix report/state.py: the per-scan report store\n * with sequential `vuln-NNNN` ids, strix's exact field insertion order,\n * title cleaning, update whitelist with dependent-field dropping, update\n * history, and hydration from a previous run dir. Key order matters: the\n * stored dicts are JSON-serialized byte-for-byte into vulnerabilities.json,\n * so fields are inserted in state.py `add_vulnerability_report` order.\n * @module @gpzhang2001/sharpkit-reporting/state\n */\n/** A stored vulnerability/dependency report dict (strix shape). */\nexport interface VulnerabilityReport {\n readonly id: string;\n title: string;\n severity: string;\n readonly timestamp: string;\n [key: string]: unknown;\n}\n/** Injectable clock (tests pass fixed times; default wall clock). */\nexport type Clock = () => Date;\n/** strix display timestamp format (state.py :349). */\nexport declare function formatTimestamp(date: Date): string;\n/** strix ISO instant format (start/end times). */\nexport declare function formatIso(date: Date): string;\n/** Control-char → space + whitespace collapse (state.py `_clean_title`). */\nexport declare function cleanTitle(title: string): string;\n/** strix severity order (tool.py `_SEVERITY_ORDER`). */\nexport declare const SEVERITY_ORDER: readonly [\"critical\", \"high\", \"medium\", \"low\", \"info\", \"none\"];\n/** Severity rank with unknown → last (writer parity). */\nexport declare function severityRank(severity: string): number;\n/** Updatable field whitelist (state.py `UPDATABLE_REPORT_FIELDS`). */\nexport declare const UPDATABLE_REPORT_FIELDS: Set<string>;\n/** Dependent fields dropped when their primary changes without replacement. */\nexport declare const DEPENDENT_REPORT_FIELDS: Readonly<Record<string, string>>;\n/** One update-history entry (state.py :467-487). */\nexport interface UpdateHistoryEntry {\n readonly timestamp: string;\n fields: string[];\n dropped_fields?: string[];\n reason?: string;\n agent_id?: string;\n agent_name?: string;\n previous_severity?: string;\n previous_cvss?: number;\n previous_confidence?: string;\n}\nexport interface AddReportInput {\n readonly title: string;\n readonly severity: string;\n readonly findingClass?: string | undefined;\n readonly dependencyMetadata?: Record<string, unknown> | undefined;\n readonly agentId?: string | undefined;\n readonly agentName?: string | undefined;\n /** All remaining report fields (already validated/normalized by the tool layer). */\n readonly fields: Record<string, unknown>;\n}\n/** The revision outcome: null = no-op (strix parity). */\nexport type UpdateOutcome = {\n readonly report: VulnerabilityReport;\n} | {\n readonly noop: true;\n};\n/**\n * One scan's report store. Not a process singleton — the suite runs one per\n * scan id inside the tool package's closure (strix's module-global maps to a\n * per-scan instance in dsh).\n */\nexport declare class ReportState {\n readonly runId: string;\n runName: string | null;\n readonly startTime: string;\n endTime: string | null;\n status: string;\n finalScanResult: string | null;\n readonly vulnerabilityReports: VulnerabilityReport[];\n /** Ids already rendered to markdown (incremental writer input). */\n readonly savedVulnIds: Set<string>;\n updateHistoryAgent: {\n readonly agentId?: string;\n readonly agentName?: string;\n } | undefined;\n private readonly clock;\n constructor(options?: {\n readonly runId?: string;\n readonly runName?: string | null;\n readonly clock?: Clock;\n });\n /** Allocate the next sequential id (state.py :343 — length-derived). */\n private nextId;\n /**\n * Add one report with strix's exact field construction order.\n * @param input - the validated/normalized create payload.\n */\n addVulnerabilityReport(input: AddReportInput): VulnerabilityReport;\n /**\n * Revise one report in place (state.py `update_vulnerability_report`):\n * whitelist + strip/lowercase, unchanged-skip, dependent-field dropping,\n * history append, and the MD invalidation marker.\n * @param reportId - the `vuln-NNNN` id.\n * @param changes - only the fields the model passed.\n * @param reason - the update_reason (truncated to 500).\n */\n updateVulnerabilityReport(reportId: string, changes: Record<string, unknown>, reason: string): UpdateOutcome;\n /**\n * Reload from a previous run's vulnerabilities.json so id allocation does\n * not collide (state.py `hydrate_from_run_dir`; raises on corrupt JSON).\n * @param reports - the parsed JSON array.\n */\n hydrate(reports: unknown): void;\n /** Mark the run complete (status transition + end time). */\n complete(exitStatus?: string): void;\n}\n","/**\n * Dedupe — port of strix report/dedupe.py decision flow: the deterministic\n * dependency identity fast path (CVE × package × ecosystem, distinct\n * manifests are separate findings, legacy word-bounded mention fallback) and\n * an injectable LLM judge for dynamic findings. Every judge failure defaults\n * to NOT duplicate (strix parity: dedupe failures never block a finding).\n * @module @gpzhang2001/sharpkit-reporting/dedupe\n */\nimport type { VulnerabilityReport } from './state.ts';\n/** Dependency identity fields (strix `_dependency_identity`). */\nexport interface DependencyIdentity {\n readonly cve: string;\n readonly packageName: string;\n readonly ecosystem: string;\n}\n/** The dedupe verdict shape (strix `DuplicateCheckResult`). */\nexport interface DuplicateVerdict {\n readonly isDuplicate: boolean;\n readonly duplicateId: string;\n readonly confidence: number;\n readonly reason: string;\n}\n/** Pluggable LLM judge (Config-injected; dsh-side LLM wiring lands with M4). */\nexport type DedupeJudge = (candidate: Record<string, unknown>, existing: readonly VulnerabilityReport[]) => Promise<DuplicateVerdict>;\n/** Extract the dependency identity from metadata (strix :162-177). */\nexport declare function dependencyIdentity(metadata: unknown): DependencyIdentity | null;\n/** Whether two manifest paths are both present AND different (strix `_distinct_manifest_paths`). */\nexport declare function distinctManifestPaths(a: unknown, b: unknown): boolean;\n/** Word-bounded regex mention check over prose fields (strix `_legacy_report_mentions_package`). */\nexport declare function legacyReportMentionsPackage(report: VulnerabilityReport, identity: DependencyIdentity): boolean;\n/**\n * The deterministic dependency fast path (strix `_check_dependency_duplicate`).\n * @param candidateIdentity - the candidate's identity.\n * @param candidateMetadata - the candidate's dependency metadata (manifest comparison).\n * @param existing - current reports.\n * @returns a verdict, or null to defer to the LLM judge.\n */\nexport declare function checkDependencyDuplicate(candidateIdentity: DependencyIdentity, candidateMetadata: Record<string, unknown> | undefined, existing: readonly VulnerabilityReport[]): DuplicateVerdict | null;\n/**\n * Entry point (strix `check_duplicate`): fast path for dependency\n * candidates, then the injected judge; every judge failure is NOT duplicate.\n * @param candidate - the candidate fields sent for comparison.\n * @param candidateMetadata - dependency metadata when present.\n * @param existing - current reports.\n * @param judge - the injected LLM judge (absent → not duplicate).\n */\nexport declare function checkDuplicate(candidate: Record<string, unknown>, candidateMetadata: Record<string, unknown> | undefined, existing: readonly VulnerabilityReport[], judge: DedupeJudge | undefined): Promise<DuplicateVerdict>;\n","/**\n * Artifact writers — port of strix report/writer.py: atomic writes\n * (temp-in-same-dir + rename, no fsync), run.json, vulnerabilities.csv\n * (formula-injection guard, \\r\\n terminators, uppercase severity,\n * severity-then-timestamp ordering), vulnerabilities.json (byte-identical\n * serialization), the vuln-NNNN.md renderer (exact section order), and the\n * executive report template.\n * @module @gpzhang2001/sharpkit-reporting/writers\n */\nimport { type VulnerabilityReport } from './state.ts';\n/** JSON.stringify with Python `json.dumps(ensure_ascii=False, indent=2)` parity. */\nexport declare function dumpsIndent(value: unknown): string;\n/**\n * Atomic text write (writer.py `atomic_write_text` :201-220): temp file in\n * the target's directory + rename; no fsync (strix parity).\n * @param path - target file path.\n * @param payload - exact bytes to write.\n */\nexport declare function atomicWriteText(path: string, payload: string): Promise<void>;\n/**\n * Formula-injection guard (writer.py `csv_safe` :35-53): prefix `'` when the\n * rendered cell starts with `= + - @ \\t \\r`.\n * @param value - the cell value.\n */\nexport declare function csvSafe(value: string): string;\n/**\n * Render vulnerabilities.csv: header + rows sorted by (severity rank,\n * timestamp), uppercase severity, \\r\\n terminators.\n * @param reports - the stored reports.\n */\nexport declare function renderVulnerabilitiesCsv(reports: readonly VulnerabilityReport[]): string;\n/** Update history section (writer.py `render_update_history` :364-396). */\nexport declare function renderUpdateHistory(report: Record<string, unknown>): string[];\n/**\n * Render one vulnerability markdown document (writer.py\n * `render_vulnerability_md` :223-361 section order).\n * @param report - the stored report dict.\n */\nexport declare function renderVulnerabilityMd(report: VulnerabilityReport): string;\n/**\n * Write the per-run artifacts handled outside SARIF (writer.py parity):\n * vulnerabilities/*.md (incremental), vulnerabilities.csv,\n * vulnerabilities.json.\n * @param runDir - the run directory.\n * @param reports - all stored reports.\n * @param savedIds - ids whose MD is already on disk (updated ids must be re-rendered by the caller removing them).\n */\nexport declare function writeVulnerabilities(runDir: string, reports: readonly VulnerabilityReport[], savedIds: ReadonlySet<string>): Promise<void>;\n/**\n * Write the assembled coverage document (coverage.py `write_coverage`).\n * @param runDir - the run directory.\n * @param document - the assembled coverage document.\n */\nexport declare function writeCoverage(runDir: string, document: Record<string, unknown>): Promise<void>;\n/**\n * Write run.json last (state.py ordering).\n * @param runDir - the run directory.\n * @param runRecord - the run record dict.\n */\nexport declare function writeRunRecord(runDir: string, runRecord: Record<string, unknown>): Promise<void>;\n/**\n * Write the executive report (plain truncate-write, writer.py :139-145).\n * @param runDir - the run directory.\n * @param finalScanResult - the composed final report body.\n * @param generatedAt - display timestamp.\n */\nexport declare function writeExecutiveReport(runDir: string, finalScanResult: string, generatedAt: string): Promise<void>;\n/** Severity list used by callers that need the canonical order. */\nexport declare const severityOrder: readonly [\"critical\", \"high\", \"medium\", \"low\", \"info\", \"none\"];\n","/**\n * CVSS v3.1 base-score math, ported from strix's usage of the `cvss`\n * package (tool.py `_calculate_cvss` :134-153): build the vector string,\n * compute the base score and qualitative severity. The score uses the\n * CVSS 3.1 spec formula with the spec's Roundup1 (ceil to one decimal with\n * the IEEE-754 guard), and a \"none\" base severity is remapped to \"info\"\n * (strix parity).\n * @module @gpzhang2001/sharpkit-reporting/cvss\n */\n/** The eight CVSS metrics with their allowed values (strix `_CVSS_VALID`). */\nexport declare const CVSS_VALID: {\n readonly attack_vector: readonly [\"N\", \"A\", \"L\", \"P\"];\n readonly attack_complexity: readonly [\"L\", \"H\"];\n readonly privileges_required: readonly [\"N\", \"L\", \"H\"];\n readonly user_interaction: readonly [\"N\", \"R\"];\n readonly scope: readonly [\"U\", \"C\"];\n readonly confidentiality: readonly [\"N\", \"L\", \"H\"];\n readonly integrity: readonly [\"N\", \"L\", \"H\"];\n readonly availability: readonly [\"N\", \"L\", \"H\"];\n};\nexport type CvssMetricName = keyof typeof CVSS_VALID;\n/**\n * Validate a breakdown against the allowed metric/value sets.\n * @param breakdown - the model-supplied 8-metric dict.\n * @returns validation errors, empty when valid.\n */\nexport declare function validateCvssBreakdown(breakdown: Record<string, unknown>): string[];\n/**\n * Build the vector string (strix format: CVSS:3.1/AV:../AC:../PR:../UI:../S:../C:../I:../A:..).\n * @param breakdown - a validated breakdown.\n */\nexport declare function buildCvssVector(breakdown: Readonly<Record<CvssMetricName, string>>): string;\n/**\n * Compute the CVSS v3.1 base score for a breakdown (the `cvss` package's\n * `compute_base_score`: Scope U ISC = 6.42×ISCBase; Scope C ISC = the 7.52\n * formula; Scope C multiplies the total by 1.08 before the cap).\n * @param breakdown - a validated breakdown.\n * @returns the rounded base score (0.0 when impact is non-positive).\n */\nexport declare function cvssBaseScore(breakdown: Readonly<Record<CvssMetricName, string>>): number;\n/**\n * Qualitative severity banding (the `cvss` package's rating bands).\n * @param score - the base score.\n */\nexport declare function cvssSeverity(score: number): 'none' | 'low' | 'medium' | 'high' | 'critical';\n/**\n * Full computation: vector + score + severity with the \"none\"→\"info\" remap\n * (strix `_calculate_cvss` return contract).\n * @param breakdown - a validated breakdown.\n */\nexport declare function calculateCvss(breakdown: Readonly<Record<CvssMetricName, string>>): {\n readonly vector: string;\n readonly score: number;\n readonly severity: string;\n};\n/**\n * Dependency severity banding from an advisory score (strix\n * `_DEP_SEVERITY_FROM_CVSS` :1363-1378, top band inclusive at 10.0).\n * @param score - the advisory base score.\n */\nexport declare function dependencySeverity(score: number): string;\n","/**\n * SARIF 2.1.0 writer — port of strix report/sarif.py: rule ids normalized\n * CWE→CVE→id→slug, GitHub security-severity, STRIDE tags from the CWE map,\n * physical + synthetic (SECURITY.md anchor) locations with endpoint logical\n * locations, PR-suggestion fixes, deterministic partial fingerprints\n * (sha256), and the strix-namespaced properties (PoC script body never\n * exported). Key insertion order matches Python dict construction\n * byte-for-byte (golden-diff locked).\n * @module @gpzhang2001/sharpkit-reporting/sarif\n */\nimport type { VulnerabilityReport } from './state.ts';\nexport declare const SARIF_SCHEMA = \"https://json.schemastore.org/sarif-2.1.0.json\";\nexport declare const SARIF_VERSION = \"2.1.0\";\nexport declare const TOOL_NAME = \"sharpkit\";\nexport declare const TOOL_INFORMATION_URI = \"https://github.com/gpzhang2001/sharpkit\";\ntype Json = string | number | boolean | null | Json[] | {\n [key: string]: Json;\n};\n/** Stable rule id: CWE → CVE → finding id → slug → sharpkit-finding. */\nexport declare function ruleIdOf(report: VulnerabilityReport): string;\n/** Lowercase slug joined by dashes (sarif.py `_slugify`). */\nexport declare function slugify(value: string): string;\n/** STRIDE legs for a CWE, default legs when unmapped (every finding gets ≥1). */\nexport declare function strideLegsForCwe(cwe: unknown): readonly string[];\n/** First curated keyword in the title, else the first 5 alphanumeric words. */\nexport declare function classKeyword(title: string): string;\n/** SARIF level mapping. */\nexport declare function sarifLevel(severity: unknown): string;\n/** GitHub security-severity: \"%.1f\" CVSS else the label score. */\nexport declare function securitySeverity(report: VulnerabilityReport): string;\n/** Reject unsafe SARIF artifact URIs; normalize backslashes (sarif.py `_sarif_uri`). */\nexport declare function sarifUri(file: string): string | null;\n/** Deterministic per-finding fingerprint (sarif.py `_primary_fingerprint`). */\ndeclare function primaryFingerprint(ruleId: string, report: VulnerabilityReport, locations: readonly Json[], isSynthetic: boolean): string | null;\n/** File-independent class fingerprint (sarif.py `_class_fingerprint`). */\ndeclare function classFingerprint(ruleId: string, report: VulnerabilityReport): string | null;\n/** One coverage entry projected into SARIF (strix coverage.py shape). */\nexport interface SarifCoverageEntry {\n readonly risk_area: string;\n readonly surface: string;\n readonly outcome: string;\n readonly evidence?: unknown;\n readonly recorded_by?: unknown;\n}\n/** The coverage document subset the SARIF bridge consumes. */\nexport interface SarifCoverage {\n readonly entries: readonly SarifCoverageEntry[];\n readonly completeness?: {\n readonly complete?: boolean;\n readonly caveats?: readonly string[];\n } | undefined;\n}\nexport interface SarifOptions {\n readonly toolVersion: string;\n readonly coverage?: SarifCoverage | undefined;\n /** Exactly-one-repository provenance (strix passes None in our port for now). */\n readonly repositoryContext?: {\n readonly repositoryUri?: string;\n readonly repositoryFullName?: string;\n readonly commitSha?: string;\n readonly branch?: string;\n readonly ref?: string;\n } | undefined;\n}\n/**\n * Build the full SARIF document (top-level key order and run properties).\n * Coverage results and invocations join when the coverage tool lands (批 4).\n * @param reports - all stored reports.\n * @param options - tool version and optional repository provenance.\n */\nexport declare function buildSarif(reports: readonly VulnerabilityReport[], options: SarifOptions): {\n [key: string]: Json;\n};\n/**\n * Write findings.sarif (temp sibling + rename, trailing newline; sarif.py\n * `write_sarif_report`). Always emitted, even with zero findings, so a fresh\n * empty doc overwrites stale results.\n * @param runDir - the run directory.\n * @param reports - all stored reports.\n * @param options - tool version and provenance.\n */\nexport declare function writeSarif(runDir: string, reports: readonly VulnerabilityReport[], options: SarifOptions): Promise<void>;\n/** Reproduce a fingerprint for tests (exposed for golden diagnostics). */\nexport declare const internals: {\n primaryFingerprint: typeof primaryFingerprint;\n classFingerprint: typeof classFingerprint;\n};\nexport {};\n","/**\n * Vulnerability / dependency reporting tools — port of strix\n * tools/reporting/tool.py: create_vulnerability_report,\n * create_dependency_report, update_vulnerability_report, list_reports,\n * get_report. Validation parity (runtime-validated value sets, CVSS\n * computation, cross-class update guards), strix's exact response JSON\n * shapes, and the artifacts fan-out on every mutation (md/csv/json/sarif +\n * run.json last, atomic writes; SARIF always emitted even when empty).\n * The dedupe LLM judge is a Config callback (deterministic dependency fast\n * path runs regardless; judge failures default to not-duplicate).\n * @module @gpzhang2001/sharpkit-reporting\n */\nimport type { Context } from '@deepseek-ai/cordis';\nimport type Schema from '@deepseek-ai/schemastery';\nimport { type DedupeJudge } from './dedupe.ts';\nimport { ReportState } from './state.ts';\nimport { renderVulnerabilityMd } from './writers.ts';\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n pentestReporting: ReportingHandle;\n }\n}\nexport { renderVulnerabilityMd };\nexport { ReportState, cleanTitle, severityRank } from './state.ts';\nexport { calculateCvss, cvssBaseScore, cvssSeverity, validateCvssBreakdown, dependencySeverity, buildCvssVector } from './cvss.ts';\nexport { checkDuplicate, dependencyIdentity } from './dedupe.ts';\nexport { buildSarif, sarifUri, ruleIdOf, classKeyword } from './sarif.ts';\n/** Deployment-tunable configuration. */\nexport interface Config {\n /** Run-name slug basis (strix derives it from the target label). */\n readonly runName?: string;\n /** Runs root directory (sharpkit_runs; configurable back to strix_runs for legacy compat). */\n readonly runsRoot?: string;\n /** Sandbox image version stamped into SARIF (tool.driver.version). */\n readonly toolVersion?: string;\n /** Scan mode recorded into run.json. */\n readonly scanMode?: string;\n /** Targets recorded into run.json. */\n readonly targetsInfo?: readonly Record<string, unknown>[];\n /** Pluggable dedupe LLM judge (dynamic findings; failures = not duplicate). */\n readonly dedupeJudge?: DedupeJudge;\n /** File the CVSS-broad-CWE ban borrows from strix's guidance. */\n readonly strictCwe?: boolean;\n /** Coverage document source (the analysis package wires itself in). */\n readonly coverageSource?: CoverageSource;\n /** Auth mode recorded into run.json (strix codex.auth_mode; default \"none\"). */\n readonly authMode?: string;\n /** Scan instruction recorded into run.json (strix set_scan_config). */\n readonly instruction?: string;\n /** Diff scope recorded into run.json (diff-scope scans). */\n readonly diffScope?: string;\n /** Non-interactive flag recorded into run.json. */\n readonly nonInteractive?: boolean;\n /** Local source trees recorded into run.json. */\n readonly localSources?: readonly Record<string, unknown>[];\n /** Scope mode recorded into run.json (strix default \"auto\"). */\n readonly scopeMode?: string;\n /** Diff base ref recorded into run.json (diff-scope scans). */\n readonly diffBase?: string;\n /** MCP connection names recorded into run.json (strix record_mcp_connections). */\n readonly mcpConnections?: readonly string[];\n}\nexport declare const name = \"pentest-tool-reporting\";\nexport declare const inject: string[];\nexport declare const Config: Schema<Config>;\n/** Normalize + validate code_locations (tool.py `_normalize_code_locations`). */\nexport declare function normalizeCodeLocations(raw: unknown): {\n readonly locations?: Record<string, unknown>[];\n readonly errors: string[];\n};\n/** CVE normalization (tool.py `_extract_cve` + `_validate_cve`). */\nexport declare function normalizeCve(value: string | undefined): string | undefined;\n/** CWE normalization (tool.py `_extract_cwe`). */\nexport declare function normalizeCwe(value: string | undefined): string | undefined;\n/** Dependency metadata builder (tool.py `_build_dependency_metadata` order). */\nexport declare function buildDependencyMetadata(fields: {\n readonly packageName: string;\n readonly installedVersion: string;\n readonly advisoryCvss?: number | undefined;\n readonly packageEcosystem: string;\n readonly manifestPath: string;\n readonly fixedVersion?: string | undefined;\n readonly introducedBy?: string | undefined;\n readonly dependencyPath?: string | undefined;\n readonly reachability: string;\n readonly reachabilityEvidence?: string | undefined;\n readonly contextual?: {\n readonly breakdown: Record<string, string>;\n readonly score: number;\n readonly vector: string;\n readonly reasoning: string;\n } | undefined;\n}): Record<string, unknown>;\nexport interface ReportingHandle {\n readonly state: ReportState;\n readonly runDir: string;\n finishScan(sections: {\n readonly executiveSummary: string;\n readonly methodology: string;\n readonly technicalAnalysis: string;\n readonly recommendations: string;\n }, status?: string): Promise<void>;\n writeNow(): Promise<void>;\n readRaw(relative: string): Promise<string>;\n}\n/** Coverage document provider the analysis package supplies at wiring time. */\nexport interface CoverageSource {\n entries(): Array<Record<string, unknown>>;\n outcomeCounts(): Record<string, number>;\n}\nexport declare function apply(ctx: Context, config?: Config): ReportingHandle;\n"],"mappings":";;;AAAA,IAAW,CAAC,uBAAuB;CAAC;OAAU,CAAC;CAAG;EAAC;EAAI;EAAI;EAAI;EAAI;CAAE;AAAC;AACtE,IAAW,CAAC,SAAS;CAAC;OAAU,CAAC,IAAI;CAAG,CAAC,EAAE;AAAC;AAG5C,IAAW,CAAC,cAAc;CAAC;OAAU,CAAC;CAAG,CAAC,EAAE;AAAC;AAE7C,IAAW,CAAC,gBAAgB;CAAC;OAAU,CAAC;CAAG,CAAC,EAAE;AAAC;AAI/C,IAAW,CAAC,kBAAkB;CAAC;OAAU,CAAC,QAAQ,MAAM;CAAG;EAAC;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;CAAE;AAAC;AAC/F,IAAW,CAAC,iBAAiB;CAAC;OAAU,CAAC,mBAAmB;CAAG;EAAC;EAAI;EAAI;CAAE;AAAC;AAC3E,IAAW,CAAC,eAAe;CAAC;OAAU;EAAC;EAAqB;EAAK;EAAO;EAAgB;EAAqB;EAAQ;CAAa;CAAG;EAAC;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;CAAE;AAAC;;;ACXjR,IAAW,CAAC,sBAAsB;CAAC;OAAU,CAAC;CAAG;EAAC;EAAI;EAAI;CAAE;AAAC;AAC7D,IAAW,CAAC,oBAAoB;CAAC;OAAU,CAAC;CAAG;EAAC;EAAI;EAAI;EAAI;CAAE;AAAC;AAC/D,IAAW,CAAC,eAAe;CAAC;OAAU;EAAC;EAAQ;EAAqB;EAAkB;CAAO;CAAG;EAAC;EAAI;EAAI;EAAI;EAAI;EAAI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