@opensip-cli/output 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +31 -0
- package/dist/format/baseline-diff.d.ts +37 -0
- package/dist/format/baseline-diff.d.ts.map +1 -0
- package/dist/format/baseline-diff.js +96 -0
- package/dist/format/baseline-diff.js.map +1 -0
- package/dist/format/signal-json.d.ts +17 -0
- package/dist/format/signal-json.d.ts.map +1 -0
- package/dist/format/signal-json.js +3 -0
- package/dist/format/signal-json.js.map +1 -0
- package/dist/format/signal-sarif.d.ts +50 -0
- package/dist/format/signal-sarif.d.ts.map +1 -0
- package/dist/format/signal-sarif.js +107 -0
- package/dist/format/signal-sarif.js.map +1 -0
- package/dist/format/signal-table.d.ts +44 -0
- package/dist/format/signal-table.d.ts.map +1 -0
- package/dist/format/signal-table.js +84 -0
- package/dist/format/signal-table.js.map +1 -0
- package/dist/format/types.d.ts +20 -0
- package/dist/format/types.d.ts.map +1 -0
- package/dist/format/types.js +2 -0
- package/dist/format/types.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/sink/cloud-signal-sink.d.ts +10 -0
- package/dist/sink/cloud-signal-sink.d.ts.map +1 -0
- package/dist/sink/cloud-signal-sink.js +94 -0
- package/dist/sink/cloud-signal-sink.js.map +1 -0
- package/dist/sink/entitlement.d.ts +28 -0
- package/dist/sink/entitlement.d.ts.map +1 -0
- package/dist/sink/entitlement.js +109 -0
- package/dist/sink/entitlement.js.map +1 -0
- package/dist/sink/http-egress.d.ts +49 -0
- package/dist/sink/http-egress.d.ts.map +1 -0
- package/dist/sink/http-egress.js +158 -0
- package/dist/sink/http-egress.js.map +1 -0
- package/dist/sink/repo-identity.d.ts +4 -0
- package/dist/sink/repo-identity.d.ts.map +1 -0
- package/dist/sink/repo-identity.js +32 -0
- package/dist/sink/repo-identity.js.map +1 -0
- package/dist/sink/resolve-signal-sink.d.ts +17 -0
- package/dist/sink/resolve-signal-sink.d.ts.map +1 -0
- package/dist/sink/resolve-signal-sink.js +87 -0
- package/dist/sink/resolve-signal-sink.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
OpenSIP CLI
|
|
2
|
+
Copyright 2026 opensip-ai
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
5
|
+
this software except in compliance with the License. A copy of the License is
|
|
6
|
+
included in the LICENSE file and is also available at:
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!-- Generated by scripts/build-package-readmes.mjs — do not edit by hand.
|
|
2
|
+
Change the package's "description" (or the generator template) and run
|
|
3
|
+
`pnpm docs:readmes`. CI enforces sync via `pnpm docs:readmes:check`. -->
|
|
4
|
+
|
|
5
|
+
# @opensip-cli/output
|
|
6
|
+
|
|
7
|
+
> Output layer for OpenSIP CLI — pure signal-envelope formatters (json/sarif/table) and effectful sinks (file/cloud)
|
|
8
|
+
|
|
9
|
+
This is an **internal library** of the opensip-cli toolkit. It is published so the CLI and tools can depend on it; most users will not install it directly.
|
|
10
|
+
|
|
11
|
+
Part of [**opensip-cli**](https://github.com/opensip-ai/opensip-cli) — an open-source codebase-analysis toolkit: fitness checks (`fit`), static call-graph analysis (`graph`), and simulation (`sim`).
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
Most users install the CLI, which bundles the first-party tools:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
curl -fsSL https://opensip.ai/cli/install.sh | bash
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This package is published for the CLI and advanced plugin authors; most users should not install `@opensip-cli/output` directly.
|
|
22
|
+
|
|
23
|
+
## Documentation
|
|
24
|
+
|
|
25
|
+
- 📚 Project docs: https://opensip.ai/docs/opensip-cli/
|
|
26
|
+
- 🧭 Package catalog (what every package does): https://github.com/opensip-ai/opensip-cli/blob/v0.1.0/docs/public/70-reference/02-package-catalog.md
|
|
27
|
+
- 📦 Source: https://github.com/opensip-ai/opensip-cli/tree/v0.1.0/packages/output
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
Apache-2.0 © opensip-ai
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Pure baseline diff — the generic net-new ratchet (ADR-0036).
|
|
3
|
+
*
|
|
4
|
+
* One symmetric three-bucket diff (`added` / `resolved` / `unchanged`) over full
|
|
5
|
+
* `Signal` objects, replacing fitness's `GateViolation` buckets and graph's
|
|
6
|
+
* asymmetric `newSignals` + bare-string `resolvedFingerprints`. Keyed on the
|
|
7
|
+
* signal's **already-stamped** `fingerprint` (the tool stamps at
|
|
8
|
+
* envelope-construction time via `stampFingerprints`); the diff — and the plane —
|
|
9
|
+
* NEVER re-fingerprints. Pure: no IO, `core`-only import (layer-legal in
|
|
10
|
+
* `output`).
|
|
11
|
+
*/
|
|
12
|
+
import type { Signal } from '@opensip-cli/core';
|
|
13
|
+
/** One loaded baseline row: an opaque fingerprint + its stored full payload. */
|
|
14
|
+
export interface BaselineDiffRow {
|
|
15
|
+
readonly fingerprint: string;
|
|
16
|
+
readonly payload: Signal | null;
|
|
17
|
+
}
|
|
18
|
+
/** Result of comparing current findings to a saved baseline (ADR-0036). */
|
|
19
|
+
export interface GateCompareResult {
|
|
20
|
+
/** Findings present now but not in the baseline (current ∖ baseline). */
|
|
21
|
+
readonly added: readonly Signal[];
|
|
22
|
+
/** Findings present in the baseline but not now (baseline ∖ current). */
|
|
23
|
+
readonly resolved: readonly Signal[];
|
|
24
|
+
/** Findings present in both (current ∩ baseline). */
|
|
25
|
+
readonly unchanged: readonly Signal[];
|
|
26
|
+
/** True iff `added` is non-empty — the gate decision. */
|
|
27
|
+
readonly degraded: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Diff current findings against a loaded baseline. Current signals are keyed by
|
|
31
|
+
* their already-stamped `fingerprint`; the diff asserts each is present (the
|
|
32
|
+
* plane never fingerprints) and throws if a tool handed unstamped signals.
|
|
33
|
+
*
|
|
34
|
+
* @throws {Error} when a current signal has no `fingerprint`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function diffBaseline(current: readonly Signal[], baseline: readonly BaselineDiffRow[]): GateCompareResult;
|
|
37
|
+
//# sourceMappingURL=baseline-diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseline-diff.d.ts","sourceRoot":"","sources":["../../src/format/baseline-diff.ts"],"names":[],"mappings":"AACA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,gFAAgF;AAChF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,2EAA2E;AAC3E,MAAM,WAAW,iBAAiB;IAChC,yEAAyE;IACzE,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,qDAAqD;IACrD,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAwDD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,QAAQ,EAAE,SAAS,eAAe,EAAE,GACnC,iBAAiB,CAiCnB"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// @fitness-ignore-file batch-operation-limits -- the for-of loops iterate the run's bounded finding set (a Map keyed by fingerprint); pure synchronous Map iteration, no async/IO per item.
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Pure baseline diff — the generic net-new ratchet (ADR-0036).
|
|
4
|
+
*
|
|
5
|
+
* One symmetric three-bucket diff (`added` / `resolved` / `unchanged`) over full
|
|
6
|
+
* `Signal` objects, replacing fitness's `GateViolation` buckets and graph's
|
|
7
|
+
* asymmetric `newSignals` + bare-string `resolvedFingerprints`. Keyed on the
|
|
8
|
+
* signal's **already-stamped** `fingerprint` (the tool stamps at
|
|
9
|
+
* envelope-construction time via `stampFingerprints`); the diff — and the plane —
|
|
10
|
+
* NEVER re-fingerprints. Pure: no IO, `core`-only import (layer-legal in
|
|
11
|
+
* `output`).
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Reconstruct a `resolved`-bucket Signal from a baseline row whose payload is
|
|
15
|
+
* absent (defensive — legacy/null rows; new rows always carry payload). Carries
|
|
16
|
+
* the fingerprint so consumers can still identify the resolved finding.
|
|
17
|
+
*
|
|
18
|
+
* The synthetic is given a unique id (incorporating the fingerprint) and makes
|
|
19
|
+
* a best-effort attempt to parse the common default fingerprint strategy form
|
|
20
|
+
* (`ruleId|filePath|line|col`) so that resolved-bucket consumers see usable
|
|
21
|
+
* identity fields instead of a single colliding placeholder.
|
|
22
|
+
*/
|
|
23
|
+
function syntheticSignal(fingerprint) {
|
|
24
|
+
const parsed = parseDefaultFingerprint(fingerprint);
|
|
25
|
+
return {
|
|
26
|
+
id: `resolved:${fingerprint}`,
|
|
27
|
+
source: 'baseline',
|
|
28
|
+
provider: 'opensip-cli',
|
|
29
|
+
severity: 'low',
|
|
30
|
+
category: 'quality',
|
|
31
|
+
ruleId: parsed.ruleId ?? 'resolved',
|
|
32
|
+
message: '(resolved finding; baseline payload unavailable)',
|
|
33
|
+
filePath: parsed.filePath ?? '',
|
|
34
|
+
code: parsed.line !== undefined || parsed.column !== undefined
|
|
35
|
+
? { file: parsed.filePath ?? '', line: parsed.line, column: parsed.column }
|
|
36
|
+
: undefined,
|
|
37
|
+
metadata: { originalFingerprint: fingerprint },
|
|
38
|
+
fingerprint,
|
|
39
|
+
createdAt: new Date(0).toISOString(),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** Best-effort parse of the host default fingerprintStrategy form. */
|
|
43
|
+
function parseDefaultFingerprint(fp) {
|
|
44
|
+
// Common form used by defaultFingerprintStrategy and several tools: ruleId|filePath|line|col
|
|
45
|
+
const parts = fp.split('|');
|
|
46
|
+
if (parts.length >= 2) {
|
|
47
|
+
const [ruleId, filePath, lineStr, colStr] = parts;
|
|
48
|
+
const line = lineStr ? Number(lineStr) : undefined;
|
|
49
|
+
const column = colStr ? Number(colStr) : undefined;
|
|
50
|
+
return {
|
|
51
|
+
ruleId: ruleId || undefined,
|
|
52
|
+
filePath: filePath || undefined,
|
|
53
|
+
line: Number.isFinite(line) ? line : undefined,
|
|
54
|
+
column: Number.isFinite(column) ? column : undefined,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Diff current findings against a loaded baseline. Current signals are keyed by
|
|
61
|
+
* their already-stamped `fingerprint`; the diff asserts each is present (the
|
|
62
|
+
* plane never fingerprints) and throws if a tool handed unstamped signals.
|
|
63
|
+
*
|
|
64
|
+
* @throws {Error} when a current signal has no `fingerprint`.
|
|
65
|
+
*/
|
|
66
|
+
export function diffBaseline(current, baseline) {
|
|
67
|
+
const currentByFp = new Map();
|
|
68
|
+
for (const signal of current) {
|
|
69
|
+
if (!signal.fingerprint) {
|
|
70
|
+
throw new Error(`diffBaseline: signal ${signal.ruleId} has no fingerprint — the tool must stamp signals ` +
|
|
71
|
+
`(stampFingerprints) at envelope-construction time before the gate seam; the plane never fingerprints.`);
|
|
72
|
+
}
|
|
73
|
+
currentByFp.set(signal.fingerprint, signal);
|
|
74
|
+
}
|
|
75
|
+
const baselineByFp = new Map();
|
|
76
|
+
for (const row of baseline)
|
|
77
|
+
baselineByFp.set(row.fingerprint, row);
|
|
78
|
+
const added = [];
|
|
79
|
+
const unchanged = [];
|
|
80
|
+
for (const [fp, signal] of currentByFp) {
|
|
81
|
+
if (baselineByFp.has(fp)) {
|
|
82
|
+
unchanged.push(signal);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
added.push(signal);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const resolved = [];
|
|
89
|
+
for (const [fp, row] of baselineByFp) {
|
|
90
|
+
if (!currentByFp.has(fp)) {
|
|
91
|
+
resolved.push(row.payload ?? syntheticSignal(fp));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return { added, resolved, unchanged, degraded: added.length > 0 };
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=baseline-diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseline-diff.js","sourceRoot":"","sources":["../../src/format/baseline-diff.ts"],"names":[],"mappings":"AAAA,4LAA4L;AAC5L;;;;;;;;;;GAUG;AAsBH;;;;;;;;;GASG;AACH,SAAS,eAAe,CAAC,WAAmB;IAC1C,MAAM,MAAM,GAAG,uBAAuB,CAAC,WAAW,CAAC,CAAC;IACpD,OAAO;QACL,EAAE,EAAE,YAAY,WAAW,EAAE;QAC7B,MAAM,EAAE,UAAU;QAClB,QAAQ,EAAE,aAAa;QACvB,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G,CAAC,EAAE,CAAC,EAAE,CAAC;YACzB,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview signal-json formatter (ADR-0011, Phase 2 Task 2.3).
|
|
3
|
+
*
|
|
4
|
+
* The envelope IS the JSON output contract — there is no transform. This
|
|
5
|
+
* single pure formatter replaces the three divergent `CliOutput`-emitting
|
|
6
|
+
* `--json` paths (fitness `buildCliOutput`, graph `json.ts`, sim's bespoke
|
|
7
|
+
* `SimDoneResult`). This formatter emits the envelope itself; on the CLI wire
|
|
8
|
+
* it rides under `.envelope` of a `CommandOutcome` (ADR-0024), so a `--json`
|
|
9
|
+
* consumer reads `jq '.envelope.verdict.passed'` / `.envelope.verdict.score`.
|
|
10
|
+
* The wire severity is the 4-level `SignalSeverity`.
|
|
11
|
+
*
|
|
12
|
+
* Pure: no IO, no clock, no id generation — stringification only.
|
|
13
|
+
*/
|
|
14
|
+
import type { Formatter } from './types.js';
|
|
15
|
+
/** Serialise the signal envelope as pretty-printed JSON (the wire contract). */
|
|
16
|
+
export declare const formatSignalJson: Formatter;
|
|
17
|
+
//# sourceMappingURL=signal-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-json.d.ts","sourceRoot":"","sources":["../../src/format/signal-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,gFAAgF;AAChF,eAAO,MAAM,gBAAgB,EAAE,SAA2D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-json.js","sourceRoot":"","sources":["../../src/format/signal-json.ts"],"names":[],"mappings":"AAeA,gFAAgF;AAChF,MAAM,CAAC,MAAM,gBAAgB,GAAc,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview signal-sarif formatter — the canonical signal → SARIF v2.1.0
|
|
3
|
+
* emitter (ADR-0011, Phase 2 Task 2.4).
|
|
4
|
+
*
|
|
5
|
+
* Promoted (moved, not copied) from graph's `renderSarifOpenSip`
|
|
6
|
+
* (`graph/engine/src/render/sarif-opensip.ts`), which already walked
|
|
7
|
+
* `Signal[]` directly — the better SARIF builder. The older `CliOutput`-
|
|
8
|
+
* based SARIF path is retired; this is the one SARIF formatter
|
|
9
|
+
* post-migration.
|
|
10
|
+
*
|
|
11
|
+
* Two surfaces:
|
|
12
|
+
*
|
|
13
|
+
* - {@link buildOpenSipSarif} — the moved core builder, `Signal[]` + driver
|
|
14
|
+
* identity → SARIF string. It emits each signal's `ruleId` **as-is**; the
|
|
15
|
+
* graph-specific `engine-slug → OpenSIP-rule-ID` mapping stays in graph
|
|
16
|
+
* (tool vocabulary does not belong in this tool-agnostic layer) and is
|
|
17
|
+
* applied while graph builds its {@link SignalEnvelope}.
|
|
18
|
+
* - {@link formatSignalSarif} — the canonical {@link Formatter}: reads
|
|
19
|
+
* `signals`/`tool` off the envelope and derives the driver name
|
|
20
|
+
* (`opensip-cli-<tool>`). Pure: no IO, no clock, no id generation.
|
|
21
|
+
*
|
|
22
|
+
* Per the prior graph emitter's Phase 0 audit Q1, every finding emits a
|
|
23
|
+
* SINGLE canonical physical location; `relatedLocations` is not populated.
|
|
24
|
+
*/
|
|
25
|
+
import type { Formatter } from './types.js';
|
|
26
|
+
import type { Signal } from '@opensip-cli/core';
|
|
27
|
+
/** Driver identity for the emitted SARIF run. */
|
|
28
|
+
export interface SarifDriver {
|
|
29
|
+
/** Tool driver name, e.g. `'opensip-cli-graph'`. */
|
|
30
|
+
readonly name: string;
|
|
31
|
+
/** Tool driver version — typically the engine package version. */
|
|
32
|
+
readonly version: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Build a SARIF v2.1.0 log from `Signal[]` and a driver identity.
|
|
36
|
+
*
|
|
37
|
+
* Each result's `ruleId` is the signal's `ruleId` **verbatim** — any
|
|
38
|
+
* tool-specific rule-ID convention is the caller's responsibility (applied
|
|
39
|
+
* before calling). Every result has exactly one `physicalLocation` (the
|
|
40
|
+
* primary site); transitive context carried in `Signal.metadata` is
|
|
41
|
+
* intentionally dropped at the SARIF boundary.
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildOpenSipSarif(signals: readonly Signal[], driver: SarifDriver): string;
|
|
44
|
+
/**
|
|
45
|
+
* The canonical signal → SARIF formatter. Reads `signals`/`tool` off the
|
|
46
|
+
* envelope; the driver name is `opensip-cli-<tool>`. Pure `(envelope) =>
|
|
47
|
+
* string`.
|
|
48
|
+
*/
|
|
49
|
+
export declare const formatSignalSarif: Formatter;
|
|
50
|
+
//# sourceMappingURL=signal-sarif.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-sarif.d.ts","sourceRoot":"","sources":["../../src/format/signal-sarif.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,mBAAmB,CAAC;AA+EhE,iDAAiD;AACjD,MAAM,WAAW,WAAW;IAC1B,oDAAoD;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAUD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,WAAW,GAAG,MAAM,CAuDzF;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAI5B,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map `Signal.severity` → SARIF `level`. Exhaustive over
|
|
3
|
+
* `SignalSeverity` (`'critical' | 'high' | 'medium' | 'low'`).
|
|
4
|
+
* `critical` and `high` both surface as `error` to match GitHub Code
|
|
5
|
+
* Scanning's PR-blocking threshold.
|
|
6
|
+
*/
|
|
7
|
+
function mapSeverityToSarifLevel(severity) {
|
|
8
|
+
switch (severity) {
|
|
9
|
+
case 'critical': {
|
|
10
|
+
return 'error';
|
|
11
|
+
}
|
|
12
|
+
case 'high': {
|
|
13
|
+
return 'error';
|
|
14
|
+
}
|
|
15
|
+
case 'medium': {
|
|
16
|
+
return 'warning';
|
|
17
|
+
}
|
|
18
|
+
case 'low': {
|
|
19
|
+
return 'note';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Coerce a 1-based SARIF region coordinate (startLine / startColumn) to a valid
|
|
25
|
+
* value, returning undefined for anything < 1 or non-finite. SARIF 2.1.0
|
|
26
|
+
* rejects region coordinates below 1; checks that report 0 (meaning "no
|
|
27
|
+
* specific line/column") must be omitted rather than emitted as 0.
|
|
28
|
+
*/
|
|
29
|
+
function atLeastOne(value) {
|
|
30
|
+
return typeof value === 'number' && Number.isFinite(value) && value >= 1 ? value : undefined;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Output-format driver version used when a caller has no real package version
|
|
34
|
+
* to thread (the envelope carries no version field). Tools that want their
|
|
35
|
+
* real engine version in the SARIF provenance pass it via {@link SarifDriver}
|
|
36
|
+
* on {@link buildOpenSipSarif} directly.
|
|
37
|
+
*/
|
|
38
|
+
const DEFAULT_DRIVER_VERSION = '1.0.0';
|
|
39
|
+
/**
|
|
40
|
+
* Build a SARIF v2.1.0 log from `Signal[]` and a driver identity.
|
|
41
|
+
*
|
|
42
|
+
* Each result's `ruleId` is the signal's `ruleId` **verbatim** — any
|
|
43
|
+
* tool-specific rule-ID convention is the caller's responsibility (applied
|
|
44
|
+
* before calling). Every result has exactly one `physicalLocation` (the
|
|
45
|
+
* primary site); transitive context carried in `Signal.metadata` is
|
|
46
|
+
* intentionally dropped at the SARIF boundary.
|
|
47
|
+
*/
|
|
48
|
+
export function buildOpenSipSarif(signals, driver) {
|
|
49
|
+
const results = [];
|
|
50
|
+
const ruleIds = new Set();
|
|
51
|
+
for (const signal of signals) {
|
|
52
|
+
ruleIds.add(signal.ruleId);
|
|
53
|
+
const filePath = signal.code?.file ?? signal.filePath;
|
|
54
|
+
// SARIF 2.1.0 requires region.startLine / region.startColumn to be >= 1.
|
|
55
|
+
// Some checks report 0 to mean "no specific line/column" (a whole-file or
|
|
56
|
+
// whole-line finding). Normalize <1 (and non-finite) values to undefined so
|
|
57
|
+
// they are omitted here rather than emitted as invalid 0s — an omitted
|
|
58
|
+
// startColumn denotes the whole line, which is the intended semantics.
|
|
59
|
+
const startLine = atLeastOne(signal.code?.line ?? signal.line);
|
|
60
|
+
const startColumn = atLeastOne(signal.code?.column ?? signal.column);
|
|
61
|
+
const physicalLocation = {
|
|
62
|
+
artifactLocation: { uri: filePath },
|
|
63
|
+
...(startLine === undefined
|
|
64
|
+
? {}
|
|
65
|
+
: {
|
|
66
|
+
region: {
|
|
67
|
+
startLine,
|
|
68
|
+
...(startColumn !== undefined && { startColumn }),
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
71
|
+
};
|
|
72
|
+
results.push({
|
|
73
|
+
ruleId: signal.ruleId,
|
|
74
|
+
level: mapSeverityToSarifLevel(signal.severity),
|
|
75
|
+
message: { text: signal.message },
|
|
76
|
+
locations: [{ physicalLocation }],
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const sarif = {
|
|
80
|
+
$schema: 'https://json.schemastore.org/sarif-2.1.0.json',
|
|
81
|
+
version: '2.1.0',
|
|
82
|
+
runs: [
|
|
83
|
+
{
|
|
84
|
+
tool: {
|
|
85
|
+
driver: {
|
|
86
|
+
name: driver.name,
|
|
87
|
+
version: driver.version,
|
|
88
|
+
informationUri: 'https://github.com/opensip-ai/opensip-cli',
|
|
89
|
+
rules: [...ruleIds].sort().map((id) => ({ id })),
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
results,
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
};
|
|
96
|
+
return JSON.stringify(sarif, null, 2);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The canonical signal → SARIF formatter. Reads `signals`/`tool` off the
|
|
100
|
+
* envelope; the driver name is `opensip-cli-<tool>`. Pure `(envelope) =>
|
|
101
|
+
* string`.
|
|
102
|
+
*/
|
|
103
|
+
export const formatSignalSarif = (envelope) => buildOpenSipSarif(envelope.signals, {
|
|
104
|
+
name: `opensip-cli-${envelope.tool}`,
|
|
105
|
+
version: DEFAULT_DRIVER_VERSION,
|
|
106
|
+
});
|
|
107
|
+
//# sourceMappingURL=signal-sarif.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-sarif.js","sourceRoot":"","sources":["../../src/format/signal-sarif.ts"],"names":[],"mappings":"AA8BA;;;;;GAKG;AACH,SAAS,uBAAuB,CAAC,QAAwB;IACvD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,UAAU,CAAC,CAAC,CAAC;YAChB,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,KAAK,KAAK,CAAC,CAAC,CAAC;YACX,OAAO,MAAM,CAAC;QAChB,CAAC;IAC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AAC,IAAI,CAAC;YACX,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,KAAK,EAAE,uBAAuB,CAAC,MAAM,CAAC,QAAQ,CAAC;YAC/C,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE;YACjC,SAAS,EAAE,CAAC,EAAE,gBAAgB,EAAE,CAAC;SAClC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,KAAK,GAAa;QACtB,OAAO,EAAE,+CAA+C;QACxD,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE;YACJ;gBACE,IAAI,EAAE;oBACJ,MAAM,EAAE;wBACN,IAAI,EAAE,MAAM,CAAC,IAAI;wBACjB,OAAO,EAAE,MAAM,CAAC,OAAO;wBACvB,cAAc,EAAE,2CAA2C;wBAC3D,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;qBACjD;iBACF;gBACD,OAAO;aACR;SACF;KACF,CAAC;IAEF,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAc,CAAC,QAAQ,EAAE,EAAE,CACvD,iBAAiB,CAAC,QAAQ,CAAC,OAAO,EAAE;IAClC,IAAI,EAAE,eAAe,QAAQ,CAAC,IAAI,EAAE;IACpC,OAAO,EAAE,sBAAsB;CAChC,CAAC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { SignalEnvelope } from '@opensip-cli/contracts';
|
|
2
|
+
/** Per-unit terminal-table row, derived from a {@link UnitResult} + its signals. */
|
|
3
|
+
export interface SignalTableRow {
|
|
4
|
+
/** Unit slug (check / rule / scenario id). */
|
|
5
|
+
readonly unit: string;
|
|
6
|
+
/** PASS when the unit emitted no critical/high signals and did not error. */
|
|
7
|
+
readonly status: 'PASS' | 'FAIL' | 'ERROR';
|
|
8
|
+
/** Count of this unit's `critical`/`high` signals. */
|
|
9
|
+
readonly errors: number;
|
|
10
|
+
/** Count of this unit's `medium`/`low` signals. */
|
|
11
|
+
readonly warnings: number;
|
|
12
|
+
/** Pretty duration (`"450ms"` / `"1.5s"` / `"24m 31.6s"`). */
|
|
13
|
+
readonly duration: string;
|
|
14
|
+
/** Raw duration in milliseconds (for sorting / re-formatting). */
|
|
15
|
+
readonly durationMs: number;
|
|
16
|
+
/** The unit's error message, when it errored (status `ERROR`). */
|
|
17
|
+
readonly error?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Count of files/items the unit validated this run, or undefined when the
|
|
20
|
+
* unit does not scan files (graph/sim). The renderer formats it with
|
|
21
|
+
* {@link itemType} as the noun (`"450 files"`); a `0`/undefined renders `—`.
|
|
22
|
+
*/
|
|
23
|
+
readonly validated?: number;
|
|
24
|
+
/** The scanned-item noun for {@link validated} (`files` / `packages` / …). */
|
|
25
|
+
readonly itemType?: string;
|
|
26
|
+
/** Findings suppressed by an inline ignore directive, or undefined when N/A. */
|
|
27
|
+
readonly ignored?: number;
|
|
28
|
+
}
|
|
29
|
+
/** Aggregate summary line for the terminal table, derived from the verdict. */
|
|
30
|
+
export interface SignalTableSummary {
|
|
31
|
+
readonly passed: number;
|
|
32
|
+
readonly failed: number;
|
|
33
|
+
readonly totalErrors: number;
|
|
34
|
+
readonly totalWarnings: number;
|
|
35
|
+
readonly durationMs: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Build one {@link SignalTableRow} per unit, attributing signals to units by
|
|
39
|
+
* `signal.source === unit.slug`. Pure: no IO, no clock.
|
|
40
|
+
*/
|
|
41
|
+
export declare function formatSignalTableRows(envelope: SignalEnvelope): SignalTableRow[];
|
|
42
|
+
/** Build the aggregate summary line from the envelope's verdict. Pure. */
|
|
43
|
+
export declare function formatSignalTableSummary(envelope: SignalEnvelope): Signal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