@r_masseater/h56m 0.1.0 → 0.2.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/README.md CHANGED
@@ -1,9 +1,12 @@
1
1
  # @r_masseater/h56m
2
2
 
3
+ <img src="logo.svg" alt="h56m logo" width="256">
4
+
3
5
  A secret scanner written in Rust and configured from `vite.config.ts`.
4
6
 
5
- It matches with the engine of [Kingfisher](https://github.com/mongodb/kingfisher)
6
- and reads settings in the Betterleaks format. It has no rules of its own: extend
7
+ Its matching engine follows [Betterleaks](https://github.com/betterleaks/betterleaks)
8
+ and reads settings in the Betterleaks format, including filters, components and
9
+ decoding of base64, hex, percent and unicode text. It has no rules of its own: extend
7
10
  a preset from [@r_masseater/h56m-presets](https://www.npmjs.com/package/@r_masseater/h56m-presets)
8
11
  or a TOML file of your own. It scans the commits a branch adds, the staged changes, a
9
12
  tree, or any text. It does not call the services the secrets belong to.
@@ -25,7 +28,51 @@ export default defineConfig({
25
28
  Run `h56m` to scan the commits since the default branch, or `h56m --staged`
26
29
  to scan the index. Call `makeDetector` to scan text from code.
27
30
 
28
- Kingfisher is under MIT and Apache-2.0, and its word list is under CC-BY-SA-4.0. `THIRD-PARTY-NOTICES.txt` holds their notices.
31
+ Encoded text is decoded up to five times, as the Betterleaks CLI does. Set
32
+ `maxDecodeDepth` to change that; `0` scans only the text as written.
33
+
34
+ The tests run every scan that the Betterleaks test suite makes and compare the
35
+ findings; `src/app/fixtures/` holds them.
36
+
37
+ The engine ports code from Betterleaks, which is under MIT, and embeds its word list, which is under CC-BY-SA-4.0. `THIRD-PARTY-NOTICES.txt` holds their notices.
38
+
39
+ ## Comparison
40
+
41
+ Measured on 2026-11-19 on linux x64, 4 CPUs with [lint-bench](https://github.com/masseater/masseater.dev/tree/main/tools/lint-bench), which keeps the full results in [results.md](https://github.com/masseater/masseater.dev/blob/main/tools/lint-bench/results/results.md). Cold runs drop the page cache and the tools' caches first. "Same as ours", "Only ours" and "Only theirs" compare findings by file, line and rule where both tools use the same rules.
42
+
43
+ h56m uses the Betterleaks rules and, like Betterleaks, scans only the lines each commit adds. Its findings match Betterleaks on both repositories. It runs 2 to 3 times slower than Betterleaks.
44
+
45
+ ### masseater.dev
46
+
47
+ | Tool | Version | Cold | Warm | Peak RSS | Findings | Same as ours | Only ours | Only theirs |
48
+ | ----------- | ----------------------------------- | ------ | --------------- | -------- | -------- | ------------ | --------- | ----------- |
49
+ | Betterleaks | 2.0.0-rc.9 | 369 ms | 328 ms ± 29 ms | 82 MB | 1 | 1 | 0 | 0 |
50
+ | gitleaks | 8.30.1 | 805 ms | 652 ms ± 25 ms | 63 MB | 1 | | | |
51
+ | **h56m** | workspace, h56m-presets betterleaks | 1.03 s | 740 ms ± 19 ms | 254 MB | 1 | | | |
52
+ | Kingfisher | 2.19.1 | 9.10 s | 740 ms ± 20 ms | 178 MB | 0 | | | |
53
+ | TruffleHog | 3.99.9 | 5.96 s | 9.89 s ± 477 ms | 185 MB | 0 | | | |
54
+
55
+ - h56m: Commits from the base to HEAD, Betterleaks default rules, no live validation
56
+ - Betterleaks: Commits from the base to HEAD, Betterleaks default rules, no live validation
57
+ - gitleaks: Commits from the base to HEAD, gitleaks default rules
58
+ - TruffleHog: Commits from the base to HEAD, all detectors, --no-verification
59
+ - Kingfisher: Commits from the base to HEAD, default rules, --no-validate
60
+
61
+ ### nodejs/node
62
+
63
+ | Tool | Version | Cold | Warm | Peak RSS | Findings | Same as ours | Only ours | Only theirs |
64
+ | ----------- | ----------------------------------- | ------- | ---------------- | -------- | -------- | ------------ | --------- | ----------- |
65
+ | Betterleaks | 2.0.0-rc.9 | 722 ms | 674 ms ± 23 ms | 387 MB | 0 | 0 | 0 | 0 |
66
+ | gitleaks | 8.30.1 | 1.31 s | 1.18 s ± 51 ms | 72 MB | 3 | | | |
67
+ | Kingfisher | 2.19.1 | 9.92 s | 1.36 s ± 41 ms | 204 MB | 0 | | | |
68
+ | **h56m** | workspace, h56m-presets betterleaks | 2.19 s | 1.96 s ± 36 ms | 436 MB | 0 | | | |
69
+ | TruffleHog | 3.99.9 | 14.07 s | 30.49 s ± 1.67 s | 185 MB | 0 | | | |
70
+
71
+ - h56m: Commits from the base to HEAD, Betterleaks default rules, no live validation
72
+ - Betterleaks: Commits from the base to HEAD, Betterleaks default rules, no live validation
73
+ - gitleaks: Commits from the base to HEAD, gitleaks default rules
74
+ - TruffleHog: Commits from the base to HEAD, all detectors, --no-verification
75
+ - Kingfisher: Commits from the base to HEAD, default rules, --no-validate
29
76
 
30
77
  ## Agent skills
31
78
 
@@ -1,14 +1,12 @@
1
- Kingfisher built-in rule attribution
1
+ h56m third-party notices
2
2
 
3
- Rules are converted and modified by Kingfisher's importers and operational overlays.
4
- The provenance manifest records source revisions, hashes, and generated rule IDs.
5
- Exact source files, including their original headers, accompany this bundle in
6
- upstream-sources.json.gz. Binary sources use a base64: prefix.
7
- Compression does not change the applicable licenses.
3
+ The matching engine in native/core ports the scanner, expression functions, search
4
+ windows and decoders of Betterleaks, and embeds its word list
5
+ (native/core/assets/words.txt.gz), which derives from wordfreq data.
8
6
 
9
7
  ===== Betterleaks (MIT) =====
10
8
 
11
- https://raw.githubusercontent.com/betterleaks/betterleaks/8f376ff9c31ed5309ac448fe601c5dd21b376155/LICENSE
9
+ https://github.com/betterleaks/betterleaks/blob/e07e69ba6a441313529b3e72be43ffdcc62bdf86/LICENSE
12
10
 
13
11
  MIT License
14
12
 
@@ -32,274 +30,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
30
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
31
  SOFTWARE.
34
32
 
35
-
36
- ===== Veles / OSV-SCALIBR (Apache-2.0) =====
37
-
38
- https://raw.githubusercontent.com/google/osv-scalibr/e8621f1fff93beb5b70e5d6ba5fdc3e9854ec845/LICENSE
39
-
40
-
41
- Apache License
42
- Version 2.0, January 2004
43
- http://www.apache.org/licenses/
44
-
45
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
46
-
47
- 1. Definitions.
48
-
49
- "License" shall mean the terms and conditions for use, reproduction,
50
- and distribution as defined by Sections 1 through 9 of this document.
51
-
52
- "Licensor" shall mean the copyright owner or entity authorized by
53
- the copyright owner that is granting the License.
54
-
55
- "Legal Entity" shall mean the union of the acting entity and all
56
- other entities that control, are controlled by, or are under common
57
- control with that entity. For the purposes of this definition,
58
- "control" means (i) the power, direct or indirect, to cause the
59
- direction or management of such entity, whether by contract or
60
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
61
- outstanding shares, or (iii) beneficial ownership of such entity.
62
-
63
- "You" (or "Your") shall mean an individual or Legal Entity
64
- exercising permissions granted by this License.
65
-
66
- "Source" form shall mean the preferred form for making modifications,
67
- including but not limited to software source code, documentation
68
- source, and configuration files.
69
-
70
- "Object" form shall mean any form resulting from mechanical
71
- transformation or translation of a Source form, including but
72
- not limited to compiled object code, generated documentation,
73
- and conversions to other media types.
74
-
75
- "Work" shall mean the work of authorship, whether in Source or
76
- Object form, made available under the License, as indicated by a
77
- copyright notice that is included in or attached to the work
78
- (an example is provided in the Appendix below).
79
-
80
- "Derivative Works" shall mean any work, whether in Source or Object
81
- form, that is based on (or derived from) the Work and for which the
82
- editorial revisions, annotations, elaborations, or other modifications
83
- represent, as a whole, an original work of authorship. For the purposes
84
- of this License, Derivative Works shall not include works that remain
85
- separable from, or merely link (or bind by name) to the interfaces of,
86
- the Work and Derivative Works thereof.
87
-
88
- "Contribution" shall mean any work of authorship, including
89
- the original version of the Work and any modifications or additions
90
- to that Work or Derivative Works thereof, that is intentionally
91
- submitted to Licensor for inclusion in the Work by the copyright owner
92
- or by an individual or Legal Entity authorized to submit on behalf of
93
- the copyright owner. For the purposes of this definition, "submitted"
94
- means any form of electronic, verbal, or written communication sent
95
- to the Licensor or its representatives, including but not limited to
96
- communication on electronic mailing lists, source code control systems,
97
- and issue tracking systems that are managed by, or on behalf of, the
98
- Licensor for the purpose of discussing and improving the Work, but
99
- excluding communication that is conspicuously marked or otherwise
100
- designated in writing by the copyright owner as "Not a Contribution."
101
-
102
- "Contributor" shall mean Licensor and any individual or Legal Entity
103
- on behalf of whom a Contribution has been received by Licensor and
104
- subsequently incorporated within the Work.
105
-
106
- 2. Grant of Copyright License. Subject to the terms and conditions of
107
- this License, each Contributor hereby grants to You a perpetual,
108
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
109
- copyright license to reproduce, prepare Derivative Works of,
110
- publicly display, publicly perform, sublicense, and distribute the
111
- Work and such Derivative Works in Source or Object form.
112
-
113
- 3. Grant of Patent License. Subject to the terms and conditions of
114
- this License, each Contributor hereby grants to You a perpetual,
115
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
116
- (except as stated in this section) patent license to make, have made,
117
- use, offer to sell, sell, import, and otherwise transfer the Work,
118
- where such license applies only to those patent claims licensable
119
- by such Contributor that are necessarily infringed by their
120
- Contribution(s) alone or by combination of their Contribution(s)
121
- with the Work to which such Contribution(s) was submitted. If You
122
- institute patent litigation against any entity (including a
123
- cross-claim or counterclaim in a lawsuit) alleging that the Work
124
- or a Contribution incorporated within the Work constitutes direct
125
- or contributory patent infringement, then any patent licenses
126
- granted to You under this License for that Work shall terminate
127
- as of the date such litigation is filed.
128
-
129
- 4. Redistribution. You may reproduce and distribute copies of the
130
- Work or Derivative Works thereof in any medium, with or without
131
- modifications, and in Source or Object form, provided that You
132
- meet the following conditions:
133
-
134
- (a) You must give any other recipients of the Work or
135
- Derivative Works a copy of this License; and
136
-
137
- (b) You must cause any modified files to carry prominent notices
138
- stating that You changed the files; and
139
-
140
- (c) You must retain, in the Source form of any Derivative Works
141
- that You distribute, all copyright, patent, trademark, and
142
- attribution notices from the Source form of the Work,
143
- excluding those notices that do not pertain to any part of
144
- the Derivative Works; and
145
-
146
- (d) If the Work includes a "NOTICE" text file as part of its
147
- distribution, then any Derivative Works that You distribute must
148
- include a readable copy of the attribution notices contained
149
- within such NOTICE file, excluding those notices that do not
150
- pertain to any part of the Derivative Works, in at least one
151
- of the following places: within a NOTICE text file distributed
152
- as part of the Derivative Works; within the Source form or
153
- documentation, if provided along with the Derivative Works; or,
154
- within a display generated by the Derivative Works, if and
155
- wherever such third-party notices normally appear. The contents
156
- of the NOTICE file are for informational purposes only and
157
- do not modify the License. You may add Your own attribution
158
- notices within Derivative Works that You distribute, alongside
159
- or as an addendum to the NOTICE text from the Work, provided
160
- that such additional attribution notices cannot be construed
161
- as modifying the License.
162
-
163
- You may add Your own copyright statement to Your modifications and
164
- may provide additional or different license terms and conditions
165
- for use, reproduction, or distribution of Your modifications, or
166
- for any such Derivative Works as a whole, provided Your use,
167
- reproduction, and distribution of the Work otherwise complies with
168
- the conditions stated in this License.
169
-
170
- 5. Submission of Contributions. Unless You explicitly state otherwise,
171
- any Contribution intentionally submitted for inclusion in the Work
172
- by You to the Licensor shall be under the terms and conditions of
173
- this License, without any additional terms or conditions.
174
- Notwithstanding the above, nothing herein shall supersede or modify
175
- the terms of any separate license agreement you may have executed
176
- with Licensor regarding such Contributions.
177
-
178
- 6. Trademarks. This License does not grant permission to use the trade
179
- names, trademarks, service marks, or product names of the Licensor,
180
- except as required for reasonable and customary use in describing the
181
- origin of the Work and reproducing the content of the NOTICE file.
182
-
183
- 7. Disclaimer of Warranty. Unless required by applicable law or
184
- agreed to in writing, Licensor provides the Work (and each
185
- Contributor provides its Contributions) on an "AS IS" BASIS,
186
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
187
- implied, including, without limitation, any warranties or conditions
188
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
189
- PARTICULAR PURPOSE. You are solely responsible for determining the
190
- appropriateness of using or redistributing the Work and assume any
191
- risks associated with Your exercise of permissions under this License.
192
-
193
- 8. Limitation of Liability. In no event and under no legal theory,
194
- whether in tort (including negligence), contract, or otherwise,
195
- unless required by applicable law (such as deliberate and grossly
196
- negligent acts) or agreed to in writing, shall any Contributor be
197
- liable to You for damages, including any direct, indirect, special,
198
- incidental, or consequential damages of any character arising as a
199
- result of this License or out of the use or inability to use the
200
- Work (including but not limited to damages for loss of goodwill,
201
- work stoppage, computer failure or malfunction, or any and all
202
- other commercial damages or losses), even if such Contributor
203
- has been advised of the possibility of such damages.
204
-
205
- 9. Accepting Warranty or Additional Liability. While redistributing
206
- the Work or Derivative Works thereof, You may choose to offer,
207
- and charge a fee for, acceptance of support, warranty, indemnity,
208
- or other liability obligations and/or rights consistent with this
209
- License. However, in accepting such obligations, You may act only
210
- on Your own behalf and on Your sole responsibility, not on behalf
211
- of any other Contributor, and only if You agree to indemnify,
212
- defend, and hold each Contributor harmless for any liability
213
- incurred by, or claims asserted against, such Contributor by reason
214
- of your accepting any such warranty or additional liability.
215
-
216
- END OF TERMS AND CONDITIONS
217
-
218
- APPENDIX: How to apply the Apache License to your work.
219
-
220
- To apply the Apache License to your work, attach the following
221
- boilerplate notice, with the fields enclosed by brackets "[]"
222
- replaced with your own identifying information. (Don't include
223
- the brackets!) The text should be enclosed in the appropriate
224
- comment syntax for the file format. We also recommend that a
225
- file or class name and description of purpose be included on the
226
- same "printed page" as the copyright notice for easier
227
- identification within third-party archives.
228
-
229
- Copyright [yyyy] [name of copyright owner]
230
-
231
- Licensed under the Apache License, Version 2.0 (the "License");
232
- you may not use this file except in compliance with the License.
233
- You may obtain a copy of the License at
234
-
235
- http://www.apache.org/licenses/LICENSE-2.0
236
-
237
- Unless required by applicable law or agreed to in writing, software
238
- distributed under the License is distributed on an "AS IS" BASIS,
239
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
240
- See the License for the specific language governing permissions and
241
- limitations under the License.
242
-
243
- ------------------
244
- File: extractor/filesystem/internal/walkdir_iterate.go
245
- File: enricher/govulncheck/source/internal/result.go
246
- File: enricher/govulncheck/source/internal/url/*
247
- ------------------
248
-
249
- Copyright 2009, Google Inc.
250
- All rights reserved.
251
-
252
- Redistribution and use in source and binary forms, with or without
253
- modification, are permitted provided that the following conditions are
254
- met:
255
-
256
- * Redistributions of source code must retain the above copyright
257
- notice, this list of conditions and the following disclaimer.
258
- * Redistributions in binary form must reproduce the above
259
- copyright notice, this list of conditions and the following
260
- disclaimer in the documentation and/or other materials provided
261
- with the distribution.
262
- * Neither the name of the Google Inc. nor the names of its
263
- contributors may be used to endorse or promote products derived
264
- from this software without specific prior written permission.
265
-
266
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
267
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
268
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
269
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
270
- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
271
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
272
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
273
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
274
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
275
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
276
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
277
-
278
- ------------------
279
- File: enricher/reachability/rust/ar/reader.go
280
- ------------------
281
-
282
- Copyright (c) 2013 Blake Smith <blakesmith0@gmail.com>
283
-
284
- Permission is hereby granted, free of charge, to any person obtaining a copy
285
- of this software and associated documentation files (the "Software"), to deal
286
- in the Software without restriction, including without limitation the rights
287
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
288
- copies of the Software, and to permit persons to whom the Software is
289
- furnished to do so, subject to the following conditions:
290
-
291
- The above copyright notice and this permission notice shall be included in
292
- all copies or substantial portions of the Software.
293
-
294
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
295
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
296
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
297
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
298
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
299
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
300
- THE SOFTWARE.
301
-
302
-
303
33
  ===== Betterleaks wordfreq-derived wordlist data (CC-BY-SA-4.0) =====
304
34
 
305
35
  https://raw.githubusercontent.com/rspeer/wordfreq/912caf64b657478d1dff1138efdc078947d54bb1/NOTICE.md
@@ -799,472 +529,3 @@ the avoidance of doubt, this paragraph does not form part of the
799
529
  public licenses.
800
530
 
801
531
  Creative Commons may be contacted at creativecommons.org.
802
-
803
-
804
-
805
- ===== Kingfisher first-party detector exceptions (Apache-2.0) =====
806
-
807
- Source: crates/kingfisher-rules/data/kingfisher-rules.yml
808
- Per-rule exception reasons and upstream migration conditions are recorded in provenance.json.
809
-
810
- Apache License
811
- Version 2.0, January 2004
812
- http://www.apache.org/licenses/
813
-
814
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
815
-
816
- 1. Definitions.
817
-
818
- "License" shall mean the terms and conditions for use, reproduction,
819
- and distribution as defined by Sections 1 through 9 of this document.
820
-
821
- "Licensor" shall mean the copyright owner or entity authorized by
822
- the copyright owner that is granting the License.
823
-
824
- "Legal Entity" shall mean the union of the acting entity and all
825
- other entities that control, are controlled by, or are under common
826
- control with that entity. For the purposes of this definition,
827
- "control" means (i) the power, direct or indirect, to cause the
828
- direction or management of such entity, whether by contract or
829
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
830
- outstanding shares, or (iii) beneficial ownership of such entity.
831
-
832
- "You" (or "Your") shall mean an individual or Legal Entity
833
- exercising permissions granted by this License.
834
-
835
- "Source" form shall mean the preferred form for making modifications,
836
- including but not limited to software source code, documentation
837
- source, and configuration files.
838
-
839
- "Object" form shall mean any form resulting from mechanical
840
- transformation or translation of a Source form, including but
841
- not limited to compiled object code, generated documentation,
842
- and conversions to other media types.
843
-
844
- "Work" shall mean the work of authorship, whether in Source or
845
- Object form, made available under the License, as indicated by a
846
- copyright notice that is included in or attached to the work
847
- (an example is provided in the Appendix below).
848
-
849
- "Derivative Works" shall mean any work, whether in Source or Object
850
- form, that is based on (or derived from) the Work and for which the
851
- editorial revisions, annotations, elaborations, or other modifications
852
- represent, as a whole, an original work of authorship. For the purposes
853
- of this License, Derivative Works shall not include works that remain
854
- separable from, or merely link (or bind by name) to the interfaces of,
855
- the Work and Derivative Works thereof.
856
-
857
- "Contribution" shall mean any work of authorship, including
858
- the original version of the Work and any modifications or additions
859
- to that Work or Derivative Works thereof, that is intentionally
860
- submitted to Licensor for inclusion in the Work by the copyright owner
861
- or by an individual or Legal Entity authorized to submit on behalf of
862
- the copyright owner. For the purposes of this definition, "submitted"
863
- means any form of electronic, verbal, or written communication sent
864
- to the Licensor or its representatives, including but not limited to
865
- communication on electronic mailing lists, source code control systems,
866
- and issue tracking systems that are managed by, or on behalf of, the
867
- Licensor for the purpose of discussing and improving the Work, but
868
- excluding communication that is conspicuously marked or otherwise
869
- designated in writing by the copyright owner as "Not a Contribution."
870
-
871
- "Contributor" shall mean Licensor and any individual or Legal Entity
872
- on behalf of whom a Contribution has been received by Licensor and
873
- subsequently incorporated within the Work.
874
-
875
- 2. Grant of Copyright License. Subject to the terms and conditions of
876
- this License, each Contributor hereby grants to You a perpetual,
877
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
878
- copyright license to reproduce, prepare Derivative Works of,
879
- publicly display, publicly perform, sublicense, and distribute the
880
- Work and such Derivative Works in Source or Object form.
881
-
882
- 3. Grant of Patent License. Subject to the terms and conditions of
883
- this License, each Contributor hereby grants to You a perpetual,
884
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
885
- (except as stated in this section) patent license to make, have made,
886
- use, offer to sell, sell, import, and otherwise transfer the Work,
887
- where such license applies only to those patent claims licensable
888
- by such Contributor that are necessarily infringed by their
889
- Contribution(s) alone or by combination of their Contribution(s)
890
- with the Work to which such Contribution(s) was submitted. If You
891
- institute patent litigation against any entity (including a
892
- cross-claim or counterclaim in a lawsuit) alleging that the Work
893
- or a Contribution incorporated within the Work constitutes direct
894
- or contributory patent infringement, then any patent licenses
895
- granted to You under this License for that Work shall terminate
896
- as of the date such litigation is filed.
897
-
898
- 4. Redistribution. You may reproduce and distribute copies of the
899
- Work or Derivative Works thereof in any medium, with or without
900
- modifications, and in Source or Object form, provided that You
901
- meet the following conditions:
902
-
903
- (a) You must give any other recipients of the Work or
904
- Derivative Works a copy of this License; and
905
-
906
- (b) You must cause any modified files to carry prominent notices
907
- stating that You changed the files; and
908
-
909
- (c) You must retain, in the Source form of any Derivative Works
910
- that You distribute, all copyright, patent, trademark, and
911
- attribution notices from the Source form of the Work,
912
- excluding those notices that do not pertain to any part of
913
- the Derivative Works; and
914
-
915
- (d) If the Work includes a "NOTICE" text file as part of its
916
- distribution, then any Derivative Works that You distribute must
917
- include a readable copy of the attribution notices contained
918
- within such NOTICE file, excluding those notices that do not
919
- pertain to any part of the Derivative Works, in at least one
920
- of the following places: within a NOTICE text file distributed
921
- as part of the Derivative Works; within the Source form or
922
- documentation, if provided along with the Derivative Works; or,
923
- within a display generated by the Derivative Works, if and
924
- wherever such third-party notices normally appear. The contents
925
- of the NOTICE file are for informational purposes only and
926
- do not modify the License. You may add Your own attribution
927
- notices within Derivative Works that You distribute, alongside
928
- or as an addendum to the NOTICE text from the Work, provided
929
- that such additional attribution notices cannot be construed
930
- as modifying the License.
931
-
932
- You may add Your own copyright statement to Your modifications and
933
- may provide additional or different license terms and conditions
934
- for use, reproduction, or distribution of Your modifications, or
935
- for any such Derivative Works as a whole, provided Your use,
936
- reproduction, and distribution of the Work otherwise complies with
937
- the conditions stated in this License.
938
-
939
- 5. Submission of Contributions. Unless You explicitly state otherwise,
940
- any Contribution intentionally submitted for inclusion in the Work
941
- by You to the Licensor shall be under the terms and conditions of
942
- this License, without any additional terms or conditions.
943
- Notwithstanding the above, nothing herein shall supersede or modify
944
- the terms of any separate license agreement you may have executed
945
- with Licensor regarding such Contributions.
946
-
947
- 6. Trademarks. This License does not grant permission to use the trade
948
- names, trademarks, service marks, or product names of the Licensor,
949
- except as required for reasonable and customary use in describing the
950
- origin of the Work and reproducing the content of the NOTICE file.
951
-
952
- 7. Disclaimer of Warranty. Unless required by applicable law or
953
- agreed to in writing, Licensor provides the Work (and each
954
- Contributor provides its Contributions) on an "AS IS" BASIS,
955
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
956
- implied, including, without limitation, any warranties or conditions
957
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
958
- PARTICULAR PURPOSE. You are solely responsible for determining the
959
- appropriateness of using or redistributing the Work and assume any
960
- risks associated with Your exercise of permissions under this License.
961
-
962
- 8. Limitation of Liability. In no event and under no legal theory,
963
- whether in tort (including negligence), contract, or otherwise,
964
- unless required by applicable law (such as deliberate and grossly
965
- negligent acts) or agreed to in writing, shall any Contributor be
966
- liable to You for damages, including any direct, indirect, special,
967
- incidental, or consequential damages of any character arising as a
968
- result of this License or out of the use or inability to use the
969
- Work (including but not limited to damages for loss of goodwill,
970
- work stoppage, computer failure or malfunction, or any and all
971
- other commercial damages or losses), even if such Contributor
972
- has been advised of the possibility of such damages.
973
-
974
- 9. Accepting Warranty or Additional Liability. While redistributing
975
- the Work or Derivative Works thereof, You may choose to offer,
976
- and charge a fee for, acceptance of support, warranty, indemnity,
977
- or other liability obligations and/or rights consistent with this
978
- License. However, in accepting such obligations, You may act only
979
- on Your own behalf and on Your sole responsibility, not on behalf
980
- of any other Contributor, and only if You agree to indemnify,
981
- defend, and hold each Contributor harmless for any liability
982
- incurred by, or claims asserted against, such Contributor by reason
983
- of your accepting any such warranty or additional liability.
984
-
985
- END OF TERMS AND CONDITIONS
986
-
987
- APPENDIX: How to apply the Apache License to your work.
988
-
989
- To apply the Apache License to your work, attach the following
990
- boilerplate notice, with the fields enclosed by brackets "[]"
991
- replaced with your own identifying information. (Don't include
992
- the brackets!) The text should be enclosed in the appropriate
993
- comment syntax for the file format. We also recommend that a
994
- file or class name and description of purpose be included on the
995
- same "printed page" as the copyright notice for easier
996
- identification within third-party archives.
997
-
998
- Copyright [yyyy] [name of copyright owner]
999
-
1000
- Licensed under the Apache License, Version 2.0 (the "License");
1001
- you may not use this file except in compliance with the License.
1002
- You may obtain a copy of the License at
1003
-
1004
- http://www.apache.org/licenses/LICENSE-2.0
1005
-
1006
- Unless required by applicable law or agreed to in writing, software
1007
- distributed under the License is distributed on an "AS IS" BASIS,
1008
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1009
- See the License for the specific language governing permissions and
1010
- limitations under the License.
1011
-
1012
- ===== Upstream source header =====
1013
- // Copyright 2026 Google LLC
1014
- //
1015
- // Licensed under the Apache License, Version 2.0 (the "License");
1016
- // you may not use this file except in compliance with the License.
1017
- // You may obtain a copy of the License at
1018
- //
1019
- // http://www.apache.org/licenses/LICENSE-2.0
1020
- //
1021
- // Unless required by applicable law or agreed to in writing, software
1022
- // distributed under the License is distributed on an "AS IS" BASIS,
1023
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1024
- // See the License for the specific language governing permissions and
1025
- // limitations under the License.
1026
-
1027
-
1028
- ===== Upstream source header =====
1029
- // Copyright 2026 Google LLC
1030
- //
1031
- // Licensed under the Apache License, Version 2.0 (the "License");
1032
- // you may not use this file except in compliance with the License.
1033
- // You may obtain a copy of the License at
1034
- //
1035
- // http://www.apache.org/licenses/LICENSE-2.0
1036
- //
1037
- // Unless required by applicable law or agreed to in writing, software
1038
- // distributed under the License is distributed on an "AS IS" BASIS,
1039
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1040
- // See the License for the specific language governing permissions and
1041
- // limitations under the License.
1042
-
1043
- // Copyright 2025 Google LLC
1044
- //
1045
- // Licensed under the Apache License, Version 2.0 (the "License");
1046
- // you may not use this file except in compliance with the License.
1047
- // You may obtain a copy of the License at
1048
- //
1049
- // http://www.apache.org/licenses/LICENSE-2.0
1050
- //
1051
- // Unless required by applicable law or agreed to in writing,
1052
- // distributed under the License is distributed on an "AS IS" BASIS,
1053
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1054
- // See the License for the specific language governing permissions and
1055
- // limitations under the License.
1056
-
1057
-
1058
- ===== Upstream source header =====
1059
- // Copyright 2026 Google LLC
1060
- //
1061
- // Licensed under the Apache License, Version 2.0 (the "License");
1062
- // you may not use this file except in compliance with the License.
1063
- // You may obtain a copy of the License at
1064
- //
1065
- // http://www.apache.org/licenses/LICENSE-2.0
1066
- //
1067
- // Unless required by applicable law or agreed to in writing, software
1068
- // distributed under the License is distributed on an "AS IS" BASIS,
1069
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1070
- // See the License for the specific language governing permissions and
1071
- // limitations under the License.
1072
-
1073
- // Package bitbucket extends the veles bitbucket.Detector to search inside the git config and history files
1074
-
1075
- ===== Upstream source header =====
1076
- // Copyright 2026 Google LLC
1077
- //
1078
- // Licensed under the Apache License, Version 2.0 (the "License");
1079
- // you may not use this file except in compliance with the License.
1080
- // You may obtain a copy of the License at
1081
- //
1082
- // http://www.apache.org/licenses/LICENSE-2.0
1083
- //
1084
- // Unless required by applicable law or agreed to in writing, software
1085
- // distributed under the License is distributed on an "AS IS" BASIS,
1086
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1087
- // See the License for the specific language governing permissions and
1088
- // limitations under the License.
1089
-
1090
- // Package bitwardenoauth2access extends the veles bitwardenoauth2access.Detector to search inside
1091
- // Bitwarden CLI data.json files for OAuth2 client credentials.
1092
-
1093
- ===== Upstream source header =====
1094
- // Copyright 2026 Google LLC
1095
- //
1096
- // Licensed under the Apache License, Version 2.0 (the "License");
1097
- // you may not use this file except in compliance with the License.
1098
- // You may obtain a copy of the License at
1099
- //
1100
- // http://www.apache.org/licenses/LICENSE-2.0
1101
- //
1102
- // Unless required by applicable law or agreed to in writing, software
1103
- // distributed under the License is distributed on an "AS IS" BASIS,
1104
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1105
- // See the License for the specific language governing permissions and
1106
- // limitations under the License.
1107
-
1108
- // Package cloudflareapitoken contains a Veles Secret type, Detector, and Validator
1109
- // for Cloudflare API Tokens. Detects 40-character tokens in environment variables,
1110
- // JSON, and YAML formats.
1111
-
1112
- ===== Upstream source header =====
1113
- // Copyright 2026 Google LLC
1114
- //
1115
- // Licensed under the Apache License, Version 2.0 (the "License");
1116
- // you may not use this file except in compliance with the License.
1117
- // You may obtain a copy of the License at
1118
- //
1119
- // http://www.apache.org/licenses/LICENSE-2.0
1120
- //
1121
- // Unless required by applicable law or agreed to in writing, software
1122
- // distributed under the License is distributed on an "AS IS" BASIS,
1123
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1124
- // See the License for the specific language governing permissions and
1125
- // limitations under the License.
1126
-
1127
- // Package cloudflareapitoken extends the veles cloudflareapitoken.Detector to search inside
1128
- // Cloudflare-specific configuration files
1129
-
1130
- ===== Upstream source header =====
1131
- // Copyright 2026 Google LLC
1132
- //
1133
- // Licensed under the Apache License, Version 2.0 (the "License");
1134
- // you may not use this file except in compliance with the License.
1135
- // You may obtain a copy of the License at
1136
- //
1137
- // http://www.apache.org/licenses/LICENSE-2.0
1138
- //
1139
- // Unless required by applicable law or agreed to in writing, software
1140
- // distributed under the License is distributed on an "AS IS" BASIS,
1141
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1142
- // See the License for the specific language governing permissions and
1143
- // limitations under the License.
1144
-
1145
- // Package codecatalyst extends the veles codecatalyst.Detector to search inside the git config and history files
1146
-
1147
- ===== Upstream source header =====
1148
- // Copyright 2026 Google LLC
1149
- //
1150
- // Licensed under the Apache License, Version 2.0 (the "License");
1151
- // you may not use this file except in compliance with the License.
1152
- // You may obtain a copy of the License at
1153
- //
1154
- // http://www.apache.org/licenses/LICENSE-2.0
1155
- //
1156
- // Unless required by applicable law or agreed to in writing, software
1157
- // distributed under the License is distributed on an "AS IS" BASIS,
1158
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1159
- // See the License for the specific language governing permissions and
1160
- // limitations under the License.
1161
-
1162
- // Package codecommit extends the veles codecommit.Detector to search inside the git config and history files
1163
-
1164
- ===== Upstream source header =====
1165
- // Copyright 2026 Google LLC
1166
- //
1167
- // Licensed under the Apache License, Version 2.0 (the "License");
1168
- // you may not use this file except in compliance with the License.
1169
- // You may obtain a copy of the License at
1170
- //
1171
- // http://www.apache.org/licenses/LICENSE-2.0
1172
- //
1173
- // Unless required by applicable law or agreed to in writing, software
1174
- // distributed under the License is distributed on an "AS IS" BASIS,
1175
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1176
- // See the License for the specific language governing permissions and
1177
- // limitations under the License.
1178
-
1179
- // Package denopat contains Veles Secret types and Detectors for
1180
- // Deno Personal Access Tokens (user tokens with prefix `ddp_` and organization tokens with prefix `ddo_`).
1181
-
1182
- ===== Upstream source header =====
1183
- // Copyright 2026 Google LLC
1184
- //
1185
- // Licensed under the Apache License, Version 2.0 (the "License");
1186
- // you may not use this file except in compliance with the License.
1187
- // You may obtain a copy of the License at
1188
- //
1189
- // http://www.apache.org/licenses/LICENSE-2.0
1190
- //
1191
- // Unless required by applicable law or agreed to in writing, software
1192
- // distributed under the License is distributed on an "AS IS" BASIS,
1193
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1194
- // See the License for the specific language governing permissions and
1195
- // limitations under the License.
1196
-
1197
- // Package digitaloceanapikey contains a Veles Secret type and a Detector for
1198
- // DigitalOcean API Tokens (prefix `dop_v1_`).
1199
-
1200
- ===== Upstream source header =====
1201
- // Copyright 2026 Google LLC
1202
- //
1203
- // Licensed under the Apache License, Version 2.0 (the "License");
1204
- // you may not use this file except in compliance with the License.
1205
- // You may obtain a copy of the License at
1206
- //
1207
- // http://www.apache.org/licenses/LICENSE-2.0
1208
- //
1209
- // Unless required by applicable law or agreed to in writing, software
1210
- // distributed under the License is distributed on an "AS IS" BASIS,
1211
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
- // See the License for the specific language governing permissions and
1213
- // limitations under the License.
1214
-
1215
- // Package list provides a public list of SCALIBR-internal extraction plugins.
1216
-
1217
- ===== Upstream source header =====
1218
- // Copyright 2026 Google LLC
1219
- //
1220
- // Licensed under the Apache License, Version 2.0 (the "License");
1221
- // you may not use this file except in compliance with the License.
1222
- // You may obtain a copy of the License at
1223
- //
1224
- // http://www.apache.org/licenses/LICENSE-2.0
1225
- //
1226
- // Unless required by applicable law or agreed to in writing, software
1227
- // distributed under the License is distributed on an "AS IS" BASIS,
1228
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1229
- // See the License for the specific language governing permissions and
1230
- // limitations under the License.
1231
-
1232
- // Package npmjsaccesstoken contains a Veles Secret type and a Detector for
1233
- // npm.js Access Tokens (prefix `npm_`).
1234
-
1235
- ===== Upstream source header =====
1236
- // Copyright 2026 Google LLC
1237
- //
1238
- // Licensed under the Apache License, Version 2.0 (the "License");
1239
- // you may not use this file except in compliance with the License.
1240
- // You may obtain a copy of the License at
1241
- //
1242
- // http://www.apache.org/licenses/LICENSE-2.0
1243
- //
1244
- // Unless required by applicable law or agreed to in writing, software
1245
- // distributed under the License is distributed on an "AS IS" BASIS,
1246
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1247
- // See the License for the specific language governing permissions and
1248
- // limitations under the License.
1249
-
1250
- // Package sendgrid provides a detector and validator for SendGrid API keys.
1251
-
1252
- ===== Upstream source header =====
1253
- // Copyright 2026 Google LLC
1254
- //
1255
- // Licensed under the Apache License, Version 2.0 (the "License");
1256
- // you may not use this file except in compliance with the License.
1257
- // You may obtain a copy of the License at
1258
- //
1259
- // http://www.apache.org/licenses/LICENSE-2.0
1260
- //
1261
- // Unless required by applicable law or agreed to in writing, software
1262
- // distributed under the License is distributed on an "AS IS" BASIS,
1263
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1264
- // See the License for the specific language governing permissions and
1265
- // limitations under the License.
1266
-
1267
- // Package slacktoken contains a Veles Secret type and a Detector for
1268
- // Slack App Tokens including App Level Tokens (prefix `xapp-`),
1269
- // App Configuration Access Tokens (prefix `xoxe.xoxp-`), and
1270
- // App Configuration Refresh Tokens (prefix `xoxe-`).
@@ -0,0 +1,38 @@
1
+ import { a as failedWith, n as format, o as runTool, r as makeDetector, t as h56mSection } from "./section-CRZpQXpe.mjs";
2
+ import { Array, Boolean, Effect } from "effect";
3
+ // src/app/cli.ts
4
+ const STAGED = "--staged";
5
+ const BASES = [
6
+ "origin/HEAD",
7
+ "origin/main",
8
+ "origin/master"
9
+ ];
10
+ const HEAD = "HEAD";
11
+ const candidatesOf = (requested) => Array.match(requested, {
12
+ onEmpty: () => BASES,
13
+ onNonEmpty: (given) => given
14
+ });
15
+ const sourceOf = (requested) => Boolean.match(Array.contains(requested, STAGED), {
16
+ onTrue: () => ({ type: "staged" }),
17
+ onFalse: () => ({
18
+ type: "history",
19
+ bases: candidatesOf(requested),
20
+ head: HEAD
21
+ })
22
+ });
23
+ const scan = ({ root, config, args }) => makeDetector(config).pipe(Effect.flatMap((detector) => detector.scanGit({
24
+ root,
25
+ source: sourceOf(args)
26
+ })));
27
+ const runCli = () => {
28
+ runTool({
29
+ name: "h56m",
30
+ section: h56mSection,
31
+ failWith: failedWith,
32
+ scan,
33
+ format
34
+ });
35
+ };
36
+ export { runCli };
37
+
38
+ //# sourceMappingURL=cli-DK1xNWFT.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-DK1xNWFT.mjs","names":["Arr","Bool"],"sources":["../src/app/cli.ts"],"sourcesContent":["import { runTool } from \"@masseater.dev/lint-host\";\nimport type { ToolCall } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Boolean as Bool, Effect } from \"effect\";\n\nimport type { Finding, GitSource, H56mConfig } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { H56mError } from \"#/shared/lib/errors.ts\";\n\nimport { makeDetector } from \"./detector.ts\";\nimport { format } from \"./format.ts\";\nimport { h56mSection } from \"./section.ts\";\n\nconst STAGED = \"--staged\";\nconst BASES = [\"origin/HEAD\", \"origin/main\", \"origin/master\"];\nconst HEAD = \"HEAD\";\n\nconst candidatesOf = (requested: readonly string[]): readonly string[] =>\n Arr.match(requested, { onEmpty: () => BASES, onNonEmpty: (given) => given });\n\nconst sourceOf = (requested: readonly string[]): GitSource =>\n Bool.match(Arr.contains(requested, STAGED), {\n onTrue: (): GitSource => ({ type: \"staged\" }),\n onFalse: (): GitSource => ({ type: \"history\", bases: candidatesOf(requested), head: HEAD }),\n });\n\nconst scan = ({\n root,\n config,\n args,\n}: ToolCall<H56mConfig>): Effect.Effect<readonly Finding[], H56mError> =>\n makeDetector(config).pipe(\n Effect.flatMap((detector) => detector.scanGit({ root, source: sourceOf(args) })),\n );\n\nexport const runCli = (): void => {\n runTool({ name: \"h56m\", section: h56mSection, failWith: failedWith, scan, format });\n};\n"],"mappings":";;;AAYA,MAAM,SAAS;AACf,MAAM,QAAQ;CAAC;CAAe;CAAe;AAAe;AAC5D,MAAM,OAAO;AAEb,MAAM,gBAAgB,cACpBA,MAAI,MAAM,WAAW;CAAE,eAAe;CAAO,aAAa,UAAU;AAAM,CAAC;AAE7E,MAAM,YAAY,cAChBC,QAAK,MAAMD,MAAI,SAAS,WAAW,MAAM,GAAG;CAC1C,eAA0B,EAAE,MAAM,SAAS;CAC3C,gBAA2B;EAAE,MAAM;EAAW,OAAO,aAAa,SAAS;EAAG,MAAM;CAAK;AAC3F,CAAC;AAEH,MAAM,QAAQ,EACZ,MACA,QACA,WAEA,aAAa,MAAM,CAAC,CAAC,KACnB,OAAO,SAAS,aAAa,SAAS,QAAQ;CAAE;CAAM,QAAQ,SAAS,IAAI;AAAE,CAAC,CAAC,CACjF;AAEF,MAAa,eAAqB;CAChC,QAAQ;EAAE,MAAM;EAAQ,SAAS;EAAa,UAAU;EAAY;EAAM;CAAO,CAAC;AACpF"}
package/dist/cli.mjs CHANGED
@@ -1,40 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { a as failedWith, n as format, o as runTool, r as makeDetector, t as h56mSection } from "./section-AeJ2zzPN.mjs";
3
- import { Array, Boolean, Effect } from "effect";
4
- // src/app/cli.ts
5
- const STAGED = "--staged";
6
- const BASES = [
7
- "origin/HEAD",
8
- "origin/main",
9
- "origin/master"
10
- ];
11
- const HEAD = "HEAD";
12
- const candidatesOf = (requested) => Array.match(requested, {
13
- onEmpty: () => BASES,
14
- onNonEmpty: (given) => given
15
- });
16
- const sourceOf = (requested) => Boolean.match(Array.contains(requested, STAGED), {
17
- onTrue: () => ({ type: "staged" }),
18
- onFalse: () => ({
19
- type: "history",
20
- bases: candidatesOf(requested),
21
- head: HEAD
22
- })
23
- });
24
- const scan = ({ root, config, args }) => makeDetector(config).pipe(Effect.flatMap((detector) => detector.scanGit({
25
- root,
26
- source: sourceOf(args)
27
- })));
28
- const runCli = () => {
29
- runTool({
30
- name: "h56m",
31
- section: h56mSection,
32
- failWith: failedWith,
33
- scan,
34
- format
35
- });
36
- };
2
+ import { enableCompileCache } from "node:module";
37
3
  // bin/h56m.ts
4
+ enableCompileCache();
5
+ const { runCli } = await import("./cli-DK1xNWFT.mjs");
38
6
  runCli();
39
7
  export {};
40
8
 
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":["Arr","Bool"],"sources":["../src/app/cli.ts","../bin/h56m.ts"],"sourcesContent":["import { runTool } from \"@masseater.dev/lint-host\";\nimport type { ToolCall } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Boolean as Bool, Effect } from \"effect\";\n\nimport type { Finding, GitSource, H56mConfig } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { H56mError } from \"#/shared/lib/errors.ts\";\n\nimport { makeDetector } from \"./detector.ts\";\nimport { format } from \"./format.ts\";\nimport { h56mSection } from \"./section.ts\";\n\nconst STAGED = \"--staged\";\nconst BASES = [\"origin/HEAD\", \"origin/main\", \"origin/master\"];\nconst HEAD = \"HEAD\";\n\nconst candidatesOf = (requested: readonly string[]): readonly string[] =>\n Arr.match(requested, { onEmpty: () => BASES, onNonEmpty: (given) => given });\n\nconst sourceOf = (requested: readonly string[]): GitSource =>\n Bool.match(Arr.contains(requested, STAGED), {\n onTrue: (): GitSource => ({ type: \"staged\" }),\n onFalse: (): GitSource => ({ type: \"history\", bases: candidatesOf(requested), head: HEAD }),\n });\n\nconst scan = ({\n root,\n config,\n args,\n}: ToolCall<H56mConfig>): Effect.Effect<readonly Finding[], H56mError> =>\n makeDetector(config).pipe(\n Effect.flatMap((detector) => detector.scanGit({ root, source: sourceOf(args) })),\n );\n\nexport const runCli = (): void => {\n runTool({ name: \"h56m\", section: h56mSection, failWith: failedWith, scan, format });\n};\n","#!/usr/bin/env node\nimport { runCli } from \"#/app/cli.ts\";\n\nrunCli();\n"],"mappings":";;;;AAYA,MAAM,SAAS;AACf,MAAM,QAAQ;CAAC;CAAe;CAAe;AAAe;AAC5D,MAAM,OAAO;AAEb,MAAM,gBAAgB,cACpBA,MAAI,MAAM,WAAW;CAAE,eAAe;CAAO,aAAa,UAAU;AAAM,CAAC;AAE7E,MAAM,YAAY,cAChBC,QAAK,MAAMD,MAAI,SAAS,WAAW,MAAM,GAAG;CAC1C,eAA0B,EAAE,MAAM,SAAS;CAC3C,gBAA2B;EAAE,MAAM;EAAW,OAAO,aAAa,SAAS;EAAG,MAAM;CAAK;AAC3F,CAAC;AAEH,MAAM,QAAQ,EACZ,MACA,QACA,WAEA,aAAa,MAAM,CAAC,CAAC,KACnB,OAAO,SAAS,aAAa,SAAS,QAAQ;CAAE;CAAM,QAAQ,SAAS,IAAI;AAAE,CAAC,CAAC,CACjF;AAEF,MAAa,eAAqB;CAChC,QAAQ;EAAE,MAAM;EAAQ,SAAS;EAAa,UAAU;EAAY;EAAM;CAAO,CAAC;AACpF;;ACjCA,OAAO"}
1
+ {"version":3,"file":"cli.mjs","names":[],"sources":["../bin/h56m.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { enableCompileCache } from \"node:module\";\n\nenableCompileCache();\n\nconst { runCli } = await import(\"#/app/cli.ts\");\n\nrunCli();\n"],"mappings":";;;AAGA,mBAAmB;AAEnB,MAAM,EAAE,WAAW,MAAM,OAAO;AAEhC,OAAO"}
@@ -18,6 +18,7 @@ interface H56mExtend {
18
18
  }
19
19
  interface H56mConfig {
20
20
  readonly extend?: H56mExtend;
21
+ readonly maxDecodeDepth?: number;
21
22
  readonly prefilter?: string;
22
23
  readonly filter?: string;
23
24
  readonly rules?: readonly H56mRule[];
@@ -49,4 +50,4 @@ type GitSource = {
49
50
  readonly revision: string;
50
51
  };
51
52
  export { H56mRule as a, H56mExtend as i, GitSource as n, H56mConfig as r, Finding as t };
52
- //# sourceMappingURL=index-DiF7IoP4.d.mts.map
53
+ //# sourceMappingURL=index-C3x2L0fZ.d.mts.map
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as H56mRule, i as H56mExtend, n as GitSource, r as H56mConfig, t as Finding } from "./index-DiF7IoP4.mjs";
1
+ import { a as H56mRule, i as H56mExtend, n as GitSource, r as H56mConfig, t as Finding } from "./index-C3x2L0fZ.mjs";
2
2
  import { Effect, Schema } from "effect";
3
3
  declare const H56mError_base: Schema.Class<H56mError, Schema.TaggedStruct<"H56mError", {
4
4
  readonly message: Schema.String;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { i as H56mError, n as format, t as h56mSection, r as makeDetector } from "./section-AeJ2zzPN.mjs";
1
+ export { i as H56mError, n as format, t as h56mSection, r as makeDetector } from "./section-CRZpQXpe.mjs";
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { Array, Boolean, Console, Effect, FileSystem, Function, Layer, Match, Option, Order, Path, Predicate, Record, Schema, String as String$1, pipe } from "effect";
3
- import { NodeServices } from "@effect/platform-node";
4
3
  import { runMain } from "@effect/platform-node/NodeRuntime";
4
+ import { layer } from "@effect/platform-node/NodeServices";
5
5
  import { ChildProcess, ChildProcessSpawner } from "effect/process";
6
6
  import { FetchHttpClient } from "effect/http";
7
7
  import { Otlp, OtlpSerialization } from "effect/observability";
@@ -100,7 +100,7 @@ const toolMainOf = (tool) => Effect.gen(function* main() {
100
100
  yield* failWhen(Array.isReadonlyArrayNonEmpty(found));
101
101
  });
102
102
  const runTraced = (name, program) => {
103
- const services = Otlp.layerFromConfig({ resource: { serviceName: name } }).pipe(Layer.provide(OtlpSerialization.layerJson), Layer.provide(FetchHttpClient.layer), Layer.provideMerge(NodeServices.layer));
103
+ const services = Otlp.layerFromConfig({ resource: { serviceName: name } }).pipe(Layer.provide(OtlpSerialization.layerJson), Layer.provide(FetchHttpClient.layer), Layer.provideMerge(layer));
104
104
  runMain(program.pipe(Effect.provide(services)));
105
105
  };
106
106
  const runTool = (tool) => {
@@ -113,12 +113,13 @@ Function.dual(2, (value, build) => Option.match(value, {
113
113
  // ../lint-host/src/shared/lib/trace.ts
114
114
  const SAMPLED = "01";
115
115
  const NOT_SAMPLED = "00";
116
+ const LINE_START = 0;
116
117
  const flagsOf = (sampled) => Boolean.match(sampled, {
117
118
  onFalse: () => NOT_SAMPLED,
118
119
  onTrue: () => SAMPLED
119
120
  });
120
121
  const traceparent = Effect.currentSpan.pipe(Effect.map((span) => `00-${span.traceId}-${span.spanId}-${flagsOf(span.sampled)}`), Effect.option);
121
- Order.combine(Order.mapInput(Order.String, (found) => found.path), Order.mapInput(Order.Number, (found) => found.line));
122
+ Order.combine(Order.mapInput(Order.String, (found) => found.path), Order.combine(Order.mapInput(Order.Number, (found) => found.line), Order.mapInput(Order.Number, (found) => found.column ?? LINE_START)));
122
123
  // src/shared/config/types.ts
123
124
  const FindingSchema = Schema.Struct({
124
125
  rule: Schema.String,
@@ -206,4 +207,4 @@ const hasSection = (value) => Predicate.hasProperty(value, "h56m") && Predicate.
206
207
  const h56mSection = (config) => pipe(Option.liftPredicate(config, hasSection), Option.map((value) => value.h56m), Option.getOrElse(() => ({})));
207
208
  export { failedWith as a, H56mError as i, format as n, runTool as o, makeDetector as r, h56mSection as t };
208
209
 
209
- //# sourceMappingURL=section-AeJ2zzPN.mjs.map
210
+ //# sourceMappingURL=section-CRZpQXpe.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"section-CRZpQXpe.mjs","names":["taggedError","Rec","Str","DATA_FIRST_ARITY","Arr","Fn","nodeServices","Fn","Bool","Str"],"sources":["../../lint-host/src/shared/lib/target.ts","../../lint-host/src/features/build-addon/model/build.ts","../../lint-host/src/features/load-addon/model/load.ts","../../lint-host/src/features/run-cli/model/cli.ts","../../lint-host/src/shared/lib/present.ts","../../lint-host/src/shared/lib/trace.ts","../src/shared/config/types.ts","../src/shared/lib/errors.ts","../src/shared/native/index.ts","../src/app/detector.ts","../src/app/format.ts","../src/app/section.ts"],"sourcesContent":["import { Match } from \"effect\";\n\nconst abiOf = (platform: string): string =>\n Match.value(platform).pipe(\n Match.when(\"linux\", () => \"-gnu\"),\n Match.when(\"win32\", () => \"-msvc\"),\n Match.orElse(() => \"\"),\n );\n\nexport const platformTarget = `${process.platform}-${process.arch}${abiOf(process.platform)}`;\n\nexport const addonFileOf = (binary: string): string => `${binary}.${platformTarget}.node`;\n","import { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServices } from \"@effect/platform-node/NodeServices\";\nimport { Effect, FileSystem, Path, Record as Rec, Schema, String as Str } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport { addonFileOf } from \"#/shared/lib/target.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nclass AddonBuildFailed extends taggedError<AddonBuildFailed, { readonly brand: unique symbol }>()(\n \"AddonBuildFailed\",\n { message: Schema.String },\n) {}\n\nconst LIBRARY: Readonly<Record<string, (name: string) => string>> = {\n linux: (name) => `lib${name}.so`,\n darwin: (name) => `lib${name}.dylib`,\n win32: (name) => `${name}.dll`,\n};\n\nconst SUCCESS = 0;\n\nexport interface AddonBuild {\n readonly crate: string;\n readonly binary: string;\n readonly packageDir: string;\n readonly workspaceDir: string;\n}\n\nconst cargo = Effect.fn(\"cargo\")(function* cargo(crate: string, workspace: string) {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const exitCode = yield* spawner.exitCode(\n ChildProcess.make(\"cargo\", [\"build\", \"--release\", \"--locked\", \"-p\", crate], {\n cwd: workspace,\n stdout: \"inherit\",\n stderr: \"inherit\",\n }),\n );\n const failure = AddonBuildFailed.make({ message: `cargo exited with ${String(exitCode)}` });\n yield* Effect.when(\n Effect.fail(failure),\n Effect.sync(() => Number(exitCode) !== SUCCESS),\n );\n});\n\nconst build = Effect.fn(\"buildAddon\")(function* build(options: AddonBuild) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const library = yield* Effect.fromOption(Rec.get(LIBRARY, process.platform)).pipe(\n Effect.mapError(() =>\n AddonBuildFailed.make({ message: `no native build for ${process.platform}` }),\n ),\n );\n yield* cargo(options.crate, options.workspaceDir);\n const output = path.join(options.packageDir, \"native\");\n yield* fileSystem.makeDirectory(output, { recursive: true });\n const built = library(Str.replaceAll(\"-\", \"_\")(options.crate));\n yield* fileSystem.copyFile(\n path.join(options.workspaceDir, \"target\", \"release\", built),\n path.join(output, addonFileOf(options.binary)),\n );\n});\n\nexport const buildAddon = (options: AddonBuild): void => {\n runMain(build(options).pipe(Effect.provide(nodeServices)));\n};\n","import { createRequire } from \"node:module\";\n\nimport { Effect } from \"effect\";\n\nimport type { FailWith } from \"#/shared/lib/fail.ts\";\nimport { addonFileOf, platformTarget } from \"#/shared/lib/target.ts\";\n\nexport interface AddonSource<Addon, Failure> {\n readonly packageName: string;\n readonly binary: string;\n readonly from: string;\n readonly isAddon: (value: unknown) => value is Addon;\n readonly failWith: FailWith<Failure>;\n}\n\nexport const loadAddon = <Addon, Failure>({\n packageName,\n binary,\n from,\n isAddon,\n failWith,\n}: AddonSource<Addon, Failure>): Effect.Effect<Addon, Failure> => {\n const requireFrom = createRequire(from);\n const loadFrom = (specifier: string): Effect.Effect<unknown, Failure> =>\n Effect.try({\n try: (): unknown => requireFrom(specifier),\n catch: failWith(`could not load ${specifier}`),\n });\n return loadFrom(`${packageName}-${platformTarget}`).pipe(\n Effect.catchCause(() => loadFrom(`${packageName}/native/${addonFileOf(binary)}`)),\n Effect.filterOrFail(isAddon, (found) =>\n failWith(`no ${binary} addon for ${platformTarget}`)(found),\n ),\n );\n};\n\nexport interface Telemetered {\n readonly flushTelemetry: () => Promise<void>;\n}\n\nexport interface AddonCall<Addon extends Telemetered, Result, Failure> {\n readonly addon: Effect.Effect<Addon, Failure>;\n readonly name: string;\n readonly files: number;\n readonly call: (addon: Addon) => Result;\n readonly failWith: FailWith<Failure>;\n}\n\nexport const callAddon = <Addon extends Telemetered, Result, Failure>({\n addon,\n name,\n files,\n call,\n failWith,\n}: AddonCall<Addon, Result, Failure>): Effect.Effect<Result, Failure> =>\n addon.pipe(\n Effect.flatMap((loaded) =>\n Effect.try({ try: () => call(loaded), catch: failWith(`${name} could not lint`) }).pipe(\n Effect.tap(() => Effect.promise(() => loaded.flushTelemetry())),\n ),\n ),\n Effect.withSpan(`${name}.native`, { attributes: { [`${name}.files`]: files } }),\n );\n","import { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServices } from \"@effect/platform-node/NodeServices\";\nimport {\n Array as Arr,\n Console,\n Effect,\n FileSystem,\n Function as Fn,\n Layer,\n Option,\n Path,\n String as Str,\n pipe,\n} from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\nimport { Otlp, OtlpSerialization } from \"effect/observability\";\nimport type { PlatformError } from \"effect/PlatformError\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport type { FailWith } from \"#/shared/lib/fail.ts\";\n\nconst CONFIG_FILES = [\"vite.config.ts\", \"vite.config.mts\", \"vite.config.js\", \"vite.config.mjs\"];\nconst FAILED = 1;\nconst DATA_FIRST_ARITY = 2;\nconst ARGUMENTS_START = 2;\n\nexport interface Reported {\n readonly severity: string;\n}\n\nexport interface LintCall<Config, Failure> {\n readonly root: string;\n readonly files: readonly string[];\n readonly projectFiles: readonly string[];\n readonly config: Config;\n readonly read: (file: string) => Effect.Effect<string, Failure>;\n}\n\nexport interface PathspecRequest<Config> {\n readonly config: Config;\n readonly patterns?: readonly string[];\n}\n\nexport interface SectionSource<Config, Failure> {\n readonly name: string;\n readonly section: (config: unknown) => Config;\n readonly failWith: FailWith<Failure>;\n}\n\nexport interface Cli<Config, Found extends Reported, Failure> extends SectionSource<\n Config,\n Failure\n> {\n readonly pathspecs: (request: PathspecRequest<Config>) => readonly string[];\n readonly lint: (call: LintCall<Config, Failure>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\nexport interface ToolCall<Config> {\n readonly root: string;\n readonly config: Config;\n readonly args: readonly string[];\n}\n\nexport interface Tool<Config, Found, Failure> extends SectionSource<Config, Failure> {\n readonly scan: (call: ToolCall<Config>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\ntype CliServices = FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner;\n\nconst readSectionIn = <Config, Failure>(\n source: SectionSource<Config, Failure>,\n root: string,\n): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* readConfig() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const found = yield* pipe(\n CONFIG_FILES,\n Arr.map((name) => path.join(root, name)),\n Effect.filter((file) => fileSystem.exists(file).pipe(Effect.orElseSucceed(() => false))),\n );\n const loaded = yield* Option.match(Arr.head(found), {\n onNone: () => Effect.succeed<unknown>({}),\n onSome: (file) =>\n Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: source.failWith(`could not load ${file}`),\n }),\n });\n return source.section(loaded);\n }).pipe(Effect.withSpan(`${source.name}.config`));\n\n/** @internal */\nexport const readSection: {\n (\n root: string,\n ): <Config, Failure>(\n source: SectionSource<Config, Failure>,\n ) => Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path>;\n <Config, Failure>(\n source: SectionSource<Config, Failure>,\n root: string,\n ): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path>;\n} = Fn.dual(DATA_FIRST_ARITY, readSectionIn);\n\nconst trackedFiles = (\n root: string,\n pathspecs: readonly string[],\n): Effect.Effect<readonly string[], PlatformError, ChildProcessSpawner.ChildProcessSpawner> =>\n Effect.gen(function* listFiles() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const output = yield* spawner.string(\n ChildProcess.make(\n \"git\",\n [\"ls-files\", \"-co\", \"--exclude-standard\", \"-z\", \"--\", ...pathspecs],\n { cwd: root },\n ),\n );\n return pipe(Str.split(output, \"\\0\"), Arr.filter(Str.isNonEmpty));\n });\n\nconst requestOf = <Config>(config: Config, patterns: readonly string[]): PathspecRequest<Config> =>\n Arr.match(patterns, {\n onEmpty: () => ({ config }),\n onNonEmpty: (given) => ({ config, patterns: given }),\n });\n\nconst hasError = (found: readonly Reported[]): boolean =>\n pipe(\n found,\n Arr.some(({ severity }) => severity === \"error\"),\n );\n\nconst failWhen = (failed: boolean): Effect.Effect<void> =>\n Effect.when(\n Effect.sync(() => {\n process.exitCode = FAILED;\n }),\n Effect.succeed(failed),\n ).pipe(Effect.asVoid);\n\nconst printAll = <Found>(\n found: readonly Found[],\n format: (found: Found) => string,\n): Effect.Effect<void> =>\n Arr.match(found, {\n onEmpty: () => Effect.void,\n onNonEmpty: (all) => Console.log(pipe(all, Arr.map(format), Arr.join(\"\\n\"))),\n });\n\nconst readerIn = <Failure>(\n root: string,\n failWith: FailWith<Failure>,\n): Effect.Effect<\n (file: string) => Effect.Effect<string, Failure>,\n never,\n FileSystem.FileSystem | Path.Path\n> =>\n Effect.gen(function* reader() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n return (file: string): Effect.Effect<string, Failure> =>\n fileSystem\n .readFileString(path.resolve(root, file))\n .pipe(Effect.mapError(failWith(`could not read ${file}`)));\n });\n\nconst mainOf = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): Effect.Effect<void, Failure | PlatformError, CliServices> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* readSectionIn(cli, root);\n const patterns = process.argv.slice(ARGUMENTS_START);\n const pathspecs = cli.pathspecs(requestOf(config, patterns));\n const { files, projectFiles } = yield* Effect.all(\n {\n files: trackedFiles(root, pathspecs).pipe(Effect.withSpan(`${cli.name}.files`)),\n projectFiles: trackedFiles(root, []).pipe(Effect.withSpan(`${cli.name}.project`)),\n },\n { concurrency: \"unbounded\" },\n );\n const read = yield* readerIn(root, cli.failWith);\n const found = yield* cli.lint({ root, files, projectFiles, config, read });\n yield* printAll(found, cli.format);\n yield* failWhen(hasError(found));\n });\n\nconst toolMainOf = <Config, Found, Failure>(\n tool: Tool<Config, Found, Failure>,\n): Effect.Effect<void, Failure | PlatformError, CliServices> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* readSectionIn(tool, root);\n const found = yield* tool.scan({ root, config, args: process.argv.slice(ARGUMENTS_START) });\n yield* printAll(found, tool.format);\n yield* failWhen(Arr.isReadonlyArrayNonEmpty(found));\n });\n\nconst runTraced = <Failure>(\n name: string,\n program: Effect.Effect<void, Failure, CliServices>,\n): void => {\n const services = Otlp.layerFromConfig({ resource: { serviceName: name } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n Layer.provideMerge(nodeServices),\n );\n runMain(program.pipe(Effect.provide(services)));\n};\n\nexport const runCli = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): void => {\n runTraced(cli.name, mainOf(cli));\n};\n\nexport const runTool = <Config, Found, Failure>(tool: Tool<Config, Found, Failure>): void => {\n runTraced(tool.name, toolMainOf(tool));\n};\n","import { Function as Fn, Option } from \"effect\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const present: {\n <Value, Fields extends object>(\n build: (value: Value) => Fields,\n ): (value: Option.Option<Value>) => Partial<Fields>;\n <Value, Fields extends object>(\n value: Option.Option<Value>,\n build: (value: Value) => Fields,\n ): Partial<Fields>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n <Value, Fields extends object>(\n value: Option.Option<Value>,\n build: (value: Value) => Fields,\n ): Partial<Fields> => Option.match(value, { onNone: (): Partial<Fields> => ({}), onSome: build }),\n);\n","import { Array as Arr, Boolean as Bool, Effect, Order } from \"effect\";\nimport type { Option } from \"effect\";\n\nconst SAMPLED = \"01\";\nconst NOT_SAMPLED = \"00\";\n\nexport interface Positioned {\n readonly path: string;\n readonly line: number;\n readonly column?: number;\n}\n\nconst LINE_START = 0;\n\nconst flagsOf = (sampled: boolean): string =>\n Bool.match(sampled, { onFalse: () => NOT_SAMPLED, onTrue: () => SAMPLED });\n\nexport const traceparent: Effect.Effect<Option.Option<string>> = Effect.currentSpan.pipe(\n Effect.map((span) => `00-${span.traceId}-${span.spanId}-${flagsOf(span.sampled)}`),\n Effect.option,\n);\n\nconst byPosition: Order.Order<Positioned> = Order.combine(\n Order.mapInput(Order.String, (found: Positioned) => found.path),\n Order.combine(\n Order.mapInput(Order.Number, (found: Positioned) => found.line),\n Order.mapInput(Order.Number, (found: Positioned) => found.column ?? LINE_START),\n ),\n);\n\nexport const sortByPosition = <Found extends Positioned>(found: readonly Found[]): Found[] =>\n Arr.sort(found, byPosition);\n","import { Schema } from \"effect\";\n\nexport interface H56mRule {\n readonly id: string;\n readonly description?: string;\n readonly keywords?: readonly string[];\n readonly regex?: string;\n readonly path?: string;\n readonly valueGroup?: number;\n readonly specificity?: number;\n readonly tags?: readonly string[];\n readonly skipReport?: boolean;\n readonly filter?: string;\n readonly confidence?: \"low\" | \"medium\" | \"high\";\n}\n\nexport interface H56mExtend {\n readonly path?: string;\n readonly disabledRules?: readonly string[];\n}\n\nexport interface H56mConfig {\n readonly extend?: H56mExtend;\n readonly maxDecodeDepth?: number;\n readonly prefilter?: string;\n readonly filter?: string;\n readonly rules?: readonly H56mRule[];\n readonly ignoredSecrets?: readonly string[];\n}\n\nexport const FindingSchema = Schema.Struct({\n rule: Schema.String,\n description: Schema.String,\n confidence: Schema.Literals([\"low\", \"medium\", \"high\"]),\n path: Schema.String,\n line: Schema.Int,\n column: Schema.Int,\n endLine: Schema.Int,\n endColumn: Schema.Int,\n secret: Schema.String,\n digest: Schema.String,\n commit: Schema.optionalKey(Schema.String),\n encoded: Schema.Boolean,\n});\n\nexport type Finding = typeof FindingSchema.Type;\n\nexport type GitSource =\n | { readonly type: \"history\"; readonly bases?: readonly string[]; readonly head: string }\n | { readonly type: \"staged\" }\n | { readonly type: \"snapshot\"; readonly revision: string };\n","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class H56mError extends taggedError<H56mError, { readonly brand: unique symbol }>()(\n \"H56mError\",\n { message: Schema.String },\n) {}\n\nexport const failedWith =\n (message: string) =>\n (cause: unknown): H56mError =>\n H56mError.make({ message: `${message}: ${String(cause)}` });\n","import { loadAddon } from \"@masseater.dev/lint-host\";\nimport { Predicate } from \"effect\";\nimport type { Effect } from \"effect\";\n\nimport type { H56mConfig } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { H56mError } from \"#/shared/lib/errors.ts\";\n\nexport interface DetectorInput {\n readonly config: Omit<H56mConfig, \"ignoredSecrets\">;\n readonly ignored: readonly string[];\n readonly traceparent?: string;\n}\n\nexport interface TextInput {\n readonly path: string;\n readonly text: string;\n readonly traceparent?: string;\n}\n\nexport interface GitInput {\n readonly root: string;\n readonly source: unknown;\n readonly traceparent?: string;\n}\n\nexport interface NativeDetector {\n readonly scan: (input: TextInput) => unknown;\n readonly scanGit: (input: GitInput) => unknown;\n}\n\nexport interface Native {\n readonly SecretDetector: new (input: DetectorInput) => NativeDetector;\n readonly flushTelemetry: () => Promise<void>;\n}\n\nconst isNative = (value: unknown): value is Native =>\n Predicate.hasProperty(value, \"SecretDetector\") &&\n Predicate.isFunction(value.SecretDetector) &&\n Predicate.hasProperty(value, \"flushTelemetry\") &&\n Predicate.isFunction(value.flushTelemetry);\n\nexport const native: Effect.Effect<Native, H56mError> = loadAddon({\n packageName: \"@r_masseater/h56m\",\n binary: \"h56m\",\n from: import.meta.url,\n isAddon: isNative,\n failWith: failedWith,\n});\n","import { callAddon, traceparent } from \"@masseater.dev/lint-host\";\nimport { Effect, Option, Schema } from \"effect\";\n\nimport { FindingSchema } from \"#/shared/config/index.ts\";\nimport type { Finding, GitSource, H56mConfig } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { H56mError } from \"#/shared/lib/errors.ts\";\nimport { native } from \"#/shared/native/index.ts\";\nimport type { NativeDetector } from \"#/shared/native/index.ts\";\n\nconst ONE_FILE = 1;\nconst WHOLE_REPOSITORY = 0;\n\nconst decodeFindings = Schema.decodeUnknownEffect(Schema.Array(FindingSchema));\n\nexport interface TextScan {\n readonly path: string;\n readonly text: string;\n}\n\nexport interface GitScan {\n readonly root: string;\n readonly source: GitSource;\n}\n\nexport interface Detector {\n readonly scanText: (scan: TextScan) => Effect.Effect<readonly Finding[], H56mError>;\n readonly scanGit: (scan: GitScan) => Effect.Effect<readonly Finding[], H56mError>;\n}\n\ntype Traced<Input> = Input | (Input & { readonly traceparent: string });\n\nconst withParent = <Input extends object>(input: Input): Effect.Effect<Traced<Input>> =>\n traceparent.pipe(\n Effect.map(\n Option.match({\n onNone: (): Traced<Input> => input,\n onSome: (value): Traced<Input> => ({ ...input, traceparent: value }),\n }),\n ),\n );\n\ninterface NativeScan {\n readonly name: string;\n readonly files: number;\n readonly call: () => unknown;\n}\n\nconst run = ({ name, files, call }: NativeScan): Effect.Effect<readonly Finding[], H56mError> =>\n callAddon({ addon: native, name, files, call, failWith: failedWith }).pipe(\n Effect.flatMap((found) =>\n decodeFindings(found).pipe(Effect.mapError(failedWith(\"h56m returned an unknown shape\"))),\n ),\n );\n\nconst scannerOf = (detector: NativeDetector): Detector => ({\n scanText: (scan) =>\n withParent(scan).pipe(\n Effect.flatMap((input) =>\n run({ name: \"h56m.text\", files: ONE_FILE, call: () => detector.scan(input) }),\n ),\n Effect.withSpan(\"h56m.scan_text\"),\n ),\n scanGit: (scan) =>\n withParent(scan).pipe(\n Effect.flatMap((input) =>\n run({ name: \"h56m.git\", files: WHOLE_REPOSITORY, call: () => detector.scanGit(input) }),\n ),\n Effect.withSpan(\"h56m.scan_git\", { attributes: { \"h56m.source\": scan.source.type } }),\n ),\n});\n\nexport const makeDetector = Effect.fn(\"h56m.detector\")(function* makeDetector(\n config: H56mConfig = {},\n) {\n const { ignoredSecrets = [], ...rest } = config;\n const input = yield* withParent({ config: rest, ignored: ignoredSecrets });\n const detector = yield* callAddon({\n addon: native,\n name: \"h56m\",\n files: WHOLE_REPOSITORY,\n call: (addon) => new addon.SecretDetector(input),\n failWith: failedWith,\n });\n return scannerOf(detector);\n});\n","import { Option, String as Str, pipe } from \"effect\";\n\nimport type { Finding } from \"#/shared/config/index.ts\";\n\nconst START = 0;\nconst SHORT_COMMIT = 12;\n\nconst commitOf = (finding: Finding): string =>\n pipe(\n Option.fromNullishOr(finding.commit),\n Option.map((commit) => ` (${Str.slice(START, SHORT_COMMIT)(commit)})`),\n Option.getOrElse(() => \"\"),\n );\n\nexport const format = (finding: Finding): string =>\n `${finding.path}:${String(finding.line)}:${String(finding.column)} ${finding.rule} ${finding.description} sha256:${finding.digest}${commitOf(finding)}`;\n","import { Option, Predicate, pipe } from \"effect\";\n\nimport type { H56mConfig } from \"#/shared/config/index.ts\";\n\nconst hasSection = (value: unknown): value is { readonly h56m: H56mConfig } =>\n Predicate.hasProperty(value, \"h56m\") && Predicate.isObject(value.h56m);\n\nexport const h56mSection = (config: unknown): H56mConfig =>\n pipe(\n Option.liftPredicate(config, hasSection),\n Option.map((value) => value.h56m),\n Option.getOrElse((): H56mConfig => ({})),\n );\n"],"mappings":";;;;;;;;;AAEA,MAAM,SAAS,aACb,MAAM,MAAM,QAAQ,CAAC,CAAC,KACpB,MAAM,KAAK,eAAe,MAAM,GAChC,MAAM,KAAK,eAAe,OAAO,GACjC,MAAM,aAAa,EAAE,CACvB;AAEF,MAAa,iBAAiB,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,MAAM,QAAQ,QAAQ;AAE1F,MAAa,eAAe,WAA2B,GAAG,OAAO,GAAG,eAAe;;ACJnF,MAAMA,gBAAc,OAAO;AAE3B,IAAM,mBAAN,cAA+BA,cAAiE,CAAC,CAC/F,oBACA,EAAE,SAAS,OAAO,OAAO,CAC3B,CAAC,CAAC,CAAC;AAEH,MAAM,UAA8D;CAClE,QAAQ,SAAS,MAAM,KAAK;CAC5B,SAAS,SAAS,MAAM,KAAK;CAC7B,QAAQ,SAAS,GAAG,KAAK;AAC3B;AAEA,MAAM,UAAU;AAShB,MAAM,QAAQ,OAAO,GAAG,OAAO,CAAC,CAAC,UAAU,MAAM,OAAe,WAAmB;CAEjF,MAAM,WAAW,QAAO,OADD,oBAAoB,oBAAA,CACX,SAC9B,aAAa,KAAK,SAAS;EA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M,GACnC,OAAO,KAAK,WAAW,KAAKC,SAAI,MAAM,OAAO,YAAY,CAAC,CAAC,MAAM,EAAE,EAAE,GACrE,OAAO,gBAAgB,EAAE,CAC3B;AAEF,MAAa,UAAU,YACrB,GAAG,QAAQ,KAAK,GAAG,OAAO,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,MAAM,EAAE,GAAG,QAAQ,KAAK,GAAG,QAAQ,YAAY,UAAU,QAAQ,SAAS,SAAS,OAAO;;ACXtJ,MAAM,cAAc,UAClB,UAAU,YAAY,OAAO,MAAM,KAAK,UAAU,SAAS,MAAM,IAAI;AAEvE,MAAa,eAAe,WAC1B,KACE,OAAO,cAAc,QAAQ,UAAU,GACvC,OAAO,KAAK,UAAU,MAAM,IAAI,GAChC,OAAO,iBAA6B,CAAC,EAAE,CACzC"}
package/dist/vite.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { r as H56mConfig } from "./index-DiF7IoP4.mjs";
1
+ import { r as H56mConfig } from "./index-C3x2L0fZ.mjs";
2
2
  declare module "vite" {
3
3
  interface UserConfig {
4
4
  readonly h56m?: H56mConfig;
package/logo.svg ADDED
@@ -0,0 +1,7 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="68 70 384 384">
2
+ <rect width="512" height="512" fill="#1C2440"/>
3
+ <circle cx="324" cy="160" r="84" fill="#F6F1E4"/>
4
+ <path d="M28 296 C 112 206, 206 352, 300 292 C 204 384, 120 300, 46 384 Z" fill="#EE8FB5"/>
5
+ <path d="M300 292 C 362 244, 420 232, 484 132 L 492 214 C 440 284, 380 306, 300 292 Z" fill="#F7C3D7"/>
6
+ <path d="M60 456 C 160 384, 244 474, 340 400 C 398 356, 440 364, 486 312 L 490 344 C 444 390, 404 384, 352 424 C 252 500, 170 416, 60 456 Z" fill="#9FD8E6"/>
7
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r_masseater/h56m",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "A secret scanner engine written in Rust that scans git history, the staged changes or any text with Betterleaks-format rules from a preset, configured from vite.config.ts.",
5
5
  "keywords": [
6
6
  "betterleaks",
@@ -14,7 +14,7 @@
14
14
  "bugs": {
15
15
  "url": "https://github.com/masseater/masseater.dev/issues"
16
16
  },
17
- "license": "MIT AND Apache-2.0 AND CC-BY-SA-4.0",
17
+ "license": "MIT AND CC-BY-SA-4.0",
18
18
  "repository": {
19
19
  "type": "git",
20
20
  "url": "git+https://github.com/masseater/masseater.dev.git",
@@ -27,6 +27,7 @@
27
27
  "LICENSE",
28
28
  "THIRD-PARTY-NOTICES.txt",
29
29
  "dist",
30
+ "logo.svg",
30
31
  "skills/scan-secrets"
31
32
  ],
32
33
  "type": "module",
@@ -49,14 +50,14 @@
49
50
  "provenance": true
50
51
  },
51
52
  "dependencies": {
52
- "@effect/platform-node": "^4.1.4"
53
+ "@effect/platform-node": "^4.1.5"
53
54
  },
54
55
  "devDependencies": {
55
- "@effect/vitest": "4.1.4",
56
+ "@effect/vitest": "4.1.5",
56
57
  "@masseater.dev/lint-host": "0.0.0",
57
- "@r_masseater/vitest-otlp": "0.2.0",
58
+ "@r_masseater/vitest-otlp": "0.2.2",
58
59
  "@types/node": "26.6.6",
59
- "effect": "4.1.4",
60
+ "effect": "4.1.5",
60
61
  "vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000",
61
62
  "vite-plus": "1.7.0"
62
63
  },
@@ -74,7 +75,7 @@
74
75
  }
75
76
  },
76
77
  "engines": {
77
- "node": ">=26"
78
+ "node": "v26.13.1"
78
79
  },
79
80
  "native": {
80
81
  "binary": "h56m",
@@ -84,8 +85,8 @@
84
85
  ]
85
86
  },
86
87
  "optionalDependencies": {
87
- "@r_masseater/h56m-linux-x64-gnu": "0.1.0",
88
- "@r_masseater/h56m-win32-x64-msvc": "0.1.0"
88
+ "@r_masseater/h56m-linux-x64-gnu": "0.2.0",
89
+ "@r_masseater/h56m-win32-x64-msvc": "0.2.0"
89
90
  },
90
91
  "scripts": {}
91
92
  }
@@ -16,7 +16,7 @@ sources:
16
16
 
17
17
  # scan-secrets
18
18
 
19
- h56m finds secrets with the Kingfisher engine. It has no rules of its own, so extend a preset from
19
+ h56m finds secrets with its own engine, which follows Betterleaks. It has no rules of its own, so extend a preset from
20
20
  `@r_masseater/h56m-presets` or a TOML file of your own. It never sends a secret anywhere to check
21
21
  whether it is live.
22
22
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"section-AeJ2zzPN.mjs","names":["taggedError","Rec","Str","DATA_FIRST_ARITY","Arr","Fn","Fn","Bool","Str"],"sources":["../../lint-host/src/shared/lib/target.ts","../../lint-host/src/features/build-addon/model/build.ts","../../lint-host/src/features/load-addon/model/load.ts","../../lint-host/src/features/run-cli/model/cli.ts","../../lint-host/src/shared/lib/present.ts","../../lint-host/src/shared/lib/trace.ts","../src/shared/config/types.ts","../src/shared/lib/errors.ts","../src/shared/native/index.ts","../src/app/detector.ts","../src/app/format.ts","../src/app/section.ts"],"sourcesContent":["import { Match } from \"effect\";\n\nconst abiOf = (platform: string): string =>\n Match.value(platform).pipe(\n Match.when(\"linux\", () => \"-gnu\"),\n Match.when(\"win32\", () => \"-msvc\"),\n Match.orElse(() => \"\"),\n );\n\nexport const platformTarget = `${process.platform}-${process.arch}${abiOf(process.platform)}`;\n\nexport const addonFileOf = (binary: string): string => `${binary}.${platformTarget}.node`;\n","import { NodeServices } from \"@effect/platform-node\";\nimport { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { Effect, FileSystem, Path, Record as Rec, Schema, String as Str } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport { addonFileOf } from \"#/shared/lib/target.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nclass AddonBuildFailed extends taggedError<AddonBuildFailed, { readonly brand: unique symbol }>()(\n \"AddonBuildFailed\",\n { message: Schema.String },\n) {}\n\nconst LIBRARY: Readonly<Record<string, (name: string) => string>> = {\n linux: (name) => `lib${name}.so`,\n darwin: (name) => `lib${name}.dylib`,\n win32: (name) => `${name}.dll`,\n};\n\nconst SUCCESS = 0;\n\nexport interface AddonBuild {\n readonly crate: string;\n readonly binary: string;\n readonly packageDir: string;\n readonly workspaceDir: string;\n}\n\nconst cargo = Effect.fn(\"cargo\")(function* cargo(crate: string, workspace: string) {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const exitCode = yield* spawner.exitCode(\n ChildProcess.make(\"cargo\", [\"build\", \"--release\", \"--locked\", \"-p\", crate], {\n cwd: workspace,\n stdout: \"inherit\",\n stderr: \"inherit\",\n }),\n );\n const failure = AddonBuildFailed.make({ message: `cargo exited with ${String(exitCode)}` });\n yield* Effect.when(\n Effect.fail(failure),\n Effect.sync(() => Number(exitCode) !== SUCCESS),\n );\n});\n\nconst build = Effect.fn(\"buildAddon\")(function* build(options: AddonBuild) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const library = yield* Effect.fromOption(Rec.get(LIBRARY, process.platform)).pipe(\n Effect.mapError(() =>\n AddonBuildFailed.make({ message: `no native build for ${process.platform}` }),\n ),\n );\n yield* cargo(options.crate, options.workspaceDir);\n const output = path.join(options.packageDir, \"native\");\n yield* fileSystem.makeDirectory(output, { recursive: true });\n const built = library(Str.replaceAll(\"-\", \"_\")(options.crate));\n yield* fileSystem.copyFile(\n path.join(options.workspaceDir, \"target\", \"release\", built),\n path.join(output, addonFileOf(options.binary)),\n );\n});\n\nexport const buildAddon = (options: AddonBuild): void => {\n runMain(build(options).pipe(Effect.provide(NodeServices.layer)));\n};\n","import { createRequire } from \"node:module\";\n\nimport { Effect } from \"effect\";\n\nimport type { FailWith } from \"#/shared/lib/fail.ts\";\nimport { addonFileOf, platformTarget } from \"#/shared/lib/target.ts\";\n\nexport interface AddonSource<Addon, Failure> {\n readonly packageName: string;\n readonly binary: string;\n readonly from: string;\n readonly isAddon: (value: unknown) => value is Addon;\n readonly failWith: FailWith<Failure>;\n}\n\nexport const loadAddon = <Addon, Failure>({\n packageName,\n binary,\n from,\n isAddon,\n failWith,\n}: AddonSource<Addon, Failure>): Effect.Effect<Addon, Failure> => {\n const requireFrom = createRequire(from);\n const loadFrom = (specifier: string): Effect.Effect<unknown, Failure> =>\n Effect.try({\n try: (): unknown => requireFrom(specifier),\n catch: failWith(`could not load ${specifier}`),\n });\n return loadFrom(`${packageName}-${platformTarget}`).pipe(\n Effect.catchCause(() => loadFrom(`${packageName}/native/${addonFileOf(binary)}`)),\n Effect.filterOrFail(isAddon, (found) =>\n failWith(`no ${binary} addon for ${platformTarget}`)(found),\n ),\n );\n};\n\nexport interface Telemetered {\n readonly flushTelemetry: () => Promise<void>;\n}\n\nexport interface AddonCall<Addon extends Telemetered, Result, Failure> {\n readonly addon: Effect.Effect<Addon, Failure>;\n readonly name: string;\n readonly files: number;\n readonly call: (addon: Addon) => Result;\n readonly failWith: FailWith<Failure>;\n}\n\nexport const callAddon = <Addon extends Telemetered, Result, Failure>({\n addon,\n name,\n files,\n call,\n failWith,\n}: AddonCall<Addon, Result, Failure>): Effect.Effect<Result, Failure> =>\n addon.pipe(\n Effect.flatMap((loaded) =>\n Effect.try({ try: () => call(loaded), catch: failWith(`${name} could not lint`) }).pipe(\n Effect.tap(() => Effect.promise(() => loaded.flushTelemetry())),\n ),\n ),\n Effect.withSpan(`${name}.native`, { attributes: { [`${name}.files`]: files } }),\n );\n","import { NodeServices } from \"@effect/platform-node\";\nimport { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport {\n Array as Arr,\n Console,\n Effect,\n FileSystem,\n Function as Fn,\n Layer,\n Option,\n Path,\n String as Str,\n pipe,\n} from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\nimport { Otlp, OtlpSerialization } from \"effect/observability\";\nimport type { PlatformError } from \"effect/PlatformError\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport type { FailWith } from \"#/shared/lib/fail.ts\";\n\nconst CONFIG_FILES = [\"vite.config.ts\", \"vite.config.mts\", \"vite.config.js\", \"vite.config.mjs\"];\nconst FAILED = 1;\nconst DATA_FIRST_ARITY = 2;\nconst ARGUMENTS_START = 2;\n\nexport interface Reported {\n readonly severity: string;\n}\n\nexport interface LintCall<Config> {\n readonly root: string;\n readonly files: readonly string[];\n readonly projectFiles: readonly string[];\n readonly config: Config;\n}\n\nexport interface PathspecRequest<Config> {\n readonly config: Config;\n readonly patterns?: readonly string[];\n}\n\nexport interface SectionSource<Config, Failure> {\n readonly name: string;\n readonly section: (config: unknown) => Config;\n readonly failWith: FailWith<Failure>;\n}\n\nexport interface Cli<Config, Found extends Reported, Failure> extends SectionSource<\n Config,\n Failure\n> {\n readonly pathspecs: (request: PathspecRequest<Config>) => readonly string[];\n readonly lint: (call: LintCall<Config>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\nexport interface ToolCall<Config> {\n readonly root: string;\n readonly config: Config;\n readonly args: readonly string[];\n}\n\nexport interface Tool<Config, Found, Failure> extends SectionSource<Config, Failure> {\n readonly scan: (call: ToolCall<Config>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\ntype CliServices = FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner;\n\nconst readSectionIn = <Config, Failure>(\n source: SectionSource<Config, Failure>,\n root: string,\n): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* readConfig() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const found = yield* pipe(\n CONFIG_FILES,\n Arr.map((name) => path.join(root, name)),\n Effect.filter((file) => fileSystem.exists(file).pipe(Effect.orElseSucceed(() => false))),\n );\n const loaded = yield* Option.match(Arr.head(found), {\n onNone: () => Effect.succeed<unknown>({}),\n onSome: (file) =>\n Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: source.failWith(`could not load ${file}`),\n }),\n });\n return source.section(loaded);\n }).pipe(Effect.withSpan(`${source.name}.config`));\n\n/** @internal */\nexport const readSection: {\n (\n root: string,\n ): <Config, Failure>(\n source: SectionSource<Config, Failure>,\n ) => Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path>;\n <Config, Failure>(\n source: SectionSource<Config, Failure>,\n root: string,\n ): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path>;\n} = Fn.dual(DATA_FIRST_ARITY, readSectionIn);\n\nconst trackedFiles = (\n root: string,\n pathspecs: readonly string[],\n): Effect.Effect<readonly string[], PlatformError, ChildProcessSpawner.ChildProcessSpawner> =>\n Effect.gen(function* listFiles() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const output = yield* spawner.string(\n ChildProcess.make(\n \"git\",\n [\"ls-files\", \"-co\", \"--exclude-standard\", \"-z\", \"--\", ...pathspecs],\n { cwd: root },\n ),\n );\n return pipe(Str.split(output, \"\\0\"), Arr.filter(Str.isNonEmpty));\n });\n\nconst requestOf = <Config>(config: Config, patterns: readonly string[]): PathspecRequest<Config> =>\n Arr.match(patterns, {\n onEmpty: () => ({ config }),\n onNonEmpty: (given) => ({ config, patterns: given }),\n });\n\nconst hasError = (found: readonly Reported[]): boolean =>\n pipe(\n found,\n Arr.some(({ severity }) => severity === \"error\"),\n );\n\nconst failWhen = (failed: boolean): Effect.Effect<void> =>\n Effect.when(\n Effect.sync(() => {\n process.exitCode = FAILED;\n }),\n Effect.succeed(failed),\n ).pipe(Effect.asVoid);\n\nconst printAll = <Found>(\n found: readonly Found[],\n format: (found: Found) => string,\n): Effect.Effect<void> =>\n Arr.match(found, {\n onEmpty: () => Effect.void,\n onNonEmpty: (all) => Console.log(pipe(all, Arr.map(format), Arr.join(\"\\n\"))),\n });\n\nconst mainOf = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): Effect.Effect<void, Failure | PlatformError, CliServices> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* readSectionIn(cli, root);\n const patterns = process.argv.slice(ARGUMENTS_START);\n const files = yield* trackedFiles(root, cli.pathspecs(requestOf(config, patterns))).pipe(\n Effect.withSpan(`${cli.name}.files`),\n );\n const projectFiles = yield* trackedFiles(root, []).pipe(Effect.withSpan(`${cli.name}.project`));\n const found = yield* cli.lint({ root, files, projectFiles, config });\n yield* printAll(found, cli.format);\n yield* failWhen(hasError(found));\n });\n\nconst toolMainOf = <Config, Found, Failure>(\n tool: Tool<Config, Found, Failure>,\n): Effect.Effect<void, Failure | PlatformError, CliServices> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* readSectionIn(tool, root);\n const found = yield* tool.scan({ root, config, args: process.argv.slice(ARGUMENTS_START) });\n yield* printAll(found, tool.format);\n yield* failWhen(Arr.isReadonlyArrayNonEmpty(found));\n });\n\nconst runTraced = <Failure>(\n name: string,\n program: Effect.Effect<void, Failure, CliServices>,\n): void => {\n const services = Otlp.layerFromConfig({ resource: { serviceName: name } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n Layer.provideMerge(NodeServices.layer),\n );\n runMain(program.pipe(Effect.provide(services)));\n};\n\nexport const runCli = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): void => {\n runTraced(cli.name, mainOf(cli));\n};\n\nexport const runTool = <Config, Found, Failure>(tool: Tool<Config, Found, Failure>): void => {\n runTraced(tool.name, toolMainOf(tool));\n};\n","import { Function as Fn, Option } from \"effect\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const present: {\n <Value, Fields extends object>(\n build: (value: Value) => Fields,\n ): (value: Option.Option<Value>) => Partial<Fields>;\n <Value, Fields extends object>(\n value: Option.Option<Value>,\n build: (value: Value) => Fields,\n ): Partial<Fields>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n <Value, Fields extends object>(\n value: Option.Option<Value>,\n build: (value: Value) => Fields,\n ): Partial<Fields> => Option.match(value, { onNone: (): Partial<Fields> => ({}), onSome: build }),\n);\n","import { Array as Arr, Boolean as Bool, Effect, Order } from \"effect\";\nimport type { Option } from \"effect\";\n\nconst SAMPLED = \"01\";\nconst NOT_SAMPLED = \"00\";\n\nexport interface Positioned {\n readonly path: string;\n readonly line: number;\n}\n\nconst flagsOf = (sampled: boolean): string =>\n Bool.match(sampled, { onFalse: () => NOT_SAMPLED, onTrue: () => SAMPLED });\n\nexport const traceparent: Effect.Effect<Option.Option<string>> = Effect.currentSpan.pipe(\n Effect.map((span) => `00-${span.traceId}-${span.spanId}-${flagsOf(span.sampled)}`),\n Effect.option,\n);\n\nconst byPosition: Order.Order<Positioned> = Order.combine(\n Order.mapInput(Order.String, (found: Positioned) => found.path),\n Order.mapInput(Order.Number, (found: Positioned) => found.line),\n);\n\nexport const sortByPosition = <Found extends Positioned>(found: readonly Found[]): Found[] =>\n Arr.sort(found, byPosition);\n","import { Schema } from \"effect\";\n\nexport interface H56mRule {\n readonly id: string;\n readonly description?: string;\n readonly keywords?: readonly string[];\n readonly regex?: string;\n readonly path?: string;\n readonly valueGroup?: number;\n readonly specificity?: number;\n readonly tags?: readonly string[];\n readonly skipReport?: boolean;\n readonly filter?: string;\n readonly confidence?: \"low\" | \"medium\" | \"high\";\n}\n\nexport interface H56mExtend {\n readonly path?: string;\n readonly disabledRules?: readonly string[];\n}\n\nexport interface H56mConfig {\n readonly extend?: H56mExtend;\n readonly prefilter?: string;\n readonly filter?: string;\n readonly rules?: readonly H56mRule[];\n readonly ignoredSecrets?: readonly string[];\n}\n\nexport const FindingSchema = Schema.Struct({\n rule: Schema.String,\n description: Schema.String,\n confidence: Schema.Literals([\"low\", \"medium\", \"high\"]),\n path: Schema.String,\n line: Schema.Int,\n column: Schema.Int,\n endLine: Schema.Int,\n endColumn: Schema.Int,\n secret: Schema.String,\n digest: Schema.String,\n commit: Schema.optionalKey(Schema.String),\n encoded: Schema.Boolean,\n});\n\nexport type Finding = typeof FindingSchema.Type;\n\nexport type GitSource =\n | { readonly type: \"history\"; readonly bases?: readonly string[]; readonly head: string }\n | { readonly type: \"staged\" }\n | { readonly type: \"snapshot\"; readonly revision: string };\n","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class H56mError extends taggedError<H56mError, { readonly brand: unique symbol }>()(\n \"H56mError\",\n { message: Schema.String },\n) {}\n\nexport const failedWith =\n (message: string) =>\n (cause: unknown): H56mError =>\n H56mError.make({ message: `${message}: ${String(cause)}` });\n","import { loadAddon } from \"@masseater.dev/lint-host\";\nimport { Predicate } from \"effect\";\nimport type { Effect } from \"effect\";\n\nimport type { H56mConfig } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { H56mError } from \"#/shared/lib/errors.ts\";\n\nexport interface DetectorInput {\n readonly config: Omit<H56mConfig, \"ignoredSecrets\">;\n readonly ignored: readonly string[];\n readonly traceparent?: string;\n}\n\nexport interface TextInput {\n readonly path: string;\n readonly text: string;\n readonly traceparent?: string;\n}\n\nexport interface GitInput {\n readonly root: string;\n readonly source: unknown;\n readonly traceparent?: string;\n}\n\nexport interface NativeDetector {\n readonly scan: (input: TextInput) => unknown;\n readonly scanGit: (input: GitInput) => unknown;\n}\n\nexport interface Native {\n readonly SecretDetector: new (input: DetectorInput) => NativeDetector;\n readonly flushTelemetry: () => Promise<void>;\n}\n\nconst isNative = (value: unknown): value is Native =>\n Predicate.hasProperty(value, \"SecretDetector\") &&\n Predicate.isFunction(value.SecretDetector) &&\n Predicate.hasProperty(value, \"flushTelemetry\") &&\n Predicate.isFunction(value.flushTelemetry);\n\nexport const native: Effect.Effect<Native, H56mError> = loadAddon({\n packageName: \"@r_masseater/h56m\",\n binary: \"h56m\",\n from: import.meta.url,\n isAddon: isNative,\n failWith: failedWith,\n});\n","import { callAddon, traceparent } from \"@masseater.dev/lint-host\";\nimport { Effect, Option, Schema } from \"effect\";\n\nimport { FindingSchema } from \"#/shared/config/index.ts\";\nimport type { Finding, GitSource, H56mConfig } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { H56mError } from \"#/shared/lib/errors.ts\";\nimport { native } from \"#/shared/native/index.ts\";\nimport type { NativeDetector } from \"#/shared/native/index.ts\";\n\nconst ONE_FILE = 1;\nconst WHOLE_REPOSITORY = 0;\n\nconst decodeFindings = Schema.decodeUnknownEffect(Schema.Array(FindingSchema));\n\nexport interface TextScan {\n readonly path: string;\n readonly text: string;\n}\n\nexport interface GitScan {\n readonly root: string;\n readonly source: GitSource;\n}\n\nexport interface Detector {\n readonly scanText: (scan: TextScan) => Effect.Effect<readonly Finding[], H56mError>;\n readonly scanGit: (scan: GitScan) => Effect.Effect<readonly Finding[], H56mError>;\n}\n\ntype Traced<Input> = Input | (Input & { readonly traceparent: string });\n\nconst withParent = <Input extends object>(input: Input): Effect.Effect<Traced<Input>> =>\n traceparent.pipe(\n Effect.map(\n Option.match({\n onNone: (): Traced<Input> => input,\n onSome: (value): Traced<Input> => ({ ...input, traceparent: value }),\n }),\n ),\n );\n\ninterface NativeScan {\n readonly name: string;\n readonly files: number;\n readonly call: () => unknown;\n}\n\nconst run = ({ name, files, call }: NativeScan): Effect.Effect<readonly Finding[], H56mError> =>\n callAddon({ addon: native, name, files, call, failWith: failedWith }).pipe(\n Effect.flatMap((found) =>\n decodeFindings(found).pipe(Effect.mapError(failedWith(\"h56m returned an unknown shape\"))),\n ),\n );\n\nconst scannerOf = (detector: NativeDetector): Detector => ({\n scanText: (scan) =>\n withParent(scan).pipe(\n Effect.flatMap((input) =>\n run({ name: \"h56m.text\", files: ONE_FILE, call: () => detector.scan(input) }),\n ),\n Effect.withSpan(\"h56m.scan_text\"),\n ),\n scanGit: (scan) =>\n withParent(scan).pipe(\n Effect.flatMap((input) =>\n run({ name: \"h56m.git\", files: WHOLE_REPOSITORY, call: () => detector.scanGit(input) }),\n ),\n Effect.withSpan(\"h56m.scan_git\", { attributes: { \"h56m.source\": scan.source.type } }),\n ),\n});\n\nexport const makeDetector = Effect.fn(\"h56m.detector\")(function* makeDetector(\n config: H56mConfig = {},\n) {\n const { ignoredSecrets = [], ...rest } = config;\n const input = yield* withParent({ config: rest, ignored: ignoredSecrets });\n const detector = yield* callAddon({\n addon: native,\n name: \"h56m\",\n files: WHOLE_REPOSITORY,\n call: (addon) => new addon.SecretDetector(input),\n failWith: failedWith,\n });\n return scannerOf(detector);\n});\n","import { Option, String as Str, pipe } from \"effect\";\n\nimport type { Finding } from \"#/shared/config/index.ts\";\n\nconst START = 0;\nconst SHORT_COMMIT = 12;\n\nconst commitOf = (finding: Finding): string =>\n pipe(\n Option.fromNullishOr(finding.commit),\n Option.map((commit) => ` (${Str.slice(START, SHORT_COMMIT)(commit)})`),\n Option.getOrElse(() => \"\"),\n );\n\nexport const format = (finding: Finding): string =>\n `${finding.path}:${String(finding.line)}:${String(finding.column)} ${finding.rule} ${finding.description} sha256:${finding.digest}${commitOf(finding)}`;\n","import { Option, Predicate, pipe } from \"effect\";\n\nimport type { H56mConfig } from \"#/shared/config/index.ts\";\n\nconst hasSection = (value: unknown): value is { readonly h56m: H56mConfig } =>\n Predicate.hasProperty(value, \"h56m\") && Predicate.isObject(value.h56m);\n\nexport const h56mSection = (config: unknown): H56mConfig =>\n pipe(\n Option.liftPredicate(config, hasSection),\n Option.map((value) => value.h56m),\n Option.getOrElse((): H56mConfig => ({})),\n );\n"],"mappings":";;;;;;;;;AAEA,MAAM,SAAS,aACb,MAAM,MAAM,QAAQ,CAAC,CAAC,KACpB,MAAM,KAAK,eAAe,MAAM,GAChC,MAAM,KAAK,eAAe,OAAO,GACjC,MAAM,aAAa,EAAE,CACvB;AAEF,MAAa,iBAAiB,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,MAAM,QAAQ,QAAQ;AAE1F,MAAa,eAAe,WAA2B,GAAG,OAAO,GAAG,eAAe;;ACJnF,MAAMA,gBAAc,OAAO;AAE3B,IAAM,mBAAN,cAA+BA,cAAiE,CAAC,CAC/F,oBACA,EAAE,SAAS,OAAO,OAAO,CAC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