@westbayberry/dg 1.0.49 → 1.0.52
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/dist/index.mjs +610 -559
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -46426,21 +46426,28 @@ import { join as join5, dirname as dirname3 } from "node:path";
|
|
|
46426
46426
|
import { fileURLToPath } from "node:url";
|
|
46427
46427
|
import { homedir as homedir2 } from "node:os";
|
|
46428
46428
|
function loadDgrc() {
|
|
46429
|
-
const
|
|
46430
|
-
|
|
46431
|
-
|
|
46432
|
-
|
|
46433
|
-
|
|
46434
|
-
|
|
46435
|
-
|
|
46436
|
-
|
|
46437
|
-
} catch {
|
|
46438
|
-
process.stderr.write(`Warning: Failed to parse ${filepath}, ignoring.
|
|
46429
|
+
const cwdPath = join5(process.cwd(), ".dgrc.json");
|
|
46430
|
+
const homePath = join5(homedir2(), ".dgrc.json");
|
|
46431
|
+
let config3 = {};
|
|
46432
|
+
if (existsSync3(homePath)) {
|
|
46433
|
+
try {
|
|
46434
|
+
config3 = JSON.parse(readFileSync3(homePath, "utf-8"));
|
|
46435
|
+
} catch {
|
|
46436
|
+
process.stderr.write(`Warning: Failed to parse ${homePath}, ignoring.
|
|
46439
46437
|
`);
|
|
46440
|
-
}
|
|
46441
46438
|
}
|
|
46442
46439
|
}
|
|
46443
|
-
|
|
46440
|
+
if (existsSync3(cwdPath) && cwdPath !== homePath) {
|
|
46441
|
+
try {
|
|
46442
|
+
const cwd2 = JSON.parse(readFileSync3(cwdPath, "utf-8"));
|
|
46443
|
+
const { apiKey: _k, apiUrl: _u, ...safeKeys } = cwd2;
|
|
46444
|
+
Object.assign(config3, safeKeys);
|
|
46445
|
+
} catch {
|
|
46446
|
+
process.stderr.write(`Warning: Failed to parse ${cwdPath}, ignoring.
|
|
46447
|
+
`);
|
|
46448
|
+
}
|
|
46449
|
+
}
|
|
46450
|
+
return config3;
|
|
46444
46451
|
}
|
|
46445
46452
|
function validateApiUrl(url) {
|
|
46446
46453
|
try {
|
|
@@ -49711,7 +49718,7 @@ var require_react_development = __commonJS({
|
|
|
49711
49718
|
var dispatcher = resolveDispatcher();
|
|
49712
49719
|
return dispatcher.useReducer(reducer7, initialArg, init3);
|
|
49713
49720
|
}
|
|
49714
|
-
function
|
|
49721
|
+
function useRef10(initialValue) {
|
|
49715
49722
|
var dispatcher = resolveDispatcher();
|
|
49716
49723
|
return dispatcher.useRef(initialValue);
|
|
49717
49724
|
}
|
|
@@ -50505,7 +50512,7 @@ var require_react_development = __commonJS({
|
|
|
50505
50512
|
exports.useLayoutEffect = useLayoutEffect2;
|
|
50506
50513
|
exports.useMemo = useMemo5;
|
|
50507
50514
|
exports.useReducer = useReducer8;
|
|
50508
|
-
exports.useRef =
|
|
50515
|
+
exports.useRef = useRef10;
|
|
50509
50516
|
exports.useState = useState11;
|
|
50510
50517
|
exports.useSyncExternalStore = useSyncExternalStore;
|
|
50511
50518
|
exports.useTransition = useTransition;
|
|
@@ -83507,6 +83514,7 @@ async function callAnalyzeAPI(packages, config3, onProgress) {
|
|
|
83507
83514
|
const results = [];
|
|
83508
83515
|
let completed = 0;
|
|
83509
83516
|
const tTotal = Date.now();
|
|
83517
|
+
if (onProgress) onProgress(0, packages.length, batches[0]?.map((p) => p.name) ?? []);
|
|
83510
83518
|
for (let i = 0; i < batches.length; i++) {
|
|
83511
83519
|
const batch = batches[i];
|
|
83512
83520
|
const tBatch = Date.now();
|
|
@@ -83514,7 +83522,7 @@ async function callAnalyzeAPI(packages, config3, onProgress) {
|
|
|
83514
83522
|
if (process.env.DG_PERF) console.error(`[CLI-PERF] batch ${i + 1}/${batches.length}: ${batch.length} packages \u2192 ${Date.now() - tBatch}ms`);
|
|
83515
83523
|
completed += batch.length;
|
|
83516
83524
|
if (onProgress) {
|
|
83517
|
-
onProgress(completed, packages.length, batch.map((p) => p.name));
|
|
83525
|
+
onProgress(completed, packages.length, batches[i + 1]?.map((p) => p.name) ?? batch.map((p) => p.name));
|
|
83518
83526
|
}
|
|
83519
83527
|
results.push(result);
|
|
83520
83528
|
}
|
|
@@ -83768,7 +83776,7 @@ var init_api3 = __esm({
|
|
|
83768
83776
|
});
|
|
83769
83777
|
|
|
83770
83778
|
// src/scan-core.ts
|
|
83771
|
-
async function scanProjectAtPath(cwd2, config3) {
|
|
83779
|
+
async function scanProjectAtPath(cwd2, config3, onProgress) {
|
|
83772
83780
|
const startNs = process.hrtime.bigint();
|
|
83773
83781
|
const elapsedMs = () => Number((process.hrtime.bigint() - startNs) / 1000000n);
|
|
83774
83782
|
try {
|
|
@@ -83792,13 +83800,26 @@ async function scanProjectAtPath(cwd2, config3) {
|
|
|
83792
83800
|
};
|
|
83793
83801
|
}
|
|
83794
83802
|
const responses = [];
|
|
83803
|
+
let cumulativeDone = 0;
|
|
83795
83804
|
if (npmPackages.length > 0) {
|
|
83796
|
-
const
|
|
83805
|
+
const npmOnProgress = onProgress ? (done, _total, currentBatch) => {
|
|
83806
|
+
onProgress({
|
|
83807
|
+
done: cumulativeDone + done,
|
|
83808
|
+
total: totalDiscovered,
|
|
83809
|
+
current: currentBatch ?? []
|
|
83810
|
+
});
|
|
83811
|
+
} : void 0;
|
|
83812
|
+
const npmResp = await callAnalyzeAPI(npmPackages, config3, npmOnProgress);
|
|
83797
83813
|
responses.push(npmResp);
|
|
83814
|
+
cumulativeDone += npmPackages.length;
|
|
83798
83815
|
}
|
|
83799
83816
|
if (pyPackages.length > 0) {
|
|
83800
|
-
const
|
|
83817
|
+
const pyOnProgress = onProgress ? (done, _total) => {
|
|
83818
|
+
onProgress({ done: cumulativeDone + done, total: totalDiscovered, current: [] });
|
|
83819
|
+
} : void 0;
|
|
83820
|
+
const pyResp = await callPyPIAnalyzeAPI(pyPackages, config3, pyOnProgress);
|
|
83801
83821
|
responses.push(pyResp);
|
|
83822
|
+
cumulativeDone += pyPackages.length;
|
|
83802
83823
|
}
|
|
83803
83824
|
const allPackages = responses.flatMap((r) => r.packages);
|
|
83804
83825
|
const maxScore = allPackages.length > 0 ? Math.max(0, ...allPackages.map((p) => p.score)) : 0;
|
|
@@ -83875,6 +83896,7 @@ function initialState(dryRun, firstRun) {
|
|
|
83875
83896
|
hookError: null,
|
|
83876
83897
|
scanRan: false,
|
|
83877
83898
|
scanResult: null,
|
|
83899
|
+
scanProgress: null,
|
|
83878
83900
|
skipped: /* @__PURE__ */ new Set()
|
|
83879
83901
|
};
|
|
83880
83902
|
}
|
|
@@ -83975,12 +83997,15 @@ function reducer(state, action) {
|
|
|
83975
83997
|
skipped
|
|
83976
83998
|
};
|
|
83977
83999
|
}
|
|
84000
|
+
case "scan_progress":
|
|
84001
|
+
return { ...state, scanProgress: action.progress };
|
|
83978
84002
|
case "scan_done":
|
|
83979
84003
|
return {
|
|
83980
84004
|
...state,
|
|
83981
84005
|
phase: state.firstRun ? "result_first_scan" : "show_app_link",
|
|
83982
84006
|
scanRan: true,
|
|
83983
|
-
scanResult: action.outcome
|
|
84007
|
+
scanResult: action.outcome,
|
|
84008
|
+
scanProgress: null
|
|
83984
84009
|
};
|
|
83985
84010
|
case "app_link_acked":
|
|
83986
84011
|
return { ...state, phase: "done" };
|
|
@@ -84094,7 +84119,9 @@ function useInit(opts = {}) {
|
|
|
84094
84119
|
const projects = state.projects.length > 0 ? state.projects : [{ path: opts.cwd ?? process.cwd() }];
|
|
84095
84120
|
const allOutcomes = [];
|
|
84096
84121
|
for (const proj of projects) {
|
|
84097
|
-
const outcome = await scanFn(proj.path, config3)
|
|
84122
|
+
const outcome = await scanFn(proj.path, config3, (p) => {
|
|
84123
|
+
dispatch({ type: "scan_progress", progress: p });
|
|
84124
|
+
});
|
|
84098
84125
|
allOutcomes.push(outcome);
|
|
84099
84126
|
}
|
|
84100
84127
|
const allPackages = allOutcomes.flatMap(
|
|
@@ -84173,6 +84200,40 @@ var init_useInit = __esm({
|
|
|
84173
84200
|
}
|
|
84174
84201
|
});
|
|
84175
84202
|
|
|
84203
|
+
// src/ui/hooks/useTerminalSize.ts
|
|
84204
|
+
function useTerminalSize() {
|
|
84205
|
+
const { stdout } = use_stdout_default();
|
|
84206
|
+
const [size, setSize] = (0, import_react23.useState)({
|
|
84207
|
+
rows: stdout?.rows ?? process.stdout.rows ?? 24,
|
|
84208
|
+
cols: stdout?.columns ?? process.stdout.columns ?? 80
|
|
84209
|
+
});
|
|
84210
|
+
(0, import_react23.useEffect)(() => {
|
|
84211
|
+
const handle = () => {
|
|
84212
|
+
const rows = process.stdout.rows ?? 24;
|
|
84213
|
+
const cols = process.stdout.columns ?? 80;
|
|
84214
|
+
if (process.stdout.isTTY) {
|
|
84215
|
+
process.stdout.write("\x1B[2J\x1B[H");
|
|
84216
|
+
}
|
|
84217
|
+
setSize({ rows, cols });
|
|
84218
|
+
};
|
|
84219
|
+
process.stdout.setMaxListeners(process.stdout.getMaxListeners() + 1);
|
|
84220
|
+
process.stdout.on("resize", handle);
|
|
84221
|
+
return () => {
|
|
84222
|
+
process.stdout.off("resize", handle);
|
|
84223
|
+
process.stdout.setMaxListeners(Math.max(0, process.stdout.getMaxListeners() - 1));
|
|
84224
|
+
};
|
|
84225
|
+
}, []);
|
|
84226
|
+
return size;
|
|
84227
|
+
}
|
|
84228
|
+
var import_react23;
|
|
84229
|
+
var init_useTerminalSize = __esm({
|
|
84230
|
+
async "src/ui/hooks/useTerminalSize.ts"() {
|
|
84231
|
+
"use strict";
|
|
84232
|
+
import_react23 = __toESM(require_react());
|
|
84233
|
+
await init_build2();
|
|
84234
|
+
}
|
|
84235
|
+
});
|
|
84236
|
+
|
|
84176
84237
|
// node_modules/cli-spinners/spinners.json
|
|
84177
84238
|
var require_spinners = __commonJS({
|
|
84178
84239
|
"node_modules/cli-spinners/spinners.json"(exports, module2) {
|
|
@@ -85820,9 +85881,9 @@ var require_cli_spinners = __commonJS({
|
|
|
85820
85881
|
|
|
85821
85882
|
// node_modules/ink-spinner/build/index.js
|
|
85822
85883
|
function Spinner({ type = "dots" }) {
|
|
85823
|
-
const [frame, setFrame] = (0,
|
|
85884
|
+
const [frame, setFrame] = (0, import_react24.useState)(0);
|
|
85824
85885
|
const spinner = import_cli_spinners.default[type];
|
|
85825
|
-
(0,
|
|
85886
|
+
(0, import_react24.useEffect)(() => {
|
|
85826
85887
|
const timer = setInterval(() => {
|
|
85827
85888
|
setFrame((previousFrame) => {
|
|
85828
85889
|
const isLastFrame = previousFrame === spinner.frames.length - 1;
|
|
@@ -85833,12 +85894,12 @@ function Spinner({ type = "dots" }) {
|
|
|
85833
85894
|
clearInterval(timer);
|
|
85834
85895
|
};
|
|
85835
85896
|
}, [spinner]);
|
|
85836
|
-
return
|
|
85897
|
+
return import_react24.default.createElement(Text, null, spinner.frames[frame]);
|
|
85837
85898
|
}
|
|
85838
|
-
var
|
|
85899
|
+
var import_react24, import_cli_spinners, build_default;
|
|
85839
85900
|
var init_build3 = __esm({
|
|
85840
85901
|
async "node_modules/ink-spinner/build/index.js"() {
|
|
85841
|
-
|
|
85902
|
+
import_react24 = __toESM(require_react(), 1);
|
|
85842
85903
|
await init_build2();
|
|
85843
85904
|
import_cli_spinners = __toESM(require_cli_spinners(), 1);
|
|
85844
85905
|
build_default = Spinner;
|
|
@@ -86793,13 +86854,93 @@ var init_Spinner = __esm({
|
|
|
86793
86854
|
}
|
|
86794
86855
|
});
|
|
86795
86856
|
|
|
86857
|
+
// src/ui/components/ProgressBar.tsx
|
|
86858
|
+
function estimateScanSeconds(packageCount) {
|
|
86859
|
+
return Math.ceil(Math.max(5, packageCount * 0.35 - 10));
|
|
86860
|
+
}
|
|
86861
|
+
function formatTime(seconds) {
|
|
86862
|
+
if (seconds < 60) return `${seconds}s`;
|
|
86863
|
+
const m = Math.floor(seconds / 60);
|
|
86864
|
+
const s = seconds % 60;
|
|
86865
|
+
return s > 0 ? `${m}m ${s}s` : `${m}m`;
|
|
86866
|
+
}
|
|
86867
|
+
var import_react25, import_chalk4, import_jsx_runtime2, ProgressBar;
|
|
86868
|
+
var init_ProgressBar = __esm({
|
|
86869
|
+
async "src/ui/components/ProgressBar.tsx"() {
|
|
86870
|
+
"use strict";
|
|
86871
|
+
import_react25 = __toESM(require_react());
|
|
86872
|
+
await init_build2();
|
|
86873
|
+
await init_build3();
|
|
86874
|
+
import_chalk4 = __toESM(require_source());
|
|
86875
|
+
await init_useTerminalSize();
|
|
86876
|
+
import_jsx_runtime2 = __toESM(require_jsx_runtime());
|
|
86877
|
+
ProgressBar = ({
|
|
86878
|
+
value,
|
|
86879
|
+
total,
|
|
86880
|
+
label
|
|
86881
|
+
}) => {
|
|
86882
|
+
const startRef = (0, import_react25.useRef)(Date.now());
|
|
86883
|
+
const [elapsed, setElapsed] = (0, import_react25.useState)(0);
|
|
86884
|
+
(0, import_react25.useEffect)(() => {
|
|
86885
|
+
const timer = setInterval(() => {
|
|
86886
|
+
setElapsed(Math.floor((Date.now() - startRef.current) / 1e3));
|
|
86887
|
+
}, 1e3);
|
|
86888
|
+
return () => clearInterval(timer);
|
|
86889
|
+
}, []);
|
|
86890
|
+
const { cols: termWidth } = useTerminalSize();
|
|
86891
|
+
const percent = total > 0 ? Math.round(value / total * 100) : 0;
|
|
86892
|
+
const estimate = estimateScanSeconds(total);
|
|
86893
|
+
const timeInfo = `${formatTime(elapsed)} / ~${formatTime(estimate)}`;
|
|
86894
|
+
const counter = `${value}/${total} ${percent}%`;
|
|
86895
|
+
const barWidth = Math.max(10, termWidth - counter.length - 8);
|
|
86896
|
+
const fraction = total > 0 ? Math.min(1, value / total) : 0;
|
|
86897
|
+
const filled = Math.round(fraction * barWidth);
|
|
86898
|
+
const empty = barWidth - filled;
|
|
86899
|
+
const filledBar = "\u2501".repeat(filled);
|
|
86900
|
+
const emptyBar = "\u2501".repeat(empty);
|
|
86901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
|
|
86902
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
|
|
86903
|
+
import_chalk4.default.cyan("\u25C6"),
|
|
86904
|
+
" ",
|
|
86905
|
+
import_chalk4.default.bold("Dependency Guardian")
|
|
86906
|
+
] }),
|
|
86907
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: "" }),
|
|
86908
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
|
|
86909
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "cyan", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(build_default, { type: "dots" }) }),
|
|
86910
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
|
|
86911
|
+
" Scanning ",
|
|
86912
|
+
total,
|
|
86913
|
+
" packages... "
|
|
86914
|
+
] }),
|
|
86915
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: timeInfo })
|
|
86916
|
+
] }),
|
|
86917
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
|
|
86918
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
|
|
86919
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "green", children: filledBar }),
|
|
86920
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: emptyBar }),
|
|
86921
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
|
|
86922
|
+
" ",
|
|
86923
|
+
counter
|
|
86924
|
+
] })
|
|
86925
|
+
] }),
|
|
86926
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
|
|
86927
|
+
" ",
|
|
86928
|
+
import_chalk4.default.dim("\u203A"),
|
|
86929
|
+
" ",
|
|
86930
|
+
label
|
|
86931
|
+
] }) })
|
|
86932
|
+
] });
|
|
86933
|
+
};
|
|
86934
|
+
}
|
|
86935
|
+
});
|
|
86936
|
+
|
|
86796
86937
|
// src/ui/components/Mascot.tsx
|
|
86797
|
-
var
|
|
86938
|
+
var import_jsx_runtime3, FACES, Mascot;
|
|
86798
86939
|
var init_Mascot = __esm({
|
|
86799
86940
|
async "src/ui/components/Mascot.tsx"() {
|
|
86800
86941
|
"use strict";
|
|
86801
86942
|
await init_build2();
|
|
86802
|
-
|
|
86943
|
+
import_jsx_runtime3 = __toESM(require_jsx_runtime());
|
|
86803
86944
|
FACES = {
|
|
86804
86945
|
idle: { left: "o", right: "o", mouth: "^" },
|
|
86805
86946
|
alert: { left: "O", right: "O", mouth: "^" },
|
|
@@ -86823,7 +86964,7 @@ var init_Mascot = __esm({
|
|
|
86823
86964
|
" ( ( ) ( ) )",
|
|
86824
86965
|
"(__(__)___(__)__)"
|
|
86825
86966
|
];
|
|
86826
|
-
return /* @__PURE__ */ (0,
|
|
86967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { flexDirection: "column", children: lines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color, children: line }, i)) });
|
|
86827
86968
|
};
|
|
86828
86969
|
}
|
|
86829
86970
|
});
|
|
@@ -86892,13 +87033,13 @@ var init_wizard_demo_data = __esm({
|
|
|
86892
87033
|
});
|
|
86893
87034
|
|
|
86894
87035
|
// src/ui/components/ScanResultCard.tsx
|
|
86895
|
-
var
|
|
87036
|
+
var import_jsx_runtime4, ScanResultCard;
|
|
86896
87037
|
var init_ScanResultCard = __esm({
|
|
86897
87038
|
async "src/ui/components/ScanResultCard.tsx"() {
|
|
86898
87039
|
"use strict";
|
|
86899
87040
|
await init_build2();
|
|
86900
87041
|
init_wizard_demo_data();
|
|
86901
|
-
|
|
87042
|
+
import_jsx_runtime4 = __toESM(require_jsx_runtime());
|
|
86902
87043
|
ScanResultCard = ({ outcome }) => {
|
|
86903
87044
|
let verdict;
|
|
86904
87045
|
let verdictColor;
|
|
@@ -86938,63 +87079,63 @@ var init_ScanResultCard = __esm({
|
|
|
86938
87079
|
extraNote = `Scan didn't finish: ${o.message ?? "unknown error"}`;
|
|
86939
87080
|
}
|
|
86940
87081
|
}
|
|
86941
|
-
return /* @__PURE__ */ (0,
|
|
86942
|
-
packages.length === 1 ? /* @__PURE__ */ (0,
|
|
86943
|
-
/* @__PURE__ */ (0,
|
|
86944
|
-
/* @__PURE__ */ (0,
|
|
87082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { flexDirection: "column", children: verdict !== "EMPTY" && packages.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
87083
|
+
packages.length === 1 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { children: [
|
|
87084
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { bold: true, children: packages[0].name }),
|
|
87085
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { dimColor: true, children: [
|
|
86945
87086
|
"@",
|
|
86946
87087
|
packages[0].version
|
|
86947
87088
|
] })
|
|
86948
|
-
] }) : /* @__PURE__ */ (0,
|
|
87089
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { dimColor: true, children: [
|
|
86949
87090
|
packages.length,
|
|
86950
87091
|
" packages"
|
|
86951
87092
|
] }),
|
|
86952
|
-
/* @__PURE__ */ (0,
|
|
86953
|
-
/* @__PURE__ */ (0,
|
|
86954
|
-
/* @__PURE__ */ (0,
|
|
86955
|
-
/* @__PURE__ */ (0,
|
|
86956
|
-
/* @__PURE__ */ (0,
|
|
87093
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { children: " " }),
|
|
87094
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { children: [
|
|
87095
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: verdictColor, bold: true, children: verdict }),
|
|
87096
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { dimColor: true, children: " \xB7 " }),
|
|
87097
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { bold: true, children: [
|
|
86957
87098
|
score,
|
|
86958
87099
|
"/100"
|
|
86959
87100
|
] })
|
|
86960
87101
|
] }),
|
|
86961
|
-
/* @__PURE__ */ (0,
|
|
86962
|
-
packages.length === 1 ? packages[0].findings.slice(0, 3).map((f, i) => /* @__PURE__ */ (0,
|
|
87102
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { children: " " }),
|
|
87103
|
+
packages.length === 1 ? packages[0].findings.slice(0, 3).map((f, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { dimColor: true, children: [
|
|
86963
87104
|
" \u2022 ",
|
|
86964
87105
|
friendlyCategory(f.category),
|
|
86965
87106
|
f.title ? ` \u2014 ${f.title}` : ""
|
|
86966
|
-
] }, `f-${i}`)) : packages.slice(0, 3).map((pkg) => /* @__PURE__ */ (0,
|
|
87107
|
+
] }, `f-${i}`)) : packages.slice(0, 3).map((pkg) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { dimColor: true, children: [
|
|
86967
87108
|
" \u2022 ",
|
|
86968
|
-
/* @__PURE__ */ (0,
|
|
87109
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { bold: true, children: pkg.name }),
|
|
86969
87110
|
" ",
|
|
86970
87111
|
pkg.score,
|
|
86971
87112
|
"/100"
|
|
86972
87113
|
] }, pkg.name)),
|
|
86973
|
-
packages.length > 3 ? /* @__PURE__ */ (0,
|
|
86974
|
-
] }) : verdict !== "EMPTY" ? /* @__PURE__ */ (0,
|
|
86975
|
-
/* @__PURE__ */ (0,
|
|
86976
|
-
/* @__PURE__ */ (0,
|
|
86977
|
-
/* @__PURE__ */ (0,
|
|
87114
|
+
packages.length > 3 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { dimColor: true, children: " + " + (packages.length - 3) + " more" }) : null
|
|
87115
|
+
] }) : verdict !== "EMPTY" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { children: [
|
|
87116
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: verdictColor, bold: true, children: verdict }),
|
|
87117
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { dimColor: true, children: " \xB7 " }),
|
|
87118
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { bold: true, children: [
|
|
86978
87119
|
score,
|
|
86979
87120
|
"/100"
|
|
86980
87121
|
] })
|
|
86981
|
-
] }) : /* @__PURE__ */ (0,
|
|
87122
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { dimColor: true, children: extraNote }) });
|
|
86982
87123
|
};
|
|
86983
87124
|
}
|
|
86984
87125
|
});
|
|
86985
87126
|
|
|
86986
87127
|
// src/ui/components/DemoScanAnimation.tsx
|
|
86987
|
-
var
|
|
87128
|
+
var import_react26, import_jsx_runtime5, DemoScanAnimation;
|
|
86988
87129
|
var init_DemoScanAnimation = __esm({
|
|
86989
87130
|
async "src/ui/components/DemoScanAnimation.tsx"() {
|
|
86990
87131
|
"use strict";
|
|
86991
|
-
|
|
87132
|
+
import_react26 = __toESM(require_react());
|
|
86992
87133
|
await init_Spinner();
|
|
86993
87134
|
init_wizard_demo_data();
|
|
86994
|
-
|
|
87135
|
+
import_jsx_runtime5 = __toESM(require_jsx_runtime());
|
|
86995
87136
|
DemoScanAnimation = ({ onComplete }) => {
|
|
86996
|
-
const [labelIdx, setLabelIdx] = (0,
|
|
86997
|
-
(0,
|
|
87137
|
+
const [labelIdx, setLabelIdx] = (0, import_react26.useState)(0);
|
|
87138
|
+
(0, import_react26.useEffect)(() => {
|
|
86998
87139
|
const tickMs = Math.floor(DEMO_SCAN_TOTAL_MS / DEMO_SCAN_LABELS.length);
|
|
86999
87140
|
const interval = setInterval(() => {
|
|
87000
87141
|
setLabelIdx((i) => {
|
|
@@ -87008,7 +87149,7 @@ var init_DemoScanAnimation = __esm({
|
|
|
87008
87149
|
}, tickMs);
|
|
87009
87150
|
return () => clearInterval(interval);
|
|
87010
87151
|
}, [onComplete]);
|
|
87011
|
-
return /* @__PURE__ */ (0,
|
|
87152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner2, { label: DEMO_SCAN_LABELS[labelIdx] });
|
|
87012
87153
|
};
|
|
87013
87154
|
}
|
|
87014
87155
|
});
|
|
@@ -87041,16 +87182,16 @@ function phaseToStep(phase) {
|
|
|
87041
87182
|
return 0;
|
|
87042
87183
|
}
|
|
87043
87184
|
}
|
|
87044
|
-
var
|
|
87185
|
+
var import_jsx_runtime6, TOTAL_STEPS, ProgressDots;
|
|
87045
87186
|
var init_ProgressDots = __esm({
|
|
87046
87187
|
async "src/ui/components/ProgressDots.tsx"() {
|
|
87047
87188
|
"use strict";
|
|
87048
87189
|
await init_build2();
|
|
87049
|
-
|
|
87190
|
+
import_jsx_runtime6 = __toESM(require_jsx_runtime());
|
|
87050
87191
|
TOTAL_STEPS = 6;
|
|
87051
|
-
ProgressDots = ({ current }) => /* @__PURE__ */ (0,
|
|
87192
|
+
ProgressDots = ({ current }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { children: Array.from({ length: TOTAL_STEPS }).map((_, i) => {
|
|
87052
87193
|
const filled = i < current;
|
|
87053
|
-
return /* @__PURE__ */ (0,
|
|
87194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: filled ? "green" : void 0, dimColor: !filled, children: filled ? "\u25CF " : "\u25CB " }, i);
|
|
87054
87195
|
}) });
|
|
87055
87196
|
}
|
|
87056
87197
|
});
|
|
@@ -87064,21 +87205,23 @@ import { basename as basename3 } from "node:path";
|
|
|
87064
87205
|
function defaultYesNoCursor(phase) {
|
|
87065
87206
|
return phase === "confirm_wrap" ? 1 : 0;
|
|
87066
87207
|
}
|
|
87067
|
-
var
|
|
87208
|
+
var import_react27, import_jsx_runtime7, YES_NO_PHASES, InitApp;
|
|
87068
87209
|
var init_InitApp = __esm({
|
|
87069
87210
|
async "src/ui/InitApp.tsx"() {
|
|
87070
87211
|
"use strict";
|
|
87071
|
-
|
|
87212
|
+
import_react27 = __toESM(require_react());
|
|
87072
87213
|
await init_build2();
|
|
87073
87214
|
init_useInit();
|
|
87215
|
+
await init_useTerminalSize();
|
|
87074
87216
|
await init_Spinner();
|
|
87217
|
+
await init_ProgressBar();
|
|
87075
87218
|
await init_Mascot();
|
|
87076
87219
|
await init_ScanResultCard();
|
|
87077
87220
|
await init_DemoScanAnimation();
|
|
87078
87221
|
await init_ProgressDots();
|
|
87079
87222
|
init_wizard_demo_data();
|
|
87080
87223
|
init_sanitize();
|
|
87081
|
-
|
|
87224
|
+
import_jsx_runtime7 = __toESM(require_jsx_runtime());
|
|
87082
87225
|
YES_NO_PHASES = /* @__PURE__ */ new Set([
|
|
87083
87226
|
"greet",
|
|
87084
87227
|
"confirm_hook",
|
|
@@ -87094,21 +87237,36 @@ var init_InitApp = __esm({
|
|
|
87094
87237
|
}) => {
|
|
87095
87238
|
const { state, canGoBack: canGoBack2, runDetect, runInstallHook, runVerifyHook, runScan, dispatch } = useInit({ dryRun, firstRun });
|
|
87096
87239
|
const { exit } = use_app_default();
|
|
87097
|
-
|
|
87098
|
-
(0,
|
|
87240
|
+
useTerminalSize();
|
|
87241
|
+
const [yesNoCursor, setYesNoCursor] = (0, import_react27.useState)(defaultYesNoCursor(state.phase));
|
|
87242
|
+
const altScreenActiveRef = (0, import_react27.useRef)(false);
|
|
87243
|
+
(0, import_react27.useEffect)(() => {
|
|
87244
|
+
if (!process.stdout.isTTY) return;
|
|
87245
|
+
process.stdout.write("\x1B[?1049h");
|
|
87246
|
+
process.stdout.write("\x1B[2J\x1B[H");
|
|
87247
|
+
altScreenActiveRef.current = true;
|
|
87248
|
+
return () => {
|
|
87249
|
+
if (altScreenActiveRef.current) {
|
|
87250
|
+
process.stdout.write("\x1B[?1049l");
|
|
87251
|
+
altScreenActiveRef.current = false;
|
|
87252
|
+
}
|
|
87253
|
+
process.stdout.write("\x1B[?25h");
|
|
87254
|
+
};
|
|
87255
|
+
}, []);
|
|
87256
|
+
(0, import_react27.useEffect)(() => {
|
|
87099
87257
|
if (YES_NO_PHASES.has(state.phase)) {
|
|
87100
87258
|
setYesNoCursor(defaultYesNoCursor(state.phase));
|
|
87101
87259
|
}
|
|
87102
87260
|
}, [state.phase]);
|
|
87103
|
-
(0,
|
|
87261
|
+
(0, import_react27.useEffect)(() => {
|
|
87104
87262
|
if (state.phase === "detect") {
|
|
87105
87263
|
runDetect();
|
|
87106
87264
|
}
|
|
87107
87265
|
}, [state.phase, runDetect]);
|
|
87108
|
-
(0,
|
|
87266
|
+
(0, import_react27.useEffect)(() => {
|
|
87109
87267
|
if (state.scanRan && onScanRan) onScanRan();
|
|
87110
87268
|
}, [state.scanRan, onScanRan]);
|
|
87111
|
-
(0,
|
|
87269
|
+
(0, import_react27.useEffect)(() => {
|
|
87112
87270
|
if (state.phase === "install_hook") {
|
|
87113
87271
|
runInstallHook();
|
|
87114
87272
|
}
|
|
@@ -87258,22 +87416,22 @@ var init_InitApp = __esm({
|
|
|
87258
87416
|
return;
|
|
87259
87417
|
}
|
|
87260
87418
|
});
|
|
87261
|
-
const yesNoRow = (yesLabel = "Yes", noLabel = "No") => /* @__PURE__ */ (0,
|
|
87262
|
-
/* @__PURE__ */ (0,
|
|
87263
|
-
/* @__PURE__ */ (0,
|
|
87264
|
-
/* @__PURE__ */ (0,
|
|
87419
|
+
const yesNoRow = (yesLabel = "Yes", noLabel = "No") => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { children: [
|
|
87420
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { inverse: yesNoCursor === 0, bold: yesNoCursor === 0, color: "green", children: ` ${yesLabel} ` }),
|
|
87421
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87422
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { inverse: yesNoCursor === 1, bold: yesNoCursor === 1, color: "red", children: ` ${noLabel} ` })
|
|
87265
87423
|
] });
|
|
87266
|
-
const okButton = /* @__PURE__ */ (0,
|
|
87424
|
+
const okButton = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { inverse: true, bold: true, color: "green", children: ` OK ` }) });
|
|
87267
87425
|
const isYesNo = YES_NO_PHASES.has(state.phase);
|
|
87268
|
-
const stepHint = /* @__PURE__ */ (0,
|
|
87426
|
+
const stepHint = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { dimColor: true, children: [
|
|
87269
87427
|
isYesNo ? "\u2190 \u2192 choose \xB7 Enter confirm \xB7 " : "",
|
|
87270
87428
|
canGoBack2 ? "[b] back \xB7 " : "",
|
|
87271
87429
|
"[s] skip \xB7 [q] quit"
|
|
87272
87430
|
] }) });
|
|
87273
87431
|
const currentStep = phaseToStep(state.phase);
|
|
87274
|
-
const Scene = (props) => /* @__PURE__ */ (0,
|
|
87275
|
-
/* @__PURE__ */ (0,
|
|
87276
|
-
/* @__PURE__ */ (0,
|
|
87432
|
+
const Scene = (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "row", paddingTop: 1, children: [
|
|
87433
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { flexDirection: "column", marginRight: 1, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Mascot, { mood: props.mood, color: props.color }) }),
|
|
87434
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
87277
87435
|
Box_default,
|
|
87278
87436
|
{
|
|
87279
87437
|
flexDirection: "column",
|
|
@@ -87283,8 +87441,8 @@ var init_InitApp = __esm({
|
|
|
87283
87441
|
paddingY: 0,
|
|
87284
87442
|
flexGrow: 1,
|
|
87285
87443
|
children: [
|
|
87286
|
-
/* @__PURE__ */ (0,
|
|
87287
|
-
/* @__PURE__ */ (0,
|
|
87444
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ProgressDots, { current: currentStep }),
|
|
87445
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87288
87446
|
props.children
|
|
87289
87447
|
]
|
|
87290
87448
|
}
|
|
@@ -87306,60 +87464,60 @@ var init_InitApp = __esm({
|
|
|
87306
87464
|
})();
|
|
87307
87465
|
switch (state.phase) {
|
|
87308
87466
|
case "greet":
|
|
87309
|
-
return /* @__PURE__ */ (0,
|
|
87310
|
-
returning ? /* @__PURE__ */ (0,
|
|
87467
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Scene, { mood: "happy", color: "green", children: [
|
|
87468
|
+
returning ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87311
87469
|
"Hey, welcome back \u{1F44B} I'm ",
|
|
87312
|
-
/* @__PURE__ */ (0,
|
|
87470
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "green", children: "Dependency Guardian" }),
|
|
87313
87471
|
"."
|
|
87314
|
-
] }) : /* @__PURE__ */ (0,
|
|
87472
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87315
87473
|
"Hey \u{1F44B} I'm ",
|
|
87316
|
-
/* @__PURE__ */ (0,
|
|
87474
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "green", children: "Dependency Guardian" }),
|
|
87317
87475
|
"."
|
|
87318
87476
|
] }),
|
|
87319
|
-
/* @__PURE__ */ (0,
|
|
87320
|
-
/* @__PURE__ */ (0,
|
|
87321
|
-
/* @__PURE__ */ (0,
|
|
87322
|
-
/* @__PURE__ */ (0,
|
|
87323
|
-
returning ? /* @__PURE__ */ (0,
|
|
87324
|
-
/* @__PURE__ */ (0,
|
|
87325
|
-
/* @__PURE__ */ (0,
|
|
87477
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87478
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "I watch the code that gets added to your project" }),
|
|
87479
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "so bad stuff doesn't sneak in." }),
|
|
87480
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87481
|
+
returning ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "Want a refresher? Takes about a minute." }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
87482
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "Looks like it's your first time here." }),
|
|
87483
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "Want me to show you around? Takes about a minute." })
|
|
87326
87484
|
] }),
|
|
87327
|
-
/* @__PURE__ */ (0,
|
|
87485
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87328
87486
|
yesNoRow("Yes", "I know what I'm doing"),
|
|
87329
|
-
/* @__PURE__ */ (0,
|
|
87487
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: "\u2190 \u2192 choose \xB7 Enter confirm \xB7 [q] quit anytime" }) })
|
|
87330
87488
|
] });
|
|
87331
87489
|
case "value_prop":
|
|
87332
|
-
return /* @__PURE__ */ (0,
|
|
87333
|
-
/* @__PURE__ */ (0,
|
|
87490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Scene, { mood: "worried", color: "yellow", children: [
|
|
87491
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87334
87492
|
"In ",
|
|
87335
|
-
/* @__PURE__ */ (0,
|
|
87493
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: "2025-2026" }),
|
|
87336
87494
|
", over ",
|
|
87337
|
-
/* @__PURE__ */ (0,
|
|
87495
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: "50,000" }),
|
|
87338
87496
|
" packages on"
|
|
87339
87497
|
] }),
|
|
87340
|
-
/* @__PURE__ */ (0,
|
|
87341
|
-
/* @__PURE__ */ (0,
|
|
87498
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87499
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: "npm" }),
|
|
87342
87500
|
" and ",
|
|
87343
|
-
/* @__PURE__ */ (0,
|
|
87501
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: "PyPI" }),
|
|
87344
87502
|
" have been caught doing bad"
|
|
87345
87503
|
] }),
|
|
87346
|
-
/* @__PURE__ */ (0,
|
|
87347
|
-
/* @__PURE__ */ (0,
|
|
87348
|
-
/* @__PURE__ */ (0,
|
|
87349
|
-
/* @__PURE__ */ (0,
|
|
87350
|
-
/* @__PURE__ */ (0,
|
|
87351
|
-
/* @__PURE__ */ (0,
|
|
87352
|
-
/* @__PURE__ */ (0,
|
|
87504
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "things \u2014 stealing passwords, mining crypto," }),
|
|
87505
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "installing backdoors." }),
|
|
87506
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87507
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: "I scan both today, with 20+ more languages planned." }),
|
|
87508
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87509
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "Want to see me catch one in the act?" }),
|
|
87510
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87353
87511
|
okButton,
|
|
87354
87512
|
stepHint
|
|
87355
87513
|
] });
|
|
87356
87514
|
case "demo_scanning":
|
|
87357
|
-
return /* @__PURE__ */ (0,
|
|
87515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Scene, { mood: "scanning", color: "cyan", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DemoScanAnimation, { onComplete: () => dispatch({ type: "demo_complete" }) }) });
|
|
87358
87516
|
case "demo_result":
|
|
87359
|
-
return /* @__PURE__ */ (0,
|
|
87360
|
-
/* @__PURE__ */ (0,
|
|
87361
|
-
/* @__PURE__ */ (0,
|
|
87362
|
-
/* @__PURE__ */ (0,
|
|
87517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Scene, { mood: "alarmed", color: "red", children: [
|
|
87518
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "red", children: "Got one." }),
|
|
87519
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87520
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
87363
87521
|
ScanResultCard,
|
|
87364
87522
|
{
|
|
87365
87523
|
outcome: {
|
|
@@ -87370,200 +87528,206 @@ var init_InitApp = __esm({
|
|
|
87370
87528
|
}
|
|
87371
87529
|
}
|
|
87372
87530
|
),
|
|
87373
|
-
/* @__PURE__ */ (0,
|
|
87374
|
-
/* @__PURE__ */ (0,
|
|
87375
|
-
/* @__PURE__ */ (0,
|
|
87531
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87532
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "yellow", bold: true, children: "This one's fake. The next one won't be." }),
|
|
87533
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87376
87534
|
okButton,
|
|
87377
87535
|
stepHint
|
|
87378
87536
|
] });
|
|
87379
87537
|
case "scenario":
|
|
87380
|
-
return /* @__PURE__ */ (0,
|
|
87381
|
-
/* @__PURE__ */ (0,
|
|
87538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Scene, { mood: "explaining", color: "cyan", children: [
|
|
87539
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87382
87540
|
"Here's the situation in ",
|
|
87383
|
-
/* @__PURE__ */ (0,
|
|
87541
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: projectName }),
|
|
87384
87542
|
"."
|
|
87385
87543
|
] }),
|
|
87386
|
-
/* @__PURE__ */ (0,
|
|
87387
|
-
/* @__PURE__ */ (0,
|
|
87388
|
-
/* @__PURE__ */ (0,
|
|
87544
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87545
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: 'npm packages can ship "install scripts" \u2014 code that' }),
|
|
87546
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87389
87547
|
"runs the moment you ",
|
|
87390
|
-
/* @__PURE__ */ (0,
|
|
87548
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: "npm install" }),
|
|
87391
87549
|
" them."
|
|
87392
87550
|
] }),
|
|
87393
|
-
/* @__PURE__ */ (0,
|
|
87394
|
-
/* @__PURE__ */ (0,
|
|
87551
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87552
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87395
87553
|
"To catch that, use ",
|
|
87396
|
-
/* @__PURE__ */ (0,
|
|
87554
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: "dg npm install" }),
|
|
87397
87555
|
" or"
|
|
87398
87556
|
] }),
|
|
87399
|
-
/* @__PURE__ */ (0,
|
|
87400
|
-
/* @__PURE__ */ (0,
|
|
87557
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87558
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: "dg pip install" }),
|
|
87401
87559
|
" instead of the normal command."
|
|
87402
87560
|
] }),
|
|
87403
|
-
/* @__PURE__ */ (0,
|
|
87404
|
-
/* @__PURE__ */ (0,
|
|
87405
|
-
/* @__PURE__ */ (0,
|
|
87406
|
-
/* @__PURE__ */ (0,
|
|
87407
|
-
/* @__PURE__ */ (0,
|
|
87408
|
-
/* @__PURE__ */ (0,
|
|
87561
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "I scan the package first, before any code runs" }),
|
|
87562
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "on your machine." }),
|
|
87563
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87564
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "I can also add a safety net to git so nothing" }),
|
|
87565
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "slips through at commit time." }),
|
|
87566
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87409
87567
|
okButton,
|
|
87410
87568
|
stepHint
|
|
87411
87569
|
] });
|
|
87412
87570
|
case "detect":
|
|
87413
87571
|
if (!state.firstRun) {
|
|
87414
|
-
return /* @__PURE__ */ (0,
|
|
87415
|
-
/* @__PURE__ */ (0,
|
|
87416
|
-
/* @__PURE__ */ (0,
|
|
87572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
|
|
87573
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "green", children: "Dependency Guardian" }),
|
|
87574
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: "Looking around..." })
|
|
87417
87575
|
] });
|
|
87418
87576
|
}
|
|
87419
|
-
return /* @__PURE__ */ (0,
|
|
87577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Scene, { mood: "scanning", color: "cyan", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Spinner2, { label: "Looking around..." }) });
|
|
87420
87578
|
case "confirm_hook":
|
|
87421
|
-
if (!state.hookInfo) return /* @__PURE__ */ (0,
|
|
87579
|
+
if (!state.hookInfo) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "..." });
|
|
87422
87580
|
if (state.hookInfo.alreadyInstalled) {
|
|
87423
|
-
return /* @__PURE__ */ (0,
|
|
87424
|
-
/* @__PURE__ */ (0,
|
|
87425
|
-
/* @__PURE__ */ (0,
|
|
87426
|
-
/* @__PURE__ */ (0,
|
|
87427
|
-
/* @__PURE__ */ (0,
|
|
87428
|
-
/* @__PURE__ */ (0,
|
|
87581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Scene, { mood: "happy", color: "green", children: [
|
|
87582
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "green", children: "Looks like you already did this step." }),
|
|
87583
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87584
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "The pre-commit hook is already installed in" }),
|
|
87585
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87586
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: hookTargetFile }),
|
|
87429
87587
|
"."
|
|
87430
87588
|
] }),
|
|
87431
|
-
/* @__PURE__ */ (0,
|
|
87432
|
-
/* @__PURE__ */ (0,
|
|
87433
|
-
/* @__PURE__ */ (0,
|
|
87589
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87590
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "Every commit that adds a package gets scanned." }),
|
|
87591
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87434
87592
|
okButton,
|
|
87435
87593
|
stepHint
|
|
87436
87594
|
] });
|
|
87437
87595
|
}
|
|
87438
|
-
return /* @__PURE__ */ (0,
|
|
87439
|
-
/* @__PURE__ */ (0,
|
|
87440
|
-
/* @__PURE__ */ (0,
|
|
87441
|
-
/* @__PURE__ */ (0,
|
|
87442
|
-
/* @__PURE__ */ (0,
|
|
87443
|
-
/* @__PURE__ */ (0,
|
|
87444
|
-
/* @__PURE__ */ (0,
|
|
87445
|
-
/* @__PURE__ */ (0,
|
|
87446
|
-
/* @__PURE__ */ (0,
|
|
87447
|
-
/* @__PURE__ */ (0,
|
|
87596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Scene, { mood: "curious", color: "green", children: [
|
|
87597
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "Git can run a safety check before each commit." }),
|
|
87598
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "I'd add my scan to that check \u2014 one line of code." }),
|
|
87599
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87600
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "After that, every commit that adds a package" }),
|
|
87601
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "gets scanned first. If I find malware, the" }),
|
|
87602
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "commit stops before your code ships anywhere." }),
|
|
87603
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87604
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "Want me to set it up?" }),
|
|
87605
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87448
87606
|
yesNoRow("Yes", "No"),
|
|
87449
87607
|
stepHint
|
|
87450
87608
|
] });
|
|
87451
87609
|
case "install_hook":
|
|
87452
|
-
return /* @__PURE__ */ (0,
|
|
87610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Scene, { mood: "scanning", color: "cyan", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Spinner2, { label: "Adding the hook..." }) });
|
|
87453
87611
|
case "verify_hook":
|
|
87454
|
-
return /* @__PURE__ */ (0,
|
|
87612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Scene, { mood: "scanning", color: "cyan", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Spinner2, { label: "Testing it..." }) });
|
|
87455
87613
|
case "confirm_wrap":
|
|
87456
|
-
return /* @__PURE__ */ (0,
|
|
87457
|
-
state.hookVerifyMs !== null ? /* @__PURE__ */ (0,
|
|
87614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Scene, { mood: state.hookError ? "alert" : "happy", color: state.hookError ? "yellow" : "green", children: [
|
|
87615
|
+
state.hookVerifyMs !== null ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: "green", children: [
|
|
87458
87616
|
"\u2713 Hook works. ",
|
|
87459
|
-
/* @__PURE__ */ (0,
|
|
87617
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { bold: true, children: [
|
|
87460
87618
|
state.hookVerifyMs,
|
|
87461
87619
|
"ms"
|
|
87462
87620
|
] }),
|
|
87463
87621
|
"."
|
|
87464
87622
|
] }) : null,
|
|
87465
|
-
state.hookError ? /* @__PURE__ */ (0,
|
|
87623
|
+
state.hookError ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: "yellow", children: [
|
|
87466
87624
|
"\u26A0 ",
|
|
87467
87625
|
state.hookError
|
|
87468
87626
|
] }) : null,
|
|
87469
|
-
/* @__PURE__ */ (0,
|
|
87470
|
-
/* @__PURE__ */ (0,
|
|
87627
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87628
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { dimColor: true, children: [
|
|
87471
87629
|
"I can also catch packages at ",
|
|
87472
|
-
/* @__PURE__ */ (0,
|
|
87630
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: "npm install" }),
|
|
87473
87631
|
" time, before"
|
|
87474
87632
|
] }),
|
|
87475
|
-
/* @__PURE__ */ (0,
|
|
87476
|
-
/* @__PURE__ */ (0,
|
|
87477
|
-
/* @__PURE__ */ (0,
|
|
87478
|
-
/* @__PURE__ */ (0,
|
|
87633
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: "they hit your package.json. Adds one line to your shell config." }),
|
|
87634
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87635
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "Want it?" }),
|
|
87636
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87479
87637
|
yesNoRow(),
|
|
87480
87638
|
stepHint
|
|
87481
87639
|
] });
|
|
87482
87640
|
case "confirm_scan":
|
|
87483
|
-
return /* @__PURE__ */ (0,
|
|
87484
|
-
/* @__PURE__ */ (0,
|
|
87641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Scene, { mood: "happy", color: "green", children: [
|
|
87642
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87485
87643
|
"Can I scan ",
|
|
87486
|
-
/* @__PURE__ */ (0,
|
|
87644
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: projectName }),
|
|
87487
87645
|
" now?"
|
|
87488
87646
|
] }),
|
|
87489
|
-
/* @__PURE__ */ (0,
|
|
87490
|
-
/* @__PURE__ */ (0,
|
|
87491
|
-
/* @__PURE__ */ (0,
|
|
87492
|
-
/* @__PURE__ */ (0,
|
|
87647
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87648
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "I'll check what's already installed and show" }),
|
|
87649
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "you what I see." }),
|
|
87650
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87493
87651
|
yesNoRow("Scan", "Skip"),
|
|
87494
87652
|
stepHint
|
|
87495
87653
|
] });
|
|
87496
|
-
case "run_scan":
|
|
87497
|
-
|
|
87654
|
+
case "run_scan": {
|
|
87655
|
+
const p = state.scanProgress;
|
|
87656
|
+
if (p && p.total > 0) {
|
|
87657
|
+
const currentLabel = p.current.length > 0 ? p.current[0] : void 0;
|
|
87658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ProgressBar, { value: p.done, total: p.total, label: currentLabel });
|
|
87659
|
+
}
|
|
87660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Scene, { mood: "scanning", color: "cyan", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Spinner2, { label: "Scanning..." }) });
|
|
87661
|
+
}
|
|
87498
87662
|
case "result_first_scan": {
|
|
87499
87663
|
const r = state.scanResult;
|
|
87500
87664
|
const okScan = r?.status === "ok" && r.result;
|
|
87501
87665
|
const empty = r?.status === "no_packages";
|
|
87502
|
-
return /* @__PURE__ */ (0,
|
|
87503
|
-
/* @__PURE__ */ (0,
|
|
87504
|
-
/* @__PURE__ */ (0,
|
|
87505
|
-
okScan ? /* @__PURE__ */ (0,
|
|
87666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Scene, { mood: resultMood, color: resultMood === "alarmed" ? "red" : resultMood === "alert" ? "yellow" : "green", children: [
|
|
87667
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: "Done." }),
|
|
87668
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87669
|
+
okScan ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87506
87670
|
"I scanned ",
|
|
87507
|
-
/* @__PURE__ */ (0,
|
|
87671
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: projectName }),
|
|
87508
87672
|
"."
|
|
87509
|
-
] }) : empty ? /* @__PURE__ */ (0,
|
|
87673
|
+
] }) : empty ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87510
87674
|
"I didn't find any packages to scan in ",
|
|
87511
|
-
/* @__PURE__ */ (0,
|
|
87675
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: projectName }),
|
|
87512
87676
|
"."
|
|
87513
|
-
] }) : /* @__PURE__ */ (0,
|
|
87677
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87514
87678
|
"I tried to scan ",
|
|
87515
|
-
/* @__PURE__ */ (0,
|
|
87679
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: projectName }),
|
|
87516
87680
|
" but ran into a snag."
|
|
87517
87681
|
] }),
|
|
87518
|
-
/* @__PURE__ */ (0,
|
|
87519
|
-
state.scanResult ? /* @__PURE__ */ (0,
|
|
87520
|
-
/* @__PURE__ */ (0,
|
|
87521
|
-
okScan && resultMood === "happy" ? /* @__PURE__ */ (0,
|
|
87522
|
-
/* @__PURE__ */ (0,
|
|
87682
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87683
|
+
state.scanResult ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ScanResultCard, { outcome: { kind: "real", outcome: state.scanResult } }) : null,
|
|
87684
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87685
|
+
okScan && resultMood === "happy" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "green", children: "You're already in good shape." }) : null,
|
|
87686
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87523
87687
|
okButton,
|
|
87524
87688
|
stepHint
|
|
87525
87689
|
] });
|
|
87526
87690
|
}
|
|
87527
87691
|
case "what_happens_next":
|
|
87528
|
-
return /* @__PURE__ */ (0,
|
|
87529
|
-
/* @__PURE__ */ (0,
|
|
87530
|
-
/* @__PURE__ */ (0,
|
|
87531
|
-
/* @__PURE__ */ (0,
|
|
87532
|
-
/* @__PURE__ */ (0,
|
|
87533
|
-
/* @__PURE__ */ (0,
|
|
87534
|
-
/* @__PURE__ */ (0,
|
|
87535
|
-
/* @__PURE__ */ (0,
|
|
87536
|
-
/* @__PURE__ */ (0,
|
|
87537
|
-
/* @__PURE__ */ (0,
|
|
87538
|
-
/* @__PURE__ */ (0,
|
|
87692
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Scene, { mood: "explaining", color: "cyan", children: [
|
|
87693
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: "What happens from here." }),
|
|
87694
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87695
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "You commit normally. If I find nothing, you" }),
|
|
87696
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "won't even see me \u2014 the commit just goes through." }),
|
|
87697
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87698
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "If I find something bad, you'll see a card like" }),
|
|
87699
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "the demo I showed you. Read it. If it's a real" }),
|
|
87700
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "threat, investigate." }),
|
|
87701
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87702
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87539
87703
|
"If it's a false alarm, just add ",
|
|
87540
|
-
/* @__PURE__ */ (0,
|
|
87704
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: "--no-verify" }),
|
|
87541
87705
|
":"
|
|
87542
87706
|
] }),
|
|
87543
|
-
/* @__PURE__ */ (0,
|
|
87707
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87544
87708
|
" ",
|
|
87545
|
-
/* @__PURE__ */ (0,
|
|
87709
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: 'git commit -m "your message" --no-verify' })
|
|
87546
87710
|
] }),
|
|
87547
|
-
/* @__PURE__ */ (0,
|
|
87548
|
-
/* @__PURE__ */ (0,
|
|
87549
|
-
/* @__PURE__ */ (0,
|
|
87711
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87712
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "I won't be offended." }),
|
|
87713
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87550
87714
|
okButton,
|
|
87551
87715
|
stepHint
|
|
87552
87716
|
] });
|
|
87553
87717
|
case "pitch_app":
|
|
87554
|
-
return /* @__PURE__ */ (0,
|
|
87555
|
-
/* @__PURE__ */ (0,
|
|
87556
|
-
/* @__PURE__ */ (0,
|
|
87557
|
-
/* @__PURE__ */ (0,
|
|
87558
|
-
/* @__PURE__ */ (0,
|
|
87559
|
-
/* @__PURE__ */ (0,
|
|
87560
|
-
/* @__PURE__ */ (0,
|
|
87561
|
-
/* @__PURE__ */ (0,
|
|
87562
|
-
/* @__PURE__ */ (0,
|
|
87718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Scene, { mood: "idle", color: "green", children: [
|
|
87719
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: "One last thing." }),
|
|
87720
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87721
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "I'm watching your laptop. For your team," }),
|
|
87722
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "there's a GitHub App that watches every pull" }),
|
|
87723
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "request the same way. Optional \u2014 install it" }),
|
|
87724
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "whenever:" }),
|
|
87725
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87726
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87563
87727
|
" ",
|
|
87564
|
-
/* @__PURE__ */ (0,
|
|
87728
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: "https://github.com/apps/dependency-guardian" })
|
|
87565
87729
|
] }),
|
|
87566
|
-
/* @__PURE__ */ (0,
|
|
87730
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87567
87731
|
okButton,
|
|
87568
87732
|
stepHint
|
|
87569
87733
|
] });
|
|
@@ -87576,7 +87740,7 @@ var init_InitApp = __esm({
|
|
|
87576
87740
|
const verdict = r.action === "block" ? "BLOCKED" : r.action === "warn" ? "WARNING" : "PASSED";
|
|
87577
87741
|
const color = r.action === "block" ? "red" : r.action === "warn" ? "yellow" : "green";
|
|
87578
87742
|
scanLine.push(
|
|
87579
|
-
/* @__PURE__ */ (0,
|
|
87743
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color, children: [
|
|
87580
87744
|
"\u2713 Scanned ",
|
|
87581
87745
|
scan.result.scannedCount,
|
|
87582
87746
|
" package",
|
|
@@ -87591,136 +87755,136 @@ var init_InitApp = __esm({
|
|
|
87591
87755
|
] }, "scan-summary")
|
|
87592
87756
|
);
|
|
87593
87757
|
} else if (scan.status === "no_packages") {
|
|
87594
|
-
scanLine.push(/* @__PURE__ */ (0,
|
|
87758
|
+
scanLine.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { dimColor: true, children: [
|
|
87595
87759
|
"\u2713 Scan ran \u2014 nothing to check yet (",
|
|
87596
87760
|
scan.result?.durationMs ?? 0,
|
|
87597
87761
|
"ms)"
|
|
87598
87762
|
] }, "scan-empty"));
|
|
87599
87763
|
} else if (scan.status === "trial_exhausted") {
|
|
87600
|
-
scanLine.push(/* @__PURE__ */ (0,
|
|
87764
|
+
scanLine.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "yellow", children: "\u26A0 Free trial scans used up \u2014 `dg login` to continue" }, "scan-trial"));
|
|
87601
87765
|
} else if (scan.status === "error") {
|
|
87602
|
-
scanLine.push(/* @__PURE__ */ (0,
|
|
87766
|
+
scanLine.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: "yellow", children: [
|
|
87603
87767
|
"\u26A0 Scan didn't finish: ",
|
|
87604
87768
|
scan.message
|
|
87605
87769
|
] }, "scan-err"));
|
|
87606
87770
|
}
|
|
87607
|
-
scanLine.push(/* @__PURE__ */ (0,
|
|
87771
|
+
scanLine.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }, "sp"));
|
|
87608
87772
|
}
|
|
87609
|
-
return /* @__PURE__ */ (0,
|
|
87610
|
-
/* @__PURE__ */ (0,
|
|
87611
|
-
/* @__PURE__ */ (0,
|
|
87773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
|
|
87774
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "green", children: "Server-side coverage (optional)" }),
|
|
87775
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87612
87776
|
scanLine,
|
|
87613
|
-
/* @__PURE__ */ (0,
|
|
87614
|
-
/* @__PURE__ */ (0,
|
|
87615
|
-
/* @__PURE__ */ (0,
|
|
87616
|
-
/* @__PURE__ */ (0,
|
|
87617
|
-
/* @__PURE__ */ (0,
|
|
87618
|
-
/* @__PURE__ */ (0,
|
|
87777
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: "The CLI protects you on this laptop. Install the GitHub App" }),
|
|
87778
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: "too for server-side scanning on every PR." }),
|
|
87779
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87780
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "cyan", children: "https://github.com/apps/dependency-guardian/installations/new" }),
|
|
87781
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87782
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: "Press Enter to continue." }),
|
|
87619
87783
|
stepHint
|
|
87620
87784
|
] });
|
|
87621
87785
|
}
|
|
87622
87786
|
case "done": {
|
|
87623
87787
|
const lines = [];
|
|
87624
87788
|
if (state.firstRun && state.skipped.has("scenario") && state.engaged) {
|
|
87625
|
-
return /* @__PURE__ */ (0,
|
|
87626
|
-
/* @__PURE__ */ (0,
|
|
87627
|
-
/* @__PURE__ */ (0,
|
|
87628
|
-
returning ? /* @__PURE__ */ (0,
|
|
87789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Scene, { mood: "wink", color: "cyan", children: [
|
|
87790
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "No worries." }),
|
|
87791
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87792
|
+
returning ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87629
87793
|
"Catch you later. ",
|
|
87630
|
-
/* @__PURE__ */ (0,
|
|
87794
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: "dg kitty" }),
|
|
87631
87795
|
" any time."
|
|
87632
|
-
] }) : /* @__PURE__ */ (0,
|
|
87633
|
-
/* @__PURE__ */ (0,
|
|
87634
|
-
/* @__PURE__ */ (0,
|
|
87796
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
87797
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "Running your command now. If you change your" }),
|
|
87798
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87635
87799
|
"mind later, ",
|
|
87636
|
-
/* @__PURE__ */ (0,
|
|
87800
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: "dg kitty" }),
|
|
87637
87801
|
" brings me back."
|
|
87638
87802
|
] })
|
|
87639
87803
|
] }),
|
|
87640
|
-
/* @__PURE__ */ (0,
|
|
87804
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87641
87805
|
okButton
|
|
87642
87806
|
] });
|
|
87643
87807
|
}
|
|
87644
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87645
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87808
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "green", children: "You're set." }, "header"));
|
|
87809
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }, "sp1"));
|
|
87646
87810
|
if (state.hookInstalled && !state.skipped.has("install_hook")) {
|
|
87647
87811
|
lines.push(
|
|
87648
|
-
/* @__PURE__ */ (0,
|
|
87812
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87649
87813
|
" ",
|
|
87650
|
-
/* @__PURE__ */ (0,
|
|
87814
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "green", children: "\u2713" }),
|
|
87651
87815
|
" I'm running on every commit"
|
|
87652
87816
|
] }, "hook")
|
|
87653
87817
|
);
|
|
87654
87818
|
} else {
|
|
87655
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87819
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: " \u25CB Hook (skipped)" }, "hook"));
|
|
87656
87820
|
}
|
|
87657
87821
|
if (state.scanRan && state.scanResult) {
|
|
87658
87822
|
const scan = state.scanResult;
|
|
87659
87823
|
if (scan.status === "ok" && scan.result) {
|
|
87660
87824
|
const r = scan.result.result;
|
|
87661
|
-
const tail = r.action === "block" ? /* @__PURE__ */ (0,
|
|
87825
|
+
const tail = r.action === "block" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "red", bold: true, children: "found something to block" }) : r.action === "warn" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "yellow", bold: true, children: "flagged a few things" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "green", children: "all clean" });
|
|
87662
87826
|
lines.push(
|
|
87663
|
-
/* @__PURE__ */ (0,
|
|
87827
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87664
87828
|
" ",
|
|
87665
|
-
/* @__PURE__ */ (0,
|
|
87829
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "green", children: "\u2713" }),
|
|
87666
87830
|
" Scanned ",
|
|
87667
|
-
/* @__PURE__ */ (0,
|
|
87831
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: scan.result.scannedCount }),
|
|
87668
87832
|
" packages \u2014 ",
|
|
87669
87833
|
tail
|
|
87670
87834
|
] }, "scan")
|
|
87671
87835
|
);
|
|
87672
87836
|
} else if (scan.status === "no_packages") {
|
|
87673
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87837
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: " \u25CB Nothing to scan yet" }, "scan"));
|
|
87674
87838
|
} else {
|
|
87675
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87839
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: "yellow", children: [
|
|
87676
87840
|
" \u26A0 ",
|
|
87677
87841
|
scan.message ?? "scan didn't finish"
|
|
87678
87842
|
] }, "scan"));
|
|
87679
87843
|
}
|
|
87680
87844
|
} else if (state.skipped.has("run_scan")) {
|
|
87681
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87845
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: " \u25CB First scan (skipped)" }, "scan"));
|
|
87682
87846
|
}
|
|
87683
87847
|
lines.push(
|
|
87684
|
-
/* @__PURE__ */ (0,
|
|
87848
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87685
87849
|
" ",
|
|
87686
|
-
/* @__PURE__ */ (0,
|
|
87850
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "green", children: "\u2713" }),
|
|
87687
87851
|
" You know how to bypass me if I'm wrong"
|
|
87688
87852
|
] }, "bypass")
|
|
87689
87853
|
);
|
|
87690
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87691
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87854
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }, "sp2"));
|
|
87855
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87692
87856
|
"Forget anything? ",
|
|
87693
|
-
/* @__PURE__ */ (0,
|
|
87857
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: "dg kitty" }),
|
|
87694
87858
|
" brings me back."
|
|
87695
87859
|
] }, "kitty"));
|
|
87696
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87860
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87697
87861
|
"Full command list: ",
|
|
87698
|
-
/* @__PURE__ */ (0,
|
|
87862
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: "dg help" })
|
|
87699
87863
|
] }, "help"));
|
|
87700
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87864
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87701
87865
|
"Curious about more? ",
|
|
87702
|
-
/* @__PURE__ */ (0,
|
|
87866
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: "https://westbayberry.com/docs" })
|
|
87703
87867
|
] }, "docs"));
|
|
87704
87868
|
if (state.hookError) {
|
|
87705
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87706
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87869
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }, "sp3"));
|
|
87870
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: "yellow", children: [
|
|
87707
87871
|
"Note: ",
|
|
87708
87872
|
state.hookError
|
|
87709
87873
|
] }, "err"));
|
|
87710
87874
|
}
|
|
87711
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87712
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87875
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }, "sp4"));
|
|
87876
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "green", children: "Build fast, don't get hacked." }, "signoff"));
|
|
87713
87877
|
if (state.dryRun) {
|
|
87714
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87878
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "yellow", children: "(dry run \u2014 no files were modified)" }, "dry"));
|
|
87715
87879
|
}
|
|
87716
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87880
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }, "sp5"));
|
|
87717
87881
|
lines.push(
|
|
87718
|
-
/* @__PURE__ */ (0,
|
|
87882
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { inverse: true, bold: true, color: "green", children: ` OK ` }) }, "ok-btn")
|
|
87719
87883
|
);
|
|
87720
87884
|
if (!state.firstRun) {
|
|
87721
|
-
return /* @__PURE__ */ (0,
|
|
87885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { flexDirection: "column", paddingLeft: 1, children: lines });
|
|
87722
87886
|
}
|
|
87723
|
-
return /* @__PURE__ */ (0,
|
|
87887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Scene, { mood: state.hookError ? "worried" : "proud", color: state.hookError ? "yellow" : "green", children: lines });
|
|
87724
87888
|
}
|
|
87725
87889
|
}
|
|
87726
87890
|
};
|
|
@@ -87807,11 +87971,11 @@ function reducer2(state, action) {
|
|
|
87807
87971
|
}
|
|
87808
87972
|
}
|
|
87809
87973
|
function useLogin() {
|
|
87810
|
-
const [state, dispatch] = (0,
|
|
87811
|
-
const started = (0,
|
|
87812
|
-
const sessionRef = (0,
|
|
87813
|
-
const cancelledRef = (0,
|
|
87814
|
-
(0,
|
|
87974
|
+
const [state, dispatch] = (0, import_react28.useReducer)(reducer2, { phase: "creating" });
|
|
87975
|
+
const started = (0, import_react28.useRef)(false);
|
|
87976
|
+
const sessionRef = (0, import_react28.useRef)(null);
|
|
87977
|
+
const cancelledRef = (0, import_react28.useRef)(false);
|
|
87978
|
+
(0, import_react28.useEffect)(() => {
|
|
87815
87979
|
if (started.current) return;
|
|
87816
87980
|
started.current = true;
|
|
87817
87981
|
(async () => {
|
|
@@ -87855,7 +88019,7 @@ function useLogin() {
|
|
|
87855
88019
|
cancelledRef.current = true;
|
|
87856
88020
|
};
|
|
87857
88021
|
}, []);
|
|
87858
|
-
const openAndPoll = (0,
|
|
88022
|
+
const openAndPoll = (0, import_react28.useCallback)(() => {
|
|
87859
88023
|
const session = sessionRef.current;
|
|
87860
88024
|
if (!session) return;
|
|
87861
88025
|
dispatch({ type: "BROWSER_OPENED" });
|
|
@@ -87891,11 +88055,11 @@ function useLogin() {
|
|
|
87891
88055
|
}, []);
|
|
87892
88056
|
return { state, openAndPoll };
|
|
87893
88057
|
}
|
|
87894
|
-
var
|
|
88058
|
+
var import_react28, POLL_INTERVAL_MS, MAX_POLL_ATTEMPTS;
|
|
87895
88059
|
var init_useLogin = __esm({
|
|
87896
88060
|
"src/ui/hooks/useLogin.ts"() {
|
|
87897
88061
|
"use strict";
|
|
87898
|
-
|
|
88062
|
+
import_react28 = __toESM(require_react());
|
|
87899
88063
|
init_auth();
|
|
87900
88064
|
POLL_INTERVAL_MS = 2e3;
|
|
87901
88065
|
MAX_POLL_ATTEMPTS = 150;
|
|
@@ -87907,19 +88071,19 @@ var LoginApp_exports = {};
|
|
|
87907
88071
|
__export(LoginApp_exports, {
|
|
87908
88072
|
LoginApp: () => LoginApp
|
|
87909
88073
|
});
|
|
87910
|
-
var
|
|
88074
|
+
var import_react29, import_jsx_runtime8, LoginApp;
|
|
87911
88075
|
var init_LoginApp = __esm({
|
|
87912
88076
|
async "src/ui/LoginApp.tsx"() {
|
|
87913
88077
|
"use strict";
|
|
87914
|
-
|
|
88078
|
+
import_react29 = __toESM(require_react());
|
|
87915
88079
|
await init_build2();
|
|
87916
88080
|
init_useLogin();
|
|
87917
88081
|
await init_Spinner();
|
|
87918
|
-
|
|
88082
|
+
import_jsx_runtime8 = __toESM(require_jsx_runtime());
|
|
87919
88083
|
LoginApp = () => {
|
|
87920
88084
|
const { state, openAndPoll } = useLogin();
|
|
87921
88085
|
const { exit } = use_app_default();
|
|
87922
|
-
(0,
|
|
88086
|
+
(0, import_react29.useEffect)(() => {
|
|
87923
88087
|
if (state.phase === "success") {
|
|
87924
88088
|
process.exitCode = 0;
|
|
87925
88089
|
const timer = setTimeout(() => exit(), 0);
|
|
@@ -87943,60 +88107,60 @@ var init_LoginApp = __esm({
|
|
|
87943
88107
|
});
|
|
87944
88108
|
switch (state.phase) {
|
|
87945
88109
|
case "creating":
|
|
87946
|
-
return /* @__PURE__ */ (0,
|
|
88110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Spinner2, { label: "Creating login session..." });
|
|
87947
88111
|
case "already_logged_in":
|
|
87948
|
-
return /* @__PURE__ */ (0,
|
|
87949
|
-
/* @__PURE__ */ (0,
|
|
87950
|
-
/* @__PURE__ */ (0,
|
|
88112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
|
|
88113
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "yellow", children: "Already authenticated." }),
|
|
88114
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { dimColor: true, children: [
|
|
87951
88115
|
"Run ",
|
|
87952
88116
|
"`dg logout`",
|
|
87953
88117
|
" first to re-authenticate."
|
|
87954
88118
|
] })
|
|
87955
88119
|
] });
|
|
87956
88120
|
case "ready":
|
|
87957
|
-
return /* @__PURE__ */ (0,
|
|
87958
|
-
/* @__PURE__ */ (0,
|
|
87959
|
-
/* @__PURE__ */ (0,
|
|
87960
|
-
/* @__PURE__ */ (0,
|
|
87961
|
-
/* @__PURE__ */ (0,
|
|
87962
|
-
/* @__PURE__ */ (0,
|
|
88121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
|
|
88122
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: " " }),
|
|
88123
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: "Authenticate your account at:" }),
|
|
88124
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "cyan", children: state.verifyUrl }),
|
|
88125
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: " " }),
|
|
88126
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { dimColor: true, children: "Press ENTER to open in the browser..." })
|
|
87963
88127
|
] });
|
|
87964
88128
|
case "waiting":
|
|
87965
|
-
return /* @__PURE__ */ (0,
|
|
87966
|
-
/* @__PURE__ */ (0,
|
|
87967
|
-
/* @__PURE__ */ (0,
|
|
87968
|
-
/* @__PURE__ */ (0,
|
|
87969
|
-
/* @__PURE__ */ (0,
|
|
87970
|
-
/* @__PURE__ */ (0,
|
|
88129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
|
|
88130
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: " " }),
|
|
88131
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: "Authenticate your account at:" }),
|
|
88132
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "cyan", children: state.verifyUrl }),
|
|
88133
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: " " }),
|
|
88134
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Spinner2, { label: "Waiting for authorization..." })
|
|
87971
88135
|
] });
|
|
87972
88136
|
case "success":
|
|
87973
|
-
return /* @__PURE__ */ (0,
|
|
87974
|
-
/* @__PURE__ */ (0,
|
|
87975
|
-
/* @__PURE__ */ (0,
|
|
88137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
|
|
88138
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: " " }),
|
|
88139
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { color: "green", bold: true, children: [
|
|
87976
88140
|
"Logged in as ",
|
|
87977
88141
|
state.email
|
|
87978
88142
|
] }),
|
|
87979
|
-
/* @__PURE__ */ (0,
|
|
87980
|
-
/* @__PURE__ */ (0,
|
|
87981
|
-
/* @__PURE__ */ (0,
|
|
88143
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { dimColor: true, children: "Credentials saved." }),
|
|
88144
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: " " }),
|
|
88145
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { children: [
|
|
87982
88146
|
"Run ",
|
|
87983
88147
|
"`dg scan`",
|
|
87984
88148
|
" to scan your dependencies."
|
|
87985
88149
|
] })
|
|
87986
88150
|
] });
|
|
87987
88151
|
case "expired":
|
|
87988
|
-
return /* @__PURE__ */ (0,
|
|
87989
|
-
/* @__PURE__ */ (0,
|
|
87990
|
-
/* @__PURE__ */ (0,
|
|
88152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
|
|
88153
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "yellow", children: "Session expired." }),
|
|
88154
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { dimColor: true, children: [
|
|
87991
88155
|
"Run ",
|
|
87992
88156
|
"`dg login`",
|
|
87993
88157
|
" to try again."
|
|
87994
88158
|
] })
|
|
87995
88159
|
] });
|
|
87996
88160
|
case "error":
|
|
87997
|
-
return /* @__PURE__ */ (0,
|
|
87998
|
-
/* @__PURE__ */ (0,
|
|
87999
|
-
/* @__PURE__ */ (0,
|
|
88161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
|
|
88162
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "red", bold: true, children: "Error: " }),
|
|
88163
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "red", children: state.message })
|
|
88000
88164
|
] });
|
|
88001
88165
|
}
|
|
88002
88166
|
};
|
|
@@ -88259,14 +88423,14 @@ function reducer3(state, action) {
|
|
|
88259
88423
|
return { ...state, error: action.error };
|
|
88260
88424
|
}
|
|
88261
88425
|
}
|
|
88262
|
-
var
|
|
88426
|
+
var import_react30, import_chalk5, import_jsx_runtime9, VISIBLE_ROWS, FileSavePrompt;
|
|
88263
88427
|
var init_FileSavePrompt = __esm({
|
|
88264
88428
|
async "src/ui/components/FileSavePrompt.tsx"() {
|
|
88265
88429
|
"use strict";
|
|
88266
|
-
|
|
88430
|
+
import_react30 = __toESM(require_react());
|
|
88267
88431
|
await init_build2();
|
|
88268
|
-
|
|
88269
|
-
|
|
88432
|
+
import_chalk5 = __toESM(require_source());
|
|
88433
|
+
import_jsx_runtime9 = __toESM(require_jsx_runtime());
|
|
88270
88434
|
VISIBLE_ROWS = 15;
|
|
88271
88435
|
FileSavePrompt = ({
|
|
88272
88436
|
defaultName,
|
|
@@ -88278,8 +88442,8 @@ var init_FileSavePrompt = __esm({
|
|
|
88278
88442
|
onSaved,
|
|
88279
88443
|
onCancel
|
|
88280
88444
|
}) => {
|
|
88281
|
-
const initialEntries = (0,
|
|
88282
|
-
const [state, dispatch] = (0,
|
|
88445
|
+
const initialEntries = (0, import_react30.useMemo)(() => listDirectory(initialDir), [initialDir]);
|
|
88446
|
+
const [state, dispatch] = (0, import_react30.useReducer)(reducer3, {
|
|
88283
88447
|
filename: defaultName,
|
|
88284
88448
|
cursorPos: defaultName.length,
|
|
88285
88449
|
directory: initialDir,
|
|
@@ -88291,7 +88455,7 @@ var init_FileSavePrompt = __esm({
|
|
|
88291
88455
|
confirmOverwrite: false,
|
|
88292
88456
|
error: null
|
|
88293
88457
|
});
|
|
88294
|
-
const filteredEntries = (0,
|
|
88458
|
+
const filteredEntries = (0, import_react30.useMemo)(() => {
|
|
88295
88459
|
const dirs = state.entries.filter((e) => e.isDirectory);
|
|
88296
88460
|
if (!state.filterText) return dirs;
|
|
88297
88461
|
const q = state.filterText.toLowerCase();
|
|
@@ -88384,86 +88548,86 @@ var init_FileSavePrompt = __esm({
|
|
|
88384
88548
|
dispatch({ type: "FILTER", text: state.filterText + input });
|
|
88385
88549
|
}
|
|
88386
88550
|
});
|
|
88387
|
-
const actionColor2 = scanAction === "block" ?
|
|
88388
|
-
const filenameDisplay = state.filename.slice(0, state.cursorPos) + (state.focus === "filename" ?
|
|
88551
|
+
const actionColor2 = scanAction === "block" ? import_chalk5.default.red : scanAction === "warn" ? import_chalk5.default.yellow : import_chalk5.default.green;
|
|
88552
|
+
const filenameDisplay = state.filename.slice(0, state.cursorPos) + (state.focus === "filename" ? import_chalk5.default.inverse(state.filename[state.cursorPos] || " ") : "") + state.filename.slice(state.cursorPos + 1);
|
|
88389
88553
|
const shortDir = state.directory.replace(process.env.HOME || "", "~");
|
|
88390
|
-
return /* @__PURE__ */ (0,
|
|
88391
|
-
/* @__PURE__ */ (0,
|
|
88392
|
-
|
|
88554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
|
|
88555
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
|
|
88556
|
+
import_chalk5.default.cyan("\u25C6"),
|
|
88393
88557
|
" ",
|
|
88394
|
-
|
|
88558
|
+
import_chalk5.default.bold("Save Scan Results")
|
|
88395
88559
|
] }),
|
|
88396
|
-
/* @__PURE__ */ (0,
|
|
88560
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
|
|
88397
88561
|
"Score: ",
|
|
88398
|
-
|
|
88562
|
+
import_chalk5.default.bold(String(score)),
|
|
88399
88563
|
" ",
|
|
88400
88564
|
actionColor2(scanAction.toUpperCase()),
|
|
88401
88565
|
" ",
|
|
88402
|
-
|
|
88566
|
+
import_chalk5.default.dim("\u2502"),
|
|
88403
88567
|
" ",
|
|
88404
88568
|
packageCount,
|
|
88405
88569
|
" packages scanned"
|
|
88406
88570
|
] }),
|
|
88407
|
-
/* @__PURE__ */ (0,
|
|
88408
|
-
/* @__PURE__ */ (0,
|
|
88409
|
-
state.focus === "filename" ?
|
|
88410
|
-
|
|
88571
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { children: "" }),
|
|
88572
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
|
|
88573
|
+
state.focus === "filename" ? import_chalk5.default.cyan("\u258C") : " ",
|
|
88574
|
+
import_chalk5.default.bold("File:"),
|
|
88411
88575
|
" ",
|
|
88412
88576
|
filenameDisplay,
|
|
88413
|
-
|
|
88577
|
+
import_chalk5.default.dim(".json")
|
|
88414
88578
|
] }),
|
|
88415
|
-
/* @__PURE__ */ (0,
|
|
88579
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { children: import_chalk5.default.dim(` \u2500\u2500\u2500 ${shortDir} \u2500\u2500\u2500 [${state.browserCursor + 1}/${filteredEntries.length}]`) }),
|
|
88416
88580
|
visibleEntries.map((entry, i) => {
|
|
88417
88581
|
const realIdx = state.browserViewport + i;
|
|
88418
88582
|
const isCursor = state.focus === "browser" && realIdx === state.browserCursor;
|
|
88419
|
-
const prefix = isCursor ?
|
|
88583
|
+
const prefix = isCursor ? import_chalk5.default.cyan("\u258C") : " ";
|
|
88420
88584
|
const icon = entry.isDirectory ? "\u{1F4C1} " : " ";
|
|
88421
|
-
const name = entry.isDirectory ?
|
|
88422
|
-
return /* @__PURE__ */ (0,
|
|
88585
|
+
const name = entry.isDirectory ? import_chalk5.default.bold(entry.name + "/") : entry.name;
|
|
88586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
|
|
88423
88587
|
prefix,
|
|
88424
88588
|
icon,
|
|
88425
88589
|
name
|
|
88426
88590
|
] }, `${entry.name}-${i}`);
|
|
88427
88591
|
}),
|
|
88428
|
-
filteredEntries.length > VISIBLE_ROWS && /* @__PURE__ */ (0,
|
|
88592
|
+
filteredEntries.length > VISIBLE_ROWS && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { dimColor: true, children: [
|
|
88429
88593
|
" ",
|
|
88430
|
-
|
|
88594
|
+
import_chalk5.default.dim(`\u2191\u2193 ${filteredEntries.length - VISIBLE_ROWS} more`)
|
|
88431
88595
|
] }),
|
|
88432
|
-
/* @__PURE__ */ (0,
|
|
88433
|
-
state.filterText && /* @__PURE__ */ (0,
|
|
88596
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { children: "" }),
|
|
88597
|
+
state.filterText && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { dimColor: true, children: [
|
|
88434
88598
|
' filter: "',
|
|
88435
88599
|
state.filterText,
|
|
88436
88600
|
'" (',
|
|
88437
88601
|
filteredEntries.length,
|
|
88438
88602
|
" matches)"
|
|
88439
88603
|
] }),
|
|
88440
|
-
state.confirmOverwrite && /* @__PURE__ */ (0,
|
|
88604
|
+
state.confirmOverwrite && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: "yellow", children: [
|
|
88441
88605
|
" ",
|
|
88442
|
-
|
|
88606
|
+
import_chalk5.default.yellow("\u26A0"),
|
|
88443
88607
|
" ",
|
|
88444
88608
|
ensureJsonExtension(state.filename),
|
|
88445
88609
|
" exists ",
|
|
88446
|
-
|
|
88610
|
+
import_chalk5.default.dim("\u2014"),
|
|
88447
88611
|
" Enter again to overwrite"
|
|
88448
88612
|
] }),
|
|
88449
|
-
state.error && /* @__PURE__ */ (0,
|
|
88613
|
+
state.error && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: "red", children: [
|
|
88450
88614
|
" ",
|
|
88451
|
-
|
|
88615
|
+
import_chalk5.default.red("\u2717"),
|
|
88452
88616
|
" ",
|
|
88453
88617
|
state.error
|
|
88454
88618
|
] }),
|
|
88455
|
-
/* @__PURE__ */ (0,
|
|
88456
|
-
|
|
88619
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
|
|
88620
|
+
import_chalk5.default.bold.hex("#FFD700")("\u23CE"),
|
|
88457
88621
|
" ",
|
|
88458
|
-
|
|
88622
|
+
import_chalk5.default.bold.hex("#FFD700")("save"),
|
|
88459
88623
|
" ",
|
|
88460
|
-
|
|
88624
|
+
import_chalk5.default.bold.cyan("\u2191\u2193"),
|
|
88461
88625
|
" ",
|
|
88462
|
-
|
|
88626
|
+
import_chalk5.default.dim("browse"),
|
|
88463
88627
|
" ",
|
|
88464
|
-
|
|
88628
|
+
import_chalk5.default.bold.cyan("esc"),
|
|
88465
88629
|
" ",
|
|
88466
|
-
|
|
88630
|
+
import_chalk5.default.dim("cancel")
|
|
88467
88631
|
] })
|
|
88468
88632
|
] });
|
|
88469
88633
|
};
|
|
@@ -88485,12 +88649,12 @@ function writeJsonFile(filepath, json) {
|
|
|
88485
88649
|
const resolved = resolvePath(filepath);
|
|
88486
88650
|
try {
|
|
88487
88651
|
writeFileSync5(resolved, json + "\n");
|
|
88488
|
-
process.stderr.write(
|
|
88652
|
+
process.stderr.write(import_chalk6.default.green(` \u2713 Saved to ${resolved}
|
|
88489
88653
|
|
|
88490
88654
|
`));
|
|
88491
88655
|
} catch (err) {
|
|
88492
88656
|
const msg = err instanceof Error ? err.message : String(err);
|
|
88493
|
-
process.stderr.write(
|
|
88657
|
+
process.stderr.write(import_chalk6.default.red(` Error saving file: ${msg}
|
|
88494
88658
|
|
|
88495
88659
|
`));
|
|
88496
88660
|
}
|
|
@@ -88522,14 +88686,14 @@ async function handleJsonOutput(result, config3) {
|
|
|
88522
88686
|
json,
|
|
88523
88687
|
onSaved: (filepath) => {
|
|
88524
88688
|
inkInstance.unmount();
|
|
88525
|
-
process.stderr.write(
|
|
88689
|
+
process.stderr.write(import_chalk6.default.green(` \u2713 Saved to ${filepath}
|
|
88526
88690
|
|
|
88527
88691
|
`));
|
|
88528
88692
|
resolve2();
|
|
88529
88693
|
},
|
|
88530
88694
|
onCancel: () => {
|
|
88531
88695
|
inkInstance.unmount();
|
|
88532
|
-
process.stderr.write(
|
|
88696
|
+
process.stderr.write(import_chalk6.default.dim(" Cancelled.\n\n"));
|
|
88533
88697
|
resolve2();
|
|
88534
88698
|
}
|
|
88535
88699
|
})
|
|
@@ -88540,7 +88704,7 @@ async function handleJsonOutput(result, config3) {
|
|
|
88540
88704
|
function printTrialBanner(result) {
|
|
88541
88705
|
if (result.trialScansRemaining === void 0) return;
|
|
88542
88706
|
process.stderr.write(
|
|
88543
|
-
|
|
88707
|
+
import_chalk6.default.dim(` Free tier \xB7 Run \`dg login\` for higher scan limits.
|
|
88544
88708
|
`)
|
|
88545
88709
|
);
|
|
88546
88710
|
}
|
|
@@ -88562,13 +88726,13 @@ function handleTrialExhausted2(error2, jsonMode = false) {
|
|
|
88562
88726
|
}, null, 2) + "\n");
|
|
88563
88727
|
} else {
|
|
88564
88728
|
if (hasKey) {
|
|
88565
|
-
process.stderr.write(
|
|
88729
|
+
process.stderr.write(import_chalk6.default.yellow(`
|
|
88566
88730
|
${message}
|
|
88567
88731
|
|
|
88568
88732
|
`));
|
|
88569
88733
|
} else {
|
|
88570
88734
|
process.stderr.write(
|
|
88571
|
-
|
|
88735
|
+
import_chalk6.default.yellow("\n Monthly scan limit reached (1,000 scans/month on free tier).\n") + import_chalk6.default.white(" Run `dg login` for higher limits, or upgrade at westbayberry.com/pricing\n\n")
|
|
88572
88736
|
);
|
|
88573
88737
|
}
|
|
88574
88738
|
}
|
|
@@ -88578,9 +88742,9 @@ function handleTrialExhausted2(error2, jsonMode = false) {
|
|
|
88578
88742
|
return false;
|
|
88579
88743
|
}
|
|
88580
88744
|
function actionColor(action) {
|
|
88581
|
-
if (action === "block") return
|
|
88582
|
-
if (action === "warn") return
|
|
88583
|
-
return
|
|
88745
|
+
if (action === "block") return import_chalk6.default.red;
|
|
88746
|
+
if (action === "warn") return import_chalk6.default.yellow;
|
|
88747
|
+
return import_chalk6.default.green;
|
|
88584
88748
|
}
|
|
88585
88749
|
function pad(s, len) {
|
|
88586
88750
|
return s + " ".repeat(Math.max(0, len - s.length));
|
|
@@ -88600,18 +88764,18 @@ function groupPackages(packages) {
|
|
|
88600
88764
|
return [...map.values()].map((pkgs) => ({ packages: pkgs, key: pkgs[0].name })).sort((a, b) => b.packages[0].score - a.packages[0].score);
|
|
88601
88765
|
}
|
|
88602
88766
|
function actionBadge(score) {
|
|
88603
|
-
if (score >= 70) return { label: "Block", color:
|
|
88604
|
-
if (score >= 60) return { label: "Warn", color:
|
|
88605
|
-
return { label: "Pass", color:
|
|
88767
|
+
if (score >= 70) return { label: "Block", color: import_chalk6.default.red };
|
|
88768
|
+
if (score >= 60) return { label: "Warn", color: import_chalk6.default.yellow };
|
|
88769
|
+
return { label: "Pass", color: import_chalk6.default.green };
|
|
88606
88770
|
}
|
|
88607
88771
|
function renderResultStatic(result, _config) {
|
|
88608
88772
|
const lines = [];
|
|
88609
88773
|
const actionStr = result.action.toUpperCase();
|
|
88610
88774
|
const colorAction = actionColor(result.action);
|
|
88611
88775
|
lines.push("");
|
|
88612
|
-
lines.push(` ${
|
|
88776
|
+
lines.push(` ${import_chalk6.default.bold("Dependency Guardian")}`);
|
|
88613
88777
|
lines.push(
|
|
88614
|
-
` Score: ${
|
|
88778
|
+
` Score: ${import_chalk6.default.bold(String(result.score))}${" ".repeat(
|
|
88615
88779
|
Math.max(1, 50 - String(result.score).length)
|
|
88616
88780
|
)}${colorAction(actionStr)}`
|
|
88617
88781
|
);
|
|
@@ -88621,11 +88785,11 @@ function renderResultStatic(result, _config) {
|
|
|
88621
88785
|
const total = result.packages.length;
|
|
88622
88786
|
if (flagged.length > 0) {
|
|
88623
88787
|
lines.push(
|
|
88624
|
-
` ${total} package${total !== 1 ? "s" : ""} scanned ${
|
|
88788
|
+
` ${total} package${total !== 1 ? "s" : ""} scanned ${import_chalk6.default.dim("\u2502")} ${import_chalk6.default.yellow(`${flagged.length} flagged`)} \u2502 ${import_chalk6.default.green(`${clean.length} clean`)}`
|
|
88625
88789
|
);
|
|
88626
88790
|
} else {
|
|
88627
88791
|
lines.push(
|
|
88628
|
-
` ${total} package${total !== 1 ? "s" : ""} scanned ${
|
|
88792
|
+
` ${total} package${total !== 1 ? "s" : ""} scanned ${import_chalk6.default.dim("\u2502")} ${import_chalk6.default.green("all clean")}`
|
|
88629
88793
|
);
|
|
88630
88794
|
}
|
|
88631
88795
|
const licensedPkgs = result.packages.filter((p) => p.license);
|
|
@@ -88634,7 +88798,7 @@ function renderResultStatic(result, _config) {
|
|
|
88634
88798
|
);
|
|
88635
88799
|
if (licenseIssues.length > 0) {
|
|
88636
88800
|
lines.push(
|
|
88637
|
-
` ${
|
|
88801
|
+
` ${import_chalk6.default.dim("Licenses:")} ${import_chalk6.default.yellow(`${licenseIssues.length} need review`)} \u2502 ${import_chalk6.default.green(`${licensedPkgs.length - licenseIssues.length} permissive`)}`
|
|
88638
88802
|
);
|
|
88639
88803
|
}
|
|
88640
88804
|
lines.push("");
|
|
@@ -88645,30 +88809,30 @@ function renderResultStatic(result, _config) {
|
|
|
88645
88809
|
}
|
|
88646
88810
|
const groups = groupPackages(flagged);
|
|
88647
88811
|
if (flagged.length > 0) {
|
|
88648
|
-
lines.push(` ${
|
|
88649
|
-
lines.push(` ${
|
|
88812
|
+
lines.push(` ${import_chalk6.default.bold("Flagged Packages")}`);
|
|
88813
|
+
lines.push(` ${import_chalk6.default.dim("\u2500".repeat(60))}`);
|
|
88650
88814
|
for (const group of groups) {
|
|
88651
88815
|
const rep = group.packages[0];
|
|
88652
88816
|
const { label, color } = actionBadge(rep.score);
|
|
88653
88817
|
const names = group.packages.length === 1 ? rep.name : group.packages.length <= 3 ? group.packages.map((p) => p.name).join(", ") : `${group.packages[0].name} + ${group.packages.length - 1} similar`;
|
|
88654
88818
|
const lcInfo = rep.license;
|
|
88655
88819
|
const lcStr = lcInfo ? truncate2(lcInfo.spdx ?? lcInfo.raw ?? "", 14) : "";
|
|
88656
|
-
const lcColor = !lcInfo ?
|
|
88820
|
+
const lcColor = !lcInfo ? import_chalk6.default.dim : lcInfo.riskCategory === "permissive" ? import_chalk6.default.green : lcInfo.riskCategory === "no-license" || lcInfo.riskCategory === "unlicensed" || lcInfo.riskCategory === "network-copyleft" ? import_chalk6.default.red : import_chalk6.default.yellow;
|
|
88657
88821
|
lines.push(
|
|
88658
|
-
` ${color(pad(label, 7))}${
|
|
88822
|
+
` ${color(pad(label, 7))}${import_chalk6.default.bold(pad(truncate2(names, 36), 38))}${lcColor(pad(lcStr, 16))}${import_chalk6.default.dim(`score ${rep.score}`)}`
|
|
88659
88823
|
);
|
|
88660
88824
|
}
|
|
88661
88825
|
lines.push("");
|
|
88662
88826
|
}
|
|
88663
88827
|
if (clean.length > 0) {
|
|
88664
88828
|
lines.push(
|
|
88665
|
-
` ${
|
|
88829
|
+
` ${import_chalk6.default.green("\u2713")} ${import_chalk6.default.dim(`${clean.length} package${clean.length !== 1 ? "s" : ""} passed with score 0`)}`
|
|
88666
88830
|
);
|
|
88667
88831
|
lines.push("");
|
|
88668
88832
|
}
|
|
88669
88833
|
if (result.durationMs) {
|
|
88670
88834
|
lines.push(
|
|
88671
|
-
` ${
|
|
88835
|
+
` ${import_chalk6.default.dim(`Completed in ${(result.durationMs / 1e3).toFixed(1)}s`)}`
|
|
88672
88836
|
);
|
|
88673
88837
|
lines.push("");
|
|
88674
88838
|
}
|
|
@@ -88677,12 +88841,12 @@ function renderResultStatic(result, _config) {
|
|
|
88677
88841
|
async function runStatic(config3) {
|
|
88678
88842
|
const dbg = (msg) => {
|
|
88679
88843
|
if (config3.debug)
|
|
88680
|
-
process.stderr.write(
|
|
88844
|
+
process.stderr.write(import_chalk6.default.dim(` [debug] ${msg}
|
|
88681
88845
|
`));
|
|
88682
88846
|
};
|
|
88683
88847
|
if (config3.mode === "off") {
|
|
88684
88848
|
process.stderr.write(
|
|
88685
|
-
|
|
88849
|
+
import_chalk6.default.dim(" Dependency Guardian: mode is off \u2014 skipping.\n")
|
|
88686
88850
|
);
|
|
88687
88851
|
process.exit(0);
|
|
88688
88852
|
}
|
|
@@ -88690,7 +88854,7 @@ async function runStatic(config3) {
|
|
|
88690
88854
|
`mode=${config3.mode} max=${config3.maxPackages}`
|
|
88691
88855
|
);
|
|
88692
88856
|
dbg(`api=${config3.apiUrl}`);
|
|
88693
|
-
process.stderr.write(
|
|
88857
|
+
process.stderr.write(import_chalk6.default.dim(" Discovering package changes...\n"));
|
|
88694
88858
|
let discovery = discoverChanges(process.cwd(), config3);
|
|
88695
88859
|
dbg(`discovery method: ${discovery.method}`);
|
|
88696
88860
|
if (discovery.pythonPackages.length > 0) {
|
|
@@ -88700,17 +88864,17 @@ async function runStatic(config3) {
|
|
|
88700
88864
|
const { discoverProjects: discoverProjects2 } = await Promise.resolve().then(() => (init_discover(), discover_exports));
|
|
88701
88865
|
const subProjects = discoverProjects2(process.cwd());
|
|
88702
88866
|
if (subProjects.length === 0) {
|
|
88703
|
-
process.stderr.write(
|
|
88867
|
+
process.stderr.write(import_chalk6.default.dim(" No package changes detected.\n"));
|
|
88704
88868
|
process.exit(0);
|
|
88705
88869
|
}
|
|
88706
88870
|
const totalPkgs = subProjects.reduce((s, p) => s + p.packageCount, 0);
|
|
88707
88871
|
process.stderr.write(
|
|
88708
|
-
|
|
88872
|
+
import_chalk6.default.dim(` Found ${subProjects.length} projects (${totalPkgs} packages total):
|
|
88709
88873
|
`)
|
|
88710
88874
|
);
|
|
88711
88875
|
for (const proj of subProjects) {
|
|
88712
88876
|
process.stderr.write(
|
|
88713
|
-
|
|
88877
|
+
import_chalk6.default.dim(` ${proj.ecosystem} ${proj.relativePath} (${proj.packageCount})
|
|
88714
88878
|
`)
|
|
88715
88879
|
);
|
|
88716
88880
|
}
|
|
@@ -88740,7 +88904,7 @@ async function runStatic(config3) {
|
|
|
88740
88904
|
}
|
|
88741
88905
|
}
|
|
88742
88906
|
if (allNpmPkgs.length === 0 && allPyPkgs.length === 0) {
|
|
88743
|
-
process.stderr.write(
|
|
88907
|
+
process.stderr.write(import_chalk6.default.dim(" No package changes detected across projects.\n"));
|
|
88744
88908
|
process.exit(0);
|
|
88745
88909
|
}
|
|
88746
88910
|
discovery = {
|
|
@@ -88753,14 +88917,14 @@ async function runStatic(config3) {
|
|
|
88753
88917
|
const packages = discovery.packages;
|
|
88754
88918
|
const totalToScan = packages.length + discovery.pythonPackages.length;
|
|
88755
88919
|
process.stderr.write(
|
|
88756
|
-
|
|
88920
|
+
import_chalk6.default.dim(
|
|
88757
88921
|
` Scanning ${totalToScan} package${totalToScan !== 1 ? "s" : ""}${discovery.pythonPackages.length > 0 ? ` (${packages.length} npm + ${discovery.pythonPackages.length} Python)` : ""} (${discovery.method})...
|
|
88758
88922
|
`
|
|
88759
88923
|
)
|
|
88760
88924
|
);
|
|
88761
88925
|
if (discovery.skipped.length > 0 && config3.maxPackages < 1e4) {
|
|
88762
88926
|
process.stderr.write(
|
|
88763
|
-
|
|
88927
|
+
import_chalk6.default.dim(
|
|
88764
88928
|
` Note: ${discovery.skipped.length} package(s) not scanned (--max-packages=${config3.maxPackages})
|
|
88765
88929
|
`
|
|
88766
88930
|
)
|
|
@@ -88774,7 +88938,7 @@ async function runStatic(config3) {
|
|
|
88774
88938
|
const startMs = Date.now();
|
|
88775
88939
|
if (packages.length > 0) {
|
|
88776
88940
|
result = await callAnalyzeAPI(packages, config3, (done, total) => {
|
|
88777
|
-
process.stderr.write(
|
|
88941
|
+
process.stderr.write(import_chalk6.default.dim(` Analyzed ${done}/${total}...
|
|
88778
88942
|
`));
|
|
88779
88943
|
});
|
|
88780
88944
|
} else {
|
|
@@ -88782,7 +88946,7 @@ async function runStatic(config3) {
|
|
|
88782
88946
|
}
|
|
88783
88947
|
if (discovery.pythonPackages.length > 0) {
|
|
88784
88948
|
process.stderr.write(
|
|
88785
|
-
|
|
88949
|
+
import_chalk6.default.dim(` Scanning ${discovery.pythonPackages.length} Python package${discovery.pythonPackages.length !== 1 ? "s" : ""}...
|
|
88786
88950
|
`)
|
|
88787
88951
|
);
|
|
88788
88952
|
const pyResult = await callPyPIAnalyzeAPI(discovery.pythonPackages, config3);
|
|
@@ -88829,7 +88993,7 @@ async function runStaticNpm(npmArgs, config3) {
|
|
|
88829
88993
|
const bareSpecs = readBareInstallPackages(process.cwd());
|
|
88830
88994
|
if (bareSpecs.length === 0) {
|
|
88831
88995
|
process.stderr.write(
|
|
88832
|
-
|
|
88996
|
+
import_chalk6.default.dim(
|
|
88833
88997
|
" Dependency Guardian: no packages to scan, passing through to npm.\n"
|
|
88834
88998
|
)
|
|
88835
88999
|
);
|
|
@@ -88837,7 +89001,7 @@ async function runStaticNpm(npmArgs, config3) {
|
|
|
88837
89001
|
process.exit(code);
|
|
88838
89002
|
}
|
|
88839
89003
|
process.stderr.write(
|
|
88840
|
-
|
|
89004
|
+
import_chalk6.default.dim(
|
|
88841
89005
|
` Resolving ${bareSpecs.length} package${bareSpecs.length !== 1 ? "s" : ""} from package.json...
|
|
88842
89006
|
`
|
|
88843
89007
|
)
|
|
@@ -88845,7 +89009,7 @@ async function runStaticNpm(npmArgs, config3) {
|
|
|
88845
89009
|
const { resolved: resolved2, failed: failed2 } = await resolvePackages(bareSpecs);
|
|
88846
89010
|
if (failed2.length > 0 && config3.debug) {
|
|
88847
89011
|
process.stderr.write(
|
|
88848
|
-
|
|
89012
|
+
import_chalk6.default.dim(
|
|
88849
89013
|
` [debug] Could not resolve: ${failed2.slice(0, 5).join(", ")}${failed2.length > 5 ? ` (+${failed2.length - 5} more)` : ""}
|
|
88850
89014
|
`
|
|
88851
89015
|
)
|
|
@@ -88854,7 +89018,7 @@ async function runStaticNpm(npmArgs, config3) {
|
|
|
88854
89018
|
return scanAndInstallStatic(resolved2, parsed, config3);
|
|
88855
89019
|
}
|
|
88856
89020
|
process.stderr.write(
|
|
88857
|
-
|
|
89021
|
+
import_chalk6.default.dim(
|
|
88858
89022
|
` Resolving ${parsed.packages.length} package${parsed.packages.length !== 1 ? "s" : ""}...
|
|
88859
89023
|
`
|
|
88860
89024
|
)
|
|
@@ -88862,7 +89026,7 @@ async function runStaticNpm(npmArgs, config3) {
|
|
|
88862
89026
|
const { resolved, failed } = await resolvePackages(parsed.packages);
|
|
88863
89027
|
if (failed.length > 0) {
|
|
88864
89028
|
process.stderr.write(
|
|
88865
|
-
|
|
89029
|
+
import_chalk6.default.yellow(
|
|
88866
89030
|
` Warning: Could not resolve versions for: ${failed.join(", ")}
|
|
88867
89031
|
`
|
|
88868
89032
|
)
|
|
@@ -88870,7 +89034,7 @@ async function runStaticNpm(npmArgs, config3) {
|
|
|
88870
89034
|
}
|
|
88871
89035
|
if (resolved.length === 0) {
|
|
88872
89036
|
process.stderr.write(
|
|
88873
|
-
|
|
89037
|
+
import_chalk6.default.dim(" No packages to scan. Passing through to npm.\n")
|
|
88874
89038
|
);
|
|
88875
89039
|
const code = await runNpm(parsed.rawArgs);
|
|
88876
89040
|
process.exit(code);
|
|
@@ -88879,7 +89043,7 @@ async function runStaticNpm(npmArgs, config3) {
|
|
|
88879
89043
|
}
|
|
88880
89044
|
async function scanAndInstallStatic(resolved, parsed, config3) {
|
|
88881
89045
|
process.stderr.write(
|
|
88882
|
-
|
|
89046
|
+
import_chalk6.default.dim(
|
|
88883
89047
|
` Scanning ${resolved.length} package${resolved.length !== 1 ? "s" : ""}...
|
|
88884
89048
|
`
|
|
88885
89049
|
)
|
|
@@ -88891,7 +89055,7 @@ async function scanAndInstallStatic(resolved, parsed, config3) {
|
|
|
88891
89055
|
const elapsed = Date.now() - startMs;
|
|
88892
89056
|
if (config3.debug) {
|
|
88893
89057
|
process.stderr.write(
|
|
88894
|
-
|
|
89058
|
+
import_chalk6.default.dim(
|
|
88895
89059
|
` [debug] API responded in ${elapsed}ms, action=${result.action}, score=${result.score}
|
|
88896
89060
|
`
|
|
88897
89061
|
)
|
|
@@ -88901,7 +89065,7 @@ async function scanAndInstallStatic(resolved, parsed, config3) {
|
|
|
88901
89065
|
if (handleTrialExhausted2(error2, config3.json)) return;
|
|
88902
89066
|
const msg = error2 instanceof Error ? error2.message : String(error2);
|
|
88903
89067
|
process.stderr.write(
|
|
88904
|
-
|
|
89068
|
+
import_chalk6.default.yellow(
|
|
88905
89069
|
` Warning: Scan failed (${msg}). Proceeding with install.
|
|
88906
89070
|
`
|
|
88907
89071
|
)
|
|
@@ -88912,8 +89076,8 @@ async function scanAndInstallStatic(resolved, parsed, config3) {
|
|
|
88912
89076
|
}
|
|
88913
89077
|
if (result.action === "pass") {
|
|
88914
89078
|
process.stderr.write(
|
|
88915
|
-
|
|
88916
|
-
` ${
|
|
89079
|
+
import_chalk6.default.green(
|
|
89080
|
+
` ${import_chalk6.default.bold("\u2713")} ${resolved.length} package${resolved.length !== 1 ? "s" : ""} scanned \u2014 all clear
|
|
88917
89081
|
`
|
|
88918
89082
|
)
|
|
88919
89083
|
);
|
|
@@ -88927,7 +89091,7 @@ async function scanAndInstallStatic(resolved, parsed, config3) {
|
|
|
88927
89091
|
printTrialBanner(result);
|
|
88928
89092
|
if (result.action === "warn") {
|
|
88929
89093
|
process.stderr.write(
|
|
88930
|
-
|
|
89094
|
+
import_chalk6.default.yellow(" Warnings detected. Proceeding with install.\n\n")
|
|
88931
89095
|
);
|
|
88932
89096
|
const code = await runNpm(parsed.rawArgs);
|
|
88933
89097
|
process.exit(code);
|
|
@@ -88935,8 +89099,8 @@ async function scanAndInstallStatic(resolved, parsed, config3) {
|
|
|
88935
89099
|
if (result.action === "block") {
|
|
88936
89100
|
if (parsed.dgForce) {
|
|
88937
89101
|
process.stderr.write(
|
|
88938
|
-
|
|
88939
|
-
|
|
89102
|
+
import_chalk6.default.yellow(
|
|
89103
|
+
import_chalk6.default.bold(
|
|
88940
89104
|
" --dg-force: Bypassing block. Install at your own risk.\n\n"
|
|
88941
89105
|
)
|
|
88942
89106
|
)
|
|
@@ -88945,10 +89109,10 @@ async function scanAndInstallStatic(resolved, parsed, config3) {
|
|
|
88945
89109
|
process.exit(code);
|
|
88946
89110
|
}
|
|
88947
89111
|
process.stderr.write(
|
|
88948
|
-
|
|
89112
|
+
import_chalk6.default.red(import_chalk6.default.bold(" BLOCKED: ")) + import_chalk6.default.red("High-risk packages detected. Install aborted.\n")
|
|
88949
89113
|
);
|
|
88950
89114
|
process.stderr.write(
|
|
88951
|
-
|
|
89115
|
+
import_chalk6.default.dim(" Use --dg-force to bypass this check.\n\n")
|
|
88952
89116
|
);
|
|
88953
89117
|
process.exit(2);
|
|
88954
89118
|
}
|
|
@@ -88965,13 +89129,13 @@ async function runStaticPip(pipArgs, config3) {
|
|
|
88965
89129
|
}
|
|
88966
89130
|
if (specs.length === 0) {
|
|
88967
89131
|
process.stderr.write(
|
|
88968
|
-
|
|
89132
|
+
import_chalk6.default.dim(" Dependency Guardian: no packages to scan, passing through to pip.\n")
|
|
88969
89133
|
);
|
|
88970
89134
|
const code = await runPip(parsed.rawArgs);
|
|
88971
89135
|
process.exit(code);
|
|
88972
89136
|
}
|
|
88973
89137
|
process.stderr.write(
|
|
88974
|
-
|
|
89138
|
+
import_chalk6.default.dim(
|
|
88975
89139
|
` Resolving ${specs.length} package${specs.length !== 1 ? "s" : ""} from PyPI...
|
|
88976
89140
|
`
|
|
88977
89141
|
)
|
|
@@ -88979,19 +89143,19 @@ async function runStaticPip(pipArgs, config3) {
|
|
|
88979
89143
|
const { resolved, failed } = await resolvePackages2(specs);
|
|
88980
89144
|
if (failed.length > 0) {
|
|
88981
89145
|
process.stderr.write(
|
|
88982
|
-
|
|
89146
|
+
import_chalk6.default.yellow(` Warning: Could not resolve versions for: ${failed.join(", ")}
|
|
88983
89147
|
`)
|
|
88984
89148
|
);
|
|
88985
89149
|
}
|
|
88986
89150
|
if (resolved.length === 0) {
|
|
88987
89151
|
process.stderr.write(
|
|
88988
|
-
|
|
89152
|
+
import_chalk6.default.dim(" No packages to scan. Passing through to pip.\n")
|
|
88989
89153
|
);
|
|
88990
89154
|
const code = await runPip(parsed.rawArgs);
|
|
88991
89155
|
process.exit(code);
|
|
88992
89156
|
}
|
|
88993
89157
|
process.stderr.write(
|
|
88994
|
-
|
|
89158
|
+
import_chalk6.default.dim(
|
|
88995
89159
|
` Scanning ${resolved.length} Python package${resolved.length !== 1 ? "s" : ""}...
|
|
88996
89160
|
`
|
|
88997
89161
|
)
|
|
@@ -89003,7 +89167,7 @@ async function runStaticPip(pipArgs, config3) {
|
|
|
89003
89167
|
if (handleTrialExhausted2(error2, config3.json)) return;
|
|
89004
89168
|
const msg = error2 instanceof Error ? error2.message : String(error2);
|
|
89005
89169
|
process.stderr.write(
|
|
89006
|
-
|
|
89170
|
+
import_chalk6.default.yellow(` Warning: Scan failed (${msg}). Proceeding with install.
|
|
89007
89171
|
`)
|
|
89008
89172
|
);
|
|
89009
89173
|
const code = await runPip(parsed.rawArgs);
|
|
@@ -89012,8 +89176,8 @@ async function runStaticPip(pipArgs, config3) {
|
|
|
89012
89176
|
}
|
|
89013
89177
|
if (result.action === "pass") {
|
|
89014
89178
|
process.stderr.write(
|
|
89015
|
-
|
|
89016
|
-
` ${
|
|
89179
|
+
import_chalk6.default.green(
|
|
89180
|
+
` ${import_chalk6.default.bold("\u2713")} ${resolved.length} package${resolved.length !== 1 ? "s" : ""} scanned \u2014 all clear
|
|
89017
89181
|
`
|
|
89018
89182
|
)
|
|
89019
89183
|
);
|
|
@@ -89027,7 +89191,7 @@ async function runStaticPip(pipArgs, config3) {
|
|
|
89027
89191
|
printTrialBanner(result);
|
|
89028
89192
|
if (result.action === "warn") {
|
|
89029
89193
|
process.stderr.write(
|
|
89030
|
-
|
|
89194
|
+
import_chalk6.default.yellow(" Warnings detected. Proceeding with install.\n\n")
|
|
89031
89195
|
);
|
|
89032
89196
|
const code = await runPip(parsed.rawArgs);
|
|
89033
89197
|
process.exit(code);
|
|
@@ -89035,16 +89199,16 @@ async function runStaticPip(pipArgs, config3) {
|
|
|
89035
89199
|
if (result.action === "block") {
|
|
89036
89200
|
if (parsed.dgForce) {
|
|
89037
89201
|
process.stderr.write(
|
|
89038
|
-
|
|
89202
|
+
import_chalk6.default.yellow(import_chalk6.default.bold(" --dg-force: Bypassing block. Install at your own risk.\n\n"))
|
|
89039
89203
|
);
|
|
89040
89204
|
const code = await runPip(parsed.rawArgs);
|
|
89041
89205
|
process.exit(code);
|
|
89042
89206
|
}
|
|
89043
89207
|
process.stderr.write(
|
|
89044
|
-
|
|
89208
|
+
import_chalk6.default.red(import_chalk6.default.bold(" BLOCKED: ")) + import_chalk6.default.red("High-risk packages detected. Install aborted.\n")
|
|
89045
89209
|
);
|
|
89046
89210
|
process.stderr.write(
|
|
89047
|
-
|
|
89211
|
+
import_chalk6.default.dim(" Use --dg-force to bypass this check.\n\n")
|
|
89048
89212
|
);
|
|
89049
89213
|
process.exit(2);
|
|
89050
89214
|
}
|
|
@@ -89067,22 +89231,22 @@ async function runStaticLogin() {
|
|
|
89067
89231
|
});
|
|
89068
89232
|
if (resp.ok) {
|
|
89069
89233
|
process.stderr.write(
|
|
89070
|
-
|
|
89234
|
+
import_chalk6.default.yellow(" Already authenticated.\n") + import_chalk6.default.dim(" Run `dg logout` first to re-authenticate.\n")
|
|
89071
89235
|
);
|
|
89072
89236
|
return;
|
|
89073
89237
|
}
|
|
89074
89238
|
} catch {
|
|
89075
89239
|
}
|
|
89076
|
-
process.stderr.write(
|
|
89240
|
+
process.stderr.write(import_chalk6.default.dim(" Stored key is invalid. Starting fresh login...\n"));
|
|
89077
89241
|
saveCredentials2("");
|
|
89078
89242
|
}
|
|
89079
|
-
process.stderr.write(
|
|
89243
|
+
process.stderr.write(import_chalk6.default.dim(" Creating login session...\n"));
|
|
89080
89244
|
let session;
|
|
89081
89245
|
try {
|
|
89082
89246
|
session = await createAuthSession2();
|
|
89083
89247
|
} catch (err) {
|
|
89084
89248
|
process.stderr.write(
|
|
89085
|
-
|
|
89249
|
+
import_chalk6.default.red(` Error: ${err instanceof Error ? err.message : String(err)}
|
|
89086
89250
|
`)
|
|
89087
89251
|
);
|
|
89088
89252
|
process.exit(1);
|
|
@@ -89090,10 +89254,10 @@ async function runStaticLogin() {
|
|
|
89090
89254
|
process.stderr.write(`
|
|
89091
89255
|
Authenticate your account at:
|
|
89092
89256
|
`);
|
|
89093
|
-
process.stderr.write(` ${
|
|
89257
|
+
process.stderr.write(` ${import_chalk6.default.cyan(session.verifyUrl)}
|
|
89094
89258
|
|
|
89095
89259
|
`);
|
|
89096
|
-
process.stderr.write(
|
|
89260
|
+
process.stderr.write(import_chalk6.default.dim(" Press ENTER to open in the browser...\n"));
|
|
89097
89261
|
await new Promise((resolve2) => {
|
|
89098
89262
|
const onData = () => {
|
|
89099
89263
|
process.stdin.removeListener("data", onData);
|
|
@@ -89108,7 +89272,7 @@ async function runStaticLogin() {
|
|
|
89108
89272
|
openBrowser2(session.verifyUrl);
|
|
89109
89273
|
} catch {
|
|
89110
89274
|
}
|
|
89111
|
-
process.stderr.write(
|
|
89275
|
+
process.stderr.write(import_chalk6.default.dim(" Waiting for authorization...\n"));
|
|
89112
89276
|
const POLL_INTERVAL = 2e3;
|
|
89113
89277
|
const MAX_ATTEMPTS = 150;
|
|
89114
89278
|
for (let i = 0; i < MAX_ATTEMPTS; i++) {
|
|
@@ -89118,15 +89282,15 @@ async function runStaticLogin() {
|
|
|
89118
89282
|
if (result.status === "complete" && result.apiKey) {
|
|
89119
89283
|
saveCredentials2(result.apiKey);
|
|
89120
89284
|
process.stderr.write(
|
|
89121
|
-
|
|
89285
|
+
import_chalk6.default.green(`
|
|
89122
89286
|
Logged in as ${result.email ?? "unknown"}
|
|
89123
|
-
`) +
|
|
89287
|
+
`) + import_chalk6.default.dim(" Credentials saved.\n\n")
|
|
89124
89288
|
);
|
|
89125
89289
|
return;
|
|
89126
89290
|
}
|
|
89127
89291
|
if (result.status === "expired") {
|
|
89128
89292
|
process.stderr.write(
|
|
89129
|
-
|
|
89293
|
+
import_chalk6.default.yellow("\n Session expired. Run `dg login` to try again.\n")
|
|
89130
89294
|
);
|
|
89131
89295
|
process.exit(1);
|
|
89132
89296
|
}
|
|
@@ -89134,15 +89298,15 @@ async function runStaticLogin() {
|
|
|
89134
89298
|
}
|
|
89135
89299
|
}
|
|
89136
89300
|
process.stderr.write(
|
|
89137
|
-
|
|
89301
|
+
import_chalk6.default.yellow("\n Timed out waiting for authorization.\n")
|
|
89138
89302
|
);
|
|
89139
89303
|
process.exit(1);
|
|
89140
89304
|
}
|
|
89141
|
-
var
|
|
89305
|
+
var import_chalk6;
|
|
89142
89306
|
var init_static_output = __esm({
|
|
89143
89307
|
"src/static-output.ts"() {
|
|
89144
89308
|
"use strict";
|
|
89145
|
-
|
|
89309
|
+
import_chalk6 = __toESM(require_source());
|
|
89146
89310
|
init_api3();
|
|
89147
89311
|
init_auth();
|
|
89148
89312
|
init_lockfile();
|
|
@@ -89213,10 +89377,10 @@ function reducer4(_state, action) {
|
|
|
89213
89377
|
}
|
|
89214
89378
|
}
|
|
89215
89379
|
function useScan(config3) {
|
|
89216
|
-
const [state, dispatch] = (0,
|
|
89217
|
-
const started = (0,
|
|
89218
|
-
const [multiProjects, setMultiProjects] = (0,
|
|
89219
|
-
(0,
|
|
89380
|
+
const [state, dispatch] = (0, import_react31.useReducer)(reducer4, { phase: "discovering" });
|
|
89381
|
+
const started = (0, import_react31.useRef)(false);
|
|
89382
|
+
const [multiProjects, setMultiProjects] = (0, import_react31.useState)(null);
|
|
89383
|
+
(0, import_react31.useEffect)(() => {
|
|
89220
89384
|
if (started.current) return;
|
|
89221
89385
|
started.current = true;
|
|
89222
89386
|
const projects = discoverProjects(process.cwd());
|
|
@@ -89243,11 +89407,11 @@ function useScan(config3) {
|
|
|
89243
89407
|
scanProjects(projects, config3, dispatch);
|
|
89244
89408
|
}
|
|
89245
89409
|
}, [config3]);
|
|
89246
|
-
const scanSelectedProjects = (0,
|
|
89410
|
+
const scanSelectedProjects = (0, import_react31.useCallback)((projects) => {
|
|
89247
89411
|
dispatch({ type: "DISCOVERY_COMPLETE", packages: [], skippedCount: 0 });
|
|
89248
89412
|
scanProjects(projects, config3, dispatch);
|
|
89249
89413
|
}, [config3]);
|
|
89250
|
-
const restartSelection = (0,
|
|
89414
|
+
const restartSelection = (0, import_react31.useCallback)(() => {
|
|
89251
89415
|
if (!multiProjects) return;
|
|
89252
89416
|
dispatch({ type: "RESTART_SELECTION", projects: multiProjects });
|
|
89253
89417
|
}, [multiProjects]);
|
|
@@ -89367,11 +89531,11 @@ async function scanProjects(projects, config3, dispatch) {
|
|
|
89367
89531
|
dispatch({ type: "ERROR", error: err });
|
|
89368
89532
|
}
|
|
89369
89533
|
}
|
|
89370
|
-
var
|
|
89534
|
+
var import_react31;
|
|
89371
89535
|
var init_useScan = __esm({
|
|
89372
89536
|
"src/ui/hooks/useScan.ts"() {
|
|
89373
89537
|
"use strict";
|
|
89374
|
-
|
|
89538
|
+
import_react31 = __toESM(require_react());
|
|
89375
89539
|
init_lockfile();
|
|
89376
89540
|
init_api3();
|
|
89377
89541
|
init_discover();
|
|
@@ -89380,85 +89544,6 @@ var init_useScan = __esm({
|
|
|
89380
89544
|
}
|
|
89381
89545
|
});
|
|
89382
89546
|
|
|
89383
|
-
// src/ui/components/ProgressBar.tsx
|
|
89384
|
-
function estimateScanSeconds(packageCount) {
|
|
89385
|
-
return Math.ceil(Math.max(5, packageCount * 0.35 - 10));
|
|
89386
|
-
}
|
|
89387
|
-
function formatTime(seconds) {
|
|
89388
|
-
if (seconds < 60) return `${seconds}s`;
|
|
89389
|
-
const m = Math.floor(seconds / 60);
|
|
89390
|
-
const s = seconds % 60;
|
|
89391
|
-
return s > 0 ? `${m}m ${s}s` : `${m}m`;
|
|
89392
|
-
}
|
|
89393
|
-
var import_react30, import_chalk6, import_jsx_runtime9, ProgressBar;
|
|
89394
|
-
var init_ProgressBar = __esm({
|
|
89395
|
-
async "src/ui/components/ProgressBar.tsx"() {
|
|
89396
|
-
"use strict";
|
|
89397
|
-
import_react30 = __toESM(require_react());
|
|
89398
|
-
await init_build2();
|
|
89399
|
-
await init_build3();
|
|
89400
|
-
import_chalk6 = __toESM(require_source());
|
|
89401
|
-
import_jsx_runtime9 = __toESM(require_jsx_runtime());
|
|
89402
|
-
ProgressBar = ({
|
|
89403
|
-
value,
|
|
89404
|
-
total,
|
|
89405
|
-
label
|
|
89406
|
-
}) => {
|
|
89407
|
-
const startRef = (0, import_react30.useRef)(Date.now());
|
|
89408
|
-
const [elapsed, setElapsed] = (0, import_react30.useState)(0);
|
|
89409
|
-
(0, import_react30.useEffect)(() => {
|
|
89410
|
-
const timer = setInterval(() => {
|
|
89411
|
-
setElapsed(Math.floor((Date.now() - startRef.current) / 1e3));
|
|
89412
|
-
}, 1e3);
|
|
89413
|
-
return () => clearInterval(timer);
|
|
89414
|
-
}, []);
|
|
89415
|
-
const termWidth = process.stdout.columns || 80;
|
|
89416
|
-
const percent = total > 0 ? Math.round(value / total * 100) : 0;
|
|
89417
|
-
const estimate = estimateScanSeconds(total);
|
|
89418
|
-
const timeInfo = `${formatTime(elapsed)} / ~${formatTime(estimate)}`;
|
|
89419
|
-
const counter = `${value}/${total} ${percent}%`;
|
|
89420
|
-
const barWidth = Math.max(10, termWidth - counter.length - 8);
|
|
89421
|
-
const fraction = total > 0 ? Math.min(1, value / total) : 0;
|
|
89422
|
-
const filled = Math.round(fraction * barWidth);
|
|
89423
|
-
const empty = barWidth - filled;
|
|
89424
|
-
const filledBar = "\u2501".repeat(filled);
|
|
89425
|
-
const emptyBar = "\u2501".repeat(empty);
|
|
89426
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
|
|
89427
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
|
|
89428
|
-
import_chalk6.default.cyan("\u25C6"),
|
|
89429
|
-
" ",
|
|
89430
|
-
import_chalk6.default.bold("Dependency Guardian")
|
|
89431
|
-
] }),
|
|
89432
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { children: "" }),
|
|
89433
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { children: [
|
|
89434
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "cyan", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(build_default, { type: "dots" }) }),
|
|
89435
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
|
|
89436
|
-
" Scanning ",
|
|
89437
|
-
total,
|
|
89438
|
-
" packages... "
|
|
89439
|
-
] }),
|
|
89440
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { dimColor: true, children: timeInfo })
|
|
89441
|
-
] }),
|
|
89442
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { children: [
|
|
89443
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { children: " " }),
|
|
89444
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "green", children: filledBar }),
|
|
89445
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { dimColor: true, children: emptyBar }),
|
|
89446
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
|
|
89447
|
-
" ",
|
|
89448
|
-
counter
|
|
89449
|
-
] })
|
|
89450
|
-
] }),
|
|
89451
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { dimColor: true, children: [
|
|
89452
|
-
" ",
|
|
89453
|
-
import_chalk6.default.dim("\u203A"),
|
|
89454
|
-
" ",
|
|
89455
|
-
label
|
|
89456
|
-
] }) })
|
|
89457
|
-
] });
|
|
89458
|
-
};
|
|
89459
|
-
}
|
|
89460
|
-
});
|
|
89461
|
-
|
|
89462
89547
|
// src/ui/components/ScoreHeader.tsx
|
|
89463
89548
|
function scoreColor(score, action) {
|
|
89464
89549
|
const colorFn = action === "block" ? import_chalk7.default.red.bold : action === "warn" ? import_chalk7.default.yellow.bold : import_chalk7.default.green.bold;
|
|
@@ -89651,9 +89736,9 @@ var init_ScoreHeader = __esm({
|
|
|
89651
89736
|
|
|
89652
89737
|
// src/ui/hooks/useExpandAnimation.ts
|
|
89653
89738
|
function useExpandAnimation(targetHeight, active, durationMs = 180) {
|
|
89654
|
-
const [visibleLines, setVisibleLines] = (0,
|
|
89655
|
-
const timerRef = (0,
|
|
89656
|
-
(0,
|
|
89739
|
+
const [visibleLines, setVisibleLines] = (0, import_react32.useState)(0);
|
|
89740
|
+
const timerRef = (0, import_react32.useRef)(null);
|
|
89741
|
+
(0, import_react32.useEffect)(() => {
|
|
89657
89742
|
if (timerRef.current) {
|
|
89658
89743
|
clearInterval(timerRef.current);
|
|
89659
89744
|
timerRef.current = null;
|
|
@@ -89687,45 +89772,11 @@ function useExpandAnimation(targetHeight, active, durationMs = 180) {
|
|
|
89687
89772
|
isAnimating: active && visibleLines > 0 && visibleLines < targetHeight
|
|
89688
89773
|
};
|
|
89689
89774
|
}
|
|
89690
|
-
var
|
|
89775
|
+
var import_react32;
|
|
89691
89776
|
var init_useExpandAnimation = __esm({
|
|
89692
89777
|
"src/ui/hooks/useExpandAnimation.ts"() {
|
|
89693
|
-
"use strict";
|
|
89694
|
-
import_react31 = __toESM(require_react());
|
|
89695
|
-
}
|
|
89696
|
-
});
|
|
89697
|
-
|
|
89698
|
-
// src/ui/hooks/useTerminalSize.ts
|
|
89699
|
-
function useTerminalSize() {
|
|
89700
|
-
const { stdout } = use_stdout_default();
|
|
89701
|
-
const [size, setSize] = (0, import_react32.useState)({
|
|
89702
|
-
rows: stdout?.rows ?? process.stdout.rows ?? 24,
|
|
89703
|
-
cols: stdout?.columns ?? process.stdout.columns ?? 80
|
|
89704
|
-
});
|
|
89705
|
-
(0, import_react32.useEffect)(() => {
|
|
89706
|
-
const handle = () => {
|
|
89707
|
-
const rows = process.stdout.rows ?? 24;
|
|
89708
|
-
const cols = process.stdout.columns ?? 80;
|
|
89709
|
-
if (process.stdout.isTTY) {
|
|
89710
|
-
process.stdout.write("\x1B[2J\x1B[H");
|
|
89711
|
-
}
|
|
89712
|
-
setSize({ rows, cols });
|
|
89713
|
-
};
|
|
89714
|
-
process.stdout.setMaxListeners(process.stdout.getMaxListeners() + 1);
|
|
89715
|
-
process.stdout.on("resize", handle);
|
|
89716
|
-
return () => {
|
|
89717
|
-
process.stdout.off("resize", handle);
|
|
89718
|
-
process.stdout.setMaxListeners(Math.max(0, process.stdout.getMaxListeners() - 1));
|
|
89719
|
-
};
|
|
89720
|
-
}, []);
|
|
89721
|
-
return size;
|
|
89722
|
-
}
|
|
89723
|
-
var import_react32;
|
|
89724
|
-
var init_useTerminalSize = __esm({
|
|
89725
|
-
async "src/ui/hooks/useTerminalSize.ts"() {
|
|
89726
89778
|
"use strict";
|
|
89727
89779
|
import_react32 = __toESM(require_react());
|
|
89728
|
-
await init_build2();
|
|
89729
89780
|
}
|
|
89730
89781
|
});
|
|
89731
89782
|
|
|
@@ -91897,7 +91948,7 @@ async function main() {
|
|
|
91897
91948
|
return;
|
|
91898
91949
|
}
|
|
91899
91950
|
if (rawCommand === "status") {
|
|
91900
|
-
const { getStoredApiKey: getStoredApiKey2
|
|
91951
|
+
const { getStoredApiKey: getStoredApiKey2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
91901
91952
|
const chalk11 = (await Promise.resolve().then(() => __toESM(require_source()))).default;
|
|
91902
91953
|
const apiKey = getStoredApiKey2();
|
|
91903
91954
|
if (!apiKey) {
|
|
@@ -91905,7 +91956,7 @@ async function main() {
|
|
|
91905
91956
|
`));
|
|
91906
91957
|
return;
|
|
91907
91958
|
}
|
|
91908
|
-
process.stderr.write(chalk11.green(` Authenticated
|
|
91959
|
+
process.stderr.write(chalk11.green(` Authenticated
|
|
91909
91960
|
`));
|
|
91910
91961
|
try {
|
|
91911
91962
|
const { parseConfig: parseConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|