@visulima/cerebro 3.0.0-alpha.29 → 3.0.0-alpha.30
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/CHANGELOG.md +34 -0
- package/LICENSE.md +163 -16
- package/dist/commands/completion-command.d.ts +1 -1
- package/dist/commands/completion-command.js +1 -1
- package/dist/commands/help-command.d.ts +1 -1
- package/dist/commands/help-command.js +1 -1
- package/dist/commands/readme-command.d.ts +1 -1
- package/dist/commands/readme-command.js +1 -1
- package/dist/commands/version-command.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/logger/create-pail-logger.d.ts +1 -0
- package/dist/packem_chunks/has-new-version.js +1 -1
- package/dist/packem_shared/Cerebro-BN_nIZ8z.js +4 -0
- package/dist/packem_shared/index-CkkDAMKi.js +6 -0
- package/dist/packem_shared/{plugin-manager.d-CuIdny8w.d.ts → plugin-manager.d-BSQtHbWS.d.ts} +3 -0
- package/dist/plugins/error-handler-plugin.d.ts +1 -1
- package/dist/plugins/runtime-version-check-plugin.d.ts +1 -1
- package/dist/plugins/update-notifier/update-notifier-plugin.d.ts +1 -1
- package/package.json +7 -8
- package/dist/packem_shared/Cerebro-CtfwEvsG.js +0 -4
- package/dist/packem_shared/index-Bl6FHt1Y.js +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
## @visulima/cerebro [3.0.0-alpha.30](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.29...@visulima/cerebro@3.0.0-alpha.30) (2026-06-04)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **cerebro:** 6 bug fixes ([717f07e](https://github.com/visulima/visulima/commit/717f07ef9ffcc1c28a01250fe1534fa45f5d11cf))
|
|
6
|
+
* **lint:** clear pre-existing eslint rot across packages ([#674](https://github.com/visulima/visulima/issues/674)) ([5354253](https://github.com/visulima/visulima/commit/5354253b163bd50bcefaf8a3fddf831bdb5df32b))
|
|
7
|
+
|
|
8
|
+
### Miscellaneous Chores
|
|
9
|
+
|
|
10
|
+
* apply eslint + prettier autofixes across packages ([c1bb784](https://github.com/visulima/visulima/commit/c1bb7848a0d93d0dfe2960c77e3cda22239c79a0))
|
|
11
|
+
|
|
12
|
+
### Tests
|
|
13
|
+
|
|
14
|
+
* **cerebro:** cover plugins, error/validation utils, update-notifier, and command processing branches ([6e40a11](https://github.com/visulima/visulima/commit/6e40a11ec1dd7204083a7d4d1b52a85cb66533e6))
|
|
15
|
+
* **cerebro:** update ESM/CJS integration snapshot for -v alias ([897bb2f](https://github.com/visulima/visulima/commit/897bb2f97d0279801d8d87cf94c0373922550477))
|
|
16
|
+
* fix cross-platform flakes in package + cerebro ([#676](https://github.com/visulima/visulima/issues/676)) ([d1afb4b](https://github.com/visulima/visulima/commit/d1afb4ba743cf18bdf9f02081539d70bdcda91e9))
|
|
17
|
+
|
|
18
|
+
### Build System
|
|
19
|
+
|
|
20
|
+
* **cerebro:** move @visulima/string and terminal-size to devDependencies ([27924b4](https://github.com/visulima/visulima/commit/27924b4716de5631e43e7b7485e6b44a232f27ee))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Dependencies
|
|
24
|
+
|
|
25
|
+
* **@visulima/colorize:** upgraded to 2.0.0-alpha.13
|
|
26
|
+
* **@visulima/tabular:** upgraded to 4.0.0-alpha.13
|
|
27
|
+
* **@visulima/string:** upgraded to 3.0.0-alpha.15
|
|
28
|
+
* **@visulima/boxen:** upgraded to 3.0.0-alpha.12
|
|
29
|
+
* **@visulima/command-line-args:** upgraded to 2.0.0-alpha.11
|
|
30
|
+
* **@visulima/error:** upgraded to 6.0.0-alpha.32
|
|
31
|
+
* **@visulima/find-cache-dir:** upgraded to 3.0.0-alpha.11
|
|
32
|
+
* **@visulima/pail:** upgraded to 4.0.0-alpha.20
|
|
33
|
+
* **@visulima/path:** upgraded to 3.0.0-alpha.12
|
|
34
|
+
|
|
1
35
|
## @visulima/cerebro [3.0.0-alpha.29](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.28...@visulima/cerebro@3.0.0-alpha.29) (2026-05-29)
|
|
2
36
|
|
|
3
37
|
### Tests
|
package/LICENSE.md
CHANGED
|
@@ -81,11 +81,14 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
81
81
|
>
|
|
82
82
|
>
|
|
83
83
|
> # Licenses of bundled dependencies
|
|
84
|
+
>
|
|
84
85
|
> The published @visulima/command-line-args artifact additionally contains code with the following licenses:
|
|
85
86
|
> MIT
|
|
86
87
|
>
|
|
87
88
|
> # Bundled dependencies:
|
|
89
|
+
>
|
|
88
90
|
> ## @visulima/error
|
|
91
|
+
>
|
|
89
92
|
> License: MIT
|
|
90
93
|
> By: Daniel Bannert
|
|
91
94
|
> Repository: git+https://github.com/visulima/visulima.git
|
|
@@ -112,8 +115,6 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
112
115
|
> > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
113
116
|
> > SOFTWARE.
|
|
114
117
|
> >
|
|
115
|
-
> >
|
|
116
|
-
> >
|
|
117
118
|
> > # Licenses of bundled dependencies
|
|
118
119
|
> >
|
|
119
120
|
> > The published @visulima/error artifact additionally contains code with the following licenses:
|
|
@@ -137,16 +138,15 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
137
138
|
> > >
|
|
138
139
|
> > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
139
140
|
> >
|
|
140
|
-
> >
|
|
141
|
-
> >
|
|
142
|
-
> >
|
|
143
|
-
> >
|
|
144
141
|
> > # Licenses of bundled types
|
|
142
|
+
> >
|
|
145
143
|
> > The published @visulima/error artifact additionally contains code with the following licenses:
|
|
146
144
|
> > Apache-2.0
|
|
147
145
|
> >
|
|
148
146
|
> > # Bundled types:
|
|
147
|
+
> >
|
|
149
148
|
> > ## ai
|
|
149
|
+
> >
|
|
150
150
|
> > License: Apache-2.0
|
|
151
151
|
> > Repository: https://github.com/vercel/ai
|
|
152
152
|
> >
|
|
@@ -169,11 +169,14 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
169
169
|
>
|
|
170
170
|
>
|
|
171
171
|
> # Licenses of bundled types
|
|
172
|
+
>
|
|
172
173
|
> The published @visulima/command-line-args artifact additionally contains code with the following licenses:
|
|
173
174
|
> MIT
|
|
174
175
|
>
|
|
175
176
|
> # Bundled types:
|
|
177
|
+
>
|
|
176
178
|
> ## @visulima/error
|
|
179
|
+
>
|
|
177
180
|
> License: MIT
|
|
178
181
|
> By: Daniel Bannert
|
|
179
182
|
> Repository: git+https://github.com/visulima/visulima.git
|
|
@@ -201,6 +204,41 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
201
204
|
> > SOFTWARE.
|
|
202
205
|
> >
|
|
203
206
|
> >
|
|
207
|
+
>
|
|
208
|
+
> # Licenses of bundled dependencies
|
|
209
|
+
>
|
|
210
|
+
> The published @visulima/command-line-args artifact additionally contains code with the following licenses:
|
|
211
|
+
> MIT
|
|
212
|
+
>
|
|
213
|
+
> # Bundled dependencies:
|
|
214
|
+
>
|
|
215
|
+
> ## @visulima/error
|
|
216
|
+
>
|
|
217
|
+
> License: MIT
|
|
218
|
+
> By: Daniel Bannert
|
|
219
|
+
> Repository: git+https://github.com/visulima/visulima.git
|
|
220
|
+
>
|
|
221
|
+
> > MIT License
|
|
222
|
+
> >
|
|
223
|
+
> > Copyright (c) 2026 visulima
|
|
224
|
+
> >
|
|
225
|
+
> > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
226
|
+
> > of this software and associated documentation files (the "Software"), to deal
|
|
227
|
+
> > in the Software without restriction, including without limitation the rights
|
|
228
|
+
> > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
229
|
+
> > copies of the Software, and to permit persons to whom the Software is
|
|
230
|
+
> > furnished to do so, subject to the following conditions:
|
|
231
|
+
> >
|
|
232
|
+
> > The above copyright notice and this permission notice shall be included in all
|
|
233
|
+
> > copies or substantial portions of the Software.
|
|
234
|
+
> >
|
|
235
|
+
> > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
236
|
+
> > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
237
|
+
> > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
238
|
+
> > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
239
|
+
> > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
240
|
+
> > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
241
|
+
> > SOFTWARE.
|
|
204
242
|
> >
|
|
205
243
|
> > # Licenses of bundled dependencies
|
|
206
244
|
> >
|
|
@@ -225,18 +263,45 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
225
263
|
> > >
|
|
226
264
|
> > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
227
265
|
> >
|
|
228
|
-
> >
|
|
266
|
+
> > # Licenses of bundled types
|
|
229
267
|
> >
|
|
268
|
+
> > The published @visulima/error artifact additionally contains code with the following licenses:
|
|
269
|
+
> > Apache-2.0
|
|
230
270
|
> >
|
|
271
|
+
> > # Bundled types:
|
|
272
|
+
> >
|
|
273
|
+
> > ## ai
|
|
274
|
+
> >
|
|
275
|
+
> > License: Apache-2.0
|
|
276
|
+
> > Repository: https://github.com/vercel/ai
|
|
231
277
|
> >
|
|
278
|
+
> > > Copyright 2023 Vercel, Inc.
|
|
279
|
+
> > >
|
|
280
|
+
> > > Licensed under the Apache License, Version 2.0 (the "License");
|
|
281
|
+
> > > you may not use this file except in compliance with the License.
|
|
282
|
+
> > > You may obtain a copy of the License at
|
|
283
|
+
> > >
|
|
284
|
+
> > > http://www.apache.org/licenses/LICENSE-2.0
|
|
285
|
+
> > >
|
|
286
|
+
> > > Unless required by applicable law or agreed to in writing, software
|
|
287
|
+
> > > distributed under the License is distributed on an "AS IS" BASIS,
|
|
288
|
+
> > > WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
289
|
+
> > > See the License for the specific language governing permissions and
|
|
290
|
+
> > > limitations under the License.
|
|
291
|
+
>
|
|
292
|
+
>
|
|
293
|
+
>
|
|
232
294
|
> > # Licenses of bundled types
|
|
295
|
+
> >
|
|
233
296
|
> > The published @visulima/error artifact additionally contains code with the following licenses:
|
|
234
297
|
> > Apache-2.0
|
|
235
298
|
> >
|
|
236
299
|
> > # Bundled types:
|
|
300
|
+
> >
|
|
237
301
|
> > ## ai
|
|
302
|
+
> >
|
|
238
303
|
> > License: Apache-2.0
|
|
239
|
-
> > Repository: https://github.com/vercel/ai
|
|
304
|
+
> > Repository: git+https://github.com/vercel/ai.git
|
|
240
305
|
> >
|
|
241
306
|
> > > Copyright 2023 Vercel, Inc.
|
|
242
307
|
> > >
|
|
@@ -1125,6 +1190,23 @@ Repository: github:watson/ci-info
|
|
|
1125
1190
|
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1126
1191
|
> SOFTWARE.
|
|
1127
1192
|
|
|
1193
|
+
---------------------------------------
|
|
1194
|
+
|
|
1195
|
+
## terminal-size
|
|
1196
|
+
License: MIT
|
|
1197
|
+
By: Sindre Sorhus
|
|
1198
|
+
Repository: sindresorhus/terminal-size
|
|
1199
|
+
|
|
1200
|
+
> MIT License
|
|
1201
|
+
>
|
|
1202
|
+
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
1203
|
+
>
|
|
1204
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
1205
|
+
>
|
|
1206
|
+
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
1207
|
+
>
|
|
1208
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1209
|
+
|
|
1128
1210
|
<!-- /DEPENDENCIES -->
|
|
1129
1211
|
|
|
1130
1212
|
<!-- TYPE_DEPENDENCIES -->
|
|
@@ -1188,11 +1270,14 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
1188
1270
|
> <!-- DEPENDENCIES -->
|
|
1189
1271
|
>
|
|
1190
1272
|
> # Licenses of bundled dependencies
|
|
1273
|
+
>
|
|
1191
1274
|
> The published @visulima/command-line-args artifact additionally contains code with the following licenses:
|
|
1192
1275
|
> MIT
|
|
1193
1276
|
>
|
|
1194
1277
|
> # Bundled dependencies:
|
|
1278
|
+
>
|
|
1195
1279
|
> ## @visulima/error
|
|
1280
|
+
>
|
|
1196
1281
|
> License: MIT
|
|
1197
1282
|
> By: Daniel Bannert
|
|
1198
1283
|
> Repository: git+https://github.com/visulima/visulima.git
|
|
@@ -1219,8 +1304,6 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
1219
1304
|
> > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1220
1305
|
> > SOFTWARE.
|
|
1221
1306
|
> >
|
|
1222
|
-
> >
|
|
1223
|
-
> >
|
|
1224
1307
|
> > # Licenses of bundled dependencies
|
|
1225
1308
|
> >
|
|
1226
1309
|
> > The published @visulima/error artifact additionally contains code with the following licenses:
|
|
@@ -1244,16 +1327,15 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
1244
1327
|
> > >
|
|
1245
1328
|
> > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1246
1329
|
> >
|
|
1247
|
-
> >
|
|
1248
|
-
> >
|
|
1249
|
-
> >
|
|
1250
|
-
> >
|
|
1251
1330
|
> > # Licenses of bundled types
|
|
1331
|
+
> >
|
|
1252
1332
|
> > The published @visulima/error artifact additionally contains code with the following licenses:
|
|
1253
1333
|
> > Apache-2.0
|
|
1254
1334
|
> >
|
|
1255
1335
|
> > # Bundled types:
|
|
1336
|
+
> >
|
|
1256
1337
|
> > ## ai
|
|
1338
|
+
> >
|
|
1257
1339
|
> > License: Apache-2.0
|
|
1258
1340
|
> > Repository: https://github.com/vercel/ai
|
|
1259
1341
|
> >
|
|
@@ -1276,11 +1358,14 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
1276
1358
|
>
|
|
1277
1359
|
>
|
|
1278
1360
|
> # Licenses of bundled types
|
|
1361
|
+
>
|
|
1279
1362
|
> The published @visulima/command-line-args artifact additionally contains code with the following licenses:
|
|
1280
1363
|
> MIT
|
|
1281
1364
|
>
|
|
1282
1365
|
> # Bundled types:
|
|
1366
|
+
>
|
|
1283
1367
|
> ## @visulima/error
|
|
1368
|
+
>
|
|
1284
1369
|
> License: MIT
|
|
1285
1370
|
> By: Daniel Bannert
|
|
1286
1371
|
> Repository: git+https://github.com/visulima/visulima.git
|
|
@@ -1308,6 +1393,41 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
1308
1393
|
> > SOFTWARE.
|
|
1309
1394
|
> >
|
|
1310
1395
|
> > <!-- DEPENDENCIES -->
|
|
1396
|
+
>
|
|
1397
|
+
> # Licenses of bundled dependencies
|
|
1398
|
+
>
|
|
1399
|
+
> The published @visulima/command-line-args artifact additionally contains code with the following licenses:
|
|
1400
|
+
> MIT
|
|
1401
|
+
>
|
|
1402
|
+
> # Bundled dependencies:
|
|
1403
|
+
>
|
|
1404
|
+
> ## @visulima/error
|
|
1405
|
+
>
|
|
1406
|
+
> License: MIT
|
|
1407
|
+
> By: Daniel Bannert
|
|
1408
|
+
> Repository: git+https://github.com/visulima/visulima.git
|
|
1409
|
+
>
|
|
1410
|
+
> > MIT License
|
|
1411
|
+
> >
|
|
1412
|
+
> > Copyright (c) 2026 visulima
|
|
1413
|
+
> >
|
|
1414
|
+
> > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1415
|
+
> > of this software and associated documentation files (the "Software"), to deal
|
|
1416
|
+
> > in the Software without restriction, including without limitation the rights
|
|
1417
|
+
> > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1418
|
+
> > copies of the Software, and to permit persons to whom the Software is
|
|
1419
|
+
> > furnished to do so, subject to the following conditions:
|
|
1420
|
+
> >
|
|
1421
|
+
> > The above copyright notice and this permission notice shall be included in all
|
|
1422
|
+
> > copies or substantial portions of the Software.
|
|
1423
|
+
> >
|
|
1424
|
+
> > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1425
|
+
> > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1426
|
+
> > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1427
|
+
> > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1428
|
+
> > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1429
|
+
> > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1430
|
+
> > SOFTWARE.
|
|
1311
1431
|
> >
|
|
1312
1432
|
> > # Licenses of bundled dependencies
|
|
1313
1433
|
> >
|
|
@@ -1332,18 +1452,45 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
1332
1452
|
> > >
|
|
1333
1453
|
> > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1334
1454
|
> >
|
|
1335
|
-
> >
|
|
1455
|
+
> > # Licenses of bundled types
|
|
1456
|
+
> >
|
|
1457
|
+
> > The published @visulima/error artifact additionally contains code with the following licenses:
|
|
1458
|
+
> > Apache-2.0
|
|
1459
|
+
> >
|
|
1460
|
+
> > # Bundled types:
|
|
1336
1461
|
> >
|
|
1462
|
+
> > ## ai
|
|
1337
1463
|
> >
|
|
1464
|
+
> > License: Apache-2.0
|
|
1465
|
+
> > Repository: https://github.com/vercel/ai
|
|
1338
1466
|
> >
|
|
1467
|
+
> > > Copyright 2023 Vercel, Inc.
|
|
1468
|
+
> > >
|
|
1469
|
+
> > > Licensed under the Apache License, Version 2.0 (the "License");
|
|
1470
|
+
> > > you may not use this file except in compliance with the License.
|
|
1471
|
+
> > > You may obtain a copy of the License at
|
|
1472
|
+
> > >
|
|
1473
|
+
> > > http://www.apache.org/licenses/LICENSE-2.0
|
|
1474
|
+
> > >
|
|
1475
|
+
> > > Unless required by applicable law or agreed to in writing, software
|
|
1476
|
+
> > > distributed under the License is distributed on an "AS IS" BASIS,
|
|
1477
|
+
> > > WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1478
|
+
> > > See the License for the specific language governing permissions and
|
|
1479
|
+
> > > limitations under the License.
|
|
1480
|
+
>
|
|
1481
|
+
> <!-- /DEPENDENCIES -->
|
|
1482
|
+
>
|
|
1339
1483
|
> > # Licenses of bundled types
|
|
1484
|
+
> >
|
|
1340
1485
|
> > The published @visulima/error artifact additionally contains code with the following licenses:
|
|
1341
1486
|
> > Apache-2.0
|
|
1342
1487
|
> >
|
|
1343
1488
|
> > # Bundled types:
|
|
1489
|
+
> >
|
|
1344
1490
|
> > ## ai
|
|
1491
|
+
> >
|
|
1345
1492
|
> > License: Apache-2.0
|
|
1346
|
-
> > Repository: https://github.com/vercel/ai
|
|
1493
|
+
> > Repository: git+https://github.com/vercel/ai.git
|
|
1347
1494
|
> >
|
|
1348
1495
|
> > > Copyright 2023 Vercel, Inc.
|
|
1349
1496
|
> > >
|
|
@@ -2,4 +2,4 @@ var g=Object.defineProperty;var a=(e,t)=>g(e,"name",{value:t,configurable:!0});i
|
|
|
2
2
|
`))}}var C=Object.defineProperty,s=a((e,t)=>C(e,"name",{value:t,configurable:!0}),"s");const h=["bash","zsh","fish","powershell"],d=["node","bun","deno"],v=s(e=>"Deno"in e,"hasDeno"),L=s(e=>"Bun"in e,"hasBun"),u=s(()=>v(globalThis)?"deno":L(globalThis)?"bun":"node","detectRuntime"),m=s(e=>{const t=e?.starshipShell??e?.shell;if(t){const r=t.toLowerCase();if(r.includes("zsh"))return"zsh";if(r.includes("bash"))return"bash";if(r.includes("fish"))return"fish"}const o=e?.psModulePath,n=e?.prompt;if(o||n?.includes("PS"))return"powershell";if(e?.comSpec?.toLowerCase().includes("cmd.exe"))return"bash"},"detectShell"),f=S,I=s((e,t)=>{for(const o of t)o.hidden||(o.name&&e.option(o.name,o.description??""),o.alias&&e.option(o.alias,o.description??""))},"registerCommandOptions"),P=s((e,t)=>{for(const[o,n]of t){if(n.name!==o||n.hidden)continue;const r=e.command(n.name,n.description??"");n.options&&I(r,n.options)}},"registerCommands"),E=s(e=>{if(!h.includes(e))throw new p(`Invalid shell type: ${e}`,"INVALID_SHELL",[`Valid shells are: ${h.join(", ")}`,"Shell will be auto-detected if not specified"])},"validateShell"),j=s(e=>{if(e&&!d.includes(e))throw new p(`Invalid runtime: ${e}`,"INVALID_RUNTIME",[`Valid runtimes are: ${d.join(", ")}`,"Runtime will be auto-detected if not specified"])},"validateRuntime"),z=s((e,t)=>{e.error("Could not detect current shell");const o=[`Usage: ${t} completion --shell=<bash|zsh|fish|powershell> [--runtime=<node|bun|deno>]`,"","Examples:"," # Install completions for zsh:",` ${t} completion --shell=zsh > ~/.${t}-completion.zsh`,` echo 'source ~/.${t}-completion.zsh' >> ~/.zshrc`,""," # Install completions for bash with custom runtime:",` ${t} completion --shell=bash --runtime=bun > ~/.${t}-completion.bash`,` echo 'source ~/.${t}-completion.bash' >> ~/.bashrc`,""," # Install completions for fish:",` ${t} completion --shell=fish > ~/.config/fish/completions/${t}.fish`].join(`
|
|
3
3
|
`);e.info(o)},"printUsageInstructions"),x={description:"Generate shell completion scripts",env:[{description:"Shell path (Unix-like systems). Used for shell detection.",name:"SHELL",type:String},{description:"Starship shell configuration. Takes precedence over SHELL for detection.",name:"STARSHIP_SHELL",type:String},{description:"PowerShell module path (Windows). Used for PowerShell detection.",name:"PSModulePath",type:String},{description:"Command prompt variable (Windows). Used for PowerShell detection.",name:"PROMPT",type:String},{description:"Command processor (Windows). Used for Windows Command Prompt detection.",name:"ComSpec",type:String}],execute:s(async({env:e,logger:t,options:o,runtime:n})=>{const r=n.getCliName(),c=o.shell??m(e);if(!c){z(t,r);return}try{E(c),j(o.runtime),P(f,n.getCommands());const i=`${o.runtime??u()} ${r}`;f.setup(r,i,c)}catch(i){if(i instanceof p){const l=[`Failed to generate completion script: ${i.message}`,`Error code: ${i.code}`];throw i.troubleshooting.length>0&&l.push("","Troubleshooting:",...i.troubleshooting.map(b=>` • ${b}`)),t.error(l.join(`
|
|
4
4
|
`)),i}else{const l=["Failed to generate completion script",`Error: ${i instanceof Error?i.message:String(i)}`,"","Troubleshooting:"," • Ensure @bomb.sh/tab is installed: pnpm add @bomb.sh/tab",` • Verify shell is supported: ${h.join(", ")}`,` • Verify runtime is supported: ${d.join(", ")}`," • Check that your CLI name is correct"];t.error(l.join(`
|
|
5
|
-
`))}}},"execute"),name:"completion",options:[{defaultOption:!0,defaultValue:m(),description:"Shell type (bash, zsh, fish, powershell). Defaults to current shell if detected.",name:"shell",type:String,typeLabel:"{underline shell}"},{
|
|
5
|
+
`))}}},"execute"),name:"completion",options:[{defaultOption:!0,defaultValue:m(),description:"Shell type (bash, zsh, fish, powershell). Defaults to current shell if detected.",name:"shell",type:String,typeLabel:"{underline shell}"},{defaultValue:u(),description:"JavaScript runtime (node, bun, deno). Defaults to current runtime if detected.",name:"runtime",type:String,typeLabel:"{underline runtime}"}]};export{x as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as OptionDefinition, A as ArgumentDefinition, C as Command, T as Toolbox } from "../packem_shared/plugin-manager.d-
|
|
1
|
+
import { O as OptionDefinition, A as ArgumentDefinition, C as Command, T as Toolbox } from "../packem_shared/plugin-manager.d-BSQtHbWS.js";
|
|
2
2
|
import '@visulima/tabular';
|
|
3
3
|
declare class HelpCommand<TLogger extends Console = Console> implements Command<OptionDefinition<string>, TLogger> {
|
|
4
4
|
argument: ArgumentDefinition<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var E=Object.defineProperty;var b=(a,o)=>E(a,"name",{value:o,configurable:!0});import{green as h,inverse as p,cyan as g,yellow as f}from"@visulima/colorize";import{f as v,p as y}from"../packem_shared/index-
|
|
1
|
+
var E=Object.defineProperty;var b=(a,o)=>E(a,"name",{value:o,configurable:!0});import{green as h,inverse as p,cyan as g,yellow as f}from"@visulima/colorize";import{f as v,p as y}from"../packem_shared/index-CkkDAMKi.js";const N=[{defaultValue:"32",description:"Controls the verbosity level of output. Valid values: '16' (quiet), '32' (normal), '64' (verbose), '128' (debug)",name:"CEREBRO_OUTPUT_LEVEL",type:String},{description:"Sets the minimum required Node.js version. Overrides the default minimum version check",name:"CEREBRO_MIN_NODE_VERSION",type:Number},{defaultValue:!1,description:"When set, disables the update notifier check",name:"NO_UPDATE_NOTIFIER",type:Boolean},{description:"Standard Node.js environment variable. When set to 'test', disables update notifier",name:"NODE_ENV",type:String},{defaultValue:!1,description:"When set, enables debug output (same as --debug flag)",name:"DEBUG",type:Boolean},{description:"Sets the terminal width for table rendering. Useful for testing and consistent output",name:"CEREBRO_TERMINAL_WIDTH",type:Number}];var w=Object.defineProperty,u=b((a,o)=>w(a,"name",{value:o,configurable:!0}),"f");const $="__Other",C=u(a=>a.charAt(0).toUpperCase()+a.slice(1),"upperFirstChar"),A=u((a,o,l,i)=>{a.debug("no command given, printing general help...");let m=[...new Set(l.values())].filter(n=>!n.hidden);i&&(m=m.filter(n=>n.group===i));const e=m.reduce((n,s)=>{const d=s.group??$;return n[d]??=[],n[d].push(s),n},{}),r=u(n=>n.map(s=>{let d="";typeof s.alias=="string"?d=s.alias:Array.isArray(s.alias)&&(d=s.alias.join(", ")),d!==""&&(d=` [${d}]`);let t=s.name;return s.commandPath&&s.commandPath.length>0&&(t=`${s.commandPath.join(" ")} ${s.name}`),[`${h(t)}${d}`,s.description??""]}),"buildCommandList");(a.raw??a.log)(y([{content:`${g(o.getCliName())} ${h("<command>")} [positional arguments] ${f("[options]")}`,header:p.cyan(" Usage ")},...Object.keys(e).map(n=>{const s=i?` ${C(i)}`:"";return{content:r(e[n]),header:n===$||i?p.green(` Available${s} Commands `):` ${p.green(` ${C(n)} `)}`}}),l.has("help")?{header:p.yellow(" Command Options "),optionList:l.get("help").options?.filter(n=>!n.hidden)}:void 0,{header:p.yellow(" Global Options "),optionList:o.getGlobalOptions()},{content:N.filter(n=>!n.hidden).map(n=>[n.name,n.description??""]),header:p.magenta(" Environment Variables ")},{content:`Run "${g(o.getCliName())} ${h("help <command>")}" or "${g(o.getCliName())} ${h("<command>")} ${f("--help")}" for help with a specific command.`,raw:!0}].filter(Boolean)))},"printGeneralHelp"),O=u((a,o)=>{const l=[];for(const i of a.values()){if(i.hidden)continue;const m=i.commandPath??[];if(m.length!==o.length)continue;let e=!0;for(const[r,n]of o.entries())if(m[r]!==n){e=!1;break}e&&l.push(i)}return l},"findChildren"),P=u((a,o,l,i)=>{const m=l.join(" "),e=[{content:`${g(o.getCliName())} ${h(m)} ${h("<subcommand>")} [positional arguments] ${f("[options]")}`,header:p.cyan(" Usage ")},{content:i.map(r=>{const n=[...r.commandPath??[],r.name].join(" ");return[h(n),r.description??""]}),header:p.green(" Subcommands ")},{header:p.yellow(" Global Options "),optionList:o.getGlobalOptions()},{content:`Run "${g(o.getCliName())} ${h(`${m} <subcommand>`)} ${f("--help")}" for help with a specific subcommand.`,raw:!0}];(a.raw??a.log)(y(e))},"printParentHelp"),j=u((a,o,l,i,m)=>{let e=m??l.get(i);if(!e)for(const t of l.values()){const c=t.commandPath?[...t.commandPath,t.name]:[t.name];if(c.at(-1)===i||c.join(" ")===i){e=t;break}}if(!e){const t=i.split(" ").filter(Boolean),c=t.length>0?O(l,t):[];if(c.length>0){P(a,o,t,c);return}a.error(`Command "${i}" not found`);return}const r=[],n=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" ");if(r.push({content:`${g(o.getCliName())} ${h(n)}${e.argument?" [positional arguments]":""}${e.options?" [options]":""}`,header:p.cyan(" Usage ")}),e.description&&r.push({content:e.description,header:p.green(" Description ")}),e.argument&&r.push({header:"Command Positional Arguments",isArgument:!0,optionList:[e.argument]}),Array.isArray(e.options)&&e.options.length>0&&r.push({header:p.yellow(" Command Options "),optionList:e.options.filter(t=>!t.hidden)}),r.push({header:p.yellow(" Global Options "),optionList:o.getGlobalOptions()}),Array.isArray(e.env)&&e.env.length>0){const t=e.env.filter(c=>!c.hidden);t.length>0&&r.push({content:t.map(c=>[c.name,c.description??""]),header:p.magenta(" Environment Variables ")})}if(e.alias!==void 0&&e.alias.length>0){let t=e.alias;typeof e.alias=="string"&&(t=[e.alias]),r.splice(1,0,{content:t,header:"Alias(es)"})}Array.isArray(e.examples)&&e.examples.length>0&&r.push({content:e.examples,header:"Examples"});const s=[...e.commandPath??[],e.name],d=O(l,s);d.length>0&&r.push({content:d.map(t=>{const c=[...t.commandPath??[],t.name].join(" ");return[h(c),t.description??""]}),header:p.green(" Subcommands ")}),(a.raw??a.log)(y(r))},"printCommandHelp");class L{static{b(this,"x")}static{u(this,"HelpCommand")}argument={description:"Command to show help for (subcommand path supported, e.g. `cli help docker build`)",name:"command",type:String};name="help";options=[{description:"Display only the specified group",name:"group",type:String}];commands;constructor(o){this.commands=o}execute(o){const{argument:l,command:i,commandName:m,logger:e,options:r,runtime:n}=o,{footer:s,header:d}=n.getCommandSection();d&&(e.raw??e.log)(v(d));const t=m==="help"&&Array.isArray(l)&&l.length>0?l.join(" "):void 0;if(m==="help"&&t===void 0)A(e,n,this.commands,typeof r?.group=="string"?r.group:void 0);else{const c=t!==void 0||i===void 0||i.name==="help"?void 0:i;j(e,n,this.commands,t??m,c)}s&&(e.raw??e.log)(v(s))}}export{L as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var O=Object.defineProperty;var f=(e,t)=>O(e,"name",{value:t,configurable:!0});import{createRequire as L}from"node:module";import U from"github-slugger";import{p as G}from"../packem_shared/index-
|
|
1
|
+
var O=Object.defineProperty;var f=(e,t)=>O(e,"name",{value:t,configurable:!0});import{createRequire as L}from"node:module";import U from"github-slugger";import{p as G}from"../packem_shared/index-CkkDAMKi.js";import{g as F,a as M,b as W,c as z}from"../packem_shared/runtime-process-DKHFvYkv.js";const N=L(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=f(e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[t,n]=g.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return g.getBuiltinModule(e)}return N(e)},"__cjs_getBuiltinModule"),{existsSync:v}=A("node:fs"),{readFile:T,mkdir:k,writeFile:B}=A("node:fs/promises"),{resolve:P,join:V,dirname:q}=A("node:path");var H=Object.defineProperty,c=f((e,t)=>H(e,"name",{value:t,configurable:!0}),"m");const I=new U,C=c(e=>I.slug(e),"slugify"),J=c(e=>e.filter(Boolean),"compact"),K=c((e,t)=>{const n=new Set,o=[];for(const r of e){const i=t(r);n.has(i)||(n.add(i),o.push(r))}return o},"uniqBy"),D=c((e,t)=>{const n=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" ");if(e.argument){const o=e.argument.name.toUpperCase(),r=e.argument.required?o:`[${o}]`;return`${t} ${n} ${r}`}return`${t} ${n}`},"formatCommandUsage"),Q=c((e,t)=>{if(!Array.isArray(e.env)||e.env.length===0)return;const n=e.env.filter(o=>!o.hidden);n.length>0&&t.push({content:n.map(o=>[o.name,o.description??""]),header:" Environment Variables "})},"addEnvironmentVariables"),X=c((e,t)=>{const n=[],o=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" "),r=!!e.argument,i=!!e.options;if(n.push({content:`${t} ${o}${r?" [positional arguments]":""}${i?" [options]":""}`,header:" Usage "}),e.description&&n.push({content:e.description,header:" Description "}),e.argument&&n.push({header:"Command Positional Arguments",isArgument:!0,optionList:[e.argument]}),Array.isArray(e.options)&&e.options.length>0&&n.push({header:" Command Options ",optionList:e.options.filter(a=>!a.hidden)}),Q(e,n),e.alias!==void 0&&e.alias.length>0){const a=Array.isArray(e.alias)?e.alias:[e.alias];n.splice(1,0,{content:a,header:"Alias(es)"})}return Array.isArray(e.examples)&&e.examples.length>0&&n.push({content:e.examples,header:"Examples"}),G(n)},"formatCommandHelp"),Y=c((e,t)=>{const n=e.description?.trim().split(`
|
|
2
2
|
`)[0]??"",o=D(e,t),r=X(e,t);return J([`## \`${o}\``,n,`\`\`\`
|
|
3
3
|
${r.trim()}
|
|
4
4
|
\`\`\``]).join(`
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as CerebroFs, b as CommandSection, O as OptionDefinition, C as Command, P as Plugin, c as PluginManager, d as CliRunOptions, R as RunCommandOptions, T as Toolbox, e as CommandExecute, f as Cli$1, L as LazyCommandModule } from "./packem_shared/plugin-manager.d-
|
|
2
|
-
export { type A as ArgumentDefinition, type g as CerebroProcess, type E as EnvDefinition, type h as OutputType, type i as PluginContext, type V as VERBOSITY_LEVEL } from "./packem_shared/plugin-manager.d-
|
|
1
|
+
import { a as CerebroFs, b as CommandSection, O as OptionDefinition, C as Command, P as Plugin, c as PluginManager, d as CliRunOptions, R as RunCommandOptions, T as Toolbox, e as CommandExecute, f as Cli$1, L as LazyCommandModule } from "./packem_shared/plugin-manager.d-BSQtHbWS.js";
|
|
2
|
+
export { type A as ArgumentDefinition, type g as CerebroProcess, type E as EnvDefinition, type h as OutputType, type i as PluginContext, type V as VERBOSITY_LEVEL } from "./packem_shared/plugin-manager.d-BSQtHbWS.js";
|
|
3
3
|
export { V as VisulimaError } from "./packem_shared/index.d-Br8HpP0A.js";
|
|
4
4
|
import '@visulima/tabular';
|
|
5
5
|
type CliOptions<T extends Console = Console> = {
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a=Object.defineProperty;var o=(r,e)=>a(r,"name",{value:e,configurable:!0});import{Cli as t}from"./packem_shared/Cerebro-
|
|
1
|
+
var a=Object.defineProperty;var o=(r,e)=>a(r,"name",{value:e,configurable:!0});import{Cli as t}from"./packem_shared/Cerebro-BN_nIZ8z.js";import{VERBOSITY_DEBUG as R,VERBOSITY_NORMAL as V,VERBOSITY_QUIET as b,VERBOSITY_VERBOSE as c}from"./packem_shared/VERBOSITY_QUIET-XPultrIA.js";import{lazyNamed as n}from"./packem_shared/lazyNamed-DOmefeJM.js";import{p as S}from"./packem_shared/isVisulimaError-jVZgumOU-C4fgdbWg.js";var E=Object.defineProperty,m=o((r,e)=>E(r,"name",{value:e,configurable:!0}),"t");const f=m((r,e)=>new t(r,e),"createCerebro");export{t as Cerebro,R as VERBOSITY_DEBUG,V as VERBOSITY_NORMAL,b as VERBOSITY_QUIET,c as VERBOSITY_VERBOSE,S as VisulimaError,f as createCerebro,n as lazyNamed};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var Xt=Object.defineProperty;var _=(r,a)=>Xt(r,"name",{value:a,configurable:!0});import{createRequire as en}from"node:module";import{findCacheDirSync as sn}from"@visulima/find-cache-dir";import{c as an}from"../packem_shared/cerebro-error-BnJTixb2.js";const tn=en(import.meta.url),U=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ve=_(r=>{if(typeof U<"u"&&U.versions&&U.versions.node){const[a,i]=U.versions.node.split(".").map(Number);if(a>22||a===22&&i>=3||a===20&&i>=16)return U.getBuiltinModule(r)}return tn(r)},"__cjs_getBuiltinModule"),{existsSync:be,readFileSync:nn,mkdirSync:rn,writeFileSync:on}=ve("node:fs"),{get:cn}=ve("node:https");var un=Object.defineProperty,ln=_((r,a)=>un(r,"name",{value:a,configurable:!0}),"o$1");const fn=ln((r,a)=>{const i=r.split(".").map(Number),f=a.split(".").map(Number);for(const[d,h]of i.entries()){if(h>f[d])return!0;if(h<f[d])return!1}return!1},"semverGt");var pn=Object.defineProperty,gn=_((r,a)=>pn(r,"name",{value:a,configurable:!0}),"$e"),dn=Object.defineProperty,H=gn((r,a)=>dn(r,"name",{value:a,configurable:!0}),"W"),hn=Object.defineProperty,u=H((r,a)=>hn(r,"name",{value:a,configurable:!0}),"u$1");let xe=u(()=>{var r=(()=>{var a=Object.defineProperty,i=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,h=u((e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},"ne"),$=u((e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of f(t))!d.call(e,o)&&o!==n&&a(e,o,{get:u(()=>t[o],"get"),enumerable:!(s=i(t,o))||s.enumerable});return e},"ae"),m=u(e=>$(a({},"__esModule",{value:!0}),e),"oe"),y={};h(y,{zeptomatch:u(()=>me,"zeptomatch")});var K=u(e=>{const t=new Set,n=[e];for(let s=0;s<n.length;s++){const o=n[s];if(t.has(o))continue;t.add(o);const{children:c}=o;if(c?.length)for(let l=0,g=c.length;l<g;l++)n.push(c[l])}return Array.from(t)},"M"),Ee=u(e=>{let t="";const n=K(e);for(let s=0,o=n.length;s<o;s++){const c=n[s];if(!c.regex)continue;const l=c.regex.flags;if(t||(t=l),t!==l)throw new Error(`Inconsistent RegExp flags used: "${t}" and "${l}"`)}return t},"se"),Q=u((e,t,n)=>{const s=n.get(e);if(s!==void 0)return s;const o=e.partial??t;let c="";if(e.regex&&(c+=o?"(?:$|":"",c+=e.regex.source),e.children?.length){const l=Re(e.children.map(g=>Q(g,t,n)).filter(Boolean));if(l?.length){const g=e.children.some(C=>!C.regex||!(C.partial??t)),v=l.length>1||o&&(!c.length||g);c+=v?o?"(?:$|":"(?:":"",c+=l.join("|"),c+=v?")":""}}return e.regex&&(c+=o?")":""),n.set(e,c),c},"O"),ke=u((e,t)=>{const n=new Map,s=K(e);for(let o=s.length-1;o>=0;o--){const c=Q(s[o],t,n);if(!(o>0))return c}return""},"ie"),Re=u(e=>Array.from(new Set(e)),"ue"),D=u((e,t,n)=>D.compile(e,n).test(t),"R");D.compile=(e,t)=>{const n=t?.partial??!1,s=ke(e,n),o=Ee(e);return new RegExp(`^(?:${s})$`,o)};var Me=D,Ae=u((e,t)=>{const n=Me.compile(e,t),s=`${n.source.slice(0,-1)}[\\\\/]?$`,o=n.flags;return new RegExp(s,o)},"le"),Ne=Ae,Se=u(e=>{const t=e.map(s=>s.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"ve"),Pe=Se,X=u(e=>Array.isArray(e),"j"),P=u(e=>typeof e=="function","_"),ze=u(e=>e.length===0,"he"),Ce=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return n=>(n.length===0||n.length===1)&&t.test(e.call(n))})(),Ie=u(e=>typeof e=="number","de"),Ue=u(e=>typeof e=="object"&&e!==null,"xe"),Te=u(e=>e instanceof RegExp,"me"),Be=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),De=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),ee=u(e=>typeof e=="string","A"),O=u(e=>e===void 0,"f"),Fe=u(e=>{const t=new Map;return n=>{const s=t.get(n);if(s!==void 0)return s;const o=e(n);return t.set(n,o),o}},"ye"),te=u((e,t,n={})=>{const s={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},o=E(t)(s),c=Math.max(s.index,s.indexBacktrackMax);if(o&&s.index===e.length)return s.output;throw new Error(`Failed to parse at index ${c}`)},"I"),p=u((e,t)=>X(e)?Le(e,t):ee(e)?ne(e,t):qe(e,t),"i"),Le=u((e,t)=>{const n={};for(const s of e){if(s.length!==1)throw new Error(`Invalid character: "${s}"`);const o=s.charCodeAt(0);n[o]=!0}return s=>{const o=s.input;let c=s.index,l=c;for(;l<o.length&&o.charCodeAt(l)in n;)l+=1;if(l>c){if(!O(t)&&!s.options.silent){const g=o.slice(c,l),v=P(t)?t(g,o,`${c}`):t;O(v)||s.output.push(v)}s.index=l}return!0}},"we"),qe=u((e,t)=>{if(De(e))return ne(e.source,t);{const n=e.source,s=e.flags.replace(/y|$/,"y"),o=new RegExp(n,s);return Be(e)&&P(t)&&!Ce(t)?We(o,t):Ze(o,t)}},"$e"),We=u((e,t)=>n=>{const s=n.index,o=n.input;e.lastIndex=s;const c=e.exec(o);if(c){const l=e.lastIndex;if(!n.options.silent){const g=t(...c,o,`${s}`);O(g)||n.output.push(g)}return n.index=l,!0}else return!1},"Ee"),Ze=u((e,t)=>n=>{const s=n.index,o=n.input;if(e.lastIndex=s,e.test(o)){const c=e.lastIndex;if(!O(t)&&!n.options.silent){const l=P(t)?t(o.slice(s,c),o,`${s}`):t;O(l)||n.output.push(l)}return n.index=c,!0}else return!1},"Ce"),ne=u((e,t)=>n=>{const s=n.index,o=n.input;if(o.startsWith(e,s)){if(!O(t)&&!n.options.silent){const c=P(t)?t(e,o,`${s}`):t;O(c)||n.output.push(c)}return n.index+=e.length,!0}else return!1},"F"),F=u((e,t,n,s)=>{const o=E(e),c=t>1;return q(L(oe(l=>{let g=0;for(;g<n;){const v=l.index;if(!o(l)||(g+=1,l.index===v))break}return g>=t},c),s))},"k"),re=u((e,t)=>F(e,0,1,t),"L"),B=u((e,t)=>F(e,0,1/0,t),"$"),Ve=u((e,t)=>F(e,1,1/0,t),"Re"),A=u((e,t)=>{const n=e.map(E);return q(L(oe(s=>{for(let o=0,c=n.length;o<c;o++)if(!n[o](s))return!1;return!0}),t))},"x"),w=u((e,t)=>{const n=e.map(E);return q(L(s=>{for(let o=0,c=n.length;o<c;o++)if(n[o](s))return!0;return!1},t))},"p"),oe=u((e,t=!0,n=!1)=>{const s=E(e);return t?o=>{const c=o.index,l=o.output.length,g=s(o);return!g&&!n&&(o.indexBacktrackMax=Math.max(o.indexBacktrackMax,o.index)),(!g||n)&&(o.index=c,o.output.length!==l&&(o.output.length=l)),g}:s},"q"),L=u((e,t)=>{const n=E(e);return t?s=>{if(s.options.silent)return n(s);const o=s.output.length;if(n(s)){const c=s.output.splice(o,1/0),l=t(c);return O(l)||s.output.push(l),!0}else return!1}:n},"B"),q=(()=>{let e=0;return t=>{const n=E(t),s=e+=1;return o=>{var c;if(o.options.memoization===!1)return n(o);const l=o.index,g=(c=o.cache)[s]||(c[s]={indexMax:-1,queue:[]}),v=g.queue;if(l<=g.indexMax){const I=g.store||(g.store=new Map);if(v.length){for(let S=0,Yt=v.length;S<Yt;S+=2){const Kt=v[S*2],Qt=v[S*2+1];I.set(Kt,Qt)}v.length=0}const j=I.get(l);if(j===!1)return!1;if(Ie(j))return o.index=j,!0;if(j)return o.index=j.index,j.output?.length&&o.output.push(...j.output),!0}const C=o.output.length,Ht=n(o);if(g.indexMax=Math.max(g.indexMax,l),Ht){const I=o.index,j=o.output.length;if(j>C){const S=o.output.slice(C,j);v.push(l,{index:I,output:S})}else v.push(l,I);return!0}else return v.push(l,!1),!1}}})(),se=u(e=>{let t;return n=>(t||(t=E(e())),t(n))},"G"),E=Fe(e=>{if(P(e))return ze(e)?se(e):e;if(ee(e)||Te(e))return p(e);if(X(e))return A(e);if(Ue(e))return w(Object.values(e));throw new Error("Invalid rule")}),R=u(e=>e,"d"),Ge=u(e=>typeof e=="string","ke"),Je=u(e=>{const t=new WeakMap,n=new WeakMap;return(s,o)=>{const c=o?.partial?n:t,l=c.get(s);if(l!==void 0)return l;const g=e(s,o);return c.set(s,g),g}},"Be"),He=u(e=>{const t={},n={};return(s,o)=>{const c=o?.partial?n:t;return c[s]??(c[s]=e(s,o))}},"Pe"),Ye=p(/\\./,R),Ke=p(/./,R),Qe=p(/\*\*\*+/,"*"),Xe=p(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),et=p(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),tt=B(w([Ye,Qe,Xe,et,Ke])),nt=tt,rt=u(e=>te(e,nt,{memoization:!1}).join(""),"Ie"),ot=rt,ae="abcdefghijklmnopqrstuvwxyz",st=u(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=ae[n]+t,e=Math.floor((e-1)/26)}return t},"Le"),ie=u(e=>{let t=0;for(let n=0,s=e.length;n<s;n++)t=t*26+ae.indexOf(e[n])+1;return t},"V"),W=u((e,t)=>{if(t<e)return W(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"b"),at=u((e,t,n)=>W(e,t).map(s=>String(s).padStart(n,"0")),"qe"),ce=u((e,t)=>W(ie(e),ie(t)).map(st),"W"),x=u(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"c"),z=u(e=>({children:e}),"y"),N=(()=>{const e=u((t,n,s)=>{if(s.has(t))return;s.add(t);const{children:o}=t;if(!o.length)o.push(n);else for(let c=0,l=o.length;c<l;c++)e(o[c],n,s)},"e");return t=>{if(!t.length)return z([]);for(let n=t.length-1;n>=1;n--){const s=new Set,o=t[n-1],c=t[n];e(o,c,s)}return t[0]}})(),k=u(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),it=p(/\\./,x),ct=p(/[$.*+?^(){}[\]\|]/,e=>x(`\\${e}`)),ut=p(/[\\\/]/,k),lt=p(/[^$.*+?^(){}[\]\|\\\/]+/,x),ft=p(/^(?:!!)*!(.*)$/,(e,t)=>x(`(?!^${me.compile(t).source}$).*?`)),pt=p(/^(!!)+/),gt=w([ft,pt]),dt=p(/\/(\*\*\/)+/,()=>z([N([k(),x(".+?"),k()]),k()])),ht=p(/^(\*\*\/)+/,()=>z([x("^"),N([x(".*?"),k()])])),mt=p(/\/(\*\*)$/,()=>z([N([k(),x(".*?")]),x("$")])),xt=p(/\*\*/,()=>x(".*?")),ue=w([dt,ht,mt,xt]),$t=p(/\*\/(?!\*\*\/|\*$)/,()=>N([x("[^\\\\/]*?"),k()])),vt=p(/\*/,()=>x("[^\\\\/]*")),le=w([$t,vt]),fe=p("?",()=>x("[^\\\\/]")),bt=p("[",R),yt=p("]",R),wt=p(/[!^]/,"^\\\\/"),jt=p(/[a-z]-[a-z]|[0-9]-[0-9]/i,R),_t=p(/\\./,R),Ot=p(/[$.*+?^(){}[\|]/,e=>`\\${e}`),Et=p(/[\\\/]/,"\\\\/"),kt=p(/[^$.*+?^(){}[\]\|\\\/]+/,R),Rt=w([_t,Ot,Et,jt,kt]),pe=A([bt,re(wt),B(Rt),yt],e=>x(e.join(""))),Mt=p("{","(?:"),At=p("}",")"),Nt=p(/(\d+)\.\.(\d+)/,(e,t,n)=>at(+t,+n,Math.min(t.length,n.length)).join("|")),St=p(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>ce(t,n).join("|")),Pt=p(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>ce(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),zt=w([Nt,St,Pt]),ge=A([Mt,zt,At],e=>x(e.join(""))),Ct=p("{"),It=p("}"),Ut=p(","),Tt=p(/\\./,x),Bt=p(/[$.*+?^(){[\]\|]/,e=>x(`\\${e}`)),Dt=p(/[\\\/]/,k),Ft=p(/[^$.*+?^(){}[\]\|\\\/,]+/,x),Lt=se(()=>he),qt=p("",()=>x("(?:)")),Wt=Ve(w([ue,le,fe,pe,ge,Lt,Tt,Bt,Dt,Ft]),N),de=w([Wt,qt]),he=A([Ct,re(A([de,B(A([Ut,de]))])),It],z),Zt=B(w([gt,ue,le,fe,pe,ge,he,it,ct,ut,lt]),N),Vt=Zt,Gt=u(e=>te(e,Vt,{memoization:!1})[0],"kr"),Jt=Gt,Z=u((e,t,n)=>Z.compile(e,n).test(t),"N");Z.compile=(()=>{const e=He((n,s)=>Ne(Jt(ot(n)),s)),t=Je((n,s)=>Pe(n.map(o=>e(o,s))));return(n,s)=>Ge(n)?e(n,s):t(n,s)})();var me=Z;return m(y)})();return r.default||r},"_lazyMatch"),V;const mn=u((r,a)=>(V||(V=xe(),xe=null),V(r,a)),"default");var xn=Object.defineProperty,$n=H((r,a)=>xn(r,"name",{value:a,configurable:!0}),"t$1");const vn=/^[A-Z]:\//i,M=$n((r="")=>r&&r.replaceAll("\\","/").replace(vn,a=>a.toUpperCase()),"normalizeWindowsPath");var bn=Object.defineProperty,b=H((r,a)=>bn(r,"name",{value:a,configurable:!0}),"r");const yn=/^[/\\]{2}/,wn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,ye=/^[A-Z]:$/i,$e=/^\/([A-Z]:)?$/i,jn=/.(\.[^./]+)$/,_n=/^[/\\]|^[a-z]:[/\\]/i,On=/\/$/,En=b(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),we=b((r,a)=>{let i="",f=0,d=-1,h=0,$;for(let m=0;m<=r.length;++m){if(m<r.length)$=r[m];else{if($==="/")break;$="/"}if($==="/"){if(!(d===m-1||h===1))if(h===2){if(i.length<2||f!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const y=i.lastIndexOf("/");y===-1?(i="",f=0):(i=i.slice(0,y),f=i.length-1-i.lastIndexOf("/")),d=m,h=0;continue}else if(i.length>0){i="",f=0,d=m,h=0;continue}}a&&(i+=i.length>0?"/..":"..",f=2)}else i.length>0?i+=`/${r.slice(d+1,m)}`:i=r.slice(d+1,m),f=m-d-1;d=m,h=0}else $==="."&&h!==-1?++h:h=-1}return i},"normalizeString"),T=b(r=>wn.test(r),"isAbsolute"),je=b(function(r){if(r.length===0)return".";r=M(r);const a=yn.exec(r),i=T(r),f=r.at(-1)==="/";return r=we(r,!i),r.length===0?i?"/":f?"./":".":(f&&(r+="/"),ye.test(r)&&(r+="/"),a?i?`//${r}`:`//./${r}`:i&&!T(r)?`/${r}`:r)},"normalize"),kn=b((...r)=>{let a="";for(const i of r)if(i)if(a.length>0){const f=a.at(-1)==="/",d=i[0]==="/";f&&d?a+=i.slice(1):a+=f||d?i:`/${i}`}else a+=i;return je(a)},"join"),G=b(function(...r){r=r.map(f=>M(f));let a="",i=!1;for(let f=r.length-1;f>=-1&&!i;f--){const d=f>=0?r[f]:En();!d||d.length===0||(a=`${d}/${a}`,i=T(d))}return a=we(a,!i),i&&!T(a)?`/${a}`:a.length>0?a:"."},"resolve");b(function(r){return M(r)},"toNamespacedPath");const Rn=b(function(r){return jn.exec(M(r))?.[1]??""},"extname");b(function(r,a){const i=G(r).replace($e,"$1").split("/"),f=G(a).replace($e,"$1").split("/");if(f[0][1]===":"&&i[0][1]===":"&&i[0]!==f[0])return f.join("/");const d=[...i];for(const h of d){if(f[0]!==h)break;i.shift(),f.shift()}return[...i.map(()=>".."),...f].join("/")},"relative");const _e=b(r=>{const a=M(r).replace(On,"").split("/").slice(0,-1);return a.length===1&&ye.test(a[0])&&(a[0]=`${a[0]}/`),a.join("/")||(T(r)?"/":".")},"dirname");b(function(r){const a=[r.root,r.dir,r.base??r.name+r.ext].filter(Boolean);return M(r.root?G(...a):a.join("/"))},"format");const Mn=b((r,a)=>{const i=M(r).split("/").pop();return a&&i.endsWith(a)?i.slice(0,-a.length):i},"basename");b(function(r){const a=_n.exec(r)?.[0]?.replaceAll("\\","/")??"",i=Mn(r),f=Rn(i);return{base:i,dir:_e(r),ext:f,name:i.slice(0,i.length-f.length),root:a}},"parse");b((r,a)=>mn(a,je(r)),"matchesGlob");var An=Object.defineProperty,Nn=_((r,a)=>An(r,"name",{value:a,configurable:!0}),"e");let J=class extends an{static{_(this,"p")}static{Nn(this,"UpdateNotifierError")}constructor(a,i="UPDATE_NOTIFIER_ERROR",f){super(a,i,f),this.name="UpdateNotifierError"}};var Sn=Object.defineProperty,Y=_((r,a)=>Sn(r,"name",{value:a,configurable:!0}),"n");const Pn="last-update-check.json",Oe=Y(r=>{const a=sn(r);if(a===void 0)throw new J("Could not find cache directory","CACHE_DIRECTORY_NOT_FOUND",{packageName:r});return kn(a,Pn)},"getConfigFile"),zn=Y(r=>{const a=Oe(r);try{if(!be(a))return;const{lastUpdateCheck:i}=JSON.parse(nn(a,"utf8"));return i}catch{return}},"getLastUpdate"),Cn=Y(r=>{const a=Oe(r),i=_e(a);be(i)||rn(i,{recursive:!0}),on(a,JSON.stringify({lastUpdateCheck:Date.now()}))},"saveLastUpdate");var In=Object.defineProperty,Un=_((r,a)=>In(r,"name",{value:a,configurable:!0}),"g$1");const Tn=Un(async(r,a,i)=>{const f=i.replace("__NAME__",r);return await new Promise((d,h)=>{cn(f,$=>{let m="";$.on("data",y=>m+=String(y)),$.on("end",()=>{try{const y=JSON.parse(m)[a];y||h(new J("Error getting version","VERSION_FETCH_ERROR",{distributionTag:a,packageName:r})),d(y)}catch{h(new J("Could not parse version response","VERSION_PARSE_ERROR",{distributionTag:a,packageName:r}))}})}).on("error",$=>{h($)})})},"getDistributionVersion");var Bn=Object.defineProperty,Dn=_((r,a)=>Bn(r,"name",{value:a,configurable:!0}),"i");const Vn=Dn(async({alwaysRun:r,debug:a,distTag:i="latest",pkg:f,registryUrl:d="https://registry.npmjs.org/-/package/__NAME__/dist-tags",updateCheckInterval:h=1e3*60*60*24})=>{const $=zn(f.name);if(r||!$||$<Date.now()-h){const m=await Tn(f.name,i,d);if(Cn(f.name),fn(m,f.version))return m;a&&console.error(`Latest version (${m}) not newer than current version (${f.version})`)}else a&&console.error(`Too recent to check for a new update. simpleUpdateNotifier() interval set to ${String(h)}ms but only ${String(Date.now()-$)}ms since last check.`)},"hasNewVersion");export{Vn as default};
|
|
1
|
+
var tn=Object.defineProperty;var R=(r,a)=>tn(r,"name",{value:a,configurable:!0});import{createRequire as nn}from"node:module";import{findCacheDirSync as un}from"@visulima/find-cache-dir";import{c as cn}from"../packem_shared/cerebro-error-BnJTixb2.js";const rn=nn(import.meta.url),L=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_e=R(r=>{if(typeof L<"u"&&L.versions&&L.versions.node){const[a,i]=L.versions.node.split(".").map(Number);if(a>22||a===22&&i>=3||a===20&&i>=16)return L.getBuiltinModule(r)}return rn(r)},"__cjs_getBuiltinModule"),{existsSync:je,readFileSync:on,mkdirSync:sn,writeFileSync:an}=_e("node:fs"),{get:ln}=_e("node:https");var fn=Object.defineProperty,Oe=R((r,a)=>fn(r,"name",{value:a,configurable:!0}),"d$1");const be=Oe(r=>{const[a,i]=r.split("-");return{nums:a.split(".").map(l=>Number.parseInt(l,10)||0),pre:i}},"parse"),pn=Oe((r,a)=>{const i=be(r),l=be(a),h=Math.max(i.nums.length,l.nums.length);for(let v=0;v<h;v++){const y=i.nums[v]??0,w=l.nums[v]??0;if(y>w)return!0;if(y<w)return!1}if(i.pre===void 0&&l.pre!==void 0)return!0;if(i.pre!==void 0&&l.pre===void 0||i.pre===void 0&&l.pre===void 0)return!1;const m=i.pre.split("."),x=l.pre.split("."),d=Math.max(m.length,x.length);for(let v=0;v<d;v++){const y=m[v],w=x[v];if(y===void 0)return!1;if(w===void 0)return!0;if(y===w)continue;const A=Number.parseInt(y,10),T=Number.parseInt(w,10),Z=!Number.isNaN(A)&&String(A)===y,C=!Number.isNaN(T)&&String(T)===w;return Z&&C?A>T:Z?!1:C?!0:y>w}return!1},"semverGt");var dn=Object.defineProperty,gn=R((r,a)=>dn(r,"name",{value:a,configurable:!0}),"$e"),hn=Object.defineProperty,ee=gn((r,a)=>hn(r,"name",{value:a,configurable:!0}),"W"),mn=Object.defineProperty,c=ee((r,a)=>mn(r,"name",{value:a,configurable:!0}),"u$1");let ye=c(()=>{var r=(()=>{var a=Object.defineProperty,i=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,h=Object.prototype.hasOwnProperty,m=c((e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},"ne"),x=c((e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of l(t))!h.call(e,o)&&o!==n&&a(e,o,{get:c(()=>t[o],"get"),enumerable:!(s=i(t,o))||s.enumerable});return e},"ae"),d=c(e=>x(a({},"__esModule",{value:!0}),e),"oe"),v={};m(v,{zeptomatch:c(()=>$e,"zeptomatch")});var y=c(e=>{const t=new Set,n=[e];for(let s=0;s<n.length;s++){const o=n[s];if(t.has(o))continue;t.add(o);const{children:u}=o;if(u?.length)for(let f=0,g=u.length;f<g;f++)n.push(u[f])}return Array.from(t)},"M"),w=c(e=>{let t="";const n=y(e);for(let s=0,o=n.length;s<o;s++){const u=n[s];if(!u.regex)continue;const f=u.regex.flags;if(t||(t=f),t!==f)throw new Error(`Inconsistent RegExp flags used: "${t}" and "${f}"`)}return t},"se"),A=c((e,t,n)=>{const s=n.get(e);if(s!==void 0)return s;const o=e.partial??t;let u="";if(e.regex&&(u+=o?"(?:$|":"",u+=e.regex.source),e.children?.length){const f=Z(e.children.map(g=>A(g,t,n)).filter(Boolean));if(f?.length){const g=e.children.some(F=>!F.regex||!(F.partial??t)),b=f.length>1||o&&(!u.length||g);u+=b?o?"(?:$|":"(?:":"",u+=f.join("|"),u+=b?")":""}}return e.regex&&(u+=o?")":""),n.set(e,u),u},"O"),T=c((e,t)=>{const n=new Map,s=y(e);for(let o=s.length-1;o>=0;o--){const u=A(s[o],t,n);if(!(o>0))return u}return""},"ie"),Z=c(e=>Array.from(new Set(e)),"ue"),C=c((e,t,n)=>C.compile(e,n).test(t),"R");C.compile=(e,t)=>{const n=t?.partial??!1,s=T(e,n),o=w(e);return new RegExp(`^(?:${s})$`,o)};var Se=C,Ae=c((e,t)=>{const n=Se.compile(e,t),s=`${n.source.slice(0,-1)}[\\\\/]?$`,o=n.flags;return new RegExp(s,o)},"le"),Ce=Ae,Ie=c(e=>{const t=e.map(s=>s.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"ve"),Pe=Ie,ne=c(e=>Array.isArray(e),"j"),U=c(e=>typeof e=="function","_"),ze=c(e=>e.length===0,"he"),Te=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return n=>(n.length===0||n.length===1)&&t.test(e.call(n))})(),Ue=c(e=>typeof e=="number","de"),Be=c(e=>typeof e=="object"&&e!==null,"xe"),Fe=c(e=>e instanceof RegExp,"me"),De=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),Le=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),re=c(e=>typeof e=="string","A"),E=c(e=>e===void 0,"f"),qe=c(e=>{const t=new Map;return n=>{const s=t.get(n);if(s!==void 0)return s;const o=e(n);return t.set(n,o),o}},"ye"),oe=c((e,t,n={})=>{const s={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},o=N(t)(s),u=Math.max(s.index,s.indexBacktrackMax);if(o&&s.index===e.length)return s.output;throw new Error(`Failed to parse at index ${u}`)},"I"),p=c((e,t)=>ne(e)?We(e,t):re(e)?se(e,t):Ze(e,t),"i"),We=c((e,t)=>{const n={};for(const s of e){if(s.length!==1)throw new Error(`Invalid character: "${s}"`);const o=s.charCodeAt(0);n[o]=!0}return s=>{const o=s.input;let u=s.index,f=u;for(;f<o.length&&o.charCodeAt(f)in n;)f+=1;if(f>u){if(!E(t)&&!s.options.silent){const g=o.slice(u,f),b=U(t)?t(g,o,`${u}`):t;E(b)||s.output.push(b)}s.index=f}return!0}},"we"),Ze=c((e,t)=>{if(Le(e))return se(e.source,t);{const n=e.source,s=e.flags.replace(/y|$/,"y"),o=new RegExp(n,s);return De(e)&&U(t)&&!Te(t)?Ve(o,t):He(o,t)}},"$e"),Ve=c((e,t)=>n=>{const s=n.index,o=n.input;e.lastIndex=s;const u=e.exec(o);if(u){const f=e.lastIndex;if(!n.options.silent){const g=t(...u,o,`${s}`);E(g)||n.output.push(g)}return n.index=f,!0}else return!1},"Ee"),He=c((e,t)=>n=>{const s=n.index,o=n.input;if(e.lastIndex=s,e.test(o)){const u=e.lastIndex;if(!E(t)&&!n.options.silent){const f=U(t)?t(o.slice(s,u),o,`${s}`):t;E(f)||n.output.push(f)}return n.index=u,!0}else return!1},"Ce"),se=c((e,t)=>n=>{const s=n.index,o=n.input;if(o.startsWith(e,s)){if(!E(t)&&!n.options.silent){const u=U(t)?t(e,o,`${s}`):t;E(u)||n.output.push(u)}return n.index+=e.length,!0}else return!1},"F"),H=c((e,t,n,s)=>{const o=N(e),u=t>1;return J(G(ie(f=>{let g=0;for(;g<n;){const b=f.index;if(!o(f)||(g+=1,f.index===b))break}return g>=t},u),s))},"k"),ae=c((e,t)=>H(e,0,1,t),"L"),V=c((e,t)=>H(e,0,1/0,t),"$"),Ge=c((e,t)=>H(e,1,1/0,t),"Re"),I=c((e,t)=>{const n=e.map(N);return J(G(ie(s=>{for(let o=0,u=n.length;o<u;o++)if(!n[o](s))return!1;return!0}),t))},"x"),j=c((e,t)=>{const n=e.map(N);return J(G(s=>{for(let o=0,u=n.length;o<u;o++)if(n[o](s))return!0;return!1},t))},"p"),ie=c((e,t=!0,n=!1)=>{const s=N(e);return t?o=>{const u=o.index,f=o.output.length,g=s(o);return!g&&!n&&(o.indexBacktrackMax=Math.max(o.indexBacktrackMax,o.index)),(!g||n)&&(o.index=u,o.output.length!==f&&(o.output.length=f)),g}:s},"q"),G=c((e,t)=>{const n=N(e);return t?s=>{if(s.options.silent)return n(s);const o=s.output.length;if(n(s)){const u=s.output.splice(o,1/0),f=t(u);return E(f)||s.output.push(f),!0}else return!1}:n},"B"),J=(()=>{let e=0;return t=>{const n=N(t),s=e+=1;return o=>{var u;if(o.options.memoization===!1)return n(o);const f=o.index,g=(u=o.cache)[s]||(u[s]={indexMax:-1,queue:[]}),b=g.queue;if(f<=g.indexMax){const D=g.store||(g.store=new Map);if(b.length){for(let z=0,Qt=b.length;z<Qt;z+=2){const Xt=b[z*2],en=b[z*2+1];D.set(Xt,en)}b.length=0}const O=D.get(f);if(O===!1)return!1;if(Ue(O))return o.index=O,!0;if(O)return o.index=O.index,O.output?.length&&o.output.push(...O.output),!0}const F=o.output.length,Kt=n(o);if(g.indexMax=Math.max(g.indexMax,f),Kt){const D=o.index,O=o.output.length;if(O>F){const z=o.output.slice(F,O);b.push(f,{index:D,output:z})}else b.push(f,D);return!0}else return b.push(f,!1),!1}}})(),ue=c(e=>{let t;return n=>(t||(t=N(e())),t(n))},"G"),N=qe(e=>{if(U(e))return ze(e)?ue(e):e;if(re(e)||Fe(e))return p(e);if(ne(e))return I(e);if(Be(e))return j(Object.values(e));throw new Error("Invalid rule")}),M=c(e=>e,"d"),Je=c(e=>typeof e=="string","ke"),Ye=c(e=>{const t=new WeakMap,n=new WeakMap;return(s,o)=>{const u=o?.partial?n:t,f=u.get(s);if(f!==void 0)return f;const g=e(s,o);return u.set(s,g),g}},"Be"),Ke=c(e=>{const t={},n={};return(s,o)=>{const u=o?.partial?n:t;return u[s]??(u[s]=e(s,o))}},"Pe"),Qe=p(/\\./,M),Xe=p(/./,M),et=p(/\*\*\*+/,"*"),tt=p(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),nt=p(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),rt=V(j([Qe,et,tt,nt,Xe])),ot=rt,st=c(e=>oe(e,ot,{memoization:!1}).join(""),"Ie"),at=st,ce="abcdefghijklmnopqrstuvwxyz",it=c(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=ce[n]+t,e=Math.floor((e-1)/26)}return t},"Le"),le=c(e=>{let t=0;for(let n=0,s=e.length;n<s;n++)t=t*26+ce.indexOf(e[n])+1;return t},"V"),Y=c((e,t)=>{if(t<e)return Y(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"b"),ut=c((e,t,n)=>Y(e,t).map(s=>String(s).padStart(n,"0")),"qe"),fe=c((e,t)=>Y(le(e),le(t)).map(it),"W"),$=c(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"c"),B=c(e=>({children:e}),"y"),P=(()=>{const e=c((t,n,s)=>{if(s.has(t))return;s.add(t);const{children:o}=t;if(!o.length)o.push(n);else for(let u=0,f=o.length;u<f;u++)e(o[u],n,s)},"e");return t=>{if(!t.length)return B([]);for(let n=t.length-1;n>=1;n--){const s=new Set,o=t[n-1],u=t[n];e(o,u,s)}return t[0]}})(),k=c(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),ct=p(/\\./,$),lt=p(/[$.*+?^(){}[\]\|]/,e=>$(`\\${e}`)),ft=p(/[\\\/]/,k),pt=p(/[^$.*+?^(){}[\]\|\\\/]+/,$),dt=p(/^(?:!!)*!(.*)$/,(e,t)=>$(`(?!^${$e.compile(t).source}$).*?`)),gt=p(/^(!!)+/),ht=j([dt,gt]),mt=p(/\/(\*\*\/)+/,()=>B([P([k(),$(".+?"),k()]),k()])),xt=p(/^(\*\*\/)+/,()=>B([$("^"),P([$(".*?"),k()])])),vt=p(/\/(\*\*)$/,()=>B([P([k(),$(".*?")]),$("$")])),$t=p(/\*\*/,()=>$(".*?")),pe=j([mt,xt,vt,$t]),bt=p(/\*\/(?!\*\*\/|\*$)/,()=>P([$("[^\\\\/]*?"),k()])),yt=p(/\*/,()=>$("[^\\\\/]*")),de=j([bt,yt]),ge=p("?",()=>$("[^\\\\/]")),wt=p("[",M),_t=p("]",M),jt=p(/[!^]/,"^\\\\/"),Ot=p(/[a-z]-[a-z]|[0-9]-[0-9]/i,M),Rt=p(/\\./,M),Et=p(/[$.*+?^(){}[\|]/,e=>`\\${e}`),Nt=p(/[\\\/]/,"\\\\/"),kt=p(/[^$.*+?^(){}[\]\|\\\/]+/,M),Mt=j([Rt,Et,Nt,Ot,kt]),he=I([wt,ae(jt),V(Mt),_t],e=>$(e.join(""))),St=p("{","(?:"),At=p("}",")"),Ct=p(/(\d+)\.\.(\d+)/,(e,t,n)=>ut(+t,+n,Math.min(t.length,n.length)).join("|")),It=p(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>fe(t,n).join("|")),Pt=p(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>fe(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),zt=j([Ct,It,Pt]),me=I([St,zt,At],e=>$(e.join(""))),Tt=p("{"),Ut=p("}"),Bt=p(","),Ft=p(/\\./,$),Dt=p(/[$.*+?^(){[\]\|]/,e=>$(`\\${e}`)),Lt=p(/[\\\/]/,k),qt=p(/[^$.*+?^(){}[\]\|\\\/,]+/,$),Wt=ue(()=>ve),Zt=p("",()=>$("(?:)")),Vt=Ge(j([pe,de,ge,he,me,Wt,Ft,Dt,Lt,qt]),P),xe=j([Vt,Zt]),ve=I([Tt,ae(I([xe,V(I([Bt,xe]))])),Ut],B),Ht=V(j([ht,pe,de,ge,he,me,ve,ct,lt,ft,pt]),P),Gt=Ht,Jt=c(e=>oe(e,Gt,{memoization:!1})[0],"kr"),Yt=Jt,K=c((e,t,n)=>K.compile(e,n).test(t),"N");K.compile=(()=>{const e=Ke((n,s)=>Ce(Yt(at(n)),s)),t=Ye((n,s)=>Pe(n.map(o=>e(o,s))));return(n,s)=>Je(n)?e(n,s):t(n,s)})();var $e=K;return d(v)})();return r.default||r},"_lazyMatch"),Q;const xn=c((r,a)=>(Q||(Q=ye(),ye=null),Q(r,a)),"default");var vn=Object.defineProperty,$n=ee((r,a)=>vn(r,"name",{value:a,configurable:!0}),"t$1");const bn=/^[A-Z]:\//i,S=$n((r="")=>r&&r.replaceAll("\\","/").replace(bn,a=>a.toUpperCase()),"normalizeWindowsPath");var yn=Object.defineProperty,_=ee((r,a)=>yn(r,"name",{value:a,configurable:!0}),"r");const wn=/^[/\\]{2}/,_n=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,Re=/^[A-Z]:$/i,we=/^\/([A-Z]:)?$/i,jn=/.(\.[^./]+)$/,On=/^[/\\]|^[a-z]:[/\\]/i,Rn=/\/$/,En=_(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),Ee=_((r,a)=>{let i="",l=0,h=-1,m=0,x;for(let d=0;d<=r.length;++d){if(d<r.length)x=r[d];else{if(x==="/")break;x="/"}if(x==="/"){if(!(h===d-1||m===1))if(m===2){if(i.length<2||l!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const v=i.lastIndexOf("/");v===-1?(i="",l=0):(i=i.slice(0,v),l=i.length-1-i.lastIndexOf("/")),h=d,m=0;continue}else if(i.length>0){i="",l=0,h=d,m=0;continue}}a&&(i+=i.length>0?"/..":"..",l=2)}else i.length>0?i+=`/${r.slice(h+1,d)}`:i=r.slice(h+1,d),l=d-h-1;h=d,m=0}else x==="."&&m!==-1?++m:m=-1}return i},"normalizeString"),W=_(r=>_n.test(r),"isAbsolute"),Ne=_(function(r){if(r.length===0)return".";r=S(r);const a=wn.exec(r),i=W(r),l=r.at(-1)==="/";return r=Ee(r,!i),r.length===0?i?"/":l?"./":".":(l&&(r+="/"),Re.test(r)&&(r+="/"),a?i?`//${r}`:`//./${r}`:i&&!W(r)?`/${r}`:r)},"normalize"),Nn=_((...r)=>{let a="";for(const i of r)if(i)if(a.length>0){const l=a.at(-1)==="/",h=i[0]==="/";l&&h?a+=i.slice(1):a+=l||h?i:`/${i}`}else a+=i;return Ne(a)},"join"),X=_(function(...r){r=r.map(l=>S(l));let a="",i=!1;for(let l=r.length-1;l>=-1&&!i;l--){const h=l>=0?r[l]:En();!h||h.length===0||(a=`${h}/${a}`,i=W(h))}return a=Ee(a,!i),i&&!W(a)?`/${a}`:a.length>0?a:"."},"resolve");_(function(r){return S(r)},"toNamespacedPath");const kn=_(function(r){return jn.exec(S(r))?.[1]??""},"extname");_(function(r,a){const i=X(r).replace(we,"$1").split("/"),l=X(a).replace(we,"$1").split("/");if(l[0][1]===":"&&i[0][1]===":"&&i[0]!==l[0])return l.join("/");const h=[...i];for(const m of h){if(l[0]!==m)break;i.shift(),l.shift()}return[...i.map(()=>".."),...l].join("/")},"relative");const ke=_(r=>{const a=S(r).replace(Rn,"").split("/").slice(0,-1);return a.length===1&&Re.test(a[0])&&(a[0]=`${a[0]}/`),a.join("/")||(W(r)?"/":".")},"dirname");_(function(r){const a=[r.root,r.dir,r.base??r.name+r.ext].filter(Boolean);return S(r.root?X(...a):a.join("/"))},"format");const Mn=_((r,a)=>{const i=S(r).split("/").pop();return a&&i.endsWith(a)?i.slice(0,-a.length):i},"basename");_(function(r){const a=On.exec(r)?.[0]?.replaceAll("\\","/")??"",i=Mn(r),l=kn(i);return{base:i,dir:ke(r),ext:l,name:i.slice(0,i.length-l.length),root:a}},"parse");_((r,a)=>xn(a,Ne(r)),"matchesGlob");var Sn=Object.defineProperty,An=R((r,a)=>Sn(r,"name",{value:a,configurable:!0}),"e");let q=class extends cn{static{R(this,"p")}static{An(this,"UpdateNotifierError")}constructor(a,i="UPDATE_NOTIFIER_ERROR",l){super(a,i,l),this.name="UpdateNotifierError"}};var Cn=Object.defineProperty,te=R((r,a)=>Cn(r,"name",{value:a,configurable:!0}),"n");const In="last-update-check.json",Me=te(r=>{const a=un(r);if(a===void 0)throw new q("Could not find cache directory","CACHE_DIRECTORY_NOT_FOUND",{packageName:r});return Nn(a,In)},"getConfigFile"),Pn=te(r=>{const a=Me(r);try{if(!je(a))return;const{lastUpdateCheck:i}=JSON.parse(on(a,"utf8"));return i}catch{return}},"getLastUpdate"),zn=te(r=>{const a=Me(r),i=ke(a);je(i)||sn(i,{recursive:!0}),an(a,JSON.stringify({lastUpdateCheck:Date.now()}))},"saveLastUpdate");var Tn=Object.defineProperty,Un=R((r,a)=>Tn(r,"name",{value:a,configurable:!0}),"d");const Bn=Un(async(r,a,i)=>{const l=i.replace("__NAME__",r),h=512*1024;return await new Promise((m,x)=>{ln(l,d=>{if(d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)){x(new q(`Unexpected status code ${String(d.statusCode)}`,"VERSION_FETCH_ERROR",{distributionTag:a,packageName:r})),d.resume();return}let v="",y=!1;d.on("data",w=>{y||(v+=String(w),v.length>h&&(y=!0,x(new q("Response too large","VERSION_FETCH_ERROR",{distributionTag:a,packageName:r})),d.destroy()))}),d.on("end",()=>{if(!y)try{const w=JSON.parse(v)[a];if(!w){x(new q("Error getting version","VERSION_FETCH_ERROR",{distributionTag:a,packageName:r}));return}m(w)}catch{x(new q("Could not parse version response","VERSION_PARSE_ERROR",{distributionTag:a,packageName:r}))}})}).on("error",d=>{x(d)})})},"getDistributionVersion");var Fn=Object.defineProperty,Dn=R((r,a)=>Fn(r,"name",{value:a,configurable:!0}),"i");const Hn=Dn(async({alwaysRun:r,debug:a,distTag:i="latest",pkg:l,registryUrl:h="https://registry.npmjs.org/-/package/__NAME__/dist-tags",updateCheckInterval:m=1e3*60*60*24})=>{const x=Pn(l.name);if(r||!x||x<Date.now()-m){const d=await Bn(l.name,i,h);if(zn(l.name),pn(d,l.version))return d;a&&console.error(`Latest version (${d}) not newer than current version (${l.version})`)}else a&&console.error(`Too recent to check for a new update. simpleUpdateNotifier() interval set to ${String(m)}ms but only ${String(Date.now()-x)}ms since last check.`)},"hasNewVersion");export{Hn as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var St=Object.defineProperty;var $=(t,e)=>St(t,"name",{value:e,configurable:!0});import{createRequire as Dt}from"node:module";import{VERBOSITY_DEBUG as H,POSITIONALS_KEY as se,VERBOSITY_QUIET as Gt,VERBOSITY_VERBOSE as Kt,VERBOSITY_NORMAL as je}from"./VERBOSITY_QUIET-XPultrIA.js";import{c as P}from"./cerebro-error-BnJTixb2.js";import{d as z,h as ke,e as Y,o as Ue,b as Ht,c as Yt,a as Jt,i as Qt,f as Xt}from"./runtime-process-DKHFvYkv.js";import{p as ue}from"./isVisulimaError-jVZgumOU-C4fgdbWg.js";import{distance as Zt}from"fastest-levenshtein";import{s as en,L as tn,M as ne,E as W,P as G,N as I,C as ye,D as Te,W as nn,U as Me,Q as on,_ as Se,J as De,T as Ve,z as an,K as rn,q as sn,I as ln,V as cn,u as un,r as pn,Y as fn,p as dn,n as hn,Z as mn,i as gn,a as vn,A as wn,X as yn,e as bn,t as Be}from"./constants-DmzZF6_u-BmMwILI_.js";const Vt=Dt(import.meta.url),ee=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,it=$(t=>{if(typeof ee<"u"&&ee.versions&&ee.versions.node){const[e,n]=ee.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ee.getBuiltinModule(t)}return Vt(t)},"__cjs_getBuiltinModule"),{writeFile:Bt,stat:Rt,rm:zt,readFile:Ie,readdir:Wt,mkdir:Ft,access:qt}=it("node:fs/promises"),{createRequire:$n}=it("node:module"),ae=[{alias:"v",description:"Turn on verbose output",group:"global",name:"verbose",type:Boolean},{description:"Turn on debugging output",group:"global",name:"debug",type:Boolean},{alias:"h",description:"Print out helpful usage information",group:"global",name:"help",type:Boolean},{alias:"q",description:"Silence output",group:"global",name:"quiet",type:Boolean},{alias:"V",description:"Print version info",group:"global",name:"version",type:Boolean},{description:"Turn off colored output",group:"global",name:"no-color",type:Boolean},{description:"Force colored output",group:"global",name:"color",type:Boolean}];var On=Object.defineProperty,An=$((t,e)=>On(t,"name",{value:e,configurable:!0}),"t$9");let V=class extends P{static{$(this,"a")}static{An(this,"CommandNotFoundError")}commandName;constructor(e,n=[]){const i=`Command "${e}" not found${n.length>0?`. Did you mean: ${n.join(", ")}?`:""}`;super(i,"COMMAND_NOT_FOUND",{commandName:e,suggestions:n}),this.name="CommandNotFoundError",this.commandName=e,n.length>0&&(this.hint=`Try one of these commands: ${n.join(", ")}`)}};var Pn=Object.defineProperty,Cn=$((t,e)=>Pn(t,"name",{value:e,configurable:!0}),"e$7");let at=class extends P{static{$(this,"o")}static{Cn(this,"ConflictingOptionsError")}option1;option2;constructor(e,n){super(`Options "${e}" and "${n}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:e,option2:n}),this.name="ConflictingOptionsError",this.option1=e,this.option2=n,this.hint=`Remove either --${e} or --${n}`}};var Nn=Object.defineProperty,_n=$((t,e)=>Nn(t,"name",{value:e,configurable:!0}),"e$6");let kn=class extends P{static{$(this,"o")}static{_n(this,"PluginError")}pluginName;constructor(e,n,i){super(`Plugin "${e}" error: ${n}`,"PLUGIN_ERROR",{originalError:i,pluginName:e}),this.name="PluginError",this.pluginName=e,i&&(this.cause=i)}};var En=Object.defineProperty,Re=$((t,e)=>En(t,"name",{value:e,configurable:!0}),"d$6");let xn=class{static{$(this,"p")}static{Re(this,"PluginManager")}logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(e){this.logger=e}hasPlugins(){return this.plugins.size>0}register(e){if(this.initialized)throw new Error(`Cannot register plugin "${e.name}" after initialization`);if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);z().CEREBRO_OUTPUT_LEVEL===String(H)&&this.logger.debug(`registering plugin: ${e.name}`),this.plugins.set(e.name,e),this.cachedDependencyOrder=void 0}async init(e){if(this.initialized)throw new Error("PluginManager already initialized");if(this.plugins.size===0){this.logger.debug("no plugins registered, skipping initialization"),this.initialized=!0;return}this.validateDependencies();const n=this.getDependencyOrder();this.logger.debug(`initializing ${String(n.length)} plugin(s)...`);for(const i of n)if(typeof i.init=="function"){this.logger.debug(`initializing plugin: ${i.name}`);try{await i.init(e)}catch(r){const o=new kn(i.name,`Failed to initialize: ${r instanceof Error?r.message:String(r)}`,r instanceof Error?r:void 0);throw this.logger.error(o.message),o}}this.initialized=!0}async executeLifecycle(e,n,i){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const r=this.getDependencyOrder();for(const o of r){const c=o[e];if(typeof c=="function"){this.logger.debug(`executing ${e} hook for plugin: ${o.name}`);try{await(e==="afterCommand"?c(n,i):c(n))}catch(s){throw this.logger.error(`Error in ${e} hook for plugin "${o.name}":`,s),s}}}}async executeErrorHandlers(e,n){if(!this.initialized||this.plugins.size===0)return;const i=this.getDependencyOrder();for(const r of i)if(typeof r.onError=="function"){this.logger.debug(`executing error handler for plugin: ${r.name}`);try{await r.onError(e,n)}catch(o){this.logger.error(`Error in error handler for plugin "${r.name}":`,o)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const e=[],n=new Set,i=new Set,r=Re(o=>{if(n.has(o))return;if(i.has(o))throw new Error(`Circular dependency detected involving plugin "${o}"`);const c=this.plugins.get(o);if(!c)throw new Error(`Plugin "${o}" not found`);if(i.add(o),c.dependencies)for(const s of c.dependencies)r(s);i.delete(o),n.add(o),e.push(c)},"visit");for(const o of this.plugins.keys())r(o);return this.cachedDependencyOrder=e,e}validateDependencies(){for(const e of this.plugins.values())if(e.dependencies){for(const n of e.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin "${e.name}" depends on "${n}" which is not registered`)}}};var Ln=Object.defineProperty,In=$((t,e)=>Ln(t,"name",{value:e,configurable:!0}),"n$b");const oe=In(t=>t.type?.name==="Boolean","optionIsBoolean");var jn=Object.defineProperty,rt=$((t,e)=>jn(t,"name",{value:e,configurable:!0}),"p$6");const Un=rt(t=>{let e=t.type?t.type.name.toLowerCase():"string";const n=t.multiple??t.lazyMultiple?"[]":"";return e&&(e=e==="boolean"?"":`{underline ${e}${n}}`),e},"getTypeLabel"),ze=rt(t=>(oe(t)||(t.typeLabel=t.typeLabel??Un(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),"mapOptionTypeLabel");var Tn=Object.defineProperty,st=$((t,e)=>Tn(t,"name",{value:e,configurable:!0}),"e$4");const Mn=new RegExp(/^-([^\d-])$/),Sn=new RegExp(/^--(\S+)/),Dn=new RegExp(/^-([^\d-]{2,})$/),Vn=st(t=>Mn.test(t)||Sn.test(t)||Dn.test(t),"isOption"),Bn=st((t,e)=>{const n=e[0]&&Vn(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const i=new Error(`Command not recognised: ${String(n)}`);throw i.command=n,i.name="INVALID_COMMAND",i}return{argv:e,command:n}},"commandLineCommands");var Rn=Object.defineProperty,lt=$((t,e)=>Rn(t,"name",{value:e,configurable:!0}),"o$b"),zn=Object.defineProperty,ct=lt((t,e)=>zn(t,"name",{value:e,configurable:!0}),"o"),Wn=Object.defineProperty,Fn=ct((t,e)=>Wn(t,"name",{value:e,configurable:!0}),"i");let qn=class ut extends ue{static{$(this,"a")}static{lt(this,"r")}static{ct(this,"t")}static{Fn(this,"AlreadySetError")}optionName;constructor(e){super({cause:void 0,hint:`Remove the duplicate option '${e}' from your command line arguments.`,location:void 0,message:`Option '${e}' is already set`,name:"ALREADY_SET",stack:void 0,title:"Option Already Set"}),this.optionName=e,Object.setPrototypeOf(this,ut.prototype)}};var Gn=Object.defineProperty,pt=$((t,e)=>Gn(t,"name",{value:e,configurable:!0}),"t$7"),Kn=Object.defineProperty,ft=pt((t,e)=>Kn(t,"name",{value:e,configurable:!0}),"e"),Hn=Object.defineProperty,Yn=ft((t,e)=>Hn(t,"name",{value:e,configurable:!0}),"e");let We=class dt extends ue{static{$(this,"n")}static{pt(this,"n")}static{ft(this,"o")}static{Yn(this,"UnknownOptionError")}optionName;constructor(e){super({cause:void 0,hint:`Check your option definitions or remove the unknown option '${e}' from your command line arguments.`,location:void 0,message:`Unknown option: --${e}`,name:"UNKNOWN_OPTION",stack:void 0,title:"Unknown Option"}),this.optionName=`--${e}`,Object.setPrototypeOf(this,dt.prototype)}};var Jn=Object.defineProperty,ht=$((t,e)=>Jn(t,"name",{value:e,configurable:!0}),"a$9"),Qn=Object.defineProperty,mt=ht((t,e)=>Qn(t,"name",{value:e,configurable:!0}),"a"),Xn=Object.defineProperty,Zn=mt((t,e)=>Xn(t,"name",{value:e,configurable:!0}),"o");let eo=class gt extends ue{static{$(this,"o")}static{ht(this,"r")}static{mt(this,"e")}static{Zn(this,"UnknownValueError")}value;constructor(e){super({hint:"Use a defined option or add a defaultOption to capture this value.",message:`Unknown value: ${e}`,name:"UNKNOWN_VALUE",title:"Unknown Value"}),this.value=e,Object.setPrototypeOf(this,gt.prototype)}};var to=Object.defineProperty,vt=$((t,e)=>to(t,"name",{value:e,configurable:!0}),"i$8"),no=Object.defineProperty,wt=vt((t,e)=>no(t,"name",{value:e,configurable:!0}),"i"),oo=Object.defineProperty,io=wt((t,e)=>oo(t,"name",{value:e,configurable:!0}),"i");let j=class yt extends ue{static{$(this,"a")}static{vt(this,"o")}static{wt(this,"e")}static{io(this,"InvalidDefinitionsError")}constructor(e,n){super({cause:void 0,hint:n,location:void 0,message:e,name:"INVALID_DEFINITIONS",stack:void 0,title:"Invalid Option Definition"}),Object.setPrototypeOf(this,yt.prototype)}};var ao=Object.defineProperty,ro=$((t,e)=>ao(t,"name",{value:e,configurable:!0}),"E$3"),so=Object.defineProperty,Q=ro((t,e)=>so(t,"name",{value:e,configurable:!0}),"C"),lo=Object.defineProperty,pe=Q((t,e)=>lo(t,"name",{value:e,configurable:!0}),"o");const Fe=pe(t=>t===Boolean||typeof t=="function"&&t.name==="Boolean","isBooleanType"),qe=pe(t=>t===Number||typeof t=="function"&&t.name==="Number","isNumberType"),Ge=pe(t=>t===String||typeof t=="function"&&t.name==="String","isStringType"),co=pe((t,e)=>Array.isArray(t)?Fe(e)?t.map(Boolean):qe(e)?t.map(Number):Ge(e)?t.map(String):t.map(n=>e(String(n))):t===null?null:Fe(e)?!!t:qe(e)?Number(t):Ge(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t)),"convertValue");var uo=Object.defineProperty,po=Q((t,e)=>uo(t,"name",{value:e,configurable:!0}),"e");const x=po((t,e,n,...i)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...i)},"debug");var fo=Object.defineProperty,q=Q((t,e)=>fo(t,"name",{value:e,configurable:!0}),"x$2");const ho=/-([a-z])/g,mo=/^\d+$/,be=q(t=>t===Boolean||typeof t=="function"&&t.name==="Boolean","isBooleanType"),go=q(t=>t.codePointAt(0)===95,"isSpecialKey"),Ke=q((t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],"appendToArrayMultiple"),He=q(t=>t==="__proto__"||t==="constructor"||t==="prototype","isUnsafeKey"),Ye=q((t,e,n,i=!1)=>{t[e]===void 0?t[e]=i?[n]:n:i&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},"createOrAppendArray"),vo=q((t,e,n,i,r)=>{let o=e.get(t)??n.get(t);if(!o&&i){const c=t.toLowerCase();o=i.get(c)??r?.get(c)}return o},"getDefinition"),wo=q((t,e,n,i)=>{const r=n.debug??!1;x(r,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),x(r,"Starting argument resolution","resolver"),x(r,"Tokens:","resolver",t),x(r,"Definitions:","resolver",e),x(r,"Processing tokens...","resolver");const o=new Map,c=new Map,s=n.caseInsensitive?new Map:void 0,g=n.caseInsensitive?new Map:void 0,a=n.camelCase?new Map:void 0,u=n.camelCase?new Map:void 0;for(const p of e)if(o.set(p.name,p),p.alias&&c.set(p.alias,p),n.caseInsensitive&&s&&(s.set(p.name.toLowerCase(),p),p.alias&&g&&g.set(p.alias.toLowerCase(),p)),n.camelCase&&a&&u){const m=p.name.replaceAll(ho,(v,O)=>O.toUpperCase());a.set(p.name,m),u.set(m,p.name)}const d={},l={},h=[],f=[],y=new Set;let b=!1;const w=e.find(p=>p.defaultOption),C=e.some(p=>p.group),N=e.some(p=>p.type===Number);for(let p=0;p<t.length;p++){const m=t[p];if(m.kind==="option-terminator"){d._unknown=i.slice(m.index),b=!0;break}if(m.kind==="option"&&m.name){let v=vo(m.name,o,c,s,g);if(!v&&m.value===void 0&&N&&mo.test(m.name)){const _=e.find(M=>M.type===Number);_&&(v=_,m.value=m.name,m.name=_.name)}const O=v?v.name:m.name,A=v?.multiple,U=v?.lazyMultiple;if(l[O]!==void 0&&!A&&!U&&!n.partial)throw new qn(O);if(!v&&n.partial){const _=m.rawName??`--${m.name}${m.value!==void 0&&m.inlineValue?`=${m.value}`:""}`;h.push({index:m.index,value:_});continue}if(!v&&n.stopAtFirstUnknown){d._unknown=i.slice(m.index);break}if(!v&&!n.partial)throw new We(m.name);if(m.value===void 0){const _=t[p+1],M=_?.kind==="option"&&!("name"in _)&&_.value!==void 0,L=_&&v&&!(v.type&&be(v.type))&&(_.kind==="positional"||M),Mt=v&&v.defaultOption&&!v.multiple&&!v.lazyMultiple;if(L&&(!v?.defaultOption||Mt))if(A){let S=p+1;const we=[];for(;S<t.length&&(t[S].kind==="positional"||t[S].kind==="option"&&!("name"in t[S])&&t[S].value!==void 0);)we.push(t[S].value),y.add(t[S].index),S++;l[O]=l[O]===void 0?we:Ke(l[O],we),p=S-1}else U?(Ye(l,O,_.value,!0),y.add(_.index),p++):(l[O]=_.value,y.add(_.index),p++);else v?.type&&be(v.type)?Ye(l,O,!0,A):l[O]=A?[]:null}else{let{value:_}=m;if(v?.type&&be(v.type))switch(_){case"":{if(n.partial){l._unknown??=[];const L=`${m.rawName??`--${m.name}`}${m.value?`=${m.value}`:""}`;l._unknown.push(L),f.push({index:m.index,value:L}),_=!0}else throw new We(m.name);break}case"false":{_=!1;break}case"true":{_=!0;break}default:_=!0}const M=[_];if(A){let L=p+1;for(;L<t.length&&t[L].kind==="positional";)M.push(t[L].value),y.add(t[L].index),L++;p=L-1}l[O]===void 0?l[O]=A||U?M:_:A||U?l[O]=Ke(l[O],M):l[O]=_}}else if(m.kind==="positional"&&n.stopAtFirstUnknown&&!y.has(m.index)&&!w){x(r,`Found unconsumed positional token at index ${String(m.index)}, stopping processing`,"resolver"),d._unknown=i.slice(m.index);break}}for(const[p,m]of Object.entries(l)){const v=o.get(p);v&&(v.multiple||v.lazyMultiple)&&!Array.isArray(m)&&(l[p]=[m])}let E=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!b){for(const p of t)if(p.kind==="option"&&!o.has(p.name??"")&&!c.has(p.name??"")&&(!n.caseInsensitive||!s?.has(p.name?.toLowerCase()??"")&&!g?.has(p.name?.toLowerCase()??""))){E=p.index;break}}if(w){const p=[],m=[];for(const v of t)v.kind==="positional"&&!y.has(v.index)&&v.index<E&&(p.push(v.value),m.push(v));if(p.length>0){const v=l[w.name],O=w.multiple??w.lazyMultiple;v===void 0?O?(m.forEach(A=>y.add(A.index)),l[w.name]=p):(y.add(m[0].index),l[w.name]=p[0]):O&&(m.forEach(A=>y.add(A.index)),l[w.name]=Array.isArray(v)?[...p,...v]:[...p,v])}}if(!n.partial){for(const p of t)if(p.kind==="positional"&&!y.has(p.index))throw new eo(i[p.index])}if(n.partial&&!n.stopAtFirstUnknown){const p=[...h];if(l._unknown)for(const m of f)p.push({index:m.index,value:m.value});for(const m of t)m.kind==="positional"&&!y.has(m.index)&&p.push({index:m.index,value:i[m.index]});p.length>0&&(p.sort((m,v)=>m.index-v.index),d._unknown=p.map(m=>m.value))}if(n.stopAtFirstUnknown&&!b){const p=t.findIndex(O=>O.kind==="option"&&!o.has(O.name??"")&&!c.has(O.name??"")&&(!n.caseInsensitive||!s?.has(O.name?.toLowerCase()??"")&&!g?.has(O.name?.toLowerCase()??""))),m=t.findIndex(O=>O.kind==="positional"&&!y.has(O.index));let v=-1;if(p!==-1&&m!==-1?v=Math.min(p,m):p!==-1?v=p:m!==-1&&(v=m),v>=0){const O=t[v].index;d._unknown=i.slice(O)}}else h.length>0&&!n.partial&&(d._unknown=h.map(p=>p.value));for(const[p,m]of Object.entries(l)){const v=n.camelCase?a?.get(p)??p:p,O=o.get(p);d[v]=O?.type?co(m,O.type):m===void 0?null:m}for(const p of e){const m=n.camelCase?a?.get(p.name)??p.name:p.name;!(m in d)&&p.defaultValue!==void 0&&(p.multiple??p.lazyMultiple?d[m]=Array.isArray(p.defaultValue)?[...p.defaultValue]:[p.defaultValue]:d[m]=p.defaultValue)}if(C){const p={},m={},v={};for(const A of e)if(A.group){const U=Array.isArray(A.group)?A.group:[A.group];for(const _ of U)He(_)||(p[_]??={})}for(const A of Object.keys(d))if(!go(A)){m[A]=d[A];let U=A;n.camelCase&&(U=u?.get(A)??A);const _=o.get(U);if(_?.group){const M=Array.isArray(_.group)?_.group:[_.group];for(const L of M)He(L)||p[L]&&(p[L][A]=d[A])}else v[A]=d[A]}const O={_all:m};for(const[A,U]of Object.entries(p))O[A]=U;Object.keys(v).length>0&&(O._none=v),d._unknown&&(O._unknown=d._unknown),Object.keys(d).forEach(A=>delete d[A]),Object.assign(d,O)}return x(r,"Final parsed result:","resolver",d),d},"resolveArgs");var yo=Object.defineProperty,X=Q((t,e)=>yo(t,"name",{value:e,configurable:!0}),"l");const J="-".codePointAt(0),F="=",bo=F.codePointAt(0),$o="--",Oo="-",Ao="--",bt=X(t=>t.length>2&&t.startsWith(Ao),"hasLongOptionPrefix"),Po=X(t=>bt(t)&&!t.includes(F,3),"isLongOption"),Co=X(t=>bt(t)&&t.includes(F,3),"isLongOptionAndValue"),No=X(t=>{if(t.length!==2||t.codePointAt(0)!==J||t.codePointAt(1)===J)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},"isShortOption"),_o=X(t=>!(t.length<=2||t.codePointAt(0)!==J||t.codePointAt(1)===J),"isShortOptionGroup"),ko=X(t=>{const e=[],n=[...t];let i=-1,r=0;for(;n.length>0;){const o=n.shift();if(o===void 0)break;if(r>0?r--:i++,o===$o){e.push({index:i,kind:"option-terminator"});const c=n.map((s,g)=>({index:i+g+1,kind:"positional",value:s}));e.push(...c),i+=n.length;break}if(No(o)){const c=o.charAt(1);e.push({index:i,kind:"option",name:c,rawName:o});continue}if(_o(o)&&!o.includes(F)){const c=[];let s="",g=!1;for(let a=1;a<o.length;a++){const u=o.charAt(a);g?s+=u:u.codePointAt(0)===bo?g=!0:c.push(`${Oo}${u}`)}if(g)if(c.length>0){const a=c.pop();c.push(`${a}=${s}`)}else c.push(s);n.unshift(...c),r=c.length;continue}if(Po(o)){const c=o.slice(2);e.push({index:i,kind:"option",name:c,rawName:o});continue}if(Co(o)){const c=o.indexOf(F),s=o.slice(2,c),g=o.slice(c+1);e.push({index:i,inlineValue:!0,kind:"option",name:s,rawName:o,value:g});continue}if(o.length>2&&o.codePointAt(0)===J&&o.codePointAt(1)!==J&&o.includes(F)){const c=o.indexOf(F),s=o.charAt(1),g=o.slice(c+1);e.push({index:i,inlineValue:!0,kind:"option",name:s,rawName:o,value:g});continue}e.push({index:i,kind:"positional",value:o})}return e},"parseArgsTokens");var Eo=Object.defineProperty,xe=Q((t,e)=>Eo(t,"name",{value:e,configurable:!0}),"d");const xo=/\d/,Lo=xe(t=>t===Boolean||typeof t=="function"&&t.name==="Boolean","isBooleanType"),Io=xe(t=>typeof t=="function","isValidCustomTypeFunction"),jo=xe((t,e,n)=>{const i=n?.debug??!1;x(i,"Validating definitions:","validation",t,"caseInsensitive:",e);const r=new Set,o=new Set,c=new Set,s=new Set;let g=0;for(const a of t){if(x(i,"Checking definition:","validation",a),!a.name)throw x(i,"Validation failed: name is required","validation"),new j("Invalid option definition: name is required");if(typeof a.name!="string")throw new j("Invalid option definition: name must be a string");if(a.name.trim()==="")throw new j("Invalid option definition: name cannot be empty");const u=e?a.name.toLowerCase():"";if(r.has(a.name)||e&&c.has(u))throw new j(`Invalid option definition: duplicate name '${a.name}'`);if(o.has(a.name)||e&&s.has(u))throw new j(`Invalid option definition: name '${a.name}' conflicts with an existing alias`);if(r.add(a.name),e&&c.add(u),a.alias!==void 0){if(typeof a.alias!="string")throw new j("Invalid option definition: alias must be a string");if(a.alias.length!==1)throw new j("Invalid option definition: alias must be a single character");if(xo.test(a.alias))throw new j("Invalid option definition: alias cannot be numeric");if(a.alias==="-")throw new j('Invalid option definition: alias cannot be "-"');const d=e?a.alias.toLowerCase():"";if(o.has(a.alias)||e&&s.has(d))throw new j(`Invalid option definition: duplicate alias '${a.alias}'`);if(r.has(a.alias)||e&&c.has(d))throw new j(`Invalid option definition: alias '${a.alias}' conflicts with an existing option name`);o.add(a.alias),e&&s.add(d)}if(a.defaultOption&&(g++,a.type!==void 0&&Lo(a.type)))throw new j("Invalid option definition: defaultOption cannot be Boolean type");if(a.type!==void 0&&!(a.type===Boolean||a.type===Number||a.type===String||typeof a.type=="function"&&Io(a.type)))throw new j("Invalid option definition: invalid type")}if(g>1)throw x(i,"Validation failed: multiple defaultOptions not allowed","validation"),new j("Invalid option definition: multiple defaultOptions not allowed");x(i,"Validation completed successfully","validation")},"validateDefinitions");var Uo=Object.defineProperty,To=Q((t,e)=>Uo(t,"name",{value:e,configurable:!0}),"O");const Mo=To((t,e={})=>{const n=e.debug??!1;x(n,"Starting command-line-args parsing","index"),x(n,"Options:","index",e);const i={...e};i.stopAtFirstUnknown&&(i.partial=!0);const r=Array.isArray(t)?t:[t];x(n,"Normalized definitions:","index",r),jo(r,i.caseInsensitive,n?i:void 0);let{argv:o}=i;if(!o&&(o=process.argv.slice(2),process.execArgv.length>0)){const a=new Set(process.execArgv);o=o.filter(u=>!a.has(u))}x(n,"Using argv:","index",o);let c=o;i.caseInsensitive&&(c=o.map(a=>{if(a.startsWith("--")){const u=a.indexOf("="),d=(u===-1?a.slice(2):a.slice(2,u)).toLowerCase();return u===-1?`--${d}`:`--${d}${a.slice(u)}`}if(a.startsWith("-")&&!a.startsWith("--")&&a.length>1){const u=a.slice(1).split("=",2),d=u[0],l=u[1];if(!d)return a;const h=d.toLowerCase();return l===void 0?`-${h}`:`-${h}=${l}`}return a}));const s=ko(c.map(String));x(n,"Tokenized arguments:","index",s);const g=wo(s,r,i,o);return x(n,"Command-line-args parsing completed","index"),g},"commandLineArgs");var So=Object.defineProperty,Do=$((t,e)=>So(t,"name",{value:e,configurable:!0}),"b$2");let Vo=class{static{$(this,"m")}static{Do(this,"EmptyToolbox")}result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}};var Bo=Object.defineProperty,Ro=$((t,e)=>Bo(t,"name",{value:e,configurable:!0}),"n$7");let $e=class extends P{static{$(this,"i")}static{Ro(this,"CommandLoaderError")}commandName;constructor(e,n,i){super(`Failed to load command "${e}": ${n}`,"COMMAND_LOADER_ERROR",{commandName:e,reason:n}),this.name="CommandLoaderError",this.commandName=e,this.hint="Ensure the loader resolves to a module with a default export that is the command handler function.",i!==void 0&&(this.cause=i)}};var zo=Object.defineProperty,Wo=$((t,e)=>zo(t,"name",{value:e,configurable:!0}),"f$5");const Fo=/^-{1,2}(\w+)(=(.+))?$/,$t=Wo((t,e,n,i)=>{const r=Fo.exec(t);if(r===null)return{};const o=r[1];if(!o)return{};const c=n&&i?n.get(o)??i.get(o):e.find(s=>s.name===o||s.alias===o);return c!==void 0?{argName:c.name,argValue:r[3],option:c}:{}},"getParameterOption");var qo=Object.defineProperty,Ee=$((t,e)=>qo(t,"name",{value:e,configurable:!0}),"e$3");const Je=Ee((t,e)=>{if(e.type===void 0)return t;if(e.type.name==="Boolean"){if(t==="true"||t==="1")return e.type(!0);if(t==="false"||t==="0")return e.type(!1)}return e.type(t)},"convertType"),Go=new Set(["0","1","false","true"]),Ko=Ee((t,e,n,i)=>{if(e.length===0||t.length===0)return{};const r=Ee((o,c)=>{const{argName:s,argValue:g,option:a}=$t(c,e,n,i),{lastOption:u}=o;return a&&oe(a)&&g&&s?o.partial[s]=Je(g,a):o.lastName&&u&&oe(u)&&Go.has(c)&&(o.partial[o.lastName]=Je(c,u)),{lastName:s,lastOption:a,partial:o.partial}},"getBooleanValue");return t.reduce(r,{partial:{}}).partial},"getBooleanValues");var Ho=Object.defineProperty,Qe=$((t,e)=>Ho(t,"name",{value:e,configurable:!0}),"s$9");const Yo=new Set(["0","1","false","true"]),Jo=Qe((t,e,n,i)=>{if(e.length===0||t.length===0)return t;const r=Qe((o,c)=>{const{argValue:s,option:g}=$t(c,e,n,i),{lastOption:a}=o;if(a&&oe(a)&&Yo.has(c)){const{args:u}=o;return{args:u.slice(0,-1)}}return g&&oe(g)&&s?{args:o.args}:{args:[...o.args,c],lastOption:g}},"removeBooleanArguments");return t.reduce(r,{args:[]}).args},"removeBooleanValues");var Qo=Object.defineProperty,Xo=$((t,e)=>Qo(t,"name",{value:e,configurable:!0}),"o$8");const Xe=Xo(t=>{const e=new Map;for(const n of t){const i=e.get(n.name);i?e.set(n.name,{...i,...n}):e.set(n.name,n)}return[...e.values()]},"mergeArguments");var Zo=Object.defineProperty,fe=$((t,e)=>Zo(t,"name",{value:e,configurable:!0}),"o$7");const ei=fe(t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},"transformBooleanEnv"),ti=fe((t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return ei(e);if(t.type===Number||typeof t.type=="function"&&t.type.name==="Number"){const n=Number.parseFloat(e);return Number.isNaN(n)?void 0:n}return t.type===String||typeof t.type=="function"&&t.type.name==="String"?e:t.type(e)}},"transformEnvValue"),ni=/_./g,oi=/^[A-Z]/,ii=fe(t=>t.toLowerCase().replaceAll(ni,e=>e[1]?.toUpperCase()??e).replace(oi,e=>e.toLowerCase()),"toCamelCase"),ai=fe(t=>{if(!t||t.length===0)return{};const e={},n=z();for(const i of t){const r=n[i.name],o=ti(i,r),c=o===void 0?i.defaultValue:o,s=ii(i.name);e[s]=c}return e},"processEnvVariables");var ri=Object.defineProperty,ie=$((t,e)=>ri(t,"name",{value:e,configurable:!0}),"a$5");const si=ie(t=>{const e=new Map,n=new Map;for(const i of t)if(e.set(i.name,i),i.alias){const r=Array.isArray(i.alias)?i.alias:[i.alias];for(const o of r)n.set(o,i)}return{optionMapByAlias:n,optionMapByName:e}},"buildOptionMaps"),Ot=ie(async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new $e(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(i){throw new $e(t.name,i instanceof Error?i.message:String(i),i)}const n=e.default;if(typeof n!="function")throw new $e(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},"loadLazyHandler"),li=ie((t,e,n,i)=>{const r=new Vo(t.name,t),{_all:o,_unknown:c,positionals:s}=e,g=Object.keys(n).length>0?{...o,...n}:o;se in g&&delete g[se],r.argument=s?.[se]??[],r.rawUnknown=[...c??[]];const a=Object.keys(i).length>0;return r.options=a?{...g,...i}:g,r.env=ai(t.env),r},"prepareToolbox"),ci=ie((t,e,n)=>{const i=t.options??[],r=i.length>0;let o=Xe(r?[...i,...n]:n);if(o.length>0){for(const a of o)if(a.multiple&&a.lazyMultiple)throw new Error(`Argument "${a.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(o=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:se,type:t.argument.type,typeLabel:t.argument.typeLabel},...o]);let c,s;if(r){const{optionMapByAlias:a,optionMapByName:u}=si(i);c=Jo(e,i,u,a),s=Ko(e,i,u,a)}else c=e,s={};const g=Mo(o,{argv:c,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:o,booleanValues:s,parsedArgs:g}},"processCommandArgs"),K=ie(async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await Ot(t))(e),"executeCommand");var ui=Object.defineProperty,pi=$((t,e)=>ui(t,"name",{value:e,configurable:!0}),"n$6");let fi=class extends P{static{$(this,"s")}static{pi(this,"CommandValidationError")}commandName;missingOptions;constructor(e,n){super(`Command "${e}" is missing required options: ${n.join(", ")}`,"COMMAND_VALIDATION_ERROR",{commandName:e,missingOptions:n}),this.name="CommandValidationError",this.commandName=e,this.missingOptions=n,this.hint=`Provide the following required options: ${n.join(", ")}`}};var di=Object.defineProperty,hi=$((t,e)=>di(t,"name",{value:e,configurable:!0}),"t$5");const Ze=hi((t,e,n=!1)=>{const i=[];for(const r of t)if(!(!n&&!r.required)&&e[r.name]===void 0){if(r.type?.name==="Boolean"){e[r.name]=!1;continue}i.push(r)}return i},"listMissingArguments");var mi=Object.defineProperty,At=$((t,e)=>mi(t,"name",{value:e,configurable:!0}),"n$5");const gi=At((t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:Zt(t,e)<=t.length/3,"isSimilar"),R=At((t,e)=>{const n=t.toLowerCase();return e.filter(i=>gi(i.toLowerCase(),n))},"findAlternatives");var vi=Object.defineProperty,de=$((t,e)=>vi(t,"name",{value:e,configurable:!0}),"a$4");const wi=de((t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(i=>{const r=i.startsWith("--");let o=`Found unknown ${r?"option":"argument"} "${i}"`;if(r){const c=R(i.replace("--",""),(e.options??[]).map(s=>s.name));if(c.length>0){const[s,...g]=c.map(a=>`--${a}`);o+=g.length>0?`, did you mean ${s??""} or ${g.join(", ")}?`:`, did you mean ${s??""}?`}}n.push(o)}),n.length>0)throw new Error(n.join(`
|
|
2
|
+
`))},"validateUnknownOptions"),yi=de((t,e,n)=>{const i=n.__requiredOptions__,r=i?Ze(i,e,!0):Ze(t,e,!1);if(r.length>0)throw new fi(n.name,r.map(o=>o.name));e._unknown&&e._unknown.length>0&&!n.argument&&wi(e,n)},"validateRequiredOptions"),bi=de((t,e,n)=>{const i=n.__conflictingOptions__??t.filter(r=>r.conflicts!==void 0);if(i.length>0){const r=i.find(o=>Array.isArray(o.conflicts)?o.conflicts.some(c=>e[c]!==void 0)&&e[o.name]!==void 0:e[o.conflicts]!==void 0&&e[o.name]!==void 0);if(r)throw new at(r.name,typeof r.conflicts=="string"?r.conflicts:r.conflicts?.[0]??"unknown")}},"validateConflictingOptions"),$i=de(t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const r of t.options){if(r.name){const o=e.get(r.name)??[];o.push(r),e.set(r.name,o)}if(typeof r.alias=="string"&&r.alias.length>0){const o=n.get(r.alias)??[];o.push(r),n.set(r.alias,o)}else if(Array.isArray(r.alias)){for(const o of r.alias)if(o.length>0){const c=n.get(o)??[];c.push(r),n.set(o,c)}}}const i=[];for(const[r,o]of e)o.length>1&&i.push(`Duplicate option name "${r}" in command "${t.name}": ${JSON.stringify(o)}`);for(const[r,o]of n)o.length>1&&i.push(`Duplicate option alias "-${r}" used by options ${o.map(c=>`"${c.name}"`).join(", ")} in command "${t.name}"`);if(i.length>0)throw new Error(i.join(`
|
|
3
|
+
`))},"validateDuplicateOptions");var Oi=Object.defineProperty,Le=$((t,e)=>Oi(t,"name",{value:e,configurable:!0}),"s$5");const Ai=Le((t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let i;for(let r=1;r<=e.length;r+=1){const o=e[r-1];if(o===void 0||o.startsWith("-"))break;n.push(o);const c=n.join(" ");t.has(c)&&(i={commandPath:[...n],depth:r})}return i?{argv:e.slice(i.depth),commandPath:i.commandPath}:{argv:e,commandPath:void 0}},"parseNestedCommand"),B=Le(t=>t.join(" "),"getCommandPathKey"),et=Le((t,e)=>e&&e.length>0?[...e,t]:[t],"getFullCommandPath");var Pi=Object.defineProperty,Pt=$((t,e)=>Pi(t,"name",{value:e,configurable:!0}),"a$3"),Ci=Object.defineProperty,Ct=Pt((t,e)=>Ci(t,"name",{value:e,configurable:!0}),"a"),Ni=Object.defineProperty,_i=Ct((t,e)=>Ni(t,"name",{value:e,configurable:!0}),"a");let Nt=class{static{$(this,"u")}static{Pt(this,"n")}static{Ct(this,"s")}static{_i(this,"LRUCache")}capacity;cache;constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}has(e){return this.cache.has(e)}set(e,n){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.capacity){const i=this.cache.keys().next().value;i!==void 0&&this.cache.delete(i)}this.cache.set(e,n)}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}size(){return this.cache.size}};var ki=Object.defineProperty,Ei=$((t,e)=>ki(t,"name",{value:e,configurable:!0}),"r$5"),xi=Object.defineProperty,Li=Ei((t,e)=>xi(t,"name",{value:e,configurable:!0}),"a"),Ii=Object.defineProperty,ji=Li((t,e)=>Ii(t,"name",{value:e,configurable:!0}),"s");const Ui=ji((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleLowerCase(e.locale):t[0].toLowerCase())+t.slice(1),"lowerFirst");var Ti=Object.defineProperty,Mi=$((t,e)=>Ti(t,"name",{value:e,configurable:!0}),"T"),Si=Object.defineProperty,he=Mi((t,e)=>Si(t,"name",{value:e,configurable:!0}),"j");const Di=$n(import.meta.url),te=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Vi=he(t=>{if(typeof te<"u"&&te.versions&&te.versions.node){const[e,n]=te.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return te.getBuiltinModule(t)}return Di(t)},"__cjs_getBuiltinModule"),{stripVTControlCharacters:Bi}=Vi("node:util");var Ri=Object.defineProperty,zi=he((t,e)=>Ri(t,"name",{value:e,configurable:!0}),"a");const Oe=new Nt(1e3),Wi=/[.*+?^${}()|[\]\\]/g,Fi=zi(t=>{const e=t.join("");if(Oe.has(e)){const r=Oe.get(e);return r.lastIndex=0,r}const n=t.map(r=>r.replaceAll(Wi,String.raw`\$&`)).join("|"),i=new RegExp(n,"g");return Oe.set(e,i),i},"getSeparatorsRegex");var qi=Object.defineProperty,Gi=he((t,e)=>qi(t,"name",{value:e,configurable:!0}),"t");const Ki=Gi(t=>{const e=[];let n=0,i;for(W.lastIndex=0;(i=W.exec(t))!==null;)i.index>n&&e.push(t.slice(n,i.index)),e.push(i[0]),n=W.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},"splitByEmoji");var Hi=Object.defineProperty,k=he((t,e)=>Hi(t,"name",{value:e,configurable:!0}),"u");const Yi=/[ČŠŽĐ]/i,_t=new Uint8Array(128),kt=new Uint8Array(128),Et=new Uint8Array(128);for(let t=0;t<128;t++)_t[t]=t>=65&&t<=90?1:0,kt[t]=t>=97&&t<=122?1:0,Et[t]=t>=48&&t<=57?1:0;const Ae=k(t=>_t[t],"isUpper"),tt=k(t=>kt[t],"isLower"),Pe=k(t=>Et[t],"isDigit"),D=k((t,e,n,i,r)=>{if(t.length===0)return[];let o=!1;const c=Object.values(e);for(const h of c)if(h(t[0])){o=!0;break}if(!o&&!n)return[t];const s=[...t],g=[];let a=s[0],u="other";const d=Object.entries(e);for(const h of d){const[f,y]=h;if(y(s[0])){u=f;break}}let l=n&&i?s[0]===s[0].toLocaleUpperCase(i):!1;for(let h=1;h<s.length;h++){const f=s[h];let y="other";for(const C of d){const[N,E]=C;if(E(f)){y=N;break}}const b=n&&i?f===f.toLocaleUpperCase(i):!1;let w=!1;r?w=r(u,y,l,b,f,h,s):(u!==y&&u!=="other"&&y!=="other"&&(w=!0),n&&y!=="other"&&!l&&b&&(w=!0)),w?(g.push(a),a=f):a+=f,u=y,n&&(l=b)}return a&&a.length>0&&g.push(a),g.length>0?g:[t]},"handleScriptTransitions"),Ji=k((t,e,n,i)=>{if(n.size===0)return e;for(const r of n)if(t.startsWith(r,e))return i.push(r),e+r.length;return e},"detectAndProcessAcronym"),xt=k((t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const i=[],r=t.length;for(let o=1;o<r;o++){const c=Ji(t,n,e,i);if(c!==n){n=c,o=n-1;continue}const s=t.codePointAt(o-1),g=t.codePointAt(o),a=s&&s<128&&Ae(s),u=g&&g<128&&Ae(g),d=s&&s<128&&tt(s),l=s&&s<128&&Pe(s),h=g&&g<128&&Pe(g);if(d&&u){i.push(t.slice(n,o)),n=o;continue}if(l&&!h||!l&&h){i.push(t.slice(n,o)),n=o;continue}if(h&&!l){let f=!1,y=!1;if(o+1<r){const b=t.codePointAt(o+1);f=b&&b<128&&Ae(b),y=b&&b<128&&Pe(b)}if(!y&&f){i.push(t.slice(n,o),t.slice(o,o+1)),n=o+1;continue}}if(o+1<r){const f=t.codePointAt(o+1),y=f&&f<128&&tt(f);if(a&&u&&y){const b=t.slice(n,o+1);e.has(b)||(i.push(t.slice(n,o)),n=o)}}}return n<r&&i.push(t.slice(n)),i.filter(o=>o!=="")},"splitCamelCaseFast"),Lt=k((t,e,n)=>{if(t.length===0)return[];const i=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!i&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const a=[...t],u=a.length,d=[];let l=a[0],h=a[0]===a[0].toLocaleUpperCase(e),f=h,y=h?0:-1;for(let b=1;b<u;b++){const w=a[b],C=w===w.toLocaleUpperCase(e);if(C===h)l+=w;else if(C)l&&l.length>0&&(d.push(l),l=w),f=!0,y=b;else{if(f&&b-y>1){const N=a[b-1],E=l.slice(0,-1);E&&E.length>0&&d.push(E),l=N+w}else l+=w;f=!1,y=-1}h=C}return l&&l.length>0&&d.push(l),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!G.test(t)&&!I.test(t))return[t];const a=[...t],u=a.length,d=[];let l=a[0];const h=a[0];let f;G.test(h)?f=1:I.test(h)?f=2:f=0;let y=h===h.toLocaleUpperCase(e);for(let w=1;w<u;w++){const C=a[w];let N;G.test(C)?N=1:I.test(C)?N=2:N=0;const E=C===C.toLocaleUpperCase(e);f!==N&&(f===1||f===2)&&(N===1||N===2)||N===f&&!y&&E?(d.push(l),l=C):l+=C,f=N,y=E}l&&l.length>0&&d.push(l);const b=[];for(let w=0;w<d.length;w++)w<d.length-1&&d[w].length===1&&I.test(d[w])&&G.test(d[w+1][0])?(b.push(d[w]+d[w+1]),w+=1):b.push(d[w]);return b}if(e.startsWith("el")){if(!ye.test(t)&&!I.test(t))return[t];const a=[];Te.lastIndex=0;let u;for(;(u=Te.exec(t))!==null;)a.push(u[0]);a.length===0&&a.push(t);const d=[];if(a.length===1){const l=a[0];if(!l||!ye.test(l[0])||l.length===1)return[l??t]}for(const l of a){if(!l)continue;if(!ye.test(l[0])||l.length===1){d.push(l);continue}const h=l.length;let f=l[0],y=l[0]===l[0].toLocaleUpperCase(e);for(let b=1;b<h;b++){const w=l[b],C=w===w.toLocaleUpperCase(e);!y&&C?(d.push(f),f=w):f+=w,y=C}f&&d.push(f)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const a=e.startsWith("ja"),u=a?{hiragana:k(l=>on.test(l),"hiragana"),kanji:k(l=>Me.test(l),"kanji"),katakana:k(l=>nn.test(l),"katakana"),latin:k(l=>I.test(l),"latin")}:{hangul:k(l=>Se.test(l),"hangul"),latin:k(l=>I.test(l),"latin")},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(a){const l=D(t,u,!1,e,(f,y)=>f==="hiragana"&&y==="katakana"||f==="katakana"&&y==="hiragana"||f==="hiragana"&&y==="latin"||f==="katakana"&&y==="latin"||f==="kanji"&&y==="latin"||f==="latin"&&(y==="hiragana"||y==="katakana"||y==="kanji")),h=[];for(const f of l){const y=f;y.length===1&&d.has(y)&&h.length>0?h[h.length-1]=h.at(-1)+y:h.push(y)}return h.length>0?h:[t]}return D(t,u,!1,e,(l,h)=>l==="hangul"&&h==="latin"||l==="latin"&&h==="hangul")}if(e.startsWith("sl")){const a=[...t],u=a.length,d=[];let l=a[0],h=a[0]===a[0].toLocaleUpperCase(e);for(let f=1;f<u;f++){const y=a[f],b=y===y.toLocaleUpperCase(e),w=Yi.test(y),C=f<u-1&&a[f+1]===a[f+1].toLocaleUpperCase(e);!h&&b||w&&C?(d.push(l),l=y,w&&C&&(d.push(l),l="")):l+=y,h=b}return l&&l.length>0&&d.push(l),d}if(e.startsWith("zh"))return D(t,{han:k(a=>Me.test(a),"han"),latin:k(a=>I.test(a),"latin")},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const a=k(u=>De.test(u)||Ve.test(u),"isRtlChar");return D(t,{latin:k(u=>I.test(u),"latin"),rtl:k(u=>a(u),"rtl")},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const a=k(u=>an.test(u)||rn.test(u)||sn.test(u)||ln.test(u)||cn.test(u)||un.test(u)||pn.test(u)||fn.test(u)||dn.test(u)||hn.test(u)||mn.test(u)||gn.test(u)||vn.test(u)||wn.test(u)||yn.test(u)||bn.test(u),"isIndicChar");return D(t,{indic:k(u=>a(u),"indic"),latin:k(u=>I.test(u),"latin")},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return D(t,{cyrillic:k(a=>G.test(a),"cyrillic"),latin:k(a=>I.test(a),"latin")},!0,e);if(["ar","fa","he"].includes(e))return D(t,{latin:k(a=>I.test(a),"latin"),rtl:k(a=>De.test(a)||Ve.test(a),"rtl")},!1,e);if(e.startsWith("ko"))return D(t,{hangul:k(a=>Se.test(a),"hangul"),latin:k(a=>I.test(a),"latin")},!1,e);if(e.startsWith("uz")){if(!G.test(t)&&!I.test(t))return[t];const a=[...t],u=a.length,d=[];let l=a[0],h=a[0]===a[0].toLocaleUpperCase(e);for(let f=1;f<u;f++){const y=a[f],b=y===y.toLocaleUpperCase(e);if(Be.test(y)||Be.test(a[f-1])){l+=y;continue}!h&&b?(d.push(l),l=y):l+=y,h=b}return l&&l.length>0&&d.push(l),d}const r=[...t],o=r.length,c=[];let s=r[0],g=r[0]===r[0].toLocaleUpperCase(e);for(const a of n)if(t.startsWith(a)){c.push(a),s=r[a.length],g=s===s.toLocaleUpperCase(e);break}for(let a=1;a<o;a++){const u=r[a],d=u===u.toLocaleUpperCase(e);let l=0;for(const h of n)if(t.startsWith(h,a)){c.push(s,h),l=h.length,s="";const f=h.at(-1);f&&(g=f===f.toLocaleUpperCase(e));break}if(l>0){a+=l-1;continue}!g&&d?(c.push(s),s=u):s+=u,g=d}return s&&c.push(s),c},"splitCamelCaseLocale"),Qi=k((t,e,n)=>{const i=[],r=ne.test(t)?t.split(ne).filter(Boolean):[t];for(const o of r){const c=o;if(ne.test(c))i.push(c);else{W.lastIndex=0;const s=W.test(c)?Ki(c).filter(Boolean):[c];for(const g of s)if(W.lastIndex=0,W.test(g))i.push(g);else if(e){const a=e.toLowerCase().split("-")[0];i.push(...Lt(g,a,n))}else i.push(...xt(g,n))}}return i},"processTextWithAnsiEmoji"),Xi=k((t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:i=!1,knownAcronyms:r=[],locale:o,normalize:c=!1,separators:s,stripAnsi:g=!1,stripEmoji:a=!1}=e,u=new Set([...r].toSorted((w,C)=>C.length-w.length));let d=t;g&&(d=Bi(d)),a&&(d=en(d));let l;Array.isArray(s)?l=Fi(s):s instanceof RegExp?l=s:l=tn;const h=[];let f=d;const y=l.flags.includes("g")?l:new RegExp(l.source,`${l.flags}g`);for(;f.length>0;){const w=y.exec(f);if(!w){f===".."?h.push(".."):f==="."?h.push("."):f.length>0&&h.push(f);break}const C=w.index,N=w[0],E=N.length,p=f.slice(0,C),m=f.slice(C+E);if(N.startsWith("../"))h.push(".."),f=f.slice(C+3);else if(N.startsWith("./"))h.push("."),f=f.slice(C+2);else if(C===0&&N==="..")h.push(".."),f=f.slice(2);else if(C===0&&N===".")h.push("."),f=f.slice(1);else{p.length>0&&h.push(p);let v=0;for(;(v=N.indexOf("../",v))!==-1;)h.push(".."),v+=3;for(v=0;(v=N.indexOf("./",v))!==-1;)(v===0||N[v-1]!==".")&&h.push("."),v+=2;let O=m;for(;O.startsWith("../");)h.push(".."),O=O.slice(3);for(;O.startsWith("./");)h.push("."),O=O.slice(2);if(O===".."){h.push("..");break}else if(O==="."){h.push(".");break}else f=O}y.lastIndex=0}if(h.length===0){const w=d.split(l).filter(Boolean);h.push(...w)}let b=[];for(const w of h)n||i?b.push(...Qi(w,o,u)):o?b.push(...Lt(w,o,u)):b.push(...xt(w,u));return c&&(b=b.map(w=>u.has(w)?w:o&&w===w.toLocaleUpperCase(o)?w[0]+w.slice(1).toLocaleLowerCase(o):w.toUpperCase()===w&&!u.has(w)?w.slice(0,1)+w.slice(1).toLowerCase():w)),b},"splitByCase");var Zi=Object.defineProperty,ea=$((t,e)=>Zi(t,"name",{value:e,configurable:!0}),"r$4"),ta=Object.defineProperty,na=ea((t,e)=>ta(t,"name",{value:e,configurable:!0}),"o"),oa=Object.defineProperty,ia=na((t,e)=>oa(t,"name",{value:e,configurable:!0}),"s");const aa=ia((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),"upperFirst");var ra=Object.defineProperty,sa=$((t,e)=>ra(t,"name",{value:e,configurable:!0}),"r$3"),la=Object.defineProperty,ca=sa((t,e)=>la(t,"name",{value:e,configurable:!0}),"r"),ua=Object.defineProperty,pa=ca((t,e)=>ua(t,"name",{value:e,configurable:!0}),"n");const fa=pa((t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}`,"generateCacheKey");var da=Object.defineProperty,ha=$((t,e)=>da(t,"name",{value:e,configurable:!0}),"i$3"),ma=Object.defineProperty,ga=ha((t,e)=>ma(t,"name",{value:e,configurable:!0}),"f"),va=Object.defineProperty,wa=ga((t,e)=>va(t,"name",{value:e,configurable:!0}),"l");const ya=wa((t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const i=[];let r="",o="";for(let c=0;c<n;c++){const s=t[c];if(ne.test(s)){r?(i.push(r+o+s),r="",o=""):(i.length>0&&i.push(e),r=s);continue}r?(o&&(o+=e),o+=s):(i.length>0&&i.push(e),i.push(s))}return i.join("")},"joinSegments");var ba=Object.defineProperty,$a=$((t,e)=>ba(t,"name",{value:e,configurable:!0}),"r$2"),Oa=Object.defineProperty,Aa=$a((t,e)=>Oa(t,"name",{value:e,configurable:!0}),"a"),Pa=Object.defineProperty,Ca=Aa((t,e)=>Pa(t,"name",{value:e,configurable:!0}),"e");const Na=/(?<![a-zß])SS(?![a-z])/g,_a=Ca(t=>t.replaceAll(Na,"ß"),"normalizeGermanEszett");var ka=Object.defineProperty,Ea=$((t,e)=>ka(t,"name",{value:e,configurable:!0}),"c$2"),xa=Object.defineProperty,La=Ea((t,e)=>xa(t,"name",{value:e,configurable:!0}),"c"),Ia=Object.defineProperty,ja=La((t,e)=>Ia(t,"name",{value:e,configurable:!0}),"o");const Ua=new Nt(1e3),It=ja((t,e)=>{if(typeof t!="string"||!t)return"";const n=e?.cache??!1,i=e?.cacheStore??Ua;let r;if(n&&(r=fa(t,e)),n&&r&&i.has(r))return i.get(r);let o=!0;const c=ya(Xi(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(s=>{if(e?.handleAnsi&&ne.test(s))return s;const g=e?.locale?.startsWith("de")?_a(s):s,a=e?.locale?g.toLocaleLowerCase(e.locale):g.toLowerCase();return o?(o=!1,Ui(a,e)):aa(a,e)}),"");return n&&r&&i.set(r,c),c},"camelCase");var Ta=Object.defineProperty,me=$((t,e)=>Ta(t,"name",{value:e,configurable:!0}),"a$2");const Ma=me(t=>{t.options?.forEach(e=>{e.__camelCaseName__=It(e.name)})},"processOptionNames"),Sa=me(t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const i of t.options)e.add(i.name);const n=[];for(const i of t.options)if(i.name.startsWith("no-")){const r=i.name.replace(/^no-/,"");if(!e.has(r)){if(i.type!==Boolean)throw new Error(`Cannot add negated option "${i.name}" to command "${t.name}" because it is not a boolean.`);const o={...i,defaultValue:i.defaultValue===void 0?!0:!i.defaultValue,name:r};n.push(o),e.add(r)}}n.length>0&&t.options.push(...n)},"addNegatableOptions"),Da=me((t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,i=new Map;for(const o of e.options)if(o.name.startsWith("no-")){const c=It(o.name);i.set(c,o)}const r=Object.keys(n).filter(o=>i.has(o));if(r.length!==0)for(const o of r){const c=o.charAt(2);if(!c)continue;const s=c.toLowerCase()+o.slice(3),g=i.get(o);g&&(g.__negated__=!0),n[s]=!n[o],Reflect.deleteProperty(n,o)}},"mapNegatableOptions"),Va=me((t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const r of e.options)r.__camelCaseName__&&r.__negated__===void 0&&r.implies!==void 0&&n.set(r.__camelCaseName__,r);if(n.size===0)return;const{options:i}=t;for(const r of Object.keys(i)){const o=n.get(r);if(o?.implies){const{implies:c}=o;for(const[s,g]of Object.entries(c))i[s]===void 0&&(i[s]=g)}}},"mapImpliedOptions");var Ba=Object.defineProperty,ge=$((t,e)=>Ba(t,"name",{value:e,configurable:!0}),"e$2");const Ra=ge(()=>!!process.versions.electron,"isElectronApp"),za=ge(()=>Ra()&&!process.defaultApp,"isBundledElectronApp"),Wa=ge(()=>za()?0:1,"getProcessArgvBinIndex"),Fa=ge(t=>t.slice(Wa()+1),"hideBin");var qa=Object.defineProperty,jt=$((t,e)=>qa(t,"name",{value:e,configurable:!0}),"e$1");const Ga=" ",Ka=jt((t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,i)=>n===e[i]),"equals"),Ha=jt(t=>{if(typeof t=="string")return t.split(Ga);const e=ke();return Ka(t,e)?Fa(t):t},"parseRawCommand");var Ya=Object.defineProperty,Ce=$((t,e)=>Ya(t,"name",{value:e,configurable:!0}),"r");const Ja=Ce(t=>{const e=Ce(o=>{t.error(`Uncaught exception: ${o.message||o}`),o.stack&&t.error(o.stack),Y(1)},"uncaughtExceptionHandler"),n=Ce((o,c)=>{if(o instanceof Error)t.error(`Promise rejection: ${o.message||o}`),o.stack&&t.error(o.stack);else{let s;if(typeof o=="string")s=o;else try{s=JSON.stringify(o)}catch{s=String(o)}t.error(`Promise rejection: ${s}`)}Y(1)},"unhandledRejectionHandler"),i=Ue("uncaughtException",e),r=Ue("unhandledRejection",n);return()=>{i(),r()}},"registerExceptionHandler");var Qa=Object.defineProperty,Z=$((t,e)=>Qa(t,"name",{value:e,configurable:!0}),"e");const le=100,Ut=/^[a-z][\w-]*$/i,ce=Z((t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new P(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},"validateNonEmptyString"),nt=Z((t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new P(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateStringArray");Z((t,e)=>{if(typeof t!="function")throw new P(`${e} must be a function`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateFunction");const Ne=Z((t,e)=>{if(typeof t!="object"||t===null)throw new P(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateObject"),re=Z(t=>{const e=ce(t,"Command name");if(e.length>le)throw new P(`Command name is too long (maximum ${String(le)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new P(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!Ut.test(e))throw new P(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},"validateCommandName");Z(t=>{const e=ce(t,"Plugin name");if(e.length>le)throw new P(`Plugin name is too long (maximum ${String(le)} characters)`,"INVALID_PLUGIN_NAME",{length:e.length,pluginName:e});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new P(`Plugin name "${e}" contains invalid characters`,"INVALID_PLUGIN_NAME",{pluginName:e});if(!Ut.test(e))throw new P(`Plugin name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_PLUGIN_NAME",{pluginName:e});return e},"validatePluginName");var Xa=Object.defineProperty,ve=$((t,e)=>Xa(t,"name",{value:e,configurable:!0}),"s");const Za=new Set([`
|
|
4
|
+
`,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),er=/^[A-Z]:/i,tr=ve((t,e=!0)=>{if(typeof t!="string")throw new TypeError("Argument must be a string");if(t.length>1e4)throw new Error(`Argument is too long (maximum ${String(1e4)} characters)`);if(e){for(const n of t)if(Za.has(n))throw new Error(`Argument contains dangerous character: ${n}`)}return t.trim()},"sanitizeArgument"),ot=ve((t,e=!0)=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");if(t.length>100)throw new Error(`Too many arguments (maximum ${String(100)})`);return t.map(n=>tr(n,e))},"sanitizeArguments");ve(t=>{if(typeof t!="string")throw new TypeError("Path must be a string");const e=t.trim();if(e.split(/[/\\]/).includes(".."))throw new Error("Path contains directory traversal sequences");if(e.startsWith("/")||er.test(e))throw new Error("Absolute paths are not allowed");if(e.length>1e3)throw new Error("Path is too long");return e},"validateSafePath");class Ar{static{$(this,"RateLimiter")}static{ve(this,"RateLimiter")}attempts=new Map;maxAttempts;windowMs;constructor(e=5,n=6e4){if(e<=0||n<=0)throw new Error("maxAttempts and windowMs must be positive numbers");this.maxAttempts=e,this.windowMs=n}checkLimit(e){const n=Date.now(),i=this.attempts.get(e);return!i||n>i.resetTime?(this.attempts.set(e,{count:1,resetTime:n+this.windowMs}),this.cleanup(n),!0):i.count>=this.maxAttempts?!1:(i.count+=1,!0)}reset(e){this.attempts.delete(e)}cleanup(e){for(const[n,i]of this.attempts.entries())e>i.resetTime&&this.attempts.delete(n)}}var nr=Object.defineProperty,T=$((t,e)=>nr(t,"name",{value:e,configurable:!0}),"b");const or=/^-([^\d-])$/,ir=/^--(\S+)/,ar=/^-([^\d-]{2,})$/,_e=T(t=>or.test(t)||ir.test(t)||ar.test(t),"isOption"),rr={access:T((t,e)=>qt(t,e),"access"),mkdir:T((t,e)=>Ft(t,e),"mkdir"),readdir:T(t=>Wt(t),"readdir"),readFile:T((async(t,e)=>e===void 0?Ie(t):Ie(t,e)),"readFile"),rm:T((t,e)=>zt(t,e),"rm"),stat:T(t=>Rt(t),"stat"),writeFile:T((t,e,n)=>Bt(t,e,n),"writeFile")};class Tt{static{$(this,"Cli")}static{T(this,"Cli")}#t;#e;#c;#u;#f;#d;#y;#b;#$;#O;#A;#p;#n;#o;#i;#a;#r;#h=!1;#P;#C=!1;#m;#g;#v;#l=[];#x(){return this.#m===void 0&&(this.#m=[...this.#o.keys()]),this.#m}#N(){return this.#g===void 0&&(this.#g=[...this.#n.keys()]),this.#g}#s(){return this.#v===void 0&&(this.#v=[...this.#x(),...this.#N()]),this.#v}#_(){return this.#l.length===0?ae:[...ae,...this.#l]}#k(){this.#m=void 0,this.#g=void 0,this.#v=void 0}#w(){if(this.#c===void 0){const e=Ha(this.#e.argv);this.#c=ot(e,!1),this.#L()}return this.#c}#L(){if(!this.#c)return;const e=z();let n=!1;for(const i of this.#c){if(i==="--quiet"||i==="-q"){e.CEREBRO_OUTPUT_LEVEL=String(Gt),n=!0;break}if(i==="--verbose"||i==="-v"){e.CEREBRO_OUTPUT_LEVEL=String(Kt),n=!0;break}if(i==="--debug"){e.CEREBRO_OUTPUT_LEVEL=String(H),n=!0;break}}n||(e.CEREBRO_OUTPUT_LEVEL=Object.hasOwn(e,"DEBUG")?String(H):String(je))}#I(){this.#C||(this.#P=Ja(this.#t),this.#C=!0)}#j(){return{arch:Yt(),argv:this.#w(),cwd:this.#u,env:this.#O??z(),exit:this.#$??(e=>Y(e??0)),platform:Ht(),stdin:this.#A}}#E(e,n,i,r){this.#t.debug(`command '${r}' found, parsing command args: ${n.join(", ")}`);const{arguments_:o,booleanValues:c,parsedArgs:s}=ci(e,n,this.#_()),g=Object.keys(c).length>0;let a=s;g&&(a={...s,_all:{...s._all,...c}}),yi(o,a,e);const u=li(e,s,c,i);u.runtime=this,u.argv=this.#w(),u.fs=this.#b??rr,u.process=this.#j(),u.console=this.#t;const d=e.options&&e.options.length>0;if(d&&e.options){const l=e.options.filter(h=>h.name.startsWith("no-"));for(const h of l){const f=h.name.replace(/^no-/,""),y=`--${h.name}`,b=`--${f}`,w=n.includes(y),C=n.includes(b);if(w&&C)throw new at(f,h.name)}}return d&&(Da(u,e),Va(u,e)),bi(o,u.options,e),z().CEREBRO_OUTPUT_LEVEL===String(H)&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(u.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(u.argument,null,2))),{arguments_:o,booleanValues:c,commandArgs:a,parsedArgs:s,toolbox:u}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new P("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#f=e.trim();const i=n.argv??ke(),r=n.cwd??Jt();if(this.#e={...n,argv:i,cwd:r},this.#e.argv&&!Array.isArray(this.#e.argv))throw new P("CLI argv option must be an array of strings","INVALID_INPUT",{argv:this.#e.argv});if(this.#e.cwd&&typeof this.#e.cwd!="string")throw new P("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new P("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new P("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});const o=z();if(o.CEREBRO_OUTPUT_LEVEL=String(je),typeof this.#e.logger=="object"){const u=["debug","error","info","log","warn"],d=[],l=this.#e.logger;for(const h of u)typeof l[h]!="function"&&d.push(h);if(d.length>0)throw new P(`Logger object is missing required methods: ${d.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:d});this.#t=this.#e.logger}else this.#t={...console,debug:T((...u)=>{o.CEREBRO_OUTPUT_LEVEL===String(H)&&console.debug(...u)},"debug")};this.#d=this.#e.packageVersion,this.#y=this.#e.packageName,this.#u=this.#e.cwd,this.#a="help",this.#r={};const c=n.fs;if(c!==void 0&&(typeof c!="object"||c===null))throw new P("CLI fs option must be an object implementing the CerebroFs interface","INVALID_INPUT",{fs:n.fs});const s=n.exit;if(s!==void 0&&typeof s!="function")throw new P("CLI exit option must be a function","INVALID_INPUT",{exit:n.exit});const g=n.env;if(g!==void 0&&(typeof g!="object"||g===null))throw new P("CLI env option must be a record of string keys","INVALID_INPUT",{env:n.env});const a=n.stdin;if(a!==void 0&&typeof a!="string")throw new P("CLI stdin option must be a string","INVALID_INPUT",{stdin:n.stdin});this.#b=n.fs,this.#$=n.exit,this.#O=n.env,this.#A=n.stdin??"",this.#n=new Map,this.#o=new Map,this.#i=new Map}setCommandSection(e){return this.#r=e,this}getCommandSection(){return this.#r.header||(this.#r.header=`${this.#f}${this.#d?` v${this.#d}`:""}`),this.#r}setDefaultCommand(e){return this.#a=e,this}get defaultCommand(){return this.#a}addCommand(e){Ne(e,"Command"),re(e.name);const n=typeof e.execute=="function",i=typeof e.loader=="function";if(n&&i)throw new P(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!i)throw new P(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?re(e.alias):nt(e.alias,"Command alias").forEach(a=>re(a))),e.argument&&Ne(e.argument,"Command argument"),e.options&&Ne(e.options,"Command options"),e.commandPath&&(nt(e.commandPath,"Command commandPath"),e.commandPath.forEach(a=>{re(a)}));const r=et(e.name,e.commandPath),o=B(r);if(this.#o.has(o))throw new P(`Command with path "${o}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const c=Array.isArray(e.commandPath)&&e.commandPath.length>0,s=this.#n.get(e.name),g=s!==void 0&&(s.commandPath===void 0||s.commandPath.length===0);if(!c&&g)throw new P(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const a of e.options)ze(a);if($i(e),Sa(e),Ma(e),e.options&&(e.__conflictingOptions__=e.options.filter(a=>a.conflicts!==void 0),e.__requiredOptions__=e.options.filter(a=>a.required===!0)),c&&s!==void 0)this.#n.set(o,e);else{if(!c&&s!==void 0&&!g){const a=et(s.name,s.commandPath);this.#n.set(B(a),s)}this.#n.set(e.name,e)}if(this.#o.set(o,r),this.#i.set(o,e),this.#k(),e.alias!==void 0){const a=typeof e.alias=="string"?[e.alias]:e.alias;for(const u of a){if(z().CEREBRO_OUTPUT_LEVEL===String(H)&&this.#t.debug("adding alias",u),this.#n.has(u))throw new P(`Command alias "${u}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:u,commandName:e.name});this.#n.set(u,e)}}return this}addGlobalOption(e){const n=e,i=new Set(ae.map(o=>o.name)),r=new Set(ae.map(o=>o.alias).filter(Boolean));if(i.has(n.name))throw new P(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&r.has(n.alias))throw new P(`Cannot add global option with alias "-${n.alias}": it conflicts with a built-in global option alias`,"DUPLICATE_OPTION",{alias:n.alias,optionName:n.name});if(new Set(this.#l.map(o=>o.name)).has(n.name))throw new P(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",ze(n),this.#l.push(n),this}getGlobalOptions(){return this.#_()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#p?this.#p:(this.#p=new xn(this.#t),this.#p.register({description:"Attaches the logger to the toolbox",execute:T(e=>{e.logger=this.#t,e.console=e.logger},"execute"),name:"logger"}),this.#p)}getCliName(){return this.#f}getPackageVersion(){return this.#d}getPackageName(){return this.#y}getCommands(){return this.#n}getCwd(){return this.#u}dispose(){this.#P?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:i=!0,...r}=e;if(!this.#n.has("help")){const{default:p}=await import("../commands/help-command.js");this.addCommand(new p(this.#n))}const o=this.#N(),c=this.#o;this.#I();const s=this.#w();let g,a=[...s];const u=Qt(),d=Xt(),l=ke();this.#t.debug(`process.execPath: ${u}`),this.#t.debug(`process.execArgv: ${d.join(" ")}`),this.#t.debug(`process.argv: ${l.join(" ")}`);const h=Ai(c,[...s]);if(h.commandPath)g=h.commandPath,a=h.argv;else{if(s.length>1&&s[0]&&s[1]&&!_e(s[0])&&!_e(s[1])){const m=[];let v=0;for(;v<s.length;){const A=s[v];if(!A||_e(A))break;m.push(A),v+=1}const O=B(m);if(m[0]&&!o.includes(m[0])){const A=this.#s(),U=R(O,A);throw new V(O,U)}}let p;try{p=Bn([null,...o],[...s])}catch(m){if(m instanceof Error&&m.name==="INVALID_COMMAND"&&"command"in m){const v=m.command,O=this.#s(),A=R(v,O);throw new V(v,A)}throw m}p.command&&(g=[p.command],a=p.argv)}if(!g)if(this.#a)g=[this.#a];else{const p=this.#s();throw new V("",p)}const f=B(g),y=this.#o.get(f);let b;if(y){if(b=this.#i.get(f),!b||B(y)!==f){const p=this.#s(),m=R(f,p);throw new V(f,m)}}else{const p=g.at(-1);if(b=p?this.#n.get(p):void 0,!b){const m=this.#s(),v=R(f,m);throw new V(f,v)}}if(typeof b.execute!="function"&&typeof b.loader!="function")return this.#t.error(`Command "${b.name}" has no function to execute.`),i?Y(1):void 0;const w=a;let C,N;try{({commandArgs:C,toolbox:N}=this.#E(b,w,r,f))}catch(p){if(this.#t.error(p),i)return Y(1);throw p}const E=this.getPluginManager();try{!this.#h&&E.hasPlugins()&&(await E.init({cli:this,cwd:this.#u,logger:this.#t}),this.#h=!0),await E.executeLifecycle("execute",N),await E.executeLifecycle("beforeCommand",N);let p;const m=C.global;if(m?.help){const v=this.#n.get("help");if(!v)throw new P("Help command not found","COMMAND_NOT_FOUND");p=await K(v,N,C)}else if(m?.version??m?.V){const v=this.#n.get("version");if(!v)throw new P("Version command not found","COMMAND_NOT_FOUND");p=await K(v,N,C)}else p=await K(b,N,C);return await E.executeLifecycle("afterCommand",N,p),i?Y(0):void 0}catch(p){throw await E.executeErrorHandlers(p,N),p}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:i=[],...r}=n;ce(e,"Command name");const o=e.split(" ").filter(Boolean),c=B(o),s=this.#o.get(c)?this.#i.get(c):this.#n.get(e);if(!s){const l=this.#s(),h=R(c||e,l);throw new V(e,h)}if(typeof s.execute!="function"&&typeof s.loader!="function")throw new P(`Command "${s.name}" has no function to execute`,"INVALID_COMMAND",{commandName:s.name});const g=[...ot(i,!1)];this.#t.debug(`running command '${e}' programmatically with args: ${g.join(", ")}`);const{commandArgs:a,toolbox:u}=this.#E(s,g,r,c||e),d=this.getPluginManager();try{!this.#h&&d.hasPlugins()&&(await d.init({cli:this,cwd:this.#u,logger:this.#t}),this.#h=!0),await d.executeLifecycle("execute",u),await d.executeLifecycle("beforeCommand",u);let l;const h=a.global;if(h?.help){const f=this.#n.get("help");if(!f)throw new P("Help command not found","COMMAND_NOT_FOUND");l=await K(f,u,a)}else if(h?.version??h?.V){const f=this.#n.get("version");if(!f)throw new P("Version command not found","COMMAND_NOT_FOUND");l=await K(f,u,a)}else l=await K(s,u,a);return await d.executeLifecycle("afterCommand",u,l),l}catch(l){throw await d.executeErrorHandlers(l,u),l}}clone(e){const n={...this.#e,...e},i=new Tt(this.#f,n);for(const[r,o]of this.#n)i.#n.set(r,o);for(const[r,o]of this.#o)i.#o.set(r,[...o]);for(const[r,o]of this.#i)i.#i.set(r,o);for(const r of this.#l)i.#l.push(r);return i.#a=this.#a,i.#r={...this.#r},i.#k(),i}async getAction(e){ce(e,"Command name");const n=e.split(" ").filter(Boolean),i=B(n),r=this.#o.get(i)?this.#i.get(i):this.#n.get(e);if(!r){const o=this.#s(),c=R(i||e,o);throw new V(e,c)}if(typeof r.execute=="function")return r.execute;if(typeof r.loader=="function")return Ot(r);throw new P(`Command "${r.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:r.name})}}export{Tt as Cli};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
var ge=Object.defineProperty;var d=(e,r)=>ge(e,"name",{value:r,configurable:!0});import{createRequire as we}from"node:module";import{h as O,H as E,E as U}from"./constants-DmzZF6_u-BmMwILI_.js";import{createTable as P}from"@visulima/tabular";import{NO_BORDER as M}from"@visulima/tabular/style";import $e from"@visulima/colorize/template";import{d as We}from"./runtime-process-DKHFvYkv.js";import{bold as Ne}from"@visulima/colorize";const be=we(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=d(e=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[r,t]=$.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return $.getBuiltinModule(e)}return be(e)},"__cjs_getBuiltinModule"),w=$,{execFileSync:ye}=k("node:child_process"),I=k("node:fs"),ve=k("node:tty"),Oe=k("node:os");var Ie=Object.defineProperty,Q=d((e,r)=>Ie(e,"name",{value:r,configurable:!0}),"u$2"),je=Object.defineProperty,L=Q((e,r)=>je(e,"name",{value:r,configurable:!0}),"l");const Ae=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],xe=12288,Ee=65510,Se=[12288,12288,65281,65376,65504,65510],Pe=8361,Me=65518,Te=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],_e=32,Ce=10630,Re=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],ke=4352,Le=262141,ae=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var Fe=Object.defineProperty,Be=L((e,r)=>Fe(e,"name",{value:r,configurable:!0}),"r$1");const j=Be((e,r)=>{let t=0,i=Math.floor(e.length/2)-1;for(;t<=i;){const a=Math.floor((t+i)/2),s=a*2;if(r<e[s])i=a-1;else if(r>e[s+1])t=a+1;else return!0}return!1},"isInRange");var He=Object.defineProperty,b=L((e,r)=>He(e,"name",{value:r,configurable:!0}),"r");const te=19968,[ze,qe]=F(ae);function F(e){let r=e[0],t=e[1];for(let i=0;i<e.length;i+=2){const a=e[i],s=e[i+1];if(te>=a&&te<=s)return[a,s];s-a>t-r&&(r=a,t=s)}return[r,t]}d(F,"c$2");Q(F,"f");L(F,"k");b(F,"findWideFastPathRange");const oe=b(e=>e<161||e>1114109?!1:j(Ae,e),"isAmbiguous"),se=b(e=>e<xe||e>Ee?!1:j(Se,e),"isFullWidth"),Ve=b(e=>e<Pe||e>Me?!1:j(Te,e),"isHalfWidth"),Ye=b(e=>e<_e||e>Ce?!1:j(Re,e),"isNarrow"),le=b(e=>e>=ze&&e<=qe?!0:e<ke||e>Le?!1:j(ae,e),"isWide");function B(e){return oe(e)?"ambiguous":se(e)?"fullwidth":Ve(e)?"halfwidth":Ye(e)?"narrow":le(e)?"wide":"neutral"}d(B,"g$3");Q(B,"S");L(B,"getCategory");b(B,"getCategory");var De=Object.defineProperty,H=d((e,r)=>De(e,"name",{value:r,configurable:!0}),"i$2"),Ue=Object.defineProperty,z=H((e,r)=>Ue(e,"name",{value:r,configurable:!0}),"a"),Je=Object.defineProperty,X=z((e,r)=>Je(e,"name",{value:r,configurable:!0}),"e");function A(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}d(A,"s$1");H(A,"s");z(A,"r");X(A,"validate");function x(e){return A(e),B(e)}d(x,"r$3");H(x,"p");z(x,"eastAsianWidthType");X(x,"eastAsianWidthType");function Z(e,{ambiguousAsWide:r=!1}={}){return A(e),se(e)||le(e)||r&&oe(e)?2:1}d(Z,"o$2");H(Z,"W");z(Z,"eastAsianWidth");X(Z,"eastAsianWidth");var Ke=Object.defineProperty,Ge=d((e,r)=>Ke(e,"name",{value:r,configurable:!0}),"E"),Qe=Object.defineProperty,Xe=Ge((e,r)=>Qe(e,"name",{value:r,configurable:!0}),"A"),Ze=Object.defineProperty,q=Xe((e,r)=>Ze(e,"name",{value:r,configurable:!0}),"d");const ie=new Map,S=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,T=q(e=>e>=32&&e<=126?"latin":e===8203||e===8204||e===8205||e===8288?"zero":e<=31||e>=127&&e<=159?"control":e>=160&&e<=255||e>=9472&&e<=9599?"latin":e>=4352&&e<=4607||e>=11904&&e<=40959||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65280&&e<=65519&&!(e>=65377&&e<=65439)||e>=12352&&e<=12543?"wide":e===8230?"latin":"other","getCharType"),er=q((e,r)=>{const t=Math.floor(e/65536),i=e%65536;let a=ie.get(t);if(a||(a=new Map,ie.set(t,a)),a.has(i))return a.get(i);let s;if(T(e)==="latin")s=r.width.regular;else if(T(e)==="control")s=r.width.control;else if(T(e)==="wide")s=r.width.wide;else switch(x(e)){case"ambiguous":{s=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{s=r.width.fullWidth;break}case"wide":{s=r.width.wide;break}default:s=r.width.regular}return a.set(i,s),s},"getCachedCharWidth"),rr=q(e=>e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=917760&&e<=917999||e>=65024&&e<=65039||e>=3633&&e<=3642||e>=3655&&e<=3662||e>=3761&&e<=3769||e>=3771&&e<=3772||e>=3784&&e<=3789||e>=2304&&e<=2307||e>=2362&&e<=2383||e>=2385&&e<=2391||e>=2402&&e<=2403||e>=2433&&e<=2435||e>=2492&&e<=2500||e>=2509&&e<=2509||e>=2561&&e<=2563||e>=2620&&e<=2637||e>=1611&&e<=1631||e>=1648&&e<=1648||e>=1750&&e<=1773||e>=2276&&e<=2302||e>=1425&&e<=1469||e>=1471&&e<=1471||e>=1473&&e<=1474||e>=1476&&e<=1477||e>=1479&&e<=1479||e>=3893&&e<=3893||e>=3895&&e<=3895||e>=3897&&e<=3897||e>=3953&&e<=3966||e>=3968&&e<=3972||e>=3974&&e<=3975?!0:e>=768&&e<=777||e>=803&&e<=803,"isCombiningCharacter"),K=q((e,r={})=>{if(!e||e.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const t={truncation:{countAnsiEscapeCodes:r.countAnsiEscapeCodes??!1,ellipsis:r.ellipsis??"",ellipsisWidth:r.ellipsisWidth??(r.ellipsis?K(r.ellipsis,{...r,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:r.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:r.ambiguousIsNarrow??!1,ansi:r.ansiWidth??0,control:r.controlWidth??0,emoji:r.emojiWidth??2,fullWidth:r.fullWidth??2,halfWidth:r.halfWidth??1,regular:r.regularWidth??1,tab:r.tabWidth??8,wide:r.wideWidth??2}},i=Math.max(0,t.truncation.limit-t.truncation.ellipsisWidth),{length:a}=e,s=a>1e4;let n=0,o=0,l=a,u=!1;const y=e.includes("\x1B")||e.includes("");for(;n<a;){if(y&&(e[n]==="\x1B"||e[n]==="")){if(e.startsWith("\x1B]8;;",n)){const h="\x1B]8;;\x07",g=h.length,V=e.indexOf("\x07",n+5);if(V!==-1){const Y=e.indexOf(h,V+1);if(Y!==-1){const me=Y+g,pe=e.slice(V+1,Y).replace(O,""),re=K(pe,{ambiguousIsNarrow:t.width.ambiguousIsNarrow,ansiWidth:t.width.ansi,controlWidth:t.width.control,countAnsiEscapeCodes:!1,ellipsis:t.truncation.ellipsis,ellipsisWidth:t.truncation.ellipsisWidth,emojiWidth:t.width.emoji,fullWidth:t.width.fullWidth,halfWidth:t.width.halfWidth,limit:Math.max(0,i-o),regularWidth:t.width.regular,tabWidth:t.width.tab,wideWidth:t.width.wide}),D=re.width;if(re.truncated)u=!0,l=Math.min(l,n);else if(o+D>i&&(l=Math.min(l,n),u=!0,o+D>t.truncation.limit))break;if(o+=D,n=me,u&&o>=t.truncation.limit)break;continue}}}if(O.lastIndex=n,O.test(e)){const h=O.lastIndex-n,g=t.truncation.countAnsiEscapeCodes?h:t.width.ansi;if(o+g>i&&(l=Math.min(l,n),o+g>t.truncation.limit)){u=!0;break}o+=g,n=O.lastIndex;continue}}const m=e.codePointAt(n);if(m===8203||m===65279||m>=8288&&m<=8292){n+=1;continue}if(m===9){if(o+t.width.tab>i&&(l=Math.min(l,n),o+t.width.tab>t.truncation.limit)){u=!0;break}o+=t.width.tab,n+=1;continue}if(S.lastIndex=n,S.test(e)){const h=(S.lastIndex-n)*t.width.regular;if(o+h>i){const g=Math.floor((i-o)/t.width.regular);if(l=Math.min(l,n+g),o+h>t.truncation.limit){u=!0;break}}o+=h,n=S.lastIndex;continue}if((m<=31||m>=127&&m<=159)&&(E.lastIndex=n,E.test(e))){const h=(E.lastIndex-n)*t.width.control;if(o+h>i&&(l=Math.min(l,n+Math.floor((i-o)/t.width.control)),o+h>t.truncation.limit)){u=!0;break}o+=h,n=E.lastIndex;continue}if(U.lastIndex=n,U.test(e)){if(o+t.width.emoji>i&&(l=Math.min(l,n),o+t.width.emoji>t.truncation.limit)){u=!0;break}o+=t.width.emoji,n=U.lastIndex;continue}const v=e.codePointAt(n)??0;if(rr(v)){n+=v>65535?2:1;continue}let f;if(s)f=er(v,t);else switch(T(v)){case"control":{f=t.width.control;break}case"latin":{f=t.width.regular;break}case"wide":{f=t.width.wide;break}case"zero":{f=0;break}default:switch(x(v)){case"ambiguous":{f=t.width.ambiguousIsNarrow?t.width.regular:t.width.wide;break}case"fullwidth":{f=t.width.fullWidth;break}case"wide":{f=t.width.wide;break}default:f=t.width.regular}}if(o+f>i&&(l=Math.min(l,n),o+f>t.truncation.limit)){u=!0;break}o+=f,n+=v>65535?2:1}let W=o,ee=!1;return u&&t.truncation.limit>=t.truncation.ellipsisWidth&&(W=t.truncation.limit,ee=!0),{ellipsed:ee,index:u?l:a,truncated:u,width:W}},"getStringTruncatedWidth");var tr=Object.defineProperty,ir=d((e,r)=>tr(e,"name",{value:r,configurable:!0}),"i$1"),nr=Object.defineProperty,ar=ir((e,r)=>nr(e,"name",{value:r,configurable:!0}),"e"),or=Object.defineProperty,sr=ar((e,r)=>or(e,"name",{value:r,configurable:!0}),"r");const lr=sr((e,r={})=>K(e,{...r,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,"getStringWidth");var dr=Object.defineProperty,p=d((e,r)=>dr(e,"name",{value:r,configurable:!0}),"n$1");const de=80,ue=24,G=p((e,r,{shell:t,env:i}={})=>ye(e,r,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:t,env:i}).trim(),"exec"),_=p((e,r)=>({columns:Number.parseInt(e,10),rows:Number.parseInt(r,10)}),"create"),ce=p((e,r)=>{const{columns:t,rows:i}=_(e,r);if(!(Number.isNaN(t)||Number.isNaN(i))&&!(t===de&&i===ue))return{columns:t,rows:i}},"createIfNotDefault"),ur=p(()=>{if(w.platform!=="linux")return!0;try{const e=I.readFileSync("/proc/self/stat","utf8"),r=e.lastIndexOf(") ");if(r===-1)return!1;const t=e.slice(r+2).trim().split(/\s+/),i=Number.parseInt(t[2],10),a=Number.parseInt(t[5],10);return Number.isNaN(i)||Number.isNaN(a)||a<=0?!1:i===a}catch{return!1}},"isForegroundProcess");function fe(){const{env:e,stdout:r,stderr:t}=w;if(r?.columns&&r?.rows)return _(r.columns,r.rows);if(t?.columns&&t?.rows)return _(t.columns,t.rows);if(e.COLUMNS&&e.LINES)return _(e.COLUMNS,e.LINES);const i={columns:de,rows:ue};return w.platform==="win32"?J()??i:w.platform==="darwin"?ne()??J()??i:ne()??J()??cr()??i}d(fe,"O$1");p(fe,"terminalSize");const ne=p(()=>{try{const e=w.platform==="darwin"?I.constants.O_EVTONLY|I.constants.O_NONBLOCK:I.constants.O_NONBLOCK,{columns:r,rows:t}=ve.WriteStream(I.openSync("/dev/tty",e));return{columns:r,rows:t}}catch{}},"devTty"),J=p(()=>{try{const e=G("tput",["cols"],{env:{TERM:"dumb",...w.env}}),r=G("tput",["lines"],{env:{TERM:"dumb",...w.env}});if(e&&r)return ce(e,r)}catch{}},"tput"),cr=p(()=>{try{if(!ur())return;const e=G("resize",["-u"]).match(/\d+/g);if(e.length===2)return ce(e[0],e[1])}catch{}},"resize");var fr=Object.defineProperty,hr=d((e,r)=>fr(e,"name",{value:r,configurable:!0}),"s");const N=new Map,mr=500,c=hr(e=>{if(!e||e==="")return"";const r=N.get(e);if(r!==void 0)return r;const t=$e(Object.assign([],{raw:[e]}));if(N.size>=mr){const i=N.keys().next().value;i!==void 0&&N.delete(i)}return N.set(e,t),t},"templateFormat");var pr=Object.defineProperty,gr=d((e,r)=>pr(e,"name",{value:r,configurable:!0}),"t$1");const C=gr(()=>{const e=We().CEREBRO_TERMINAL_WIDTH;if(e===void 0)return;const r=Number.parseInt(e,10);if(!(Number.isNaN(r)||r<=0))return r},"getTerminalWidth");var wr=Object.defineProperty,br=d((e,r)=>wr(e,"name",{value:r,configurable:!0}),"t");class he{static{d(this,"n")}static{br(this,"BaseSection")}lines;constructor(){this.lines=[]}add(r){this.lines.push(r)}toString(){return this.lines.join(Oe.EOL)}header(r){this.add(Ne(r)),this.lines.push("")}}var yr=Object.defineProperty,R=d((e,r)=>yr(e,"name",{value:r,configurable:!0}),"g");const vr=R(e=>e!==void 0&&e>0?e:fe().columns,"resolveTerminalWidth"),$r=R((e,r,t,i)=>{if(e.length===0||e.some(u=>u.length!==2))return;let a=0;for(const u of e){const y=u[0];if(y===void 0)continue;const W=lr(y);W>a&&(a=W)}if(a===0)return;const s=t+i,n=a+s,o=20+s;if(n+o>r)return;const l=r-n;return[n,l]},"computeColumnWidths");class Wr extends he{static{d(this,"S")}static{R(this,"ContentSection")}constructor(r){if(super(),r.header&&this.header(c(r.header)),r.content){if(r.raw)if(Array.isArray(r.content)&&r.content.every(t=>typeof t=="string"))r.content.forEach(t=>{Array.isArray(t)?t.forEach(i=>{this.add(c(i))}):this.add(c(t))});else if(typeof r.content=="string")this.add(c(r.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(r.content));this.add("")}}getContentLines(r){if(typeof r=="string"){const t=P({showHeader:!1,style:{border:M,paddingLeft:4,paddingRight:1},terminalWidth:C(),truncateOverflow:!1,wordWrap:!0});return t.addRow([c(r)]),t.toString()}if(Array.isArray(r)&&r.every(t=>typeof t=="string"||Array.isArray(t)&&t.every(i=>typeof i=="string"))){const t=vr(C()),i=R(o=>Array.isArray(o)?o.map(l=>c(l)):[c(o)],"formatRow"),a=r.map(o=>i(o)),s=$r(a,t,4,1),n=P({columnWidths:s,showHeader:!1,style:{border:M,paddingLeft:4,paddingRight:1},terminalWidth:t,truncateOverflow:!1,wordWrap:!0});return a.forEach(o=>{s!==void 0&&o.length===2?n.addRow([{content:o[0],wordWrap:!1},o[1]]):n.addRow(o)}),n.toString()}if(typeof r=="object"){const t=r;if(!t.options||!t.data)throw new Error(`Must have an "options" or "data" property
|
|
2
|
+
${JSON.stringify(r)}`);const i=P({showHeader:!1,style:{border:M,paddingLeft:4,paddingRight:1},terminalWidth:C(),truncateOverflow:!1,wordWrap:!0});return t.data.forEach(a=>{Array.isArray(a)?i.addRow(a.map(s=>c(s))):i.addRow([c(a)])}),i.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object:
|
|
3
|
+
|
|
4
|
+
${JSON.stringify(r)}`)}}var Or=Object.defineProperty,Nr=d((e,r)=>Or(e,"name",{value:r,configurable:!0}),"m");class Ir extends he{static{d(this,"O")}static{Nr(this,"OptionListSection")}constructor(r){super();let t=r.optionList??[];const i=Array.isArray(r.hide)?r.hide:[r.hide].filter(n=>typeof n=="string"),a=Array.isArray(r.group)?r.group:[r.group].filter(n=>typeof n=="string");i.length>0&&(t=t.filter(n=>!i.includes(n.name))),r.header&&this.header(c(r.header)),a.length>0&&(t=t.filter(n=>{const o=n,l=a.includes("_none")&&!o.group,u=o.group,y=this.intersect(Array.isArray(u)?u:[u],a);return l||y?n:void 0}));const s=P({showHeader:!1,style:{border:M,paddingLeft:2,paddingRight:1,...r.tableOptions?.style},terminalWidth:C()??r.tableOptions?.terminalWidth,truncateOverflow:!1,wordWrap:r.tableOptions?.wordWrap??!0,...r.tableOptions});t.forEach(n=>{const o=n;s.addRow([this.getOptionNames(o,r.reverseNameOrder??!1,r.isArgument??!1),c(o.description)])}),this.add(s.toString()),this.lines.push("")}getOptionNames(r,t,i){if(!r.name)throw new TypeError("Invalid option definition, name is required.");let a=r.type?r.type.name.toLowerCase():"string";const s=r.multiple||r.lazyMultiple?"[]":"";a=c(r.typeLabel??`{underline ${a}${s}}`);let n;if(r.alias)if(r.name){const o=i?r.name:`{yellow --${r.name}}`;n=c(t?`{bold ${o}}, {bold -${r.alias}} ${a}`:`{bold -${r.alias}}, {bold ${o}} ${a}`)}else t?n=c(`{bold -${r.alias}} ${a}`):n=c(`{bold -${r.alias}} ${a}`);else n=c(`{bold ${i?r.name:`{yellow --${r.name}}`}} ${a}`);return n}intersect(r,t){return r.some(i=>t.includes(i))}}var jr=Object.defineProperty,Ar=d((e,r)=>jr(e,"name",{value:r,configurable:!0}),"o");const Rr=Ar(e=>(Array.isArray(e)?e:[e]).length===0?"":`
|
|
5
|
+
${e.map(r=>r.optionList?new Ir(r).toString():new Wr(r).toString()).join(`
|
|
6
|
+
`)}`,"commandLineUsage");export{c as f,Rr as p};
|
package/dist/packem_shared/{plugin-manager.d-CuIdny8w.d.ts → plugin-manager.d-BSQtHbWS.d.ts}
RENAMED
|
@@ -38,6 +38,9 @@ interface OptionDefinition$1 {
|
|
|
38
38
|
*/
|
|
39
39
|
type?: (input: string) => any;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Error thrown when an option is already set (duplicate assignment).
|
|
43
|
+
*/
|
|
41
44
|
/** A Content section comprises a header and one or more lines of content. */
|
|
42
45
|
interface Content {
|
|
43
46
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { O as Options$1 } from "../packem_shared/index.d-Br8HpP0A.js";
|
|
2
|
-
import { P as Plugin } from "../packem_shared/plugin-manager.d-
|
|
2
|
+
import { P as Plugin } from "../packem_shared/plugin-manager.d-BSQtHbWS.js";
|
|
3
3
|
import '@visulima/tabular';
|
|
4
4
|
type ErrorHandlerOptions = {
|
|
5
5
|
/** Show detailed error information including stack traces and code frames (default: false) */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/cerebro",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.30",
|
|
4
4
|
"description": "A delightful toolkit for building cross-runtime CLIs for Node.js, Deno, and Bun.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ansi",
|
|
@@ -109,16 +109,15 @@
|
|
|
109
109
|
"LICENSE.md"
|
|
110
110
|
],
|
|
111
111
|
"dependencies": {
|
|
112
|
-
"@visulima/colorize": "2.0.0-alpha.
|
|
113
|
-
"@visulima/tabular": "4.0.0-alpha.
|
|
114
|
-
"fastest-levenshtein": "^1.0.16"
|
|
115
|
-
"terminal-size": "^4.0.1"
|
|
112
|
+
"@visulima/colorize": "2.0.0-alpha.13",
|
|
113
|
+
"@visulima/tabular": "4.0.0-alpha.13",
|
|
114
|
+
"fastest-levenshtein": "^1.0.16"
|
|
116
115
|
},
|
|
117
116
|
"peerDependencies": {
|
|
118
117
|
"@bomb.sh/tab": "0.0.15",
|
|
119
|
-
"@visulima/boxen": "3.0.0-alpha.
|
|
120
|
-
"@visulima/find-cache-dir": "3.0.0-alpha.
|
|
121
|
-
"@visulima/pail": "4.0.0-alpha.
|
|
118
|
+
"@visulima/boxen": "3.0.0-alpha.12",
|
|
119
|
+
"@visulima/find-cache-dir": "3.0.0-alpha.11",
|
|
120
|
+
"@visulima/pail": "4.0.0-alpha.20",
|
|
122
121
|
"github-slugger": "2.0.0"
|
|
123
122
|
},
|
|
124
123
|
"peerDependenciesMeta": {
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var Rt=Object.defineProperty;var O=(t,e)=>Rt(t,"name",{value:e,configurable:!0});import{createRequire as zt}from"node:module";import{VERBOSITY_DEBUG as K,POSITIONALS_KEY as re,VERBOSITY_QUIET as Jt,VERBOSITY_VERBOSE as Qt,VERBOSITY_NORMAL as je}from"./VERBOSITY_QUIET-XPultrIA.js";import{c as A}from"./cerebro-error-BnJTixb2.js";import{d as R,h as ke,e as Y,o as Ie,b as Xt,c as Zt,a as en,i as tn,f as nn}from"./runtime-process-DKHFvYkv.js";import{distance as an}from"fastest-levenshtein";import{s as on,L as rn,M as ee,E as te,P as G,N as L,C as ye,D as Ue,W as sn,U as Me,Q as ln,_ as Ve,J as Te,T as Se,z as cn,K as un,q as pn,I as fn,V as dn,u as hn,r as mn,Y as gn,p as vn,n as yn,Z as wn,i as bn,a as $n,A as On,X as Pn,e as An,t as De}from"./constants-DmzZF6_u-BmMwILI_.js";const Wt=zt(import.meta.url),X=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,it=O(t=>{if(typeof X<"u"&&X.versions&&X.versions.node){const[e,n]=X.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return X.getBuiltinModule(t)}return Wt(t)},"__cjs_getBuiltinModule"),{writeFile:Ft,stat:qt,rm:Gt,readFile:Le,readdir:Ht,mkdir:Kt,access:Yt}=it("node:fs/promises"),{createRequire:Cn}=it("node:module"),ae=[{description:"Turn on verbose output",group:"global",name:"verbose",type:Boolean},{description:"Turn on debugging output",group:"global",name:"debug",type:Boolean},{alias:"h",description:"Print out helpful usage information",group:"global",name:"help",type:Boolean},{alias:"q",description:"Silence output",group:"global",name:"quiet",type:Boolean},{alias:"V",description:"Print version info",group:"global",name:"version",type:Boolean},{description:"Turn off colored output",group:"global",name:"no-color",type:Boolean},{description:"Force colored output",group:"global",name:"color",type:Boolean}];var Nn=Object.defineProperty,kn=O((t,e)=>Nn(t,"name",{value:e,configurable:!0}),"t$9");let S=class extends A{static{O(this,"a")}static{kn(this,"CommandNotFoundError")}commandName;constructor(e,n=[]){const a=`Command "${e}" not found${n.length>0?`. Did you mean: ${n.join(", ")}?`:""}`;super(a,"COMMAND_NOT_FOUND",{commandName:e,suggestions:n}),this.name="CommandNotFoundError",this.commandName=e,n.length>0&&(this.hint=`Try one of these commands: ${n.join(", ")}`)}};var _n=Object.defineProperty,En=O((t,e)=>_n(t,"name",{value:e,configurable:!0}),"e$7");let at=class extends A{static{O(this,"o")}static{En(this,"ConflictingOptionsError")}option1;option2;constructor(e,n){super(`Options "${e}" and "${n}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:e,option2:n}),this.name="ConflictingOptionsError",this.option1=e,this.option2=n,this.hint=`Remove either --${e} or --${n}`}};var xn=Object.defineProperty,Ln=O((t,e)=>xn(t,"name",{value:e,configurable:!0}),"e$6");let jn=class extends A{static{O(this,"o")}static{Ln(this,"PluginError")}pluginName;constructor(e,n,a){super(`Plugin "${e}" error: ${n}`,"PLUGIN_ERROR",{originalError:a,pluginName:e}),this.name="PluginError",this.pluginName=e,a&&(this.cause=a)}};var In=Object.defineProperty,Be=O((t,e)=>In(t,"name",{value:e,configurable:!0}),"d$7");let Un=class{static{O(this,"p")}static{Be(this,"PluginManager")}logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(e){this.logger=e}hasPlugins(){return this.plugins.size>0}register(e){if(this.initialized)throw new Error(`Cannot register plugin "${e.name}" after initialization`);if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);R().CEREBRO_OUTPUT_LEVEL===String(K)&&this.logger.debug(`registering plugin: ${e.name}`),this.plugins.set(e.name,e),this.cachedDependencyOrder=void 0}async init(e){if(this.initialized)throw new Error("PluginManager already initialized");if(this.plugins.size===0){this.logger.debug("no plugins registered, skipping initialization"),this.initialized=!0;return}this.validateDependencies();const n=this.getDependencyOrder();this.logger.debug(`initializing ${String(n.length)} plugin(s)...`);for(const a of n)if(typeof a.init=="function"){this.logger.debug(`initializing plugin: ${a.name}`);try{await a.init(e)}catch(r){const i=new jn(a.name,`Failed to initialize: ${r instanceof Error?r.message:String(r)}`,r instanceof Error?r:void 0);throw this.logger.error(i.message),i}}this.initialized=!0}async executeLifecycle(e,n,a){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const r=this.getDependencyOrder();for(const i of r){const u=i[e];if(typeof u=="function"){this.logger.debug(`executing ${e} hook for plugin: ${i.name}`);try{await(e==="afterCommand"?u(n,a):u(n))}catch(s){throw this.logger.error(`Error in ${e} hook for plugin "${i.name}":`,s),s}}}}async executeErrorHandlers(e,n){if(!this.initialized||this.plugins.size===0)return;const a=this.getDependencyOrder();for(const r of a)if(typeof r.onError=="function"){this.logger.debug(`executing error handler for plugin: ${r.name}`);try{await r.onError(e,n)}catch(i){this.logger.error(`Error in error handler for plugin "${r.name}":`,i)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const e=[],n=new Set,a=new Set,r=Be(i=>{if(n.has(i))return;if(a.has(i))throw new Error(`Circular dependency detected involving plugin "${i}"`);const u=this.plugins.get(i);if(!u)throw new Error(`Plugin "${i}" not found`);if(a.add(i),u.dependencies)for(const s of u.dependencies)r(s);a.delete(i),n.add(i),e.push(u)},"visit");for(const i of this.plugins.keys())r(i);return this.cachedDependencyOrder=e,e}validateDependencies(){for(const e of this.plugins.values())if(e.dependencies){for(const n of e.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin "${e.name}" depends on "${n}" which is not registered`)}}};var Mn=Object.defineProperty,Vn=O((t,e)=>Mn(t,"name",{value:e,configurable:!0}),"n$a");const ne=Vn(t=>t.type?.name==="Boolean","optionIsBoolean");var Tn=Object.defineProperty,ot=O((t,e)=>Tn(t,"name",{value:e,configurable:!0}),"p$9");const Sn=ot(t=>{let e=t.type?t.type.name.toLowerCase():"string";const n=t.multiple??t.lazyMultiple?"[]":"";return e&&(e=e==="boolean"?"":`{underline ${e}${n}}`),e},"getTypeLabel"),Re=ot(t=>(ne(t)||(t.typeLabel=t.typeLabel??Sn(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),"mapOptionTypeLabel");var Dn=Object.defineProperty,rt=O((t,e)=>Dn(t,"name",{value:e,configurable:!0}),"e$4");const Bn=new RegExp(/^-([^\d-])$/),Rn=new RegExp(/^--(\S+)/),zn=new RegExp(/^-([^\d-]{2,})$/),Wn=rt(t=>Bn.test(t)||Rn.test(t)||zn.test(t),"isOption"),Fn=rt((t,e)=>{const n=e[0]&&Wn(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const a=new Error(`Command not recognised: ${String(n)}`);throw a.command=n,a.name="INVALID_COMMAND",a}return{argv:e,command:n}},"commandLineCommands");var qn=Object.defineProperty,st=O((t,e)=>qn(t,"name",{value:e,configurable:!0}),"i$b"),Gn=Object.defineProperty,lt=st((t,e)=>Gn(t,"name",{value:e,configurable:!0}),"i"),Hn=Object.defineProperty,ct=lt((t,e)=>Hn(t,"name",{value:e,configurable:!0}),"s"),Kn=Object.defineProperty,ut=ct((t,e)=>Kn(t,"name",{value:e,configurable:!0}),"i"),Yn=Object.defineProperty,pt=ut((t,e)=>Yn(t,"name",{value:e,configurable:!0}),"t");pt(t=>t instanceof Error&&t.type==="VisulimaError","isVisulimaError");let ce=class extends Error{static{O(this,"v")}static{st(this,"g")}static{lt(this,"p")}static{ct(this,"V")}static{ut(this,"VisulimaError")}static{pt(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:a,message:r,name:i,stack:u,title:s}){super(r,{cause:e}),this.title=s,this.name=i,this.stack=u??this.stack,this.loc=a,this.hint=n}setLocation(e){this.loc=e}setName(e){this.name=e}setMessage(e){this.message=e}setHint(e){this.hint=e}};var Jn=Object.defineProperty,ft=O((t,e)=>Jn(t,"name",{value:e,configurable:!0}),"o$b"),Qn=Object.defineProperty,dt=ft((t,e)=>Qn(t,"name",{value:e,configurable:!0}),"o"),Xn=Object.defineProperty,Zn=dt((t,e)=>Xn(t,"name",{value:e,configurable:!0}),"i");let ei=class ht extends ce{static{O(this,"a")}static{ft(this,"a")}static{dt(this,"t")}static{Zn(this,"AlreadySetError")}optionName;constructor(e){super({cause:void 0,hint:`Remove the duplicate option '${e}' from your command line arguments.`,location:void 0,message:`Option '${e}' is already set`,name:"ALREADY_SET",stack:void 0,title:"Option Already Set"}),this.optionName=e,Object.setPrototypeOf(this,ht.prototype)}};var ti=Object.defineProperty,mt=O((t,e)=>ti(t,"name",{value:e,configurable:!0}),"t$7"),ni=Object.defineProperty,gt=mt((t,e)=>ni(t,"name",{value:e,configurable:!0}),"e"),ii=Object.defineProperty,ai=gt((t,e)=>ii(t,"name",{value:e,configurable:!0}),"e");let ze=class vt extends ce{static{O(this,"n")}static{mt(this,"n")}static{gt(this,"o")}static{ai(this,"UnknownOptionError")}optionName;constructor(e){super({cause:void 0,hint:`Check your option definitions or remove the unknown option '${e}' from your command line arguments.`,location:void 0,message:`Unknown option: --${e}`,name:"UNKNOWN_OPTION",stack:void 0,title:"Unknown Option"}),this.optionName=`--${e}`,Object.setPrototypeOf(this,vt.prototype)}};var oi=Object.defineProperty,yt=O((t,e)=>oi(t,"name",{value:e,configurable:!0}),"a$9"),ri=Object.defineProperty,wt=yt((t,e)=>ri(t,"name",{value:e,configurable:!0}),"a"),si=Object.defineProperty,li=wt((t,e)=>si(t,"name",{value:e,configurable:!0}),"o");let ci=class bt extends ce{static{O(this,"n")}static{yt(this,"o")}static{wt(this,"e")}static{li(this,"UnknownValueError")}value;constructor(e){super({hint:"Use a defined option or add a defaultOption to capture this value.",message:`Unknown value: ${e}`,name:"UNKNOWN_VALUE",title:"Unknown Value"}),this.value=e,Object.setPrototypeOf(this,bt.prototype)}};var ui=Object.defineProperty,$t=O((t,e)=>ui(t,"name",{value:e,configurable:!0}),"i$8"),pi=Object.defineProperty,Ot=$t((t,e)=>pi(t,"name",{value:e,configurable:!0}),"i"),fi=Object.defineProperty,di=Ot((t,e)=>fi(t,"name",{value:e,configurable:!0}),"i");let j=class Pt extends ce{static{O(this,"a")}static{$t(this,"o")}static{Ot(this,"e")}static{di(this,"InvalidDefinitionsError")}constructor(e,n){super({cause:void 0,hint:n,location:void 0,message:e,name:"INVALID_DEFINITIONS",stack:void 0,title:"Invalid Option Definition"}),Object.setPrototypeOf(this,Pt.prototype)}};var hi=Object.defineProperty,mi=O((t,e)=>hi(t,"name",{value:e,configurable:!0}),"z"),gi=Object.defineProperty,J=mi((t,e)=>gi(t,"name",{value:e,configurable:!0}),"S"),vi=Object.defineProperty,ue=J((t,e)=>vi(t,"name",{value:e,configurable:!0}),"o");const We=ue(t=>t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean"),"isBooleanType"),Fe=ue(t=>t===Number||typeof t=="function"&&t.name==="Number","isNumberType"),qe=ue(t=>t===String||typeof t=="function"&&t.name==="String","isStringType"),yi=ue((t,e)=>Array.isArray(t)?We(e)?t.map(Boolean):Fe(e)?t.map(Number):qe(e)?t.map(String):t.map(n=>e(String(n))):t===null?null:We(e)?!!t:Fe(e)?Number(t):qe(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t)),"convertValue");var wi=Object.defineProperty,bi=J((t,e)=>wi(t,"name",{value:e,configurable:!0}),"e");const x=bi((t,e,n,...a)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...a)},"debug");var $i=Object.defineProperty,F=J((t,e)=>$i(t,"name",{value:e,configurable:!0}),"h$1");const Oi=/-([a-z])/g,Pi=/^\d+$/,we=F(t=>t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean"),"isBooleanType"),Ai=F(t=>t.codePointAt(0)===95,"isSpecialKey"),Ge=F((t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],"appendToArrayMultiple"),He=F(t=>t==="__proto__"||t==="constructor"||t==="prototype","isUnsafeKey"),Ke=F((t,e,n,a=!1)=>{t[e]===void 0?t[e]=a?[n]:n:a&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},"createOrAppendArray"),Ci=F((t,e,n,a,r)=>{let i=e.get(t)??n.get(t);if(!i&&a){const u=t.toLowerCase();i=a.get(u)??r?.get(u)}return i},"getDefinition"),Ni=F((t,e,n,a)=>{const r=n.debug??!1;x(r,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),x(r,"Starting argument resolution","resolver"),x(r,"Tokens:","resolver",t),x(r,"Definitions:","resolver",e),x(r,"Processing tokens...","resolver");const i=new Map,u=new Map,s=n.caseInsensitive?new Map:void 0,m=n.caseInsensitive?new Map:void 0,o=n.camelCase?new Map:void 0,c=n.camelCase?new Map:void 0;for(const f of e)if(i.set(f.name,f),f.alias&&u.set(f.alias,f),n.caseInsensitive&&s&&(s.set(f.name.toLowerCase(),f),f.alias&&m&&m.set(f.alias.toLowerCase(),f)),n.camelCase&&o&&c){const h=f.name.replaceAll(Oi,(v,y)=>y.toUpperCase());o.set(f.name,h),c.set(h,f.name)}const d={},l={},g=[],p=new Set;let b=!1;const $=e.find(f=>f.defaultOption),w=e.some(f=>f.group),C=e.some(f=>f.type===Number);for(let f=0;f<t.length;f++){const h=t[f];if(h.kind==="option-terminator"){d._unknown=a.slice(h.index),b=!0;break}if(h.kind==="option"&&h.name){let v=Ci(h.name,i,u,s,m);if(!v&&h.value===void 0&&C&&Pi.test(h.name)){const N=e.find(M=>M.type===Number);N&&(v=N,h.value=h.name,h.name=N.name)}const y=v?v.name:h.name,P=v?.multiple,E=v?.lazyMultiple;if(l[y]!==void 0&&!P&&!E&&!n.partial)throw new ei(y);if(!v&&n.partial){const N=h.rawName??`--${h.name}${h.value!==void 0&&h.inlineValue?`=${h.value}`:""}`;g.push({index:h.index,value:N});continue}if(!v&&n.stopAtFirstUnknown){d._unknown=a.slice(h.index);break}if(!v&&!n.partial)throw new ze(h.name);if(h.value===void 0){const N=t[f+1],M=N?.kind==="option"&&!("name"in N)&&N.value!==void 0,I=N&&v&&!(v.type&&we(v.type))&&(N.kind==="positional"||M),Bt=v&&v.defaultOption&&!v.multiple&&!v.lazyMultiple;if(I&&(!v?.defaultOption||Bt))if(P){let V=f+1;const ve=[];for(;V<t.length&&(t[V].kind==="positional"||t[V].kind==="option"&&!("name"in t[V])&&t[V].value!==void 0);)ve.push(t[V].value),p.add(t[V].index),V++;l[y]=l[y]===void 0?ve:Ge(l[y],ve),f=V-1}else E?(Ke(l,y,N.value,!0),p.add(N.index),f++):(l[y]=N.value,p.add(N.index),f++);else v?.type&&we(v.type)?Ke(l,y,!0,P):l[y]=P?[]:null}else{let{value:N}=h;if(v?.type&&we(v.type))switch(N){case"":{if(n.partial)l._unknown??=[],l._unknown.push(`${h.rawName??`--${h.name}`}${h.value?`=${h.value}`:""}`),N=!0;else throw new ze(h.name);break}case"false":{N=!1;break}case"true":{N=!0;break}default:N=!0}const M=[N];if(P){let I=f+1;for(;I<t.length&&t[I].kind==="positional";)M.push(t[I].value),p.add(t[I].index),I++;f=I-1}l[y]===void 0?l[y]=P||E?M:N:P||E?l[y]=Ge(l[y],M):l[y]=N}}else if(h.kind==="positional"&&n.stopAtFirstUnknown&&!p.has(h.index)&&!$){x(r,`Found unconsumed positional token at index ${String(h.index)}, stopping processing`,"resolver"),d._unknown=a.slice(h.index);break}}for(const[f,h]of Object.entries(l)){const v=i.get(f);v&&(v.multiple||v.lazyMultiple)&&!Array.isArray(h)&&(l[f]=[h])}let k=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!b){for(const f of t)if(f.kind==="option"&&!i.has(f.name??"")&&!u.has(f.name??"")&&(!n.caseInsensitive||!s?.has(f.name?.toLowerCase()??"")&&!m?.has(f.name?.toLowerCase()??""))){k=f.index;break}}if($){const f=[],h=[];for(const v of t)v.kind==="positional"&&!p.has(v.index)&&v.index<k&&(f.push(v.value),h.push(v));if(f.length>0){const v=l[$.name],y=$.multiple??$.lazyMultiple;v===void 0?y?(h.forEach(P=>p.add(P.index)),l[$.name]=f):(p.add(h[0].index),l[$.name]=f[0]):y&&(h.forEach(P=>p.add(P.index)),l[$.name]=Array.isArray(v)?[...f,...v]:[...f,v])}}if(!n.partial){for(const f of t)if(f.kind==="positional"&&!p.has(f.index))throw new ci(a[f.index])}if(n.partial&&!n.stopAtFirstUnknown){const f=[...g];if(l._unknown){const h=new Map;for(const[v,y]of a.entries())h.set(y,v);for(const v of l._unknown){const y=h.get(v);y!==void 0&&f.push({index:y,value:v})}}for(const h of t)h.kind==="positional"&&!p.has(h.index)&&f.push({index:h.index,value:a[h.index]});f.length>0&&(f.sort((h,v)=>h.index-v.index),d._unknown=f.map(h=>h.value))}if(n.stopAtFirstUnknown&&!b){const f=t.findIndex(y=>y.kind==="option"&&!i.has(y.name??"")&&!u.has(y.name??"")&&(!n.caseInsensitive||!s?.has(y.name?.toLowerCase()??"")&&!m?.has(y.name?.toLowerCase()??""))),h=t.findIndex(y=>y.kind==="positional"&&!p.has(y.index));let v=-1;if(f!==-1&&h!==-1?v=Math.min(f,h):f!==-1?v=f:h!==-1&&(v=h),v>=0){const y=t[v].index;d._unknown=a.slice(y)}}else g.length>0&&!n.partial&&(d._unknown=g.map(f=>f.value));for(const[f,h]of Object.entries(l)){const v=n.camelCase?o?.get(f)??f:f,y=i.get(f);d[v]=y?.type?yi(h,y.type):h===void 0?null:h}for(const f of e){const h=n.camelCase?o?.get(f.name)??f.name:f.name;!(h in d)&&f.defaultValue!==void 0&&(f.multiple??f.lazyMultiple?d[h]=Array.isArray(f.defaultValue)?[...f.defaultValue]:[f.defaultValue]:d[h]=f.defaultValue)}if(w){const f={},h={},v={};for(const P of e)if(P.group){const E=Array.isArray(P.group)?P.group:[P.group];for(const N of E)He(N)||(f[N]??={})}for(const P of Object.keys(d))if(!Ai(P)){h[P]=d[P];let E=P;n.camelCase&&(E=c?.get(P)??P);const N=i.get(E);if(N?.group){const M=Array.isArray(N.group)?N.group:[N.group];for(const I of M)He(I)||f[I]&&(f[I][P]=d[P])}else v[P]=d[P]}const y={_all:h};for(const[P,E]of Object.entries(f))y[P]=E;Object.keys(v).length>0&&(y._none=v),d._unknown&&(y._unknown=d._unknown),Object.keys(d).forEach(P=>delete d[P]),Object.assign(d,y)}return x(r,"Final parsed result:","resolver",d),d},"resolveArgs");var ki=Object.defineProperty,q=J((t,e)=>ki(t,"name",{value:e,configurable:!0}),"l");const W="-".codePointAt(0),z="=",_i=z.codePointAt(0),Ei="--",xi="-",Li="--",At=q(t=>t.length>2&&t.startsWith(Li),"hasLongOptionPrefix"),ji=q(t=>At(t)&&!t.includes(z,3),"isLongOption"),Ii=q(t=>At(t)&&t.includes(z,3),"isLongOptionAndValue"),Ui=q(t=>t!==void 0&&t.length>0&&t.codePointAt(0)!==W,"hasOptionValue"),Mi=q(t=>{if(t.length!==2||t.codePointAt(0)!==W||t.codePointAt(1)===W)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},"isShortOption"),Vi=q(t=>!(t.length<=2||t.codePointAt(0)!==W||t.codePointAt(1)===W),"isShortOptionGroup"),Ti=q(t=>{const e=[],n=[...t];let a=-1,r=0;for(;n.length>0;){const i=n.shift();if(i===void 0)break;const u=n[0];if(r>0?r--:a++,i===Ei){e.push({index:a,kind:"option-terminator"});const s=n.map((m,o)=>({index:a+o+1,kind:"positional",value:m}));e.push(...s),a+=n.length;break}if(Mi(i)){const s=i.charAt(1);let m;r?(e.push({index:a,kind:"option",name:s,rawName:i,value:m}),r===1&&Ui(u)&&(m=n.shift(),e.push({index:a,kind:"option",value:m}))):e.push({index:a,kind:"option",name:s,rawName:i,value:m}),m!==void 0&&++a;continue}if(Vi(i)&&!i.includes(z)){const s=[];let m="",o=!1;for(let c=1;c<i.length;c++){const d=i.charAt(c);o?m+=d:d.codePointAt(0)===_i?o=!0:s.push(`${xi}${d}`)}if(o)if(s.length>0){const c=s.pop();s.push(`${c}=${m}`)}else s.push(m);n.unshift(...s),r=s.length;continue}if(ji(i)){const s=i.slice(2);e.push({index:a,kind:"option",name:s,rawName:i});continue}if(Ii(i)){const s=i.indexOf(z),m=i.slice(2,s),o=i.slice(s+1);e.push({index:a,inlineValue:!0,kind:"option",name:m,rawName:i,value:o});continue}if(i.length>2&&i.codePointAt(0)===W&&i.codePointAt(1)!==W&&i.includes(z)){const s=i.indexOf(z),m=i.charAt(1),o=i.slice(s+1);e.push({index:a,inlineValue:!0,kind:"option",name:m,rawName:i,value:o});continue}e.push({index:a,kind:"positional",value:i})}return e},"parseArgsTokens");var Si=Object.defineProperty,Ee=J((t,e)=>Si(t,"name",{value:e,configurable:!0}),"d");const Di=/\d/,Bi=Ee(t=>t!=null&&(t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean")),"isBooleanType"),Ri=Ee(t=>typeof t=="function","isValidCustomTypeFunction"),zi=Ee((t,e,n)=>{const a=n?.debug??!1;x(a,"Validating definitions:","validation",t,"caseInsensitive:",e);const r=new Set,i=new Set,u=new Set,s=new Set;let m=0;for(const o of t){if(x(a,"Checking definition:","validation",o),!o.name)throw x(a,"Validation failed: name is required","validation"),new j("Invalid option definition: name is required");if(typeof o.name!="string")throw new j("Invalid option definition: name must be a string");if(o.name.trim()==="")throw new j("Invalid option definition: name cannot be empty");const c=e?o.name.toLowerCase():"";if(r.has(o.name)||e&&u.has(c))throw new j(`Invalid option definition: duplicate name '${o.name}'`);if(i.has(o.name)||e&&s.has(c))throw new j(`Invalid option definition: name '${o.name}' conflicts with an existing alias`);if(r.add(o.name),e&&u.add(c),o.alias!==void 0){if(typeof o.alias!="string")throw new j("Invalid option definition: alias must be a string");if(o.alias.length!==1)throw new j("Invalid option definition: alias must be a single character");if(Di.test(o.alias))throw new j("Invalid option definition: alias cannot be numeric");if(o.alias==="-")throw new j('Invalid option definition: alias cannot be "-"');const d=e?o.alias.toLowerCase():"";if(i.has(o.alias)||e&&s.has(d))throw new j(`Invalid option definition: duplicate alias '${o.alias}'`);if(r.has(o.alias)||e&&u.has(d))throw new j(`Invalid option definition: alias '${o.alias}' conflicts with an existing option name`);i.add(o.alias),e&&s.add(d)}if(o.defaultOption&&(m++,o.type!==void 0&&Bi(o.type)))throw new j("Invalid option definition: defaultOption cannot be Boolean type");if(o.type!==void 0&&!(o.type===Boolean||o.type===Number||o.type===String||typeof o.type=="function"&&Ri(o.type)))throw new j("Invalid option definition: invalid type")}if(m>1)throw x(a,"Validation failed: multiple defaultOptions not allowed","validation"),new j("Invalid option definition: multiple defaultOptions not allowed");x(a,"Validation completed successfully","validation")},"validateDefinitions");var Wi=Object.defineProperty,Fi=J((t,e)=>Wi(t,"name",{value:e,configurable:!0}),"O");const qi=Fi((t,e={})=>{const n=e.debug??!1;x(n,"Starting command-line-args parsing","index"),x(n,"Options:","index",e);const a={...e};a.stopAtFirstUnknown&&(a.partial=!0);const r=Array.isArray(t)?t:[t];x(n,"Normalized definitions:","index",r),zi(r,a.caseInsensitive,n?a:void 0);let{argv:i}=a;if(!i&&(i=process.argv.slice(2),process.execArgv.length>0)){const o=new Set(process.execArgv);i=i.filter(c=>!o.has(c))}x(n,"Using argv:","index",i);let u=i;a.caseInsensitive&&(u=i.map(o=>{if(o.startsWith("--")){const c=o.indexOf("="),d=(c===-1?o.slice(2):o.slice(2,c)).toLowerCase();return c===-1?`--${d}`:`--${d}${o.slice(c)}`}if(o.startsWith("-")&&!o.startsWith("--")&&o.length>1){const c=o.slice(1).split("=",2),d=c[0],l=c[1];if(!d)return o;const g=d.toLowerCase();return l===void 0?`-${g}`:`-${g}=${l}`}return o}));const s=Ti(u.map(String));x(n,"Tokenized arguments:","index",s);const m=Ni(s,r,a,i);return x(n,"Command-line-args parsing completed","index"),m},"commandLineArgs");var Gi=Object.defineProperty,Hi=O((t,e)=>Gi(t,"name",{value:e,configurable:!0}),"b$2");let Ki=class{static{O(this,"m")}static{Hi(this,"EmptyToolbox")}result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}};var Yi=Object.defineProperty,Ji=O((t,e)=>Yi(t,"name",{value:e,configurable:!0}),"n$6");let be=class extends A{static{O(this,"i")}static{Ji(this,"CommandLoaderError")}commandName;constructor(e,n,a){super(`Failed to load command "${e}": ${n}`,"COMMAND_LOADER_ERROR",{commandName:e,reason:n}),this.name="CommandLoaderError",this.commandName=e,this.hint="Ensure the loader resolves to a module with a default export that is the command handler function.",a!==void 0&&(this.cause=a)}};var Qi=Object.defineProperty,Xi=O((t,e)=>Qi(t,"name",{value:e,configurable:!0}),"f$5");const Zi=/^-{1,2}(\w+)(=(.+))?$/,Ct=Xi((t,e,n,a)=>{const r=Zi.exec(t);if(r===null)return{};const i=r[1];if(!i)return{};const u=n&&a?n.get(i)??a.get(i):e.find(s=>s.name===i||s.alias===i);return u!==void 0?{argName:u.name,argValue:r[3],option:u}:{}},"getParameterOption");var ea=Object.defineProperty,_e=O((t,e)=>ea(t,"name",{value:e,configurable:!0}),"e$3");const Ye=_e((t,e)=>{if(e.type===void 0)return t;if(e.type.name==="Boolean"){if(t==="true"||t==="1")return e.type(!0);if(t==="false"||t==="0")return e.type(!1)}return e.type(t)},"convertType"),ta=new Set(["0","1","false","true"]),na=_e((t,e,n,a)=>{if(e.length===0||t.length===0)return{};const r=_e((i,u)=>{const{argName:s,argValue:m,option:o}=Ct(u,e,n,a),{lastOption:c}=i;return o&&ne(o)&&m&&s?i.partial[s]=Ye(m,o):i.lastName&&c&&ne(c)&&ta.has(u)&&(i.partial[i.lastName]=Ye(u,c)),{lastName:s,lastOption:o,partial:i.partial}},"getBooleanValue");return t.reduce(r,{partial:{}}).partial},"getBooleanValues");var ia=Object.defineProperty,Je=O((t,e)=>ia(t,"name",{value:e,configurable:!0}),"s$8");const aa=new Set(["0","1","false","true"]),oa=Je((t,e,n,a)=>{if(e.length===0||t.length===0)return t;const r=Je((i,u)=>{const{argValue:s,option:m}=Ct(u,e,n,a),{lastOption:o}=i;if(o&&ne(o)&&aa.has(u)){const{args:c}=i;return{args:c.slice(0,-1)}}return m&&ne(m)&&s?{args:i.args}:{args:[...i.args,u],lastOption:m}},"removeBooleanArguments");return t.reduce(r,{args:[]}).args},"removeBooleanValues");var ra=Object.defineProperty,sa=O((t,e)=>ra(t,"name",{value:e,configurable:!0}),"o$8");const Qe=sa(t=>{const e=new Map;for(const n of t){const a=e.get(n.name);a?e.set(n.name,{...a,...n}):e.set(n.name,n)}return[...e.values()]},"mergeArguments");var la=Object.defineProperty,pe=O((t,e)=>la(t,"name",{value:e,configurable:!0}),"o$7");const ca=pe(t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},"transformBooleanEnv"),ua=pe((t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return ca(e);if(t.type===Number||typeof t.type=="function"&&t.type.name==="Number"){const n=Number.parseFloat(e);return Number.isNaN(n)?void 0:n}return t.type===String||typeof t.type=="function"&&t.type.name==="String"?e:t.type(e)}},"transformEnvValue"),pa=/_./g,fa=/^[A-Z]/,da=pe(t=>t.toLowerCase().replaceAll(pa,e=>e[1]?.toUpperCase()??e).replace(fa,e=>e.toLowerCase()),"toCamelCase"),ha=pe(t=>{if(!t||t.length===0)return{};const e={},n=R();for(const a of t){const r=n[a.name],i=ua(a,r),u=i===void 0?a.defaultValue:i,s=da(a.name);e[s]=u}return e},"processEnvVariables");var ma=Object.defineProperty,ie=O((t,e)=>ma(t,"name",{value:e,configurable:!0}),"a$5");const ga=ie(t=>{const e=new Map,n=new Map;for(const a of t)if(e.set(a.name,a),a.alias){const r=Array.isArray(a.alias)?a.alias:[a.alias];for(const i of r)n.set(i,a)}return{optionMapByAlias:n,optionMapByName:e}},"buildOptionMaps"),Nt=ie(async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new be(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(a){throw new be(t.name,a instanceof Error?a.message:String(a),a)}const n=e.default;if(typeof n!="function")throw new be(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},"loadLazyHandler"),va=ie((t,e,n,a)=>{const r=new Ki(t.name,t),{_all:i,_unknown:u,positionals:s}=e,m=Object.keys(n).length>0?{...i,...n}:i;re in m&&delete m[re],r.argument=s?.[re]??[],r.rawUnknown=[...u??[]];const o=Object.keys(a).length>0;return r.options=o?{...m,...a}:m,r.env=ha(t.env),r},"prepareToolbox"),ya=ie((t,e,n)=>{const a=t.options??[],r=a.length>0;let i=Qe(r?[...a,...n]:n);if(i.length>0){for(const o of i)if(o.multiple&&o.lazyMultiple)throw new Error(`Argument "${o.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(i=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:re,type:t.argument.type,typeLabel:t.argument.typeLabel},...i]);let u,s;if(r){const{optionMapByAlias:o,optionMapByName:c}=ga(a);u=oa(e,a,c,o),s=na(e,a,c,o)}else u=e,s={};const m=qi(i,{argv:u,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:i,booleanValues:s,parsedArgs:m}},"processCommandArgs"),H=ie(async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await Nt(t))(e),"executeCommand");var wa=Object.defineProperty,ba=O((t,e)=>wa(t,"name",{value:e,configurable:!0}),"n$5");let $a=class extends A{static{O(this,"s")}static{ba(this,"CommandValidationError")}commandName;missingOptions;constructor(e,n){super(`Command "${e}" is missing required options: ${n.join(", ")}`,"COMMAND_VALIDATION_ERROR",{commandName:e,missingOptions:n}),this.name="CommandValidationError",this.commandName=e,this.missingOptions=n,this.hint=`Provide the following required options: ${n.join(", ")}`}};var Oa=Object.defineProperty,Pa=O((t,e)=>Oa(t,"name",{value:e,configurable:!0}),"t$5");const Xe=Pa((t,e,n=!1)=>{const a=[];for(const r of t)if(!(!n&&!r.required)&&e[r.name]===void 0){if(r.type?.name==="Boolean"){e[r.name]=!1;continue}a.push(r)}return a},"listMissingArguments");var Aa=Object.defineProperty,kt=O((t,e)=>Aa(t,"name",{value:e,configurable:!0}),"n$4");const Ca=kt((t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:an(t,e)<=t.length/3,"isSimilar"),B=kt((t,e)=>{const n=t.toLowerCase();return e.filter(a=>Ca(a.toLowerCase(),n))},"findAlternatives");var Na=Object.defineProperty,fe=O((t,e)=>Na(t,"name",{value:e,configurable:!0}),"a$4");const ka=fe((t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(a=>{const r=a.startsWith("--");let i=`Found unknown ${r?"option":"argument"} "${a}"`;if(r){const u=B(a.replace("--",""),(e.options??[]).map(s=>s.name));if(u.length>0){const[s,...m]=u.map(o=>`--${o}`);i+=m.length>0?`, did you mean ${s??""} or ${m.join(", ")}?`:`, did you mean ${s??""}?`}}n.push(i)}),n.length>0)throw new Error(n.join(`
|
|
2
|
-
`))},"validateUnknownOptions"),_a=fe((t,e,n)=>{const a=n.__requiredOptions__,r=a?Xe(a,e,!0):Xe(t,e,!1);if(r.length>0)throw new $a(n.name,r.map(i=>i.name));e._unknown&&e._unknown.length>0&&!n.argument&&ka(e,n)},"validateRequiredOptions"),Ea=fe((t,e,n)=>{const a=n.__conflictingOptions__??t.filter(r=>r.conflicts!==void 0);if(a.length>0){const r=a.find(i=>Array.isArray(i.conflicts)?i.conflicts.some(u=>e[u]!==void 0)&&e[i.name]!==void 0:e[i.conflicts]!==void 0&&e[i.name]!==void 0);if(r)throw new at(r.name,typeof r.conflicts=="string"?r.conflicts:r.conflicts?.[0]??"unknown")}},"validateConflictingOptions"),xa=fe(t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const r of t.options){if(r.name){const i=e.get(r.name)??[];i.push(r),e.set(r.name,i)}if(typeof r.alias=="string"&&r.alias.length>0){const i=n.get(r.alias)??[];i.push(r),n.set(r.alias,i)}else if(Array.isArray(r.alias)){for(const i of r.alias)if(i.length>0){const u=n.get(i)??[];u.push(r),n.set(i,u)}}}const a=[];for(const[r,i]of e)i.length>1&&a.push(`Duplicate option name "${r}" in command "${t.name}": ${JSON.stringify(i)}`);for(const[r,i]of n)i.length>1&&a.push(`Duplicate option alias "-${r}" used by options ${i.map(u=>`"${u.name}"`).join(", ")} in command "${t.name}"`);if(a.length>0)throw new Error(a.join(`
|
|
3
|
-
`))},"validateDuplicateOptions");var La=Object.defineProperty,xe=O((t,e)=>La(t,"name",{value:e,configurable:!0}),"s$4");const ja=xe((t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let a;for(let r=1;r<=e.length;r+=1){const i=e[r-1];if(i===void 0||i.startsWith("-"))break;n.push(i);const u=n.join(" ");t.has(u)&&(a={commandPath:[...n],depth:r})}return a?{argv:e.slice(a.depth),commandPath:a.commandPath}:{argv:e,commandPath:void 0}},"parseNestedCommand"),D=xe(t=>t.join(" "),"getCommandPathKey"),Ze=xe((t,e)=>e&&e.length>0?[...e,t]:[t],"getFullCommandPath");var Ia=Object.defineProperty,_t=O((t,e)=>Ia(t,"name",{value:e,configurable:!0}),"i$5"),Ua=Object.defineProperty,Et=_t((t,e)=>Ua(t,"name",{value:e,configurable:!0}),"r"),Ma=Object.defineProperty,Va=Et((t,e)=>Ma(t,"name",{value:e,configurable:!0}),"c");let xt=class{static{O(this,"l")}static{_t(this,"y")}static{Et(this,"s")}static{Va(this,"LRUCache")}capacity;cache;keyOrder;constructor(e){this.capacity=e,this.cache=new Map,this.keyOrder=[]}get(e){if(this.cache.has(e))return this.keyOrder=this.keyOrder.filter(n=>n!==e),this.keyOrder.push(e),this.cache.get(e)}has(e){return this.cache.has(e)}set(e,n){if(this.cache.has(e))this.keyOrder=this.keyOrder.filter(a=>a!==e);else if(this.cache.size>=this.capacity){const a=this.keyOrder.shift();a!==void 0&&this.cache.delete(a)}this.cache.set(e,n),this.keyOrder.push(e)}delete(e){this.cache.delete(e),this.keyOrder=this.keyOrder.filter(n=>n!==e)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}};var Ta=Object.defineProperty,Sa=O((t,e)=>Ta(t,"name",{value:e,configurable:!0}),"r$5"),Da=Object.defineProperty,Ba=Sa((t,e)=>Da(t,"name",{value:e,configurable:!0}),"a"),Ra=Object.defineProperty,za=Ba((t,e)=>Ra(t,"name",{value:e,configurable:!0}),"s");const Wa=za((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleLowerCase(e.locale):t[0].toLowerCase())+t.slice(1),"lowerFirst");var Fa=Object.defineProperty,qa=O((t,e)=>Fa(t,"name",{value:e,configurable:!0}),"I"),Ga=Object.defineProperty,de=qa((t,e)=>Ga(t,"name",{value:e,configurable:!0}),"W");const Ha=Cn(import.meta.url),Z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ka=de(t=>{if(typeof Z<"u"&&Z.versions&&Z.versions.node){const[e,n]=Z.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return Z.getBuiltinModule(t)}return Ha(t)},"__cjs_getBuiltinModule"),{stripVTControlCharacters:Ya}=Ka("node:util");var Ja=Object.defineProperty,Qa=de((t,e)=>Ja(t,"name",{value:e,configurable:!0}),"g");const $e=new xt(1e3),Xa=/[.*+?^${}()|[\]\\]/g,Za=Qa(t=>{const e=t.join("");if($e.has(e))return $e.get(e);const n=t.map(r=>r.replaceAll(Xa,String.raw`\$&`)).join("|"),a=new RegExp(n,"g");return $e.set(e,a),a},"getSeparatorsRegex");var eo=Object.defineProperty,to=de((t,e)=>eo(t,"name",{value:e,configurable:!0}),"t");const no=to(t=>{const e=[];let n=0,a;for(te.lastIndex=0;(a=te.exec(t))!==null;)a.index>n&&e.push(t.slice(n,a.index)),e.push(a[0]),n=te.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},"splitByEmoji");var io=Object.defineProperty,_=de((t,e)=>io(t,"name",{value:e,configurable:!0}),"u");const ao=/[ČŠŽĐ]/i,Lt=new Uint8Array(128),jt=new Uint8Array(128),It=new Uint8Array(128);for(let t=0;t<128;t++)Lt[t]=t>=65&&t<=90?1:0,jt[t]=t>=97&&t<=122?1:0,It[t]=t>=48&&t<=57?1:0;const Oe=_(t=>Lt[t],"isUpper"),et=_(t=>jt[t],"isLower"),Pe=_(t=>It[t],"isDigit"),T=_((t,e,n,a,r)=>{if(t.length===0)return[];let i=!1;const u=Object.values(e);for(const g of u)if(g(t[0])){i=!0;break}if(!i&&!n)return[t];const s=[...t],m=[];let o=s[0],c="other";const d=Object.entries(e);for(const g of d){const[p,b]=g;if(b(s[0])){c=p;break}}let l=n&&a?s[0]===s[0].toLocaleUpperCase(a):!1;for(let g=1;g<s.length;g++){const p=s[g];let b="other";for(const C of d){const[k,f]=C;if(f(p)){b=k;break}}const $=n&&a?p===p.toLocaleUpperCase(a):!1;let w=!1;r?w=r(c,b,l,$,p,g,s):(c!==b&&c!=="other"&&b!=="other"&&(w=!0),n&&b!=="other"&&!l&&$&&(w=!0)),w?(m.push(o),o=p):o+=p,c=b,n&&(l=$)}return o&&o.length>0&&m.push(o),m.length>0?m:[t]},"handleScriptTransitions"),oo=_((t,e,n,a)=>{if(n.size===0)return e;for(const r of n)if(t.startsWith(r,e))return a.push(r),e+r.length;return e},"detectAndProcessAcronym"),Ut=_((t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const a=[],r=t.length;for(let i=1;i<r;i++){const u=oo(t,n,e,a);if(u!==n){n=u,i=n-1;continue}const s=t.codePointAt(i-1),m=t.codePointAt(i),o=s&&s<128&&Oe(s),c=m&&m<128&&Oe(m),d=s&&s<128&&et(s),l=s&&s<128&&Pe(s),g=m&&m<128&&Pe(m);if(d&&c){a.push(t.slice(n,i)),n=i;continue}if(l&&!g||!l&&g){a.push(t.slice(n,i)),n=i;continue}if(g&&!l){let p=!1,b=!1;if(i+1<r){const $=t.codePointAt(i+1);p=$&&$<128&&Oe($),b=$&&$<128&&Pe($)}if(!b&&p){a.push(t.slice(n,i),t.slice(i,i+1)),n=i+1;continue}}if(i+1<r){const p=t.codePointAt(i+1),b=p&&p<128&&et(p);if(o&&c&&b){const $=t.slice(n,i+1);e.has($)||(a.push(t.slice(n,i)),n=i)}}}return n<r&&a.push(t.slice(n)),a.filter(i=>i!=="")},"splitCamelCaseFast"),Mt=_((t,e,n)=>{if(t.length===0)return[];const a=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!a&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const o=[...t],c=o.length,d=[];let l=o[0],g=o[0]===o[0].toLocaleUpperCase(e),p=g,b=g?0:-1;for(let $=1;$<c;$++){const w=o[$],C=w===w.toLocaleUpperCase(e);if(C===g)l+=w;else if(C)l&&l.length>0&&(d.push(l),l=w),p=!0,b=$;else{if(p&&$-b>1){const k=o[$-1],f=l.slice(0,-1);f&&f.length>0&&d.push(f),l=k+w}else l+=w;p=!1,b=-1}g=C}return l&&l.length>0&&d.push(l),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!G.test(t)&&!L.test(t))return[t];const o=[...t],c=o.length,d=[];let l=o[0];const g=o[0];let p;G.test(g)?p=1:L.test(g)?p=2:p=0;let b=g===g.toLocaleUpperCase(e);for(let w=1;w<c;w++){const C=o[w];let k;G.test(C)?k=1:L.test(C)?k=2:k=0;const f=C===C.toLocaleUpperCase(e);p!==k&&(p===1||p===2)&&(k===1||k===2)||k===p&&!b&&f?(d.push(l),l=C):l+=C,p=k,b=f}l&&l.length>0&&d.push(l);const $=[];for(let w=0;w<d.length;w++)w<d.length-1&&d[w].length===1&&L.test(d[w])&&G.test(d[w+1][0])?($.push(d[w]+d[w+1]),w+=1):$.push(d[w]);return $}if(e.startsWith("el")){if(!ye.test(t)&&!L.test(t))return[t];const o=[];Ue.lastIndex=0;let c;for(;(c=Ue.exec(t))!==null;)o.push(c[0]);o.length===0&&o.push(t);const d=[];if(o.length===1){const l=o[0];if(!l||!ye.test(l[0])||l.length===1)return[l??t]}for(const l of o){if(!l)continue;if(!ye.test(l[0])||l.length===1){d.push(l);continue}const g=l.length;let p=l[0],b=l[0]===l[0].toLocaleUpperCase(e);for(let $=1;$<g;$++){const w=l[$],C=w===w.toLocaleUpperCase(e);!b&&C?(d.push(p),p=w):p+=w,b=C}p&&d.push(p)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const o=e.startsWith("ja"),c=o?{hiragana:_(l=>ln.test(l),"hiragana"),kanji:_(l=>Me.test(l),"kanji"),katakana:_(l=>sn.test(l),"katakana"),latin:_(l=>L.test(l),"latin")}:{hangul:_(l=>Ve.test(l),"hangul"),latin:_(l=>L.test(l),"latin")},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(o){const l=T(t,c,!1,e,(p,b)=>p==="hiragana"&&b==="katakana"||p==="katakana"&&b==="hiragana"||p==="hiragana"&&b==="latin"||p==="katakana"&&b==="latin"||p==="kanji"&&b==="latin"||p==="latin"&&(b==="hiragana"||b==="katakana"||b==="kanji")),g=[];for(const p of l){const b=p;b.length===1&&d.has(b)&&g.length>0?g[g.length-1]=g.at(-1)+b:g.push(b)}return g.length>0?g:[t]}return T(t,c,!1,e,(l,g)=>l==="hangul"&&g==="latin"||l==="latin"&&g==="hangul")}if(e.startsWith("sl")){const o=[...t],c=o.length,d=[];let l=o[0],g=o[0]===o[0].toLocaleUpperCase(e);for(let p=1;p<c;p++){const b=o[p],$=b===b.toLocaleUpperCase(e),w=ao.test(b),C=p<c-1&&o[p+1]===o[p+1].toLocaleUpperCase(e);!g&&$||w&&C?(d.push(l),l=b,w&&C&&(d.push(l),l="")):l+=b,g=$}return l&&l.length>0&&d.push(l),d}if(e.startsWith("zh"))return T(t,{han:_(o=>Me.test(o),"han"),latin:_(o=>L.test(o),"latin")},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const o=_(c=>Te.test(c)||Se.test(c),"isRtlChar");return T(t,{latin:_(c=>L.test(c),"latin"),rtl:_(c=>o(c),"rtl")},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const o=_(c=>cn.test(c)||un.test(c)||pn.test(c)||fn.test(c)||dn.test(c)||hn.test(c)||mn.test(c)||gn.test(c)||vn.test(c)||yn.test(c)||wn.test(c)||bn.test(c)||$n.test(c)||On.test(c)||Pn.test(c)||An.test(c),"isIndicChar");return T(t,{indic:_(c=>o(c),"indic"),latin:_(c=>L.test(c),"latin")},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return T(t,{cyrillic:_(o=>G.test(o),"cyrillic"),latin:_(o=>L.test(o),"latin")},!0,e);if(["ar","fa","he"].includes(e))return T(t,{latin:_(o=>L.test(o),"latin"),rtl:_(o=>Te.test(o)||Se.test(o),"rtl")},!1,e);if(e.startsWith("ko"))return T(t,{hangul:_(o=>Ve.test(o),"hangul"),latin:_(o=>L.test(o),"latin")},!1,e);if(e.startsWith("uz")){if(!G.test(t)&&!L.test(t))return[t];const o=[...t],c=o.length,d=[];let l=o[0],g=o[0]===o[0].toLocaleUpperCase(e);for(let p=1;p<c;p++){const b=o[p],$=b===b.toLocaleUpperCase(e);if(De.test(b)||De.test(o[p-1])){l+=b;continue}!g&&$?(d.push(l),l=b):l+=b,g=$}return l&&l.length>0&&d.push(l),d}const r=[...t],i=r.length,u=[];let s=r[0],m=r[0]===r[0].toLocaleUpperCase(e);for(const o of n)if(t.startsWith(o)){u.push(o),s=r[o.length],m=s===s.toLocaleUpperCase(e);break}for(let o=1;o<i;o++){const c=r[o],d=c===c.toLocaleUpperCase(e);let l=0;for(const g of n)if(t.startsWith(g,o)){u.push(s,g),l=g.length,s="";const p=g.at(-1);p&&(m=p===p.toLocaleUpperCase(e));break}if(l>0){o+=l-1;continue}!m&&d?(u.push(s),s=c):s+=c,m=d}return s&&u.push(s),u},"splitCamelCaseLocale"),ro=_((t,e,n)=>{const a=[],r=ee.test(t)?t.split(ee).filter(Boolean):[t];for(const i of r){const u=i;if(ee.test(u))a.push(u);else{const s=te.test(u)?no(u).filter(Boolean):[u];for(const m of s)if(te.test(m))a.push(m);else if(e){const o=e.toLowerCase().split("-")[0];a.push(...Mt(m,o,n))}else a.push(...Ut(m,n))}}return a},"processTextWithAnsiEmoji"),so=_((t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:a=!1,knownAcronyms:r=[],locale:i,normalize:u=!1,separators:s,stripAnsi:m=!1,stripEmoji:o=!1}=e,c=new Set([...r].toSorted((w,C)=>C.length-w.length));let d=t;m&&(d=Ya(d)),o&&(d=on(d));let l;Array.isArray(s)?l=Za(s):s instanceof RegExp?l=s:l=rn;const g=[];let p=d;const b=l.flags.includes("g")?l:new RegExp(l.source,`${l.flags}g`);for(;p.length>0;){const w=b.exec(p);if(!w){p===".."?g.push(".."):p==="."?g.push("."):p.length>0&&g.push(p);break}const C=w.index,k=w[0],f=k.length,h=p.slice(0,C),v=p.slice(C+f);if(k.startsWith("../"))g.push(".."),p=p.slice(C+3);else if(k.startsWith("./"))g.push("."),p=p.slice(C+2);else if(C===0&&k==="..")g.push(".."),p=p.slice(2);else if(C===0&&k===".")g.push("."),p=p.slice(1);else{h.length>0&&g.push(h);let y=0;for(;(y=k.indexOf("../",y))!==-1;)g.push(".."),y+=3;for(y=0;(y=k.indexOf("./",y))!==-1;)(y===0||k[y-1]!==".")&&g.push("."),y+=2;let P=v;for(;P.startsWith("../");)g.push(".."),P=P.slice(3);for(;P.startsWith("./");)g.push("."),P=P.slice(2);if(P===".."){g.push("..");break}else if(P==="."){g.push(".");break}else p=P}b.lastIndex=0}if(g.length===0){const w=d.split(l).filter(Boolean);g.push(...w)}let $=[];for(const w of g)n||a?$.push(...ro(w,i,c)):i?$.push(...Mt(w,i,c)):$.push(...Ut(w,c));return u&&($=$.map(w=>c.has(w)?w:i&&w===w.toLocaleUpperCase(i)?w[0]+w.slice(1).toLocaleLowerCase(i):w.toUpperCase()===w&&!c.has(w)?w.slice(0,1)+w.slice(1).toLowerCase():w)),$},"splitByCase");var lo=Object.defineProperty,co=O((t,e)=>lo(t,"name",{value:e,configurable:!0}),"r$4"),uo=Object.defineProperty,po=co((t,e)=>uo(t,"name",{value:e,configurable:!0}),"o"),fo=Object.defineProperty,ho=po((t,e)=>fo(t,"name",{value:e,configurable:!0}),"s");const mo=ho((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),"upperFirst");var go=Object.defineProperty,vo=O((t,e)=>go(t,"name",{value:e,configurable:!0}),"r$3"),yo=Object.defineProperty,wo=vo((t,e)=>yo(t,"name",{value:e,configurable:!0}),"r"),bo=Object.defineProperty,$o=wo((t,e)=>bo(t,"name",{value:e,configurable:!0}),"n");const Oo=$o((t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}`,"generateCacheKey");var Po=Object.defineProperty,Ao=O((t,e)=>Po(t,"name",{value:e,configurable:!0}),"i$3"),Co=Object.defineProperty,No=Ao((t,e)=>Co(t,"name",{value:e,configurable:!0}),"f"),ko=Object.defineProperty,_o=No((t,e)=>ko(t,"name",{value:e,configurable:!0}),"l");const Eo=_o((t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const a=[];let r="",i="";for(let u=0;u<n;u++){const s=t[u];if(ee.test(s)){r?(a.push(r+i+s),r="",i=""):(a.length>0&&a.push(e),r=s);continue}r?(i&&(i+=e),i+=s):(a.length>0&&a.push(e),a.push(s))}return a.join("")},"joinSegments");var xo=Object.defineProperty,Lo=O((t,e)=>xo(t,"name",{value:e,configurable:!0}),"r$2"),jo=Object.defineProperty,Io=Lo((t,e)=>jo(t,"name",{value:e,configurable:!0}),"a"),Uo=Object.defineProperty,Mo=Io((t,e)=>Uo(t,"name",{value:e,configurable:!0}),"e");const Vo=/(?<![a-zß])SS(?![a-z])/g,To=Mo(t=>t.replaceAll(Vo,"ß"),"normalizeGermanEszett");var So=Object.defineProperty,Do=O((t,e)=>So(t,"name",{value:e,configurable:!0}),"c$2"),Bo=Object.defineProperty,Ro=Do((t,e)=>Bo(t,"name",{value:e,configurable:!0}),"c"),zo=Object.defineProperty,Wo=Ro((t,e)=>zo(t,"name",{value:e,configurable:!0}),"o");const Fo=new xt(1e3),Vt=Wo((t,e)=>{if(typeof t!="string"||!t)return"";const n=e?.cache??!1,a=e?.cacheStore??Fo;let r;if(n&&(r=Oo(t,e)),n&&r&&a.has(r))return a.get(r);let i=!0;const u=Eo(so(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(s=>{if(e?.handleAnsi&&ee.test(s))return s;const m=e?.locale?.startsWith("de")?To(s):s,o=e?.locale?m.toLocaleLowerCase(e.locale):m.toLowerCase();return i?(i=!1,Wa(o,e)):mo(o,e)}),"");return n&&r&&a.set(r,u),u},"camelCase");var qo=Object.defineProperty,he=O((t,e)=>qo(t,"name",{value:e,configurable:!0}),"a$2");const Go=he(t=>{t.options?.forEach(e=>{e.__camelCaseName__=Vt(e.name)})},"processOptionNames"),Ho=he(t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const a of t.options)e.add(a.name);const n=[];for(const a of t.options)if(a.name.startsWith("no-")){const r=a.name.replace("no-","");if(!e.has(r)){if(a.type!==Boolean)throw new Error(`Cannot add negated option "${a.name}" to command "${t.name}" because it is not a boolean.`);const i={...a,defaultValue:a.defaultValue===void 0?!0:!a.defaultValue,name:r};n.push(i),e.add(r)}}n.length>0&&t.options.push(...n)},"addNegatableOptions"),Ko=he((t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,a=new Map;for(const i of e.options)if(i.name.startsWith("no-")){const u=Vt(i.name);a.set(u,i)}const r=Object.keys(n).filter(i=>a.has(i));if(r.length!==0)for(const i of r){const u=i.charAt(2);if(!u)continue;const s=u.toLowerCase()+i.slice(3),m=a.get(i);m&&(m.__negated__=!0),n[s]=!n[i],Reflect.deleteProperty(n,i)}},"mapNegatableOptions"),Yo=he((t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const r of e.options)r.__camelCaseName__&&r.__negated__===void 0&&r.implies!==void 0&&n.set(r.__camelCaseName__,r);if(n.size===0)return;const{options:a}=t;for(const r of Object.keys(a)){const i=n.get(r);if(i?.implies){const{implies:u}=i;for(const[s,m]of Object.entries(u))a[s]===void 0&&(a[s]=m)}}},"mapImpliedOptions");var Jo=Object.defineProperty,me=O((t,e)=>Jo(t,"name",{value:e,configurable:!0}),"e$2");const Qo=me(()=>!!process.versions.electron,"isElectronApp"),Xo=me(()=>Qo()&&!process.defaultApp,"isBundledElectronApp"),Zo=me(()=>Xo()?0:1,"getProcessArgvBinIndex"),er=me(t=>t.slice(Zo()+1),"hideBin");var tr=Object.defineProperty,Tt=O((t,e)=>tr(t,"name",{value:e,configurable:!0}),"e$1");const nr=" ",ir=Tt((t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,a)=>n===e[a]),"equals"),ar=Tt(t=>{if(typeof t=="string")return t.split(nr);const e=ke();return ir(t,e)?er(t):t},"parseRawCommand");var or=Object.defineProperty,Ae=O((t,e)=>or(t,"name",{value:e,configurable:!0}),"r");const rr=Ae(t=>{const e=Ae(i=>{t.error(`Uncaught exception: ${i.message||i}`),i.stack&&t.error(i.stack),Y(1)},"uncaughtExceptionHandler"),n=Ae((i,u)=>{if(i instanceof Error)t.error(`Promise rejection: ${i.message||i}`),i.stack&&t.error(i.stack);else{let s;if(typeof i=="string")s=i;else try{s=JSON.stringify(i)}catch{s=String(i)}t.error(`Promise rejection: ${s}`)}Y(1)},"unhandledRejectionHandler"),a=Ie("uncaughtException",e),r=Ie("unhandledRejection",n);return()=>{a(),r()}},"registerExceptionHandler");var sr=Object.defineProperty,Q=O((t,e)=>sr(t,"name",{value:e,configurable:!0}),"e");const se=100,St=/^[a-z][\w-]*$/i,le=Q((t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new A(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},"validateNonEmptyString"),tt=Q((t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new A(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateStringArray");Q((t,e)=>{if(typeof t!="function")throw new A(`${e} must be a function`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateFunction");const Ce=Q((t,e)=>{if(typeof t!="object"||t===null)throw new A(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateObject"),oe=Q(t=>{const e=le(t,"Command name");if(e.length>se)throw new A(`Command name is too long (maximum ${String(se)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new A(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!St.test(e))throw new A(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},"validateCommandName");Q(t=>{const e=le(t,"Plugin name");if(e.length>se)throw new A(`Plugin name is too long (maximum ${String(se)} characters)`,"INVALID_PLUGIN_NAME",{length:e.length,pluginName:e});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new A(`Plugin name "${e}" contains invalid characters`,"INVALID_PLUGIN_NAME",{pluginName:e});if(!St.test(e))throw new A(`Plugin name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_PLUGIN_NAME",{pluginName:e});return e},"validatePluginName");var lr=Object.defineProperty,ge=O((t,e)=>lr(t,"name",{value:e,configurable:!0}),"s");const cr=new Set([`
|
|
4
|
-
`,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),ur=/^[A-Z]:/i,pr=ge(t=>{if(typeof t!="string")throw new TypeError("Argument must be a string");if(t.length>1e4)throw new Error(`Argument is too long (maximum ${String(1e4)} characters)`);for(const e of t)if(cr.has(e))throw new Error(`Argument contains dangerous character: ${e}`);return t.trim()},"sanitizeArgument"),nt=ge(t=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");if(t.length>100)throw new Error(`Too many arguments (maximum ${String(100)})`);return t.map(e=>pr(e))},"sanitizeArguments");ge(t=>{if(typeof t!="string")throw new TypeError("Path must be a string");const e=t.trim();if(e.includes("..")||e.includes("../")||e.includes("..\\"))throw new Error("Path contains directory traversal sequences");if(e.startsWith("/")||ur.test(e))throw new Error("Absolute paths are not allowed");if(e.length>1e3)throw new Error("Path is too long");return e},"validateSafePath");class Ir{static{O(this,"RateLimiter")}static{ge(this,"RateLimiter")}attempts=new Map;maxAttempts;windowMs;constructor(e=5,n=6e4){if(e<=0||n<=0)throw new Error("maxAttempts and windowMs must be positive numbers");this.maxAttempts=e,this.windowMs=n}checkLimit(e){const n=Date.now(),a=this.attempts.get(e);return!a||n>a.resetTime?(this.attempts.set(e,{count:1,resetTime:n+this.windowMs}),this.cleanup(n),!0):a.count>=this.maxAttempts?!1:(a.count+=1,!0)}reset(e){this.attempts.delete(e)}cleanup(e){for(const[n,a]of this.attempts.entries())e>a.resetTime&&this.attempts.delete(n)}}var fr=Object.defineProperty,U=O((t,e)=>fr(t,"name",{value:e,configurable:!0}),"b");const dr=/^-([^\d-])$/,hr=/^--(\S+)/,mr=/^-([^\d-]{2,})$/,Ne=U(t=>dr.test(t)||hr.test(t)||mr.test(t),"isOption"),gr={access:U((t,e)=>Yt(t,e),"access"),mkdir:U((t,e)=>Kt(t,e),"mkdir"),readdir:U(t=>Ht(t),"readdir"),readFile:U((async(t,e)=>e===void 0?Le(t):Le(t,e)),"readFile"),rm:U((t,e)=>Gt(t,e),"rm"),stat:U(t=>qt(t),"stat"),writeFile:U((t,e,n)=>Ft(t,e,n),"writeFile")};class Dt{static{O(this,"Cli")}static{U(this,"Cli")}#t;#e;#c;#u;#f;#d;#w;#b;#$;#O;#P;#p;#n;#i;#a;#o;#r;#h=!1;#A;#C=!1;#m;#g;#v;#l=[];#x(){return this.#m===void 0&&(this.#m=[...this.#i.keys()]),this.#m}#N(){return this.#g===void 0&&(this.#g=[...this.#n.keys()]),this.#g}#s(){return this.#v===void 0&&(this.#v=[...this.#x(),...this.#N()]),this.#v}#k(){return this.#l.length===0?ae:[...ae,...this.#l]}#_(){this.#m=void 0,this.#g=void 0,this.#v=void 0}#y(){if(this.#c===void 0){const e=ar(this.#e.argv);this.#c=nt(e),this.#L()}return this.#c}#L(){if(!this.#c)return;const e=R();let n=!1;for(const a of this.#c){if(a==="--quiet"||a==="-q"){e.CEREBRO_OUTPUT_LEVEL=String(Jt),n=!0;break}if(a==="--verbose"||a==="-v"){e.CEREBRO_OUTPUT_LEVEL=String(Qt),n=!0;break}if(a==="--debug"||a==="-vvv"){e.CEREBRO_OUTPUT_LEVEL=String(K),n=!0;break}}n||(e.CEREBRO_OUTPUT_LEVEL=Object.hasOwn(e,"DEBUG")?String(K):String(je))}#j(){this.#C||(this.#A=rr(this.#t),this.#C=!0)}#I(){return{arch:Zt(),argv:this.#y(),cwd:this.#u,env:this.#O??R(),exit:this.#$??(e=>Y(e??0)),platform:Xt(),stdin:this.#P}}#E(e,n,a,r){this.#t.debug(`command '${r}' found, parsing command args: ${n.join(", ")}`);const{arguments_:i,booleanValues:u,parsedArgs:s}=ya(e,n,this.#k()),m=Object.keys(u).length>0;let o=s;m&&(o={...s,_all:{...s._all,...u}}),_a(i,o,e);const c=va(e,s,u,a);c.runtime=this,c.argv=this.#y(),c.fs=this.#b??gr,c.process=this.#I(),c.console=this.#t;const d=e.options&&e.options.length>0;if(d&&e.options){const l=e.options.filter(g=>g.name.startsWith("no-"));for(const g of l){const p=g.name.replace("no-",""),b=`--${g.name}`,$=`--${p}`,w=n.includes(b),C=n.includes($);if(w&&C)throw new at(p,g.name)}}return d&&(Ko(c,e),Yo(c,e)),Ea(i,c.options,e),R().CEREBRO_OUTPUT_LEVEL===String(K)&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(c.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(c.argument,null,2))),{arguments_:i,booleanValues:u,commandArgs:o,parsedArgs:s,toolbox:c}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new A("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#f=e.trim();const a=n.argv??ke(),r=n.cwd??en();if(this.#e={...n,argv:a,cwd:r},this.#e.argv&&!Array.isArray(this.#e.argv))throw new A("CLI argv option must be an array of strings","INVALID_INPUT",{argv:this.#e.argv});if(this.#e.cwd&&typeof this.#e.cwd!="string")throw new A("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new A("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new A("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});const i=R();if(i.CEREBRO_OUTPUT_LEVEL=String(je),typeof this.#e.logger=="object"){const c=["debug","error","info","log","warn"],d=[],l=this.#e.logger;for(const g of c)typeof l[g]!="function"&&d.push(g);if(d.length>0)throw new A(`Logger object is missing required methods: ${d.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:d});this.#t=this.#e.logger}else this.#t={...console,debug:U((...c)=>{i.CEREBRO_OUTPUT_LEVEL===String(K)&&console.debug(...c)},"debug")};this.#d=this.#e.packageVersion,this.#w=this.#e.packageName,this.#u=this.#e.cwd,this.#o="help",this.#r={};const u=n.fs;if(u!==void 0&&(typeof u!="object"||u===null))throw new A("CLI fs option must be an object implementing the CerebroFs interface","INVALID_INPUT",{fs:n.fs});const s=n.exit;if(s!==void 0&&typeof s!="function")throw new A("CLI exit option must be a function","INVALID_INPUT",{exit:n.exit});const m=n.env;if(m!==void 0&&(typeof m!="object"||m===null))throw new A("CLI env option must be a record of string keys","INVALID_INPUT",{env:n.env});const o=n.stdin;if(o!==void 0&&typeof o!="string")throw new A("CLI stdin option must be a string","INVALID_INPUT",{stdin:n.stdin});this.#b=n.fs,this.#$=n.exit,this.#O=n.env,this.#P=n.stdin??"",this.#n=new Map,this.#i=new Map,this.#a=new Map}setCommandSection(e){return this.#r=e,this}getCommandSection(){return this.#r.header||(this.#r.header=`${this.#f}${this.#d?` v${this.#d}`:""}`),this.#r}setDefaultCommand(e){return this.#o=e,this}get defaultCommand(){return this.#o}addCommand(e){Ce(e,"Command"),oe(e.name);const n=typeof e.execute=="function",a=typeof e.loader=="function";if(n&&a)throw new A(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!a)throw new A(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?oe(e.alias):tt(e.alias,"Command alias").forEach(o=>oe(o))),e.argument&&Ce(e.argument,"Command argument"),e.options&&Ce(e.options,"Command options"),e.commandPath&&(tt(e.commandPath,"Command commandPath"),e.commandPath.forEach(o=>{oe(o)}));const r=Ze(e.name,e.commandPath),i=D(r);if(this.#i.has(i))throw new A(`Command with path "${i}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const u=Array.isArray(e.commandPath)&&e.commandPath.length>0,s=this.#n.get(e.name),m=s!==void 0&&(s.commandPath===void 0||s.commandPath.length===0);if(!u&&m)throw new A(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const o of e.options)Re(o);if(xa(e),Ho(e),Go(e),e.options&&(e.__conflictingOptions__=e.options.filter(o=>o.conflicts!==void 0),e.__requiredOptions__=e.options.filter(o=>o.required===!0)),u&&s!==void 0)this.#n.set(i,e);else{if(!u&&s!==void 0&&!m){const o=Ze(s.name,s.commandPath);this.#n.set(D(o),s)}this.#n.set(e.name,e)}if(this.#i.set(i,r),this.#a.set(i,e),this.#_(),e.alias!==void 0){const o=typeof e.alias=="string"?[e.alias]:e.alias;for(const c of o){if(R().CEREBRO_OUTPUT_LEVEL===String(K)&&this.#t.debug("adding alias",c),this.#n.has(c))throw new A(`Command alias "${c}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:c,commandName:e.name});this.#n.set(c,e)}}return this}addGlobalOption(e){const n=e,a=new Set(ae.map(i=>i.name)),r=new Set(ae.map(i=>i.alias).filter(Boolean));if(a.has(n.name))throw new A(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&r.has(n.alias))throw new A(`Cannot add global option with alias "-${n.alias}": it conflicts with a built-in global option alias`,"DUPLICATE_OPTION",{alias:n.alias,optionName:n.name});if(new Set(this.#l.map(i=>i.name)).has(n.name))throw new A(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",Re(n),this.#l.push(n),this}getGlobalOptions(){return this.#k()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#p?this.#p:(this.#p=new Un(this.#t),this.#p.register({description:"Attaches the logger to the toolbox",execute:U(e=>{e.logger=this.#t,e.console=e.logger},"execute"),name:"logger"}),this.#p)}getCliName(){return this.#f}getPackageVersion(){return this.#d}getPackageName(){return this.#w}getCommands(){return this.#n}getCwd(){return this.#u}dispose(){this.#A?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:a=!0,...r}=e;if(!this.#n.has("help")){const{default:h}=await import("../commands/help-command.js");this.addCommand(new h(this.#n))}const i=this.#N(),u=this.#i;this.#j();const s=this.#y();let m,o=[...s];const c=tn(),d=nn(),l=ke();this.#t.debug(`process.execPath: ${c}`),this.#t.debug(`process.execArgv: ${d.join(" ")}`),this.#t.debug(`process.argv: ${l.join(" ")}`);const g=ja(u,[...s]);if(g.commandPath)m=g.commandPath,o=g.argv;else{if(s.length>1&&s[0]&&s[1]&&!Ne(s[0])&&!Ne(s[1])){const v=[];let y=0;for(;y<s.length;){const E=s[y];if(!E||Ne(E))break;v.push(E),y+=1}const P=D(v);if(v[0]&&!i.includes(v[0])){const E=this.#s(),N=B(P,E);throw new S(P,N)}}let h;try{h=Fn([null,...i],[...s])}catch(v){if(v instanceof Error&&v.name==="INVALID_COMMAND"&&"command"in v){const y=v.command,P=this.#s(),E=B(y,P);throw new S(y,E)}throw v}h.command&&(m=[h.command],o=h.argv)}if(!m)if(this.#o)m=[this.#o];else{const h=this.#s();throw new S("",h)}const p=D(m),b=this.#i.get(p);let $;if(b){if($=this.#a.get(p),!$||D(b)!==p){const h=this.#s(),v=B(p,h);throw new S(p,v)}}else{const h=m.at(-1);if($=h?this.#n.get(h):void 0,!$){const v=this.#s(),y=B(p,v);throw new S(p,y)}}if(typeof $.execute!="function"&&typeof $.loader!="function")return this.#t.error(`Command "${$.name}" has no function to execute.`),a?Y(1):void 0;const w=o;let C,k;try{({commandArgs:C,toolbox:k}=this.#E($,w,r,p))}catch(h){if(this.#t.error(h),a)return Y(1);throw h}const f=this.getPluginManager();try{!this.#h&&f.hasPlugins()&&(await f.init({cli:this,cwd:this.#u,logger:this.#t}),this.#h=!0),await f.executeLifecycle("execute",k),await f.executeLifecycle("beforeCommand",k);let h;const v=C.global;if(v?.help){const y=this.#n.get("help");if(!y)throw new A("Help command not found","COMMAND_NOT_FOUND");h=await H(y,k,C)}else if(v?.version??v?.V){const y=this.#n.get("version");if(!y)throw new A("Version command not found","COMMAND_NOT_FOUND");h=await H(y,k,C)}else h=await H($,k,C);return await f.executeLifecycle("afterCommand",k,h),a?Y(0):void 0}catch(h){throw await f.executeErrorHandlers(h,k),h}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:a=[],...r}=n;le(e,"Command name");const i=e.split(" ").filter(Boolean),u=D(i),s=this.#i.get(u)?this.#a.get(u):this.#n.get(e);if(!s){const l=this.#s(),g=B(u||e,l);throw new S(e,g)}if(typeof s.execute!="function"&&typeof s.loader!="function")throw new A(`Command "${s.name}" has no function to execute`,"INVALID_COMMAND",{commandName:s.name});const m=[...nt(a)];this.#t.debug(`running command '${e}' programmatically with args: ${m.join(", ")}`);const{commandArgs:o,toolbox:c}=this.#E(s,m,r,u||e),d=this.getPluginManager();try{!this.#h&&d.hasPlugins()&&(await d.init({cli:this,cwd:this.#u,logger:this.#t}),this.#h=!0),await d.executeLifecycle("execute",c),await d.executeLifecycle("beforeCommand",c);let l;const g=o.global;if(g?.help){const p=this.#n.get("help");if(!p)throw new A("Help command not found","COMMAND_NOT_FOUND");l=await H(p,c,o)}else if(g?.version??g?.V){const p=this.#n.get("version");if(!p)throw new A("Version command not found","COMMAND_NOT_FOUND");l=await H(p,c,o)}else l=await H(s,c,o);return await d.executeLifecycle("afterCommand",c,l),l}catch(l){throw await d.executeErrorHandlers(l,c),l}}clone(e){const n={...this.#e,...e},a=new Dt(this.#f,n);for(const[r,i]of this.#n)a.#n.set(r,i);for(const[r,i]of this.#i)a.#i.set(r,[...i]);for(const[r,i]of this.#a)a.#a.set(r,i);for(const r of this.#l)a.#l.push(r);return a.#o=this.#o,a.#r={...this.#r},a.#_(),a}async getAction(e){le(e,"Command name");const n=e.split(" ").filter(Boolean),a=D(n),r=this.#i.get(a)?this.#a.get(a):this.#n.get(e);if(!r){const i=this.#s(),u=B(a||e,i);throw new S(e,u)}if(typeof r.execute=="function")return r.execute;if(typeof r.loader=="function")return Nt(r);throw new A(`Command "${r.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:r.name})}}export{Dt as Cli};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
var ne=Object.defineProperty;var u=(e,i)=>ne(e,"name",{value:i,configurable:!0});import{createRequire as ae}from"node:module";import{h as $,H as j,E as q}from"./constants-DmzZF6_u-BmMwILI_.js";import{createTable as x}from"@visulima/tabular";import{NO_BORDER as E}from"@visulima/tabular/style";import le from"terminal-size";import de from"@visulima/colorize/template";import{d as ue}from"./runtime-process-DKHFvYkv.js";import{bold as fe}from"@visulima/colorize";const oe=ae(import.meta.url),v=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,se=u(e=>{if(typeof v<"u"&&v.versions&&v.versions.node){const[i,r]=v.versions.node.split(".").map(Number);if(i>22||i===22&&r>=3||i===20&&r>=16)return v.getBuiltinModule(e)}return oe(e)},"__cjs_getBuiltinModule"),ce=se("node:os");var he=Object.defineProperty,V=u((e,i)=>he(e,"name",{value:i,configurable:!0}),"u$1"),pe=Object.defineProperty,S=V((e,i)=>pe(e,"name",{value:i,configurable:!0}),"l");const me=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],ge=12288,we=65510,be=[12288,12288,65281,65376,65504,65510],ye=8361,ve=65518,$e=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],We=32,Oe=10630,Ie=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Ae=4352,je=262141,Q=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var Ne=Object.defineProperty,xe=S((e,i)=>Ne(e,"name",{value:i,configurable:!0}),"r$1");const O=xe((e,i)=>{let r=0,a=Math.floor(e.length/2)-1;for(;r<=a;){const o=Math.floor((r+a)/2),s=o*2;if(i<e[s])a=o-1;else if(i>e[s+1])r=o+1;else return!0}return!1},"isInRange");var Ee=Object.defineProperty,g=S((e,i)=>Ee(e,"name",{value:i,configurable:!0}),"r");const G=19968,[Pe,Me]=T(Q);function T(e){let i=e[0],r=e[1];for(let a=0;a<e.length;a+=2){const o=e[a],s=e[a+1];if(G>=o&&G<=s)return[o,s];s-o>r-i&&(i=o,r=s)}return[i,r]}u(T,"c$2");V(T,"f");S(T,"k");g(T,"findWideFastPathRange");const X=g(e=>e<161||e>1114109?!1:O(me,e),"isAmbiguous"),Z=g(e=>e<ge||e>we?!1:O(be,e),"isFullWidth"),ke=g(e=>e<ye||e>ve?!1:O($e,e),"isHalfWidth"),Se=g(e=>e<We||e>Oe?!1:O(Ie,e),"isNarrow"),ee=g(e=>e>=Pe&&e<=Me?!0:e<Ae||e>je?!1:O(Q,e),"isWide");function R(e){return X(e)?"ambiguous":Z(e)?"fullwidth":ke(e)?"halfwidth":Se(e)?"narrow":ee(e)?"wide":"neutral"}u(R,"g$3");V(R,"S");S(R,"getCategory");g(R,"getCategory");var Te=Object.defineProperty,C=u((e,i)=>Te(e,"name",{value:i,configurable:!0}),"i$2"),Re=Object.defineProperty,_=C((e,i)=>Re(e,"name",{value:i,configurable:!0}),"a"),Ce=Object.defineProperty,Y=_((e,i)=>Ce(e,"name",{value:i,configurable:!0}),"e");function I(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}u(I,"s$1");C(I,"s");_(I,"r");Y(I,"validate");function A(e){return I(e),R(e)}u(A,"r$3");C(A,"p");_(A,"eastAsianWidthType");Y(A,"eastAsianWidthType");function D(e,{ambiguousAsWide:i=!1}={}){return I(e),Z(e)||ee(e)||i&&X(e)?2:1}u(D,"o$2");C(D,"W");_(D,"eastAsianWidth");Y(D,"eastAsianWidth");var _e=Object.defineProperty,Le=u((e,i)=>_e(e,"name",{value:i,configurable:!0}),"E"),Fe=Object.defineProperty,Be=Le((e,i)=>Fe(e,"name",{value:i,configurable:!0}),"A"),He=Object.defineProperty,L=Be((e,i)=>He(e,"name",{value:i,configurable:!0}),"d");const K=new Map,N=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,P=L(e=>e>=32&&e<=126?"latin":e===8203||e===8204||e===8205||e===8288?"zero":e<=31||e>=127&&e<=159?"control":e>=160&&e<=255||e>=9472&&e<=9599?"latin":e>=4352&&e<=4607||e>=11904&&e<=40959||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65280&&e<=65519&&!(e>=65377&&e<=65439)||e>=12352&&e<=12543?"wide":e===8230?"latin":"other","getCharType"),qe=L((e,i)=>{const r=Math.floor(e/65536),a=e%65536;let o=K.get(r);if(o||(o=new Map,K.set(r,o)),o.has(a))return o.get(a);let s;if(P(e)==="latin")s=i.width.regular;else if(P(e)==="control")s=i.width.control;else if(P(e)==="wide")s=i.width.wide;else switch(A(e)){case"ambiguous":{s=i.width.ambiguousIsNarrow?i.width.regular:i.width.wide;break}case"fullwidth":{s=i.width.fullWidth;break}case"wide":{s=i.width.wide;break}default:s=i.width.regular}return o.set(a,s),s},"getCachedCharWidth"),ze=L(e=>e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=917760&&e<=917999||e>=65024&&e<=65039||e>=3633&&e<=3642||e>=3655&&e<=3662||e>=3761&&e<=3769||e>=3771&&e<=3772||e>=3784&&e<=3789||e>=2304&&e<=2307||e>=2362&&e<=2383||e>=2385&&e<=2391||e>=2402&&e<=2403||e>=2433&&e<=2435||e>=2492&&e<=2500||e>=2509&&e<=2509||e>=2561&&e<=2563||e>=2620&&e<=2637||e>=1611&&e<=1631||e>=1648&&e<=1648||e>=1750&&e<=1773||e>=2276&&e<=2302||e>=1425&&e<=1469||e>=1471&&e<=1471||e>=1473&&e<=1474||e>=1476&&e<=1477||e>=1479&&e<=1479||e>=3893&&e<=3893||e>=3895&&e<=3895||e>=3897&&e<=3897||e>=3953&&e<=3966||e>=3968&&e<=3972||e>=3974&&e<=3975?!0:e>=768&&e<=777||e>=803&&e<=803,"isCombiningCharacter"),z=L((e,i={})=>{if(!e||e.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const r={truncation:{countAnsiEscapeCodes:i.countAnsiEscapeCodes??!1,ellipsis:i.ellipsis??"",ellipsisWidth:i.ellipsisWidth??(i.ellipsis?z(i.ellipsis,{...i,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:i.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:i.ambiguousIsNarrow??!1,ansi:i.ansiWidth??0,control:i.controlWidth??0,emoji:i.emojiWidth??2,fullWidth:i.fullWidth??2,halfWidth:i.halfWidth??1,regular:i.regularWidth??1,tab:i.tabWidth??8,wide:i.wideWidth??2}},a=Math.max(0,r.truncation.limit-r.truncation.ellipsisWidth),{length:o}=e,s=o>1e4;let t=0,n=0,l=o,d=!1;const w=e.includes("\x1B")||e.includes("");for(;t<o;){if(w&&(e[t]==="\x1B"||e[t]==="")){if(e.startsWith("\x1B]8;;",t)){const h="\x1B]8;;\x07",m=h.length,F=e.indexOf("\x07",t+5);if(F!==-1){const B=e.indexOf(h,F+1);if(B!==-1){const re=B+m,te=e.slice(F+1,B).replace($,""),U=z(te,{ambiguousIsNarrow:r.width.ambiguousIsNarrow,ansiWidth:r.width.ansi,controlWidth:r.width.control,countAnsiEscapeCodes:!1,ellipsis:r.truncation.ellipsis,ellipsisWidth:r.truncation.ellipsisWidth,emojiWidth:r.width.emoji,fullWidth:r.width.fullWidth,halfWidth:r.width.halfWidth,limit:Math.max(0,a-n),regularWidth:r.width.regular,tabWidth:r.width.tab,wideWidth:r.width.wide}),H=U.width;if(U.truncated)d=!0,l=Math.min(l,t);else if(n+H>a&&(l=Math.min(l,t),d=!0,n+H>r.truncation.limit))break;if(n+=H,t=re,d&&n>=r.truncation.limit)break;continue}}}if($.lastIndex=t,$.test(e)){const h=$.lastIndex-t,m=r.truncation.countAnsiEscapeCodes?h:r.width.ansi;if(n+m>a&&(l=Math.min(l,t),n+m>r.truncation.limit)){d=!0;break}n+=m,t=$.lastIndex;continue}}const p=e.codePointAt(t);if(p===8203||p===65279||p>=8288&&p<=8292){t+=1;continue}if(p===9){if(n+r.width.tab>a&&(l=Math.min(l,t),n+r.width.tab>r.truncation.limit)){d=!0;break}n+=r.width.tab,t+=1;continue}if(N.lastIndex=t,N.test(e)){const h=(N.lastIndex-t)*r.width.regular;if(n+h>a){const m=Math.floor((a-n)/r.width.regular);if(l=Math.min(l,t+m),n+h>r.truncation.limit){d=!0;break}}n+=h,t=N.lastIndex;continue}if((p<=31||p>=127&&p<=159)&&(j.lastIndex=t,j.test(e))){const h=(j.lastIndex-t)*r.width.control;if(n+h>a&&(l=Math.min(l,t+Math.floor((a-n)/r.width.control)),n+h>r.truncation.limit)){d=!0;break}n+=h,t=j.lastIndex;continue}if(q.lastIndex=t,q.test(e)){if(n+r.width.emoji>a&&(l=Math.min(l,t),n+r.width.emoji>r.truncation.limit)){d=!0;break}n+=r.width.emoji,t=q.lastIndex;continue}const b=e.codePointAt(t)??0;if(ze(b)){t+=b>65535?2:1;continue}let f;if(s)f=qe(b,r);else switch(P(b)){case"control":{f=r.width.control;break}case"latin":{f=r.width.regular;break}case"wide":{f=r.width.wide;break}case"zero":{f=0;break}default:switch(A(b)){case"ambiguous":{f=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{f=r.width.fullWidth;break}case"wide":{f=r.width.wide;break}default:f=r.width.regular}}if(n+f>a&&(l=Math.min(l,t),n+f>r.truncation.limit)){d=!0;break}n+=f,t+=b>65535?2:1}let y=n,J=!1;return d&&r.truncation.limit>=r.truncation.ellipsisWidth&&(y=r.truncation.limit,J=!0),{ellipsed:J,index:d?l:o,truncated:d,width:y}},"getStringTruncatedWidth");var Ve=Object.defineProperty,Ye=u((e,i)=>Ve(e,"name",{value:i,configurable:!0}),"i$1"),De=Object.defineProperty,Je=Ye((e,i)=>De(e,"name",{value:i,configurable:!0}),"e"),Ue=Object.defineProperty,Ge=Je((e,i)=>Ue(e,"name",{value:i,configurable:!0}),"r");const Ke=Ge((e,i={})=>z(e,{...i,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,"getStringWidth");var Qe=Object.defineProperty,Xe=u((e,i)=>Qe(e,"name",{value:i,configurable:!0}),"s");const W=new Map,Ze=500,c=Xe(e=>{if(!e||e==="")return"";const i=W.get(e);if(i!==void 0)return i;const r=de(Object.assign([],{raw:[e]}));if(W.size>=Ze){const a=W.keys().next().value;a!==void 0&&W.delete(a)}return W.set(e,r),r},"templateFormat");var ei=Object.defineProperty,ii=u((e,i)=>ei(e,"name",{value:i,configurable:!0}),"t$1");const M=ii(()=>{const e=ue().CEREBRO_TERMINAL_WIDTH;if(e===void 0)return;const i=Number.parseInt(e,10);if(!(Number.isNaN(i)||i<=0))return i},"getTerminalWidth");var ri=Object.defineProperty,ti=u((e,i)=>ri(e,"name",{value:i,configurable:!0}),"t");class ie{static{u(this,"n")}static{ti(this,"BaseSection")}lines;constructor(){this.lines=[]}add(i){this.lines.push(i)}toString(){return this.lines.join(ce.EOL)}header(i){this.add(fe(i)),this.lines.push("")}}var ni=Object.defineProperty,k=u((e,i)=>ni(e,"name",{value:i,configurable:!0}),"g");const ai=k(e=>e!==void 0&&e>0?e:le().columns,"resolveTerminalWidth"),oi=k((e,i,r,a)=>{if(e.length===0||e.some(d=>d.length!==2))return;let o=0;for(const d of e){const w=d[0];if(w===void 0)continue;const y=Ke(w);y>o&&(o=y)}if(o===0)return;const s=r+a,t=o+s,n=20+s;if(t+n>i)return;const l=i-t;return[t,l]},"computeColumnWidths");class si extends ie{static{u(this,"S")}static{k(this,"ContentSection")}constructor(i){if(super(),i.header&&this.header(c(i.header)),i.content){if(i.raw)if(Array.isArray(i.content)&&i.content.every(r=>typeof r=="string"))i.content.forEach(r=>{Array.isArray(r)?r.forEach(a=>{this.add(c(a))}):this.add(c(r))});else if(typeof i.content=="string")this.add(c(i.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(i.content));this.add("")}}getContentLines(i){if(typeof i=="string"){const r=x({showHeader:!1,style:{border:E,paddingLeft:4,paddingRight:1},terminalWidth:M(),truncateOverflow:!1,wordWrap:!0});return r.addRow([c(i)]),r.toString()}if(Array.isArray(i)&&i.every(r=>typeof r=="string"||Array.isArray(r)&&r.every(a=>typeof a=="string"))){const r=ai(M()),a=k(n=>Array.isArray(n)?n.map(l=>c(l)):[c(n)],"formatRow"),o=i.map(n=>a(n)),s=oi(o,r,4,1),t=x({columnWidths:s,showHeader:!1,style:{border:E,paddingLeft:4,paddingRight:1},terminalWidth:r,truncateOverflow:!1,wordWrap:!0});return o.forEach(n=>{s!==void 0&&n.length===2?t.addRow([{content:n[0],wordWrap:!1},n[1]]):t.addRow(n)}),t.toString()}if(typeof i=="object"){const r=i;if(!r.options||!r.data)throw new Error(`Must have an "options" or "data" property
|
|
2
|
-
${JSON.stringify(i)}`);const a=x({showHeader:!1,style:{border:E,paddingLeft:4,paddingRight:1},terminalWidth:M(),truncateOverflow:!1,wordWrap:!0});return r.data.forEach(o=>{Array.isArray(o)?a.addRow(o.map(s=>c(s))):a.addRow([c(o)])}),a.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object:
|
|
3
|
-
|
|
4
|
-
${JSON.stringify(i)}`)}}var li=Object.defineProperty,di=u((e,i)=>li(e,"name",{value:i,configurable:!0}),"m");class ui extends ie{static{u(this,"O")}static{di(this,"OptionListSection")}constructor(i){super();let r=i.optionList??[];const a=Array.isArray(i.hide)?i.hide:[i.hide].filter(t=>typeof t=="string"),o=Array.isArray(i.group)?i.group:[i.group].filter(t=>typeof t=="string");a.length>0&&(r=r.filter(t=>!a.includes(t.name))),i.header&&this.header(c(i.header)),o.length>0&&(r=r.filter(t=>{const n=t,l=o.includes("_none")&&!n.group,d=n.group,w=this.intersect(Array.isArray(d)?d:[d],o);return l||w?t:void 0}));const s=x({showHeader:!1,style:{border:E,paddingLeft:2,paddingRight:1,...i.tableOptions?.style},terminalWidth:M()??i.tableOptions?.terminalWidth,truncateOverflow:!1,wordWrap:i.tableOptions?.wordWrap??!0,...i.tableOptions});r.forEach(t=>{const n=t;s.addRow([this.getOptionNames(n,i.reverseNameOrder??!1,i.isArgument??!1),c(n.description)])}),this.add(s.toString()),this.lines.push("")}getOptionNames(i,r,a){if(!i.name)throw new TypeError("Invalid option definition, name is required.");let o=i.type?i.type.name.toLowerCase():"string";const s=i.multiple||i.lazyMultiple?"[]":"";o=c(i.typeLabel??`{underline ${o}${s}}`);let t;if(i.alias)if(i.name){const n=a?i.name:`{yellow --${i.name}}`;t=c(r?`{bold ${n}}, {bold -${i.alias}} ${o}`:`{bold -${i.alias}}, {bold ${n}} ${o}`)}else r?t=c(`{bold -${i.alias}} ${o}`):t=c(`{bold -${i.alias}} ${o}`);else t=c(`{bold ${a?i.name:`{yellow --${i.name}}`}} ${o}`);return t}intersect(i,r){return i.some(a=>r.includes(a))}}var ci=Object.defineProperty,fi=u((e,i)=>ci(e,"name",{value:i,configurable:!0}),"o");const Wi=fi(e=>(Array.isArray(e)?e:[e]).length===0?"":`
|
|
5
|
-
${e.map(i=>i.optionList?new ui(i).toString():new si(i).toString()).join(`
|
|
6
|
-
`)}`,"commandLineUsage");export{c as f,Wi as p};
|