lawcheck 0.0.0 → 0.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -2
- package/dist/args.js +168 -0
- package/dist/bin.cjs +20 -0
- package/dist/check.js +472 -0
- package/dist/cli.js +182 -0
- package/dist/config.js +278 -0
- package/dist/docs.js +41 -0
- package/dist/doctor.js +273 -0
- package/dist/environment.js +73 -0
- package/dist/explain.js +446 -0
- package/dist/files.js +388 -0
- package/dist/glob.js +268 -0
- package/dist/grammars/LICENSES.txt +353 -0
- package/dist/grammars/tree-sitter-c.wasm +0 -0
- package/dist/grammars/tree-sitter-c_sharp.wasm +0 -0
- package/dist/grammars/tree-sitter-cpp.wasm +0 -0
- package/dist/grammars/tree-sitter-go.wasm +0 -0
- package/dist/grammars/tree-sitter-java.wasm +0 -0
- package/dist/grammars/tree-sitter-javascript.wasm +0 -0
- package/dist/grammars/tree-sitter-kotlin.wasm +0 -0
- package/dist/grammars/tree-sitter-php.wasm +0 -0
- package/dist/grammars/tree-sitter-python.wasm +0 -0
- package/dist/grammars/tree-sitter-ruby.wasm +0 -0
- package/dist/grammars/tree-sitter-rust.wasm +0 -0
- package/dist/grammars/tree-sitter-tsx.wasm +0 -0
- package/dist/grammars/tree-sitter-typescript.wasm +0 -0
- package/dist/guard.js +179 -0
- package/dist/init.js +131 -0
- package/dist/keys.js +55 -0
- package/dist/law.js +416 -0
- package/dist/lawchange.js +208 -0
- package/dist/limits.js +207 -0
- package/dist/main.js +77 -0
- package/dist/names.js +117 -0
- package/dist/output.js +325 -0
- package/dist/prime.js +211 -0
- package/dist/programs.js +177 -0
- package/dist/progress.js +42 -0
- package/dist/prompt.js +317 -0
- package/dist/providers/anthropic.js +33 -0
- package/dist/providers/claude-code.js +41 -0
- package/dist/providers/codex.js +75 -0
- package/dist/providers/copilot-cli.js +56 -0
- package/dist/providers/gemini-cli.js +30 -0
- package/dist/providers/google.js +31 -0
- package/dist/providers/http.js +138 -0
- package/dist/providers/index.js +96 -0
- package/dist/providers/ollama.js +39 -0
- package/dist/providers/openai-compatible.js +41 -0
- package/dist/providers/openai.js +17 -0
- package/dist/providers/program.js +282 -0
- package/dist/readers.js +286 -0
- package/dist/review.js +116 -0
- package/dist/rules.js +418 -0
- package/dist/runner.js +177 -0
- package/dist/setup.js +388 -0
- package/dist/try.js +346 -0
- package/dist/types.js +99 -0
- package/dist/uses.js +78 -0
- package/dist/verdicts.js +337 -0
- package/dist/waivers.js +70 -0
- package/dist/work.js +21 -0
- package/docs/change.md +62 -0
- package/docs/ci.md +133 -0
- package/docs/codes.md +60 -0
- package/docs/config.md +117 -0
- package/docs/first-law.md +189 -0
- package/docs/json.md +72 -0
- package/docs/languages.md +87 -0
- package/docs/law.md +95 -0
- package/docs/providers.md +105 -0
- package/docs/reviewer-rules.md +96 -0
- package/docs/script-rules.md +90 -0
- package/docs/waivers.md +56 -0
- package/package.json +59 -3
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
The grammars in this directory are compiled from the repositories below, at the commits Runes pins in grammars/manifest.json. Each is distributed under the licence its repository states at that commit, reproduced in full.
|
|
2
|
+
|
|
3
|
+
========================================================================
|
|
4
|
+
TypeScript: tree-sitter-typescript.wasm
|
|
5
|
+
Repository: https://github.com/tree-sitter/tree-sitter-typescript
|
|
6
|
+
Commit: 75b3874edb2dc714fb1fd77a32013d0f8699989f
|
|
7
|
+
|
|
8
|
+
The MIT License (MIT)
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2017 Max Brunsfeld
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
|
29
|
+
|
|
30
|
+
========================================================================
|
|
31
|
+
TSX: tree-sitter-tsx.wasm
|
|
32
|
+
Repository: https://github.com/tree-sitter/tree-sitter-typescript
|
|
33
|
+
Commit: 75b3874edb2dc714fb1fd77a32013d0f8699989f
|
|
34
|
+
|
|
35
|
+
The MIT License (MIT)
|
|
36
|
+
|
|
37
|
+
Copyright (c) 2017 Max Brunsfeld
|
|
38
|
+
|
|
39
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
40
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
41
|
+
in the Software without restriction, including without limitation the rights
|
|
42
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
43
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
44
|
+
furnished to do so, subject to the following conditions:
|
|
45
|
+
|
|
46
|
+
The above copyright notice and this permission notice shall be included in all
|
|
47
|
+
copies or substantial portions of the Software.
|
|
48
|
+
|
|
49
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
50
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
51
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
52
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
53
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
54
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
55
|
+
SOFTWARE.
|
|
56
|
+
|
|
57
|
+
========================================================================
|
|
58
|
+
JavaScript: tree-sitter-javascript.wasm
|
|
59
|
+
Repository: https://github.com/tree-sitter/tree-sitter-javascript
|
|
60
|
+
Commit: 44c892e0be055ac465d5eeddae6d3e194424e7de
|
|
61
|
+
|
|
62
|
+
The MIT License (MIT)
|
|
63
|
+
|
|
64
|
+
Copyright (c) 2014 Max Brunsfeld
|
|
65
|
+
|
|
66
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
67
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
68
|
+
in the Software without restriction, including without limitation the rights
|
|
69
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
70
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
71
|
+
furnished to do so, subject to the following conditions:
|
|
72
|
+
|
|
73
|
+
The above copyright notice and this permission notice shall be included in all
|
|
74
|
+
copies or substantial portions of the Software.
|
|
75
|
+
|
|
76
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
77
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
78
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
79
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
80
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
81
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
82
|
+
SOFTWARE.
|
|
83
|
+
|
|
84
|
+
========================================================================
|
|
85
|
+
Python: tree-sitter-python.wasm
|
|
86
|
+
Repository: https://github.com/tree-sitter/tree-sitter-python
|
|
87
|
+
Commit: 293fdc02038ee2bf0e2e206711b69c90ac0d413f
|
|
88
|
+
|
|
89
|
+
The MIT License (MIT)
|
|
90
|
+
|
|
91
|
+
Copyright (c) 2016 Max Brunsfeld
|
|
92
|
+
|
|
93
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
94
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
95
|
+
in the Software without restriction, including without limitation the rights
|
|
96
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
97
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
98
|
+
furnished to do so, subject to the following conditions:
|
|
99
|
+
|
|
100
|
+
The above copyright notice and this permission notice shall be included in all
|
|
101
|
+
copies or substantial portions of the Software.
|
|
102
|
+
|
|
103
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
104
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
105
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
106
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
107
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
108
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
109
|
+
SOFTWARE.
|
|
110
|
+
|
|
111
|
+
========================================================================
|
|
112
|
+
Go: tree-sitter-go.wasm
|
|
113
|
+
Repository: https://github.com/tree-sitter/tree-sitter-go
|
|
114
|
+
Commit: 1547678a9da59885853f5f5cc8a99cc203fa2e2c
|
|
115
|
+
|
|
116
|
+
The MIT License (MIT)
|
|
117
|
+
|
|
118
|
+
Copyright (c) 2014 Max Brunsfeld
|
|
119
|
+
|
|
120
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
121
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
122
|
+
in the Software without restriction, including without limitation the rights
|
|
123
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
124
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
125
|
+
furnished to do so, subject to the following conditions:
|
|
126
|
+
|
|
127
|
+
The above copyright notice and this permission notice shall be included in all
|
|
128
|
+
copies or substantial portions of the Software.
|
|
129
|
+
|
|
130
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
131
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
132
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
133
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
134
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
135
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
136
|
+
SOFTWARE.
|
|
137
|
+
|
|
138
|
+
========================================================================
|
|
139
|
+
Rust: tree-sitter-rust.wasm
|
|
140
|
+
Repository: https://github.com/tree-sitter/tree-sitter-rust
|
|
141
|
+
Commit: 77a3747266f4d621d0757825e6b11edcbf991ca5
|
|
142
|
+
|
|
143
|
+
The MIT License (MIT)
|
|
144
|
+
|
|
145
|
+
Copyright (c) 2017 Maxim Sokolov
|
|
146
|
+
|
|
147
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
148
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
149
|
+
in the Software without restriction, including without limitation the rights
|
|
150
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
151
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
152
|
+
furnished to do so, subject to the following conditions:
|
|
153
|
+
|
|
154
|
+
The above copyright notice and this permission notice shall be included in all
|
|
155
|
+
copies or substantial portions of the Software.
|
|
156
|
+
|
|
157
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
158
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
159
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
160
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
161
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
162
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
163
|
+
SOFTWARE.
|
|
164
|
+
|
|
165
|
+
========================================================================
|
|
166
|
+
Java: tree-sitter-java.wasm
|
|
167
|
+
Repository: https://github.com/tree-sitter/tree-sitter-java
|
|
168
|
+
Commit: 94703d5a6bed02b98e438d7cad1136c01a60ba2c
|
|
169
|
+
|
|
170
|
+
MIT License
|
|
171
|
+
|
|
172
|
+
Copyright (c) 2017 Ayman Nadeem
|
|
173
|
+
|
|
174
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
175
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
176
|
+
in the Software without restriction, including without limitation the rights
|
|
177
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
178
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
179
|
+
furnished to do so, subject to the following conditions:
|
|
180
|
+
|
|
181
|
+
The above copyright notice and this permission notice shall be included in all
|
|
182
|
+
copies or substantial portions of the Software.
|
|
183
|
+
|
|
184
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
185
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
186
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
187
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
188
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
189
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
190
|
+
SOFTWARE.
|
|
191
|
+
|
|
192
|
+
========================================================================
|
|
193
|
+
Kotlin: tree-sitter-kotlin.wasm
|
|
194
|
+
Repository: https://github.com/tree-sitter-grammars/tree-sitter-kotlin
|
|
195
|
+
Commit: 77dd60ea0a9003ce062c9728a513ffe1aaff8c82
|
|
196
|
+
|
|
197
|
+
The MIT License (MIT)
|
|
198
|
+
|
|
199
|
+
Copyright (c) 2024 Amaan Qureshi <amaanq12@gmail.com>
|
|
200
|
+
|
|
201
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
202
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
203
|
+
in the Software without restriction, including without limitation the rights
|
|
204
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
205
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
206
|
+
furnished to do so, subject to the following conditions:
|
|
207
|
+
|
|
208
|
+
The above copyright notice and this permission notice shall be included in all
|
|
209
|
+
copies or substantial portions of the Software.
|
|
210
|
+
|
|
211
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
212
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
213
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
214
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
215
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
216
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
217
|
+
SOFTWARE.
|
|
218
|
+
|
|
219
|
+
========================================================================
|
|
220
|
+
C#: tree-sitter-c_sharp.wasm
|
|
221
|
+
Repository: https://github.com/tree-sitter/tree-sitter-c-sharp
|
|
222
|
+
Commit: 9150f7d56bb47f1a809fa23623f1ba1413e93fa9
|
|
223
|
+
|
|
224
|
+
The MIT License (MIT)
|
|
225
|
+
|
|
226
|
+
Copyright (c) 2014-2023 Max Brunsfeld, Damien Guard, Amaan Qureshi, and contributors.
|
|
227
|
+
|
|
228
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
229
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
230
|
+
in the Software without restriction, including without limitation the rights
|
|
231
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
232
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
233
|
+
furnished to do so, subject to the following conditions:
|
|
234
|
+
|
|
235
|
+
The above copyright notice and this permission notice shall be included in all
|
|
236
|
+
copies or substantial portions of the Software.
|
|
237
|
+
|
|
238
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
239
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
240
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
241
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
242
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
243
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
244
|
+
SOFTWARE.
|
|
245
|
+
|
|
246
|
+
========================================================================
|
|
247
|
+
C: tree-sitter-c.wasm
|
|
248
|
+
Repository: https://github.com/tree-sitter/tree-sitter-c
|
|
249
|
+
Commit: b780e47fc780ddc8da13afa35a3f4ed5c157823d
|
|
250
|
+
|
|
251
|
+
The MIT License (MIT)
|
|
252
|
+
|
|
253
|
+
Copyright (c) 2014 Max Brunsfeld
|
|
254
|
+
|
|
255
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
256
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
257
|
+
in the Software without restriction, including without limitation the rights
|
|
258
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
259
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
260
|
+
furnished to do so, subject to the following conditions:
|
|
261
|
+
|
|
262
|
+
The above copyright notice and this permission notice shall be included in all
|
|
263
|
+
copies or substantial portions of the Software.
|
|
264
|
+
|
|
265
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
266
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
267
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
268
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
269
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
270
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
271
|
+
SOFTWARE.
|
|
272
|
+
|
|
273
|
+
========================================================================
|
|
274
|
+
C++: tree-sitter-cpp.wasm
|
|
275
|
+
Repository: https://github.com/tree-sitter/tree-sitter-cpp
|
|
276
|
+
Commit: c009222808634c1014f82438d4883753516a2c24
|
|
277
|
+
|
|
278
|
+
The MIT License (MIT)
|
|
279
|
+
|
|
280
|
+
Copyright (c) 2014 Max Brunsfeld
|
|
281
|
+
|
|
282
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
283
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
284
|
+
in the Software without restriction, including without limitation the rights
|
|
285
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
286
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
287
|
+
furnished to do so, subject to the following conditions:
|
|
288
|
+
|
|
289
|
+
The above copyright notice and this permission notice shall be included in all
|
|
290
|
+
copies or substantial portions of the Software.
|
|
291
|
+
|
|
292
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
293
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
294
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
295
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
296
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
297
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
298
|
+
SOFTWARE.
|
|
299
|
+
|
|
300
|
+
========================================================================
|
|
301
|
+
PHP: tree-sitter-php.wasm
|
|
302
|
+
Repository: https://github.com/tree-sitter/tree-sitter-php
|
|
303
|
+
Commit: 3fda2fb9577166c6399834917f9844f30370beea
|
|
304
|
+
|
|
305
|
+
The MIT License (MIT)
|
|
306
|
+
|
|
307
|
+
Copyright (c) 2017 Josh Vera, GitHub
|
|
308
|
+
Copyright (c) 2019 Max Brunsfeld, Amaan Qureshi, Christian Frøystad, Caleb White
|
|
309
|
+
|
|
310
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
311
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
312
|
+
in the Software without restriction, including without limitation the rights
|
|
313
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
314
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
315
|
+
furnished to do so, subject to the following conditions:
|
|
316
|
+
|
|
317
|
+
The above copyright notice and this permission notice shall be included in all
|
|
318
|
+
copies or substantial portions of the Software.
|
|
319
|
+
|
|
320
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
321
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
322
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
323
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
324
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
325
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
326
|
+
SOFTWARE.
|
|
327
|
+
|
|
328
|
+
========================================================================
|
|
329
|
+
Ruby: tree-sitter-ruby.wasm
|
|
330
|
+
Repository: https://github.com/tree-sitter/tree-sitter-ruby
|
|
331
|
+
Commit: ad907a69da0c8a4f7a943a7fe012712208da6dee
|
|
332
|
+
|
|
333
|
+
The MIT License (MIT)
|
|
334
|
+
|
|
335
|
+
Copyright (c) 2016 Rob Rix
|
|
336
|
+
|
|
337
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
338
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
339
|
+
in the Software without restriction, including without limitation the rights
|
|
340
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
341
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
342
|
+
furnished to do so, subject to the following conditions:
|
|
343
|
+
|
|
344
|
+
The above copyright notice and this permission notice shall be included in all
|
|
345
|
+
copies or substantial portions of the Software.
|
|
346
|
+
|
|
347
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
348
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
349
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
350
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
351
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
352
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
353
|
+
SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/guard.js
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { rmSync } from 'node:fs';
|
|
3
|
+
import { killTree, powershell, PROCESS_TABLE, toEnd } from './programs.js';
|
|
4
|
+
const pids = new Set();
|
|
5
|
+
const windows = process.platform === 'win32';
|
|
6
|
+
// On Windows a program left by one that has ended can be found only through the list of processes, and PowerShell takes seconds to start on a busy machine. While a group is registered, or once the tool has said it starts programs, one PowerShell keeps that list fresh, so the guard ends the tree from a list begun after the kill without starting another PowerShell.
|
|
7
|
+
let watcher = null;
|
|
8
|
+
let table = '';
|
|
9
|
+
let listed = false;
|
|
10
|
+
let onListed = null;
|
|
11
|
+
// A list is printed after its snapshot ends, so one that comes after the kill may show the processes as they were before it; each list starts with the time its snapshot began, and the guard ends a tree only from a list begun once it knew of the kill.
|
|
12
|
+
const waitingForList = [];
|
|
13
|
+
// Once the tool has said it is about to call a program, the list runs until the tool ends, so it is running when a call starts.
|
|
14
|
+
let held = false;
|
|
15
|
+
function watch() {
|
|
16
|
+
if (!windows || watcher !== null)
|
|
17
|
+
return;
|
|
18
|
+
watcher = spawn(powershell(), ['-NoProfile', '-NonInteractive', '-Command', `while ($true) { [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds(); ${PROCESS_TABLE}; '--'; Start-Sleep -Milliseconds 250 }`], { stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true });
|
|
19
|
+
const current = watcher;
|
|
20
|
+
const gone = () => {
|
|
21
|
+
if (watcher !== current)
|
|
22
|
+
return;
|
|
23
|
+
for (const next of waitingForList.splice(0))
|
|
24
|
+
next.done(null);
|
|
25
|
+
};
|
|
26
|
+
current.on('error', gone);
|
|
27
|
+
current.on('close', gone);
|
|
28
|
+
let partial = '';
|
|
29
|
+
watcher.stdout.setEncoding('utf8').on('data', (chunk) => {
|
|
30
|
+
partial += chunk;
|
|
31
|
+
const end = partial.lastIndexOf('\n--');
|
|
32
|
+
if (end < 0)
|
|
33
|
+
return;
|
|
34
|
+
const start = partial.lastIndexOf('\n--', end - 1);
|
|
35
|
+
const [begun, ...rows] = partial.slice(start < 0 ? 0 : start + 3, end).trimStart().split('\n');
|
|
36
|
+
table = rows.join('\n');
|
|
37
|
+
partial = partial.slice(end + 3);
|
|
38
|
+
listed = true;
|
|
39
|
+
onListed?.();
|
|
40
|
+
const takenAt = Number(begun);
|
|
41
|
+
for (const next of waitingForList.filter((waiting) => takenAt >= waiting.since)) {
|
|
42
|
+
waitingForList.splice(waitingForList.indexOf(next), 1);
|
|
43
|
+
next.done(table);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
const groups = new Set();
|
|
48
|
+
const folders = new Set();
|
|
49
|
+
let pending = '';
|
|
50
|
+
process.stdin.setEncoding('utf8');
|
|
51
|
+
process.stdin.on('data', (chunk) => {
|
|
52
|
+
pending += chunk;
|
|
53
|
+
for (let end = pending.indexOf('\n'); end >= 0; end = pending.indexOf('\n')) {
|
|
54
|
+
const line = pending.slice(0, end);
|
|
55
|
+
pending = pending.slice(end + 1);
|
|
56
|
+
const adding = line.startsWith('+');
|
|
57
|
+
if (line === '+w') {
|
|
58
|
+
held = true;
|
|
59
|
+
watch();
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (line[1] === 'd') {
|
|
63
|
+
if (adding)
|
|
64
|
+
folders.add(line.slice(2));
|
|
65
|
+
else
|
|
66
|
+
folders.delete(line.slice(2));
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const group = line[1] === 'g';
|
|
70
|
+
const pid = Number(line.slice(group ? 2 : 1));
|
|
71
|
+
const set = group ? groups : pids;
|
|
72
|
+
if (adding)
|
|
73
|
+
set.add(pid);
|
|
74
|
+
else
|
|
75
|
+
set.delete(pid);
|
|
76
|
+
if (group && adding)
|
|
77
|
+
watch();
|
|
78
|
+
if (group && !adding && groups.size === 0 && !held)
|
|
79
|
+
stopWatching();
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
// PowerShell writes test files to the temporary directory while it starts and removes them once started, so the watcher is ended only after its first list, or after 10 seconds.
|
|
83
|
+
function stopWatching(then = () => undefined) {
|
|
84
|
+
const current = watcher;
|
|
85
|
+
if (current === null || listed || current.exitCode !== null) {
|
|
86
|
+
current?.kill();
|
|
87
|
+
watcher = null;
|
|
88
|
+
listed = false;
|
|
89
|
+
then();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
let done = false;
|
|
93
|
+
const end = () => {
|
|
94
|
+
if (done)
|
|
95
|
+
return;
|
|
96
|
+
done = true;
|
|
97
|
+
current.kill();
|
|
98
|
+
if (watcher === current) {
|
|
99
|
+
watcher = null;
|
|
100
|
+
listed = false;
|
|
101
|
+
}
|
|
102
|
+
then();
|
|
103
|
+
};
|
|
104
|
+
onListed = end;
|
|
105
|
+
current.on('exit', end);
|
|
106
|
+
setTimeout(end, 10_000).unref();
|
|
107
|
+
}
|
|
108
|
+
let ended = false;
|
|
109
|
+
// Windows gives an ended process's id to a new one soon, so a process is killed from the list only when a list made after the tool's end still shows that id made at the same time.
|
|
110
|
+
function listSince(since, ms) {
|
|
111
|
+
if (watcher === null || watcher.exitCode !== null)
|
|
112
|
+
return Promise.resolve(null);
|
|
113
|
+
return new Promise((done) => {
|
|
114
|
+
const waiting = {
|
|
115
|
+
since,
|
|
116
|
+
done: (list) => {
|
|
117
|
+
clearTimeout(timer);
|
|
118
|
+
done(list);
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
const timer = setTimeout(() => {
|
|
122
|
+
waitingForList.splice(waitingForList.indexOf(waiting), 1);
|
|
123
|
+
done(null);
|
|
124
|
+
}, ms);
|
|
125
|
+
waitingForList.push(waiting);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
// False when no list came, and the trees are then ended without one.
|
|
129
|
+
async function endWatched() {
|
|
130
|
+
if (groups.size === 0)
|
|
131
|
+
return true;
|
|
132
|
+
const learned = Date.now();
|
|
133
|
+
const before = table;
|
|
134
|
+
const fresh = await listSince(learned, 10_000);
|
|
135
|
+
if (fresh === null)
|
|
136
|
+
return false;
|
|
137
|
+
for (const pid of toEnd(before, fresh, [...groups])) {
|
|
138
|
+
try {
|
|
139
|
+
process.kill(pid, 'SIGKILL');
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
// The process has already ended.
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
function endAll() {
|
|
148
|
+
if (ended)
|
|
149
|
+
return;
|
|
150
|
+
ended = true;
|
|
151
|
+
for (const pid of pids) {
|
|
152
|
+
try {
|
|
153
|
+
process.kill(pid, 'SIGKILL');
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
// The runner has already ended.
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
void endWatched().then((found) => {
|
|
160
|
+
for (const pid of groups)
|
|
161
|
+
killTree(pid, 'SIGKILL', !found);
|
|
162
|
+
for (const folder of folders)
|
|
163
|
+
rmSync(folder, { recursive: true, force: true, maxRetries: 10 });
|
|
164
|
+
stopWatching(() => process.exit(0));
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
process.stdin.on('close', endAll);
|
|
168
|
+
// On Windows the guard's input did not close when the tool was killed while claude ran, so the guard also watches the tool itself.
|
|
169
|
+
if (process.platform === 'win32') {
|
|
170
|
+
const tool = process.ppid;
|
|
171
|
+
setInterval(() => {
|
|
172
|
+
try {
|
|
173
|
+
process.kill(tool, 0);
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
endAll();
|
|
177
|
+
}
|
|
178
|
+
}, 250);
|
|
179
|
+
}
|