@herodevs/cli 2.0.0-beta.1 → 2.0.0-beta.11
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 +201 -110
- package/bin/dev.js +1 -4
- package/bin/main.js +3 -3
- package/bin/run.js +1 -1
- package/dist/api/gql-operations.d.ts +2 -0
- package/dist/api/gql-operations.js +36 -0
- package/dist/api/nes.client.d.ts +12 -0
- package/dist/api/nes.client.js +84 -0
- package/dist/commands/scan/eol.d.ts +18 -19
- package/dist/commands/scan/eol.js +214 -142
- package/dist/config/constants.d.ts +9 -3
- package/dist/config/constants.js +19 -3
- package/dist/hooks/finally/finally.d.ts +3 -0
- package/dist/hooks/finally/finally.js +18 -0
- package/dist/hooks/{npm-update-notifier.js → init/00_npm-update-notifier.js} +3 -3
- package/dist/hooks/init/01_initialize_amplitude.d.ts +3 -0
- package/dist/hooks/init/01_initialize_amplitude.js +15 -0
- package/dist/service/analytics.svc.d.ts +27 -0
- package/dist/service/analytics.svc.js +112 -0
- package/dist/service/{eol/cdx.svc.d.ts → cdx.svc.d.ts} +8 -16
- package/dist/service/{eol/cdx.svc.js → cdx.svc.js} +17 -7
- package/dist/service/display.svc.d.ts +30 -0
- package/dist/service/display.svc.js +87 -0
- package/dist/service/file.svc.d.ts +30 -0
- package/dist/service/file.svc.js +115 -0
- package/dist/service/log.svc.d.ts +1 -0
- package/dist/service/log.svc.js +9 -0
- package/dist/service/{eol/sbom.worker.js → sbom.worker.js} +2 -1
- package/dist/utils/strip-typename.d.ts +1 -0
- package/dist/utils/strip-typename.js +15 -0
- package/package.json +33 -22
- package/dist/api/client.d.ts +0 -12
- package/dist/api/client.js +0 -43
- package/dist/api/nes/nes.client.d.ts +0 -23
- package/dist/api/nes/nes.client.js +0 -107
- package/dist/api/queries/nes/sbom.d.ts +0 -3
- package/dist/api/queries/nes/sbom.js +0 -35
- package/dist/api/queries/nes/telemetry.d.ts +0 -2
- package/dist/api/queries/nes/telemetry.js +0 -24
- package/dist/api/types/hd-cli.types.d.ts +0 -30
- package/dist/api/types/hd-cli.types.js +0 -10
- package/dist/api/types/nes.types.d.ts +0 -53
- package/dist/api/types/nes.types.js +0 -1
- package/dist/commands/report/committers.d.ts +0 -23
- package/dist/commands/report/committers.js +0 -146
- package/dist/commands/report/purls.d.ts +0 -15
- package/dist/commands/report/purls.js +0 -84
- package/dist/commands/scan/sbom.d.ts +0 -21
- package/dist/commands/scan/sbom.js +0 -159
- package/dist/service/committers.svc.d.ts +0 -70
- package/dist/service/committers.svc.js +0 -196
- package/dist/service/eol/eol.svc.d.ts +0 -14
- package/dist/service/eol/eol.svc.js +0 -49
- package/dist/service/error.svc.d.ts +0 -8
- package/dist/service/error.svc.js +0 -28
- package/dist/service/nes/nes.svc.d.ts +0 -5
- package/dist/service/nes/nes.svc.js +0 -27
- package/dist/service/purls.svc.d.ts +0 -23
- package/dist/service/purls.svc.js +0 -99
- package/dist/ui/date.ui.d.ts +0 -1
- package/dist/ui/date.ui.js +0 -15
- package/dist/ui/eol.ui.d.ts +0 -15
- package/dist/ui/eol.ui.js +0 -134
- package/dist/ui/shared.ui.d.ts +0 -6
- package/dist/ui/shared.ui.js +0 -16
- /package/dist/hooks/{npm-update-notifier.d.ts → init/00_npm-update-notifier.d.ts} +0 -0
- /package/dist/hooks/{prerun.d.ts → prerun/prerun.d.ts} +0 -0
- /package/dist/hooks/{prerun.js → prerun/prerun.js} +0 -0
- /package/dist/service/{eol/sbom.worker.d.ts → sbom.worker.d.ts} +0 -0
package/dist/ui/date.ui.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export function parseMomentToSimpleDate(momentDate) {
|
|
2
|
-
// Only return empty string for null
|
|
3
|
-
if (momentDate === null)
|
|
4
|
-
return '';
|
|
5
|
-
try {
|
|
6
|
-
const dateObj = new Date(momentDate);
|
|
7
|
-
if (Number.isNaN(dateObj.getTime())) {
|
|
8
|
-
throw new Error('Invalid date');
|
|
9
|
-
}
|
|
10
|
-
return dateObj.toISOString().split('T')[0];
|
|
11
|
-
}
|
|
12
|
-
catch {
|
|
13
|
-
throw new Error('Invalid date');
|
|
14
|
-
}
|
|
15
|
-
}
|
package/dist/ui/eol.ui.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ScanResultComponentsMap } from '../api/types/hd-cli.types.ts';
|
|
2
|
-
import type { ComponentStatus, InsightsEolScanComponent } from '../api/types/nes.types.ts';
|
|
3
|
-
export declare function truncateString(purl: string, maxLength: number): string;
|
|
4
|
-
export declare function colorizeStatus(status: ComponentStatus): string;
|
|
5
|
-
export declare function createStatusDisplay(components: ScanResultComponentsMap, all: boolean): Record<ComponentStatus, string[]>;
|
|
6
|
-
export declare function createTableForStatus(grouped: Record<ComponentStatus, InsightsEolScanComponent[]>, status: ComponentStatus): string;
|
|
7
|
-
export declare function convertComponentToTableRow(component: InsightsEolScanComponent): {
|
|
8
|
-
name: string;
|
|
9
|
-
version: string;
|
|
10
|
-
eol: string;
|
|
11
|
-
daysEol: number | null;
|
|
12
|
-
type: string;
|
|
13
|
-
vulnCount: number | null;
|
|
14
|
-
};
|
|
15
|
-
export declare function groupComponentsByStatus(components: ScanResultComponentsMap): Record<ComponentStatus, InsightsEolScanComponent[]>;
|
package/dist/ui/eol.ui.js
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { ux } from '@oclif/core';
|
|
2
|
-
import { makeTable } from '@oclif/table';
|
|
3
|
-
import { PackageURL } from 'packageurl-js';
|
|
4
|
-
import { config } from "../config/constants.js";
|
|
5
|
-
import { resolvePurlPackageName } from "../service/eol/eol.svc.js";
|
|
6
|
-
import { parseMomentToSimpleDate } from "./date.ui.js";
|
|
7
|
-
import { INDICATORS, MAX_PURL_LENGTH, MAX_TABLE_COLUMN_WIDTH, STATUS_COLORS } from "./shared.ui.js";
|
|
8
|
-
export function truncateString(purl, maxLength) {
|
|
9
|
-
const ellipses = '...';
|
|
10
|
-
return purl.length > maxLength ? `${purl.slice(0, maxLength - ellipses.length)}${ellipses}` : purl;
|
|
11
|
-
}
|
|
12
|
-
export function colorizeStatus(status) {
|
|
13
|
-
return ux.colorize(STATUS_COLORS[status], status);
|
|
14
|
-
}
|
|
15
|
-
function formatSimpleComponent(purl, status) {
|
|
16
|
-
const color = STATUS_COLORS[status];
|
|
17
|
-
return ` ${INDICATORS[status]} ${ux.colorize(color, truncateString(purl, MAX_PURL_LENGTH))}`;
|
|
18
|
-
}
|
|
19
|
-
function getDaysEolString(daysEol) {
|
|
20
|
-
if (daysEol === null) {
|
|
21
|
-
return '';
|
|
22
|
-
}
|
|
23
|
-
if (daysEol <= 0) {
|
|
24
|
-
return `${Math.abs(daysEol) + 1} days from now`;
|
|
25
|
-
}
|
|
26
|
-
if (daysEol > 0) {
|
|
27
|
-
return 'today';
|
|
28
|
-
}
|
|
29
|
-
return `${daysEol} days ago`;
|
|
30
|
-
}
|
|
31
|
-
function formatDetailedComponent(purl, info) {
|
|
32
|
-
const { status, eolAt, daysEol, vulnCount } = info;
|
|
33
|
-
const simpleComponent = formatSimpleComponent(purl, status);
|
|
34
|
-
const eolAtString = parseMomentToSimpleDate(eolAt);
|
|
35
|
-
const daysEolString = getDaysEolString(daysEol);
|
|
36
|
-
const eolString = [`${simpleComponent}`, ` ⮑ EOL Date: ${eolAtString} (${daysEolString})`];
|
|
37
|
-
if (config.showVulnCount) {
|
|
38
|
-
eolString.push(` ⮑ # of Vulns: ${vulnCount ?? ''}`);
|
|
39
|
-
}
|
|
40
|
-
const output = eolString.filter(Boolean).join('\n');
|
|
41
|
-
return output;
|
|
42
|
-
}
|
|
43
|
-
export function createStatusDisplay(components, all) {
|
|
44
|
-
const statusOutput = {
|
|
45
|
-
UNKNOWN: [],
|
|
46
|
-
OK: [],
|
|
47
|
-
SUPPORTED: [],
|
|
48
|
-
EOL: [],
|
|
49
|
-
};
|
|
50
|
-
// Single loop to separate and format components
|
|
51
|
-
for (const [purl, component] of components.entries()) {
|
|
52
|
-
const { status } = component.info;
|
|
53
|
-
if (all) {
|
|
54
|
-
if (status === 'UNKNOWN' || status === 'OK') {
|
|
55
|
-
statusOutput[status].push(formatSimpleComponent(purl, status));
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (status === 'SUPPORTED' || status === 'EOL') {
|
|
59
|
-
statusOutput[status].push(formatDetailedComponent(purl, component.info));
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return statusOutput;
|
|
63
|
-
}
|
|
64
|
-
export function createTableForStatus(grouped, status) {
|
|
65
|
-
const data = grouped[status].map((component) => convertComponentToTableRow(component));
|
|
66
|
-
if (status === 'EOL' || status === 'SUPPORTED') {
|
|
67
|
-
if (config.showVulnCount) {
|
|
68
|
-
return makeTable({
|
|
69
|
-
data,
|
|
70
|
-
columns: [
|
|
71
|
-
{ key: 'name', name: 'NAME', width: MAX_TABLE_COLUMN_WIDTH },
|
|
72
|
-
{ key: 'version', name: 'VERSION', width: 10 },
|
|
73
|
-
{ key: 'eol', name: 'EOL', width: 12 },
|
|
74
|
-
{ key: 'daysEol', name: 'DAYS EOL', width: 10 },
|
|
75
|
-
{ key: 'type', name: 'TYPE', width: 12 },
|
|
76
|
-
{ key: 'vulnCount', name: '# OF VULNS', width: 12 },
|
|
77
|
-
],
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
return makeTable({
|
|
81
|
-
data,
|
|
82
|
-
columns: [
|
|
83
|
-
{ key: 'name', name: 'NAME', width: MAX_TABLE_COLUMN_WIDTH },
|
|
84
|
-
{ key: 'version', name: 'VERSION', width: 10 },
|
|
85
|
-
{ key: 'eol', name: 'EOL', width: 12 },
|
|
86
|
-
{ key: 'daysEol', name: 'DAYS EOL', width: 10 },
|
|
87
|
-
{ key: 'type', name: 'TYPE', width: 12 },
|
|
88
|
-
],
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
if (config.showVulnCount) {
|
|
92
|
-
return makeTable({
|
|
93
|
-
data,
|
|
94
|
-
columns: [
|
|
95
|
-
{ key: 'name', name: 'NAME', width: MAX_TABLE_COLUMN_WIDTH },
|
|
96
|
-
{ key: 'version', name: 'VERSION', width: 10 },
|
|
97
|
-
{ key: 'type', name: 'TYPE', width: 12 },
|
|
98
|
-
{ key: 'vulnCount', name: '# OF VULNS', width: 12 },
|
|
99
|
-
],
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
return makeTable({
|
|
103
|
-
data,
|
|
104
|
-
columns: [
|
|
105
|
-
{ key: 'name', name: 'NAME', width: MAX_TABLE_COLUMN_WIDTH },
|
|
106
|
-
{ key: 'version', name: 'VERSION', width: 10 },
|
|
107
|
-
{ key: 'type', name: 'TYPE', width: 12 },
|
|
108
|
-
],
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
export function convertComponentToTableRow(component) {
|
|
112
|
-
const purlParts = PackageURL.fromString(component.purl);
|
|
113
|
-
const { eolAt, daysEol, vulnCount } = component.info;
|
|
114
|
-
return {
|
|
115
|
-
name: resolvePurlPackageName(purlParts),
|
|
116
|
-
version: purlParts.version ?? '',
|
|
117
|
-
eol: parseMomentToSimpleDate(eolAt),
|
|
118
|
-
daysEol: daysEol,
|
|
119
|
-
type: purlParts.type,
|
|
120
|
-
vulnCount: vulnCount,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
export function groupComponentsByStatus(components) {
|
|
124
|
-
const grouped = {
|
|
125
|
-
UNKNOWN: [],
|
|
126
|
-
OK: [],
|
|
127
|
-
SUPPORTED: [],
|
|
128
|
-
EOL: [],
|
|
129
|
-
};
|
|
130
|
-
for (const component of components.values()) {
|
|
131
|
-
grouped[component.info.status].push(component);
|
|
132
|
-
}
|
|
133
|
-
return grouped;
|
|
134
|
-
}
|
package/dist/ui/shared.ui.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ComponentStatus } from '../api/types/nes.types.ts';
|
|
2
|
-
export declare const STATUS_COLORS: Record<ComponentStatus, string>;
|
|
3
|
-
export declare const INDICATORS: Record<ComponentStatus, string>;
|
|
4
|
-
export declare const MAX_PURL_LENGTH = 60;
|
|
5
|
-
export declare const MAX_TABLE_COLUMN_WIDTH = 30;
|
|
6
|
-
export declare const SCAN_ID_KEY = "eol-scan-v1-";
|
package/dist/ui/shared.ui.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ux } from '@oclif/core';
|
|
2
|
-
export const STATUS_COLORS = {
|
|
3
|
-
EOL: 'red',
|
|
4
|
-
UNKNOWN: 'default',
|
|
5
|
-
OK: 'green',
|
|
6
|
-
SUPPORTED: 'yellow',
|
|
7
|
-
};
|
|
8
|
-
export const INDICATORS = {
|
|
9
|
-
EOL: ux.colorize(STATUS_COLORS.EOL, '✗'),
|
|
10
|
-
UNKNOWN: ux.colorize(STATUS_COLORS.UNKNOWN, '•'),
|
|
11
|
-
OK: ux.colorize(STATUS_COLORS.OK, '✔'),
|
|
12
|
-
SUPPORTED: ux.colorize(STATUS_COLORS.SUPPORTED, '⚡'),
|
|
13
|
-
};
|
|
14
|
-
export const MAX_PURL_LENGTH = 60;
|
|
15
|
-
export const MAX_TABLE_COLUMN_WIDTH = 30;
|
|
16
|
-
export const SCAN_ID_KEY = 'eol-scan-v1-';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|