@westbayberry/dg 1.3.2 → 2.0.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/LICENSE +1 -201
- package/NOTICE +1 -4
- package/README.md +293 -0
- package/dist/api/analyze.js +210 -0
- package/dist/audit/deep.js +180 -0
- package/dist/audit/detectors.js +247 -0
- package/dist/audit/events.js +41 -0
- package/dist/audit/rules.js +426 -0
- package/dist/audit-ui/AuditApp.js +39 -0
- package/dist/audit-ui/components/AuditHeader.js +24 -0
- package/dist/audit-ui/components/AuditResultsView.js +307 -0
- package/dist/audit-ui/components/DeepStatusRow.js +11 -0
- package/dist/audit-ui/export.js +85 -0
- package/dist/audit-ui/format.js +34 -0
- package/dist/audit-ui/launch.js +34 -0
- package/dist/auth/device-login.js +271 -0
- package/dist/auth/env-token.js +6 -0
- package/dist/auth/login-app.js +156 -0
- package/dist/auth/store.js +147 -0
- package/dist/bin/dg.js +71 -0
- package/dist/commands/audit.js +357 -0
- package/dist/commands/completion.js +116 -0
- package/dist/commands/config.js +99 -0
- package/dist/commands/doctor.js +39 -0
- package/dist/commands/explain.js +100 -0
- package/dist/commands/guard-commit.js +158 -0
- package/dist/commands/help.js +74 -0
- package/dist/commands/licenses.js +435 -0
- package/dist/commands/login.js +81 -0
- package/dist/commands/logout.js +37 -0
- package/dist/commands/router.js +98 -0
- package/dist/commands/scan.js +18 -0
- package/dist/commands/service.js +475 -0
- package/dist/commands/setup.js +302 -0
- package/dist/commands/status.js +115 -0
- package/dist/commands/suggest.js +35 -0
- package/dist/commands/types.js +4 -0
- package/dist/commands/unavailable.js +11 -0
- package/dist/commands/uninstall.js +111 -0
- package/dist/commands/update.js +210 -0
- package/dist/commands/verify.js +151 -0
- package/dist/commands/version.js +22 -0
- package/dist/commands/wrap.js +55 -0
- package/dist/config/settings.js +302 -0
- package/dist/install-ui/LiveInstall.js +24 -0
- package/dist/install-ui/block-render.js +83 -0
- package/dist/install-ui/live-install-app.js +48 -0
- package/dist/install-ui/prompt.js +24 -0
- package/dist/launcher/classify.js +116 -0
- package/dist/launcher/env.js +53 -0
- package/dist/launcher/live-install.js +50 -0
- package/dist/launcher/output-redaction.js +77 -0
- package/dist/launcher/preflight-prompt.js +139 -0
- package/dist/launcher/resolve-real-binary.js +73 -0
- package/dist/launcher/run.js +417 -0
- package/dist/policy/evaluate.js +128 -0
- package/dist/presentation/mode.js +52 -0
- package/dist/presentation/theme.js +29 -0
- package/dist/proxy/buffer-budget.js +64 -0
- package/dist/proxy/ca.js +126 -0
- package/dist/proxy/classify-host.js +26 -0
- package/dist/proxy/enforcement.js +102 -0
- package/dist/proxy/metadata-map.js +336 -0
- package/dist/proxy/server.js +909 -0
- package/dist/proxy/upstream-proxy.js +102 -0
- package/dist/proxy/worker.js +39 -0
- package/dist/publish-set/collect.js +51 -0
- package/dist/publish-set/no-exec-shell.js +19 -0
- package/dist/publish-set/npm.js +109 -0
- package/dist/publish-set/pack.js +36 -0
- package/dist/publish-set/pypi.js +59 -0
- package/dist/runtime/cli.js +17 -0
- package/dist/runtime/first-run.js +60 -0
- package/dist/runtime/node-version.js +58 -0
- package/dist/runtime/nudges.js +105 -0
- package/dist/scan/analyze-worker.js +21 -0
- package/dist/scan/collect.js +153 -0
- package/dist/scan/command.js +159 -0
- package/dist/scan/discovery.js +209 -0
- package/dist/scan/render.js +240 -0
- package/dist/scan/scanner-report.js +82 -0
- package/dist/scan/staged.js +173 -0
- package/dist/scan/types.js +1 -0
- package/dist/scan-ui/LegacyApp.js +156 -0
- package/dist/scan-ui/alt-screen.js +84 -0
- package/dist/scan-ui/api-aliases.js +1 -0
- package/dist/scan-ui/components/ErrorView.js +23 -0
- package/dist/scan-ui/components/InteractiveResultsView.js +1166 -0
- package/dist/scan-ui/components/ProgressBar.js +89 -0
- package/dist/scan-ui/components/ProjectSelector.js +62 -0
- package/dist/scan-ui/components/ScoreHeader.js +20 -0
- package/dist/scan-ui/components/SetupBanner.js +13 -0
- package/dist/scan-ui/components/Spinner.js +4 -0
- package/dist/scan-ui/format-helpers.js +40 -0
- package/dist/scan-ui/hooks/useExpandAnimation.js +40 -0
- package/dist/scan-ui/hooks/useScan.js +113 -0
- package/dist/scan-ui/hooks/useTerminalSize.js +24 -0
- package/dist/scan-ui/launch.js +27 -0
- package/dist/scan-ui/logo.js +91 -0
- package/dist/scan-ui/shims.js +30 -0
- package/dist/security/sanitize.js +28 -0
- package/dist/service/state.js +837 -0
- package/dist/service/trust-store.js +234 -0
- package/dist/service/worker.js +88 -0
- package/dist/setup/git-hook.js +244 -0
- package/dist/setup/optional-support.js +58 -0
- package/dist/setup/plan.js +899 -0
- package/dist/state/cleanup-registry.js +60 -0
- package/dist/state/index.js +5 -0
- package/dist/state/locks.js +161 -0
- package/dist/state/paths.js +24 -0
- package/dist/state/sessions.js +170 -0
- package/dist/state/store.js +50 -0
- package/dist/telemetry/events.js +40 -0
- package/dist/util/git.js +20 -0
- package/dist/util/tty-prompt.js +43 -0
- package/dist/verify/local.js +400 -0
- package/dist/verify/package-check.js +240 -0
- package/dist/verify/preflight.js +698 -0
- package/dist/verify/render.js +184 -0
- package/dist/verify/types.js +1 -0
- package/package.json +33 -50
- package/dist/index.mjs +0 -54141
- package/dist/postinstall.mjs +0 -731
- package/dist/python-hook/dg_pip_hook.pth +0 -1
- package/dist/python-hook/dg_pip_hook.py +0 -130
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const ESC = "\x1b";
|
|
2
|
+
const ALT_SCREEN_ON = `${ESC}[?1049h`;
|
|
3
|
+
const ALT_SCREEN_OFF = `${ESC}[?1049l`;
|
|
4
|
+
const HIDE_CURSOR = `${ESC}[?25l`;
|
|
5
|
+
const SHOW_CURSOR = `${ESC}[?25h`;
|
|
6
|
+
const MOUSE_1000_OFF = `${ESC}[?1000l`;
|
|
7
|
+
const MOUSE_1003_OFF = `${ESC}[?1003l`;
|
|
8
|
+
const CLEAR_HOME = `${ESC}[2J${ESC}[H`;
|
|
9
|
+
const CLEAR_LINE = `\r${ESC}[2K`;
|
|
10
|
+
const TITLE = "Dependency Guardian";
|
|
11
|
+
const TITLE_OSC = `${ESC}]0;${TITLE}\x07`;
|
|
12
|
+
let tuiActive = false;
|
|
13
|
+
let tuiHandle = null;
|
|
14
|
+
let signalRegistrations = [];
|
|
15
|
+
let exitHandler = null;
|
|
16
|
+
const SIGNAL_EXIT_CODES = {
|
|
17
|
+
SIGHUP: 129,
|
|
18
|
+
SIGINT: 130,
|
|
19
|
+
SIGTERM: 143
|
|
20
|
+
};
|
|
21
|
+
function installRestoreHandlers() {
|
|
22
|
+
exitHandler = () => leaveTui();
|
|
23
|
+
process.once("exit", exitHandler);
|
|
24
|
+
signalRegistrations = ["SIGHUP", "SIGINT", "SIGTERM"].map((signal) => {
|
|
25
|
+
const handler = () => {
|
|
26
|
+
leaveTui();
|
|
27
|
+
process.exit(SIGNAL_EXIT_CODES[signal] ?? 1);
|
|
28
|
+
};
|
|
29
|
+
process.once(signal, handler);
|
|
30
|
+
return { signal, handler };
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function removeRestoreHandlers() {
|
|
34
|
+
if (exitHandler) {
|
|
35
|
+
process.off("exit", exitHandler);
|
|
36
|
+
exitHandler = null;
|
|
37
|
+
}
|
|
38
|
+
for (const registration of signalRegistrations) {
|
|
39
|
+
process.off(registration.signal, registration.handler);
|
|
40
|
+
}
|
|
41
|
+
signalRegistrations = [];
|
|
42
|
+
}
|
|
43
|
+
export function enterTui() {
|
|
44
|
+
if (!process.stdout.isTTY || tuiActive)
|
|
45
|
+
return;
|
|
46
|
+
process.stdout.write(CLEAR_LINE + ALT_SCREEN_ON + HIDE_CURSOR + MOUSE_1000_OFF + MOUSE_1003_OFF + CLEAR_HOME + TITLE_OSC);
|
|
47
|
+
tuiActive = true;
|
|
48
|
+
installRestoreHandlers();
|
|
49
|
+
if (!tuiHandle)
|
|
50
|
+
tuiHandle = setInterval(() => { }, 60000);
|
|
51
|
+
}
|
|
52
|
+
export function leaveTui() {
|
|
53
|
+
if (!tuiActive)
|
|
54
|
+
return;
|
|
55
|
+
if (tuiHandle) {
|
|
56
|
+
clearInterval(tuiHandle);
|
|
57
|
+
tuiHandle = null;
|
|
58
|
+
}
|
|
59
|
+
process.stdout.write(MOUSE_1003_OFF + MOUSE_1000_OFF + SHOW_CURSOR + ALT_SCREEN_OFF);
|
|
60
|
+
tuiActive = false;
|
|
61
|
+
removeRestoreHandlers();
|
|
62
|
+
}
|
|
63
|
+
export function clearScreen() {
|
|
64
|
+
if (!process.stdout.isTTY)
|
|
65
|
+
return;
|
|
66
|
+
process.stdout.write(CLEAR_HOME);
|
|
67
|
+
}
|
|
68
|
+
export function hideCursor() {
|
|
69
|
+
if (!process.stdout.isTTY)
|
|
70
|
+
return;
|
|
71
|
+
process.stdout.write(HIDE_CURSOR);
|
|
72
|
+
}
|
|
73
|
+
export function showCursor() {
|
|
74
|
+
if (!process.stdout.isTTY)
|
|
75
|
+
return;
|
|
76
|
+
process.stdout.write(SHOW_CURSOR);
|
|
77
|
+
}
|
|
78
|
+
export function tuiIsActive() {
|
|
79
|
+
return tuiActive;
|
|
80
|
+
}
|
|
81
|
+
export function __resetTuiStateForTests() {
|
|
82
|
+
tuiActive = false;
|
|
83
|
+
removeRestoreHandlers();
|
|
84
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AnalyzeError as APIError } from "../api/analyze.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text, Box } from "ink";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { sanitize } from "../../security/sanitize.js";
|
|
5
|
+
function getHint(error) {
|
|
6
|
+
const statusCode = error.statusCode;
|
|
7
|
+
if (typeof statusCode !== "number")
|
|
8
|
+
return null;
|
|
9
|
+
switch (statusCode) {
|
|
10
|
+
case 401:
|
|
11
|
+
return "Not authenticated. Run `dg login` to sign in.";
|
|
12
|
+
case 429:
|
|
13
|
+
return "Rate limit exceeded. Upgrade at westbayberry.com/pricing";
|
|
14
|
+
case 504:
|
|
15
|
+
return "Server timeout. Try scanning fewer packages.";
|
|
16
|
+
default:
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export const ErrorView = ({ error }) => {
|
|
21
|
+
const hint = getHint(error);
|
|
22
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "red", paddingLeft: 1, paddingRight: 1, children: [_jsx(Text, { children: chalk.red.bold("\u2718 Error") }), _jsx(Text, { children: sanitize(error.message) }), hint && (_jsxs(Text, { children: [chalk.yellow("\u2192"), " ", hint] }))] }));
|
|
23
|
+
};
|