@herodevs/cli 1.5.0-beta.3 → 1.6.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/bin/dev.js +7 -3
- package/bin/main.js +29 -0
- package/bin/run.js +6 -2
- package/dist/service/eol/cdx.svc.d.ts +5 -1
- package/dist/service/purls.svc.d.ts +2 -2
- package/dist/service/purls.svc.js +37 -4
- package/package.json +2 -7
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ $ npm install -g @herodevs/cli
|
|
|
26
26
|
$ hd COMMAND
|
|
27
27
|
running command...
|
|
28
28
|
$ hd (--version)
|
|
29
|
-
@herodevs/cli/1.
|
|
29
|
+
@herodevs/cli/1.6.0-beta.0 linux-x64 node-v22.14.0
|
|
30
30
|
$ hd --help [COMMAND]
|
|
31
31
|
USAGE
|
|
32
32
|
$ hd COMMAND
|
|
@@ -91,7 +91,7 @@ EXAMPLES
|
|
|
91
91
|
$ hd report committers --csv
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
_See code: [src/commands/report/committers.ts](https://github.com/herodevs/cli/blob/v1.
|
|
94
|
+
_See code: [src/commands/report/committers.ts](https://github.com/herodevs/cli/blob/v1.6.0-beta.0/src/commands/report/committers.ts)_
|
|
95
95
|
|
|
96
96
|
## `hd report purls`
|
|
97
97
|
|
|
@@ -125,7 +125,7 @@ EXAMPLES
|
|
|
125
125
|
$ hd report purls --save --csv
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
-
_See code: [src/commands/report/purls.ts](https://github.com/herodevs/cli/blob/v1.
|
|
128
|
+
_See code: [src/commands/report/purls.ts](https://github.com/herodevs/cli/blob/v1.6.0-beta.0/src/commands/report/purls.ts)_
|
|
129
129
|
|
|
130
130
|
## `hd scan eol`
|
|
131
131
|
|
|
@@ -159,7 +159,7 @@ EXAMPLES
|
|
|
159
159
|
$ hd scan eol -a --dir=./my-project
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
-
_See code: [src/commands/scan/eol.ts](https://github.com/herodevs/cli/blob/v1.
|
|
162
|
+
_See code: [src/commands/scan/eol.ts](https://github.com/herodevs/cli/blob/v1.6.0-beta.0/src/commands/scan/eol.ts)_
|
|
163
163
|
|
|
164
164
|
## `hd scan sbom`
|
|
165
165
|
|
|
@@ -187,7 +187,7 @@ EXAMPLES
|
|
|
187
187
|
$ hd scan sbom --file=path/to/sbom.json
|
|
188
188
|
```
|
|
189
189
|
|
|
190
|
-
_See code: [src/commands/scan/sbom.ts](https://github.com/herodevs/cli/blob/v1.
|
|
190
|
+
_See code: [src/commands/scan/sbom.ts](https://github.com/herodevs/cli/blob/v1.6.0-beta.0/src/commands/scan/sbom.ts)_
|
|
191
191
|
|
|
192
192
|
## `hd update [CHANNEL]`
|
|
193
193
|
|
package/bin/dev.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { execute } from '@oclif/core';
|
|
4
|
-
|
|
5
3
|
// Localhost
|
|
6
4
|
// process.env.GRAPHQL_HOST = 'http://localhost:3000';
|
|
7
5
|
|
|
@@ -11,4 +9,10 @@ process.env.GRAPHQL_HOST = 'https://api.dev.nes.herodevs.com';
|
|
|
11
9
|
// Prod
|
|
12
10
|
// process.env.GRAPHQL_HOST = 'https://api.nes.herodevs.com';
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
import main from './main.js';
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
await main(false);
|
|
16
|
+
} catch (error) {
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
package/bin/main.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { parseArgs } from 'node:util';
|
|
2
|
+
import { execute } from '@oclif/core';
|
|
3
|
+
|
|
4
|
+
async function main(isProduction = false) {
|
|
5
|
+
const { positionals } = parseArgs({
|
|
6
|
+
allowPositionals: true,
|
|
7
|
+
strict: false, // Don't validate flags
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// If no arguments at all, default to scan:eol -t
|
|
11
|
+
if (positionals.length === 0) {
|
|
12
|
+
process.argv.splice(2, 0, 'scan:eol', '-t');
|
|
13
|
+
}
|
|
14
|
+
// If only flags are provided, set scan:eol as the command for those flags
|
|
15
|
+
else if (positionals.length === 1 && positionals[0].startsWith('-')) {
|
|
16
|
+
process.argv.splice(2, 0, 'scan:eol');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
await execute({
|
|
21
|
+
development: !isProduction,
|
|
22
|
+
dir: new URL('./dev.js', import.meta.url),
|
|
23
|
+
});
|
|
24
|
+
} catch (error) {
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default main;
|
package/bin/run.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { CdxGenOptions } from './eol.svc.ts';
|
|
2
|
+
export interface SbomDependency {
|
|
3
|
+
ref: string;
|
|
4
|
+
dependsOn: string[];
|
|
5
|
+
}
|
|
2
6
|
export interface SbomEntry {
|
|
3
7
|
group: string;
|
|
4
8
|
name: string;
|
|
@@ -7,7 +11,7 @@ export interface SbomEntry {
|
|
|
7
11
|
}
|
|
8
12
|
export interface Sbom {
|
|
9
13
|
components: SbomEntry[];
|
|
10
|
-
dependencies:
|
|
14
|
+
dependencies: SbomDependency[];
|
|
11
15
|
}
|
|
12
16
|
export declare const SBOM_DEFAULT__OPTIONS: {
|
|
13
17
|
$0: string;
|
|
@@ -12,9 +12,9 @@ export declare function formatCsvValue(value: string): string;
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function getPurlOutput(purls: string[], output: string): string;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Extract all PURLs from a CycloneDX SBOM, including components and dependencies
|
|
16
16
|
*/
|
|
17
|
-
export declare function extractPurls(sbom: Sbom):
|
|
17
|
+
export declare function extractPurls(sbom: Sbom): string[];
|
|
18
18
|
/**
|
|
19
19
|
* Parse a purls file in either JSON or text format, including the format of
|
|
20
20
|
* eol.purls.json - { purls: [ 'pkg:npm/express@4.18.2', 'pkg:npm/react@18.3.1' ] }
|
|
@@ -21,11 +21,44 @@ export function getPurlOutput(purls, output) {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Extract PURLs from components recursively
|
|
25
25
|
*/
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
26
|
+
function extractPurlsFromComponents(components, purlSet) {
|
|
27
|
+
for (const component of components) {
|
|
28
|
+
if (component.purl) {
|
|
29
|
+
purlSet.add(component.purl);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Extract PURLs from dependencies
|
|
35
|
+
*/
|
|
36
|
+
function extractPurlsFromDependencies(dependencies, purlSet) {
|
|
37
|
+
for (const dependency of dependencies) {
|
|
38
|
+
if (dependency.ref) {
|
|
39
|
+
purlSet.add(dependency.ref);
|
|
40
|
+
}
|
|
41
|
+
if (dependency.dependsOn) {
|
|
42
|
+
for (const dep of dependency.dependsOn) {
|
|
43
|
+
purlSet.add(dep);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Extract all PURLs from a CycloneDX SBOM, including components and dependencies
|
|
50
|
+
*/
|
|
51
|
+
export function extractPurls(sbom) {
|
|
52
|
+
const purlSet = new Set();
|
|
53
|
+
// Extract from direct components
|
|
54
|
+
if (sbom.components) {
|
|
55
|
+
extractPurlsFromComponents(sbom.components, purlSet);
|
|
56
|
+
}
|
|
57
|
+
// Extract from dependencies
|
|
58
|
+
if (sbom.dependencies) {
|
|
59
|
+
extractPurlsFromDependencies(sbom.dependencies, purlSet);
|
|
60
|
+
}
|
|
61
|
+
return Array.from(purlSet);
|
|
29
62
|
}
|
|
30
63
|
/**
|
|
31
64
|
* Parse a purls file in either JSON or text format, including the format of
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herodevs/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0-beta.0",
|
|
4
4
|
"author": "HeroDevs, Inc",
|
|
5
5
|
"bin": {
|
|
6
6
|
"hd": "./bin/run.js"
|
|
@@ -26,10 +26,6 @@
|
|
|
26
26
|
"prepack": "oclif manifest && oclif readme",
|
|
27
27
|
"pretest": "npm run lint && npm run typecheck",
|
|
28
28
|
"readme": "npm run ci:fix && npm run build && npm exec oclif readme",
|
|
29
|
-
"release": "./scripts/release.sh",
|
|
30
|
-
"pre:release:publish": "npm run prepack && git add README.md",
|
|
31
|
-
"release:publish:beta": "npm run release -- --publish",
|
|
32
|
-
"release:publish:latest": "npm run release -- --latest --publish",
|
|
33
29
|
"test": "globstar -- node --import tsx --test \"test/**/*.test.ts\"",
|
|
34
30
|
"test:e2e": "globstar -- node --import tsx --test \"e2e/**/*.test.ts\"",
|
|
35
31
|
"typecheck": "tsc --noEmit"
|
|
@@ -57,7 +53,6 @@
|
|
|
57
53
|
"@types/node": "^22",
|
|
58
54
|
"@types/sinon": "^17.0.4",
|
|
59
55
|
"@types/update-notifier": "^6.0.8",
|
|
60
|
-
"commit-and-tag-version": "^12.5.1",
|
|
61
56
|
"globstar": "^1.0.0",
|
|
62
57
|
"oclif": "^4",
|
|
63
58
|
"shx": "^0.4.0",
|
|
@@ -86,7 +81,7 @@
|
|
|
86
81
|
"@oclif/plugin-update"
|
|
87
82
|
],
|
|
88
83
|
"hooks": {
|
|
89
|
-
"init": "./dist/hooks/npm-update-notifier",
|
|
84
|
+
"init": "./dist/hooks/npm-update-notifier.js",
|
|
90
85
|
"prerun": "./dist/hooks/prerun.js"
|
|
91
86
|
},
|
|
92
87
|
"topicSeparator": " ",
|