@westbayberry/dg 1.0.51 → 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 +544 -502
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -49718,7 +49718,7 @@ var require_react_development = __commonJS({
|
|
|
49718
49718
|
var dispatcher = resolveDispatcher();
|
|
49719
49719
|
return dispatcher.useReducer(reducer7, initialArg, init3);
|
|
49720
49720
|
}
|
|
49721
|
-
function
|
|
49721
|
+
function useRef10(initialValue) {
|
|
49722
49722
|
var dispatcher = resolveDispatcher();
|
|
49723
49723
|
return dispatcher.useRef(initialValue);
|
|
49724
49724
|
}
|
|
@@ -50512,7 +50512,7 @@ var require_react_development = __commonJS({
|
|
|
50512
50512
|
exports.useLayoutEffect = useLayoutEffect2;
|
|
50513
50513
|
exports.useMemo = useMemo5;
|
|
50514
50514
|
exports.useReducer = useReducer8;
|
|
50515
|
-
exports.useRef =
|
|
50515
|
+
exports.useRef = useRef10;
|
|
50516
50516
|
exports.useState = useState11;
|
|
50517
50517
|
exports.useSyncExternalStore = useSyncExternalStore;
|
|
50518
50518
|
exports.useTransition = useTransition;
|
|
@@ -83514,6 +83514,7 @@ async function callAnalyzeAPI(packages, config3, onProgress) {
|
|
|
83514
83514
|
const results = [];
|
|
83515
83515
|
let completed = 0;
|
|
83516
83516
|
const tTotal = Date.now();
|
|
83517
|
+
if (onProgress) onProgress(0, packages.length, batches[0]?.map((p) => p.name) ?? []);
|
|
83517
83518
|
for (let i = 0; i < batches.length; i++) {
|
|
83518
83519
|
const batch = batches[i];
|
|
83519
83520
|
const tBatch = Date.now();
|
|
@@ -83521,7 +83522,7 @@ async function callAnalyzeAPI(packages, config3, onProgress) {
|
|
|
83521
83522
|
if (process.env.DG_PERF) console.error(`[CLI-PERF] batch ${i + 1}/${batches.length}: ${batch.length} packages \u2192 ${Date.now() - tBatch}ms`);
|
|
83522
83523
|
completed += batch.length;
|
|
83523
83524
|
if (onProgress) {
|
|
83524
|
-
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));
|
|
83525
83526
|
}
|
|
83526
83527
|
results.push(result);
|
|
83527
83528
|
}
|
|
@@ -83775,7 +83776,7 @@ var init_api3 = __esm({
|
|
|
83775
83776
|
});
|
|
83776
83777
|
|
|
83777
83778
|
// src/scan-core.ts
|
|
83778
|
-
async function scanProjectAtPath(cwd2, config3) {
|
|
83779
|
+
async function scanProjectAtPath(cwd2, config3, onProgress) {
|
|
83779
83780
|
const startNs = process.hrtime.bigint();
|
|
83780
83781
|
const elapsedMs = () => Number((process.hrtime.bigint() - startNs) / 1000000n);
|
|
83781
83782
|
try {
|
|
@@ -83799,13 +83800,26 @@ async function scanProjectAtPath(cwd2, config3) {
|
|
|
83799
83800
|
};
|
|
83800
83801
|
}
|
|
83801
83802
|
const responses = [];
|
|
83803
|
+
let cumulativeDone = 0;
|
|
83802
83804
|
if (npmPackages.length > 0) {
|
|
83803
|
-
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);
|
|
83804
83813
|
responses.push(npmResp);
|
|
83814
|
+
cumulativeDone += npmPackages.length;
|
|
83805
83815
|
}
|
|
83806
83816
|
if (pyPackages.length > 0) {
|
|
83807
|
-
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);
|
|
83808
83821
|
responses.push(pyResp);
|
|
83822
|
+
cumulativeDone += pyPackages.length;
|
|
83809
83823
|
}
|
|
83810
83824
|
const allPackages = responses.flatMap((r) => r.packages);
|
|
83811
83825
|
const maxScore = allPackages.length > 0 ? Math.max(0, ...allPackages.map((p) => p.score)) : 0;
|
|
@@ -83882,6 +83896,7 @@ function initialState(dryRun, firstRun) {
|
|
|
83882
83896
|
hookError: null,
|
|
83883
83897
|
scanRan: false,
|
|
83884
83898
|
scanResult: null,
|
|
83899
|
+
scanProgress: null,
|
|
83885
83900
|
skipped: /* @__PURE__ */ new Set()
|
|
83886
83901
|
};
|
|
83887
83902
|
}
|
|
@@ -83982,12 +83997,15 @@ function reducer(state, action) {
|
|
|
83982
83997
|
skipped
|
|
83983
83998
|
};
|
|
83984
83999
|
}
|
|
84000
|
+
case "scan_progress":
|
|
84001
|
+
return { ...state, scanProgress: action.progress };
|
|
83985
84002
|
case "scan_done":
|
|
83986
84003
|
return {
|
|
83987
84004
|
...state,
|
|
83988
84005
|
phase: state.firstRun ? "result_first_scan" : "show_app_link",
|
|
83989
84006
|
scanRan: true,
|
|
83990
|
-
scanResult: action.outcome
|
|
84007
|
+
scanResult: action.outcome,
|
|
84008
|
+
scanProgress: null
|
|
83991
84009
|
};
|
|
83992
84010
|
case "app_link_acked":
|
|
83993
84011
|
return { ...state, phase: "done" };
|
|
@@ -84101,7 +84119,9 @@ function useInit(opts = {}) {
|
|
|
84101
84119
|
const projects = state.projects.length > 0 ? state.projects : [{ path: opts.cwd ?? process.cwd() }];
|
|
84102
84120
|
const allOutcomes = [];
|
|
84103
84121
|
for (const proj of projects) {
|
|
84104
|
-
const outcome = await scanFn(proj.path, config3)
|
|
84122
|
+
const outcome = await scanFn(proj.path, config3, (p) => {
|
|
84123
|
+
dispatch({ type: "scan_progress", progress: p });
|
|
84124
|
+
});
|
|
84105
84125
|
allOutcomes.push(outcome);
|
|
84106
84126
|
}
|
|
84107
84127
|
const allPackages = allOutcomes.flatMap(
|
|
@@ -86834,13 +86854,93 @@ var init_Spinner = __esm({
|
|
|
86834
86854
|
}
|
|
86835
86855
|
});
|
|
86836
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
|
+
|
|
86837
86937
|
// src/ui/components/Mascot.tsx
|
|
86838
|
-
var
|
|
86938
|
+
var import_jsx_runtime3, FACES, Mascot;
|
|
86839
86939
|
var init_Mascot = __esm({
|
|
86840
86940
|
async "src/ui/components/Mascot.tsx"() {
|
|
86841
86941
|
"use strict";
|
|
86842
86942
|
await init_build2();
|
|
86843
|
-
|
|
86943
|
+
import_jsx_runtime3 = __toESM(require_jsx_runtime());
|
|
86844
86944
|
FACES = {
|
|
86845
86945
|
idle: { left: "o", right: "o", mouth: "^" },
|
|
86846
86946
|
alert: { left: "O", right: "O", mouth: "^" },
|
|
@@ -86864,7 +86964,7 @@ var init_Mascot = __esm({
|
|
|
86864
86964
|
" ( ( ) ( ) )",
|
|
86865
86965
|
"(__(__)___(__)__)"
|
|
86866
86966
|
];
|
|
86867
|
-
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)) });
|
|
86868
86968
|
};
|
|
86869
86969
|
}
|
|
86870
86970
|
});
|
|
@@ -86933,13 +87033,13 @@ var init_wizard_demo_data = __esm({
|
|
|
86933
87033
|
});
|
|
86934
87034
|
|
|
86935
87035
|
// src/ui/components/ScanResultCard.tsx
|
|
86936
|
-
var
|
|
87036
|
+
var import_jsx_runtime4, ScanResultCard;
|
|
86937
87037
|
var init_ScanResultCard = __esm({
|
|
86938
87038
|
async "src/ui/components/ScanResultCard.tsx"() {
|
|
86939
87039
|
"use strict";
|
|
86940
87040
|
await init_build2();
|
|
86941
87041
|
init_wizard_demo_data();
|
|
86942
|
-
|
|
87042
|
+
import_jsx_runtime4 = __toESM(require_jsx_runtime());
|
|
86943
87043
|
ScanResultCard = ({ outcome }) => {
|
|
86944
87044
|
let verdict;
|
|
86945
87045
|
let verdictColor;
|
|
@@ -86979,63 +87079,63 @@ var init_ScanResultCard = __esm({
|
|
|
86979
87079
|
extraNote = `Scan didn't finish: ${o.message ?? "unknown error"}`;
|
|
86980
87080
|
}
|
|
86981
87081
|
}
|
|
86982
|
-
return /* @__PURE__ */ (0,
|
|
86983
|
-
packages.length === 1 ? /* @__PURE__ */ (0,
|
|
86984
|
-
/* @__PURE__ */ (0,
|
|
86985
|
-
/* @__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: [
|
|
86986
87086
|
"@",
|
|
86987
87087
|
packages[0].version
|
|
86988
87088
|
] })
|
|
86989
|
-
] }) : /* @__PURE__ */ (0,
|
|
87089
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { dimColor: true, children: [
|
|
86990
87090
|
packages.length,
|
|
86991
87091
|
" packages"
|
|
86992
87092
|
] }),
|
|
86993
|
-
/* @__PURE__ */ (0,
|
|
86994
|
-
/* @__PURE__ */ (0,
|
|
86995
|
-
/* @__PURE__ */ (0,
|
|
86996
|
-
/* @__PURE__ */ (0,
|
|
86997
|
-
/* @__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: [
|
|
86998
87098
|
score,
|
|
86999
87099
|
"/100"
|
|
87000
87100
|
] })
|
|
87001
87101
|
] }),
|
|
87002
|
-
/* @__PURE__ */ (0,
|
|
87003
|
-
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: [
|
|
87004
87104
|
" \u2022 ",
|
|
87005
87105
|
friendlyCategory(f.category),
|
|
87006
87106
|
f.title ? ` \u2014 ${f.title}` : ""
|
|
87007
|
-
] }, `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: [
|
|
87008
87108
|
" \u2022 ",
|
|
87009
|
-
/* @__PURE__ */ (0,
|
|
87109
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { bold: true, children: pkg.name }),
|
|
87010
87110
|
" ",
|
|
87011
87111
|
pkg.score,
|
|
87012
87112
|
"/100"
|
|
87013
87113
|
] }, pkg.name)),
|
|
87014
|
-
packages.length > 3 ? /* @__PURE__ */ (0,
|
|
87015
|
-
] }) : verdict !== "EMPTY" ? /* @__PURE__ */ (0,
|
|
87016
|
-
/* @__PURE__ */ (0,
|
|
87017
|
-
/* @__PURE__ */ (0,
|
|
87018
|
-
/* @__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: [
|
|
87019
87119
|
score,
|
|
87020
87120
|
"/100"
|
|
87021
87121
|
] })
|
|
87022
|
-
] }) : /* @__PURE__ */ (0,
|
|
87122
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { dimColor: true, children: extraNote }) });
|
|
87023
87123
|
};
|
|
87024
87124
|
}
|
|
87025
87125
|
});
|
|
87026
87126
|
|
|
87027
87127
|
// src/ui/components/DemoScanAnimation.tsx
|
|
87028
|
-
var
|
|
87128
|
+
var import_react26, import_jsx_runtime5, DemoScanAnimation;
|
|
87029
87129
|
var init_DemoScanAnimation = __esm({
|
|
87030
87130
|
async "src/ui/components/DemoScanAnimation.tsx"() {
|
|
87031
87131
|
"use strict";
|
|
87032
|
-
|
|
87132
|
+
import_react26 = __toESM(require_react());
|
|
87033
87133
|
await init_Spinner();
|
|
87034
87134
|
init_wizard_demo_data();
|
|
87035
|
-
|
|
87135
|
+
import_jsx_runtime5 = __toESM(require_jsx_runtime());
|
|
87036
87136
|
DemoScanAnimation = ({ onComplete }) => {
|
|
87037
|
-
const [labelIdx, setLabelIdx] = (0,
|
|
87038
|
-
(0,
|
|
87137
|
+
const [labelIdx, setLabelIdx] = (0, import_react26.useState)(0);
|
|
87138
|
+
(0, import_react26.useEffect)(() => {
|
|
87039
87139
|
const tickMs = Math.floor(DEMO_SCAN_TOTAL_MS / DEMO_SCAN_LABELS.length);
|
|
87040
87140
|
const interval = setInterval(() => {
|
|
87041
87141
|
setLabelIdx((i) => {
|
|
@@ -87049,7 +87149,7 @@ var init_DemoScanAnimation = __esm({
|
|
|
87049
87149
|
}, tickMs);
|
|
87050
87150
|
return () => clearInterval(interval);
|
|
87051
87151
|
}, [onComplete]);
|
|
87052
|
-
return /* @__PURE__ */ (0,
|
|
87152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner2, { label: DEMO_SCAN_LABELS[labelIdx] });
|
|
87053
87153
|
};
|
|
87054
87154
|
}
|
|
87055
87155
|
});
|
|
@@ -87082,16 +87182,16 @@ function phaseToStep(phase) {
|
|
|
87082
87182
|
return 0;
|
|
87083
87183
|
}
|
|
87084
87184
|
}
|
|
87085
|
-
var
|
|
87185
|
+
var import_jsx_runtime6, TOTAL_STEPS, ProgressDots;
|
|
87086
87186
|
var init_ProgressDots = __esm({
|
|
87087
87187
|
async "src/ui/components/ProgressDots.tsx"() {
|
|
87088
87188
|
"use strict";
|
|
87089
87189
|
await init_build2();
|
|
87090
|
-
|
|
87190
|
+
import_jsx_runtime6 = __toESM(require_jsx_runtime());
|
|
87091
87191
|
TOTAL_STEPS = 6;
|
|
87092
|
-
ProgressDots = ({ current }) => /* @__PURE__ */ (0,
|
|
87192
|
+
ProgressDots = ({ current }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { children: Array.from({ length: TOTAL_STEPS }).map((_, i) => {
|
|
87093
87193
|
const filled = i < current;
|
|
87094
|
-
return /* @__PURE__ */ (0,
|
|
87194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: filled ? "green" : void 0, dimColor: !filled, children: filled ? "\u25CF " : "\u25CB " }, i);
|
|
87095
87195
|
}) });
|
|
87096
87196
|
}
|
|
87097
87197
|
});
|
|
@@ -87105,22 +87205,23 @@ import { basename as basename3 } from "node:path";
|
|
|
87105
87205
|
function defaultYesNoCursor(phase) {
|
|
87106
87206
|
return phase === "confirm_wrap" ? 1 : 0;
|
|
87107
87207
|
}
|
|
87108
|
-
var
|
|
87208
|
+
var import_react27, import_jsx_runtime7, YES_NO_PHASES, InitApp;
|
|
87109
87209
|
var init_InitApp = __esm({
|
|
87110
87210
|
async "src/ui/InitApp.tsx"() {
|
|
87111
87211
|
"use strict";
|
|
87112
|
-
|
|
87212
|
+
import_react27 = __toESM(require_react());
|
|
87113
87213
|
await init_build2();
|
|
87114
87214
|
init_useInit();
|
|
87115
87215
|
await init_useTerminalSize();
|
|
87116
87216
|
await init_Spinner();
|
|
87217
|
+
await init_ProgressBar();
|
|
87117
87218
|
await init_Mascot();
|
|
87118
87219
|
await init_ScanResultCard();
|
|
87119
87220
|
await init_DemoScanAnimation();
|
|
87120
87221
|
await init_ProgressDots();
|
|
87121
87222
|
init_wizard_demo_data();
|
|
87122
87223
|
init_sanitize();
|
|
87123
|
-
|
|
87224
|
+
import_jsx_runtime7 = __toESM(require_jsx_runtime());
|
|
87124
87225
|
YES_NO_PHASES = /* @__PURE__ */ new Set([
|
|
87125
87226
|
"greet",
|
|
87126
87227
|
"confirm_hook",
|
|
@@ -87137,21 +87238,35 @@ var init_InitApp = __esm({
|
|
|
87137
87238
|
const { state, canGoBack: canGoBack2, runDetect, runInstallHook, runVerifyHook, runScan, dispatch } = useInit({ dryRun, firstRun });
|
|
87138
87239
|
const { exit } = use_app_default();
|
|
87139
87240
|
useTerminalSize();
|
|
87140
|
-
const [yesNoCursor, setYesNoCursor] = (0,
|
|
87141
|
-
(0,
|
|
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)(() => {
|
|
87142
87257
|
if (YES_NO_PHASES.has(state.phase)) {
|
|
87143
87258
|
setYesNoCursor(defaultYesNoCursor(state.phase));
|
|
87144
87259
|
}
|
|
87145
87260
|
}, [state.phase]);
|
|
87146
|
-
(0,
|
|
87261
|
+
(0, import_react27.useEffect)(() => {
|
|
87147
87262
|
if (state.phase === "detect") {
|
|
87148
87263
|
runDetect();
|
|
87149
87264
|
}
|
|
87150
87265
|
}, [state.phase, runDetect]);
|
|
87151
|
-
(0,
|
|
87266
|
+
(0, import_react27.useEffect)(() => {
|
|
87152
87267
|
if (state.scanRan && onScanRan) onScanRan();
|
|
87153
87268
|
}, [state.scanRan, onScanRan]);
|
|
87154
|
-
(0,
|
|
87269
|
+
(0, import_react27.useEffect)(() => {
|
|
87155
87270
|
if (state.phase === "install_hook") {
|
|
87156
87271
|
runInstallHook();
|
|
87157
87272
|
}
|
|
@@ -87301,22 +87416,22 @@ var init_InitApp = __esm({
|
|
|
87301
87416
|
return;
|
|
87302
87417
|
}
|
|
87303
87418
|
});
|
|
87304
|
-
const yesNoRow = (yesLabel = "Yes", noLabel = "No") => /* @__PURE__ */ (0,
|
|
87305
|
-
/* @__PURE__ */ (0,
|
|
87306
|
-
/* @__PURE__ */ (0,
|
|
87307
|
-
/* @__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} ` })
|
|
87308
87423
|
] });
|
|
87309
|
-
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 ` }) });
|
|
87310
87425
|
const isYesNo = YES_NO_PHASES.has(state.phase);
|
|
87311
|
-
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: [
|
|
87312
87427
|
isYesNo ? "\u2190 \u2192 choose \xB7 Enter confirm \xB7 " : "",
|
|
87313
87428
|
canGoBack2 ? "[b] back \xB7 " : "",
|
|
87314
87429
|
"[s] skip \xB7 [q] quit"
|
|
87315
87430
|
] }) });
|
|
87316
87431
|
const currentStep = phaseToStep(state.phase);
|
|
87317
|
-
const Scene = (props) => /* @__PURE__ */ (0,
|
|
87318
|
-
/* @__PURE__ */ (0,
|
|
87319
|
-
/* @__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)(
|
|
87320
87435
|
Box_default,
|
|
87321
87436
|
{
|
|
87322
87437
|
flexDirection: "column",
|
|
@@ -87326,8 +87441,8 @@ var init_InitApp = __esm({
|
|
|
87326
87441
|
paddingY: 0,
|
|
87327
87442
|
flexGrow: 1,
|
|
87328
87443
|
children: [
|
|
87329
|
-
/* @__PURE__ */ (0,
|
|
87330
|
-
/* @__PURE__ */ (0,
|
|
87444
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ProgressDots, { current: currentStep }),
|
|
87445
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87331
87446
|
props.children
|
|
87332
87447
|
]
|
|
87333
87448
|
}
|
|
@@ -87349,60 +87464,60 @@ var init_InitApp = __esm({
|
|
|
87349
87464
|
})();
|
|
87350
87465
|
switch (state.phase) {
|
|
87351
87466
|
case "greet":
|
|
87352
|
-
return /* @__PURE__ */ (0,
|
|
87353
|
-
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: [
|
|
87354
87469
|
"Hey, welcome back \u{1F44B} I'm ",
|
|
87355
|
-
/* @__PURE__ */ (0,
|
|
87470
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "green", children: "Dependency Guardian" }),
|
|
87356
87471
|
"."
|
|
87357
|
-
] }) : /* @__PURE__ */ (0,
|
|
87472
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87358
87473
|
"Hey \u{1F44B} I'm ",
|
|
87359
|
-
/* @__PURE__ */ (0,
|
|
87474
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "green", children: "Dependency Guardian" }),
|
|
87360
87475
|
"."
|
|
87361
87476
|
] }),
|
|
87362
|
-
/* @__PURE__ */ (0,
|
|
87363
|
-
/* @__PURE__ */ (0,
|
|
87364
|
-
/* @__PURE__ */ (0,
|
|
87365
|
-
/* @__PURE__ */ (0,
|
|
87366
|
-
returning ? /* @__PURE__ */ (0,
|
|
87367
|
-
/* @__PURE__ */ (0,
|
|
87368
|
-
/* @__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." })
|
|
87369
87484
|
] }),
|
|
87370
|
-
/* @__PURE__ */ (0,
|
|
87485
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87371
87486
|
yesNoRow("Yes", "I know what I'm doing"),
|
|
87372
|
-
/* @__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" }) })
|
|
87373
87488
|
] });
|
|
87374
87489
|
case "value_prop":
|
|
87375
|
-
return /* @__PURE__ */ (0,
|
|
87376
|
-
/* @__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: [
|
|
87377
87492
|
"In ",
|
|
87378
|
-
/* @__PURE__ */ (0,
|
|
87493
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: "2025-2026" }),
|
|
87379
87494
|
", over ",
|
|
87380
|
-
/* @__PURE__ */ (0,
|
|
87495
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: "50,000" }),
|
|
87381
87496
|
" packages on"
|
|
87382
87497
|
] }),
|
|
87383
|
-
/* @__PURE__ */ (0,
|
|
87384
|
-
/* @__PURE__ */ (0,
|
|
87498
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87499
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: "npm" }),
|
|
87385
87500
|
" and ",
|
|
87386
|
-
/* @__PURE__ */ (0,
|
|
87501
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: "PyPI" }),
|
|
87387
87502
|
" have been caught doing bad"
|
|
87388
87503
|
] }),
|
|
87389
|
-
/* @__PURE__ */ (0,
|
|
87390
|
-
/* @__PURE__ */ (0,
|
|
87391
|
-
/* @__PURE__ */ (0,
|
|
87392
|
-
/* @__PURE__ */ (0,
|
|
87393
|
-
/* @__PURE__ */ (0,
|
|
87394
|
-
/* @__PURE__ */ (0,
|
|
87395
|
-
/* @__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: " " }),
|
|
87396
87511
|
okButton,
|
|
87397
87512
|
stepHint
|
|
87398
87513
|
] });
|
|
87399
87514
|
case "demo_scanning":
|
|
87400
|
-
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" }) }) });
|
|
87401
87516
|
case "demo_result":
|
|
87402
|
-
return /* @__PURE__ */ (0,
|
|
87403
|
-
/* @__PURE__ */ (0,
|
|
87404
|
-
/* @__PURE__ */ (0,
|
|
87405
|
-
/* @__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)(
|
|
87406
87521
|
ScanResultCard,
|
|
87407
87522
|
{
|
|
87408
87523
|
outcome: {
|
|
@@ -87413,200 +87528,206 @@ var init_InitApp = __esm({
|
|
|
87413
87528
|
}
|
|
87414
87529
|
}
|
|
87415
87530
|
),
|
|
87416
|
-
/* @__PURE__ */ (0,
|
|
87417
|
-
/* @__PURE__ */ (0,
|
|
87418
|
-
/* @__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: " " }),
|
|
87419
87534
|
okButton,
|
|
87420
87535
|
stepHint
|
|
87421
87536
|
] });
|
|
87422
87537
|
case "scenario":
|
|
87423
|
-
return /* @__PURE__ */ (0,
|
|
87424
|
-
/* @__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: [
|
|
87425
87540
|
"Here's the situation in ",
|
|
87426
|
-
/* @__PURE__ */ (0,
|
|
87541
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: projectName }),
|
|
87427
87542
|
"."
|
|
87428
87543
|
] }),
|
|
87429
|
-
/* @__PURE__ */ (0,
|
|
87430
|
-
/* @__PURE__ */ (0,
|
|
87431
|
-
/* @__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: [
|
|
87432
87547
|
"runs the moment you ",
|
|
87433
|
-
/* @__PURE__ */ (0,
|
|
87548
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: "npm install" }),
|
|
87434
87549
|
" them."
|
|
87435
87550
|
] }),
|
|
87436
|
-
/* @__PURE__ */ (0,
|
|
87437
|
-
/* @__PURE__ */ (0,
|
|
87551
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87552
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87438
87553
|
"To catch that, use ",
|
|
87439
|
-
/* @__PURE__ */ (0,
|
|
87554
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: "dg npm install" }),
|
|
87440
87555
|
" or"
|
|
87441
87556
|
] }),
|
|
87442
|
-
/* @__PURE__ */ (0,
|
|
87443
|
-
/* @__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" }),
|
|
87444
87559
|
" instead of the normal command."
|
|
87445
87560
|
] }),
|
|
87446
|
-
/* @__PURE__ */ (0,
|
|
87447
|
-
/* @__PURE__ */ (0,
|
|
87448
|
-
/* @__PURE__ */ (0,
|
|
87449
|
-
/* @__PURE__ */ (0,
|
|
87450
|
-
/* @__PURE__ */ (0,
|
|
87451
|
-
/* @__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: " " }),
|
|
87452
87567
|
okButton,
|
|
87453
87568
|
stepHint
|
|
87454
87569
|
] });
|
|
87455
87570
|
case "detect":
|
|
87456
87571
|
if (!state.firstRun) {
|
|
87457
|
-
return /* @__PURE__ */ (0,
|
|
87458
|
-
/* @__PURE__ */ (0,
|
|
87459
|
-
/* @__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..." })
|
|
87460
87575
|
] });
|
|
87461
87576
|
}
|
|
87462
|
-
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..." }) });
|
|
87463
87578
|
case "confirm_hook":
|
|
87464
|
-
if (!state.hookInfo) return /* @__PURE__ */ (0,
|
|
87579
|
+
if (!state.hookInfo) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: "..." });
|
|
87465
87580
|
if (state.hookInfo.alreadyInstalled) {
|
|
87466
|
-
return /* @__PURE__ */ (0,
|
|
87467
|
-
/* @__PURE__ */ (0,
|
|
87468
|
-
/* @__PURE__ */ (0,
|
|
87469
|
-
/* @__PURE__ */ (0,
|
|
87470
|
-
/* @__PURE__ */ (0,
|
|
87471
|
-
/* @__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 }),
|
|
87472
87587
|
"."
|
|
87473
87588
|
] }),
|
|
87474
|
-
/* @__PURE__ */ (0,
|
|
87475
|
-
/* @__PURE__ */ (0,
|
|
87476
|
-
/* @__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: " " }),
|
|
87477
87592
|
okButton,
|
|
87478
87593
|
stepHint
|
|
87479
87594
|
] });
|
|
87480
87595
|
}
|
|
87481
|
-
return /* @__PURE__ */ (0,
|
|
87482
|
-
/* @__PURE__ */ (0,
|
|
87483
|
-
/* @__PURE__ */ (0,
|
|
87484
|
-
/* @__PURE__ */ (0,
|
|
87485
|
-
/* @__PURE__ */ (0,
|
|
87486
|
-
/* @__PURE__ */ (0,
|
|
87487
|
-
/* @__PURE__ */ (0,
|
|
87488
|
-
/* @__PURE__ */ (0,
|
|
87489
|
-
/* @__PURE__ */ (0,
|
|
87490
|
-
/* @__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: " " }),
|
|
87491
87606
|
yesNoRow("Yes", "No"),
|
|
87492
87607
|
stepHint
|
|
87493
87608
|
] });
|
|
87494
87609
|
case "install_hook":
|
|
87495
|
-
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..." }) });
|
|
87496
87611
|
case "verify_hook":
|
|
87497
|
-
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..." }) });
|
|
87498
87613
|
case "confirm_wrap":
|
|
87499
|
-
return /* @__PURE__ */ (0,
|
|
87500
|
-
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: [
|
|
87501
87616
|
"\u2713 Hook works. ",
|
|
87502
|
-
/* @__PURE__ */ (0,
|
|
87617
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { bold: true, children: [
|
|
87503
87618
|
state.hookVerifyMs,
|
|
87504
87619
|
"ms"
|
|
87505
87620
|
] }),
|
|
87506
87621
|
"."
|
|
87507
87622
|
] }) : null,
|
|
87508
|
-
state.hookError ? /* @__PURE__ */ (0,
|
|
87623
|
+
state.hookError ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: "yellow", children: [
|
|
87509
87624
|
"\u26A0 ",
|
|
87510
87625
|
state.hookError
|
|
87511
87626
|
] }) : null,
|
|
87512
|
-
/* @__PURE__ */ (0,
|
|
87513
|
-
/* @__PURE__ */ (0,
|
|
87627
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87628
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { dimColor: true, children: [
|
|
87514
87629
|
"I can also catch packages at ",
|
|
87515
|
-
/* @__PURE__ */ (0,
|
|
87630
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: "npm install" }),
|
|
87516
87631
|
" time, before"
|
|
87517
87632
|
] }),
|
|
87518
|
-
/* @__PURE__ */ (0,
|
|
87519
|
-
/* @__PURE__ */ (0,
|
|
87520
|
-
/* @__PURE__ */ (0,
|
|
87521
|
-
/* @__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: " " }),
|
|
87522
87637
|
yesNoRow(),
|
|
87523
87638
|
stepHint
|
|
87524
87639
|
] });
|
|
87525
87640
|
case "confirm_scan":
|
|
87526
|
-
return /* @__PURE__ */ (0,
|
|
87527
|
-
/* @__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: [
|
|
87528
87643
|
"Can I scan ",
|
|
87529
|
-
/* @__PURE__ */ (0,
|
|
87644
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: projectName }),
|
|
87530
87645
|
" now?"
|
|
87531
87646
|
] }),
|
|
87532
|
-
/* @__PURE__ */ (0,
|
|
87533
|
-
/* @__PURE__ */ (0,
|
|
87534
|
-
/* @__PURE__ */ (0,
|
|
87535
|
-
/* @__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: " " }),
|
|
87536
87651
|
yesNoRow("Scan", "Skip"),
|
|
87537
87652
|
stepHint
|
|
87538
87653
|
] });
|
|
87539
|
-
case "run_scan":
|
|
87540
|
-
|
|
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
|
+
}
|
|
87541
87662
|
case "result_first_scan": {
|
|
87542
87663
|
const r = state.scanResult;
|
|
87543
87664
|
const okScan = r?.status === "ok" && r.result;
|
|
87544
87665
|
const empty = r?.status === "no_packages";
|
|
87545
|
-
return /* @__PURE__ */ (0,
|
|
87546
|
-
/* @__PURE__ */ (0,
|
|
87547
|
-
/* @__PURE__ */ (0,
|
|
87548
|
-
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: [
|
|
87549
87670
|
"I scanned ",
|
|
87550
|
-
/* @__PURE__ */ (0,
|
|
87671
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: projectName }),
|
|
87551
87672
|
"."
|
|
87552
|
-
] }) : empty ? /* @__PURE__ */ (0,
|
|
87673
|
+
] }) : empty ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87553
87674
|
"I didn't find any packages to scan in ",
|
|
87554
|
-
/* @__PURE__ */ (0,
|
|
87675
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: projectName }),
|
|
87555
87676
|
"."
|
|
87556
|
-
] }) : /* @__PURE__ */ (0,
|
|
87677
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87557
87678
|
"I tried to scan ",
|
|
87558
|
-
/* @__PURE__ */ (0,
|
|
87679
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: projectName }),
|
|
87559
87680
|
" but ran into a snag."
|
|
87560
87681
|
] }),
|
|
87561
|
-
/* @__PURE__ */ (0,
|
|
87562
|
-
state.scanResult ? /* @__PURE__ */ (0,
|
|
87563
|
-
/* @__PURE__ */ (0,
|
|
87564
|
-
okScan && resultMood === "happy" ? /* @__PURE__ */ (0,
|
|
87565
|
-
/* @__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: " " }),
|
|
87566
87687
|
okButton,
|
|
87567
87688
|
stepHint
|
|
87568
87689
|
] });
|
|
87569
87690
|
}
|
|
87570
87691
|
case "what_happens_next":
|
|
87571
|
-
return /* @__PURE__ */ (0,
|
|
87572
|
-
/* @__PURE__ */ (0,
|
|
87573
|
-
/* @__PURE__ */ (0,
|
|
87574
|
-
/* @__PURE__ */ (0,
|
|
87575
|
-
/* @__PURE__ */ (0,
|
|
87576
|
-
/* @__PURE__ */ (0,
|
|
87577
|
-
/* @__PURE__ */ (0,
|
|
87578
|
-
/* @__PURE__ */ (0,
|
|
87579
|
-
/* @__PURE__ */ (0,
|
|
87580
|
-
/* @__PURE__ */ (0,
|
|
87581
|
-
/* @__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: [
|
|
87582
87703
|
"If it's a false alarm, just add ",
|
|
87583
|
-
/* @__PURE__ */ (0,
|
|
87704
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: "--no-verify" }),
|
|
87584
87705
|
":"
|
|
87585
87706
|
] }),
|
|
87586
|
-
/* @__PURE__ */ (0,
|
|
87707
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87587
87708
|
" ",
|
|
87588
|
-
/* @__PURE__ */ (0,
|
|
87709
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: 'git commit -m "your message" --no-verify' })
|
|
87589
87710
|
] }),
|
|
87590
|
-
/* @__PURE__ */ (0,
|
|
87591
|
-
/* @__PURE__ */ (0,
|
|
87592
|
-
/* @__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: " " }),
|
|
87593
87714
|
okButton,
|
|
87594
87715
|
stepHint
|
|
87595
87716
|
] });
|
|
87596
87717
|
case "pitch_app":
|
|
87597
|
-
return /* @__PURE__ */ (0,
|
|
87598
|
-
/* @__PURE__ */ (0,
|
|
87599
|
-
/* @__PURE__ */ (0,
|
|
87600
|
-
/* @__PURE__ */ (0,
|
|
87601
|
-
/* @__PURE__ */ (0,
|
|
87602
|
-
/* @__PURE__ */ (0,
|
|
87603
|
-
/* @__PURE__ */ (0,
|
|
87604
|
-
/* @__PURE__ */ (0,
|
|
87605
|
-
/* @__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: [
|
|
87606
87727
|
" ",
|
|
87607
|
-
/* @__PURE__ */ (0,
|
|
87728
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: "https://github.com/apps/dependency-guardian" })
|
|
87608
87729
|
] }),
|
|
87609
|
-
/* @__PURE__ */ (0,
|
|
87730
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87610
87731
|
okButton,
|
|
87611
87732
|
stepHint
|
|
87612
87733
|
] });
|
|
@@ -87619,7 +87740,7 @@ var init_InitApp = __esm({
|
|
|
87619
87740
|
const verdict = r.action === "block" ? "BLOCKED" : r.action === "warn" ? "WARNING" : "PASSED";
|
|
87620
87741
|
const color = r.action === "block" ? "red" : r.action === "warn" ? "yellow" : "green";
|
|
87621
87742
|
scanLine.push(
|
|
87622
|
-
/* @__PURE__ */ (0,
|
|
87743
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color, children: [
|
|
87623
87744
|
"\u2713 Scanned ",
|
|
87624
87745
|
scan.result.scannedCount,
|
|
87625
87746
|
" package",
|
|
@@ -87634,136 +87755,136 @@ var init_InitApp = __esm({
|
|
|
87634
87755
|
] }, "scan-summary")
|
|
87635
87756
|
);
|
|
87636
87757
|
} else if (scan.status === "no_packages") {
|
|
87637
|
-
scanLine.push(/* @__PURE__ */ (0,
|
|
87758
|
+
scanLine.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { dimColor: true, children: [
|
|
87638
87759
|
"\u2713 Scan ran \u2014 nothing to check yet (",
|
|
87639
87760
|
scan.result?.durationMs ?? 0,
|
|
87640
87761
|
"ms)"
|
|
87641
87762
|
] }, "scan-empty"));
|
|
87642
87763
|
} else if (scan.status === "trial_exhausted") {
|
|
87643
|
-
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"));
|
|
87644
87765
|
} else if (scan.status === "error") {
|
|
87645
|
-
scanLine.push(/* @__PURE__ */ (0,
|
|
87766
|
+
scanLine.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: "yellow", children: [
|
|
87646
87767
|
"\u26A0 Scan didn't finish: ",
|
|
87647
87768
|
scan.message
|
|
87648
87769
|
] }, "scan-err"));
|
|
87649
87770
|
}
|
|
87650
|
-
scanLine.push(/* @__PURE__ */ (0,
|
|
87771
|
+
scanLine.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }, "sp"));
|
|
87651
87772
|
}
|
|
87652
|
-
return /* @__PURE__ */ (0,
|
|
87653
|
-
/* @__PURE__ */ (0,
|
|
87654
|
-
/* @__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: " " }),
|
|
87655
87776
|
scanLine,
|
|
87656
|
-
/* @__PURE__ */ (0,
|
|
87657
|
-
/* @__PURE__ */ (0,
|
|
87658
|
-
/* @__PURE__ */ (0,
|
|
87659
|
-
/* @__PURE__ */ (0,
|
|
87660
|
-
/* @__PURE__ */ (0,
|
|
87661
|
-
/* @__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." }),
|
|
87662
87783
|
stepHint
|
|
87663
87784
|
] });
|
|
87664
87785
|
}
|
|
87665
87786
|
case "done": {
|
|
87666
87787
|
const lines = [];
|
|
87667
87788
|
if (state.firstRun && state.skipped.has("scenario") && state.engaged) {
|
|
87668
|
-
return /* @__PURE__ */ (0,
|
|
87669
|
-
/* @__PURE__ */ (0,
|
|
87670
|
-
/* @__PURE__ */ (0,
|
|
87671
|
-
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: [
|
|
87672
87793
|
"Catch you later. ",
|
|
87673
|
-
/* @__PURE__ */ (0,
|
|
87794
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: "dg kitty" }),
|
|
87674
87795
|
" any time."
|
|
87675
|
-
] }) : /* @__PURE__ */ (0,
|
|
87676
|
-
/* @__PURE__ */ (0,
|
|
87677
|
-
/* @__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: [
|
|
87678
87799
|
"mind later, ",
|
|
87679
|
-
/* @__PURE__ */ (0,
|
|
87800
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: "dg kitty" }),
|
|
87680
87801
|
" brings me back."
|
|
87681
87802
|
] })
|
|
87682
87803
|
] }),
|
|
87683
|
-
/* @__PURE__ */ (0,
|
|
87804
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
|
|
87684
87805
|
okButton
|
|
87685
87806
|
] });
|
|
87686
87807
|
}
|
|
87687
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87688
|
-
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"));
|
|
87689
87810
|
if (state.hookInstalled && !state.skipped.has("install_hook")) {
|
|
87690
87811
|
lines.push(
|
|
87691
|
-
/* @__PURE__ */ (0,
|
|
87812
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87692
87813
|
" ",
|
|
87693
|
-
/* @__PURE__ */ (0,
|
|
87814
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "green", children: "\u2713" }),
|
|
87694
87815
|
" I'm running on every commit"
|
|
87695
87816
|
] }, "hook")
|
|
87696
87817
|
);
|
|
87697
87818
|
} else {
|
|
87698
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87819
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: " \u25CB Hook (skipped)" }, "hook"));
|
|
87699
87820
|
}
|
|
87700
87821
|
if (state.scanRan && state.scanResult) {
|
|
87701
87822
|
const scan = state.scanResult;
|
|
87702
87823
|
if (scan.status === "ok" && scan.result) {
|
|
87703
87824
|
const r = scan.result.result;
|
|
87704
|
-
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" });
|
|
87705
87826
|
lines.push(
|
|
87706
|
-
/* @__PURE__ */ (0,
|
|
87827
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87707
87828
|
" ",
|
|
87708
|
-
/* @__PURE__ */ (0,
|
|
87829
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "green", children: "\u2713" }),
|
|
87709
87830
|
" Scanned ",
|
|
87710
|
-
/* @__PURE__ */ (0,
|
|
87831
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, children: scan.result.scannedCount }),
|
|
87711
87832
|
" packages \u2014 ",
|
|
87712
87833
|
tail
|
|
87713
87834
|
] }, "scan")
|
|
87714
87835
|
);
|
|
87715
87836
|
} else if (scan.status === "no_packages") {
|
|
87716
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87837
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: " \u25CB Nothing to scan yet" }, "scan"));
|
|
87717
87838
|
} else {
|
|
87718
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87839
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: "yellow", children: [
|
|
87719
87840
|
" \u26A0 ",
|
|
87720
87841
|
scan.message ?? "scan didn't finish"
|
|
87721
87842
|
] }, "scan"));
|
|
87722
87843
|
}
|
|
87723
87844
|
} else if (state.skipped.has("run_scan")) {
|
|
87724
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87845
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: " \u25CB First scan (skipped)" }, "scan"));
|
|
87725
87846
|
}
|
|
87726
87847
|
lines.push(
|
|
87727
|
-
/* @__PURE__ */ (0,
|
|
87848
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87728
87849
|
" ",
|
|
87729
|
-
/* @__PURE__ */ (0,
|
|
87850
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "green", children: "\u2713" }),
|
|
87730
87851
|
" You know how to bypass me if I'm wrong"
|
|
87731
87852
|
] }, "bypass")
|
|
87732
87853
|
);
|
|
87733
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87734
|
-
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: [
|
|
87735
87856
|
"Forget anything? ",
|
|
87736
|
-
/* @__PURE__ */ (0,
|
|
87857
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: "dg kitty" }),
|
|
87737
87858
|
" brings me back."
|
|
87738
87859
|
] }, "kitty"));
|
|
87739
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87860
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87740
87861
|
"Full command list: ",
|
|
87741
|
-
/* @__PURE__ */ (0,
|
|
87862
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: "dg help" })
|
|
87742
87863
|
] }, "help"));
|
|
87743
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87864
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
|
|
87744
87865
|
"Curious about more? ",
|
|
87745
|
-
/* @__PURE__ */ (0,
|
|
87866
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: "https://westbayberry.com/docs" })
|
|
87746
87867
|
] }, "docs"));
|
|
87747
87868
|
if (state.hookError) {
|
|
87748
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87749
|
-
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: [
|
|
87750
87871
|
"Note: ",
|
|
87751
87872
|
state.hookError
|
|
87752
87873
|
] }, "err"));
|
|
87753
87874
|
}
|
|
87754
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87755
|
-
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"));
|
|
87756
87877
|
if (state.dryRun) {
|
|
87757
|
-
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"));
|
|
87758
87879
|
}
|
|
87759
|
-
lines.push(/* @__PURE__ */ (0,
|
|
87880
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }, "sp5"));
|
|
87760
87881
|
lines.push(
|
|
87761
|
-
/* @__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")
|
|
87762
87883
|
);
|
|
87763
87884
|
if (!state.firstRun) {
|
|
87764
|
-
return /* @__PURE__ */ (0,
|
|
87885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { flexDirection: "column", paddingLeft: 1, children: lines });
|
|
87765
87886
|
}
|
|
87766
|
-
return /* @__PURE__ */ (0,
|
|
87887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Scene, { mood: state.hookError ? "worried" : "proud", color: state.hookError ? "yellow" : "green", children: lines });
|
|
87767
87888
|
}
|
|
87768
87889
|
}
|
|
87769
87890
|
};
|
|
@@ -87850,11 +87971,11 @@ function reducer2(state, action) {
|
|
|
87850
87971
|
}
|
|
87851
87972
|
}
|
|
87852
87973
|
function useLogin() {
|
|
87853
|
-
const [state, dispatch] = (0,
|
|
87854
|
-
const started = (0,
|
|
87855
|
-
const sessionRef = (0,
|
|
87856
|
-
const cancelledRef = (0,
|
|
87857
|
-
(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)(() => {
|
|
87858
87979
|
if (started.current) return;
|
|
87859
87980
|
started.current = true;
|
|
87860
87981
|
(async () => {
|
|
@@ -87898,7 +88019,7 @@ function useLogin() {
|
|
|
87898
88019
|
cancelledRef.current = true;
|
|
87899
88020
|
};
|
|
87900
88021
|
}, []);
|
|
87901
|
-
const openAndPoll = (0,
|
|
88022
|
+
const openAndPoll = (0, import_react28.useCallback)(() => {
|
|
87902
88023
|
const session = sessionRef.current;
|
|
87903
88024
|
if (!session) return;
|
|
87904
88025
|
dispatch({ type: "BROWSER_OPENED" });
|
|
@@ -87934,11 +88055,11 @@ function useLogin() {
|
|
|
87934
88055
|
}, []);
|
|
87935
88056
|
return { state, openAndPoll };
|
|
87936
88057
|
}
|
|
87937
|
-
var
|
|
88058
|
+
var import_react28, POLL_INTERVAL_MS, MAX_POLL_ATTEMPTS;
|
|
87938
88059
|
var init_useLogin = __esm({
|
|
87939
88060
|
"src/ui/hooks/useLogin.ts"() {
|
|
87940
88061
|
"use strict";
|
|
87941
|
-
|
|
88062
|
+
import_react28 = __toESM(require_react());
|
|
87942
88063
|
init_auth();
|
|
87943
88064
|
POLL_INTERVAL_MS = 2e3;
|
|
87944
88065
|
MAX_POLL_ATTEMPTS = 150;
|
|
@@ -87950,19 +88071,19 @@ var LoginApp_exports = {};
|
|
|
87950
88071
|
__export(LoginApp_exports, {
|
|
87951
88072
|
LoginApp: () => LoginApp
|
|
87952
88073
|
});
|
|
87953
|
-
var
|
|
88074
|
+
var import_react29, import_jsx_runtime8, LoginApp;
|
|
87954
88075
|
var init_LoginApp = __esm({
|
|
87955
88076
|
async "src/ui/LoginApp.tsx"() {
|
|
87956
88077
|
"use strict";
|
|
87957
|
-
|
|
88078
|
+
import_react29 = __toESM(require_react());
|
|
87958
88079
|
await init_build2();
|
|
87959
88080
|
init_useLogin();
|
|
87960
88081
|
await init_Spinner();
|
|
87961
|
-
|
|
88082
|
+
import_jsx_runtime8 = __toESM(require_jsx_runtime());
|
|
87962
88083
|
LoginApp = () => {
|
|
87963
88084
|
const { state, openAndPoll } = useLogin();
|
|
87964
88085
|
const { exit } = use_app_default();
|
|
87965
|
-
(0,
|
|
88086
|
+
(0, import_react29.useEffect)(() => {
|
|
87966
88087
|
if (state.phase === "success") {
|
|
87967
88088
|
process.exitCode = 0;
|
|
87968
88089
|
const timer = setTimeout(() => exit(), 0);
|
|
@@ -87986,60 +88107,60 @@ var init_LoginApp = __esm({
|
|
|
87986
88107
|
});
|
|
87987
88108
|
switch (state.phase) {
|
|
87988
88109
|
case "creating":
|
|
87989
|
-
return /* @__PURE__ */ (0,
|
|
88110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Spinner2, { label: "Creating login session..." });
|
|
87990
88111
|
case "already_logged_in":
|
|
87991
|
-
return /* @__PURE__ */ (0,
|
|
87992
|
-
/* @__PURE__ */ (0,
|
|
87993
|
-
/* @__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: [
|
|
87994
88115
|
"Run ",
|
|
87995
88116
|
"`dg logout`",
|
|
87996
88117
|
" first to re-authenticate."
|
|
87997
88118
|
] })
|
|
87998
88119
|
] });
|
|
87999
88120
|
case "ready":
|
|
88000
|
-
return /* @__PURE__ */ (0,
|
|
88001
|
-
/* @__PURE__ */ (0,
|
|
88002
|
-
/* @__PURE__ */ (0,
|
|
88003
|
-
/* @__PURE__ */ (0,
|
|
88004
|
-
/* @__PURE__ */ (0,
|
|
88005
|
-
/* @__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..." })
|
|
88006
88127
|
] });
|
|
88007
88128
|
case "waiting":
|
|
88008
|
-
return /* @__PURE__ */ (0,
|
|
88009
|
-
/* @__PURE__ */ (0,
|
|
88010
|
-
/* @__PURE__ */ (0,
|
|
88011
|
-
/* @__PURE__ */ (0,
|
|
88012
|
-
/* @__PURE__ */ (0,
|
|
88013
|
-
/* @__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..." })
|
|
88014
88135
|
] });
|
|
88015
88136
|
case "success":
|
|
88016
|
-
return /* @__PURE__ */ (0,
|
|
88017
|
-
/* @__PURE__ */ (0,
|
|
88018
|
-
/* @__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: [
|
|
88019
88140
|
"Logged in as ",
|
|
88020
88141
|
state.email
|
|
88021
88142
|
] }),
|
|
88022
|
-
/* @__PURE__ */ (0,
|
|
88023
|
-
/* @__PURE__ */ (0,
|
|
88024
|
-
/* @__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: [
|
|
88025
88146
|
"Run ",
|
|
88026
88147
|
"`dg scan`",
|
|
88027
88148
|
" to scan your dependencies."
|
|
88028
88149
|
] })
|
|
88029
88150
|
] });
|
|
88030
88151
|
case "expired":
|
|
88031
|
-
return /* @__PURE__ */ (0,
|
|
88032
|
-
/* @__PURE__ */ (0,
|
|
88033
|
-
/* @__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: [
|
|
88034
88155
|
"Run ",
|
|
88035
88156
|
"`dg login`",
|
|
88036
88157
|
" to try again."
|
|
88037
88158
|
] })
|
|
88038
88159
|
] });
|
|
88039
88160
|
case "error":
|
|
88040
|
-
return /* @__PURE__ */ (0,
|
|
88041
|
-
/* @__PURE__ */ (0,
|
|
88042
|
-
/* @__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 })
|
|
88043
88164
|
] });
|
|
88044
88165
|
}
|
|
88045
88166
|
};
|
|
@@ -88302,14 +88423,14 @@ function reducer3(state, action) {
|
|
|
88302
88423
|
return { ...state, error: action.error };
|
|
88303
88424
|
}
|
|
88304
88425
|
}
|
|
88305
|
-
var
|
|
88426
|
+
var import_react30, import_chalk5, import_jsx_runtime9, VISIBLE_ROWS, FileSavePrompt;
|
|
88306
88427
|
var init_FileSavePrompt = __esm({
|
|
88307
88428
|
async "src/ui/components/FileSavePrompt.tsx"() {
|
|
88308
88429
|
"use strict";
|
|
88309
|
-
|
|
88430
|
+
import_react30 = __toESM(require_react());
|
|
88310
88431
|
await init_build2();
|
|
88311
|
-
|
|
88312
|
-
|
|
88432
|
+
import_chalk5 = __toESM(require_source());
|
|
88433
|
+
import_jsx_runtime9 = __toESM(require_jsx_runtime());
|
|
88313
88434
|
VISIBLE_ROWS = 15;
|
|
88314
88435
|
FileSavePrompt = ({
|
|
88315
88436
|
defaultName,
|
|
@@ -88321,8 +88442,8 @@ var init_FileSavePrompt = __esm({
|
|
|
88321
88442
|
onSaved,
|
|
88322
88443
|
onCancel
|
|
88323
88444
|
}) => {
|
|
88324
|
-
const initialEntries = (0,
|
|
88325
|
-
const [state, dispatch] = (0,
|
|
88445
|
+
const initialEntries = (0, import_react30.useMemo)(() => listDirectory(initialDir), [initialDir]);
|
|
88446
|
+
const [state, dispatch] = (0, import_react30.useReducer)(reducer3, {
|
|
88326
88447
|
filename: defaultName,
|
|
88327
88448
|
cursorPos: defaultName.length,
|
|
88328
88449
|
directory: initialDir,
|
|
@@ -88334,7 +88455,7 @@ var init_FileSavePrompt = __esm({
|
|
|
88334
88455
|
confirmOverwrite: false,
|
|
88335
88456
|
error: null
|
|
88336
88457
|
});
|
|
88337
|
-
const filteredEntries = (0,
|
|
88458
|
+
const filteredEntries = (0, import_react30.useMemo)(() => {
|
|
88338
88459
|
const dirs = state.entries.filter((e) => e.isDirectory);
|
|
88339
88460
|
if (!state.filterText) return dirs;
|
|
88340
88461
|
const q = state.filterText.toLowerCase();
|
|
@@ -88427,86 +88548,86 @@ var init_FileSavePrompt = __esm({
|
|
|
88427
88548
|
dispatch({ type: "FILTER", text: state.filterText + input });
|
|
88428
88549
|
}
|
|
88429
88550
|
});
|
|
88430
|
-
const actionColor2 = scanAction === "block" ?
|
|
88431
|
-
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);
|
|
88432
88553
|
const shortDir = state.directory.replace(process.env.HOME || "", "~");
|
|
88433
|
-
return /* @__PURE__ */ (0,
|
|
88434
|
-
/* @__PURE__ */ (0,
|
|
88435
|
-
|
|
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"),
|
|
88436
88557
|
" ",
|
|
88437
|
-
|
|
88558
|
+
import_chalk5.default.bold("Save Scan Results")
|
|
88438
88559
|
] }),
|
|
88439
|
-
/* @__PURE__ */ (0,
|
|
88560
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
|
|
88440
88561
|
"Score: ",
|
|
88441
|
-
|
|
88562
|
+
import_chalk5.default.bold(String(score)),
|
|
88442
88563
|
" ",
|
|
88443
88564
|
actionColor2(scanAction.toUpperCase()),
|
|
88444
88565
|
" ",
|
|
88445
|
-
|
|
88566
|
+
import_chalk5.default.dim("\u2502"),
|
|
88446
88567
|
" ",
|
|
88447
88568
|
packageCount,
|
|
88448
88569
|
" packages scanned"
|
|
88449
88570
|
] }),
|
|
88450
|
-
/* @__PURE__ */ (0,
|
|
88451
|
-
/* @__PURE__ */ (0,
|
|
88452
|
-
state.focus === "filename" ?
|
|
88453
|
-
|
|
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:"),
|
|
88454
88575
|
" ",
|
|
88455
88576
|
filenameDisplay,
|
|
88456
|
-
|
|
88577
|
+
import_chalk5.default.dim(".json")
|
|
88457
88578
|
] }),
|
|
88458
|
-
/* @__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}]`) }),
|
|
88459
88580
|
visibleEntries.map((entry, i) => {
|
|
88460
88581
|
const realIdx = state.browserViewport + i;
|
|
88461
88582
|
const isCursor = state.focus === "browser" && realIdx === state.browserCursor;
|
|
88462
|
-
const prefix = isCursor ?
|
|
88583
|
+
const prefix = isCursor ? import_chalk5.default.cyan("\u258C") : " ";
|
|
88463
88584
|
const icon = entry.isDirectory ? "\u{1F4C1} " : " ";
|
|
88464
|
-
const name = entry.isDirectory ?
|
|
88465
|
-
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: [
|
|
88466
88587
|
prefix,
|
|
88467
88588
|
icon,
|
|
88468
88589
|
name
|
|
88469
88590
|
] }, `${entry.name}-${i}`);
|
|
88470
88591
|
}),
|
|
88471
|
-
filteredEntries.length > VISIBLE_ROWS && /* @__PURE__ */ (0,
|
|
88592
|
+
filteredEntries.length > VISIBLE_ROWS && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { dimColor: true, children: [
|
|
88472
88593
|
" ",
|
|
88473
|
-
|
|
88594
|
+
import_chalk5.default.dim(`\u2191\u2193 ${filteredEntries.length - VISIBLE_ROWS} more`)
|
|
88474
88595
|
] }),
|
|
88475
|
-
/* @__PURE__ */ (0,
|
|
88476
|
-
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: [
|
|
88477
88598
|
' filter: "',
|
|
88478
88599
|
state.filterText,
|
|
88479
88600
|
'" (',
|
|
88480
88601
|
filteredEntries.length,
|
|
88481
88602
|
" matches)"
|
|
88482
88603
|
] }),
|
|
88483
|
-
state.confirmOverwrite && /* @__PURE__ */ (0,
|
|
88604
|
+
state.confirmOverwrite && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: "yellow", children: [
|
|
88484
88605
|
" ",
|
|
88485
|
-
|
|
88606
|
+
import_chalk5.default.yellow("\u26A0"),
|
|
88486
88607
|
" ",
|
|
88487
88608
|
ensureJsonExtension(state.filename),
|
|
88488
88609
|
" exists ",
|
|
88489
|
-
|
|
88610
|
+
import_chalk5.default.dim("\u2014"),
|
|
88490
88611
|
" Enter again to overwrite"
|
|
88491
88612
|
] }),
|
|
88492
|
-
state.error && /* @__PURE__ */ (0,
|
|
88613
|
+
state.error && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: "red", children: [
|
|
88493
88614
|
" ",
|
|
88494
|
-
|
|
88615
|
+
import_chalk5.default.red("\u2717"),
|
|
88495
88616
|
" ",
|
|
88496
88617
|
state.error
|
|
88497
88618
|
] }),
|
|
88498
|
-
/* @__PURE__ */ (0,
|
|
88499
|
-
|
|
88619
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
|
|
88620
|
+
import_chalk5.default.bold.hex("#FFD700")("\u23CE"),
|
|
88500
88621
|
" ",
|
|
88501
|
-
|
|
88622
|
+
import_chalk5.default.bold.hex("#FFD700")("save"),
|
|
88502
88623
|
" ",
|
|
88503
|
-
|
|
88624
|
+
import_chalk5.default.bold.cyan("\u2191\u2193"),
|
|
88504
88625
|
" ",
|
|
88505
|
-
|
|
88626
|
+
import_chalk5.default.dim("browse"),
|
|
88506
88627
|
" ",
|
|
88507
|
-
|
|
88628
|
+
import_chalk5.default.bold.cyan("esc"),
|
|
88508
88629
|
" ",
|
|
88509
|
-
|
|
88630
|
+
import_chalk5.default.dim("cancel")
|
|
88510
88631
|
] })
|
|
88511
88632
|
] });
|
|
88512
88633
|
};
|
|
@@ -88528,12 +88649,12 @@ function writeJsonFile(filepath, json) {
|
|
|
88528
88649
|
const resolved = resolvePath(filepath);
|
|
88529
88650
|
try {
|
|
88530
88651
|
writeFileSync5(resolved, json + "\n");
|
|
88531
|
-
process.stderr.write(
|
|
88652
|
+
process.stderr.write(import_chalk6.default.green(` \u2713 Saved to ${resolved}
|
|
88532
88653
|
|
|
88533
88654
|
`));
|
|
88534
88655
|
} catch (err) {
|
|
88535
88656
|
const msg = err instanceof Error ? err.message : String(err);
|
|
88536
|
-
process.stderr.write(
|
|
88657
|
+
process.stderr.write(import_chalk6.default.red(` Error saving file: ${msg}
|
|
88537
88658
|
|
|
88538
88659
|
`));
|
|
88539
88660
|
}
|
|
@@ -88565,14 +88686,14 @@ async function handleJsonOutput(result, config3) {
|
|
|
88565
88686
|
json,
|
|
88566
88687
|
onSaved: (filepath) => {
|
|
88567
88688
|
inkInstance.unmount();
|
|
88568
|
-
process.stderr.write(
|
|
88689
|
+
process.stderr.write(import_chalk6.default.green(` \u2713 Saved to ${filepath}
|
|
88569
88690
|
|
|
88570
88691
|
`));
|
|
88571
88692
|
resolve2();
|
|
88572
88693
|
},
|
|
88573
88694
|
onCancel: () => {
|
|
88574
88695
|
inkInstance.unmount();
|
|
88575
|
-
process.stderr.write(
|
|
88696
|
+
process.stderr.write(import_chalk6.default.dim(" Cancelled.\n\n"));
|
|
88576
88697
|
resolve2();
|
|
88577
88698
|
}
|
|
88578
88699
|
})
|
|
@@ -88583,7 +88704,7 @@ async function handleJsonOutput(result, config3) {
|
|
|
88583
88704
|
function printTrialBanner(result) {
|
|
88584
88705
|
if (result.trialScansRemaining === void 0) return;
|
|
88585
88706
|
process.stderr.write(
|
|
88586
|
-
|
|
88707
|
+
import_chalk6.default.dim(` Free tier \xB7 Run \`dg login\` for higher scan limits.
|
|
88587
88708
|
`)
|
|
88588
88709
|
);
|
|
88589
88710
|
}
|
|
@@ -88605,13 +88726,13 @@ function handleTrialExhausted2(error2, jsonMode = false) {
|
|
|
88605
88726
|
}, null, 2) + "\n");
|
|
88606
88727
|
} else {
|
|
88607
88728
|
if (hasKey) {
|
|
88608
|
-
process.stderr.write(
|
|
88729
|
+
process.stderr.write(import_chalk6.default.yellow(`
|
|
88609
88730
|
${message}
|
|
88610
88731
|
|
|
88611
88732
|
`));
|
|
88612
88733
|
} else {
|
|
88613
88734
|
process.stderr.write(
|
|
88614
|
-
|
|
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")
|
|
88615
88736
|
);
|
|
88616
88737
|
}
|
|
88617
88738
|
}
|
|
@@ -88621,9 +88742,9 @@ function handleTrialExhausted2(error2, jsonMode = false) {
|
|
|
88621
88742
|
return false;
|
|
88622
88743
|
}
|
|
88623
88744
|
function actionColor(action) {
|
|
88624
|
-
if (action === "block") return
|
|
88625
|
-
if (action === "warn") return
|
|
88626
|
-
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;
|
|
88627
88748
|
}
|
|
88628
88749
|
function pad(s, len) {
|
|
88629
88750
|
return s + " ".repeat(Math.max(0, len - s.length));
|
|
@@ -88643,18 +88764,18 @@ function groupPackages(packages) {
|
|
|
88643
88764
|
return [...map.values()].map((pkgs) => ({ packages: pkgs, key: pkgs[0].name })).sort((a, b) => b.packages[0].score - a.packages[0].score);
|
|
88644
88765
|
}
|
|
88645
88766
|
function actionBadge(score) {
|
|
88646
|
-
if (score >= 70) return { label: "Block", color:
|
|
88647
|
-
if (score >= 60) return { label: "Warn", color:
|
|
88648
|
-
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 };
|
|
88649
88770
|
}
|
|
88650
88771
|
function renderResultStatic(result, _config) {
|
|
88651
88772
|
const lines = [];
|
|
88652
88773
|
const actionStr = result.action.toUpperCase();
|
|
88653
88774
|
const colorAction = actionColor(result.action);
|
|
88654
88775
|
lines.push("");
|
|
88655
|
-
lines.push(` ${
|
|
88776
|
+
lines.push(` ${import_chalk6.default.bold("Dependency Guardian")}`);
|
|
88656
88777
|
lines.push(
|
|
88657
|
-
` Score: ${
|
|
88778
|
+
` Score: ${import_chalk6.default.bold(String(result.score))}${" ".repeat(
|
|
88658
88779
|
Math.max(1, 50 - String(result.score).length)
|
|
88659
88780
|
)}${colorAction(actionStr)}`
|
|
88660
88781
|
);
|
|
@@ -88664,11 +88785,11 @@ function renderResultStatic(result, _config) {
|
|
|
88664
88785
|
const total = result.packages.length;
|
|
88665
88786
|
if (flagged.length > 0) {
|
|
88666
88787
|
lines.push(
|
|
88667
|
-
` ${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`)}`
|
|
88668
88789
|
);
|
|
88669
88790
|
} else {
|
|
88670
88791
|
lines.push(
|
|
88671
|
-
` ${total} package${total !== 1 ? "s" : ""} scanned ${
|
|
88792
|
+
` ${total} package${total !== 1 ? "s" : ""} scanned ${import_chalk6.default.dim("\u2502")} ${import_chalk6.default.green("all clean")}`
|
|
88672
88793
|
);
|
|
88673
88794
|
}
|
|
88674
88795
|
const licensedPkgs = result.packages.filter((p) => p.license);
|
|
@@ -88677,7 +88798,7 @@ function renderResultStatic(result, _config) {
|
|
|
88677
88798
|
);
|
|
88678
88799
|
if (licenseIssues.length > 0) {
|
|
88679
88800
|
lines.push(
|
|
88680
|
-
` ${
|
|
88801
|
+
` ${import_chalk6.default.dim("Licenses:")} ${import_chalk6.default.yellow(`${licenseIssues.length} need review`)} \u2502 ${import_chalk6.default.green(`${licensedPkgs.length - licenseIssues.length} permissive`)}`
|
|
88681
88802
|
);
|
|
88682
88803
|
}
|
|
88683
88804
|
lines.push("");
|
|
@@ -88688,30 +88809,30 @@ function renderResultStatic(result, _config) {
|
|
|
88688
88809
|
}
|
|
88689
88810
|
const groups = groupPackages(flagged);
|
|
88690
88811
|
if (flagged.length > 0) {
|
|
88691
|
-
lines.push(` ${
|
|
88692
|
-
lines.push(` ${
|
|
88812
|
+
lines.push(` ${import_chalk6.default.bold("Flagged Packages")}`);
|
|
88813
|
+
lines.push(` ${import_chalk6.default.dim("\u2500".repeat(60))}`);
|
|
88693
88814
|
for (const group of groups) {
|
|
88694
88815
|
const rep = group.packages[0];
|
|
88695
88816
|
const { label, color } = actionBadge(rep.score);
|
|
88696
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`;
|
|
88697
88818
|
const lcInfo = rep.license;
|
|
88698
88819
|
const lcStr = lcInfo ? truncate2(lcInfo.spdx ?? lcInfo.raw ?? "", 14) : "";
|
|
88699
|
-
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;
|
|
88700
88821
|
lines.push(
|
|
88701
|
-
` ${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}`)}`
|
|
88702
88823
|
);
|
|
88703
88824
|
}
|
|
88704
88825
|
lines.push("");
|
|
88705
88826
|
}
|
|
88706
88827
|
if (clean.length > 0) {
|
|
88707
88828
|
lines.push(
|
|
88708
|
-
` ${
|
|
88829
|
+
` ${import_chalk6.default.green("\u2713")} ${import_chalk6.default.dim(`${clean.length} package${clean.length !== 1 ? "s" : ""} passed with score 0`)}`
|
|
88709
88830
|
);
|
|
88710
88831
|
lines.push("");
|
|
88711
88832
|
}
|
|
88712
88833
|
if (result.durationMs) {
|
|
88713
88834
|
lines.push(
|
|
88714
|
-
` ${
|
|
88835
|
+
` ${import_chalk6.default.dim(`Completed in ${(result.durationMs / 1e3).toFixed(1)}s`)}`
|
|
88715
88836
|
);
|
|
88716
88837
|
lines.push("");
|
|
88717
88838
|
}
|
|
@@ -88720,12 +88841,12 @@ function renderResultStatic(result, _config) {
|
|
|
88720
88841
|
async function runStatic(config3) {
|
|
88721
88842
|
const dbg = (msg) => {
|
|
88722
88843
|
if (config3.debug)
|
|
88723
|
-
process.stderr.write(
|
|
88844
|
+
process.stderr.write(import_chalk6.default.dim(` [debug] ${msg}
|
|
88724
88845
|
`));
|
|
88725
88846
|
};
|
|
88726
88847
|
if (config3.mode === "off") {
|
|
88727
88848
|
process.stderr.write(
|
|
88728
|
-
|
|
88849
|
+
import_chalk6.default.dim(" Dependency Guardian: mode is off \u2014 skipping.\n")
|
|
88729
88850
|
);
|
|
88730
88851
|
process.exit(0);
|
|
88731
88852
|
}
|
|
@@ -88733,7 +88854,7 @@ async function runStatic(config3) {
|
|
|
88733
88854
|
`mode=${config3.mode} max=${config3.maxPackages}`
|
|
88734
88855
|
);
|
|
88735
88856
|
dbg(`api=${config3.apiUrl}`);
|
|
88736
|
-
process.stderr.write(
|
|
88857
|
+
process.stderr.write(import_chalk6.default.dim(" Discovering package changes...\n"));
|
|
88737
88858
|
let discovery = discoverChanges(process.cwd(), config3);
|
|
88738
88859
|
dbg(`discovery method: ${discovery.method}`);
|
|
88739
88860
|
if (discovery.pythonPackages.length > 0) {
|
|
@@ -88743,17 +88864,17 @@ async function runStatic(config3) {
|
|
|
88743
88864
|
const { discoverProjects: discoverProjects2 } = await Promise.resolve().then(() => (init_discover(), discover_exports));
|
|
88744
88865
|
const subProjects = discoverProjects2(process.cwd());
|
|
88745
88866
|
if (subProjects.length === 0) {
|
|
88746
|
-
process.stderr.write(
|
|
88867
|
+
process.stderr.write(import_chalk6.default.dim(" No package changes detected.\n"));
|
|
88747
88868
|
process.exit(0);
|
|
88748
88869
|
}
|
|
88749
88870
|
const totalPkgs = subProjects.reduce((s, p) => s + p.packageCount, 0);
|
|
88750
88871
|
process.stderr.write(
|
|
88751
|
-
|
|
88872
|
+
import_chalk6.default.dim(` Found ${subProjects.length} projects (${totalPkgs} packages total):
|
|
88752
88873
|
`)
|
|
88753
88874
|
);
|
|
88754
88875
|
for (const proj of subProjects) {
|
|
88755
88876
|
process.stderr.write(
|
|
88756
|
-
|
|
88877
|
+
import_chalk6.default.dim(` ${proj.ecosystem} ${proj.relativePath} (${proj.packageCount})
|
|
88757
88878
|
`)
|
|
88758
88879
|
);
|
|
88759
88880
|
}
|
|
@@ -88783,7 +88904,7 @@ async function runStatic(config3) {
|
|
|
88783
88904
|
}
|
|
88784
88905
|
}
|
|
88785
88906
|
if (allNpmPkgs.length === 0 && allPyPkgs.length === 0) {
|
|
88786
|
-
process.stderr.write(
|
|
88907
|
+
process.stderr.write(import_chalk6.default.dim(" No package changes detected across projects.\n"));
|
|
88787
88908
|
process.exit(0);
|
|
88788
88909
|
}
|
|
88789
88910
|
discovery = {
|
|
@@ -88796,14 +88917,14 @@ async function runStatic(config3) {
|
|
|
88796
88917
|
const packages = discovery.packages;
|
|
88797
88918
|
const totalToScan = packages.length + discovery.pythonPackages.length;
|
|
88798
88919
|
process.stderr.write(
|
|
88799
|
-
|
|
88920
|
+
import_chalk6.default.dim(
|
|
88800
88921
|
` Scanning ${totalToScan} package${totalToScan !== 1 ? "s" : ""}${discovery.pythonPackages.length > 0 ? ` (${packages.length} npm + ${discovery.pythonPackages.length} Python)` : ""} (${discovery.method})...
|
|
88801
88922
|
`
|
|
88802
88923
|
)
|
|
88803
88924
|
);
|
|
88804
88925
|
if (discovery.skipped.length > 0 && config3.maxPackages < 1e4) {
|
|
88805
88926
|
process.stderr.write(
|
|
88806
|
-
|
|
88927
|
+
import_chalk6.default.dim(
|
|
88807
88928
|
` Note: ${discovery.skipped.length} package(s) not scanned (--max-packages=${config3.maxPackages})
|
|
88808
88929
|
`
|
|
88809
88930
|
)
|
|
@@ -88817,7 +88938,7 @@ async function runStatic(config3) {
|
|
|
88817
88938
|
const startMs = Date.now();
|
|
88818
88939
|
if (packages.length > 0) {
|
|
88819
88940
|
result = await callAnalyzeAPI(packages, config3, (done, total) => {
|
|
88820
|
-
process.stderr.write(
|
|
88941
|
+
process.stderr.write(import_chalk6.default.dim(` Analyzed ${done}/${total}...
|
|
88821
88942
|
`));
|
|
88822
88943
|
});
|
|
88823
88944
|
} else {
|
|
@@ -88825,7 +88946,7 @@ async function runStatic(config3) {
|
|
|
88825
88946
|
}
|
|
88826
88947
|
if (discovery.pythonPackages.length > 0) {
|
|
88827
88948
|
process.stderr.write(
|
|
88828
|
-
|
|
88949
|
+
import_chalk6.default.dim(` Scanning ${discovery.pythonPackages.length} Python package${discovery.pythonPackages.length !== 1 ? "s" : ""}...
|
|
88829
88950
|
`)
|
|
88830
88951
|
);
|
|
88831
88952
|
const pyResult = await callPyPIAnalyzeAPI(discovery.pythonPackages, config3);
|
|
@@ -88872,7 +88993,7 @@ async function runStaticNpm(npmArgs, config3) {
|
|
|
88872
88993
|
const bareSpecs = readBareInstallPackages(process.cwd());
|
|
88873
88994
|
if (bareSpecs.length === 0) {
|
|
88874
88995
|
process.stderr.write(
|
|
88875
|
-
|
|
88996
|
+
import_chalk6.default.dim(
|
|
88876
88997
|
" Dependency Guardian: no packages to scan, passing through to npm.\n"
|
|
88877
88998
|
)
|
|
88878
88999
|
);
|
|
@@ -88880,7 +89001,7 @@ async function runStaticNpm(npmArgs, config3) {
|
|
|
88880
89001
|
process.exit(code);
|
|
88881
89002
|
}
|
|
88882
89003
|
process.stderr.write(
|
|
88883
|
-
|
|
89004
|
+
import_chalk6.default.dim(
|
|
88884
89005
|
` Resolving ${bareSpecs.length} package${bareSpecs.length !== 1 ? "s" : ""} from package.json...
|
|
88885
89006
|
`
|
|
88886
89007
|
)
|
|
@@ -88888,7 +89009,7 @@ async function runStaticNpm(npmArgs, config3) {
|
|
|
88888
89009
|
const { resolved: resolved2, failed: failed2 } = await resolvePackages(bareSpecs);
|
|
88889
89010
|
if (failed2.length > 0 && config3.debug) {
|
|
88890
89011
|
process.stderr.write(
|
|
88891
|
-
|
|
89012
|
+
import_chalk6.default.dim(
|
|
88892
89013
|
` [debug] Could not resolve: ${failed2.slice(0, 5).join(", ")}${failed2.length > 5 ? ` (+${failed2.length - 5} more)` : ""}
|
|
88893
89014
|
`
|
|
88894
89015
|
)
|
|
@@ -88897,7 +89018,7 @@ async function runStaticNpm(npmArgs, config3) {
|
|
|
88897
89018
|
return scanAndInstallStatic(resolved2, parsed, config3);
|
|
88898
89019
|
}
|
|
88899
89020
|
process.stderr.write(
|
|
88900
|
-
|
|
89021
|
+
import_chalk6.default.dim(
|
|
88901
89022
|
` Resolving ${parsed.packages.length} package${parsed.packages.length !== 1 ? "s" : ""}...
|
|
88902
89023
|
`
|
|
88903
89024
|
)
|
|
@@ -88905,7 +89026,7 @@ async function runStaticNpm(npmArgs, config3) {
|
|
|
88905
89026
|
const { resolved, failed } = await resolvePackages(parsed.packages);
|
|
88906
89027
|
if (failed.length > 0) {
|
|
88907
89028
|
process.stderr.write(
|
|
88908
|
-
|
|
89029
|
+
import_chalk6.default.yellow(
|
|
88909
89030
|
` Warning: Could not resolve versions for: ${failed.join(", ")}
|
|
88910
89031
|
`
|
|
88911
89032
|
)
|
|
@@ -88913,7 +89034,7 @@ async function runStaticNpm(npmArgs, config3) {
|
|
|
88913
89034
|
}
|
|
88914
89035
|
if (resolved.length === 0) {
|
|
88915
89036
|
process.stderr.write(
|
|
88916
|
-
|
|
89037
|
+
import_chalk6.default.dim(" No packages to scan. Passing through to npm.\n")
|
|
88917
89038
|
);
|
|
88918
89039
|
const code = await runNpm(parsed.rawArgs);
|
|
88919
89040
|
process.exit(code);
|
|
@@ -88922,7 +89043,7 @@ async function runStaticNpm(npmArgs, config3) {
|
|
|
88922
89043
|
}
|
|
88923
89044
|
async function scanAndInstallStatic(resolved, parsed, config3) {
|
|
88924
89045
|
process.stderr.write(
|
|
88925
|
-
|
|
89046
|
+
import_chalk6.default.dim(
|
|
88926
89047
|
` Scanning ${resolved.length} package${resolved.length !== 1 ? "s" : ""}...
|
|
88927
89048
|
`
|
|
88928
89049
|
)
|
|
@@ -88934,7 +89055,7 @@ async function scanAndInstallStatic(resolved, parsed, config3) {
|
|
|
88934
89055
|
const elapsed = Date.now() - startMs;
|
|
88935
89056
|
if (config3.debug) {
|
|
88936
89057
|
process.stderr.write(
|
|
88937
|
-
|
|
89058
|
+
import_chalk6.default.dim(
|
|
88938
89059
|
` [debug] API responded in ${elapsed}ms, action=${result.action}, score=${result.score}
|
|
88939
89060
|
`
|
|
88940
89061
|
)
|
|
@@ -88944,7 +89065,7 @@ async function scanAndInstallStatic(resolved, parsed, config3) {
|
|
|
88944
89065
|
if (handleTrialExhausted2(error2, config3.json)) return;
|
|
88945
89066
|
const msg = error2 instanceof Error ? error2.message : String(error2);
|
|
88946
89067
|
process.stderr.write(
|
|
88947
|
-
|
|
89068
|
+
import_chalk6.default.yellow(
|
|
88948
89069
|
` Warning: Scan failed (${msg}). Proceeding with install.
|
|
88949
89070
|
`
|
|
88950
89071
|
)
|
|
@@ -88955,8 +89076,8 @@ async function scanAndInstallStatic(resolved, parsed, config3) {
|
|
|
88955
89076
|
}
|
|
88956
89077
|
if (result.action === "pass") {
|
|
88957
89078
|
process.stderr.write(
|
|
88958
|
-
|
|
88959
|
-
` ${
|
|
89079
|
+
import_chalk6.default.green(
|
|
89080
|
+
` ${import_chalk6.default.bold("\u2713")} ${resolved.length} package${resolved.length !== 1 ? "s" : ""} scanned \u2014 all clear
|
|
88960
89081
|
`
|
|
88961
89082
|
)
|
|
88962
89083
|
);
|
|
@@ -88970,7 +89091,7 @@ async function scanAndInstallStatic(resolved, parsed, config3) {
|
|
|
88970
89091
|
printTrialBanner(result);
|
|
88971
89092
|
if (result.action === "warn") {
|
|
88972
89093
|
process.stderr.write(
|
|
88973
|
-
|
|
89094
|
+
import_chalk6.default.yellow(" Warnings detected. Proceeding with install.\n\n")
|
|
88974
89095
|
);
|
|
88975
89096
|
const code = await runNpm(parsed.rawArgs);
|
|
88976
89097
|
process.exit(code);
|
|
@@ -88978,8 +89099,8 @@ async function scanAndInstallStatic(resolved, parsed, config3) {
|
|
|
88978
89099
|
if (result.action === "block") {
|
|
88979
89100
|
if (parsed.dgForce) {
|
|
88980
89101
|
process.stderr.write(
|
|
88981
|
-
|
|
88982
|
-
|
|
89102
|
+
import_chalk6.default.yellow(
|
|
89103
|
+
import_chalk6.default.bold(
|
|
88983
89104
|
" --dg-force: Bypassing block. Install at your own risk.\n\n"
|
|
88984
89105
|
)
|
|
88985
89106
|
)
|
|
@@ -88988,10 +89109,10 @@ async function scanAndInstallStatic(resolved, parsed, config3) {
|
|
|
88988
89109
|
process.exit(code);
|
|
88989
89110
|
}
|
|
88990
89111
|
process.stderr.write(
|
|
88991
|
-
|
|
89112
|
+
import_chalk6.default.red(import_chalk6.default.bold(" BLOCKED: ")) + import_chalk6.default.red("High-risk packages detected. Install aborted.\n")
|
|
88992
89113
|
);
|
|
88993
89114
|
process.stderr.write(
|
|
88994
|
-
|
|
89115
|
+
import_chalk6.default.dim(" Use --dg-force to bypass this check.\n\n")
|
|
88995
89116
|
);
|
|
88996
89117
|
process.exit(2);
|
|
88997
89118
|
}
|
|
@@ -89008,13 +89129,13 @@ async function runStaticPip(pipArgs, config3) {
|
|
|
89008
89129
|
}
|
|
89009
89130
|
if (specs.length === 0) {
|
|
89010
89131
|
process.stderr.write(
|
|
89011
|
-
|
|
89132
|
+
import_chalk6.default.dim(" Dependency Guardian: no packages to scan, passing through to pip.\n")
|
|
89012
89133
|
);
|
|
89013
89134
|
const code = await runPip(parsed.rawArgs);
|
|
89014
89135
|
process.exit(code);
|
|
89015
89136
|
}
|
|
89016
89137
|
process.stderr.write(
|
|
89017
|
-
|
|
89138
|
+
import_chalk6.default.dim(
|
|
89018
89139
|
` Resolving ${specs.length} package${specs.length !== 1 ? "s" : ""} from PyPI...
|
|
89019
89140
|
`
|
|
89020
89141
|
)
|
|
@@ -89022,19 +89143,19 @@ async function runStaticPip(pipArgs, config3) {
|
|
|
89022
89143
|
const { resolved, failed } = await resolvePackages2(specs);
|
|
89023
89144
|
if (failed.length > 0) {
|
|
89024
89145
|
process.stderr.write(
|
|
89025
|
-
|
|
89146
|
+
import_chalk6.default.yellow(` Warning: Could not resolve versions for: ${failed.join(", ")}
|
|
89026
89147
|
`)
|
|
89027
89148
|
);
|
|
89028
89149
|
}
|
|
89029
89150
|
if (resolved.length === 0) {
|
|
89030
89151
|
process.stderr.write(
|
|
89031
|
-
|
|
89152
|
+
import_chalk6.default.dim(" No packages to scan. Passing through to pip.\n")
|
|
89032
89153
|
);
|
|
89033
89154
|
const code = await runPip(parsed.rawArgs);
|
|
89034
89155
|
process.exit(code);
|
|
89035
89156
|
}
|
|
89036
89157
|
process.stderr.write(
|
|
89037
|
-
|
|
89158
|
+
import_chalk6.default.dim(
|
|
89038
89159
|
` Scanning ${resolved.length} Python package${resolved.length !== 1 ? "s" : ""}...
|
|
89039
89160
|
`
|
|
89040
89161
|
)
|
|
@@ -89046,7 +89167,7 @@ async function runStaticPip(pipArgs, config3) {
|
|
|
89046
89167
|
if (handleTrialExhausted2(error2, config3.json)) return;
|
|
89047
89168
|
const msg = error2 instanceof Error ? error2.message : String(error2);
|
|
89048
89169
|
process.stderr.write(
|
|
89049
|
-
|
|
89170
|
+
import_chalk6.default.yellow(` Warning: Scan failed (${msg}). Proceeding with install.
|
|
89050
89171
|
`)
|
|
89051
89172
|
);
|
|
89052
89173
|
const code = await runPip(parsed.rawArgs);
|
|
@@ -89055,8 +89176,8 @@ async function runStaticPip(pipArgs, config3) {
|
|
|
89055
89176
|
}
|
|
89056
89177
|
if (result.action === "pass") {
|
|
89057
89178
|
process.stderr.write(
|
|
89058
|
-
|
|
89059
|
-
` ${
|
|
89179
|
+
import_chalk6.default.green(
|
|
89180
|
+
` ${import_chalk6.default.bold("\u2713")} ${resolved.length} package${resolved.length !== 1 ? "s" : ""} scanned \u2014 all clear
|
|
89060
89181
|
`
|
|
89061
89182
|
)
|
|
89062
89183
|
);
|
|
@@ -89070,7 +89191,7 @@ async function runStaticPip(pipArgs, config3) {
|
|
|
89070
89191
|
printTrialBanner(result);
|
|
89071
89192
|
if (result.action === "warn") {
|
|
89072
89193
|
process.stderr.write(
|
|
89073
|
-
|
|
89194
|
+
import_chalk6.default.yellow(" Warnings detected. Proceeding with install.\n\n")
|
|
89074
89195
|
);
|
|
89075
89196
|
const code = await runPip(parsed.rawArgs);
|
|
89076
89197
|
process.exit(code);
|
|
@@ -89078,16 +89199,16 @@ async function runStaticPip(pipArgs, config3) {
|
|
|
89078
89199
|
if (result.action === "block") {
|
|
89079
89200
|
if (parsed.dgForce) {
|
|
89080
89201
|
process.stderr.write(
|
|
89081
|
-
|
|
89202
|
+
import_chalk6.default.yellow(import_chalk6.default.bold(" --dg-force: Bypassing block. Install at your own risk.\n\n"))
|
|
89082
89203
|
);
|
|
89083
89204
|
const code = await runPip(parsed.rawArgs);
|
|
89084
89205
|
process.exit(code);
|
|
89085
89206
|
}
|
|
89086
89207
|
process.stderr.write(
|
|
89087
|
-
|
|
89208
|
+
import_chalk6.default.red(import_chalk6.default.bold(" BLOCKED: ")) + import_chalk6.default.red("High-risk packages detected. Install aborted.\n")
|
|
89088
89209
|
);
|
|
89089
89210
|
process.stderr.write(
|
|
89090
|
-
|
|
89211
|
+
import_chalk6.default.dim(" Use --dg-force to bypass this check.\n\n")
|
|
89091
89212
|
);
|
|
89092
89213
|
process.exit(2);
|
|
89093
89214
|
}
|
|
@@ -89110,22 +89231,22 @@ async function runStaticLogin() {
|
|
|
89110
89231
|
});
|
|
89111
89232
|
if (resp.ok) {
|
|
89112
89233
|
process.stderr.write(
|
|
89113
|
-
|
|
89234
|
+
import_chalk6.default.yellow(" Already authenticated.\n") + import_chalk6.default.dim(" Run `dg logout` first to re-authenticate.\n")
|
|
89114
89235
|
);
|
|
89115
89236
|
return;
|
|
89116
89237
|
}
|
|
89117
89238
|
} catch {
|
|
89118
89239
|
}
|
|
89119
|
-
process.stderr.write(
|
|
89240
|
+
process.stderr.write(import_chalk6.default.dim(" Stored key is invalid. Starting fresh login...\n"));
|
|
89120
89241
|
saveCredentials2("");
|
|
89121
89242
|
}
|
|
89122
|
-
process.stderr.write(
|
|
89243
|
+
process.stderr.write(import_chalk6.default.dim(" Creating login session...\n"));
|
|
89123
89244
|
let session;
|
|
89124
89245
|
try {
|
|
89125
89246
|
session = await createAuthSession2();
|
|
89126
89247
|
} catch (err) {
|
|
89127
89248
|
process.stderr.write(
|
|
89128
|
-
|
|
89249
|
+
import_chalk6.default.red(` Error: ${err instanceof Error ? err.message : String(err)}
|
|
89129
89250
|
`)
|
|
89130
89251
|
);
|
|
89131
89252
|
process.exit(1);
|
|
@@ -89133,10 +89254,10 @@ async function runStaticLogin() {
|
|
|
89133
89254
|
process.stderr.write(`
|
|
89134
89255
|
Authenticate your account at:
|
|
89135
89256
|
`);
|
|
89136
|
-
process.stderr.write(` ${
|
|
89257
|
+
process.stderr.write(` ${import_chalk6.default.cyan(session.verifyUrl)}
|
|
89137
89258
|
|
|
89138
89259
|
`);
|
|
89139
|
-
process.stderr.write(
|
|
89260
|
+
process.stderr.write(import_chalk6.default.dim(" Press ENTER to open in the browser...\n"));
|
|
89140
89261
|
await new Promise((resolve2) => {
|
|
89141
89262
|
const onData = () => {
|
|
89142
89263
|
process.stdin.removeListener("data", onData);
|
|
@@ -89151,7 +89272,7 @@ async function runStaticLogin() {
|
|
|
89151
89272
|
openBrowser2(session.verifyUrl);
|
|
89152
89273
|
} catch {
|
|
89153
89274
|
}
|
|
89154
|
-
process.stderr.write(
|
|
89275
|
+
process.stderr.write(import_chalk6.default.dim(" Waiting for authorization...\n"));
|
|
89155
89276
|
const POLL_INTERVAL = 2e3;
|
|
89156
89277
|
const MAX_ATTEMPTS = 150;
|
|
89157
89278
|
for (let i = 0; i < MAX_ATTEMPTS; i++) {
|
|
@@ -89161,15 +89282,15 @@ async function runStaticLogin() {
|
|
|
89161
89282
|
if (result.status === "complete" && result.apiKey) {
|
|
89162
89283
|
saveCredentials2(result.apiKey);
|
|
89163
89284
|
process.stderr.write(
|
|
89164
|
-
|
|
89285
|
+
import_chalk6.default.green(`
|
|
89165
89286
|
Logged in as ${result.email ?? "unknown"}
|
|
89166
|
-
`) +
|
|
89287
|
+
`) + import_chalk6.default.dim(" Credentials saved.\n\n")
|
|
89167
89288
|
);
|
|
89168
89289
|
return;
|
|
89169
89290
|
}
|
|
89170
89291
|
if (result.status === "expired") {
|
|
89171
89292
|
process.stderr.write(
|
|
89172
|
-
|
|
89293
|
+
import_chalk6.default.yellow("\n Session expired. Run `dg login` to try again.\n")
|
|
89173
89294
|
);
|
|
89174
89295
|
process.exit(1);
|
|
89175
89296
|
}
|
|
@@ -89177,15 +89298,15 @@ async function runStaticLogin() {
|
|
|
89177
89298
|
}
|
|
89178
89299
|
}
|
|
89179
89300
|
process.stderr.write(
|
|
89180
|
-
|
|
89301
|
+
import_chalk6.default.yellow("\n Timed out waiting for authorization.\n")
|
|
89181
89302
|
);
|
|
89182
89303
|
process.exit(1);
|
|
89183
89304
|
}
|
|
89184
|
-
var
|
|
89305
|
+
var import_chalk6;
|
|
89185
89306
|
var init_static_output = __esm({
|
|
89186
89307
|
"src/static-output.ts"() {
|
|
89187
89308
|
"use strict";
|
|
89188
|
-
|
|
89309
|
+
import_chalk6 = __toESM(require_source());
|
|
89189
89310
|
init_api3();
|
|
89190
89311
|
init_auth();
|
|
89191
89312
|
init_lockfile();
|
|
@@ -89256,10 +89377,10 @@ function reducer4(_state, action) {
|
|
|
89256
89377
|
}
|
|
89257
89378
|
}
|
|
89258
89379
|
function useScan(config3) {
|
|
89259
|
-
const [state, dispatch] = (0,
|
|
89260
|
-
const started = (0,
|
|
89261
|
-
const [multiProjects, setMultiProjects] = (0,
|
|
89262
|
-
(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)(() => {
|
|
89263
89384
|
if (started.current) return;
|
|
89264
89385
|
started.current = true;
|
|
89265
89386
|
const projects = discoverProjects(process.cwd());
|
|
@@ -89286,11 +89407,11 @@ function useScan(config3) {
|
|
|
89286
89407
|
scanProjects(projects, config3, dispatch);
|
|
89287
89408
|
}
|
|
89288
89409
|
}, [config3]);
|
|
89289
|
-
const scanSelectedProjects = (0,
|
|
89410
|
+
const scanSelectedProjects = (0, import_react31.useCallback)((projects) => {
|
|
89290
89411
|
dispatch({ type: "DISCOVERY_COMPLETE", packages: [], skippedCount: 0 });
|
|
89291
89412
|
scanProjects(projects, config3, dispatch);
|
|
89292
89413
|
}, [config3]);
|
|
89293
|
-
const restartSelection = (0,
|
|
89414
|
+
const restartSelection = (0, import_react31.useCallback)(() => {
|
|
89294
89415
|
if (!multiProjects) return;
|
|
89295
89416
|
dispatch({ type: "RESTART_SELECTION", projects: multiProjects });
|
|
89296
89417
|
}, [multiProjects]);
|
|
@@ -89410,11 +89531,11 @@ async function scanProjects(projects, config3, dispatch) {
|
|
|
89410
89531
|
dispatch({ type: "ERROR", error: err });
|
|
89411
89532
|
}
|
|
89412
89533
|
}
|
|
89413
|
-
var
|
|
89534
|
+
var import_react31;
|
|
89414
89535
|
var init_useScan = __esm({
|
|
89415
89536
|
"src/ui/hooks/useScan.ts"() {
|
|
89416
89537
|
"use strict";
|
|
89417
|
-
|
|
89538
|
+
import_react31 = __toESM(require_react());
|
|
89418
89539
|
init_lockfile();
|
|
89419
89540
|
init_api3();
|
|
89420
89541
|
init_discover();
|
|
@@ -89423,85 +89544,6 @@ var init_useScan = __esm({
|
|
|
89423
89544
|
}
|
|
89424
89545
|
});
|
|
89425
89546
|
|
|
89426
|
-
// src/ui/components/ProgressBar.tsx
|
|
89427
|
-
function estimateScanSeconds(packageCount) {
|
|
89428
|
-
return Math.ceil(Math.max(5, packageCount * 0.35 - 10));
|
|
89429
|
-
}
|
|
89430
|
-
function formatTime(seconds) {
|
|
89431
|
-
if (seconds < 60) return `${seconds}s`;
|
|
89432
|
-
const m = Math.floor(seconds / 60);
|
|
89433
|
-
const s = seconds % 60;
|
|
89434
|
-
return s > 0 ? `${m}m ${s}s` : `${m}m`;
|
|
89435
|
-
}
|
|
89436
|
-
var import_react31, import_chalk6, import_jsx_runtime9, ProgressBar;
|
|
89437
|
-
var init_ProgressBar = __esm({
|
|
89438
|
-
async "src/ui/components/ProgressBar.tsx"() {
|
|
89439
|
-
"use strict";
|
|
89440
|
-
import_react31 = __toESM(require_react());
|
|
89441
|
-
await init_build2();
|
|
89442
|
-
await init_build3();
|
|
89443
|
-
import_chalk6 = __toESM(require_source());
|
|
89444
|
-
import_jsx_runtime9 = __toESM(require_jsx_runtime());
|
|
89445
|
-
ProgressBar = ({
|
|
89446
|
-
value,
|
|
89447
|
-
total,
|
|
89448
|
-
label
|
|
89449
|
-
}) => {
|
|
89450
|
-
const startRef = (0, import_react31.useRef)(Date.now());
|
|
89451
|
-
const [elapsed, setElapsed] = (0, import_react31.useState)(0);
|
|
89452
|
-
(0, import_react31.useEffect)(() => {
|
|
89453
|
-
const timer = setInterval(() => {
|
|
89454
|
-
setElapsed(Math.floor((Date.now() - startRef.current) / 1e3));
|
|
89455
|
-
}, 1e3);
|
|
89456
|
-
return () => clearInterval(timer);
|
|
89457
|
-
}, []);
|
|
89458
|
-
const termWidth = process.stdout.columns || 80;
|
|
89459
|
-
const percent = total > 0 ? Math.round(value / total * 100) : 0;
|
|
89460
|
-
const estimate = estimateScanSeconds(total);
|
|
89461
|
-
const timeInfo = `${formatTime(elapsed)} / ~${formatTime(estimate)}`;
|
|
89462
|
-
const counter = `${value}/${total} ${percent}%`;
|
|
89463
|
-
const barWidth = Math.max(10, termWidth - counter.length - 8);
|
|
89464
|
-
const fraction = total > 0 ? Math.min(1, value / total) : 0;
|
|
89465
|
-
const filled = Math.round(fraction * barWidth);
|
|
89466
|
-
const empty = barWidth - filled;
|
|
89467
|
-
const filledBar = "\u2501".repeat(filled);
|
|
89468
|
-
const emptyBar = "\u2501".repeat(empty);
|
|
89469
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
|
|
89470
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
|
|
89471
|
-
import_chalk6.default.cyan("\u25C6"),
|
|
89472
|
-
" ",
|
|
89473
|
-
import_chalk6.default.bold("Dependency Guardian")
|
|
89474
|
-
] }),
|
|
89475
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { children: "" }),
|
|
89476
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { children: [
|
|
89477
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "cyan", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(build_default, { type: "dots" }) }),
|
|
89478
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
|
|
89479
|
-
" Scanning ",
|
|
89480
|
-
total,
|
|
89481
|
-
" packages... "
|
|
89482
|
-
] }),
|
|
89483
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { dimColor: true, children: timeInfo })
|
|
89484
|
-
] }),
|
|
89485
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { children: [
|
|
89486
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { children: " " }),
|
|
89487
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "green", children: filledBar }),
|
|
89488
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { dimColor: true, children: emptyBar }),
|
|
89489
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
|
|
89490
|
-
" ",
|
|
89491
|
-
counter
|
|
89492
|
-
] })
|
|
89493
|
-
] }),
|
|
89494
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { dimColor: true, children: [
|
|
89495
|
-
" ",
|
|
89496
|
-
import_chalk6.default.dim("\u203A"),
|
|
89497
|
-
" ",
|
|
89498
|
-
label
|
|
89499
|
-
] }) })
|
|
89500
|
-
] });
|
|
89501
|
-
};
|
|
89502
|
-
}
|
|
89503
|
-
});
|
|
89504
|
-
|
|
89505
89547
|
// src/ui/components/ScoreHeader.tsx
|
|
89506
89548
|
function scoreColor(score, action) {
|
|
89507
89549
|
const colorFn = action === "block" ? import_chalk7.default.red.bold : action === "warn" ? import_chalk7.default.yellow.bold : import_chalk7.default.green.bold;
|