@herodevs/cli 1.0.0-beta.2 → 1.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -325
- package/bin/dev.js +6 -6
- package/bin/run.js +3 -2
- package/dist/api/client.d.ts +0 -2
- package/dist/api/client.js +19 -18
- package/dist/api/nes/nes.client.d.ts +4 -0
- package/dist/api/nes/nes.client.js +11 -0
- package/dist/api/queries/nes/sbom.js +5 -0
- package/dist/api/types/nes.types.d.ts +17 -3
- package/dist/api/types/nes.types.js +11 -1
- package/dist/commands/report/committers.d.ts +3 -2
- package/dist/commands/report/committers.js +75 -33
- package/dist/commands/report/purls.d.ts +4 -2
- package/dist/commands/report/purls.js +51 -31
- package/dist/commands/scan/eol.d.ts +13 -4
- package/dist/commands/scan/eol.js +112 -37
- package/dist/commands/scan/sbom.d.ts +4 -1
- package/dist/commands/scan/sbom.js +86 -33
- package/dist/hooks/prerun.js +8 -0
- package/dist/service/committers.svc.js +24 -3
- package/dist/service/eol/cdx.svc.d.ts +52 -0
- package/dist/service/eol/cdx.svc.js +58 -62
- package/dist/service/eol/eol.svc.d.ts +0 -21
- package/dist/service/eol/eol.svc.js +2 -62
- package/dist/service/eol/sbom.worker.d.ts +1 -0
- package/dist/service/eol/sbom.worker.js +26 -0
- package/dist/service/error.svc.d.ts +8 -0
- package/dist/service/error.svc.js +28 -0
- package/dist/service/log.svc.d.ts +5 -8
- package/dist/service/log.svc.js +5 -18
- package/dist/service/nes/nes.svc.js +4 -3
- package/dist/service/purls.svc.js +1 -1
- package/dist/ui/date.ui.d.ts +1 -0
- package/dist/ui/date.ui.js +15 -0
- package/dist/ui/eol.ui.d.ts +4 -3
- package/dist/ui/eol.ui.js +56 -15
- package/dist/ui/shared.us.d.ts +3 -0
- package/dist/ui/shared.us.js +13 -0
- package/package.json +13 -14
- package/dist/hooks/init/update.d.ts +0 -2
- package/dist/hooks/init/update.js +0 -5
- package/dist/hooks/prerun/CommandContextHook.js +0 -8
- package/dist/service/line.svc.d.ts +0 -24
- package/dist/service/line.svc.js +0 -61
- /package/dist/hooks/{prerun/CommandContextHook.d.ts → prerun.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ $ npm install -g @herodevs/cli
|
|
|
16
16
|
$ hd COMMAND
|
|
17
17
|
running command...
|
|
18
18
|
$ hd (--version)
|
|
19
|
-
@herodevs/cli/1.
|
|
19
|
+
@herodevs/cli/1.2.0-beta.1 linux-x64 node-v22.14.0
|
|
20
20
|
$ hd --help [COMMAND]
|
|
21
21
|
USAGE
|
|
22
22
|
$ hd COMMAND
|
|
@@ -26,16 +26,6 @@ USAGE
|
|
|
26
26
|
## Commands
|
|
27
27
|
<!-- commands -->
|
|
28
28
|
* [`hd help [COMMAND]`](#hd-help-command)
|
|
29
|
-
* [`hd plugins`](#hd-plugins)
|
|
30
|
-
* [`hd plugins add PLUGIN`](#hd-plugins-add-plugin)
|
|
31
|
-
* [`hd plugins:inspect PLUGIN...`](#hd-pluginsinspect-plugin)
|
|
32
|
-
* [`hd plugins install PLUGIN`](#hd-plugins-install-plugin)
|
|
33
|
-
* [`hd plugins link PATH`](#hd-plugins-link-path)
|
|
34
|
-
* [`hd plugins remove [PLUGIN]`](#hd-plugins-remove-plugin)
|
|
35
|
-
* [`hd plugins reset`](#hd-plugins-reset)
|
|
36
|
-
* [`hd plugins uninstall [PLUGIN]`](#hd-plugins-uninstall-plugin)
|
|
37
|
-
* [`hd plugins unlink [PLUGIN]`](#hd-plugins-unlink-plugin)
|
|
38
|
-
* [`hd plugins update`](#hd-plugins-update)
|
|
39
29
|
* [`hd report committers`](#hd-report-committers)
|
|
40
30
|
* [`hd report purls`](#hd-report-purls)
|
|
41
31
|
* [`hd scan eol`](#hd-scan-eol)
|
|
@@ -61,309 +51,18 @@ DESCRIPTION
|
|
|
61
51
|
|
|
62
52
|
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.27/src/commands/help.ts)_
|
|
63
53
|
|
|
64
|
-
## `hd plugins`
|
|
65
|
-
|
|
66
|
-
List installed plugins.
|
|
67
|
-
|
|
68
|
-
```
|
|
69
|
-
USAGE
|
|
70
|
-
$ hd plugins [--json] [--core]
|
|
71
|
-
|
|
72
|
-
FLAGS
|
|
73
|
-
--core Show core plugins.
|
|
74
|
-
|
|
75
|
-
GLOBAL FLAGS
|
|
76
|
-
--json Format output as json.
|
|
77
|
-
|
|
78
|
-
DESCRIPTION
|
|
79
|
-
List installed plugins.
|
|
80
|
-
|
|
81
|
-
EXAMPLES
|
|
82
|
-
$ hd plugins
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.36/src/commands/plugins/index.ts)_
|
|
86
|
-
|
|
87
|
-
## `hd plugins add PLUGIN`
|
|
88
|
-
|
|
89
|
-
Installs a plugin into hd.
|
|
90
|
-
|
|
91
|
-
```
|
|
92
|
-
USAGE
|
|
93
|
-
$ hd plugins add PLUGIN... [--json] [-f] [-h] [-s | -v]
|
|
94
|
-
|
|
95
|
-
ARGUMENTS
|
|
96
|
-
PLUGIN... Plugin to install.
|
|
97
|
-
|
|
98
|
-
FLAGS
|
|
99
|
-
-f, --force Force npm to fetch remote resources even if a local copy exists on disk.
|
|
100
|
-
-h, --help Show CLI help.
|
|
101
|
-
-s, --silent Silences npm output.
|
|
102
|
-
-v, --verbose Show verbose npm output.
|
|
103
|
-
|
|
104
|
-
GLOBAL FLAGS
|
|
105
|
-
--json Format output as json.
|
|
106
|
-
|
|
107
|
-
DESCRIPTION
|
|
108
|
-
Installs a plugin into hd.
|
|
109
|
-
|
|
110
|
-
Uses npm to install plugins.
|
|
111
|
-
|
|
112
|
-
Installation of a user-installed plugin will override a core plugin.
|
|
113
|
-
|
|
114
|
-
Use the HD_NPM_LOG_LEVEL environment variable to set the npm loglevel.
|
|
115
|
-
Use the HD_NPM_REGISTRY environment variable to set the npm registry.
|
|
116
|
-
|
|
117
|
-
ALIASES
|
|
118
|
-
$ hd plugins add
|
|
119
|
-
|
|
120
|
-
EXAMPLES
|
|
121
|
-
Install a plugin from npm registry.
|
|
122
|
-
|
|
123
|
-
$ hd plugins add myplugin
|
|
124
|
-
|
|
125
|
-
Install a plugin from a github url.
|
|
126
|
-
|
|
127
|
-
$ hd plugins add https://github.com/someuser/someplugin
|
|
128
|
-
|
|
129
|
-
Install a plugin from a github slug.
|
|
130
|
-
|
|
131
|
-
$ hd plugins add someuser/someplugin
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
## `hd plugins:inspect PLUGIN...`
|
|
135
|
-
|
|
136
|
-
Displays installation properties of a plugin.
|
|
137
|
-
|
|
138
|
-
```
|
|
139
|
-
USAGE
|
|
140
|
-
$ hd plugins inspect PLUGIN...
|
|
141
|
-
|
|
142
|
-
ARGUMENTS
|
|
143
|
-
PLUGIN... [default: .] Plugin to inspect.
|
|
144
|
-
|
|
145
|
-
FLAGS
|
|
146
|
-
-h, --help Show CLI help.
|
|
147
|
-
-v, --verbose
|
|
148
|
-
|
|
149
|
-
GLOBAL FLAGS
|
|
150
|
-
--json Format output as json.
|
|
151
|
-
|
|
152
|
-
DESCRIPTION
|
|
153
|
-
Displays installation properties of a plugin.
|
|
154
|
-
|
|
155
|
-
EXAMPLES
|
|
156
|
-
$ hd plugins inspect myplugin
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.36/src/commands/plugins/inspect.ts)_
|
|
160
|
-
|
|
161
|
-
## `hd plugins install PLUGIN`
|
|
162
|
-
|
|
163
|
-
Installs a plugin into hd.
|
|
164
|
-
|
|
165
|
-
```
|
|
166
|
-
USAGE
|
|
167
|
-
$ hd plugins install PLUGIN... [--json] [-f] [-h] [-s | -v]
|
|
168
|
-
|
|
169
|
-
ARGUMENTS
|
|
170
|
-
PLUGIN... Plugin to install.
|
|
171
|
-
|
|
172
|
-
FLAGS
|
|
173
|
-
-f, --force Force npm to fetch remote resources even if a local copy exists on disk.
|
|
174
|
-
-h, --help Show CLI help.
|
|
175
|
-
-s, --silent Silences npm output.
|
|
176
|
-
-v, --verbose Show verbose npm output.
|
|
177
|
-
|
|
178
|
-
GLOBAL FLAGS
|
|
179
|
-
--json Format output as json.
|
|
180
|
-
|
|
181
|
-
DESCRIPTION
|
|
182
|
-
Installs a plugin into hd.
|
|
183
|
-
|
|
184
|
-
Uses npm to install plugins.
|
|
185
|
-
|
|
186
|
-
Installation of a user-installed plugin will override a core plugin.
|
|
187
|
-
|
|
188
|
-
Use the HD_NPM_LOG_LEVEL environment variable to set the npm loglevel.
|
|
189
|
-
Use the HD_NPM_REGISTRY environment variable to set the npm registry.
|
|
190
|
-
|
|
191
|
-
ALIASES
|
|
192
|
-
$ hd plugins add
|
|
193
|
-
|
|
194
|
-
EXAMPLES
|
|
195
|
-
Install a plugin from npm registry.
|
|
196
|
-
|
|
197
|
-
$ hd plugins install myplugin
|
|
198
|
-
|
|
199
|
-
Install a plugin from a github url.
|
|
200
|
-
|
|
201
|
-
$ hd plugins install https://github.com/someuser/someplugin
|
|
202
|
-
|
|
203
|
-
Install a plugin from a github slug.
|
|
204
|
-
|
|
205
|
-
$ hd plugins install someuser/someplugin
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.36/src/commands/plugins/install.ts)_
|
|
209
|
-
|
|
210
|
-
## `hd plugins link PATH`
|
|
211
|
-
|
|
212
|
-
Links a plugin into the CLI for development.
|
|
213
|
-
|
|
214
|
-
```
|
|
215
|
-
USAGE
|
|
216
|
-
$ hd plugins link PATH [-h] [--install] [-v]
|
|
217
|
-
|
|
218
|
-
ARGUMENTS
|
|
219
|
-
PATH [default: .] path to plugin
|
|
220
|
-
|
|
221
|
-
FLAGS
|
|
222
|
-
-h, --help Show CLI help.
|
|
223
|
-
-v, --verbose
|
|
224
|
-
--[no-]install Install dependencies after linking the plugin.
|
|
225
|
-
|
|
226
|
-
DESCRIPTION
|
|
227
|
-
Links a plugin into the CLI for development.
|
|
228
|
-
|
|
229
|
-
Installation of a linked plugin will override a user-installed or core plugin.
|
|
230
|
-
|
|
231
|
-
e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
|
|
232
|
-
command will override the user-installed or core plugin implementation. This is useful for development work.
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
EXAMPLES
|
|
236
|
-
$ hd plugins link myplugin
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.36/src/commands/plugins/link.ts)_
|
|
240
|
-
|
|
241
|
-
## `hd plugins remove [PLUGIN]`
|
|
242
|
-
|
|
243
|
-
Removes a plugin from the CLI.
|
|
244
|
-
|
|
245
|
-
```
|
|
246
|
-
USAGE
|
|
247
|
-
$ hd plugins remove [PLUGIN...] [-h] [-v]
|
|
248
|
-
|
|
249
|
-
ARGUMENTS
|
|
250
|
-
PLUGIN... plugin to uninstall
|
|
251
|
-
|
|
252
|
-
FLAGS
|
|
253
|
-
-h, --help Show CLI help.
|
|
254
|
-
-v, --verbose
|
|
255
|
-
|
|
256
|
-
DESCRIPTION
|
|
257
|
-
Removes a plugin from the CLI.
|
|
258
|
-
|
|
259
|
-
ALIASES
|
|
260
|
-
$ hd plugins unlink
|
|
261
|
-
$ hd plugins remove
|
|
262
|
-
|
|
263
|
-
EXAMPLES
|
|
264
|
-
$ hd plugins remove myplugin
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
## `hd plugins reset`
|
|
268
|
-
|
|
269
|
-
Remove all user-installed and linked plugins.
|
|
270
|
-
|
|
271
|
-
```
|
|
272
|
-
USAGE
|
|
273
|
-
$ hd plugins reset [--hard] [--reinstall]
|
|
274
|
-
|
|
275
|
-
FLAGS
|
|
276
|
-
--hard Delete node_modules and package manager related files in addition to uninstalling plugins.
|
|
277
|
-
--reinstall Reinstall all plugins after uninstalling.
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.36/src/commands/plugins/reset.ts)_
|
|
281
|
-
|
|
282
|
-
## `hd plugins uninstall [PLUGIN]`
|
|
283
|
-
|
|
284
|
-
Removes a plugin from the CLI.
|
|
285
|
-
|
|
286
|
-
```
|
|
287
|
-
USAGE
|
|
288
|
-
$ hd plugins uninstall [PLUGIN...] [-h] [-v]
|
|
289
|
-
|
|
290
|
-
ARGUMENTS
|
|
291
|
-
PLUGIN... plugin to uninstall
|
|
292
|
-
|
|
293
|
-
FLAGS
|
|
294
|
-
-h, --help Show CLI help.
|
|
295
|
-
-v, --verbose
|
|
296
|
-
|
|
297
|
-
DESCRIPTION
|
|
298
|
-
Removes a plugin from the CLI.
|
|
299
|
-
|
|
300
|
-
ALIASES
|
|
301
|
-
$ hd plugins unlink
|
|
302
|
-
$ hd plugins remove
|
|
303
|
-
|
|
304
|
-
EXAMPLES
|
|
305
|
-
$ hd plugins uninstall myplugin
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.36/src/commands/plugins/uninstall.ts)_
|
|
309
|
-
|
|
310
|
-
## `hd plugins unlink [PLUGIN]`
|
|
311
|
-
|
|
312
|
-
Removes a plugin from the CLI.
|
|
313
|
-
|
|
314
|
-
```
|
|
315
|
-
USAGE
|
|
316
|
-
$ hd plugins unlink [PLUGIN...] [-h] [-v]
|
|
317
|
-
|
|
318
|
-
ARGUMENTS
|
|
319
|
-
PLUGIN... plugin to uninstall
|
|
320
|
-
|
|
321
|
-
FLAGS
|
|
322
|
-
-h, --help Show CLI help.
|
|
323
|
-
-v, --verbose
|
|
324
|
-
|
|
325
|
-
DESCRIPTION
|
|
326
|
-
Removes a plugin from the CLI.
|
|
327
|
-
|
|
328
|
-
ALIASES
|
|
329
|
-
$ hd plugins unlink
|
|
330
|
-
$ hd plugins remove
|
|
331
|
-
|
|
332
|
-
EXAMPLES
|
|
333
|
-
$ hd plugins unlink myplugin
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
## `hd plugins update`
|
|
337
|
-
|
|
338
|
-
Update installed plugins.
|
|
339
|
-
|
|
340
|
-
```
|
|
341
|
-
USAGE
|
|
342
|
-
$ hd plugins update [-h] [-v]
|
|
343
|
-
|
|
344
|
-
FLAGS
|
|
345
|
-
-h, --help Show CLI help.
|
|
346
|
-
-v, --verbose
|
|
347
|
-
|
|
348
|
-
DESCRIPTION
|
|
349
|
-
Update installed plugins.
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.36/src/commands/plugins/update.ts)_
|
|
353
|
-
|
|
354
54
|
## `hd report committers`
|
|
355
55
|
|
|
356
56
|
Generate report of committers to a git repository
|
|
357
57
|
|
|
358
58
|
```
|
|
359
59
|
USAGE
|
|
360
|
-
$ hd report committers [--json] [-m <value>] [-
|
|
60
|
+
$ hd report committers [--json] [-m <value>] [-c] [-s]
|
|
361
61
|
|
|
362
62
|
FLAGS
|
|
363
|
-
-
|
|
364
|
-
-
|
|
365
|
-
|
|
366
|
-
-s, --save Save the committers report as nes.committers.<output>
|
|
63
|
+
-c, --csv Output in CSV format
|
|
64
|
+
-m, --months=<value> [default: 12] The number of months of git history to review
|
|
65
|
+
-s, --save Save the committers report as nes.committers.<output>
|
|
367
66
|
|
|
368
67
|
GLOBAL FLAGS
|
|
369
68
|
--json Format output as json.
|
|
@@ -374,14 +73,14 @@ DESCRIPTION
|
|
|
374
73
|
EXAMPLES
|
|
375
74
|
$ hd report committers
|
|
376
75
|
|
|
377
|
-
$ hd report committers
|
|
76
|
+
$ hd report committers --csv -s
|
|
378
77
|
|
|
379
|
-
$ hd report committers --
|
|
78
|
+
$ hd report committers --json
|
|
380
79
|
|
|
381
|
-
$ hd report committers --
|
|
80
|
+
$ hd report committers --csv
|
|
382
81
|
```
|
|
383
82
|
|
|
384
|
-
_See code: [src/commands/report/committers.ts](https://github.com/herodevs/cli/blob/v1.
|
|
83
|
+
_See code: [src/commands/report/committers.ts](https://github.com/herodevs/cli/blob/v1.2.0-beta.1/src/commands/report/committers.ts)_
|
|
385
84
|
|
|
386
85
|
## `hd report purls`
|
|
387
86
|
|
|
@@ -389,14 +88,13 @@ Generate a list of purls from a sbom
|
|
|
389
88
|
|
|
390
89
|
```
|
|
391
90
|
USAGE
|
|
392
|
-
$ hd report purls [--json] [-f <value>] [-d <value>] [-s] [-
|
|
91
|
+
$ hd report purls [--json] [-f <value>] [-d <value>] [-s] [-c]
|
|
393
92
|
|
|
394
93
|
FLAGS
|
|
395
|
-
-
|
|
396
|
-
-
|
|
397
|
-
-
|
|
398
|
-
|
|
399
|
-
-s, --save Save the list of purls as nes.purls.<output>
|
|
94
|
+
-c, --csv Save output in CSV format (only applies when using --save)
|
|
95
|
+
-d, --dir=<value> The directory to scan in order to create a cyclonedx sbom
|
|
96
|
+
-f, --file=<value> The file path of an existing cyclonedx sbom to scan for EOL
|
|
97
|
+
-s, --save Save the list of purls as nes.purls.<output>
|
|
400
98
|
|
|
401
99
|
GLOBAL FLAGS
|
|
402
100
|
--json Format output as json.
|
|
@@ -405,16 +103,18 @@ DESCRIPTION
|
|
|
405
103
|
Generate a list of purls from a sbom
|
|
406
104
|
|
|
407
105
|
EXAMPLES
|
|
106
|
+
$ hd report purls --json -s
|
|
107
|
+
|
|
408
108
|
$ hd report purls --dir=./my-project
|
|
409
109
|
|
|
410
110
|
$ hd report purls --file=path/to/sbom.json
|
|
411
111
|
|
|
412
112
|
$ hd report purls --dir=./my-project --save
|
|
413
113
|
|
|
414
|
-
$ hd report purls --save --
|
|
114
|
+
$ hd report purls --save --csv
|
|
415
115
|
```
|
|
416
116
|
|
|
417
|
-
_See code: [src/commands/report/purls.ts](https://github.com/herodevs/cli/blob/v1.
|
|
117
|
+
_See code: [src/commands/report/purls.ts](https://github.com/herodevs/cli/blob/v1.2.0-beta.1/src/commands/report/purls.ts)_
|
|
418
118
|
|
|
419
119
|
## `hd scan eol`
|
|
420
120
|
|
|
@@ -422,12 +122,14 @@ Scan a given sbom for EOL data
|
|
|
422
122
|
|
|
423
123
|
```
|
|
424
124
|
USAGE
|
|
425
|
-
$ hd scan eol [--json] [-f <value>] [-d <value>] [-s]
|
|
125
|
+
$ hd scan eol [--json] [-f <value>] [-d <value>] [-s] [-a] [-c]
|
|
426
126
|
|
|
427
127
|
FLAGS
|
|
428
|
-
-
|
|
429
|
-
-
|
|
430
|
-
-
|
|
128
|
+
-a, --all Show all components (default is EOL and LTS only)
|
|
129
|
+
-c, --getCustomerSupport Get Never-Ending Support for End-of-Life components
|
|
130
|
+
-d, --dir=<value> The directory to scan in order to create a cyclonedx sbom
|
|
131
|
+
-f, --file=<value> The file path of an existing cyclonedx sbom to scan for EOL
|
|
132
|
+
-s, --save Save the generated SBOM as nes.sbom.json in the scanned directory
|
|
431
133
|
|
|
432
134
|
GLOBAL FLAGS
|
|
433
135
|
--json Format output as json.
|
|
@@ -439,9 +141,11 @@ EXAMPLES
|
|
|
439
141
|
$ hd scan eol --dir=./my-project
|
|
440
142
|
|
|
441
143
|
$ hd scan eol --file=path/to/sbom.json
|
|
144
|
+
|
|
145
|
+
$ hd scan eol -a --dir=./my-project
|
|
442
146
|
```
|
|
443
147
|
|
|
444
|
-
_See code: [src/commands/scan/eol.ts](https://github.com/herodevs/cli/blob/v1.
|
|
148
|
+
_See code: [src/commands/scan/eol.ts](https://github.com/herodevs/cli/blob/v1.2.0-beta.1/src/commands/scan/eol.ts)_
|
|
445
149
|
|
|
446
150
|
## `hd scan sbom`
|
|
447
151
|
|
|
@@ -449,9 +153,10 @@ Scan a SBOM for purls
|
|
|
449
153
|
|
|
450
154
|
```
|
|
451
155
|
USAGE
|
|
452
|
-
$ hd scan sbom [--json] [-f <value>] [-d <value>] [-s]
|
|
156
|
+
$ hd scan sbom [--json] [-f <value>] [-d <value>] [-s] [-b]
|
|
453
157
|
|
|
454
158
|
FLAGS
|
|
159
|
+
-b, --background Run the scan in the background
|
|
455
160
|
-d, --dir=<value> The directory to scan in order to create a cyclonedx sbom
|
|
456
161
|
-f, --file=<value> The file path of an existing cyclonedx sbom to scan for EOL
|
|
457
162
|
-s, --save Save the generated SBOM as nes.sbom.json in the scanned directory
|
|
@@ -468,5 +173,5 @@ EXAMPLES
|
|
|
468
173
|
$ hd scan sbom --file=path/to/sbom.json
|
|
469
174
|
```
|
|
470
175
|
|
|
471
|
-
_See code: [src/commands/scan/sbom.ts](https://github.com/herodevs/cli/blob/v1.
|
|
176
|
+
_See code: [src/commands/scan/sbom.ts](https://github.com/herodevs/cli/blob/v1.2.0-beta.1/src/commands/scan/sbom.ts)_
|
|
472
177
|
<!-- commandsstop -->
|
package/bin/dev.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
import { execute } from '@oclif/core';
|
|
4
|
+
|
|
5
|
+
// Localhost
|
|
3
6
|
process.env.GRAPHQL_HOST = 'http://localhost:3000';
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
await oclif.execute({ development: true, dir: import.meta.dirname });
|
|
8
|
-
console.log('\n\n\n=> OCLIF: Command complete.');
|
|
9
|
-
}
|
|
8
|
+
// Dev
|
|
9
|
+
// process.env.GRAPHQL_HOST = 'https://api.dev.nes.herodevs.com';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
await execute({ development: true, dir: import.meta.url });
|
package/bin/run.js
CHANGED
package/dist/api/client.d.ts
CHANGED
|
@@ -4,8 +4,6 @@ export interface ApolloHelper {
|
|
|
4
4
|
query<T, V extends apollo.OperationVariables | undefined = undefined>(query: apollo.DocumentNode, variables?: V): Promise<apollo.ApolloQueryResult<T>>;
|
|
5
5
|
}
|
|
6
6
|
export declare const createApollo: (url: string) => apollo.ApolloClient<apollo.NormalizedCacheObject>;
|
|
7
|
-
export declare class ApolloError extends Error {
|
|
8
|
-
}
|
|
9
7
|
export declare class ApolloClient implements ApolloHelper {
|
|
10
8
|
#private;
|
|
11
9
|
constructor(url: string);
|
package/dist/api/client.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as apollo from '@apollo/client/core/index.js';
|
|
2
|
+
import { ApolloError } from "../service/error.svc.js";
|
|
2
3
|
export const createApollo = (url) => new apollo.ApolloClient({
|
|
3
4
|
cache: new apollo.InMemoryCache({
|
|
4
5
|
addTypename: false,
|
|
@@ -12,31 +13,31 @@ export const createApollo = (url) => new apollo.ApolloClient({
|
|
|
12
13
|
}),
|
|
13
14
|
]),
|
|
14
15
|
});
|
|
15
|
-
export class ApolloError extends Error {
|
|
16
|
-
}
|
|
17
16
|
export class ApolloClient {
|
|
18
17
|
#apollo;
|
|
19
18
|
constructor(url) {
|
|
20
19
|
this.#apollo = createApollo(url);
|
|
21
20
|
}
|
|
22
21
|
async mutate(mutation, variables) {
|
|
23
|
-
|
|
24
|
-
.mutate({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
try {
|
|
23
|
+
return await this.#apollo.mutate({
|
|
24
|
+
mutation,
|
|
25
|
+
variables,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
throw new ApolloError('GraphQL mutation failed', error);
|
|
30
|
+
}
|
|
31
31
|
}
|
|
32
32
|
async query(query, variables) {
|
|
33
|
-
|
|
34
|
-
.query({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
try {
|
|
34
|
+
return await this.#apollo.query({
|
|
35
|
+
query,
|
|
36
|
+
variables,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
throw new ApolloError('GraphQL query failed', error);
|
|
41
|
+
}
|
|
41
42
|
}
|
|
42
43
|
}
|
|
@@ -14,3 +14,7 @@ export declare class NesApolloClient implements NesClient {
|
|
|
14
14
|
mutate<T, V extends Record<string, unknown>>(mutation: apollo.DocumentNode, variables?: V): Promise<apollo.FetchResult<T>>;
|
|
15
15
|
query<T, V extends Record<string, unknown> | undefined>(query: apollo.DocumentNode, variables?: V): Promise<apollo.ApolloQueryResult<T>>;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Uses the purls from the sbom to run the scan.
|
|
19
|
+
*/
|
|
20
|
+
export declare function submitScan(purls: string[]): Promise<ScanResult>;
|
|
@@ -15,3 +15,14 @@ export class NesApolloClient {
|
|
|
15
15
|
return this.#apollo.query(query, variables);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Uses the purls from the sbom to run the scan.
|
|
20
|
+
*/
|
|
21
|
+
export async function submitScan(purls) {
|
|
22
|
+
// NOTE: GRAPHQL_HOST is set in `./bin/dev.js` or tests
|
|
23
|
+
const host = process.env.GRAPHQL_HOST || 'https://api.nes.herodevs.com';
|
|
24
|
+
const path = process.env.GRAPHQL_PATH || '/graphql';
|
|
25
|
+
const url = host + path;
|
|
26
|
+
const client = new NesApolloClient(url);
|
|
27
|
+
return client.scan.sbom(purls);
|
|
28
|
+
}
|
|
@@ -16,20 +16,34 @@ export interface ScanResponseReport {
|
|
|
16
16
|
diagnostics?: Record<string, unknown>;
|
|
17
17
|
message: string;
|
|
18
18
|
success: boolean;
|
|
19
|
+
warnings?: ScanWarning[];
|
|
19
20
|
}
|
|
20
|
-
export
|
|
21
|
+
export declare const VALID_STATUSES: readonly ["UNKNOWN", "OK", "EOL", "LTS"];
|
|
22
|
+
export type ComponentStatus = (typeof VALID_STATUSES)[number];
|
|
23
|
+
export declare const isValidComponentStatus: (status: string) => status is ComponentStatus;
|
|
24
|
+
export declare const validateComponentStatuses: (statuses: string[]) => ComponentStatus[];
|
|
21
25
|
export interface ScanResultComponent {
|
|
22
26
|
info: {
|
|
23
27
|
eolAt: Date | null;
|
|
24
28
|
isEol: boolean;
|
|
29
|
+
daysEol: number | null;
|
|
25
30
|
isUnsafe: boolean;
|
|
31
|
+
status: ComponentStatus;
|
|
26
32
|
};
|
|
27
33
|
purl: string;
|
|
28
|
-
status?: ComponentStatus;
|
|
29
34
|
}
|
|
35
|
+
export interface ScanWarning {
|
|
36
|
+
purl: string;
|
|
37
|
+
message: string;
|
|
38
|
+
type?: string;
|
|
39
|
+
error?: unknown;
|
|
40
|
+
diagnostics?: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
export type ScanResultComponentsMap = Map<string, ScanResultComponent>;
|
|
30
43
|
export interface ScanResult {
|
|
31
|
-
components:
|
|
44
|
+
components: ScanResultComponentsMap;
|
|
32
45
|
diagnostics?: Record<string, unknown>;
|
|
33
46
|
message: string;
|
|
34
47
|
success: boolean;
|
|
48
|
+
warnings: ScanWarning[];
|
|
35
49
|
}
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const VALID_STATUSES = ['UNKNOWN', 'OK', 'EOL', 'LTS'];
|
|
2
|
+
export const isValidComponentStatus = (status) => {
|
|
3
|
+
return VALID_STATUSES.includes(status);
|
|
4
|
+
};
|
|
5
|
+
export const validateComponentStatuses = (statuses) => {
|
|
6
|
+
const validStatuses = statuses.filter(isValidComponentStatus);
|
|
7
|
+
if (validStatuses.length !== statuses.length) {
|
|
8
|
+
throw new Error('Invalid component status provided');
|
|
9
|
+
}
|
|
10
|
+
return validStatuses;
|
|
11
|
+
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
|
+
import { type ReportData } from '../../service/committers.svc.ts';
|
|
2
3
|
export default class Committers extends Command {
|
|
3
4
|
static description: string;
|
|
4
5
|
static enableJsonFlag: boolean;
|
|
5
6
|
static examples: string[];
|
|
6
7
|
static flags: {
|
|
7
8
|
months: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
-
|
|
9
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
10
|
save: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
11
|
};
|
|
11
|
-
run(): Promise<
|
|
12
|
+
run(): Promise<ReportData | string>;
|
|
12
13
|
/**
|
|
13
14
|
* Generates structured report data
|
|
14
15
|
* @param entries - parsed git log output for commits
|