brew-tui 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -8
- package/build/{brewbar-installer-LCENEWJB.js → brewbar-installer-GWJ76J6G.js} +2 -3
- package/build/brewbar-installer-GWJ76J6G.js.map +1 -0
- package/build/{chunk-VXTPR2FD.js → chunk-KDKXGXN2.js} +2 -2
- package/build/{chunk-MHHIHUCY.js → chunk-WDRT6G63.js} +9 -1
- package/build/chunk-WDRT6G63.js.map +1 -0
- package/build/index.js +861 -788
- package/build/index.js.map +1 -1
- package/build/{sync-engine-IKKIWF2Y.js → sync-engine-76YMONYH.js} +3 -3
- package/build/{version-check-GUAV5TWD.js → version-check-LHQYDFDA.js} +2 -2
- package/package.json +1 -1
- package/build/brewbar-installer-LCENEWJB.js.map +0 -1
- package/build/chunk-MHHIHUCY.js.map +0 -1
- /package/build/{chunk-VXTPR2FD.js.map → chunk-KDKXGXN2.js.map} +0 -0
- /package/build/{sync-engine-IKKIWF2Y.js.map → sync-engine-76YMONYH.js.map} +0 -0
- /package/build/{version-check-GUAV5TWD.js.map → version-check-LHQYDFDA.js.map} +0 -0
package/build/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
readSyncEnvelope,
|
|
20
20
|
revalidate,
|
|
21
21
|
sync
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-KDKXGXN2.js";
|
|
23
23
|
import {
|
|
24
24
|
checkCompliance
|
|
25
25
|
} from "./chunk-J6HCX7RG.js";
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
t,
|
|
56
56
|
tp,
|
|
57
57
|
useLocaleStore
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-WDRT6G63.js";
|
|
59
59
|
import {
|
|
60
60
|
logger
|
|
61
61
|
} from "./chunk-KDHEUNRI.js";
|
|
@@ -66,14 +66,14 @@ import { rm as rm2 } from "fs/promises";
|
|
|
66
66
|
import { render } from "ink";
|
|
67
67
|
|
|
68
68
|
// src/app.tsx
|
|
69
|
-
import { useEffect as
|
|
69
|
+
import { useEffect as useEffect23, useState as useState20 } from "react";
|
|
70
70
|
import { useApp } from "ink";
|
|
71
71
|
|
|
72
72
|
// src/components/layout/app-layout.tsx
|
|
73
73
|
import { Box as Box3 } from "ink";
|
|
74
74
|
|
|
75
75
|
// src/components/layout/header.tsx
|
|
76
|
-
import { Box, Text as
|
|
76
|
+
import { Box, Text as Text3, useStdout } from "ink";
|
|
77
77
|
|
|
78
78
|
// src/stores/navigation-store.ts
|
|
79
79
|
import { create } from "zustand";
|
|
@@ -99,7 +99,9 @@ var useNavigationStore = create((set, get) => ({
|
|
|
99
99
|
selectedPackage: null,
|
|
100
100
|
selectedPackageType: null,
|
|
101
101
|
viewHistory: [],
|
|
102
|
-
menuMode
|
|
102
|
+
// menuMode starts ON so the side menu owns arrows from the first frame —
|
|
103
|
+
// users can navigate with ↑/↓/↵ without having to press M first.
|
|
104
|
+
menuMode: true,
|
|
103
105
|
menuCursor: 0,
|
|
104
106
|
navigate: (view) => {
|
|
105
107
|
const { currentView, viewHistory } = get();
|
|
@@ -293,6 +295,24 @@ var GRADIENTS = {
|
|
|
293
295
|
darkGold: [COLORS.goldDeep, COLORS.goldDark, COLORS.goldDeepest]
|
|
294
296
|
};
|
|
295
297
|
|
|
298
|
+
// src/components/common/blinking-text.tsx
|
|
299
|
+
import { useEffect, useState } from "react";
|
|
300
|
+
import { Text as Text2 } from "ink";
|
|
301
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
302
|
+
function BlinkingText({
|
|
303
|
+
color,
|
|
304
|
+
intervalMs = 600,
|
|
305
|
+
bold = true,
|
|
306
|
+
children
|
|
307
|
+
}) {
|
|
308
|
+
const [bright, setBright] = useState(true);
|
|
309
|
+
useEffect(() => {
|
|
310
|
+
const id = setInterval(() => setBright((b) => !b), intervalMs);
|
|
311
|
+
return () => clearInterval(id);
|
|
312
|
+
}, [intervalMs]);
|
|
313
|
+
return /* @__PURE__ */ jsx2(Text2, { color, bold, dimColor: !bright, children });
|
|
314
|
+
}
|
|
315
|
+
|
|
296
316
|
// src/utils/spacing.ts
|
|
297
317
|
var SPACING = {
|
|
298
318
|
none: 0,
|
|
@@ -305,7 +325,7 @@ var SPACING = {
|
|
|
305
325
|
};
|
|
306
326
|
|
|
307
327
|
// src/components/layout/header.tsx
|
|
308
|
-
import { jsx as
|
|
328
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
309
329
|
var LOGO_BREW = [
|
|
310
330
|
"\u256D\u2501\u2501\u256E\u2571\u256D\u2501\u2501\u2501\u256E\u256D\u2501\u2501\u2501\u256E\u256D\u256E\u256D\u256E\u256D\u256E\u2571\u2571\u2571\u2571\u2571\u2571\u2571",
|
|
311
331
|
"\u2503\u256D\u256E\u2503\u2571\u2503\u256D\u2501\u256E\u2503\u2503\u256D\u2501\u2501\u256F\u2503\u2503\u2503\u2503\u2503\u2503\u2571\u2571\u2571\u2571\u2571\u2571\u2571",
|
|
@@ -350,12 +370,12 @@ function MenuItem({ view, currentView, cursorView, menuMode }) {
|
|
|
350
370
|
const labelColor = isCursor ? COLORS.brand : isCurrent ? COLORS.success : isAccount ? COLORS.gold : COLORS.textSecondary;
|
|
351
371
|
const showArrow = menuMode ? isCursor : isCurrent;
|
|
352
372
|
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
353
|
-
showArrow ? /* @__PURE__ */ jsxs(
|
|
373
|
+
showArrow ? /* @__PURE__ */ jsxs(Text3, { color: indicatorColor, bold: true, children: [
|
|
354
374
|
"\u25B6",
|
|
355
375
|
" "
|
|
356
|
-
] }) : /* @__PURE__ */
|
|
357
|
-
/* @__PURE__ */
|
|
358
|
-
isPro && /* @__PURE__ */ jsxs(
|
|
376
|
+
] }) : /* @__PURE__ */ jsx3(Text3, { children: " " }),
|
|
377
|
+
/* @__PURE__ */ jsx3(Text3, { bold: showArrow, underline: !menuMode && isCurrent, color: labelColor, children: viewLabel }),
|
|
378
|
+
isPro && /* @__PURE__ */ jsxs(Text3, { color: COLORS.brand, bold: true, children: [
|
|
359
379
|
" ",
|
|
360
380
|
t("pro_badge")
|
|
361
381
|
] })
|
|
@@ -372,34 +392,41 @@ function Header() {
|
|
|
372
392
|
const cols = stdout?.columns ?? 80;
|
|
373
393
|
const isNarrow = cols < 95;
|
|
374
394
|
const cursorView = menuMode ? MENU_VIEWS[menuCursor] ?? null : null;
|
|
375
|
-
const logoBlock = /* @__PURE__ */
|
|
376
|
-
/* @__PURE__ */
|
|
377
|
-
/* @__PURE__ */
|
|
395
|
+
const logoBlock = /* @__PURE__ */ jsx3(Box, { flexDirection: "column", flexShrink: 0, children: LOGO_BREW.map((brew, i) => /* @__PURE__ */ jsxs(Box, { children: [
|
|
396
|
+
/* @__PURE__ */ jsx3(GradientText, { colors: GRADIENTS.gold, children: brew }),
|
|
397
|
+
/* @__PURE__ */ jsx3(GradientText, { colors: GRADIENTS.darkGold, children: LOGO_TUI[i] })
|
|
378
398
|
] }, `logo-${i}`)) });
|
|
379
399
|
const menuBorderColor = menuMode ? COLORS.brand : COLORS.lavender;
|
|
380
400
|
const menuBlock = /* @__PURE__ */ jsxs(Box, { borderStyle: "round", borderColor: menuBorderColor, paddingX: SPACING.xs, flexDirection: "column", alignSelf: isNarrow ? "flex-start" : "center", children: [
|
|
381
401
|
/* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
|
|
382
|
-
/* @__PURE__ */
|
|
383
|
-
/* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ jsx3(Box, { flexDirection: "column", children: COL1_VIEWS.map((view) => /* @__PURE__ */ jsx3(MenuItem, { view, currentView, cursorView, menuMode }, view)) }),
|
|
403
|
+
/* @__PURE__ */ jsx3(Box, { flexDirection: "column", marginLeft: SPACING.sm, children: COL2_VIEWS.map((view) => /* @__PURE__ */ jsx3(MenuItem, { view, currentView, cursorView, menuMode }, view)) })
|
|
384
404
|
] }),
|
|
385
|
-
/* @__PURE__ */
|
|
405
|
+
/* @__PURE__ */ jsx3(Box, { borderStyle: "single", borderTop: true, borderBottom: false, borderLeft: false, borderRight: false, borderColor: menuBorderColor, marginTop: SPACING.none, children: menuMode ? /* @__PURE__ */ jsxs(Text3, { color: COLORS.brand, children: [
|
|
406
|
+
t("hint_menuMode_prefix"),
|
|
407
|
+
/* @__PURE__ */ jsx3(BlinkingText, { color: COLORS.brand, children: "m" }),
|
|
408
|
+
t("hint_menuMode_suffix")
|
|
409
|
+
] }) : /* @__PURE__ */ jsxs(Text3, { color: COLORS.textSecondary, children: [
|
|
410
|
+
/* @__PURE__ */ jsx3(BlinkingText, { color: COLORS.brand, children: "M" }),
|
|
411
|
+
t("hint_menuOpen_suffix")
|
|
412
|
+
] }) })
|
|
386
413
|
] });
|
|
387
414
|
if (isNarrow) {
|
|
388
415
|
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: SPACING.xs, children: [
|
|
389
416
|
logoBlock,
|
|
390
|
-
/* @__PURE__ */
|
|
417
|
+
/* @__PURE__ */ jsx3(Box, { marginTop: SPACING.xs, children: menuBlock })
|
|
391
418
|
] });
|
|
392
419
|
}
|
|
393
420
|
return /* @__PURE__ */ jsxs(Box, { flexDirection: "row", paddingX: SPACING.xs, alignItems: "center", children: [
|
|
394
421
|
logoBlock,
|
|
395
|
-
/* @__PURE__ */
|
|
422
|
+
/* @__PURE__ */ jsx3(Box, { marginLeft: SPACING.sm, children: menuBlock })
|
|
396
423
|
] });
|
|
397
424
|
}
|
|
398
425
|
|
|
399
426
|
// src/components/layout/footer.tsx
|
|
400
|
-
import
|
|
401
|
-
import { Box as Box2, Text as
|
|
402
|
-
import { Fragment as Fragment2, jsx as
|
|
427
|
+
import React3 from "react";
|
|
428
|
+
import { Box as Box2, Text as Text4 } from "ink";
|
|
429
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
403
430
|
var VIEW_HINT_DEFS = {
|
|
404
431
|
dashboard: [["1", "hint_refresh"]],
|
|
405
432
|
installed: [["/", "hint_filter"], ["enter", "hint_info"], ["1", "hint_uninstall"], ["2", "hint_switchTab"]],
|
|
@@ -423,9 +450,9 @@ function hasNumberedActions(defs) {
|
|
|
423
450
|
}
|
|
424
451
|
function HintItem({ def }) {
|
|
425
452
|
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
426
|
-
/* @__PURE__ */
|
|
427
|
-
/* @__PURE__ */
|
|
428
|
-
/* @__PURE__ */
|
|
453
|
+
/* @__PURE__ */ jsx4(Text4, { color: COLORS.text, bold: true, children: def[0] }),
|
|
454
|
+
/* @__PURE__ */ jsx4(Text4, { color: COLORS.textSecondary, children: ":" }),
|
|
455
|
+
/* @__PURE__ */ jsx4(Text4, { color: COLORS.gold, dimColor: true, children: t(def[1]) })
|
|
429
456
|
] });
|
|
430
457
|
}
|
|
431
458
|
function Footer() {
|
|
@@ -435,40 +462,40 @@ function Footer() {
|
|
|
435
462
|
const defs = VIEW_HINT_DEFS[currentView] ?? [];
|
|
436
463
|
const showChoose = hasNumberedActions(defs) && !menuMode;
|
|
437
464
|
return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
|
|
438
|
-
showChoose && /* @__PURE__ */
|
|
465
|
+
showChoose && /* @__PURE__ */ jsx4(Box2, { paddingX: SPACING.xs, children: /* @__PURE__ */ jsx4(Text4, { color: COLORS.text, children: t("hint_chooseNumber") }) }),
|
|
439
466
|
/* @__PURE__ */ jsxs2(Box2, { borderStyle: "single", borderTop: true, borderBottom: false, borderLeft: false, borderRight: false, borderColor: COLORS.gold, paddingX: SPACING.xs, flexWrap: "wrap", children: [
|
|
440
|
-
!menuMode && defs.map((def, i) => /* @__PURE__ */ jsxs2(
|
|
441
|
-
i > 0 && /* @__PURE__ */ jsxs2(
|
|
467
|
+
!menuMode && defs.map((def, i) => /* @__PURE__ */ jsxs2(React3.Fragment, { children: [
|
|
468
|
+
i > 0 && /* @__PURE__ */ jsxs2(Text4, { color: COLORS.border, children: [
|
|
442
469
|
" ",
|
|
443
470
|
"\u2502",
|
|
444
471
|
" "
|
|
445
472
|
] }),
|
|
446
|
-
/* @__PURE__ */
|
|
473
|
+
/* @__PURE__ */ jsx4(HintItem, { def })
|
|
447
474
|
] }, `${def[0]}:${def[1]}`)),
|
|
448
|
-
!menuMode && defs.length > 0 && /* @__PURE__ */ jsxs2(
|
|
475
|
+
!menuMode && defs.length > 0 && /* @__PURE__ */ jsxs2(Text4, { color: COLORS.border, children: [
|
|
449
476
|
" ",
|
|
450
477
|
"\u2502",
|
|
451
478
|
" "
|
|
452
479
|
] }),
|
|
453
|
-
/* @__PURE__ */
|
|
454
|
-
/* @__PURE__ */
|
|
455
|
-
/* @__PURE__ */
|
|
456
|
-
/* @__PURE__ */ jsxs2(
|
|
480
|
+
/* @__PURE__ */ jsx4(Text4, { color: COLORS.text, bold: true, children: "esc" }),
|
|
481
|
+
/* @__PURE__ */ jsx4(Text4, { color: COLORS.textSecondary, children: ":" }),
|
|
482
|
+
/* @__PURE__ */ jsx4(Text4, { color: COLORS.gold, dimColor: true, children: t("hint_back") }),
|
|
483
|
+
/* @__PURE__ */ jsxs2(Text4, { color: COLORS.border, children: [
|
|
457
484
|
" ",
|
|
458
485
|
"\u2502",
|
|
459
486
|
" "
|
|
460
487
|
] }),
|
|
461
|
-
/* @__PURE__ */
|
|
462
|
-
/* @__PURE__ */
|
|
463
|
-
/* @__PURE__ */
|
|
464
|
-
/* @__PURE__ */ jsxs2(
|
|
488
|
+
/* @__PURE__ */ jsx4(Text4, { color: COLORS.text, bold: true, children: "q" }),
|
|
489
|
+
/* @__PURE__ */ jsx4(Text4, { color: COLORS.textSecondary, children: ":" }),
|
|
490
|
+
/* @__PURE__ */ jsx4(Text4, { color: COLORS.gold, dimColor: true, children: t("hint_quit") }),
|
|
491
|
+
/* @__PURE__ */ jsxs2(Text4, { color: COLORS.lavender, children: [
|
|
465
492
|
" ",
|
|
466
493
|
"\u2503",
|
|
467
494
|
" "
|
|
468
495
|
] }),
|
|
469
|
-
/* @__PURE__ */
|
|
470
|
-
/* @__PURE__ */
|
|
471
|
-
/* @__PURE__ */ jsxs2(
|
|
496
|
+
/* @__PURE__ */ jsx4(Text4, { color: COLORS.text, bold: true, children: "L" }),
|
|
497
|
+
/* @__PURE__ */ jsx4(Text4, { color: COLORS.textSecondary, children: ":" }),
|
|
498
|
+
/* @__PURE__ */ jsxs2(Text4, { color: COLORS.gold, dimColor: true, children: [
|
|
472
499
|
t("hint_lang"),
|
|
473
500
|
"(",
|
|
474
501
|
locale,
|
|
@@ -479,12 +506,12 @@ function Footer() {
|
|
|
479
506
|
}
|
|
480
507
|
|
|
481
508
|
// src/components/layout/app-layout.tsx
|
|
482
|
-
import { jsx as
|
|
509
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
483
510
|
function AppLayout({ children }) {
|
|
484
511
|
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", width: "100%", children: [
|
|
485
|
-
/* @__PURE__ */
|
|
486
|
-
/* @__PURE__ */
|
|
487
|
-
/* @__PURE__ */
|
|
512
|
+
/* @__PURE__ */ jsx5(Header, {}),
|
|
513
|
+
/* @__PURE__ */ jsx5(Box3, { flexDirection: "column", flexGrow: 1, paddingX: SPACING.sm, paddingY: SPACING.xs, children }),
|
|
514
|
+
/* @__PURE__ */ jsx5(Footer, {})
|
|
488
515
|
] });
|
|
489
516
|
}
|
|
490
517
|
|
|
@@ -710,8 +737,8 @@ async function markOnboardingComplete() {
|
|
|
710
737
|
}
|
|
711
738
|
|
|
712
739
|
// src/views/welcome.tsx
|
|
713
|
-
import { useEffect } from "react";
|
|
714
|
-
import { Box as Box4, Text as
|
|
740
|
+
import { useEffect as useEffect2 } from "react";
|
|
741
|
+
import { Box as Box4, Text as Text5 } from "ink";
|
|
715
742
|
|
|
716
743
|
// src/hooks/use-view-input.ts
|
|
717
744
|
import { useInput as useInput2 } from "ink";
|
|
@@ -722,9 +749,9 @@ function useViewInput(handler, opts) {
|
|
|
722
749
|
}
|
|
723
750
|
|
|
724
751
|
// src/views/welcome.tsx
|
|
725
|
-
import { jsx as
|
|
752
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
726
753
|
function WelcomeView({ onContinue }) {
|
|
727
|
-
|
|
754
|
+
useEffect2(() => {
|
|
728
755
|
return () => {
|
|
729
756
|
};
|
|
730
757
|
}, []);
|
|
@@ -734,64 +761,64 @@ function WelcomeView({ onContinue }) {
|
|
|
734
761
|
}
|
|
735
762
|
});
|
|
736
763
|
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", paddingY: SPACING.md, paddingX: SPACING.lg, children: [
|
|
737
|
-
/* @__PURE__ */
|
|
738
|
-
/* @__PURE__ */
|
|
764
|
+
/* @__PURE__ */ jsx6(Box4, { children: /* @__PURE__ */ jsx6(GradientText, { colors: GRADIENTS.gold, bold: true, children: t("welcome_title") }) }),
|
|
765
|
+
/* @__PURE__ */ jsx6(Box4, { marginTop: SPACING.sm, children: /* @__PURE__ */ jsx6(Text5, { color: COLORS.text, children: t("welcome_intro") }) }),
|
|
739
766
|
/* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: SPACING.sm, children: [
|
|
740
|
-
/* @__PURE__ */
|
|
767
|
+
/* @__PURE__ */ jsx6(Text5, { color: COLORS.muted, children: t("welcome_keysHeader") }),
|
|
741
768
|
/* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", paddingLeft: SPACING.sm, marginTop: SPACING.xs, children: [
|
|
742
|
-
/* @__PURE__ */ jsxs4(
|
|
743
|
-
/* @__PURE__ */
|
|
769
|
+
/* @__PURE__ */ jsxs4(Text5, { children: [
|
|
770
|
+
/* @__PURE__ */ jsx6(Text5, { color: COLORS.gold, bold: true, children: "m" }),
|
|
744
771
|
" ",
|
|
745
772
|
t("welcome_keyMenu")
|
|
746
773
|
] }),
|
|
747
|
-
/* @__PURE__ */ jsxs4(
|
|
748
|
-
/* @__PURE__ */
|
|
774
|
+
/* @__PURE__ */ jsxs4(Text5, { children: [
|
|
775
|
+
/* @__PURE__ */ jsx6(Text5, { color: COLORS.gold, bold: true, children: "\u2191 \u2193" }),
|
|
749
776
|
" ",
|
|
750
777
|
t("welcome_keyMove")
|
|
751
778
|
] }),
|
|
752
|
-
/* @__PURE__ */ jsxs4(
|
|
753
|
-
/* @__PURE__ */
|
|
779
|
+
/* @__PURE__ */ jsxs4(Text5, { children: [
|
|
780
|
+
/* @__PURE__ */ jsx6(Text5, { color: COLORS.gold, bold: true, children: "1-9" }),
|
|
754
781
|
" ",
|
|
755
782
|
t("welcome_keyAction")
|
|
756
783
|
] }),
|
|
757
|
-
/* @__PURE__ */ jsxs4(
|
|
758
|
-
/* @__PURE__ */
|
|
784
|
+
/* @__PURE__ */ jsxs4(Text5, { children: [
|
|
785
|
+
/* @__PURE__ */ jsx6(Text5, { color: COLORS.gold, bold: true, children: "Enter" }),
|
|
759
786
|
" ",
|
|
760
787
|
t("welcome_keySelect")
|
|
761
788
|
] }),
|
|
762
|
-
/* @__PURE__ */ jsxs4(
|
|
763
|
-
/* @__PURE__ */
|
|
789
|
+
/* @__PURE__ */ jsxs4(Text5, { children: [
|
|
790
|
+
/* @__PURE__ */ jsx6(Text5, { color: COLORS.gold, bold: true, children: "S" }),
|
|
764
791
|
" ",
|
|
765
792
|
t("welcome_keySearch")
|
|
766
793
|
] }),
|
|
767
|
-
/* @__PURE__ */ jsxs4(
|
|
768
|
-
/* @__PURE__ */
|
|
794
|
+
/* @__PURE__ */ jsxs4(Text5, { children: [
|
|
795
|
+
/* @__PURE__ */ jsx6(Text5, { color: COLORS.gold, bold: true, children: "Esc" }),
|
|
769
796
|
" ",
|
|
770
797
|
t("welcome_keyBack")
|
|
771
798
|
] }),
|
|
772
|
-
/* @__PURE__ */ jsxs4(
|
|
773
|
-
/* @__PURE__ */
|
|
799
|
+
/* @__PURE__ */ jsxs4(Text5, { children: [
|
|
800
|
+
/* @__PURE__ */ jsx6(Text5, { color: COLORS.gold, bold: true, children: "L" }),
|
|
774
801
|
" ",
|
|
775
802
|
t("welcome_keyLocale")
|
|
776
803
|
] }),
|
|
777
|
-
/* @__PURE__ */ jsxs4(
|
|
778
|
-
/* @__PURE__ */
|
|
804
|
+
/* @__PURE__ */ jsxs4(Text5, { children: [
|
|
805
|
+
/* @__PURE__ */ jsx6(Text5, { color: COLORS.gold, bold: true, children: "q" }),
|
|
779
806
|
" ",
|
|
780
807
|
t("welcome_keyQuit")
|
|
781
808
|
] })
|
|
782
809
|
] })
|
|
783
810
|
] }),
|
|
784
811
|
/* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: SPACING.sm, children: [
|
|
785
|
-
/* @__PURE__ */
|
|
786
|
-
/* @__PURE__ */
|
|
812
|
+
/* @__PURE__ */ jsx6(Text5, { color: COLORS.muted, children: t("welcome_proHeader") }),
|
|
813
|
+
/* @__PURE__ */ jsx6(Box4, { paddingLeft: SPACING.sm, children: /* @__PURE__ */ jsx6(Text5, { color: COLORS.textSecondary, children: t("welcome_proIntro") }) })
|
|
787
814
|
] }),
|
|
788
|
-
/* @__PURE__ */
|
|
815
|
+
/* @__PURE__ */ jsx6(Box4, { marginTop: SPACING.md, children: /* @__PURE__ */ jsx6(Text5, { color: COLORS.success, bold: true, children: t("welcome_continueHint") }) })
|
|
789
816
|
] });
|
|
790
817
|
}
|
|
791
818
|
|
|
792
819
|
// src/components/common/upgrade-prompt.tsx
|
|
793
|
-
import { Box as Box5, Text as
|
|
794
|
-
import { jsx as
|
|
820
|
+
import { Box as Box5, Text as Text6 } from "ink";
|
|
821
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
795
822
|
var FEATURE_KEYS = {
|
|
796
823
|
profiles: { title: "upgrade_profiles", desc: "upgrade_profilesDesc" },
|
|
797
824
|
"smart-cleanup": { title: "upgrade_cleanup", desc: "upgrade_cleanupDesc" },
|
|
@@ -811,7 +838,7 @@ function UpgradePrompt({ viewId }) {
|
|
|
811
838
|
const pricingKey = team ? "upgrade_teamPricing" : "upgrade_pricing";
|
|
812
839
|
const buyUrlKey = team ? "upgrade_buyUrlTeam" : "upgrade_buyUrl";
|
|
813
840
|
const labelKey = team ? "upgrade_teamLabel" : "upgrade_proLabel";
|
|
814
|
-
return /* @__PURE__ */
|
|
841
|
+
return /* @__PURE__ */ jsx7(Box5, { flexDirection: "column", alignItems: "center", paddingY: SPACING.sm, children: /* @__PURE__ */ jsxs5(
|
|
815
842
|
Box5,
|
|
816
843
|
{
|
|
817
844
|
borderStyle: "double",
|
|
@@ -822,30 +849,30 @@ function UpgradePrompt({ viewId }) {
|
|
|
822
849
|
alignItems: "center",
|
|
823
850
|
width: "80%",
|
|
824
851
|
children: [
|
|
825
|
-
/* @__PURE__ */ jsxs5(
|
|
852
|
+
/* @__PURE__ */ jsxs5(Text6, { bold: true, color: COLORS.brand, children: [
|
|
826
853
|
"\u2B50",
|
|
827
854
|
" ",
|
|
828
855
|
t(headerKey, { title })
|
|
829
856
|
] }),
|
|
830
|
-
/* @__PURE__ */
|
|
831
|
-
/* @__PURE__ */
|
|
832
|
-
/* @__PURE__ */
|
|
857
|
+
/* @__PURE__ */ jsx7(Text6, { children: " " }),
|
|
858
|
+
/* @__PURE__ */ jsx7(Text6, { color: COLORS.text, wrap: "wrap", children: t(keys.desc) }),
|
|
859
|
+
/* @__PURE__ */ jsx7(Text6, { children: " " }),
|
|
833
860
|
/* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", alignItems: "center", children: [
|
|
834
|
-
/* @__PURE__ */
|
|
835
|
-
/* @__PURE__ */
|
|
836
|
-
/* @__PURE__ */
|
|
837
|
-
/* @__PURE__ */ jsxs5(
|
|
861
|
+
/* @__PURE__ */ jsx7(Text6, { color: COLORS.info, bold: true, children: t(pricingKey) }),
|
|
862
|
+
/* @__PURE__ */ jsx7(Text6, { children: " " }),
|
|
863
|
+
/* @__PURE__ */ jsx7(Text6, { color: COLORS.muted, children: t("upgrade_buyAt") }),
|
|
864
|
+
/* @__PURE__ */ jsxs5(Text6, { color: COLORS.sky, bold: true, children: [
|
|
838
865
|
" ",
|
|
839
866
|
t(buyUrlKey)
|
|
840
867
|
] }),
|
|
841
|
-
/* @__PURE__ */
|
|
842
|
-
/* @__PURE__ */
|
|
843
|
-
/* @__PURE__ */ jsxs5(
|
|
868
|
+
/* @__PURE__ */ jsx7(Text6, { children: " " }),
|
|
869
|
+
/* @__PURE__ */ jsx7(Text6, { color: COLORS.muted, children: t("upgrade_activateWith") }),
|
|
870
|
+
/* @__PURE__ */ jsxs5(Text6, { color: COLORS.success, bold: true, children: [
|
|
844
871
|
" ",
|
|
845
872
|
t("upgrade_activateCmd")
|
|
846
873
|
] }),
|
|
847
|
-
/* @__PURE__ */
|
|
848
|
-
/* @__PURE__ */
|
|
874
|
+
/* @__PURE__ */ jsx7(Text6, { children: " " }),
|
|
875
|
+
/* @__PURE__ */ jsx7(Text6, { color: COLORS.brand, children: t(labelKey) })
|
|
849
876
|
] })
|
|
850
877
|
]
|
|
851
878
|
}
|
|
@@ -853,8 +880,8 @@ function UpgradePrompt({ viewId }) {
|
|
|
853
880
|
}
|
|
854
881
|
|
|
855
882
|
// src/views/dashboard.tsx
|
|
856
|
-
import { useEffect as
|
|
857
|
-
import { Box as Box9, Text as
|
|
883
|
+
import { useEffect as useEffect3, useMemo as useMemo2 } from "react";
|
|
884
|
+
import { Box as Box9, Text as Text12, useStdout as useStdout3 } from "ink";
|
|
858
885
|
|
|
859
886
|
// src/stores/brew-store.ts
|
|
860
887
|
import { create as create4 } from "zustand";
|
|
@@ -1820,8 +1847,8 @@ var useComplianceStore = create8((set, get) => ({
|
|
|
1820
1847
|
}));
|
|
1821
1848
|
|
|
1822
1849
|
// src/components/common/stat-card.tsx
|
|
1823
|
-
import { Box as Box6, Text as
|
|
1824
|
-
import { jsx as
|
|
1850
|
+
import { Box as Box6, Text as Text7, useStdout as useStdout2 } from "ink";
|
|
1851
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1825
1852
|
function StatCard({ label, value, color = COLORS.white }) {
|
|
1826
1853
|
const { stdout } = useStdout2();
|
|
1827
1854
|
const cols = stdout?.columns ?? 80;
|
|
@@ -1837,35 +1864,35 @@ function StatCard({ label, value, color = COLORS.white }) {
|
|
|
1837
1864
|
alignItems: "center",
|
|
1838
1865
|
minWidth: minW,
|
|
1839
1866
|
children: [
|
|
1840
|
-
/* @__PURE__ */
|
|
1841
|
-
/* @__PURE__ */
|
|
1867
|
+
/* @__PURE__ */ jsx8(Text7, { bold: true, color, children: value }),
|
|
1868
|
+
/* @__PURE__ */ jsx8(Text7, { color: COLORS.muted, children: label })
|
|
1842
1869
|
]
|
|
1843
1870
|
}
|
|
1844
1871
|
);
|
|
1845
1872
|
}
|
|
1846
1873
|
|
|
1847
1874
|
// src/components/common/loading.tsx
|
|
1848
|
-
import { Box as Box7, Text as
|
|
1875
|
+
import { Box as Box7, Text as Text8 } from "ink";
|
|
1849
1876
|
import { Spinner } from "@inkjs/ui";
|
|
1850
|
-
import { jsx as
|
|
1877
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1851
1878
|
function Loading({ message }) {
|
|
1852
1879
|
useLocaleStore((s) => s.locale);
|
|
1853
|
-
return /* @__PURE__ */
|
|
1880
|
+
return /* @__PURE__ */ jsx9(Box7, { paddingY: SPACING.xs, children: /* @__PURE__ */ jsx9(Spinner, { label: message ?? t("loading_default") }) });
|
|
1854
1881
|
}
|
|
1855
1882
|
function ErrorMessage({ message }) {
|
|
1856
1883
|
useLocaleStore((s) => s.locale);
|
|
1857
1884
|
return /* @__PURE__ */ jsxs7(Box7, { paddingY: SPACING.xs, children: [
|
|
1858
|
-
/* @__PURE__ */ jsxs7(
|
|
1885
|
+
/* @__PURE__ */ jsxs7(Text8, { color: COLORS.error, bold: true, children: [
|
|
1859
1886
|
"\u2718",
|
|
1860
1887
|
" ",
|
|
1861
1888
|
t("error_prefix")
|
|
1862
1889
|
] }),
|
|
1863
|
-
/* @__PURE__ */
|
|
1890
|
+
/* @__PURE__ */ jsx9(Text8, { color: COLORS.error, children: message })
|
|
1864
1891
|
] });
|
|
1865
1892
|
}
|
|
1866
1893
|
|
|
1867
1894
|
// src/components/common/status-badge.tsx
|
|
1868
|
-
import { Text as
|
|
1895
|
+
import { Text as Text9 } from "ink";
|
|
1869
1896
|
import { jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1870
1897
|
var BADGE_STYLES = {
|
|
1871
1898
|
success: { icon: "\u2714", color: COLORS.success },
|
|
@@ -1876,7 +1903,7 @@ var BADGE_STYLES = {
|
|
|
1876
1903
|
};
|
|
1877
1904
|
function StatusBadge({ label, variant }) {
|
|
1878
1905
|
const { icon, color } = BADGE_STYLES[variant];
|
|
1879
|
-
return /* @__PURE__ */ jsxs8(
|
|
1906
|
+
return /* @__PURE__ */ jsxs8(Text9, { color, children: [
|
|
1880
1907
|
icon,
|
|
1881
1908
|
" ",
|
|
1882
1909
|
label
|
|
@@ -1884,16 +1911,16 @@ function StatusBadge({ label, variant }) {
|
|
|
1884
1911
|
}
|
|
1885
1912
|
|
|
1886
1913
|
// src/components/common/section-header.tsx
|
|
1887
|
-
import { Box as Box8, Text as
|
|
1888
|
-
import { jsx as
|
|
1914
|
+
import { Box as Box8, Text as Text10 } from "ink";
|
|
1915
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1889
1916
|
function SectionHeader({ emoji, title, color = COLORS.gold, gradient, count }) {
|
|
1890
1917
|
return /* @__PURE__ */ jsxs9(Box8, { gap: SPACING.xs, children: [
|
|
1891
|
-
/* @__PURE__ */ jsxs9(
|
|
1918
|
+
/* @__PURE__ */ jsxs9(Text10, { children: [
|
|
1892
1919
|
emoji,
|
|
1893
1920
|
" "
|
|
1894
1921
|
] }),
|
|
1895
|
-
gradient ? /* @__PURE__ */
|
|
1896
|
-
count !== void 0 && /* @__PURE__ */ jsxs9(
|
|
1922
|
+
gradient ? /* @__PURE__ */ jsx10(GradientText, { colors: gradient, bold: true, children: title }) : /* @__PURE__ */ jsx10(Text10, { bold: true, color, children: title }),
|
|
1923
|
+
count !== void 0 && /* @__PURE__ */ jsxs9(Text10, { color: COLORS.textSecondary, children: [
|
|
1897
1924
|
"(",
|
|
1898
1925
|
count,
|
|
1899
1926
|
")"
|
|
@@ -1902,23 +1929,23 @@ function SectionHeader({ emoji, title, color = COLORS.gold, gradient, count }) {
|
|
|
1902
1929
|
}
|
|
1903
1930
|
|
|
1904
1931
|
// src/components/common/version-arrow.tsx
|
|
1905
|
-
import { Text as
|
|
1906
|
-
import { Fragment as Fragment3, jsx as
|
|
1932
|
+
import { Text as Text11 } from "ink";
|
|
1933
|
+
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1907
1934
|
function VersionArrow({ current, latest }) {
|
|
1908
1935
|
return /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
1909
|
-
/* @__PURE__ */ jsxs10(
|
|
1936
|
+
/* @__PURE__ */ jsxs10(Text11, { color: COLORS.muted, children: [
|
|
1910
1937
|
t("version_installed"),
|
|
1911
1938
|
" "
|
|
1912
1939
|
] }),
|
|
1913
|
-
/* @__PURE__ */
|
|
1914
|
-
/* @__PURE__ */
|
|
1915
|
-
/* @__PURE__ */
|
|
1916
|
-
/* @__PURE__ */ jsxs10(
|
|
1940
|
+
/* @__PURE__ */ jsx11(Text11, { color: COLORS.error, children: current }),
|
|
1941
|
+
/* @__PURE__ */ jsx11(Text11, { color: COLORS.warning, children: " \u2500\u2500 " }),
|
|
1942
|
+
/* @__PURE__ */ jsx11(Text11, { color: COLORS.gold, children: "\u25B6" }),
|
|
1943
|
+
/* @__PURE__ */ jsxs10(Text11, { color: COLORS.muted, children: [
|
|
1917
1944
|
" ",
|
|
1918
1945
|
t("version_available"),
|
|
1919
1946
|
" "
|
|
1920
1947
|
] }),
|
|
1921
|
-
/* @__PURE__ */
|
|
1948
|
+
/* @__PURE__ */ jsx11(Text11, { color: COLORS.teal, children: latest })
|
|
1922
1949
|
] });
|
|
1923
1950
|
}
|
|
1924
1951
|
|
|
@@ -1950,7 +1977,7 @@ function truncate(str, maxLen) {
|
|
|
1950
1977
|
}
|
|
1951
1978
|
|
|
1952
1979
|
// src/views/dashboard.tsx
|
|
1953
|
-
import { jsx as
|
|
1980
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1954
1981
|
function ProStatusPanel() {
|
|
1955
1982
|
const security = useSecurityStore((s) => s.summary);
|
|
1956
1983
|
const drift = useBrewfileStore((s) => s.drift);
|
|
@@ -1963,28 +1990,28 @@ function ProStatusPanel() {
|
|
|
1963
1990
|
const syncAgo = lastSync ? formatRelativeTime(new Date(lastSync).getTime() / 1e3) : null;
|
|
1964
1991
|
const violationCount = complianceReport ? complianceReport.violations.length : null;
|
|
1965
1992
|
return /* @__PURE__ */ jsxs11(Box9, { flexDirection: "column", borderStyle: "round", borderColor: COLORS.purple, paddingX: SPACING.sm, paddingY: SPACING.none, marginTop: SPACING.xs, children: [
|
|
1966
|
-
/* @__PURE__ */
|
|
1993
|
+
/* @__PURE__ */ jsx12(Text12, { bold: true, color: COLORS.purple, children: t("dashboard_pro_status") }),
|
|
1967
1994
|
/* @__PURE__ */ jsxs11(Box9, { gap: SPACING.xs, children: [
|
|
1968
|
-
/* @__PURE__ */
|
|
1969
|
-
cveCount === null ? /* @__PURE__ */
|
|
1995
|
+
/* @__PURE__ */ jsx12(Text12, { color: COLORS.muted, children: t("dashboard_security") }),
|
|
1996
|
+
cveCount === null ? /* @__PURE__ */ jsx12(Text12, { color: COLORS.muted, children: "\u2014" }) : cveCount === 0 ? /* @__PURE__ */ jsx12(Text12, { color: COLORS.success, children: t("dashboard_no_cves") }) : /* @__PURE__ */ jsxs11(Text12, { color: COLORS.error, children: [
|
|
1970
1997
|
t("dashboard_cves", { count: String(cveCount) }),
|
|
1971
1998
|
criticalCount && criticalCount > 0 ? ` (${criticalCount} critical)` : ""
|
|
1972
1999
|
] })
|
|
1973
2000
|
] }),
|
|
1974
2001
|
/* @__PURE__ */ jsxs11(Box9, { gap: SPACING.xs, children: [
|
|
1975
|
-
/* @__PURE__ */
|
|
1976
|
-
driftScore === null ? /* @__PURE__ */
|
|
2002
|
+
/* @__PURE__ */ jsx12(Text12, { color: COLORS.muted, children: t("dashboard_brewfile") }),
|
|
2003
|
+
driftScore === null ? /* @__PURE__ */ jsx12(Text12, { color: COLORS.muted, children: "\u2014" }) : /* @__PURE__ */ jsxs11(Text12, { color: driftScore >= 80 ? COLORS.success : COLORS.warning, children: [
|
|
1977
2004
|
driftScore,
|
|
1978
2005
|
"%"
|
|
1979
2006
|
] })
|
|
1980
2007
|
] }),
|
|
1981
2008
|
/* @__PURE__ */ jsxs11(Box9, { gap: SPACING.xs, children: [
|
|
1982
|
-
/* @__PURE__ */
|
|
1983
|
-
syncAgo === null ? /* @__PURE__ */
|
|
2009
|
+
/* @__PURE__ */ jsx12(Text12, { color: COLORS.muted, children: t("dashboard_sync") }),
|
|
2010
|
+
syncAgo === null ? /* @__PURE__ */ jsx12(Text12, { color: COLORS.muted, children: t("dashboard_sync_never") }) : /* @__PURE__ */ jsx12(Text12, { color: COLORS.info, children: t("dashboard_sync_ago", { time: syncAgo }) })
|
|
1984
2011
|
] }),
|
|
1985
2012
|
/* @__PURE__ */ jsxs11(Box9, { gap: SPACING.xs, children: [
|
|
1986
|
-
/* @__PURE__ */
|
|
1987
|
-
violationCount === null ? /* @__PURE__ */
|
|
2013
|
+
/* @__PURE__ */ jsx12(Text12, { color: COLORS.muted, children: t("dashboard_compliance") }),
|
|
2014
|
+
violationCount === null ? /* @__PURE__ */ jsx12(Text12, { color: COLORS.muted, children: "\u2014" }) : violationCount === 0 ? /* @__PURE__ */ jsx12(Text12, { color: COLORS.success, children: t("dashboard_compliance_ok") }) : /* @__PURE__ */ jsx12(Text12, { color: COLORS.warning, children: t("dashboard_compliance_violations", { count: String(violationCount) }) })
|
|
1988
2015
|
] })
|
|
1989
2016
|
] });
|
|
1990
2017
|
}
|
|
@@ -2001,7 +2028,7 @@ function DashboardView() {
|
|
|
2001
2028
|
const isPro = useLicenseStore((s) => s.isPro);
|
|
2002
2029
|
const { stdout } = useStdout3();
|
|
2003
2030
|
const columns = stdout?.columns ?? 80;
|
|
2004
|
-
|
|
2031
|
+
useEffect3(() => {
|
|
2005
2032
|
fetchAll();
|
|
2006
2033
|
}, []);
|
|
2007
2034
|
useViewInput((input) => {
|
|
@@ -2026,11 +2053,11 @@ function DashboardView() {
|
|
|
2026
2053
|
const outdatedValue = loading.outdated ? "..." : errors.outdated ? t("dashboard_statError") : outdated.formulae.length + outdated.casks.length;
|
|
2027
2054
|
const servicesValue = loading.services ? "..." : errors.services ? t("dashboard_statError") : `${runningServices}/${services.length}`;
|
|
2028
2055
|
const lastUpdated = lastFetchedAt.installed ? formatRelativeTime(lastFetchedAt.installed / 1e3) : null;
|
|
2029
|
-
if (loading.installed) return /* @__PURE__ */
|
|
2056
|
+
if (loading.installed) return /* @__PURE__ */ jsx12(Loading, { message: t("loading_fetchingBrew") });
|
|
2030
2057
|
if (errors.installed) {
|
|
2031
2058
|
return /* @__PURE__ */ jsxs11(Box9, { flexDirection: "column", children: [
|
|
2032
|
-
/* @__PURE__ */
|
|
2033
|
-
/* @__PURE__ */
|
|
2059
|
+
/* @__PURE__ */ jsx12(ErrorMessage, { message: errors.installed }),
|
|
2060
|
+
/* @__PURE__ */ jsx12(Box9, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs11(Text12, { color: COLORS.textSecondary, children: [
|
|
2034
2061
|
"r:",
|
|
2035
2062
|
t("hint_refresh")
|
|
2036
2063
|
] }) })
|
|
@@ -2038,11 +2065,11 @@ function DashboardView() {
|
|
|
2038
2065
|
}
|
|
2039
2066
|
const isNarrow = columns < 60;
|
|
2040
2067
|
return /* @__PURE__ */ jsxs11(Box9, { flexDirection: "column", gap: SPACING.sm, children: [
|
|
2041
|
-
/* @__PURE__ */
|
|
2068
|
+
/* @__PURE__ */ jsx12(SectionHeader, { emoji: "\u{1F4CA}", title: t("dashboard_overview"), gradient: GRADIENTS.gold }),
|
|
2042
2069
|
/* @__PURE__ */ jsxs11(Box9, { gap: SPACING.xs, flexWrap: "wrap", flexDirection: isNarrow ? "column" : "row", children: [
|
|
2043
|
-
/* @__PURE__ */
|
|
2044
|
-
/* @__PURE__ */
|
|
2045
|
-
/* @__PURE__ */
|
|
2070
|
+
/* @__PURE__ */ jsx12(StatCard, { label: t("dashboard_formulae"), value: formulae.length, color: COLORS.info }),
|
|
2071
|
+
/* @__PURE__ */ jsx12(StatCard, { label: t("dashboard_casks"), value: casks.length, color: COLORS.purple }),
|
|
2072
|
+
/* @__PURE__ */ jsx12(
|
|
2046
2073
|
StatCard,
|
|
2047
2074
|
{
|
|
2048
2075
|
label: t("dashboard_outdated"),
|
|
@@ -2050,7 +2077,7 @@ function DashboardView() {
|
|
|
2050
2077
|
color: typeof outdatedValue === "number" && outdatedValue > 0 ? COLORS.warning : errors.outdated ? COLORS.error : COLORS.success
|
|
2051
2078
|
}
|
|
2052
2079
|
),
|
|
2053
|
-
/* @__PURE__ */
|
|
2080
|
+
/* @__PURE__ */ jsx12(
|
|
2054
2081
|
StatCard,
|
|
2055
2082
|
{
|
|
2056
2083
|
label: t("dashboard_services"),
|
|
@@ -2059,66 +2086,66 @@ function DashboardView() {
|
|
|
2059
2086
|
}
|
|
2060
2087
|
)
|
|
2061
2088
|
] }),
|
|
2062
|
-
lastUpdated && /* @__PURE__ */
|
|
2089
|
+
lastUpdated && /* @__PURE__ */ jsx12(Text12, { color: COLORS.muted, children: t("dashboard_lastUpdated", { time: lastUpdated }) }),
|
|
2063
2090
|
partialErrors.length > 0 && /* @__PURE__ */ jsxs11(Box9, { flexDirection: "column", borderStyle: "round", borderColor: COLORS.warning, paddingX: SPACING.sm, paddingY: SPACING.none, children: [
|
|
2064
|
-
/* @__PURE__ */
|
|
2065
|
-
partialErrors.map((item) => /* @__PURE__ */ jsxs11(
|
|
2091
|
+
/* @__PURE__ */ jsx12(Text12, { color: COLORS.warning, bold: true, children: t("dashboard_partialData") }),
|
|
2092
|
+
partialErrors.map((item) => /* @__PURE__ */ jsxs11(Text12, { color: COLORS.muted, children: [
|
|
2066
2093
|
item.label,
|
|
2067
2094
|
": ",
|
|
2068
2095
|
item.message
|
|
2069
2096
|
] }, item.label))
|
|
2070
2097
|
] }),
|
|
2071
2098
|
config && !errors.config && /* @__PURE__ */ jsxs11(Box9, { flexDirection: "column", children: [
|
|
2072
|
-
/* @__PURE__ */
|
|
2099
|
+
/* @__PURE__ */ jsx12(SectionHeader, { emoji: "\u2139\uFE0F", title: t("dashboard_systemInfo"), gradient: [COLORS.text, COLORS.muted] }),
|
|
2073
2100
|
/* @__PURE__ */ jsxs11(Box9, { borderStyle: "round", borderColor: COLORS.blue, paddingX: SPACING.sm, paddingY: SPACING.none, flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
2074
|
-
/* @__PURE__ */ jsxs11(
|
|
2075
|
-
/* @__PURE__ */
|
|
2101
|
+
/* @__PURE__ */ jsxs11(Text12, { children: [
|
|
2102
|
+
/* @__PURE__ */ jsx12(Text12, { color: COLORS.muted, children: t("dashboard_homebrew") }),
|
|
2076
2103
|
" ",
|
|
2077
2104
|
config.HOMEBREW_VERSION
|
|
2078
2105
|
] }),
|
|
2079
|
-
/* @__PURE__ */ jsxs11(
|
|
2080
|
-
/* @__PURE__ */
|
|
2106
|
+
/* @__PURE__ */ jsxs11(Text12, { children: [
|
|
2107
|
+
/* @__PURE__ */ jsx12(Text12, { color: COLORS.muted, children: t("dashboard_prefix") }),
|
|
2081
2108
|
" ",
|
|
2082
2109
|
config.HOMEBREW_PREFIX
|
|
2083
2110
|
] }),
|
|
2084
|
-
/* @__PURE__ */ jsxs11(
|
|
2085
|
-
/* @__PURE__ */
|
|
2111
|
+
/* @__PURE__ */ jsxs11(Text12, { children: [
|
|
2112
|
+
/* @__PURE__ */ jsx12(Text12, { color: COLORS.muted, children: t("dashboard_updated") }),
|
|
2086
2113
|
" ",
|
|
2087
2114
|
config.coreUpdated
|
|
2088
2115
|
] })
|
|
2089
2116
|
] })
|
|
2090
2117
|
] }),
|
|
2091
2118
|
!errors.outdated && outdated.formulae.length > 0 && /* @__PURE__ */ jsxs11(Box9, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
2092
|
-
/* @__PURE__ */
|
|
2119
|
+
/* @__PURE__ */ jsx12(SectionHeader, { emoji: "\u{1F4E6}", title: t("dashboard_outdatedPackages"), gradient: GRADIENTS.fire }),
|
|
2093
2120
|
/* @__PURE__ */ jsxs11(Box9, { paddingLeft: SPACING.sm, flexDirection: "column", children: [
|
|
2094
2121
|
outdated.formulae.slice(0, 10).map((pkg) => /* @__PURE__ */ jsxs11(Box9, { gap: SPACING.xs, children: [
|
|
2095
|
-
/* @__PURE__ */
|
|
2096
|
-
/* @__PURE__ */
|
|
2122
|
+
/* @__PURE__ */ jsx12(Text12, { color: COLORS.text, children: pkg.name }),
|
|
2123
|
+
/* @__PURE__ */ jsx12(VersionArrow, { current: pkg.installed_versions[0] ?? "", latest: pkg.current_version })
|
|
2097
2124
|
] }, pkg.name)),
|
|
2098
|
-
outdated.formulae.length > 10 && /* @__PURE__ */
|
|
2125
|
+
outdated.formulae.length > 10 && /* @__PURE__ */ jsx12(Text12, { color: COLORS.textSecondary, italic: true, children: t("common_andMore", { count: outdated.formulae.length - 10 }) })
|
|
2099
2126
|
] })
|
|
2100
2127
|
] }),
|
|
2101
2128
|
!errors.services && errorServices > 0 && /* @__PURE__ */ jsxs11(Box9, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
2102
|
-
/* @__PURE__ */
|
|
2103
|
-
/* @__PURE__ */
|
|
2104
|
-
/* @__PURE__ */
|
|
2105
|
-
/* @__PURE__ */
|
|
2106
|
-
s.exit_code != null && /* @__PURE__ */
|
|
2129
|
+
/* @__PURE__ */ jsx12(SectionHeader, { emoji: "\u26A0\uFE0F", title: t("dashboard_serviceErrors"), color: COLORS.error }),
|
|
2130
|
+
/* @__PURE__ */ jsx12(Box9, { paddingLeft: SPACING.sm, flexDirection: "column", children: errorServiceList.map((s) => /* @__PURE__ */ jsxs11(Box9, { gap: SPACING.xs, children: [
|
|
2131
|
+
/* @__PURE__ */ jsx12(StatusBadge, { label: t("badge_error"), variant: "error" }),
|
|
2132
|
+
/* @__PURE__ */ jsx12(Text12, { children: s.name }),
|
|
2133
|
+
s.exit_code != null && /* @__PURE__ */ jsx12(Text12, { color: COLORS.muted, children: t("common_exit", { code: s.exit_code }) })
|
|
2107
2134
|
] }, s.name)) })
|
|
2108
2135
|
] }),
|
|
2109
|
-
isPro() && /* @__PURE__ */
|
|
2136
|
+
isPro() && /* @__PURE__ */ jsx12(ProStatusPanel, {})
|
|
2110
2137
|
] });
|
|
2111
2138
|
}
|
|
2112
2139
|
|
|
2113
2140
|
// src/views/installed.tsx
|
|
2114
|
-
import { useState as
|
|
2115
|
-
import { Box as Box15, Text as
|
|
2141
|
+
import { useState as useState6, useMemo as useMemo3, useEffect as useEffect9, useRef as useRef2 } from "react";
|
|
2142
|
+
import { Box as Box15, Text as Text18 } from "ink";
|
|
2116
2143
|
|
|
2117
2144
|
// src/hooks/use-debounce.ts
|
|
2118
|
-
import { useState, useEffect as
|
|
2145
|
+
import { useState as useState2, useEffect as useEffect4 } from "react";
|
|
2119
2146
|
function useDebounce(value, delayMs) {
|
|
2120
|
-
const [debounced, setDebounced] =
|
|
2121
|
-
|
|
2147
|
+
const [debounced, setDebounced] = useState2(value);
|
|
2148
|
+
useEffect4(() => {
|
|
2122
2149
|
const timer = setTimeout(() => setDebounced(value), delayMs);
|
|
2123
2150
|
return () => clearTimeout(timer);
|
|
2124
2151
|
}, [value, delayMs]);
|
|
@@ -2126,7 +2153,7 @@ function useDebounce(value, delayMs) {
|
|
|
2126
2153
|
}
|
|
2127
2154
|
|
|
2128
2155
|
// src/hooks/use-brew-stream.ts
|
|
2129
|
-
import { useState as
|
|
2156
|
+
import { useState as useState3, useCallback, useRef, useEffect as useEffect5 } from "react";
|
|
2130
2157
|
var MAX_LINES = 100;
|
|
2131
2158
|
async function logToHistory(args, success, error) {
|
|
2132
2159
|
const detected = detectAction(args);
|
|
@@ -2139,13 +2166,13 @@ async function logToHistory(args, success, error) {
|
|
|
2139
2166
|
}
|
|
2140
2167
|
}
|
|
2141
2168
|
function useBrewStream() {
|
|
2142
|
-
const [lines, setLines] =
|
|
2143
|
-
const [isRunning, setIsRunning] =
|
|
2144
|
-
const [error, setError2] =
|
|
2169
|
+
const [lines, setLines] = useState3([]);
|
|
2170
|
+
const [isRunning, setIsRunning] = useState3(false);
|
|
2171
|
+
const [error, setError2] = useState3(null);
|
|
2145
2172
|
const cancelRef = useRef(false);
|
|
2146
2173
|
const generatorRef = useRef(null);
|
|
2147
2174
|
const mountedRef = useRef(true);
|
|
2148
|
-
|
|
2175
|
+
useEffect5(() => {
|
|
2149
2176
|
mountedRef.current = true;
|
|
2150
2177
|
return () => {
|
|
2151
2178
|
mountedRef.current = false;
|
|
@@ -2203,35 +2230,35 @@ function useBrewStream() {
|
|
|
2203
2230
|
}
|
|
2204
2231
|
|
|
2205
2232
|
// src/components/common/search-input.tsx
|
|
2206
|
-
import { Box as Box10, Text as
|
|
2233
|
+
import { Box as Box10, Text as Text13 } from "ink";
|
|
2207
2234
|
import { TextInput } from "@inkjs/ui";
|
|
2208
|
-
import { jsx as
|
|
2235
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2209
2236
|
function SearchInput({ defaultValue, onChange, placeholder, isActive = true }) {
|
|
2210
2237
|
const resolvedPlaceholder = placeholder ?? t("searchInput_placeholder");
|
|
2211
2238
|
return /* @__PURE__ */ jsxs12(Box10, { children: [
|
|
2212
|
-
/* @__PURE__ */ jsxs12(
|
|
2239
|
+
/* @__PURE__ */ jsxs12(Text13, { color: COLORS.gold, children: [
|
|
2213
2240
|
"\u{1F50D}",
|
|
2214
2241
|
" "
|
|
2215
2242
|
] }),
|
|
2216
|
-
isActive ? /* @__PURE__ */
|
|
2243
|
+
isActive ? /* @__PURE__ */ jsx13(
|
|
2217
2244
|
TextInput,
|
|
2218
2245
|
{
|
|
2219
2246
|
placeholder: resolvedPlaceholder,
|
|
2220
2247
|
defaultValue,
|
|
2221
2248
|
onChange
|
|
2222
2249
|
}
|
|
2223
|
-
) : /* @__PURE__ */
|
|
2250
|
+
) : /* @__PURE__ */ jsx13(Text13, { color: COLORS.textSecondary, children: defaultValue || placeholder })
|
|
2224
2251
|
] });
|
|
2225
2252
|
}
|
|
2226
2253
|
|
|
2227
2254
|
// src/components/common/confirm-dialog.tsx
|
|
2228
|
-
import { useEffect as
|
|
2229
|
-
import { Box as Box11, Text as
|
|
2230
|
-
import { jsx as
|
|
2255
|
+
import { useEffect as useEffect6 } from "react";
|
|
2256
|
+
import { Box as Box11, Text as Text14, useInput as useInput3 } from "ink";
|
|
2257
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2231
2258
|
function ConfirmDialog({ message, onConfirm, onCancel }) {
|
|
2232
2259
|
const locale = useLocaleStore((s) => s.locale);
|
|
2233
2260
|
const { openModal, closeModal } = useModalStore();
|
|
2234
|
-
|
|
2261
|
+
useEffect6(() => {
|
|
2235
2262
|
openModal();
|
|
2236
2263
|
return () => {
|
|
2237
2264
|
closeModal();
|
|
@@ -2244,26 +2271,26 @@ function ConfirmDialog({ message, onConfirm, onCancel }) {
|
|
|
2244
2271
|
else if (key.escape) onCancel();
|
|
2245
2272
|
});
|
|
2246
2273
|
return /* @__PURE__ */ jsxs13(Box11, { borderStyle: "double", borderColor: COLORS.purple, paddingX: SPACING.sm, paddingY: SPACING.xs, flexDirection: "column", children: [
|
|
2247
|
-
/* @__PURE__ */
|
|
2274
|
+
/* @__PURE__ */ jsx14(Text14, { bold: true, color: COLORS.text, children: message }),
|
|
2248
2275
|
/* @__PURE__ */ jsxs13(Box11, { marginTop: SPACING.xs, children: [
|
|
2249
|
-
/* @__PURE__ */
|
|
2250
|
-
/* @__PURE__ */
|
|
2251
|
-
/* @__PURE__ */
|
|
2276
|
+
/* @__PURE__ */ jsx14(Text14, { color: COLORS.success, children: t("confirm_yes") }),
|
|
2277
|
+
/* @__PURE__ */ jsx14(Text14, { children: " / " }),
|
|
2278
|
+
/* @__PURE__ */ jsx14(Text14, { color: COLORS.error, children: t("confirm_no") })
|
|
2252
2279
|
] })
|
|
2253
2280
|
] });
|
|
2254
2281
|
}
|
|
2255
2282
|
|
|
2256
2283
|
// src/components/common/progress-log.tsx
|
|
2257
|
-
import { Box as Box12, Text as
|
|
2284
|
+
import { Box as Box12, Text as Text15 } from "ink";
|
|
2258
2285
|
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
2259
|
-
import { jsx as
|
|
2286
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2260
2287
|
function ProgressLog({ lines, isRunning, title, maxVisible = 15 }) {
|
|
2261
2288
|
const start = Math.max(0, lines.length - maxVisible);
|
|
2262
2289
|
const visible = lines.slice(start);
|
|
2263
2290
|
return /* @__PURE__ */ jsxs14(Box12, { flexDirection: "column", borderStyle: "round", borderColor: COLORS.sky, paddingX: SPACING.xs, children: [
|
|
2264
2291
|
title && /* @__PURE__ */ jsxs14(Box12, { marginBottom: SPACING.xs, children: [
|
|
2265
|
-
isRunning && /* @__PURE__ */
|
|
2266
|
-
/* @__PURE__ */ jsxs14(
|
|
2292
|
+
isRunning && /* @__PURE__ */ jsx15(Spinner2, { label: "" }),
|
|
2293
|
+
/* @__PURE__ */ jsxs14(Text15, { bold: true, color: COLORS.sky, children: [
|
|
2267
2294
|
" ",
|
|
2268
2295
|
title
|
|
2269
2296
|
] })
|
|
@@ -2272,15 +2299,15 @@ function ProgressLog({ lines, isRunning, title, maxVisible = 15 }) {
|
|
|
2272
2299
|
// UI-006: keys are absolute indices, so a line that scrolls off-screen
|
|
2273
2300
|
// does not change the key of remaining lines. Stable identity prevents
|
|
2274
2301
|
// React from treating the whole list as new on every append.
|
|
2275
|
-
/* @__PURE__ */
|
|
2302
|
+
/* @__PURE__ */ jsx15(Text15, { color: COLORS.muted, wrap: "wrap", children: line }, `log-${start + i}`)
|
|
2276
2303
|
)),
|
|
2277
|
-
lines.length === 0 && !isRunning && /* @__PURE__ */
|
|
2304
|
+
lines.length === 0 && !isRunning && /* @__PURE__ */ jsx15(Text15, { color: COLORS.textSecondary, italic: true, children: t("progress_noOutput") })
|
|
2278
2305
|
] });
|
|
2279
2306
|
}
|
|
2280
2307
|
|
|
2281
2308
|
// src/components/common/result-banner.tsx
|
|
2282
|
-
import { Box as Box13, Text as
|
|
2283
|
-
import { jsx as
|
|
2309
|
+
import { Box as Box13, Text as Text16 } from "ink";
|
|
2310
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
2284
2311
|
var STATUS_COLORS = {
|
|
2285
2312
|
success: COLORS.success,
|
|
2286
2313
|
error: COLORS.error,
|
|
@@ -2288,21 +2315,64 @@ var STATUS_COLORS = {
|
|
|
2288
2315
|
info: COLORS.info
|
|
2289
2316
|
};
|
|
2290
2317
|
function ResultBanner({ status, message }) {
|
|
2291
|
-
return /* @__PURE__ */
|
|
2318
|
+
return /* @__PURE__ */ jsx16(Box13, { borderStyle: "round", borderColor: STATUS_COLORS[status], paddingX: SPACING.sm, paddingY: SPACING.none, children: /* @__PURE__ */ jsx16(Text16, { color: STATUS_COLORS[status], bold: true, children: message }) });
|
|
2292
2319
|
}
|
|
2293
2320
|
|
|
2294
2321
|
// src/components/common/selectable-row.tsx
|
|
2295
|
-
import { Box as Box14, Text as
|
|
2296
|
-
import { jsx as
|
|
2322
|
+
import { Box as Box14, Text as Text17 } from "ink";
|
|
2323
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2297
2324
|
function SelectableRow({ isCurrent, children, gap = 1 }) {
|
|
2298
2325
|
return /* @__PURE__ */ jsxs15(Box14, { gap, children: [
|
|
2299
|
-
/* @__PURE__ */
|
|
2326
|
+
/* @__PURE__ */ jsx17(Text17, { color: isCurrent ? COLORS.success : COLORS.muted, children: isCurrent ? "\u25B6" : " " }),
|
|
2300
2327
|
children
|
|
2301
2328
|
] });
|
|
2302
2329
|
}
|
|
2303
2330
|
|
|
2331
|
+
// src/hooks/use-container-size.ts
|
|
2332
|
+
import { useEffect as useEffect8, useState as useState5 } from "react";
|
|
2333
|
+
import { measureElement } from "ink";
|
|
2334
|
+
|
|
2335
|
+
// src/hooks/use-terminal-size.ts
|
|
2336
|
+
import { useEffect as useEffect7, useState as useState4 } from "react";
|
|
2337
|
+
import { useStdout as useStdout4 } from "ink";
|
|
2338
|
+
function useTerminalSize() {
|
|
2339
|
+
const { stdout } = useStdout4();
|
|
2340
|
+
const [size, setSize] = useState4(() => ({
|
|
2341
|
+
columns: stdout?.columns ?? 80,
|
|
2342
|
+
rows: stdout?.rows ?? 24
|
|
2343
|
+
}));
|
|
2344
|
+
useEffect7(() => {
|
|
2345
|
+
if (!stdout) return;
|
|
2346
|
+
const onResize = () => {
|
|
2347
|
+
setSize({
|
|
2348
|
+
columns: stdout.columns ?? 80,
|
|
2349
|
+
rows: stdout.rows ?? 24
|
|
2350
|
+
});
|
|
2351
|
+
};
|
|
2352
|
+
stdout.on("resize", onResize);
|
|
2353
|
+
return () => {
|
|
2354
|
+
stdout.off("resize", onResize);
|
|
2355
|
+
};
|
|
2356
|
+
}, [stdout]);
|
|
2357
|
+
return size;
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
// src/hooks/use-container-size.ts
|
|
2361
|
+
function useContainerSize(ref) {
|
|
2362
|
+
const terminal = useTerminalSize();
|
|
2363
|
+
const [size, setSize] = useState5({ width: 0, height: 0 });
|
|
2364
|
+
useEffect8(() => {
|
|
2365
|
+
if (!ref.current) return;
|
|
2366
|
+
const measured = measureElement(ref.current);
|
|
2367
|
+
setSize(
|
|
2368
|
+
(prev) => prev.width === measured.width && prev.height === measured.height ? prev : measured
|
|
2369
|
+
);
|
|
2370
|
+
}, [ref, terminal.columns, terminal.rows]);
|
|
2371
|
+
return size;
|
|
2372
|
+
}
|
|
2373
|
+
|
|
2304
2374
|
// src/views/installed.tsx
|
|
2305
|
-
import { jsx as
|
|
2375
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2306
2376
|
function InstalledView() {
|
|
2307
2377
|
const formulae = useBrewStore((s) => s.formulae);
|
|
2308
2378
|
const casks = useBrewStore((s) => s.casks);
|
|
@@ -2311,22 +2381,24 @@ function InstalledView() {
|
|
|
2311
2381
|
const fetchInstalled = useBrewStore((s) => s.fetchInstalled);
|
|
2312
2382
|
const navigate = useNavigationStore((s) => s.navigate);
|
|
2313
2383
|
const selectPackage = useNavigationStore((s) => s.selectPackage);
|
|
2314
|
-
const
|
|
2315
|
-
const
|
|
2316
|
-
const
|
|
2317
|
-
const
|
|
2318
|
-
const
|
|
2384
|
+
const { openModal, closeModal } = useModalStore();
|
|
2385
|
+
const containerRef = useRef2(null);
|
|
2386
|
+
const { width: containerWidth } = useContainerSize(containerRef);
|
|
2387
|
+
const { rows: terminalRows } = useTerminalSize();
|
|
2388
|
+
const columns = containerWidth > 0 ? containerWidth : 80;
|
|
2389
|
+
const nameWidth = Math.floor(columns * 0.35);
|
|
2390
|
+
const versionWidth = Math.floor(columns * 0.15);
|
|
2391
|
+
const [filter, setFilter] = useState6("");
|
|
2392
|
+
const [cursor, setCursor] = useState6(0);
|
|
2393
|
+
const [tab, setTab] = useState6("formulae");
|
|
2394
|
+
const [isSearching, setIsSearching] = useState6(false);
|
|
2395
|
+
const [confirmUninstall, setConfirmUninstall] = useState6(null);
|
|
2319
2396
|
const debouncedFilter = useDebounce(filter, 200);
|
|
2320
2397
|
const stream = useBrewStream();
|
|
2321
|
-
|
|
2322
|
-
const { stdout } = useStdout4();
|
|
2323
|
-
const cols = stdout?.columns ?? 80;
|
|
2324
|
-
const nameWidth = Math.floor(cols * 0.35);
|
|
2325
|
-
const versionWidth = Math.floor(cols * 0.15);
|
|
2326
|
-
useEffect6(() => {
|
|
2398
|
+
useEffect9(() => {
|
|
2327
2399
|
fetchInstalled();
|
|
2328
2400
|
}, []);
|
|
2329
|
-
|
|
2401
|
+
useEffect9(() => {
|
|
2330
2402
|
if (isSearching) {
|
|
2331
2403
|
openModal();
|
|
2332
2404
|
return () => {
|
|
@@ -2387,11 +2459,11 @@ function InstalledView() {
|
|
|
2387
2459
|
setCursor(0);
|
|
2388
2460
|
}
|
|
2389
2461
|
}, { isActive: true });
|
|
2390
|
-
if (loading.installed) return /* @__PURE__ */
|
|
2391
|
-
if (errors.installed) return /* @__PURE__ */
|
|
2462
|
+
if (loading.installed) return /* @__PURE__ */ jsx18(Loading, { message: t("loading_installed") });
|
|
2463
|
+
if (errors.installed) return /* @__PURE__ */ jsx18(ErrorMessage, { message: errors.installed });
|
|
2392
2464
|
if (stream.isRunning || stream.lines.length > 0) {
|
|
2393
2465
|
return /* @__PURE__ */ jsxs16(Box15, { flexDirection: "column", children: [
|
|
2394
|
-
/* @__PURE__ */
|
|
2466
|
+
/* @__PURE__ */ jsx18(
|
|
2395
2467
|
ProgressLog,
|
|
2396
2468
|
{
|
|
2397
2469
|
lines: stream.lines,
|
|
@@ -2399,50 +2471,50 @@ function InstalledView() {
|
|
|
2399
2471
|
title: t("pkgInfo_uninstalling", { name: "..." })
|
|
2400
2472
|
}
|
|
2401
2473
|
),
|
|
2402
|
-
stream.isRunning && /* @__PURE__ */ jsxs16(
|
|
2474
|
+
stream.isRunning && /* @__PURE__ */ jsxs16(Text18, { color: COLORS.textSecondary, children: [
|
|
2403
2475
|
"esc:",
|
|
2404
2476
|
t("hint_cancel")
|
|
2405
2477
|
] }),
|
|
2406
2478
|
!stream.isRunning && /* @__PURE__ */ jsxs16(Box15, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
2407
|
-
/* @__PURE__ */
|
|
2479
|
+
/* @__PURE__ */ jsx18(
|
|
2408
2480
|
ResultBanner,
|
|
2409
2481
|
{
|
|
2410
2482
|
status: stream.error ? "error" : "success",
|
|
2411
2483
|
message: stream.error ? `\u2718 ${stream.error}` : `\u2714 ${t("pkgInfo_done")}`
|
|
2412
2484
|
}
|
|
2413
2485
|
),
|
|
2414
|
-
/* @__PURE__ */ jsxs16(
|
|
2486
|
+
/* @__PURE__ */ jsxs16(Text18, { color: COLORS.textSecondary, children: [
|
|
2415
2487
|
"esc:",
|
|
2416
2488
|
t("hint_back")
|
|
2417
2489
|
] })
|
|
2418
2490
|
] })
|
|
2419
2491
|
] });
|
|
2420
2492
|
}
|
|
2421
|
-
const MAX_VISIBLE_ROWS = Math.max(5,
|
|
2493
|
+
const MAX_VISIBLE_ROWS = Math.max(5, terminalRows - 8);
|
|
2422
2494
|
const start = Math.max(0, cursor - Math.floor(MAX_VISIBLE_ROWS / 2));
|
|
2423
2495
|
const visible = allItems.slice(start, start + MAX_VISIBLE_ROWS);
|
|
2424
|
-
return /* @__PURE__ */ jsxs16(Box15, { flexDirection: "column", children: [
|
|
2496
|
+
return /* @__PURE__ */ jsxs16(Box15, { flexDirection: "column", ref: containerRef, children: [
|
|
2425
2497
|
/* @__PURE__ */ jsxs16(Box15, { marginBottom: SPACING.xs, gap: SPACING.xs, children: [
|
|
2426
|
-
/* @__PURE__ */
|
|
2498
|
+
/* @__PURE__ */ jsx18(
|
|
2427
2499
|
Box15,
|
|
2428
2500
|
{
|
|
2429
2501
|
borderStyle: "round",
|
|
2430
2502
|
borderColor: tab === "formulae" ? COLORS.info : COLORS.textSecondary,
|
|
2431
2503
|
paddingX: SPACING.xs,
|
|
2432
|
-
children: /* @__PURE__ */ jsxs16(
|
|
2504
|
+
children: /* @__PURE__ */ jsxs16(Text18, { bold: tab === "formulae", color: tab === "formulae" ? COLORS.info : COLORS.textSecondary, children: [
|
|
2433
2505
|
"\u{1F4E6}",
|
|
2434
2506
|
" ",
|
|
2435
2507
|
t("installed_formulaeCount", { count: formulae.length })
|
|
2436
2508
|
] })
|
|
2437
2509
|
}
|
|
2438
2510
|
),
|
|
2439
|
-
/* @__PURE__ */
|
|
2511
|
+
/* @__PURE__ */ jsx18(
|
|
2440
2512
|
Box15,
|
|
2441
2513
|
{
|
|
2442
2514
|
borderStyle: "round",
|
|
2443
2515
|
borderColor: tab === "casks" ? COLORS.purple : COLORS.textSecondary,
|
|
2444
2516
|
paddingX: SPACING.xs,
|
|
2445
|
-
children: /* @__PURE__ */ jsxs16(
|
|
2517
|
+
children: /* @__PURE__ */ jsxs16(Text18, { bold: tab === "casks", color: tab === "casks" ? COLORS.purple : COLORS.textSecondary, children: [
|
|
2446
2518
|
"\u{1F37A}",
|
|
2447
2519
|
" ",
|
|
2448
2520
|
t("installed_casksCount", { count: casks.length })
|
|
@@ -2450,7 +2522,7 @@ function InstalledView() {
|
|
|
2450
2522
|
}
|
|
2451
2523
|
)
|
|
2452
2524
|
] }),
|
|
2453
|
-
confirmUninstall && /* @__PURE__ */
|
|
2525
|
+
confirmUninstall && /* @__PURE__ */ jsx18(
|
|
2454
2526
|
ConfirmDialog,
|
|
2455
2527
|
{
|
|
2456
2528
|
message: t("installed_confirmUninstall", { name: confirmUninstall }),
|
|
@@ -2464,18 +2536,18 @@ function InstalledView() {
|
|
|
2464
2536
|
onCancel: () => setConfirmUninstall(null)
|
|
2465
2537
|
}
|
|
2466
2538
|
),
|
|
2467
|
-
isSearching && /* @__PURE__ */
|
|
2539
|
+
isSearching && /* @__PURE__ */ jsx18(Box15, { marginBottom: SPACING.xs, borderStyle: "round", borderColor: COLORS.gold, paddingX: SPACING.xs, children: /* @__PURE__ */ jsx18(SearchInput, { defaultValue: filter, onChange: setFilter, isActive: isSearching }) }),
|
|
2468
2540
|
/* @__PURE__ */ jsxs16(Box15, { gap: SPACING.xs, borderStyle: "single", borderBottom: true, borderTop: false, borderLeft: false, borderRight: false, borderColor: COLORS.border, children: [
|
|
2469
|
-
/* @__PURE__ */ jsxs16(
|
|
2541
|
+
/* @__PURE__ */ jsxs16(Text18, { color: COLORS.text, bold: true, children: [
|
|
2470
2542
|
" ",
|
|
2471
2543
|
t("installed_col_package").padEnd(nameWidth)
|
|
2472
2544
|
] }),
|
|
2473
|
-
/* @__PURE__ */
|
|
2474
|
-
/* @__PURE__ */
|
|
2545
|
+
/* @__PURE__ */ jsx18(Text18, { color: COLORS.text, bold: true, children: t("installed_col_version").padEnd(versionWidth) }),
|
|
2546
|
+
/* @__PURE__ */ jsx18(Text18, { color: COLORS.text, bold: true, children: t("installed_col_status") })
|
|
2475
2547
|
] }),
|
|
2476
2548
|
/* @__PURE__ */ jsxs16(Box15, { flexDirection: "column", children: [
|
|
2477
|
-
visible.length === 0 && /* @__PURE__ */
|
|
2478
|
-
start > 0 && /* @__PURE__ */ jsxs16(
|
|
2549
|
+
visible.length === 0 && /* @__PURE__ */ jsx18(Box15, { paddingY: SPACING.xs, justifyContent: "center", children: /* @__PURE__ */ jsx18(Text18, { color: COLORS.textSecondary, italic: true, children: t("installed_noPackages") }) }),
|
|
2550
|
+
start > 0 && /* @__PURE__ */ jsxs16(Text18, { color: COLORS.textSecondary, dimColor: true, children: [
|
|
2479
2551
|
" ",
|
|
2480
2552
|
t("scroll_moreAbove", { count: start })
|
|
2481
2553
|
] }),
|
|
@@ -2483,43 +2555,43 @@ function InstalledView() {
|
|
|
2483
2555
|
const idx = start + i;
|
|
2484
2556
|
const isCurrent = idx === cursor;
|
|
2485
2557
|
return /* @__PURE__ */ jsxs16(SelectableRow, { isCurrent, children: [
|
|
2486
|
-
/* @__PURE__ */
|
|
2487
|
-
/* @__PURE__ */
|
|
2488
|
-
item.outdated && /* @__PURE__ */
|
|
2489
|
-
item.pinned && /* @__PURE__ */
|
|
2490
|
-
item.kegOnly && /* @__PURE__ */
|
|
2491
|
-
item.installedAsDependency && /* @__PURE__ */
|
|
2492
|
-
!item.outdated && !item.pinned && !item.kegOnly && !item.installedAsDependency && /* @__PURE__ */
|
|
2558
|
+
/* @__PURE__ */ jsx18(Text18, { bold: isCurrent, inverse: isCurrent, color: isCurrent ? COLORS.text : COLORS.muted, children: truncate(item.name, nameWidth).padEnd(nameWidth) }),
|
|
2559
|
+
/* @__PURE__ */ jsx18(Text18, { color: COLORS.teal, children: item.version.padEnd(versionWidth) }),
|
|
2560
|
+
item.outdated && /* @__PURE__ */ jsx18(StatusBadge, { label: t("badge_outdated"), variant: "warning" }),
|
|
2561
|
+
item.pinned && /* @__PURE__ */ jsx18(StatusBadge, { label: t("badge_pinned"), variant: "info" }),
|
|
2562
|
+
item.kegOnly && /* @__PURE__ */ jsx18(StatusBadge, { label: t("badge_kegOnly"), variant: "muted" }),
|
|
2563
|
+
item.installedAsDependency && /* @__PURE__ */ jsx18(StatusBadge, { label: t("badge_dep"), variant: "muted" }),
|
|
2564
|
+
!item.outdated && !item.pinned && !item.kegOnly && !item.installedAsDependency && /* @__PURE__ */ jsx18(Text18, { color: COLORS.textSecondary, dimColor: true, children: truncate(item.desc, 30) })
|
|
2493
2565
|
] }, item.name);
|
|
2494
2566
|
}),
|
|
2495
|
-
start + MAX_VISIBLE_ROWS < allItems.length && /* @__PURE__ */ jsxs16(
|
|
2567
|
+
start + MAX_VISIBLE_ROWS < allItems.length && /* @__PURE__ */ jsxs16(Text18, { color: COLORS.textSecondary, dimColor: true, children: [
|
|
2496
2568
|
" ",
|
|
2497
2569
|
t("scroll_moreBelow", { count: allItems.length - start - MAX_VISIBLE_ROWS })
|
|
2498
2570
|
] })
|
|
2499
2571
|
] }),
|
|
2500
|
-
/* @__PURE__ */
|
|
2572
|
+
/* @__PURE__ */ jsx18(Box15, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx18(Text18, { color: COLORS.text, bold: true, children: allItems.length > 0 ? `${cursor + 1}/${allItems.length}` : "0/0" }) })
|
|
2501
2573
|
] });
|
|
2502
2574
|
}
|
|
2503
2575
|
|
|
2504
2576
|
// src/views/search.tsx
|
|
2505
|
-
import { useState as
|
|
2506
|
-
import { Box as Box16, Text as
|
|
2577
|
+
import { useState as useState7, useCallback as useCallback2, useEffect as useEffect10, useRef as useRef3 } from "react";
|
|
2578
|
+
import { Box as Box16, Text as Text19 } from "ink";
|
|
2507
2579
|
import { TextInput as TextInput2 } from "@inkjs/ui";
|
|
2508
|
-
import { jsx as
|
|
2580
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2509
2581
|
function SearchView() {
|
|
2510
|
-
const [query, setQuery] =
|
|
2511
|
-
const [results, setResults] =
|
|
2512
|
-
const [searching, setSearching] =
|
|
2513
|
-
const [searchError, setSearchError] =
|
|
2514
|
-
const [cursor, setCursor] =
|
|
2515
|
-
const [confirmInstall, setConfirmInstall] =
|
|
2582
|
+
const [query, setQuery] = useState7("");
|
|
2583
|
+
const [results, setResults] = useState7(null);
|
|
2584
|
+
const [searching, setSearching] = useState7(false);
|
|
2585
|
+
const [searchError, setSearchError] = useState7(null);
|
|
2586
|
+
const [cursor, setCursor] = useState7(0);
|
|
2587
|
+
const [confirmInstall, setConfirmInstall] = useState7(null);
|
|
2516
2588
|
const stream = useBrewStream();
|
|
2517
2589
|
const { openModal, closeModal } = useModalStore();
|
|
2518
2590
|
const navigate = useNavigationStore((s) => s.navigate);
|
|
2519
2591
|
const selectPackage = useNavigationStore((s) => s.selectPackage);
|
|
2520
2592
|
const fetchInstalled = useBrewStore((s) => s.fetchInstalled);
|
|
2521
|
-
const hasRefreshed =
|
|
2522
|
-
|
|
2593
|
+
const hasRefreshed = useRef3(false);
|
|
2594
|
+
useEffect10(() => {
|
|
2523
2595
|
if (results !== null) {
|
|
2524
2596
|
openModal();
|
|
2525
2597
|
return () => {
|
|
@@ -2547,7 +2619,7 @@ function SearchView() {
|
|
|
2547
2619
|
setSearching(false);
|
|
2548
2620
|
}
|
|
2549
2621
|
}, []);
|
|
2550
|
-
|
|
2622
|
+
useEffect10(() => {
|
|
2551
2623
|
if (!stream.isRunning && !stream.error && stream.lines.length > 0 && !hasRefreshed.current) {
|
|
2552
2624
|
hasRefreshed.current = true;
|
|
2553
2625
|
void fetchInstalled();
|
|
@@ -2593,7 +2665,7 @@ function SearchView() {
|
|
|
2593
2665
|
});
|
|
2594
2666
|
if (stream.isRunning || stream.lines.length > 0) {
|
|
2595
2667
|
return /* @__PURE__ */ jsxs17(Box16, { flexDirection: "column", children: [
|
|
2596
|
-
/* @__PURE__ */
|
|
2668
|
+
/* @__PURE__ */ jsx19(
|
|
2597
2669
|
ProgressLog,
|
|
2598
2670
|
{
|
|
2599
2671
|
lines: stream.lines,
|
|
@@ -2601,19 +2673,19 @@ function SearchView() {
|
|
|
2601
2673
|
title: t("search_installing")
|
|
2602
2674
|
}
|
|
2603
2675
|
),
|
|
2604
|
-
stream.isRunning && /* @__PURE__ */ jsxs17(
|
|
2676
|
+
stream.isRunning && /* @__PURE__ */ jsxs17(Text19, { color: COLORS.textSecondary, children: [
|
|
2605
2677
|
"esc:",
|
|
2606
2678
|
t("hint_cancel")
|
|
2607
2679
|
] }),
|
|
2608
2680
|
!stream.isRunning && /* @__PURE__ */ jsxs17(Box16, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
2609
|
-
/* @__PURE__ */
|
|
2681
|
+
/* @__PURE__ */ jsx19(
|
|
2610
2682
|
ResultBanner,
|
|
2611
2683
|
{
|
|
2612
2684
|
status: stream.error ? "error" : "success",
|
|
2613
2685
|
message: stream.error ? `\u2718 ${stream.error}` : `\u2714 ${t("search_installComplete")}`
|
|
2614
2686
|
}
|
|
2615
2687
|
),
|
|
2616
|
-
/* @__PURE__ */ jsxs17(
|
|
2688
|
+
/* @__PURE__ */ jsxs17(Text19, { color: COLORS.textSecondary, children: [
|
|
2617
2689
|
"esc:",
|
|
2618
2690
|
t("hint_clear")
|
|
2619
2691
|
] })
|
|
@@ -2622,11 +2694,11 @@ function SearchView() {
|
|
|
2622
2694
|
}
|
|
2623
2695
|
return /* @__PURE__ */ jsxs17(Box16, { flexDirection: "column", children: [
|
|
2624
2696
|
/* @__PURE__ */ jsxs17(Box16, { marginBottom: SPACING.xs, children: [
|
|
2625
|
-
/* @__PURE__ */ jsxs17(
|
|
2697
|
+
/* @__PURE__ */ jsxs17(Text19, { color: COLORS.gold, children: [
|
|
2626
2698
|
"\u{1F50D}",
|
|
2627
2699
|
" "
|
|
2628
2700
|
] }),
|
|
2629
|
-
!results ? /* @__PURE__ */
|
|
2701
|
+
!results ? /* @__PURE__ */ jsx19(
|
|
2630
2702
|
TextInput2,
|
|
2631
2703
|
{
|
|
2632
2704
|
placeholder: t("search_placeholder"),
|
|
@@ -2634,17 +2706,17 @@ function SearchView() {
|
|
|
2634
2706
|
onChange: setQuery,
|
|
2635
2707
|
onSubmit: () => void doSearch(query)
|
|
2636
2708
|
}
|
|
2637
|
-
) : /* @__PURE__ */ jsxs17(
|
|
2709
|
+
) : /* @__PURE__ */ jsxs17(Text19, { children: [
|
|
2638
2710
|
t("search_resultsFor"),
|
|
2639
2711
|
' "',
|
|
2640
|
-
/* @__PURE__ */
|
|
2712
|
+
/* @__PURE__ */ jsx19(Text19, { bold: true, color: COLORS.text, children: query }),
|
|
2641
2713
|
'" ',
|
|
2642
|
-
/* @__PURE__ */
|
|
2714
|
+
/* @__PURE__ */ jsx19(Text19, { color: COLORS.textSecondary, children: t("search_escToClear") })
|
|
2643
2715
|
] })
|
|
2644
2716
|
] }),
|
|
2645
|
-
searching && /* @__PURE__ */
|
|
2646
|
-
searchError && /* @__PURE__ */
|
|
2647
|
-
confirmInstall && /* @__PURE__ */
|
|
2717
|
+
searching && /* @__PURE__ */ jsx19(Loading, { message: t("loading_searching") }),
|
|
2718
|
+
searchError && /* @__PURE__ */ jsx19(Box16, { marginBottom: SPACING.xs, children: /* @__PURE__ */ jsx19(Text19, { color: COLORS.error, children: searchError }) }),
|
|
2719
|
+
confirmInstall && /* @__PURE__ */ jsx19(
|
|
2648
2720
|
ConfirmDialog,
|
|
2649
2721
|
{
|
|
2650
2722
|
message: t("search_confirmInstall", { name: confirmInstall }),
|
|
@@ -2659,72 +2731,72 @@ function SearchView() {
|
|
|
2659
2731
|
),
|
|
2660
2732
|
results && !searching && !confirmInstall && /* @__PURE__ */ jsxs17(Box16, { flexDirection: "column", children: [
|
|
2661
2733
|
visibleFormulae.length > 0 && /* @__PURE__ */ jsxs17(Box16, { flexDirection: "column", marginBottom: SPACING.xs, children: [
|
|
2662
|
-
/* @__PURE__ */
|
|
2734
|
+
/* @__PURE__ */ jsx19(Text19, { bold: true, color: COLORS.info, children: t("search_formulaeHeader", { count: results.formulae.length }) }),
|
|
2663
2735
|
visibleFormulae.map((name, i) => {
|
|
2664
2736
|
const isCurrent = i === cursor;
|
|
2665
|
-
return /* @__PURE__ */
|
|
2737
|
+
return /* @__PURE__ */ jsx19(SelectableRow, { isCurrent, children: /* @__PURE__ */ jsx19(Text19, { bold: isCurrent, inverse: isCurrent, children: name }) }, name);
|
|
2666
2738
|
}),
|
|
2667
|
-
results.formulae.length > MAX_VISIBLE && /* @__PURE__ */ jsxs17(
|
|
2739
|
+
results.formulae.length > MAX_VISIBLE && /* @__PURE__ */ jsxs17(Text19, { color: COLORS.textSecondary, dimColor: true, children: [
|
|
2668
2740
|
" ",
|
|
2669
2741
|
t("scroll_moreBelow", { count: results.formulae.length - MAX_VISIBLE })
|
|
2670
2742
|
] })
|
|
2671
2743
|
] }),
|
|
2672
2744
|
visibleCasks.length > 0 && /* @__PURE__ */ jsxs17(Box16, { flexDirection: "column", children: [
|
|
2673
|
-
/* @__PURE__ */
|
|
2745
|
+
/* @__PURE__ */ jsx19(Text19, { bold: true, color: COLORS.purple, children: t("search_casksHeader", { count: results.casks.length }) }),
|
|
2674
2746
|
visibleCasks.map((name, i) => {
|
|
2675
2747
|
const idx = visibleFormulae.length + i;
|
|
2676
2748
|
const isCurrent = idx === cursor;
|
|
2677
|
-
return /* @__PURE__ */
|
|
2749
|
+
return /* @__PURE__ */ jsx19(SelectableRow, { isCurrent, children: /* @__PURE__ */ jsx19(Text19, { bold: isCurrent, inverse: isCurrent, children: name }) }, name);
|
|
2678
2750
|
}),
|
|
2679
|
-
results.casks.length > MAX_VISIBLE && /* @__PURE__ */ jsxs17(
|
|
2751
|
+
results.casks.length > MAX_VISIBLE && /* @__PURE__ */ jsxs17(Text19, { color: COLORS.textSecondary, dimColor: true, children: [
|
|
2680
2752
|
" ",
|
|
2681
2753
|
t("scroll_moreBelow", { count: results.casks.length - MAX_VISIBLE })
|
|
2682
2754
|
] })
|
|
2683
2755
|
] }),
|
|
2684
|
-
allVisible.length === 0 && /* @__PURE__ */
|
|
2685
|
-
/* @__PURE__ */
|
|
2756
|
+
allVisible.length === 0 && /* @__PURE__ */ jsx19(Box16, { borderStyle: "round", borderColor: COLORS.textSecondary, paddingX: SPACING.sm, children: /* @__PURE__ */ jsx19(Text19, { color: COLORS.textSecondary, italic: true, children: t("search_noResults") }) }),
|
|
2757
|
+
/* @__PURE__ */ jsx19(Box16, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx19(Text19, { color: COLORS.text, bold: true, children: allVisible.length > 0 ? `${cursor + 1}/${allVisible.length}` : "" }) })
|
|
2686
2758
|
] })
|
|
2687
2759
|
] });
|
|
2688
2760
|
}
|
|
2689
2761
|
|
|
2690
2762
|
// src/views/outdated.tsx
|
|
2691
|
-
import { useEffect as
|
|
2692
|
-
import { Box as Box17, Text as
|
|
2693
|
-
import { jsx as
|
|
2763
|
+
import { useEffect as useEffect11, useMemo as useMemo4, useRef as useRef4, useState as useState8 } from "react";
|
|
2764
|
+
import { Box as Box17, Text as Text20 } from "ink";
|
|
2765
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2694
2766
|
function ImpactPanel({ impact }) {
|
|
2695
2767
|
const riskColor = impact.risk === "high" ? COLORS.error : impact.risk === "medium" ? COLORS.warning : COLORS.success;
|
|
2696
2768
|
const riskLabel = impact.risk === "high" ? t("impact_high") : impact.risk === "medium" ? t("impact_medium") : t("impact_low");
|
|
2697
2769
|
const riskIcon = impact.risk === "high" ? "\u26A0" : impact.risk === "medium" ? "~" : "\u2713";
|
|
2698
2770
|
return /* @__PURE__ */ jsxs18(Box17, { flexDirection: "column", marginTop: SPACING.xs, borderStyle: "round", borderColor: riskColor, paddingX: SPACING.sm, paddingY: SPACING.none, children: [
|
|
2699
2771
|
/* @__PURE__ */ jsxs18(Box17, { children: [
|
|
2700
|
-
/* @__PURE__ */ jsxs18(
|
|
2772
|
+
/* @__PURE__ */ jsxs18(Text20, { bold: true, color: riskColor, children: [
|
|
2701
2773
|
riskIcon,
|
|
2702
2774
|
" ",
|
|
2703
2775
|
riskLabel
|
|
2704
2776
|
] }),
|
|
2705
|
-
impact.reverseDeps.length > 0 && /* @__PURE__ */ jsxs18(
|
|
2777
|
+
impact.reverseDeps.length > 0 && /* @__PURE__ */ jsxs18(Text20, { color: COLORS.textSecondary, children: [
|
|
2706
2778
|
" \\u2014 ",
|
|
2707
2779
|
t("impact_affects", { count: impact.reverseDeps.length })
|
|
2708
2780
|
] })
|
|
2709
2781
|
] }),
|
|
2710
|
-
impact.riskReasons.length > 0 && /* @__PURE__ */
|
|
2711
|
-
impact.reverseDeps.length > 0 && impact.reverseDeps.length <= 5 && /* @__PURE__ */
|
|
2712
|
-
impact.risk === "high" && /* @__PURE__ */
|
|
2782
|
+
impact.riskReasons.length > 0 && /* @__PURE__ */ jsx20(Text20, { color: COLORS.textSecondary, children: impact.riskReasons.join(" \xB7 ") }),
|
|
2783
|
+
impact.reverseDeps.length > 0 && impact.reverseDeps.length <= 5 && /* @__PURE__ */ jsx20(Text20, { color: COLORS.muted, dimColor: true, children: t("impact_usedBy", { packages: impact.reverseDeps.join(", ") }) }),
|
|
2784
|
+
impact.risk === "high" && /* @__PURE__ */ jsx20(Text20, { color: COLORS.info, children: t("impact_brewfile_hint") })
|
|
2713
2785
|
] });
|
|
2714
2786
|
}
|
|
2715
2787
|
function OutdatedView() {
|
|
2716
2788
|
const { outdated, loading, errors, fetchOutdated } = useBrewStore();
|
|
2717
2789
|
const stream = useBrewStream();
|
|
2718
|
-
const [cursor, setCursor] =
|
|
2719
|
-
const [confirmAction, setConfirmAction] =
|
|
2720
|
-
const hasRefreshed =
|
|
2721
|
-
const pendingUpgradeRef =
|
|
2722
|
-
const [impact, setImpact] =
|
|
2723
|
-
const [impactLoading, setImpactLoading] =
|
|
2724
|
-
|
|
2790
|
+
const [cursor, setCursor] = useState8(0);
|
|
2791
|
+
const [confirmAction, setConfirmAction] = useState8(null);
|
|
2792
|
+
const hasRefreshed = useRef4(false);
|
|
2793
|
+
const pendingUpgradeRef = useRef4(null);
|
|
2794
|
+
const [impact, setImpact] = useState8(null);
|
|
2795
|
+
const [impactLoading, setImpactLoading] = useState8(false);
|
|
2796
|
+
useEffect11(() => {
|
|
2725
2797
|
fetchOutdated();
|
|
2726
2798
|
}, []);
|
|
2727
|
-
|
|
2799
|
+
useEffect11(() => {
|
|
2728
2800
|
if (!stream.isRunning && !stream.error && stream.lines.length > 0 && !hasRefreshed.current) {
|
|
2729
2801
|
hasRefreshed.current = true;
|
|
2730
2802
|
void fetchOutdated().then(() => {
|
|
@@ -2751,7 +2823,7 @@ function OutdatedView() {
|
|
|
2751
2823
|
[outdated.formulae, outdated.casks]
|
|
2752
2824
|
);
|
|
2753
2825
|
const debouncedCursor = useDebounce(cursor, 150);
|
|
2754
|
-
|
|
2826
|
+
useEffect11(() => {
|
|
2755
2827
|
const pkg = allOutdated[debouncedCursor];
|
|
2756
2828
|
if (!pkg || stream.isRunning) {
|
|
2757
2829
|
setImpact(null);
|
|
@@ -2808,15 +2880,15 @@ function OutdatedView() {
|
|
|
2808
2880
|
void fetchOutdated();
|
|
2809
2881
|
}
|
|
2810
2882
|
});
|
|
2811
|
-
const {
|
|
2812
|
-
const MAX_VISIBLE_ROWS = Math.max(5,
|
|
2883
|
+
const { rows: terminalRows } = useTerminalSize();
|
|
2884
|
+
const MAX_VISIBLE_ROWS = Math.max(5, terminalRows - 8);
|
|
2813
2885
|
const start = Math.max(0, cursor - Math.floor(MAX_VISIBLE_ROWS / 2));
|
|
2814
2886
|
const visible = allOutdated.slice(start, start + MAX_VISIBLE_ROWS);
|
|
2815
|
-
if (loading.outdated) return /* @__PURE__ */
|
|
2816
|
-
if (errors.outdated) return /* @__PURE__ */
|
|
2887
|
+
if (loading.outdated) return /* @__PURE__ */ jsx20(Loading, { message: t("loading_outdated") });
|
|
2888
|
+
if (errors.outdated) return /* @__PURE__ */ jsx20(ErrorMessage, { message: errors.outdated });
|
|
2817
2889
|
if (stream.isRunning || stream.lines.length > 0) {
|
|
2818
2890
|
return /* @__PURE__ */ jsxs18(Box17, { flexDirection: "column", children: [
|
|
2819
|
-
/* @__PURE__ */
|
|
2891
|
+
/* @__PURE__ */ jsx20(
|
|
2820
2892
|
ProgressLog,
|
|
2821
2893
|
{
|
|
2822
2894
|
lines: stream.lines,
|
|
@@ -2824,19 +2896,19 @@ function OutdatedView() {
|
|
|
2824
2896
|
title: t("outdated_upgrading")
|
|
2825
2897
|
}
|
|
2826
2898
|
),
|
|
2827
|
-
stream.isRunning && /* @__PURE__ */ jsxs18(
|
|
2899
|
+
stream.isRunning && /* @__PURE__ */ jsxs18(Text20, { color: COLORS.textSecondary, children: [
|
|
2828
2900
|
"esc:",
|
|
2829
2901
|
t("hint_cancel")
|
|
2830
2902
|
] }),
|
|
2831
2903
|
!stream.isRunning && /* @__PURE__ */ jsxs18(Box17, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
2832
2904
|
/* @__PURE__ */ jsxs18(Box17, { borderStyle: "round", borderColor: stream.error ? COLORS.error : COLORS.success, paddingX: SPACING.sm, paddingY: SPACING.none, children: [
|
|
2833
|
-
/* @__PURE__ */
|
|
2834
|
-
/* @__PURE__ */ jsxs18(
|
|
2905
|
+
/* @__PURE__ */ jsx20(Text20, { color: stream.error ? COLORS.error : COLORS.success, bold: true, children: stream.error ? `\u2718 ${stream.error}` : `\u2714 ${t("outdated_upgradeComplete")}` }),
|
|
2906
|
+
/* @__PURE__ */ jsxs18(Text20, { color: COLORS.muted, children: [
|
|
2835
2907
|
" ",
|
|
2836
2908
|
t("outdated_pressRefresh")
|
|
2837
2909
|
] })
|
|
2838
2910
|
] }),
|
|
2839
|
-
/* @__PURE__ */ jsxs18(
|
|
2911
|
+
/* @__PURE__ */ jsxs18(Text20, { color: COLORS.textSecondary, children: [
|
|
2840
2912
|
"r:",
|
|
2841
2913
|
t("hint_refresh"),
|
|
2842
2914
|
" esc:",
|
|
@@ -2848,8 +2920,8 @@ function OutdatedView() {
|
|
|
2848
2920
|
const upgradeAllMessage = confirmAction?.type === "all" ? `${t("outdated_confirmAll", { count: allOutdated.length })}
|
|
2849
2921
|
${t("outdated_upgradeAllList", { list: allOutdated.map((p) => p.name).join(", ") })}` : "";
|
|
2850
2922
|
return /* @__PURE__ */ jsxs18(Box17, { flexDirection: "column", children: [
|
|
2851
|
-
/* @__PURE__ */
|
|
2852
|
-
confirmAction && /* @__PURE__ */
|
|
2923
|
+
/* @__PURE__ */ jsx20(SectionHeader, { emoji: "\u{1F4E6}", title: t("outdated_title", { count: allOutdated.length }), gradient: GRADIENTS.fire }),
|
|
2924
|
+
confirmAction && /* @__PURE__ */ jsx20(Box17, { marginY: SPACING.xs, children: /* @__PURE__ */ jsx20(
|
|
2853
2925
|
ConfirmDialog,
|
|
2854
2926
|
{
|
|
2855
2927
|
message: confirmAction.type === "all" ? upgradeAllMessage : t("outdated_confirmSingle", { name: confirmAction.type === "single" ? confirmAction.name : "" }),
|
|
@@ -2867,9 +2939,9 @@ ${t("outdated_upgradeAllList", { list: allOutdated.map((p) => p.name).join(", ")
|
|
|
2867
2939
|
onCancel: () => setConfirmAction(null)
|
|
2868
2940
|
}
|
|
2869
2941
|
) }),
|
|
2870
|
-
allOutdated.length === 0 && !confirmAction && /* @__PURE__ */
|
|
2942
|
+
allOutdated.length === 0 && !confirmAction && /* @__PURE__ */ jsx20(Box17, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx20(ResultBanner, { status: "success", message: `\u2714 ${t("outdated_upToDate")}` }) }),
|
|
2871
2943
|
allOutdated.length > 0 && !confirmAction && /* @__PURE__ */ jsxs18(Box17, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
2872
|
-
start > 0 && /* @__PURE__ */ jsxs18(
|
|
2944
|
+
start > 0 && /* @__PURE__ */ jsxs18(Text20, { color: COLORS.textSecondary, dimColor: true, children: [
|
|
2873
2945
|
" ",
|
|
2874
2946
|
t("scroll_moreAbove", { count: start })
|
|
2875
2947
|
] }),
|
|
@@ -2877,31 +2949,31 @@ ${t("outdated_upgradeAllList", { list: allOutdated.map((p) => p.name).join(", ")
|
|
|
2877
2949
|
const idx = start + i;
|
|
2878
2950
|
const isCurrent = idx === cursor;
|
|
2879
2951
|
return /* @__PURE__ */ jsxs18(SelectableRow, { isCurrent, children: [
|
|
2880
|
-
/* @__PURE__ */
|
|
2881
|
-
/* @__PURE__ */
|
|
2882
|
-
pkg.pinned && /* @__PURE__ */
|
|
2952
|
+
/* @__PURE__ */ jsx20(Text20, { bold: isCurrent, inverse: isCurrent, color: isCurrent ? COLORS.text : COLORS.muted, children: pkg.name }),
|
|
2953
|
+
/* @__PURE__ */ jsx20(VersionArrow, { current: pkg.installed_versions[0] ?? "", latest: pkg.current_version }),
|
|
2954
|
+
pkg.pinned && /* @__PURE__ */ jsx20(StatusBadge, { label: t("outdated_pinned"), variant: "info" })
|
|
2883
2955
|
] }, pkg.name);
|
|
2884
2956
|
}),
|
|
2885
|
-
start + MAX_VISIBLE_ROWS < allOutdated.length && /* @__PURE__ */ jsxs18(
|
|
2957
|
+
start + MAX_VISIBLE_ROWS < allOutdated.length && /* @__PURE__ */ jsxs18(Text20, { color: COLORS.textSecondary, dimColor: true, children: [
|
|
2886
2958
|
" ",
|
|
2887
2959
|
t("scroll_moreBelow", { count: allOutdated.length - start - MAX_VISIBLE_ROWS })
|
|
2888
2960
|
] }),
|
|
2889
|
-
/* @__PURE__ */
|
|
2961
|
+
/* @__PURE__ */ jsx20(Box17, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs18(Text20, { color: COLORS.text, bold: true, children: [
|
|
2890
2962
|
cursor + 1,
|
|
2891
2963
|
"/",
|
|
2892
2964
|
allOutdated.length
|
|
2893
2965
|
] }) }),
|
|
2894
|
-
impact && !stream.isRunning && !confirmAction && /* @__PURE__ */
|
|
2895
|
-
impactLoading && !stream.isRunning && !confirmAction && /* @__PURE__ */
|
|
2896
|
-
/* @__PURE__ */
|
|
2966
|
+
impact && !stream.isRunning && !confirmAction && /* @__PURE__ */ jsx20(ImpactPanel, { impact }),
|
|
2967
|
+
impactLoading && !stream.isRunning && !confirmAction && /* @__PURE__ */ jsx20(Box17, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx20(Text20, { color: COLORS.textSecondary, children: t("impact_analyzing") }) }),
|
|
2968
|
+
/* @__PURE__ */ jsx20(Box17, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx20(Text20, { color: COLORS.textSecondary, children: t("impact_hint") }) })
|
|
2897
2969
|
] })
|
|
2898
2970
|
] });
|
|
2899
2971
|
}
|
|
2900
2972
|
|
|
2901
2973
|
// src/views/package-info.tsx
|
|
2902
|
-
import { useEffect as
|
|
2903
|
-
import { Box as Box18, Text as
|
|
2904
|
-
import { Fragment as Fragment4, jsx as
|
|
2974
|
+
import { useEffect as useEffect12, useRef as useRef5, useState as useState9 } from "react";
|
|
2975
|
+
import { Box as Box18, Text as Text21 } from "ink";
|
|
2976
|
+
import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2905
2977
|
var ACTION_PROGRESS_KEYS = {
|
|
2906
2978
|
install: "pkgInfo_installing",
|
|
2907
2979
|
uninstall: "pkgInfo_uninstalling",
|
|
@@ -2915,21 +2987,21 @@ var ACTION_CONFIRM_KEYS = {
|
|
|
2915
2987
|
function PackageInfoView() {
|
|
2916
2988
|
const packageName = useNavigationStore((s) => s.selectedPackage);
|
|
2917
2989
|
const packageType = useNavigationStore((s) => s.selectedPackageType);
|
|
2918
|
-
const [formula, setFormula] =
|
|
2919
|
-
const [loading, setLoading2] =
|
|
2920
|
-
const [error, setError2] =
|
|
2921
|
-
const [confirmAction, setConfirmAction] =
|
|
2922
|
-
const activeActionRef =
|
|
2923
|
-
const mountedRef =
|
|
2924
|
-
const hasRefreshed =
|
|
2990
|
+
const [formula, setFormula] = useState9(null);
|
|
2991
|
+
const [loading, setLoading2] = useState9(true);
|
|
2992
|
+
const [error, setError2] = useState9(null);
|
|
2993
|
+
const [confirmAction, setConfirmAction] = useState9(null);
|
|
2994
|
+
const activeActionRef = useRef5("install");
|
|
2995
|
+
const mountedRef = useRef5(true);
|
|
2996
|
+
const hasRefreshed = useRef5(false);
|
|
2925
2997
|
const stream = useBrewStream();
|
|
2926
|
-
|
|
2998
|
+
useEffect12(() => {
|
|
2927
2999
|
mountedRef.current = true;
|
|
2928
3000
|
return () => {
|
|
2929
3001
|
mountedRef.current = false;
|
|
2930
3002
|
};
|
|
2931
3003
|
}, []);
|
|
2932
|
-
|
|
3004
|
+
useEffect12(() => {
|
|
2933
3005
|
if (!packageName) return;
|
|
2934
3006
|
setLoading2(true);
|
|
2935
3007
|
const fetchInfo = async () => {
|
|
@@ -2954,7 +3026,7 @@ function PackageInfoView() {
|
|
|
2954
3026
|
}
|
|
2955
3027
|
});
|
|
2956
3028
|
}, [packageName, packageType]);
|
|
2957
|
-
|
|
3029
|
+
useEffect12(() => {
|
|
2958
3030
|
if (!stream.isRunning && !stream.error && stream.lines.length > 0 && !hasRefreshed.current && packageName) {
|
|
2959
3031
|
hasRefreshed.current = true;
|
|
2960
3032
|
const refreshFn = packageType === "cask" ? getCaskInfo(packageName).then((c) => c ? { ...c, installed: c.installed ? [{ version: c.installed }] : [] } : null) : getFormulaInfo(packageName);
|
|
@@ -2997,21 +3069,21 @@ function PackageInfoView() {
|
|
|
2997
3069
|
}
|
|
2998
3070
|
});
|
|
2999
3071
|
if (!packageName) {
|
|
3000
|
-
return /* @__PURE__ */
|
|
3072
|
+
return /* @__PURE__ */ jsx21(Text21, { color: COLORS.textSecondary, italic: true, children: t("pkgInfo_noPackage") });
|
|
3001
3073
|
}
|
|
3002
|
-
if (loading) return /* @__PURE__ */
|
|
3003
|
-
if (error) return /* @__PURE__ */
|
|
3004
|
-
if (!formula) return /* @__PURE__ */
|
|
3074
|
+
if (loading) return /* @__PURE__ */ jsx21(Loading, { message: t("loading_package", { name: packageName }) });
|
|
3075
|
+
if (error) return /* @__PURE__ */ jsx21(ErrorMessage, { message: error });
|
|
3076
|
+
if (!formula) return /* @__PURE__ */ jsx21(ErrorMessage, { message: t("pkgInfo_notFound") });
|
|
3005
3077
|
if (stream.isRunning || stream.lines.length > 0) {
|
|
3006
3078
|
return /* @__PURE__ */ jsxs19(Box18, { flexDirection: "column", children: [
|
|
3007
|
-
/* @__PURE__ */
|
|
3008
|
-
stream.isRunning && /* @__PURE__ */ jsxs19(
|
|
3079
|
+
/* @__PURE__ */ jsx21(ProgressLog, { lines: stream.lines, isRunning: stream.isRunning, title: t(ACTION_PROGRESS_KEYS[activeActionRef.current] ?? ACTION_PROGRESS_KEYS["install"], { name: formula.name }) }),
|
|
3080
|
+
stream.isRunning && /* @__PURE__ */ jsxs19(Text21, { color: COLORS.textSecondary, children: [
|
|
3009
3081
|
"esc:",
|
|
3010
3082
|
t("hint_cancel")
|
|
3011
3083
|
] }),
|
|
3012
3084
|
!stream.isRunning && /* @__PURE__ */ jsxs19(Fragment4, { children: [
|
|
3013
|
-
/* @__PURE__ */
|
|
3014
|
-
/* @__PURE__ */ jsxs19(
|
|
3085
|
+
/* @__PURE__ */ jsx21(Text21, { color: stream.error ? COLORS.error : COLORS.success, bold: true, children: stream.error ? `\u2718 ${stream.error}` : `\u2714 ${t("pkgInfo_done")}` }),
|
|
3086
|
+
/* @__PURE__ */ jsxs19(Text21, { color: COLORS.textSecondary, children: [
|
|
3015
3087
|
"esc:",
|
|
3016
3088
|
t("hint_back")
|
|
3017
3089
|
] })
|
|
@@ -3021,7 +3093,7 @@ function PackageInfoView() {
|
|
|
3021
3093
|
const installed = formula.installed[0];
|
|
3022
3094
|
const isInstalled = formula.installed.length > 0;
|
|
3023
3095
|
return /* @__PURE__ */ jsxs19(Box18, { flexDirection: "column", children: [
|
|
3024
|
-
confirmAction && /* @__PURE__ */
|
|
3096
|
+
confirmAction && /* @__PURE__ */ jsx21(
|
|
3025
3097
|
ConfirmDialog,
|
|
3026
3098
|
{
|
|
3027
3099
|
message: t(ACTION_CONFIRM_KEYS[confirmAction], { name: formula.name }),
|
|
@@ -3038,55 +3110,55 @@ function PackageInfoView() {
|
|
|
3038
3110
|
}
|
|
3039
3111
|
),
|
|
3040
3112
|
/* @__PURE__ */ jsxs19(Box18, { gap: SPACING.sm, marginBottom: SPACING.xs, children: [
|
|
3041
|
-
/* @__PURE__ */
|
|
3042
|
-
/* @__PURE__ */
|
|
3043
|
-
isInstalled && /* @__PURE__ */
|
|
3044
|
-
formula.outdated && /* @__PURE__ */
|
|
3045
|
-
formula.pinned && /* @__PURE__ */
|
|
3046
|
-
formula.keg_only && /* @__PURE__ */
|
|
3047
|
-
formula.deprecated && /* @__PURE__ */
|
|
3113
|
+
/* @__PURE__ */ jsx21(GradientText, { colors: GRADIENTS.gold, bold: true, children: formula.name }),
|
|
3114
|
+
/* @__PURE__ */ jsx21(Text21, { color: COLORS.teal, children: installed?.version ?? formula.versions.stable }),
|
|
3115
|
+
isInstalled && /* @__PURE__ */ jsx21(StatusBadge, { label: t("badge_installed"), variant: "success" }),
|
|
3116
|
+
formula.outdated && /* @__PURE__ */ jsx21(StatusBadge, { label: t("badge_outdated"), variant: "warning" }),
|
|
3117
|
+
formula.pinned && /* @__PURE__ */ jsx21(StatusBadge, { label: t("badge_pinned"), variant: "info" }),
|
|
3118
|
+
formula.keg_only && /* @__PURE__ */ jsx21(StatusBadge, { label: t("badge_kegOnly"), variant: "muted" }),
|
|
3119
|
+
formula.deprecated && /* @__PURE__ */ jsx21(StatusBadge, { label: t("badge_deprecated"), variant: "error" })
|
|
3048
3120
|
] }),
|
|
3049
3121
|
/* @__PURE__ */ jsxs19(Box18, { flexDirection: "column", gap: SPACING.xs, children: [
|
|
3050
|
-
/* @__PURE__ */
|
|
3122
|
+
/* @__PURE__ */ jsx21(Text21, { children: formula.desc }),
|
|
3051
3123
|
/* @__PURE__ */ jsxs19(Box18, { flexDirection: "column", children: [
|
|
3052
|
-
/* @__PURE__ */
|
|
3124
|
+
/* @__PURE__ */ jsx21(SectionHeader, { emoji: "\u{1F4CB}", title: t("pkgInfo_details"), gradient: [COLORS.text, COLORS.muted] }),
|
|
3053
3125
|
/* @__PURE__ */ jsxs19(Box18, { borderStyle: "round", borderColor: COLORS.border, paddingX: SPACING.sm, flexDirection: "column", children: [
|
|
3054
|
-
/* @__PURE__ */ jsxs19(
|
|
3055
|
-
/* @__PURE__ */
|
|
3126
|
+
/* @__PURE__ */ jsxs19(Text21, { children: [
|
|
3127
|
+
/* @__PURE__ */ jsx21(Text21, { color: COLORS.muted, children: t("pkgInfo_homepage") }),
|
|
3056
3128
|
" ",
|
|
3057
3129
|
formula.homepage
|
|
3058
3130
|
] }),
|
|
3059
|
-
/* @__PURE__ */ jsxs19(
|
|
3060
|
-
/* @__PURE__ */
|
|
3131
|
+
/* @__PURE__ */ jsxs19(Text21, { children: [
|
|
3132
|
+
/* @__PURE__ */ jsx21(Text21, { color: COLORS.muted, children: t("pkgInfo_license") }),
|
|
3061
3133
|
" ",
|
|
3062
3134
|
formula.license
|
|
3063
3135
|
] }),
|
|
3064
|
-
/* @__PURE__ */ jsxs19(
|
|
3065
|
-
/* @__PURE__ */
|
|
3136
|
+
/* @__PURE__ */ jsxs19(Text21, { children: [
|
|
3137
|
+
/* @__PURE__ */ jsx21(Text21, { color: COLORS.muted, children: t("pkgInfo_tap") }),
|
|
3066
3138
|
" ",
|
|
3067
3139
|
formula.tap
|
|
3068
3140
|
] }),
|
|
3069
|
-
/* @__PURE__ */ jsxs19(
|
|
3070
|
-
/* @__PURE__ */
|
|
3141
|
+
/* @__PURE__ */ jsxs19(Text21, { children: [
|
|
3142
|
+
/* @__PURE__ */ jsx21(Text21, { color: COLORS.muted, children: t("pkgInfo_stable") }),
|
|
3071
3143
|
" ",
|
|
3072
3144
|
formula.versions.stable
|
|
3073
3145
|
] }),
|
|
3074
3146
|
installed && /* @__PURE__ */ jsxs19(Fragment4, { children: [
|
|
3075
|
-
/* @__PURE__ */ jsxs19(
|
|
3076
|
-
/* @__PURE__ */
|
|
3147
|
+
/* @__PURE__ */ jsxs19(Text21, { children: [
|
|
3148
|
+
/* @__PURE__ */ jsx21(Text21, { color: COLORS.muted, children: t("pkgInfo_installed") }),
|
|
3077
3149
|
" ",
|
|
3078
3150
|
installed.version,
|
|
3079
3151
|
" (",
|
|
3080
3152
|
formatRelativeTime(installed.time),
|
|
3081
3153
|
")"
|
|
3082
3154
|
] }),
|
|
3083
|
-
/* @__PURE__ */ jsxs19(
|
|
3084
|
-
/* @__PURE__ */
|
|
3155
|
+
/* @__PURE__ */ jsxs19(Text21, { children: [
|
|
3156
|
+
/* @__PURE__ */ jsx21(Text21, { color: COLORS.muted, children: t("pkgInfo_bottle") }),
|
|
3085
3157
|
" ",
|
|
3086
3158
|
installed.poured_from_bottle ? t("common_yes") : t("common_no")
|
|
3087
3159
|
] }),
|
|
3088
|
-
/* @__PURE__ */ jsxs19(
|
|
3089
|
-
/* @__PURE__ */
|
|
3160
|
+
/* @__PURE__ */ jsxs19(Text21, { children: [
|
|
3161
|
+
/* @__PURE__ */ jsx21(Text21, { color: COLORS.muted, children: t("pkgInfo_onRequest") }),
|
|
3090
3162
|
" ",
|
|
3091
3163
|
installed.installed_on_request ? t("common_yes") : t("pkgInfo_noDependency")
|
|
3092
3164
|
] })
|
|
@@ -3094,15 +3166,15 @@ function PackageInfoView() {
|
|
|
3094
3166
|
] })
|
|
3095
3167
|
] }),
|
|
3096
3168
|
formula.dependencies.length > 0 && /* @__PURE__ */ jsxs19(Box18, { flexDirection: "column", children: [
|
|
3097
|
-
/* @__PURE__ */
|
|
3098
|
-
/* @__PURE__ */
|
|
3169
|
+
/* @__PURE__ */ jsx21(SectionHeader, { emoji: "\u{1F517}", title: t("pkgInfo_dependencies", { count: formula.dependencies.length }), gradient: GRADIENTS.ocean }),
|
|
3170
|
+
/* @__PURE__ */ jsx21(Box18, { paddingLeft: SPACING.sm, flexWrap: "wrap", columnGap: 2, children: formula.dependencies.map((dep) => /* @__PURE__ */ jsx21(Text21, { color: COLORS.muted, children: dep }, dep)) })
|
|
3099
3171
|
] }),
|
|
3100
3172
|
formula.caveats && /* @__PURE__ */ jsxs19(Box18, { flexDirection: "column", children: [
|
|
3101
|
-
/* @__PURE__ */
|
|
3102
|
-
/* @__PURE__ */
|
|
3173
|
+
/* @__PURE__ */ jsx21(SectionHeader, { emoji: "\u26A0\uFE0F", title: t("pkgInfo_caveats"), color: COLORS.warning }),
|
|
3174
|
+
/* @__PURE__ */ jsx21(Box18, { borderStyle: "round", borderColor: COLORS.warning, paddingX: SPACING.sm, children: /* @__PURE__ */ jsx21(Text21, { color: COLORS.warning, children: formula.caveats }) })
|
|
3103
3175
|
] })
|
|
3104
3176
|
] }),
|
|
3105
|
-
/* @__PURE__ */
|
|
3177
|
+
/* @__PURE__ */ jsx21(Box18, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs19(Text21, { color: COLORS.textSecondary, children: [
|
|
3106
3178
|
isInstalled ? `u:${t("hint_uninstall")}` : `i:${t("hint_install")}`,
|
|
3107
3179
|
isInstalled && formula.outdated ? ` U:${t("hint_upgrade")}` : "",
|
|
3108
3180
|
` esc:${t("hint_back")}`
|
|
@@ -3111,9 +3183,9 @@ function PackageInfoView() {
|
|
|
3111
3183
|
}
|
|
3112
3184
|
|
|
3113
3185
|
// src/views/services.tsx
|
|
3114
|
-
import { useEffect as
|
|
3115
|
-
import { Box as Box19, Text as
|
|
3116
|
-
import { jsx as
|
|
3186
|
+
import { useEffect as useEffect13, useState as useState10 } from "react";
|
|
3187
|
+
import { Box as Box19, Text as Text22, useStdout as useStdout5 } from "ink";
|
|
3188
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3117
3189
|
var STATUS_VARIANTS = {
|
|
3118
3190
|
started: "success",
|
|
3119
3191
|
stopped: "muted",
|
|
@@ -3128,16 +3200,16 @@ function humaniseServiceError(message) {
|
|
|
3128
3200
|
}
|
|
3129
3201
|
function ServicesView() {
|
|
3130
3202
|
const { services, loading, errors, fetchServices, serviceAction: serviceAction2 } = useBrewStore();
|
|
3131
|
-
const [cursor, setCursor] =
|
|
3132
|
-
const [actionInProgress, setActionInProgress] =
|
|
3133
|
-
const [confirmAction, setConfirmAction] =
|
|
3134
|
-
const [lastError, setLastError] =
|
|
3135
|
-
const { stdout } =
|
|
3203
|
+
const [cursor, setCursor] = useState10(0);
|
|
3204
|
+
const [actionInProgress, setActionInProgress] = useState10(false);
|
|
3205
|
+
const [confirmAction, setConfirmAction] = useState10(null);
|
|
3206
|
+
const [lastError, setLastError] = useState10(null);
|
|
3207
|
+
const { stdout } = useStdout5();
|
|
3136
3208
|
const cols = stdout?.columns ?? 80;
|
|
3137
3209
|
const svcNameWidth = Math.floor(cols * 0.35);
|
|
3138
3210
|
const svcStatusWidth = Math.floor(cols * 0.15);
|
|
3139
3211
|
const MAX_VISIBLE_ROWS = Math.max(5, (stdout?.rows ?? 24) - 10);
|
|
3140
|
-
|
|
3212
|
+
useEffect13(() => {
|
|
3141
3213
|
fetchServices();
|
|
3142
3214
|
}, []);
|
|
3143
3215
|
useViewInput((input, key) => {
|
|
@@ -3169,19 +3241,19 @@ function ServicesView() {
|
|
|
3169
3241
|
else if (input === "x" || input === "2") setConfirmAction({ type: "stop", name: svc.name });
|
|
3170
3242
|
else if (input === "R" || input === "3") setConfirmAction({ type: "restart", name: svc.name });
|
|
3171
3243
|
});
|
|
3172
|
-
if (loading.services) return /* @__PURE__ */
|
|
3173
|
-
if (errors.services) return /* @__PURE__ */
|
|
3244
|
+
if (loading.services) return /* @__PURE__ */ jsx22(Loading, { message: t("loading_services") });
|
|
3245
|
+
if (errors.services) return /* @__PURE__ */ jsx22(ErrorMessage, { message: errors.services });
|
|
3174
3246
|
if (services.length === 0) {
|
|
3175
3247
|
return /* @__PURE__ */ jsxs20(Box19, { flexDirection: "column", children: [
|
|
3176
|
-
/* @__PURE__ */
|
|
3177
|
-
/* @__PURE__ */
|
|
3248
|
+
/* @__PURE__ */ jsx22(SectionHeader, { emoji: "\u2699\uFE0F", title: t("services_title"), gradient: GRADIENTS.ocean }),
|
|
3249
|
+
/* @__PURE__ */ jsx22(Text22, { color: COLORS.textSecondary, italic: true, children: t("services_noServices") })
|
|
3178
3250
|
] });
|
|
3179
3251
|
}
|
|
3180
3252
|
const start = Math.max(0, cursor - Math.floor(MAX_VISIBLE_ROWS / 2));
|
|
3181
3253
|
const visible = services.slice(start, start + MAX_VISIBLE_ROWS);
|
|
3182
3254
|
return /* @__PURE__ */ jsxs20(Box19, { flexDirection: "column", children: [
|
|
3183
|
-
/* @__PURE__ */
|
|
3184
|
-
confirmAction && /* @__PURE__ */
|
|
3255
|
+
/* @__PURE__ */ jsx22(SectionHeader, { emoji: "\u2699\uFE0F", title: t("services_titleCount", { count: services.length }), gradient: GRADIENTS.ocean }),
|
|
3256
|
+
confirmAction && /* @__PURE__ */ jsx22(Box19, { marginY: SPACING.xs, children: /* @__PURE__ */ jsx22(
|
|
3185
3257
|
ConfirmDialog,
|
|
3186
3258
|
{
|
|
3187
3259
|
message: confirmAction.type === "stop" ? t("services_confirmStop", { name: confirmAction.name }) : t("services_confirmRestart", { name: confirmAction.name }),
|
|
@@ -3202,14 +3274,14 @@ function ServicesView() {
|
|
|
3202
3274
|
) }),
|
|
3203
3275
|
/* @__PURE__ */ jsxs20(Box19, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
3204
3276
|
/* @__PURE__ */ jsxs20(Box19, { gap: SPACING.xs, borderStyle: "single", borderBottom: true, borderTop: false, borderLeft: false, borderRight: false, borderColor: COLORS.border, paddingBottom: SPACING.none, children: [
|
|
3205
|
-
/* @__PURE__ */ jsxs20(
|
|
3277
|
+
/* @__PURE__ */ jsxs20(Text22, { bold: true, color: COLORS.text, children: [
|
|
3206
3278
|
" ",
|
|
3207
3279
|
t("services_name").padEnd(svcNameWidth)
|
|
3208
3280
|
] }),
|
|
3209
|
-
/* @__PURE__ */
|
|
3210
|
-
/* @__PURE__ */
|
|
3281
|
+
/* @__PURE__ */ jsx22(Text22, { bold: true, color: COLORS.text, children: t("services_status").padEnd(svcStatusWidth) }),
|
|
3282
|
+
/* @__PURE__ */ jsx22(Text22, { bold: true, color: COLORS.text, children: t("services_user") })
|
|
3211
3283
|
] }),
|
|
3212
|
-
start > 0 && /* @__PURE__ */ jsxs20(
|
|
3284
|
+
start > 0 && /* @__PURE__ */ jsxs20(Text22, { color: COLORS.textSecondary, dimColor: true, children: [
|
|
3213
3285
|
" ",
|
|
3214
3286
|
t("scroll_moreAbove", { count: start })
|
|
3215
3287
|
] }),
|
|
@@ -3217,20 +3289,20 @@ function ServicesView() {
|
|
|
3217
3289
|
const idx = start + i;
|
|
3218
3290
|
const isCurrent = idx === cursor;
|
|
3219
3291
|
return /* @__PURE__ */ jsxs20(SelectableRow, { isCurrent, children: [
|
|
3220
|
-
/* @__PURE__ */
|
|
3221
|
-
/* @__PURE__ */
|
|
3222
|
-
/* @__PURE__ */
|
|
3223
|
-
svc.exit_code != null && svc.exit_code !== 0 && /* @__PURE__ */
|
|
3292
|
+
/* @__PURE__ */ jsx22(Text22, { bold: isCurrent, inverse: isCurrent, color: isCurrent ? COLORS.text : COLORS.muted, children: svc.name.padEnd(svcNameWidth - 2) }),
|
|
3293
|
+
/* @__PURE__ */ jsx22(StatusBadge, { label: svc.status, variant: STATUS_VARIANTS[svc.status] }),
|
|
3294
|
+
/* @__PURE__ */ jsx22(Text22, { color: COLORS.muted, children: svc.user ?? "-" }),
|
|
3295
|
+
svc.exit_code != null && svc.exit_code !== 0 && /* @__PURE__ */ jsx22(Text22, { color: COLORS.error, children: t("common_exit", { code: svc.exit_code }) })
|
|
3224
3296
|
] }, svc.name);
|
|
3225
3297
|
}),
|
|
3226
|
-
start + MAX_VISIBLE_ROWS < services.length && /* @__PURE__ */ jsxs20(
|
|
3298
|
+
start + MAX_VISIBLE_ROWS < services.length && /* @__PURE__ */ jsxs20(Text22, { color: COLORS.textSecondary, dimColor: true, children: [
|
|
3227
3299
|
" ",
|
|
3228
3300
|
t("scroll_moreBelow", { count: services.length - start - MAX_VISIBLE_ROWS })
|
|
3229
3301
|
] })
|
|
3230
3302
|
] }),
|
|
3231
|
-
actionInProgress && /* @__PURE__ */
|
|
3232
|
-
lastError && /* @__PURE__ */
|
|
3233
|
-
/* @__PURE__ */
|
|
3303
|
+
actionInProgress && /* @__PURE__ */ jsx22(Text22, { color: COLORS.sky, children: t("services_processing") }),
|
|
3304
|
+
lastError && /* @__PURE__ */ jsx22(Box19, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx22(Text22, { color: COLORS.error, children: lastError }) }),
|
|
3305
|
+
/* @__PURE__ */ jsx22(Box19, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs20(Text22, { color: COLORS.text, bold: true, children: [
|
|
3234
3306
|
cursor + 1,
|
|
3235
3307
|
"/",
|
|
3236
3308
|
services.length
|
|
@@ -3239,42 +3311,42 @@ function ServicesView() {
|
|
|
3239
3311
|
}
|
|
3240
3312
|
|
|
3241
3313
|
// src/views/doctor.tsx
|
|
3242
|
-
import { useEffect as
|
|
3243
|
-
import { Box as Box20, Text as
|
|
3244
|
-
import { jsx as
|
|
3314
|
+
import { useEffect as useEffect14, useRef as useRef6 } from "react";
|
|
3315
|
+
import { Box as Box20, Text as Text23 } from "ink";
|
|
3316
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3245
3317
|
function DoctorView() {
|
|
3246
3318
|
const { doctorWarnings, doctorClean, loading, errors, fetchDoctor } = useBrewStore();
|
|
3247
|
-
const mountedRef =
|
|
3248
|
-
|
|
3319
|
+
const mountedRef = useRef6(true);
|
|
3320
|
+
useEffect14(() => {
|
|
3249
3321
|
mountedRef.current = true;
|
|
3250
3322
|
return () => {
|
|
3251
3323
|
mountedRef.current = false;
|
|
3252
3324
|
};
|
|
3253
3325
|
}, []);
|
|
3254
|
-
|
|
3326
|
+
useEffect14(() => {
|
|
3255
3327
|
fetchDoctor();
|
|
3256
3328
|
}, []);
|
|
3257
3329
|
useViewInput((input) => {
|
|
3258
3330
|
if (input === "r" || input === "1") void fetchDoctor();
|
|
3259
3331
|
});
|
|
3260
|
-
if (loading.doctor) return /* @__PURE__ */
|
|
3261
|
-
if (errors.doctor) return /* @__PURE__ */
|
|
3332
|
+
if (loading.doctor) return /* @__PURE__ */ jsx23(Loading, { message: t("loading_doctor") });
|
|
3333
|
+
if (errors.doctor) return /* @__PURE__ */ jsx23(ErrorMessage, { message: errors.doctor });
|
|
3262
3334
|
return /* @__PURE__ */ jsxs21(Box20, { flexDirection: "column", children: [
|
|
3263
|
-
/* @__PURE__ */
|
|
3335
|
+
/* @__PURE__ */ jsx23(SectionHeader, { emoji: "\u{1FA7A}", title: t("doctor_title"), gradient: GRADIENTS.emerald }),
|
|
3264
3336
|
/* @__PURE__ */ jsxs21(Box20, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
3265
|
-
doctorClean && /* @__PURE__ */
|
|
3266
|
-
doctorClean === false && doctorWarnings.length === 0 && /* @__PURE__ */
|
|
3337
|
+
doctorClean && /* @__PURE__ */ jsx23(ResultBanner, { status: "success", message: `\u2714 ${t("doctor_clean")}` }),
|
|
3338
|
+
doctorClean === false && doctorWarnings.length === 0 && /* @__PURE__ */ jsx23(Text23, { color: COLORS.warning, children: t("doctor_warningsNotCaptured") }),
|
|
3267
3339
|
doctorWarnings.map((warning, i) => (
|
|
3268
3340
|
// FE-004: Improved React key
|
|
3269
|
-
/* @__PURE__ */
|
|
3341
|
+
/* @__PURE__ */ jsx23(Box20, { flexDirection: "column", marginBottom: SPACING.xs, borderStyle: "single", borderColor: COLORS.warning, paddingX: SPACING.xs, children: warning.split("\n").map((line, j) => /* @__PURE__ */ jsx23(Text23, { color: j === 0 ? COLORS.warning : COLORS.muted, children: line }, `warning-${i}-${j}-${line.slice(0, 20)}`)) }, `warning-${i}-${warning.slice(0, 20)}`)
|
|
3270
3342
|
))
|
|
3271
3343
|
] }),
|
|
3272
|
-
/* @__PURE__ */
|
|
3344
|
+
/* @__PURE__ */ jsx23(Box20, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx23(Text23, { color: COLORS.text, bold: true, children: doctorWarnings.length > 0 ? tp("plural_warnings", doctorWarnings.length) : "" }) })
|
|
3273
3345
|
] });
|
|
3274
3346
|
}
|
|
3275
3347
|
|
|
3276
3348
|
// src/views/profiles.tsx
|
|
3277
|
-
import { useEffect as
|
|
3349
|
+
import { useEffect as useEffect15, useRef as useRef7, useState as useState11 } from "react";
|
|
3278
3350
|
import { Box as Box25 } from "ink";
|
|
3279
3351
|
|
|
3280
3352
|
// src/stores/profile-store.ts
|
|
@@ -3495,13 +3567,13 @@ var useProfileStore = create9((set) => ({
|
|
|
3495
3567
|
}));
|
|
3496
3568
|
|
|
3497
3569
|
// src/views/profiles/profile-list-mode.tsx
|
|
3498
|
-
import { Box as Box21, Text as
|
|
3499
|
-
import { jsx as
|
|
3570
|
+
import { Box as Box21, Text as Text24 } from "ink";
|
|
3571
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3500
3572
|
function ProfileListMode({ profileNames, cursor, confirmDelete, loadError, onConfirmDelete, onCancelDelete }) {
|
|
3501
3573
|
return /* @__PURE__ */ jsxs22(Box21, { flexDirection: "column", children: [
|
|
3502
|
-
/* @__PURE__ */
|
|
3503
|
-
loadError && /* @__PURE__ */
|
|
3504
|
-
confirmDelete && profileNames[cursor] && /* @__PURE__ */
|
|
3574
|
+
/* @__PURE__ */ jsx24(SectionHeader, { emoji: "\u{1F4C1}", title: t("profiles_title", { count: profileNames.length }), gradient: GRADIENTS.gold }),
|
|
3575
|
+
loadError && /* @__PURE__ */ jsx24(Box21, { marginY: SPACING.xs, children: /* @__PURE__ */ jsx24(Text24, { color: COLORS.error, children: loadError }) }),
|
|
3576
|
+
confirmDelete && profileNames[cursor] && /* @__PURE__ */ jsx24(Box21, { marginY: SPACING.xs, children: /* @__PURE__ */ jsx24(
|
|
3505
3577
|
ConfirmDialog,
|
|
3506
3578
|
{
|
|
3507
3579
|
message: t("profiles_confirmDelete", { name: profileNames[cursor] }),
|
|
@@ -3509,12 +3581,12 @@ function ProfileListMode({ profileNames, cursor, confirmDelete, loadError, onCon
|
|
|
3509
3581
|
onCancel: onCancelDelete
|
|
3510
3582
|
}
|
|
3511
3583
|
) }),
|
|
3512
|
-
profileNames.length === 0 && !confirmDelete && /* @__PURE__ */
|
|
3513
|
-
/* @__PURE__ */
|
|
3514
|
-
/* @__PURE__ */ jsxs22(
|
|
3584
|
+
profileNames.length === 0 && !confirmDelete && /* @__PURE__ */ jsx24(Box21, { marginTop: SPACING.xs, borderStyle: "round", borderColor: COLORS.textSecondary, paddingX: SPACING.sm, paddingY: SPACING.none, children: /* @__PURE__ */ jsxs22(Box21, { flexDirection: "column", children: [
|
|
3585
|
+
/* @__PURE__ */ jsx24(Text24, { color: COLORS.textSecondary, italic: true, children: t("profiles_noProfiles") }),
|
|
3586
|
+
/* @__PURE__ */ jsxs22(Text24, { color: COLORS.muted, children: [
|
|
3515
3587
|
t("profiles_press"),
|
|
3516
3588
|
" ",
|
|
3517
|
-
/* @__PURE__ */
|
|
3589
|
+
/* @__PURE__ */ jsx24(Text24, { color: COLORS.gold, bold: true, children: "n" }),
|
|
3518
3590
|
" ",
|
|
3519
3591
|
t("profiles_exportHint")
|
|
3520
3592
|
] })
|
|
@@ -3522,9 +3594,9 @@ function ProfileListMode({ profileNames, cursor, confirmDelete, loadError, onCon
|
|
|
3522
3594
|
profileNames.length > 0 && !confirmDelete && /* @__PURE__ */ jsxs22(Box21, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
3523
3595
|
profileNames.map((name, i) => {
|
|
3524
3596
|
const isCurrent = i === cursor;
|
|
3525
|
-
return /* @__PURE__ */
|
|
3597
|
+
return /* @__PURE__ */ jsx24(SelectableRow, { isCurrent, children: /* @__PURE__ */ jsx24(Text24, { bold: isCurrent, inverse: isCurrent, children: name }) }, name);
|
|
3526
3598
|
}),
|
|
3527
|
-
/* @__PURE__ */
|
|
3599
|
+
/* @__PURE__ */ jsx24(Box21, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs22(Text24, { color: COLORS.text, bold: true, children: [
|
|
3528
3600
|
cursor + 1,
|
|
3529
3601
|
"/",
|
|
3530
3602
|
profileNames.length
|
|
@@ -3534,23 +3606,23 @@ function ProfileListMode({ profileNames, cursor, confirmDelete, loadError, onCon
|
|
|
3534
3606
|
}
|
|
3535
3607
|
|
|
3536
3608
|
// src/views/profiles/profile-detail-mode.tsx
|
|
3537
|
-
import { Box as Box22, Text as
|
|
3538
|
-
import { jsx as
|
|
3609
|
+
import { Box as Box22, Text as Text25 } from "ink";
|
|
3610
|
+
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3539
3611
|
function ProfileDetailMode({ profile }) {
|
|
3540
3612
|
return /* @__PURE__ */ jsxs23(Box22, { flexDirection: "column", children: [
|
|
3541
|
-
/* @__PURE__ */
|
|
3542
|
-
/* @__PURE__ */
|
|
3543
|
-
/* @__PURE__ */
|
|
3613
|
+
/* @__PURE__ */ jsx25(Text25, { bold: true, color: COLORS.gold, children: profile.name }),
|
|
3614
|
+
/* @__PURE__ */ jsx25(Text25, { color: COLORS.muted, children: profile.description }),
|
|
3615
|
+
/* @__PURE__ */ jsx25(Text25, { color: COLORS.muted, children: t("profiles_created", { date: formatDate(profile.createdAt) }) }),
|
|
3544
3616
|
/* @__PURE__ */ jsxs23(Box22, { marginTop: SPACING.xs, flexDirection: "column", children: [
|
|
3545
|
-
/* @__PURE__ */
|
|
3617
|
+
/* @__PURE__ */ jsx25(Text25, { bold: true, children: t("profiles_formulaeCount", { count: profile.formulae.length }) }),
|
|
3546
3618
|
/* @__PURE__ */ jsxs23(Box22, { paddingLeft: SPACING.sm, flexDirection: "column", children: [
|
|
3547
|
-
profile.formulae.slice(0, 30).map((f) => /* @__PURE__ */
|
|
3548
|
-
profile.formulae.length > 30 && /* @__PURE__ */
|
|
3619
|
+
profile.formulae.slice(0, 30).map((f) => /* @__PURE__ */ jsx25(Text25, { color: COLORS.muted, children: f }, f)),
|
|
3620
|
+
profile.formulae.length > 30 && /* @__PURE__ */ jsx25(Text25, { color: COLORS.textSecondary, italic: true, children: t("common_andMore", { count: profile.formulae.length - 30 }) })
|
|
3549
3621
|
] }),
|
|
3550
|
-
/* @__PURE__ */
|
|
3551
|
-
/* @__PURE__ */
|
|
3622
|
+
/* @__PURE__ */ jsx25(Text25, { bold: true, children: t("profiles_casksCount", { count: profile.casks.length }) }),
|
|
3623
|
+
/* @__PURE__ */ jsx25(Box22, { paddingLeft: SPACING.sm, flexDirection: "column", children: profile.casks.map((c) => /* @__PURE__ */ jsx25(Text25, { color: COLORS.muted, children: c }, c)) })
|
|
3552
3624
|
] }),
|
|
3553
|
-
/* @__PURE__ */
|
|
3625
|
+
/* @__PURE__ */ jsx25(Box22, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs23(Text25, { color: COLORS.textSecondary, children: [
|
|
3554
3626
|
"esc:",
|
|
3555
3627
|
t("hint_back"),
|
|
3556
3628
|
" e:",
|
|
@@ -3562,13 +3634,13 @@ function ProfileDetailMode({ profile }) {
|
|
|
3562
3634
|
}
|
|
3563
3635
|
|
|
3564
3636
|
// src/views/profiles/profile-create-flow.tsx
|
|
3565
|
-
import { Box as Box23, Text as
|
|
3637
|
+
import { Box as Box23, Text as Text26 } from "ink";
|
|
3566
3638
|
import { TextInput as TextInput3 } from "@inkjs/ui";
|
|
3567
|
-
import { jsx as
|
|
3639
|
+
import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3568
3640
|
function ProfileCreateName({ onSubmit }) {
|
|
3569
3641
|
return /* @__PURE__ */ jsxs24(Box23, { flexDirection: "column", children: [
|
|
3570
|
-
/* @__PURE__ */
|
|
3571
|
-
/* @__PURE__ */
|
|
3642
|
+
/* @__PURE__ */ jsx26(Text26, { bold: true, children: t("profiles_createName") }),
|
|
3643
|
+
/* @__PURE__ */ jsx26(
|
|
3572
3644
|
TextInput3,
|
|
3573
3645
|
{
|
|
3574
3646
|
placeholder: t("profiles_namePlaceholder"),
|
|
@@ -3579,12 +3651,12 @@ function ProfileCreateName({ onSubmit }) {
|
|
|
3579
3651
|
}
|
|
3580
3652
|
function ProfileCreateDesc({ name, loadError, onSubmit }) {
|
|
3581
3653
|
return /* @__PURE__ */ jsxs24(Box23, { flexDirection: "column", children: [
|
|
3582
|
-
/* @__PURE__ */
|
|
3583
|
-
loadError && /* @__PURE__ */ jsxs24(
|
|
3654
|
+
/* @__PURE__ */ jsx26(Text26, { bold: true, children: t("profiles_createDesc", { name }) }),
|
|
3655
|
+
loadError && /* @__PURE__ */ jsxs24(Text26, { color: COLORS.error, children: [
|
|
3584
3656
|
t("error_prefix"),
|
|
3585
3657
|
loadError
|
|
3586
3658
|
] }),
|
|
3587
|
-
/* @__PURE__ */
|
|
3659
|
+
/* @__PURE__ */ jsx26(
|
|
3588
3660
|
TextInput3,
|
|
3589
3661
|
{
|
|
3590
3662
|
placeholder: t("profiles_descPlaceholder"),
|
|
@@ -3595,13 +3667,13 @@ function ProfileCreateDesc({ name, loadError, onSubmit }) {
|
|
|
3595
3667
|
}
|
|
3596
3668
|
|
|
3597
3669
|
// src/views/profiles/profile-edit-flow.tsx
|
|
3598
|
-
import { Box as Box24, Text as
|
|
3670
|
+
import { Box as Box24, Text as Text27 } from "ink";
|
|
3599
3671
|
import { TextInput as TextInput4 } from "@inkjs/ui";
|
|
3600
|
-
import { jsx as
|
|
3672
|
+
import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3601
3673
|
function ProfileEditName({ defaultName, onSubmit }) {
|
|
3602
3674
|
return /* @__PURE__ */ jsxs25(Box24, { flexDirection: "column", children: [
|
|
3603
|
-
/* @__PURE__ */
|
|
3604
|
-
/* @__PURE__ */
|
|
3675
|
+
/* @__PURE__ */ jsx27(Text27, { bold: true, children: t("profiles_editName") }),
|
|
3676
|
+
/* @__PURE__ */ jsx27(
|
|
3605
3677
|
TextInput4,
|
|
3606
3678
|
{
|
|
3607
3679
|
defaultValue: defaultName,
|
|
@@ -3612,12 +3684,12 @@ function ProfileEditName({ defaultName, onSubmit }) {
|
|
|
3612
3684
|
}
|
|
3613
3685
|
function ProfileEditDesc({ name, defaultDesc, loadError, onSubmit }) {
|
|
3614
3686
|
return /* @__PURE__ */ jsxs25(Box24, { flexDirection: "column", children: [
|
|
3615
|
-
/* @__PURE__ */
|
|
3616
|
-
loadError && /* @__PURE__ */ jsxs25(
|
|
3687
|
+
/* @__PURE__ */ jsx27(Text27, { bold: true, children: t("profiles_editDesc", { name }) }),
|
|
3688
|
+
loadError && /* @__PURE__ */ jsxs25(Text27, { color: COLORS.error, children: [
|
|
3617
3689
|
t("error_prefix"),
|
|
3618
3690
|
loadError
|
|
3619
3691
|
] }),
|
|
3620
|
-
/* @__PURE__ */
|
|
3692
|
+
/* @__PURE__ */ jsx27(
|
|
3621
3693
|
TextInput4,
|
|
3622
3694
|
{
|
|
3623
3695
|
defaultValue: defaultDesc,
|
|
@@ -3628,26 +3700,26 @@ function ProfileEditDesc({ name, defaultDesc, loadError, onSubmit }) {
|
|
|
3628
3700
|
}
|
|
3629
3701
|
|
|
3630
3702
|
// src/views/profiles.tsx
|
|
3631
|
-
import { jsx as
|
|
3703
|
+
import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3632
3704
|
function ProfilesView() {
|
|
3633
3705
|
const { profileNames, selectedProfile, loading, loadError, fetchProfiles, loadProfile: loadProfile2, exportCurrent, deleteProfile: deleteProfile2, updateProfile: updateProfile2 } = useProfileStore();
|
|
3634
|
-
const [cursor, setCursor] =
|
|
3635
|
-
const [mode, setMode] =
|
|
3636
|
-
const [newName, setNewName] =
|
|
3637
|
-
const [confirmDelete, setConfirmDelete] =
|
|
3638
|
-
const [editName, setEditName] =
|
|
3639
|
-
const [editDesc, setEditDesc] =
|
|
3640
|
-
const [importLines, setImportLines] =
|
|
3641
|
-
const [importRunning, setImportRunning] =
|
|
3642
|
-
const [importHadError, setImportHadError] =
|
|
3643
|
-
const [importProfile2, setImportProfile] =
|
|
3706
|
+
const [cursor, setCursor] = useState11(0);
|
|
3707
|
+
const [mode, setMode] = useState11("list");
|
|
3708
|
+
const [newName, setNewName] = useState11("");
|
|
3709
|
+
const [confirmDelete, setConfirmDelete] = useState11(false);
|
|
3710
|
+
const [editName, setEditName] = useState11("");
|
|
3711
|
+
const [editDesc, setEditDesc] = useState11("");
|
|
3712
|
+
const [importLines, setImportLines] = useState11([]);
|
|
3713
|
+
const [importRunning, setImportRunning] = useState11(false);
|
|
3714
|
+
const [importHadError, setImportHadError] = useState11(false);
|
|
3715
|
+
const [importProfile2, setImportProfile] = useState11(null);
|
|
3644
3716
|
const { openModal, closeModal } = useModalStore();
|
|
3645
|
-
const importGenRef =
|
|
3646
|
-
const mountedRef =
|
|
3647
|
-
|
|
3717
|
+
const importGenRef = useRef7(null);
|
|
3718
|
+
const mountedRef = useRef7(true);
|
|
3719
|
+
useEffect15(() => {
|
|
3648
3720
|
fetchProfiles();
|
|
3649
3721
|
}, []);
|
|
3650
|
-
|
|
3722
|
+
useEffect15(() => {
|
|
3651
3723
|
mountedRef.current = true;
|
|
3652
3724
|
return () => {
|
|
3653
3725
|
mountedRef.current = false;
|
|
@@ -3655,7 +3727,7 @@ function ProfilesView() {
|
|
|
3655
3727
|
importGenRef.current = null;
|
|
3656
3728
|
};
|
|
3657
3729
|
}, []);
|
|
3658
|
-
|
|
3730
|
+
useEffect15(() => {
|
|
3659
3731
|
if (mode !== "list") {
|
|
3660
3732
|
openModal();
|
|
3661
3733
|
return () => {
|
|
@@ -3737,9 +3809,9 @@ function ProfilesView() {
|
|
|
3737
3809
|
}
|
|
3738
3810
|
}
|
|
3739
3811
|
};
|
|
3740
|
-
if (loading) return /* @__PURE__ */
|
|
3812
|
+
if (loading) return /* @__PURE__ */ jsx28(Loading, { message: t("loading_profiles") });
|
|
3741
3813
|
if (mode === "confirm-import" && importProfile2) {
|
|
3742
|
-
return /* @__PURE__ */
|
|
3814
|
+
return /* @__PURE__ */ jsx28(Box25, { flexDirection: "column", children: /* @__PURE__ */ jsx28(
|
|
3743
3815
|
ConfirmDialog,
|
|
3744
3816
|
{
|
|
3745
3817
|
message: t("profiles_importSummary", {
|
|
@@ -3760,18 +3832,18 @@ function ProfilesView() {
|
|
|
3760
3832
|
}
|
|
3761
3833
|
if (mode === "importing") {
|
|
3762
3834
|
return /* @__PURE__ */ jsxs26(Box25, { flexDirection: "column", children: [
|
|
3763
|
-
/* @__PURE__ */
|
|
3764
|
-
!importRunning && /* @__PURE__ */
|
|
3835
|
+
/* @__PURE__ */ jsx28(ProgressLog, { lines: importLines, isRunning: importRunning, title: t("profiles_importTitle") }),
|
|
3836
|
+
!importRunning && /* @__PURE__ */ jsx28(Box25, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx28(ResultBanner, { status: importHadError ? "error" : "success", message: importHadError ? t("profiles_importPartial") : `\u2714 ${t("profiles_importComplete")}` }) })
|
|
3765
3837
|
] });
|
|
3766
3838
|
}
|
|
3767
3839
|
if (mode === "create-name") {
|
|
3768
|
-
return /* @__PURE__ */
|
|
3840
|
+
return /* @__PURE__ */ jsx28(ProfileCreateName, { onSubmit: (val) => {
|
|
3769
3841
|
setNewName(val);
|
|
3770
3842
|
setMode("create-desc");
|
|
3771
3843
|
} });
|
|
3772
3844
|
}
|
|
3773
3845
|
if (mode === "create-desc") {
|
|
3774
|
-
return /* @__PURE__ */
|
|
3846
|
+
return /* @__PURE__ */ jsx28(
|
|
3775
3847
|
ProfileCreateDesc,
|
|
3776
3848
|
{
|
|
3777
3849
|
name: newName,
|
|
@@ -3788,13 +3860,13 @@ function ProfilesView() {
|
|
|
3788
3860
|
);
|
|
3789
3861
|
}
|
|
3790
3862
|
if (mode === "edit-name") {
|
|
3791
|
-
return /* @__PURE__ */
|
|
3863
|
+
return /* @__PURE__ */ jsx28(ProfileEditName, { defaultName: editName, onSubmit: (val) => {
|
|
3792
3864
|
setEditName(val);
|
|
3793
3865
|
setMode("edit-desc");
|
|
3794
3866
|
} });
|
|
3795
3867
|
}
|
|
3796
3868
|
if (mode === "edit-desc") {
|
|
3797
|
-
return /* @__PURE__ */
|
|
3869
|
+
return /* @__PURE__ */ jsx28(
|
|
3798
3870
|
ProfileEditDesc,
|
|
3799
3871
|
{
|
|
3800
3872
|
name: editName,
|
|
@@ -3812,9 +3884,9 @@ function ProfilesView() {
|
|
|
3812
3884
|
);
|
|
3813
3885
|
}
|
|
3814
3886
|
if (mode === "detail" && selectedProfile) {
|
|
3815
|
-
return /* @__PURE__ */
|
|
3887
|
+
return /* @__PURE__ */ jsx28(ProfileDetailMode, { profile: selectedProfile });
|
|
3816
3888
|
}
|
|
3817
|
-
return /* @__PURE__ */
|
|
3889
|
+
return /* @__PURE__ */ jsx28(
|
|
3818
3890
|
ProfileListMode,
|
|
3819
3891
|
{
|
|
3820
3892
|
profileNames,
|
|
@@ -3831,8 +3903,8 @@ function ProfilesView() {
|
|
|
3831
3903
|
}
|
|
3832
3904
|
|
|
3833
3905
|
// src/views/smart-cleanup.tsx
|
|
3834
|
-
import { useEffect as
|
|
3835
|
-
import { Box as Box26, Text as
|
|
3906
|
+
import { useEffect as useEffect16, useRef as useRef8, useState as useState12 } from "react";
|
|
3907
|
+
import { Box as Box26, Text as Text28 } from "ink";
|
|
3836
3908
|
|
|
3837
3909
|
// src/stores/cleanup-store.ts
|
|
3838
3910
|
import { create as create10 } from "zustand";
|
|
@@ -3952,19 +4024,19 @@ var useCleanupStore = create10((set, get) => ({
|
|
|
3952
4024
|
}));
|
|
3953
4025
|
|
|
3954
4026
|
// src/views/smart-cleanup.tsx
|
|
3955
|
-
import { jsx as
|
|
4027
|
+
import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3956
4028
|
function SmartCleanupView() {
|
|
3957
4029
|
const { summary, selected, loading, error, analyze, toggleSelect, selectAll } = useCleanupStore();
|
|
3958
|
-
const [cursor, setCursor] =
|
|
3959
|
-
const [confirmClean, setConfirmClean] =
|
|
3960
|
-
const [confirmForce, setConfirmForce] =
|
|
3961
|
-
const [failedNames, setFailedNames] =
|
|
4030
|
+
const [cursor, setCursor] = useState12(0);
|
|
4031
|
+
const [confirmClean, setConfirmClean] = useState12(false);
|
|
4032
|
+
const [confirmForce, setConfirmForce] = useState12(false);
|
|
4033
|
+
const [failedNames, setFailedNames] = useState12([]);
|
|
3962
4034
|
const stream = useBrewStream();
|
|
3963
|
-
const hasRefreshed =
|
|
3964
|
-
|
|
4035
|
+
const hasRefreshed = useRef8(false);
|
|
4036
|
+
useEffect16(() => {
|
|
3965
4037
|
analyze();
|
|
3966
4038
|
}, []);
|
|
3967
|
-
|
|
4039
|
+
useEffect16(() => {
|
|
3968
4040
|
if (!stream.isRunning && !stream.error && stream.lines.length > 0 && !hasRefreshed.current) {
|
|
3969
4041
|
hasRefreshed.current = true;
|
|
3970
4042
|
void analyze();
|
|
@@ -4003,26 +4075,26 @@ function SmartCleanupView() {
|
|
|
4003
4075
|
if (input === "j" || key.downArrow) setCursor((c) => Math.min(c + 1, Math.max(0, candidates.length - 1)));
|
|
4004
4076
|
else if (input === "k" || key.upArrow) setCursor((c) => Math.max(c - 1, 0));
|
|
4005
4077
|
});
|
|
4006
|
-
if (loading) return /* @__PURE__ */
|
|
4007
|
-
if (error) return /* @__PURE__ */
|
|
4078
|
+
if (loading) return /* @__PURE__ */ jsx29(Loading, { message: t("loading_cleanup") });
|
|
4079
|
+
if (error) return /* @__PURE__ */ jsx29(ErrorMessage, { message: error });
|
|
4008
4080
|
if (stream.isRunning || stream.lines.length > 0) {
|
|
4009
4081
|
return /* @__PURE__ */ jsxs27(Box26, { flexDirection: "column", children: [
|
|
4010
|
-
/* @__PURE__ */
|
|
4011
|
-
stream.isRunning && /* @__PURE__ */ jsxs27(
|
|
4082
|
+
/* @__PURE__ */ jsx29(ProgressLog, { lines: stream.lines, isRunning: stream.isRunning, title: t("cleanup_cleaning") }),
|
|
4083
|
+
stream.isRunning && /* @__PURE__ */ jsxs27(Text28, { color: COLORS.muted, children: [
|
|
4012
4084
|
"esc:",
|
|
4013
4085
|
t("hint_cancel")
|
|
4014
4086
|
] }),
|
|
4015
|
-
!stream.isRunning && !stream.error && /* @__PURE__ */
|
|
4087
|
+
!stream.isRunning && !stream.error && /* @__PURE__ */ jsx29(ResultBanner, { status: "success", message: `\u2714 ${t("cleanup_complete")}` }),
|
|
4016
4088
|
!stream.isRunning && stream.error && /* @__PURE__ */ jsxs27(Box26, { flexDirection: "column", gap: SPACING.xs, children: [
|
|
4017
|
-
/* @__PURE__ */
|
|
4018
|
-
isDependencyError && failedNames.length > 0 && /* @__PURE__ */ jsxs27(
|
|
4089
|
+
/* @__PURE__ */ jsx29(ResultBanner, { status: "error", message: `\u2718 ${t("cleanup_depError")}` }),
|
|
4090
|
+
isDependencyError && failedNames.length > 0 && /* @__PURE__ */ jsxs27(Text28, { color: COLORS.warning, children: [
|
|
4019
4091
|
"F:",
|
|
4020
4092
|
t("hint_force"),
|
|
4021
4093
|
" r:",
|
|
4022
4094
|
t("hint_refresh")
|
|
4023
4095
|
] })
|
|
4024
4096
|
] }),
|
|
4025
|
-
confirmForce && /* @__PURE__ */
|
|
4097
|
+
confirmForce && /* @__PURE__ */ jsx29(Box26, { marginY: SPACING.xs, children: /* @__PURE__ */ jsx29(
|
|
4026
4098
|
ConfirmDialog,
|
|
4027
4099
|
{
|
|
4028
4100
|
message: t("cleanup_confirmForce", { count: failedNames.length }),
|
|
@@ -4038,15 +4110,15 @@ function SmartCleanupView() {
|
|
|
4038
4110
|
] });
|
|
4039
4111
|
}
|
|
4040
4112
|
return /* @__PURE__ */ jsxs27(Box26, { flexDirection: "column", children: [
|
|
4041
|
-
/* @__PURE__ */
|
|
4113
|
+
/* @__PURE__ */ jsx29(SectionHeader, { emoji: "\u{1F9F9}", title: t("cleanup_title"), gradient: GRADIENTS.emerald }),
|
|
4042
4114
|
summary && /* @__PURE__ */ jsxs27(Box26, { gap: SPACING.xs, marginY: SPACING.xs, children: [
|
|
4043
|
-
/* @__PURE__ */
|
|
4044
|
-
/* @__PURE__ */
|
|
4045
|
-
/* @__PURE__ */
|
|
4115
|
+
/* @__PURE__ */ jsx29(StatCard, { label: t("cleanup_orphans"), value: candidates.length, color: candidates.length > 0 ? COLORS.warning : COLORS.success }),
|
|
4116
|
+
/* @__PURE__ */ jsx29(StatCard, { label: t("cleanup_reclaimable"), value: summary.totalReclaimableFormatted, color: COLORS.sky }),
|
|
4117
|
+
/* @__PURE__ */ jsx29(StatCard, { label: t("cleanup_selected"), value: selected.size, color: selected.size > 0 ? COLORS.success : COLORS.muted })
|
|
4046
4118
|
] }),
|
|
4047
4119
|
confirmClean && /* @__PURE__ */ jsxs27(Box26, { flexDirection: "column", marginY: SPACING.xs, gap: SPACING.xs, children: [
|
|
4048
|
-
/* @__PURE__ */
|
|
4049
|
-
/* @__PURE__ */
|
|
4120
|
+
/* @__PURE__ */ jsx29(Box26, { borderStyle: "round", borderColor: COLORS.warning, paddingX: SPACING.sm, paddingY: SPACING.none, children: /* @__PURE__ */ jsx29(Text28, { color: COLORS.warning, children: t("cleanup_warning_system_tools") }) }),
|
|
4121
|
+
/* @__PURE__ */ jsx29(
|
|
4050
4122
|
ConfirmDialog,
|
|
4051
4123
|
{
|
|
4052
4124
|
message: t("cleanup_confirmUninstall", { count: selected.size }),
|
|
@@ -4061,23 +4133,23 @@ function SmartCleanupView() {
|
|
|
4061
4133
|
}
|
|
4062
4134
|
)
|
|
4063
4135
|
] }),
|
|
4064
|
-
candidates.length === 0 && !confirmClean && /* @__PURE__ */
|
|
4136
|
+
candidates.length === 0 && !confirmClean && /* @__PURE__ */ jsx29(ResultBanner, { status: "success", message: `\u2714 ${t("cleanup_systemClean")}` }),
|
|
4065
4137
|
candidates.length > 0 && !confirmClean && /* @__PURE__ */ jsxs27(Box26, { flexDirection: "column", children: [
|
|
4066
4138
|
candidates.map((c, i) => {
|
|
4067
4139
|
const isCurrent = i === cursor;
|
|
4068
4140
|
const isSelected = selected.has(c.name);
|
|
4069
4141
|
return /* @__PURE__ */ jsxs27(SelectableRow, { isCurrent, children: [
|
|
4070
|
-
/* @__PURE__ */
|
|
4071
|
-
/* @__PURE__ */
|
|
4072
|
-
/* @__PURE__ */
|
|
4073
|
-
/* @__PURE__ */ jsxs27(
|
|
4142
|
+
/* @__PURE__ */ jsx29(Text28, { color: isSelected ? COLORS.success : COLORS.muted, children: isSelected ? "\u2611" : "\u2610" }),
|
|
4143
|
+
/* @__PURE__ */ jsx29(Text28, { bold: isCurrent, inverse: isCurrent, color: isCurrent ? COLORS.text : COLORS.muted, children: c.name }),
|
|
4144
|
+
/* @__PURE__ */ jsx29(Text28, { color: COLORS.warning, children: c.diskUsageFormatted }),
|
|
4145
|
+
/* @__PURE__ */ jsxs27(Text28, { color: COLORS.textSecondary, children: [
|
|
4074
4146
|
"[",
|
|
4075
4147
|
c.reason,
|
|
4076
4148
|
"]"
|
|
4077
4149
|
] })
|
|
4078
4150
|
] }, c.name);
|
|
4079
4151
|
}),
|
|
4080
|
-
/* @__PURE__ */
|
|
4152
|
+
/* @__PURE__ */ jsx29(Box26, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs27(Text28, { color: COLORS.text, bold: true, children: [
|
|
4081
4153
|
cursor + 1,
|
|
4082
4154
|
"/",
|
|
4083
4155
|
candidates.length
|
|
@@ -4087,8 +4159,8 @@ function SmartCleanupView() {
|
|
|
4087
4159
|
}
|
|
4088
4160
|
|
|
4089
4161
|
// src/views/history.tsx
|
|
4090
|
-
import { useEffect as
|
|
4091
|
-
import { Box as Box27, Text as
|
|
4162
|
+
import { useEffect as useEffect17, useState as useState13, useMemo as useMemo5 } from "react";
|
|
4163
|
+
import { Box as Box27, Text as Text29, useStdout as useStdout6 } from "ink";
|
|
4092
4164
|
|
|
4093
4165
|
// src/stores/history-store.ts
|
|
4094
4166
|
import { create as create11 } from "zustand";
|
|
@@ -4124,7 +4196,7 @@ var useHistoryStore = create11((set) => ({
|
|
|
4124
4196
|
}));
|
|
4125
4197
|
|
|
4126
4198
|
// src/views/history.tsx
|
|
4127
|
-
import { jsx as
|
|
4199
|
+
import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
4128
4200
|
var ACTION_ICONS = {
|
|
4129
4201
|
install: { icon: "+", color: COLORS.success },
|
|
4130
4202
|
uninstall: { icon: "-", color: COLORS.error },
|
|
@@ -4140,21 +4212,21 @@ var ACTION_LABEL_KEYS = {
|
|
|
4140
4212
|
var FILTERS = ["all", "install", "uninstall", "upgrade", "upgrade-all"];
|
|
4141
4213
|
function HistoryView() {
|
|
4142
4214
|
const { entries, loading, error, fetchHistory, clearHistory: clearHistory2 } = useHistoryStore();
|
|
4143
|
-
const [cursor, setCursor] =
|
|
4144
|
-
const [filter, setFilter] =
|
|
4145
|
-
const [searchQuery, setSearchQuery] =
|
|
4146
|
-
const [isSearching, setIsSearching] =
|
|
4147
|
-
const [confirmClear, setConfirmClear] =
|
|
4148
|
-
const [confirmReplay, setConfirmReplay] =
|
|
4215
|
+
const [cursor, setCursor] = useState13(0);
|
|
4216
|
+
const [filter, setFilter] = useState13("all");
|
|
4217
|
+
const [searchQuery, setSearchQuery] = useState13("");
|
|
4218
|
+
const [isSearching, setIsSearching] = useState13(false);
|
|
4219
|
+
const [confirmClear, setConfirmClear] = useState13(false);
|
|
4220
|
+
const [confirmReplay, setConfirmReplay] = useState13(null);
|
|
4149
4221
|
const stream = useBrewStream();
|
|
4150
4222
|
const debouncedQuery = useDebounce(searchQuery, 200);
|
|
4151
4223
|
const { openModal, closeModal } = useModalStore();
|
|
4152
|
-
const { stdout } =
|
|
4224
|
+
const { stdout } = useStdout6();
|
|
4153
4225
|
const MAX_VISIBLE_ROWS = Math.max(5, (stdout?.rows ?? 24) - 8);
|
|
4154
|
-
|
|
4226
|
+
useEffect17(() => {
|
|
4155
4227
|
fetchHistory();
|
|
4156
4228
|
}, []);
|
|
4157
|
-
|
|
4229
|
+
useEffect17(() => {
|
|
4158
4230
|
if (isSearching) {
|
|
4159
4231
|
openModal();
|
|
4160
4232
|
return () => {
|
|
@@ -4204,17 +4276,17 @@ function HistoryView() {
|
|
|
4204
4276
|
if (input === "j" || key.downArrow) setCursor((c) => Math.min(c + 1, Math.max(0, filtered.length - 1)));
|
|
4205
4277
|
else if (input === "k" || key.upArrow) setCursor((c) => Math.max(c - 1, 0));
|
|
4206
4278
|
});
|
|
4207
|
-
if (loading) return /* @__PURE__ */
|
|
4208
|
-
if (error) return /* @__PURE__ */
|
|
4279
|
+
if (loading) return /* @__PURE__ */ jsx30(Loading, { message: t("loading_history") });
|
|
4280
|
+
if (error) return /* @__PURE__ */ jsx30(ErrorMessage, { message: error });
|
|
4209
4281
|
const start = Math.max(0, cursor - Math.floor(MAX_VISIBLE_ROWS / 2));
|
|
4210
4282
|
const visible = filtered.slice(start, start + MAX_VISIBLE_ROWS);
|
|
4211
4283
|
return /* @__PURE__ */ jsxs28(Box27, { flexDirection: "column", children: [
|
|
4212
4284
|
/* @__PURE__ */ jsxs28(Box27, { gap: SPACING.sm, marginBottom: SPACING.xs, children: [
|
|
4213
|
-
/* @__PURE__ */
|
|
4214
|
-
/* @__PURE__ */
|
|
4285
|
+
/* @__PURE__ */ jsx30(SectionHeader, { emoji: "\u{1F4DC}", title: t("history_title", { count: filtered.length }), gradient: GRADIENTS.gold }),
|
|
4286
|
+
/* @__PURE__ */ jsx30(Text29, { color: filter === "all" ? COLORS.text : COLORS.gold, children: t("history_filterLabel", { filter }) })
|
|
4215
4287
|
] }),
|
|
4216
|
-
isSearching && /* @__PURE__ */
|
|
4217
|
-
confirmClear && /* @__PURE__ */
|
|
4288
|
+
isSearching && /* @__PURE__ */ jsx30(Box27, { marginBottom: SPACING.xs, children: /* @__PURE__ */ jsx30(SearchInput, { defaultValue: searchQuery, onChange: setSearchQuery, placeholder: t("history_searchPlaceholder"), isActive: true }) }),
|
|
4289
|
+
confirmClear && /* @__PURE__ */ jsx30(
|
|
4218
4290
|
ConfirmDialog,
|
|
4219
4291
|
{
|
|
4220
4292
|
message: t("history_confirmClear", { count: entries.length }),
|
|
@@ -4225,7 +4297,7 @@ function HistoryView() {
|
|
|
4225
4297
|
onCancel: () => setConfirmClear(false)
|
|
4226
4298
|
}
|
|
4227
4299
|
),
|
|
4228
|
-
confirmReplay && /* @__PURE__ */
|
|
4300
|
+
confirmReplay && /* @__PURE__ */ jsx30(
|
|
4229
4301
|
ConfirmDialog,
|
|
4230
4302
|
{
|
|
4231
4303
|
message: confirmReplay.action === "upgrade-all" ? t("history_replayAll") + "\n" + t("upgrade_all_warning") : t("history_confirmReplay", { action: t(ACTION_LABEL_KEYS[confirmReplay.action]), name: confirmReplay.packageName ?? "" }),
|
|
@@ -4253,10 +4325,10 @@ function HistoryView() {
|
|
|
4253
4325
|
onCancel: () => setConfirmReplay(null)
|
|
4254
4326
|
}
|
|
4255
4327
|
),
|
|
4256
|
-
(stream.isRunning || stream.lines.length > 0) && /* @__PURE__ */
|
|
4257
|
-
filtered.length === 0 && !confirmClear && /* @__PURE__ */
|
|
4328
|
+
(stream.isRunning || stream.lines.length > 0) && /* @__PURE__ */ jsx30(Box27, { marginY: SPACING.xs, children: /* @__PURE__ */ jsx30(ProgressLog, { lines: stream.lines, isRunning: stream.isRunning, title: t("hint_replay") }) }),
|
|
4329
|
+
filtered.length === 0 && !confirmClear && /* @__PURE__ */ jsx30(Text29, { color: COLORS.textSecondary, italic: true, children: filter !== "all" ? t("history_noEntriesFor", { filter }) : t("history_noEntries") }),
|
|
4258
4330
|
filtered.length > 0 && !confirmClear && /* @__PURE__ */ jsxs28(Box27, { flexDirection: "column", children: [
|
|
4259
|
-
start > 0 && /* @__PURE__ */ jsxs28(
|
|
4331
|
+
start > 0 && /* @__PURE__ */ jsxs28(Text29, { color: COLORS.textSecondary, dimColor: true, children: [
|
|
4260
4332
|
" ",
|
|
4261
4333
|
t("scroll_moreAbove", { count: start })
|
|
4262
4334
|
] }),
|
|
@@ -4266,18 +4338,18 @@ function HistoryView() {
|
|
|
4266
4338
|
const { icon, color } = ACTION_ICONS[entry.action];
|
|
4267
4339
|
const ts = new Date(entry.timestamp).getTime() / 1e3;
|
|
4268
4340
|
return /* @__PURE__ */ jsxs28(SelectableRow, { isCurrent, children: [
|
|
4269
|
-
/* @__PURE__ */
|
|
4270
|
-
/* @__PURE__ */
|
|
4271
|
-
/* @__PURE__ */
|
|
4272
|
-
entry.success ? /* @__PURE__ */
|
|
4273
|
-
/* @__PURE__ */
|
|
4341
|
+
/* @__PURE__ */ jsx30(Text29, { color, bold: true, children: icon }),
|
|
4342
|
+
/* @__PURE__ */ jsx30(Text29, { bold: isCurrent, inverse: isCurrent, color: isCurrent ? COLORS.text : COLORS.muted, children: t(ACTION_LABEL_KEYS[entry.action]).padEnd(12) }),
|
|
4343
|
+
/* @__PURE__ */ jsx30(Text29, { color: COLORS.text, children: entry.packageName ?? t("history_all") }),
|
|
4344
|
+
entry.success ? /* @__PURE__ */ jsx30(StatusBadge, { label: t("badge_ok"), variant: "success" }) : /* @__PURE__ */ jsx30(StatusBadge, { label: t("badge_fail"), variant: "error" }),
|
|
4345
|
+
/* @__PURE__ */ jsx30(Text29, { color: COLORS.muted, children: formatRelativeTime(ts) })
|
|
4274
4346
|
] }, entry.id);
|
|
4275
4347
|
}),
|
|
4276
|
-
start + MAX_VISIBLE_ROWS < filtered.length && /* @__PURE__ */ jsxs28(
|
|
4348
|
+
start + MAX_VISIBLE_ROWS < filtered.length && /* @__PURE__ */ jsxs28(Text29, { color: COLORS.textSecondary, dimColor: true, children: [
|
|
4277
4349
|
" ",
|
|
4278
4350
|
t("scroll_moreBelow", { count: filtered.length - start - MAX_VISIBLE_ROWS })
|
|
4279
4351
|
] }),
|
|
4280
|
-
/* @__PURE__ */
|
|
4352
|
+
/* @__PURE__ */ jsx30(Box27, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs28(Text29, { color: COLORS.text, bold: true, children: [
|
|
4281
4353
|
cursor + 1,
|
|
4282
4354
|
"/",
|
|
4283
4355
|
filtered.length
|
|
@@ -4287,9 +4359,9 @@ function HistoryView() {
|
|
|
4287
4359
|
}
|
|
4288
4360
|
|
|
4289
4361
|
// src/views/security-audit.tsx
|
|
4290
|
-
import { useEffect as
|
|
4291
|
-
import { Box as Box28, Text as
|
|
4292
|
-
import { jsx as
|
|
4362
|
+
import { useEffect as useEffect18, useState as useState14 } from "react";
|
|
4363
|
+
import { Box as Box28, Text as Text30 } from "ink";
|
|
4364
|
+
import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
4293
4365
|
var SEVERITY_COLORS = {
|
|
4294
4366
|
CRITICAL: COLORS.error,
|
|
4295
4367
|
HIGH: COLORS.error,
|
|
@@ -4310,11 +4382,11 @@ function isNetworkError(msg) {
|
|
|
4310
4382
|
function SecurityAuditView() {
|
|
4311
4383
|
const { summary, loading, error, scan, cachedAt } = useSecurityStore();
|
|
4312
4384
|
const navigate = useNavigationStore((s) => s.navigate);
|
|
4313
|
-
const [cursor, setCursor] =
|
|
4314
|
-
const [expandedPkg, setExpandedPkg] =
|
|
4315
|
-
const [confirmUpgrade, setConfirmUpgrade] =
|
|
4385
|
+
const [cursor, setCursor] = useState14(0);
|
|
4386
|
+
const [expandedPkg, setExpandedPkg] = useState14(null);
|
|
4387
|
+
const [confirmUpgrade, setConfirmUpgrade] = useState14(null);
|
|
4316
4388
|
const stream = useBrewStream();
|
|
4317
|
-
|
|
4389
|
+
useEffect18(() => {
|
|
4318
4390
|
scan();
|
|
4319
4391
|
}, []);
|
|
4320
4392
|
const results = summary?.results ?? [];
|
|
@@ -4338,17 +4410,17 @@ function SecurityAuditView() {
|
|
|
4338
4410
|
setExpandedPkg(expandedPkg === results[cursor].packageName ? null : results[cursor].packageName);
|
|
4339
4411
|
}
|
|
4340
4412
|
});
|
|
4341
|
-
if (loading) return /* @__PURE__ */
|
|
4413
|
+
if (loading) return /* @__PURE__ */ jsx31(Loading, { message: t("loading_security") });
|
|
4342
4414
|
if (error) {
|
|
4343
4415
|
const displayError = isNetworkError(error) ? t("security_networkError") : error;
|
|
4344
|
-
return /* @__PURE__ */
|
|
4416
|
+
return /* @__PURE__ */ jsx31(ErrorMessage, { message: displayError });
|
|
4345
4417
|
}
|
|
4346
4418
|
const cacheAge = cachedAt ? formatRelativeTime(cachedAt / 1e3) : null;
|
|
4347
4419
|
return /* @__PURE__ */ jsxs29(Box28, { flexDirection: "column", children: [
|
|
4348
|
-
/* @__PURE__ */
|
|
4420
|
+
/* @__PURE__ */ jsx31(SectionHeader, { emoji: "\u{1F6E1}\uFE0F", title: t("security_title"), gradient: GRADIENTS.ocean }),
|
|
4349
4421
|
summary && /* @__PURE__ */ jsxs29(Box28, { gap: SPACING.xs, marginY: SPACING.xs, children: [
|
|
4350
|
-
/* @__PURE__ */
|
|
4351
|
-
/* @__PURE__ */
|
|
4422
|
+
/* @__PURE__ */ jsx31(StatCard, { label: t("security_scanned"), value: summary.totalPackages, color: COLORS.info }),
|
|
4423
|
+
/* @__PURE__ */ jsx31(
|
|
4352
4424
|
StatCard,
|
|
4353
4425
|
{
|
|
4354
4426
|
label: t("security_vulnerable"),
|
|
@@ -4356,14 +4428,14 @@ function SecurityAuditView() {
|
|
|
4356
4428
|
color: summary.vulnerablePackages > 0 ? COLORS.error : COLORS.success
|
|
4357
4429
|
}
|
|
4358
4430
|
),
|
|
4359
|
-
summary.criticalCount > 0 && /* @__PURE__ */
|
|
4360
|
-
summary.highCount > 0 && /* @__PURE__ */
|
|
4361
|
-
summary.mediumCount > 0 && /* @__PURE__ */
|
|
4431
|
+
summary.criticalCount > 0 && /* @__PURE__ */ jsx31(StatCard, { label: t("security_critical"), value: summary.criticalCount, color: COLORS.error }),
|
|
4432
|
+
summary.highCount > 0 && /* @__PURE__ */ jsx31(StatCard, { label: t("security_high"), value: summary.highCount, color: COLORS.error }),
|
|
4433
|
+
summary.mediumCount > 0 && /* @__PURE__ */ jsx31(StatCard, { label: t("security_medium"), value: summary.mediumCount, color: COLORS.warning })
|
|
4362
4434
|
] }),
|
|
4363
|
-
cacheAge && /* @__PURE__ */
|
|
4364
|
-
summary && /* @__PURE__ */
|
|
4365
|
-
results.length === 0 && summary && /* @__PURE__ */
|
|
4366
|
-
confirmUpgrade && /* @__PURE__ */
|
|
4435
|
+
cacheAge && /* @__PURE__ */ jsx31(Text30, { color: COLORS.muted, children: t("security_cachedResults", { time: cacheAge }) }),
|
|
4436
|
+
summary && /* @__PURE__ */ jsx31(Box28, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx31(Text30, { color: COLORS.textSecondary, italic: true, children: t("security_coverage_warning") }) }),
|
|
4437
|
+
results.length === 0 && summary && /* @__PURE__ */ jsx31(Box28, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx31(ResultBanner, { status: "success", message: `\u2714 ${t("security_noVulns")}` }) }),
|
|
4438
|
+
confirmUpgrade && /* @__PURE__ */ jsx31(Box28, { marginY: SPACING.xs, children: /* @__PURE__ */ jsx31(
|
|
4367
4439
|
ConfirmDialog,
|
|
4368
4440
|
{
|
|
4369
4441
|
message: t("security_confirmUpgrade", { name: confirmUpgrade }),
|
|
@@ -4376,51 +4448,51 @@ function SecurityAuditView() {
|
|
|
4376
4448
|
onCancel: () => setConfirmUpgrade(null)
|
|
4377
4449
|
}
|
|
4378
4450
|
) }),
|
|
4379
|
-
(stream.isRunning || stream.lines.length > 0) && /* @__PURE__ */
|
|
4451
|
+
(stream.isRunning || stream.lines.length > 0) && /* @__PURE__ */ jsx31(Box28, { marginY: SPACING.xs, children: /* @__PURE__ */ jsx31(ProgressLog, { lines: stream.lines, isRunning: stream.isRunning, title: t("hint_upgrade") }) }),
|
|
4380
4452
|
results.length > 0 && /* @__PURE__ */ jsxs29(Box28, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
4381
4453
|
results.map((pkg, i) => {
|
|
4382
4454
|
const isCurrent = i === cursor;
|
|
4383
4455
|
const isExpanded = expandedPkg === pkg.packageName;
|
|
4384
4456
|
return /* @__PURE__ */ jsxs29(Box28, { flexDirection: "column", children: [
|
|
4385
4457
|
/* @__PURE__ */ jsxs29(SelectableRow, { isCurrent, children: [
|
|
4386
|
-
/* @__PURE__ */
|
|
4387
|
-
/* @__PURE__ */
|
|
4388
|
-
/* @__PURE__ */
|
|
4389
|
-
/* @__PURE__ */
|
|
4390
|
-
pkg.vulnerabilities.some((v) => v.fixedVersion) && /* @__PURE__ */ jsxs29(
|
|
4458
|
+
/* @__PURE__ */ jsx31(StatusBadge, { label: pkg.maxSeverity, variant: SEVERITY_BADGE[pkg.maxSeverity] }),
|
|
4459
|
+
/* @__PURE__ */ jsx31(Text30, { bold: isCurrent, inverse: isCurrent, color: isCurrent ? COLORS.text : COLORS.muted, children: pkg.packageName }),
|
|
4460
|
+
/* @__PURE__ */ jsx31(Text30, { color: COLORS.muted, children: pkg.installedVersion }),
|
|
4461
|
+
/* @__PURE__ */ jsx31(Text30, { color: COLORS.muted, children: tp("plural_vulns", pkg.vulnerabilities.length) }),
|
|
4462
|
+
pkg.vulnerabilities.some((v) => v.fixedVersion) && /* @__PURE__ */ jsxs29(Text30, { color: COLORS.textSecondary, children: [
|
|
4391
4463
|
"[R:",
|
|
4392
4464
|
t("hint_rollback"),
|
|
4393
4465
|
"]"
|
|
4394
4466
|
] }),
|
|
4395
|
-
/* @__PURE__ */
|
|
4467
|
+
/* @__PURE__ */ jsx31(Text30, { color: COLORS.muted, children: isExpanded ? "\u25BC" : "\u25B6" })
|
|
4396
4468
|
] }),
|
|
4397
|
-
isExpanded && /* @__PURE__ */
|
|
4469
|
+
isExpanded && /* @__PURE__ */ jsx31(Box28, { flexDirection: "column", paddingLeft: SPACING.lg, marginBottom: SPACING.xs, children: pkg.vulnerabilities.map((vuln) => /* @__PURE__ */ jsxs29(Box28, { flexDirection: "column", marginBottom: SPACING.xs, children: [
|
|
4398
4470
|
/* @__PURE__ */ jsxs29(Box28, { gap: SPACING.xs, children: [
|
|
4399
|
-
/* @__PURE__ */
|
|
4400
|
-
/* @__PURE__ */ jsxs29(
|
|
4471
|
+
/* @__PURE__ */ jsx31(Text30, { color: SEVERITY_COLORS[vuln.severity], bold: true, children: vuln.id }),
|
|
4472
|
+
/* @__PURE__ */ jsxs29(Text30, { color: COLORS.muted, children: [
|
|
4401
4473
|
"[",
|
|
4402
4474
|
vuln.severity,
|
|
4403
4475
|
"]"
|
|
4404
4476
|
] })
|
|
4405
4477
|
] }),
|
|
4406
|
-
/* @__PURE__ */
|
|
4407
|
-
vuln.fixedVersion && /* @__PURE__ */
|
|
4478
|
+
/* @__PURE__ */ jsx31(Text30, { color: COLORS.muted, wrap: "wrap", children: vuln.summary }),
|
|
4479
|
+
vuln.fixedVersion && /* @__PURE__ */ jsx31(Text30, { color: COLORS.success, children: t("security_fixedIn", { version: vuln.fixedVersion }) })
|
|
4408
4480
|
] }, vuln.id)) })
|
|
4409
4481
|
] }, pkg.packageName);
|
|
4410
4482
|
}),
|
|
4411
|
-
/* @__PURE__ */
|
|
4483
|
+
/* @__PURE__ */ jsx31(Box28, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs29(Text30, { color: COLORS.text, bold: true, children: [
|
|
4412
4484
|
cursor + 1,
|
|
4413
4485
|
"/",
|
|
4414
4486
|
results.length
|
|
4415
4487
|
] }) }),
|
|
4416
|
-
/* @__PURE__ */
|
|
4488
|
+
/* @__PURE__ */ jsx31(Box28, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx31(Text30, { color: COLORS.textSecondary, children: t("security_rollback_hint") }) })
|
|
4417
4489
|
] })
|
|
4418
4490
|
] });
|
|
4419
4491
|
}
|
|
4420
4492
|
|
|
4421
4493
|
// src/views/account.tsx
|
|
4422
|
-
import { useState as
|
|
4423
|
-
import { Box as Box29, Text as
|
|
4494
|
+
import { useState as useState15 } from "react";
|
|
4495
|
+
import { Box as Box29, Text as Text31 } from "ink";
|
|
4424
4496
|
import { TextInput as TextInput5 } from "@inkjs/ui";
|
|
4425
4497
|
|
|
4426
4498
|
// src/lib/license/promo.ts
|
|
@@ -4498,16 +4570,16 @@ async function redeemPromoCode(code) {
|
|
|
4498
4570
|
}
|
|
4499
4571
|
|
|
4500
4572
|
// src/views/account.tsx
|
|
4501
|
-
import { Fragment as Fragment5, jsx as
|
|
4573
|
+
import { Fragment as Fragment5, jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
4502
4574
|
function AccountView() {
|
|
4503
4575
|
const { status, license, deactivate: deactivate2, revalidate: revalidate2, degradation } = useLicenseStore();
|
|
4504
|
-
const [confirmDeactivate, setConfirmDeactivate] =
|
|
4505
|
-
const [deactivating, setDeactivating] =
|
|
4506
|
-
const [deactivateError, setDeactivateError] =
|
|
4507
|
-
const [promoMode, setPromoMode] =
|
|
4508
|
-
const [promoLoading, setPromoLoading] =
|
|
4509
|
-
const [promoResult, setPromoResult] =
|
|
4510
|
-
const [revalidating, setRevalidating] =
|
|
4576
|
+
const [confirmDeactivate, setConfirmDeactivate] = useState15(false);
|
|
4577
|
+
const [deactivating, setDeactivating] = useState15(false);
|
|
4578
|
+
const [deactivateError, setDeactivateError] = useState15(null);
|
|
4579
|
+
const [promoMode, setPromoMode] = useState15(false);
|
|
4580
|
+
const [promoLoading, setPromoLoading] = useState15(false);
|
|
4581
|
+
const [promoResult, setPromoResult] = useState15(null);
|
|
4582
|
+
const [revalidating, setRevalidating] = useState15(false);
|
|
4511
4583
|
useViewInput((input, key) => {
|
|
4512
4584
|
if (confirmDeactivate || deactivating || promoMode || revalidating) {
|
|
4513
4585
|
if (key.escape && promoMode) {
|
|
@@ -4533,11 +4605,11 @@ function AccountView() {
|
|
|
4533
4605
|
return key.slice(0, 4) + "-****-****-" + key.slice(-4);
|
|
4534
4606
|
};
|
|
4535
4607
|
if (status === "validating") {
|
|
4536
|
-
return /* @__PURE__ */
|
|
4608
|
+
return /* @__PURE__ */ jsx32(Loading, { message: t("account_loading") });
|
|
4537
4609
|
}
|
|
4538
4610
|
return /* @__PURE__ */ jsxs30(Box29, { flexDirection: "column", children: [
|
|
4539
|
-
/* @__PURE__ */
|
|
4540
|
-
confirmDeactivate && /* @__PURE__ */
|
|
4611
|
+
/* @__PURE__ */ jsx32(SectionHeader, { emoji: "\u{1F464}", title: t("account_title"), gradient: GRADIENTS.gold }),
|
|
4612
|
+
confirmDeactivate && /* @__PURE__ */ jsx32(Box29, { marginY: SPACING.xs, children: /* @__PURE__ */ jsx32(
|
|
4541
4613
|
ConfirmDialog,
|
|
4542
4614
|
{
|
|
4543
4615
|
message: t("account_confirmDeactivate"),
|
|
@@ -4558,70 +4630,70 @@ function AccountView() {
|
|
|
4558
4630
|
) }),
|
|
4559
4631
|
/* @__PURE__ */ jsxs30(Box29, { flexDirection: "column", marginTop: SPACING.xs, paddingLeft: SPACING.sm, children: [
|
|
4560
4632
|
/* @__PURE__ */ jsxs30(Box29, { gap: SPACING.xs, children: [
|
|
4561
|
-
/* @__PURE__ */
|
|
4562
|
-
status === "pro" && /* @__PURE__ */
|
|
4563
|
-
status === "free" && /* @__PURE__ */
|
|
4564
|
-
status === "expired" && /* @__PURE__ */
|
|
4633
|
+
/* @__PURE__ */ jsx32(Text31, { color: COLORS.muted, children: t("account_statusLabel") }),
|
|
4634
|
+
status === "pro" && /* @__PURE__ */ jsx32(Text31, { color: COLORS.success, bold: true, children: t("account_pro") }),
|
|
4635
|
+
status === "free" && /* @__PURE__ */ jsx32(Text31, { color: COLORS.muted, children: t("account_free") }),
|
|
4636
|
+
status === "expired" && /* @__PURE__ */ jsx32(Text31, { color: COLORS.error, children: t("account_expired") })
|
|
4565
4637
|
] }),
|
|
4566
|
-
(degradation === "warning" || degradation === "limited") && license && /* @__PURE__ */
|
|
4638
|
+
(degradation === "warning" || degradation === "limited") && license && /* @__PURE__ */ jsx32(Box29, { marginTop: SPACING.xs, borderStyle: "round", borderColor: COLORS.warning, paddingX: SPACING.sm, paddingY: SPACING.none, children: /* @__PURE__ */ jsx32(Text31, { color: COLORS.warning, children: t("license_offlineWarning", {
|
|
4567
4639
|
days: Math.floor((Date.now() - new Date(license.lastValidatedAt).getTime()) / (24 * 60 * 60 * 1e3))
|
|
4568
4640
|
}) }) }),
|
|
4569
4641
|
license && /* @__PURE__ */ jsxs30(Fragment5, { children: [
|
|
4570
4642
|
/* @__PURE__ */ jsxs30(Box29, { gap: SPACING.xs, children: [
|
|
4571
|
-
/* @__PURE__ */
|
|
4572
|
-
/* @__PURE__ */
|
|
4643
|
+
/* @__PURE__ */ jsx32(Text31, { color: COLORS.muted, children: t("account_emailLabel") }),
|
|
4644
|
+
/* @__PURE__ */ jsx32(Text31, { children: license.customerEmail })
|
|
4573
4645
|
] }),
|
|
4574
4646
|
/* @__PURE__ */ jsxs30(Box29, { gap: SPACING.xs, children: [
|
|
4575
|
-
/* @__PURE__ */
|
|
4576
|
-
/* @__PURE__ */
|
|
4647
|
+
/* @__PURE__ */ jsx32(Text31, { color: COLORS.muted, children: t("account_nameLabel") }),
|
|
4648
|
+
/* @__PURE__ */ jsx32(Text31, { children: license.customerName })
|
|
4577
4649
|
] }),
|
|
4578
4650
|
/* @__PURE__ */ jsxs30(Box29, { gap: SPACING.xs, children: [
|
|
4579
|
-
/* @__PURE__ */
|
|
4580
|
-
/* @__PURE__ */
|
|
4651
|
+
/* @__PURE__ */ jsx32(Text31, { color: COLORS.muted, children: t("account_planLabel") }),
|
|
4652
|
+
/* @__PURE__ */ jsx32(Text31, { color: COLORS.success, bold: true, children: "Pro" })
|
|
4581
4653
|
] }),
|
|
4582
4654
|
/* @__PURE__ */ jsxs30(Box29, { gap: SPACING.xs, children: [
|
|
4583
|
-
/* @__PURE__ */
|
|
4584
|
-
/* @__PURE__ */
|
|
4655
|
+
/* @__PURE__ */ jsx32(Text31, { color: COLORS.muted, children: t("account_keyLabel") }),
|
|
4656
|
+
/* @__PURE__ */ jsx32(Text31, { children: maskKey(license.key) })
|
|
4585
4657
|
] }),
|
|
4586
4658
|
license.expiresAt && /* @__PURE__ */ jsxs30(Box29, { gap: SPACING.xs, children: [
|
|
4587
|
-
/* @__PURE__ */
|
|
4588
|
-
/* @__PURE__ */
|
|
4659
|
+
/* @__PURE__ */ jsx32(Text31, { color: COLORS.muted, children: t("account_expiresLabel") }),
|
|
4660
|
+
/* @__PURE__ */ jsx32(Text31, { children: formatDate(license.expiresAt) })
|
|
4589
4661
|
] }),
|
|
4590
4662
|
/* @__PURE__ */ jsxs30(Box29, { gap: SPACING.xs, children: [
|
|
4591
|
-
/* @__PURE__ */
|
|
4592
|
-
/* @__PURE__ */
|
|
4663
|
+
/* @__PURE__ */ jsx32(Text31, { color: COLORS.muted, children: t("account_activatedLabel") }),
|
|
4664
|
+
/* @__PURE__ */ jsx32(Text31, { children: formatDate(license.activatedAt) })
|
|
4593
4665
|
] })
|
|
4594
4666
|
] }),
|
|
4595
4667
|
status === "free" && /* @__PURE__ */ jsxs30(Box29, { flexDirection: "column", marginTop: SPACING.sm, borderStyle: "round", borderColor: COLORS.brand, paddingX: SPACING.sm, paddingY: SPACING.xs, children: [
|
|
4596
|
-
/* @__PURE__ */ jsxs30(
|
|
4668
|
+
/* @__PURE__ */ jsxs30(Text31, { bold: true, color: COLORS.brand, children: [
|
|
4597
4669
|
"\u2B50",
|
|
4598
4670
|
" ",
|
|
4599
4671
|
t("account_upgradeTitle")
|
|
4600
4672
|
] }),
|
|
4601
|
-
/* @__PURE__ */
|
|
4602
|
-
/* @__PURE__ */
|
|
4603
|
-
/* @__PURE__ */
|
|
4604
|
-
/* @__PURE__ */
|
|
4605
|
-
/* @__PURE__ */ jsxs30(
|
|
4673
|
+
/* @__PURE__ */ jsx32(Text31, { children: " " }),
|
|
4674
|
+
/* @__PURE__ */ jsx32(Text31, { children: t("account_unlockDesc") }),
|
|
4675
|
+
/* @__PURE__ */ jsx32(Text31, { color: COLORS.info, bold: true, children: t("account_pricing") }),
|
|
4676
|
+
/* @__PURE__ */ jsx32(Text31, { children: " " }),
|
|
4677
|
+
/* @__PURE__ */ jsxs30(Text31, { color: COLORS.muted, children: [
|
|
4606
4678
|
t("upgrade_buyAt"),
|
|
4607
4679
|
" ",
|
|
4608
|
-
/* @__PURE__ */
|
|
4680
|
+
/* @__PURE__ */ jsx32(Text31, { color: COLORS.sky, bold: true, children: t("upgrade_buyUrl") })
|
|
4609
4681
|
] }),
|
|
4610
|
-
/* @__PURE__ */ jsxs30(
|
|
4682
|
+
/* @__PURE__ */ jsxs30(Text31, { color: COLORS.muted, children: [
|
|
4611
4683
|
t("account_runActivate"),
|
|
4612
4684
|
" ",
|
|
4613
|
-
/* @__PURE__ */
|
|
4685
|
+
/* @__PURE__ */ jsx32(Text31, { color: COLORS.success, bold: true, children: t("account_activateCmd") })
|
|
4614
4686
|
] })
|
|
4615
4687
|
] }),
|
|
4616
|
-
status === "expired" && /* @__PURE__ */
|
|
4617
|
-
deactivating && /* @__PURE__ */
|
|
4618
|
-
deactivateError && /* @__PURE__ */
|
|
4688
|
+
status === "expired" && /* @__PURE__ */ jsx32(Box29, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx32(Box29, { borderStyle: "round", borderColor: COLORS.error, paddingX: SPACING.sm, paddingY: SPACING.none, children: /* @__PURE__ */ jsx32(Text31, { color: COLORS.error, children: t("account_licenseExpired") }) }) }),
|
|
4689
|
+
deactivating && /* @__PURE__ */ jsx32(Text31, { color: COLORS.sky, children: t("account_deactivating") }),
|
|
4690
|
+
deactivateError && /* @__PURE__ */ jsx32(Text31, { color: COLORS.error, children: deactivateError })
|
|
4619
4691
|
] }),
|
|
4620
|
-
/* @__PURE__ */
|
|
4621
|
-
/* @__PURE__ */
|
|
4622
|
-
promoLoading ? /* @__PURE__ */
|
|
4623
|
-
/* @__PURE__ */
|
|
4624
|
-
/* @__PURE__ */
|
|
4692
|
+
/* @__PURE__ */ jsx32(Box29, { flexDirection: "column", marginTop: SPACING.xs, paddingLeft: SPACING.sm, children: promoMode ? /* @__PURE__ */ jsxs30(Box29, { flexDirection: "column", gap: SPACING.xs, children: [
|
|
4693
|
+
/* @__PURE__ */ jsx32(Text31, { bold: true, color: COLORS.gold, children: t("account_promoTitle") }),
|
|
4694
|
+
promoLoading ? /* @__PURE__ */ jsx32(Text31, { color: COLORS.sky, children: t("account_promoValidating") }) : /* @__PURE__ */ jsxs30(Box29, { gap: SPACING.xs, children: [
|
|
4695
|
+
/* @__PURE__ */ jsx32(Text31, { color: COLORS.muted, children: t("account_promoLabel") }),
|
|
4696
|
+
/* @__PURE__ */ jsx32(
|
|
4625
4697
|
TextInput5,
|
|
4626
4698
|
{
|
|
4627
4699
|
defaultValue: "",
|
|
@@ -4645,22 +4717,22 @@ function AccountView() {
|
|
|
4645
4717
|
}
|
|
4646
4718
|
)
|
|
4647
4719
|
] }),
|
|
4648
|
-
promoResult && /* @__PURE__ */
|
|
4649
|
-
/* @__PURE__ */
|
|
4650
|
-
] }) : /* @__PURE__ */
|
|
4651
|
-
/* @__PURE__ */
|
|
4720
|
+
promoResult && /* @__PURE__ */ jsx32(ResultBanner, { status: promoResult.success ? "success" : "error", message: promoResult.message }),
|
|
4721
|
+
/* @__PURE__ */ jsx32(Text31, { color: COLORS.textSecondary, dimColor: true, children: t("account_promoEsc") })
|
|
4722
|
+
] }) : /* @__PURE__ */ jsx32(Text31, { color: COLORS.textSecondary, children: t("account_promoHint") }) }),
|
|
4723
|
+
/* @__PURE__ */ jsx32(Box29, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs30(Text31, { color: COLORS.textSecondary, children: [
|
|
4652
4724
|
status === "pro" || status === "team" ? `d ${t("hint_deactivate")} ` : "",
|
|
4653
4725
|
status === "pro" || status === "team" || status === "expired" ? `v ${t("hint_revalidate")} ` : "",
|
|
4654
4726
|
revalidating ? t("account_revalidating") : "",
|
|
4655
4727
|
" ",
|
|
4656
|
-
t("app_version", { version: "0.9.
|
|
4728
|
+
t("app_version", { version: "0.9.2" })
|
|
4657
4729
|
] }) })
|
|
4658
4730
|
] });
|
|
4659
4731
|
}
|
|
4660
4732
|
|
|
4661
4733
|
// src/views/rollback.tsx
|
|
4662
|
-
import { useCallback as useCallback3, useEffect as
|
|
4663
|
-
import { Box as Box30, Text as
|
|
4734
|
+
import { useCallback as useCallback3, useEffect as useEffect19, useRef as useRef9, useState as useState16 } from "react";
|
|
4735
|
+
import { Box as Box30, Text as Text32 } from "ink";
|
|
4664
4736
|
|
|
4665
4737
|
// src/stores/rollback-store.ts
|
|
4666
4738
|
import { create as create12 } from "zustand";
|
|
@@ -4870,7 +4942,7 @@ var useRollbackStore = create12((set) => ({
|
|
|
4870
4942
|
}));
|
|
4871
4943
|
|
|
4872
4944
|
// src/views/rollback.tsx
|
|
4873
|
-
import { jsx as
|
|
4945
|
+
import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
4874
4946
|
function strategyLabel(action) {
|
|
4875
4947
|
switch (action.strategy) {
|
|
4876
4948
|
case "versioned-formula":
|
|
@@ -4900,46 +4972,46 @@ function PlanView({ plan }) {
|
|
|
4900
4972
|
const executableCount = plan.actions.filter((a) => a.strategy !== "unavailable" && a.action !== "remove").length;
|
|
4901
4973
|
return /* @__PURE__ */ jsxs31(Box30, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
4902
4974
|
/* @__PURE__ */ jsxs31(Box30, { marginBottom: SPACING.xs, children: [
|
|
4903
|
-
/* @__PURE__ */ jsxs31(
|
|
4975
|
+
/* @__PURE__ */ jsxs31(Text32, { color: COLORS.text, bold: true, children: [
|
|
4904
4976
|
plan.snapshotLabel,
|
|
4905
4977
|
" "
|
|
4906
4978
|
] }),
|
|
4907
|
-
/* @__PURE__ */
|
|
4979
|
+
/* @__PURE__ */ jsx33(Text32, { color: COLORS.textSecondary, children: plan.snapshotDate })
|
|
4908
4980
|
] }),
|
|
4909
|
-
plan.actions.length === 0 && /* @__PURE__ */
|
|
4981
|
+
plan.actions.length === 0 && /* @__PURE__ */ jsx33(ResultBanner, { status: "success", message: t("rollback_diff_empty") }),
|
|
4910
4982
|
plan.actions.map((a) => /* @__PURE__ */ jsxs31(Box30, { children: [
|
|
4911
|
-
/* @__PURE__ */ jsxs31(
|
|
4983
|
+
/* @__PURE__ */ jsxs31(Text32, { color: actionColor(a), children: [
|
|
4912
4984
|
actionPrefix(a),
|
|
4913
4985
|
" "
|
|
4914
4986
|
] }),
|
|
4915
|
-
/* @__PURE__ */
|
|
4916
|
-
a.fromVersion !== "" && a.toVersion !== "" && /* @__PURE__ */ jsxs31(
|
|
4987
|
+
/* @__PURE__ */ jsx33(Text32, { color: actionColor(a), bold: true, children: a.packageName }),
|
|
4988
|
+
a.fromVersion !== "" && a.toVersion !== "" && /* @__PURE__ */ jsxs31(Text32, { color: COLORS.textSecondary, children: [
|
|
4917
4989
|
" ",
|
|
4918
4990
|
a.fromVersion,
|
|
4919
4991
|
" \u2192 ",
|
|
4920
4992
|
a.toVersion
|
|
4921
4993
|
] }),
|
|
4922
|
-
a.fromVersion === "" && a.toVersion !== "" && /* @__PURE__ */ jsxs31(
|
|
4994
|
+
a.fromVersion === "" && a.toVersion !== "" && /* @__PURE__ */ jsxs31(Text32, { color: COLORS.textSecondary, children: [
|
|
4923
4995
|
" install ",
|
|
4924
4996
|
a.toVersion
|
|
4925
4997
|
] }),
|
|
4926
|
-
a.fromVersion !== "" && a.toVersion === "" && /* @__PURE__ */
|
|
4927
|
-
/* @__PURE__ */ jsxs31(
|
|
4998
|
+
a.fromVersion !== "" && a.toVersion === "" && /* @__PURE__ */ jsx33(Text32, { color: COLORS.textSecondary, children: " remove" }),
|
|
4999
|
+
/* @__PURE__ */ jsxs31(Text32, { color: COLORS.muted, dimColor: true, children: [
|
|
4928
5000
|
" [",
|
|
4929
5001
|
strategyLabel(a),
|
|
4930
5002
|
"]"
|
|
4931
5003
|
] })
|
|
4932
5004
|
] }, a.packageName + a.action)),
|
|
4933
|
-
plan.warnings.map((w) => /* @__PURE__ */
|
|
5005
|
+
plan.warnings.map((w) => /* @__PURE__ */ jsx33(Box30, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs31(Text32, { color: COLORS.warning, children: [
|
|
4934
5006
|
"\u26A0 ",
|
|
4935
5007
|
w
|
|
4936
5008
|
] }) }, w)),
|
|
4937
|
-
/* @__PURE__ */
|
|
5009
|
+
/* @__PURE__ */ jsx33(Box30, { marginTop: SPACING.xs, children: plan.canExecute ? /* @__PURE__ */ jsxs31(Text32, { color: COLORS.textSecondary, children: [
|
|
4938
5010
|
"enter:",
|
|
4939
5011
|
t("rollback_confirm", { count: String(executableCount) }),
|
|
4940
5012
|
" esc:",
|
|
4941
5013
|
t("hint_back")
|
|
4942
|
-
] }) : /* @__PURE__ */ jsxs31(
|
|
5014
|
+
] }) : /* @__PURE__ */ jsxs31(Text32, { color: COLORS.muted, children: [
|
|
4943
5015
|
t("rollback_strategy_unavailable"),
|
|
4944
5016
|
" esc:",
|
|
4945
5017
|
t("hint_back")
|
|
@@ -4949,21 +5021,21 @@ function PlanView({ plan }) {
|
|
|
4949
5021
|
function RollbackView() {
|
|
4950
5022
|
const isPro = useLicenseStore((s) => s.isPro);
|
|
4951
5023
|
const { snapshots, loading, error, plan, planLoading, planError, fetchSnapshots, selectSnapshot, clearPlan } = useRollbackStore();
|
|
4952
|
-
const [cursor, setCursor] =
|
|
4953
|
-
const [phase, setPhase] =
|
|
4954
|
-
const [streamLines, setStreamLines] =
|
|
4955
|
-
const [streamRunning, setStreamRunning] =
|
|
4956
|
-
const [streamError, setStreamError] =
|
|
4957
|
-
const generatorRef =
|
|
4958
|
-
const mountedRef =
|
|
4959
|
-
|
|
5024
|
+
const [cursor, setCursor] = useState16(0);
|
|
5025
|
+
const [phase, setPhase] = useState16("list");
|
|
5026
|
+
const [streamLines, setStreamLines] = useState16([]);
|
|
5027
|
+
const [streamRunning, setStreamRunning] = useState16(false);
|
|
5028
|
+
const [streamError, setStreamError] = useState16(null);
|
|
5029
|
+
const generatorRef = useRef9(null);
|
|
5030
|
+
const mountedRef = useRef9(true);
|
|
5031
|
+
useEffect19(() => {
|
|
4960
5032
|
mountedRef.current = true;
|
|
4961
5033
|
return () => {
|
|
4962
5034
|
mountedRef.current = false;
|
|
4963
5035
|
void generatorRef.current?.return(void 0);
|
|
4964
5036
|
};
|
|
4965
5037
|
}, []);
|
|
4966
|
-
|
|
5038
|
+
useEffect19(() => {
|
|
4967
5039
|
void fetchSnapshots(isPro());
|
|
4968
5040
|
}, []);
|
|
4969
5041
|
const runRollback = useCallback3(async (p) => {
|
|
@@ -5023,21 +5095,21 @@ function RollbackView() {
|
|
|
5023
5095
|
void fetchSnapshots(isPro());
|
|
5024
5096
|
}
|
|
5025
5097
|
});
|
|
5026
|
-
if (loading) return /* @__PURE__ */
|
|
5027
|
-
if (error) return /* @__PURE__ */
|
|
5098
|
+
if (loading) return /* @__PURE__ */ jsx33(Loading, { message: t("rollback_select_snapshot") });
|
|
5099
|
+
if (error) return /* @__PURE__ */ jsx33(ErrorMessage, { message: error });
|
|
5028
5100
|
if (phase === "executing") {
|
|
5029
|
-
return /* @__PURE__ */
|
|
5101
|
+
return /* @__PURE__ */ jsx33(Box30, { flexDirection: "column", children: /* @__PURE__ */ jsx33(ProgressLog, { lines: streamLines, isRunning: streamRunning, title: t("rollback_executing") }) });
|
|
5030
5102
|
}
|
|
5031
5103
|
if (phase === "result") {
|
|
5032
5104
|
return /* @__PURE__ */ jsxs31(Box30, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
5033
|
-
/* @__PURE__ */
|
|
5105
|
+
/* @__PURE__ */ jsx33(
|
|
5034
5106
|
ResultBanner,
|
|
5035
5107
|
{
|
|
5036
5108
|
status: streamError ? "error" : "success",
|
|
5037
5109
|
message: streamError ? t("rollback_error", { error: streamError }) : t("rollback_success")
|
|
5038
5110
|
}
|
|
5039
5111
|
),
|
|
5040
|
-
/* @__PURE__ */
|
|
5112
|
+
/* @__PURE__ */ jsx33(Box30, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs31(Text32, { color: COLORS.textSecondary, children: [
|
|
5041
5113
|
"r:",
|
|
5042
5114
|
t("hint_refresh"),
|
|
5043
5115
|
" esc:",
|
|
@@ -5046,17 +5118,17 @@ function RollbackView() {
|
|
|
5046
5118
|
] });
|
|
5047
5119
|
}
|
|
5048
5120
|
return /* @__PURE__ */ jsxs31(Box30, { flexDirection: "column", children: [
|
|
5049
|
-
/* @__PURE__ */
|
|
5050
|
-
snapshots.length === 0 && /* @__PURE__ */
|
|
5121
|
+
/* @__PURE__ */ jsx33(SectionHeader, { emoji: "\u23EA", title: t("rollback_title"), gradient: GRADIENTS.gold }),
|
|
5122
|
+
snapshots.length === 0 && /* @__PURE__ */ jsx33(Box30, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx33(ResultBanner, { status: "info", message: t("rollback_no_snapshots") }) }),
|
|
5051
5123
|
phase === "list" && snapshots.length > 0 && /* @__PURE__ */ jsxs31(Box30, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
5052
|
-
/* @__PURE__ */
|
|
5053
|
-
/* @__PURE__ */
|
|
5054
|
-
/* @__PURE__ */
|
|
5055
|
-
/* @__PURE__ */ jsxs31(
|
|
5124
|
+
/* @__PURE__ */ jsx33(Text32, { color: COLORS.textSecondary, dimColor: true, children: t("rollback_select_snapshot") }),
|
|
5125
|
+
/* @__PURE__ */ jsx33(Box30, { flexDirection: "column", marginTop: SPACING.xs, children: snapshots.map((s, i) => /* @__PURE__ */ jsxs31(SelectableRow, { isCurrent: i === cursor, children: [
|
|
5126
|
+
/* @__PURE__ */ jsx33(Text32, { bold: i === cursor, color: i === cursor ? COLORS.text : COLORS.muted, children: s.label ?? t("rollback_snapshot_auto") }),
|
|
5127
|
+
/* @__PURE__ */ jsxs31(Text32, { color: COLORS.textSecondary, children: [
|
|
5056
5128
|
" \u2014 ",
|
|
5057
5129
|
new Date(s.capturedAt).toLocaleString()
|
|
5058
5130
|
] }),
|
|
5059
|
-
/* @__PURE__ */ jsxs31(
|
|
5131
|
+
/* @__PURE__ */ jsxs31(Text32, { color: COLORS.muted, dimColor: true, children: [
|
|
5060
5132
|
" ",
|
|
5061
5133
|
"(",
|
|
5062
5134
|
tp("packages", s.formulae.length + s.casks.length),
|
|
@@ -5065,11 +5137,11 @@ function RollbackView() {
|
|
|
5065
5137
|
] }, s.capturedAt)) })
|
|
5066
5138
|
] }),
|
|
5067
5139
|
phase === "plan" && /* @__PURE__ */ jsxs31(Box30, { flexDirection: "column", children: [
|
|
5068
|
-
planLoading && /* @__PURE__ */
|
|
5069
|
-
planError && /* @__PURE__ */
|
|
5070
|
-
plan && !planLoading && /* @__PURE__ */
|
|
5140
|
+
planLoading && /* @__PURE__ */ jsx33(Loading, { message: t("rollback_capturing") }),
|
|
5141
|
+
planError && /* @__PURE__ */ jsx33(ErrorMessage, { message: planError }),
|
|
5142
|
+
plan && !planLoading && /* @__PURE__ */ jsx33(PlanView, { plan })
|
|
5071
5143
|
] }),
|
|
5072
|
-
phase === "confirm" && plan && /* @__PURE__ */
|
|
5144
|
+
phase === "confirm" && plan && /* @__PURE__ */ jsx33(Box30, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx33(
|
|
5073
5145
|
ConfirmDialog,
|
|
5074
5146
|
{
|
|
5075
5147
|
message: t("rollback_confirm", {
|
|
@@ -5083,60 +5155,60 @@ function RollbackView() {
|
|
|
5083
5155
|
}
|
|
5084
5156
|
|
|
5085
5157
|
// src/views/brewfile.tsx
|
|
5086
|
-
import { useCallback as useCallback4, useEffect as
|
|
5087
|
-
import { Box as Box31, Text as
|
|
5158
|
+
import { useCallback as useCallback4, useEffect as useEffect20, useRef as useRef10, useState as useState17 } from "react";
|
|
5159
|
+
import { Box as Box31, Text as Text33 } from "ink";
|
|
5088
5160
|
import { TextInput as TextInput6 } from "@inkjs/ui";
|
|
5089
|
-
import { jsx as
|
|
5161
|
+
import { jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
5090
5162
|
function DriftScore({ score }) {
|
|
5091
5163
|
const color = score >= 80 ? COLORS.success : score >= 50 ? COLORS.warning : COLORS.error;
|
|
5092
5164
|
const bars = Math.round(score / 10);
|
|
5093
5165
|
const filled = "\u2593".repeat(bars);
|
|
5094
5166
|
const empty = "\u2591".repeat(10 - bars);
|
|
5095
5167
|
return /* @__PURE__ */ jsxs32(Box31, { children: [
|
|
5096
|
-
/* @__PURE__ */ jsxs32(
|
|
5168
|
+
/* @__PURE__ */ jsxs32(Text33, { color, children: [
|
|
5097
5169
|
filled,
|
|
5098
5170
|
empty
|
|
5099
5171
|
] }),
|
|
5100
|
-
/* @__PURE__ */ jsxs32(
|
|
5172
|
+
/* @__PURE__ */ jsxs32(Text33, { color, bold: true, children: [
|
|
5101
5173
|
" ",
|
|
5102
5174
|
score,
|
|
5103
5175
|
"% "
|
|
5104
5176
|
] }),
|
|
5105
|
-
/* @__PURE__ */
|
|
5177
|
+
/* @__PURE__ */ jsx34(Text33, { color: COLORS.textSecondary, children: t("brewfile_compliant") })
|
|
5106
5178
|
] });
|
|
5107
5179
|
}
|
|
5108
5180
|
function DriftSummary({ drift }) {
|
|
5109
5181
|
return /* @__PURE__ */ jsxs32(Box31, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
5110
5182
|
drift.missingPackages.length > 0 && /* @__PURE__ */ jsxs32(Box31, { children: [
|
|
5111
|
-
/* @__PURE__ */
|
|
5112
|
-
/* @__PURE__ */
|
|
5113
|
-
/* @__PURE__ */ jsxs32(
|
|
5183
|
+
/* @__PURE__ */ jsx34(Text33, { color: COLORS.error, children: "\u25CF " }),
|
|
5184
|
+
/* @__PURE__ */ jsx34(Text33, { color: COLORS.error, children: t("brewfile_drift_missing", { count: drift.missingPackages.length }) }),
|
|
5185
|
+
/* @__PURE__ */ jsxs32(Text33, { color: COLORS.textSecondary, children: [
|
|
5114
5186
|
": " + drift.missingPackages.slice(0, 3).join(", "),
|
|
5115
5187
|
drift.missingPackages.length > 3 ? "..." : ""
|
|
5116
5188
|
] })
|
|
5117
5189
|
] }),
|
|
5118
5190
|
drift.extraPackages.length > 0 && /* @__PURE__ */ jsxs32(Box31, { children: [
|
|
5119
|
-
/* @__PURE__ */
|
|
5120
|
-
/* @__PURE__ */
|
|
5191
|
+
/* @__PURE__ */ jsx34(Text33, { color: COLORS.warning, children: "\u25CF " }),
|
|
5192
|
+
/* @__PURE__ */ jsx34(Text33, { color: COLORS.warning, children: t("brewfile_drift_extra", { count: drift.extraPackages.length }) })
|
|
5121
5193
|
] }),
|
|
5122
5194
|
drift.wrongVersions.length > 0 && /* @__PURE__ */ jsxs32(Box31, { children: [
|
|
5123
|
-
/* @__PURE__ */
|
|
5124
|
-
/* @__PURE__ */
|
|
5195
|
+
/* @__PURE__ */ jsx34(Text33, { color: COLORS.info, children: "\u25CF " }),
|
|
5196
|
+
/* @__PURE__ */ jsx34(Text33, { color: COLORS.info, children: t("brewfile_drift_wrong", { count: drift.wrongVersions.length }) })
|
|
5125
5197
|
] }),
|
|
5126
|
-
drift.missingPackages.length === 0 && drift.extraPackages.length === 0 && drift.wrongVersions.length === 0 && /* @__PURE__ */
|
|
5198
|
+
drift.missingPackages.length === 0 && drift.extraPackages.length === 0 && drift.wrongVersions.length === 0 && /* @__PURE__ */ jsx34(ResultBanner, { status: "success", message: t("brewfile_in_sync") })
|
|
5127
5199
|
] });
|
|
5128
5200
|
}
|
|
5129
5201
|
function BrewfileView() {
|
|
5130
5202
|
const isPro = useLicenseStore((s) => s.isPro);
|
|
5131
5203
|
const { schema, drift, loading, driftLoading, error, load, createFromCurrent } = useBrewfileStore();
|
|
5132
|
-
const [phase, setPhase] =
|
|
5133
|
-
const [streamLines, setStreamLines] =
|
|
5134
|
-
const [streamRunning, setStreamRunning] =
|
|
5135
|
-
const [streamError, setStreamError] =
|
|
5136
|
-
const [resultMessage, setResultMessage] =
|
|
5137
|
-
const generatorRef =
|
|
5138
|
-
const mountedRef =
|
|
5139
|
-
|
|
5204
|
+
const [phase, setPhase] = useState17("overview");
|
|
5205
|
+
const [streamLines, setStreamLines] = useState17([]);
|
|
5206
|
+
const [streamRunning, setStreamRunning] = useState17(false);
|
|
5207
|
+
const [streamError, setStreamError] = useState17(null);
|
|
5208
|
+
const [resultMessage, setResultMessage] = useState17("");
|
|
5209
|
+
const generatorRef = useRef10(null);
|
|
5210
|
+
const mountedRef = useRef10(true);
|
|
5211
|
+
useEffect20(() => {
|
|
5140
5212
|
mountedRef.current = true;
|
|
5141
5213
|
void load();
|
|
5142
5214
|
return () => {
|
|
@@ -5203,10 +5275,10 @@ function BrewfileView() {
|
|
|
5203
5275
|
if (key.escape) {
|
|
5204
5276
|
}
|
|
5205
5277
|
});
|
|
5206
|
-
if (loading) return /* @__PURE__ */
|
|
5207
|
-
if (error) return /* @__PURE__ */
|
|
5278
|
+
if (loading) return /* @__PURE__ */ jsx34(Loading, { message: t("loading_default") });
|
|
5279
|
+
if (error) return /* @__PURE__ */ jsx34(ErrorMessage, { message: error });
|
|
5208
5280
|
if (phase === "confirming-reconcile" && drift) {
|
|
5209
|
-
return /* @__PURE__ */
|
|
5281
|
+
return /* @__PURE__ */ jsx34(
|
|
5210
5282
|
ConfirmDialog,
|
|
5211
5283
|
{
|
|
5212
5284
|
message: t("confirm_brewfile_reconcile", {
|
|
@@ -5224,13 +5296,13 @@ function BrewfileView() {
|
|
|
5224
5296
|
}
|
|
5225
5297
|
if (phase === "creating") {
|
|
5226
5298
|
return /* @__PURE__ */ jsxs32(Box31, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
5227
|
-
/* @__PURE__ */
|
|
5299
|
+
/* @__PURE__ */ jsx34(SectionHeader, { emoji: "\u{1F4E6}", title: t("brewfile_title"), gradient: GRADIENTS.ocean }),
|
|
5228
5300
|
/* @__PURE__ */ jsxs32(Box31, { marginTop: SPACING.xs, children: [
|
|
5229
|
-
/* @__PURE__ */ jsxs32(
|
|
5301
|
+
/* @__PURE__ */ jsxs32(Text33, { color: COLORS.textSecondary, children: [
|
|
5230
5302
|
t("brewfile_create_name"),
|
|
5231
5303
|
" "
|
|
5232
5304
|
] }),
|
|
5233
|
-
/* @__PURE__ */
|
|
5305
|
+
/* @__PURE__ */ jsx34(
|
|
5234
5306
|
TextInput6,
|
|
5235
5307
|
{
|
|
5236
5308
|
defaultValue: "My Environment",
|
|
@@ -5246,7 +5318,7 @@ function BrewfileView() {
|
|
|
5246
5318
|
] });
|
|
5247
5319
|
}
|
|
5248
5320
|
if (phase === "reconciling") {
|
|
5249
|
-
return /* @__PURE__ */
|
|
5321
|
+
return /* @__PURE__ */ jsx34(Box31, { flexDirection: "column", children: /* @__PURE__ */ jsx34(
|
|
5250
5322
|
ProgressLog,
|
|
5251
5323
|
{
|
|
5252
5324
|
lines: streamLines,
|
|
@@ -5257,14 +5329,14 @@ function BrewfileView() {
|
|
|
5257
5329
|
}
|
|
5258
5330
|
if (phase === "result") {
|
|
5259
5331
|
return /* @__PURE__ */ jsxs32(Box31, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
5260
|
-
/* @__PURE__ */
|
|
5332
|
+
/* @__PURE__ */ jsx34(
|
|
5261
5333
|
ResultBanner,
|
|
5262
5334
|
{
|
|
5263
5335
|
status: streamError ? "error" : "success",
|
|
5264
5336
|
message: resultMessage
|
|
5265
5337
|
}
|
|
5266
5338
|
),
|
|
5267
|
-
/* @__PURE__ */
|
|
5339
|
+
/* @__PURE__ */ jsx34(Box31, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs32(Text33, { color: COLORS.textSecondary, children: [
|
|
5268
5340
|
"r:",
|
|
5269
5341
|
t("hint_refresh"),
|
|
5270
5342
|
" esc:",
|
|
@@ -5273,33 +5345,33 @@ function BrewfileView() {
|
|
|
5273
5345
|
] });
|
|
5274
5346
|
}
|
|
5275
5347
|
return /* @__PURE__ */ jsxs32(Box31, { flexDirection: "column", children: [
|
|
5276
|
-
/* @__PURE__ */
|
|
5348
|
+
/* @__PURE__ */ jsx34(SectionHeader, { emoji: "\u{1F4E6}", title: t("brewfile_title"), gradient: GRADIENTS.ocean }),
|
|
5277
5349
|
schema === null ? /* @__PURE__ */ jsxs32(Box31, { marginTop: SPACING.xs, flexDirection: "column", children: [
|
|
5278
|
-
/* @__PURE__ */
|
|
5279
|
-
/* @__PURE__ */
|
|
5350
|
+
/* @__PURE__ */ jsx34(ResultBanner, { status: "info", message: t("brewfile_no_brewfile") }),
|
|
5351
|
+
/* @__PURE__ */ jsx34(Box31, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs32(Text33, { color: COLORS.textSecondary, children: [
|
|
5280
5352
|
"n:",
|
|
5281
5353
|
t("hint_new")
|
|
5282
5354
|
] }) })
|
|
5283
5355
|
] }) : /* @__PURE__ */ jsxs32(Box31, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
5284
5356
|
/* @__PURE__ */ jsxs32(Box31, { gap: SPACING.sm, children: [
|
|
5285
|
-
/* @__PURE__ */
|
|
5286
|
-
schema.meta.description && /* @__PURE__ */
|
|
5287
|
-
schema.strictMode && /* @__PURE__ */ jsxs32(
|
|
5357
|
+
/* @__PURE__ */ jsx34(Text33, { color: COLORS.text, bold: true, children: schema.meta.name }),
|
|
5358
|
+
schema.meta.description && /* @__PURE__ */ jsx34(Text33, { color: COLORS.textSecondary, children: schema.meta.description }),
|
|
5359
|
+
schema.strictMode && /* @__PURE__ */ jsxs32(Text33, { color: COLORS.warning, children: [
|
|
5288
5360
|
"[",
|
|
5289
5361
|
t("brewfile_strict_mode"),
|
|
5290
5362
|
"]"
|
|
5291
5363
|
] })
|
|
5292
5364
|
] }),
|
|
5293
5365
|
/* @__PURE__ */ jsxs32(Box31, { gap: SPACING.md, marginTop: SPACING.xs, children: [
|
|
5294
|
-
/* @__PURE__ */
|
|
5295
|
-
/* @__PURE__ */
|
|
5366
|
+
/* @__PURE__ */ jsx34(Text33, { color: COLORS.sky, children: t("brewfile_formulae_count", { count: schema.formulae.length }) }),
|
|
5367
|
+
/* @__PURE__ */ jsx34(Text33, { color: COLORS.teal, children: t("brewfile_casks_count", { count: schema.casks.length }) })
|
|
5296
5368
|
] }),
|
|
5297
|
-
driftLoading && /* @__PURE__ */
|
|
5369
|
+
driftLoading && /* @__PURE__ */ jsx34(Box31, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx34(Text33, { color: COLORS.muted, children: t("brewfile_computing_drift") }) }),
|
|
5298
5370
|
drift && !driftLoading && /* @__PURE__ */ jsxs32(Box31, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
5299
|
-
/* @__PURE__ */
|
|
5300
|
-
/* @__PURE__ */
|
|
5371
|
+
/* @__PURE__ */ jsx34(DriftScore, { score: drift.score }),
|
|
5372
|
+
/* @__PURE__ */ jsx34(DriftSummary, { drift })
|
|
5301
5373
|
] }),
|
|
5302
|
-
/* @__PURE__ */
|
|
5374
|
+
/* @__PURE__ */ jsx34(Box31, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs32(Text33, { color: COLORS.textSecondary, children: [
|
|
5303
5375
|
"r:",
|
|
5304
5376
|
t("hint_refresh"),
|
|
5305
5377
|
drift && (drift.missingPackages.length > 0 || drift.wrongVersions.length > 0) ? ` c:${t("hint_reconcile")}` : "",
|
|
@@ -5312,9 +5384,9 @@ function BrewfileView() {
|
|
|
5312
5384
|
}
|
|
5313
5385
|
|
|
5314
5386
|
// src/views/sync.tsx
|
|
5315
|
-
import { useCallback as useCallback5, useEffect as
|
|
5316
|
-
import { Box as Box32, Text as
|
|
5317
|
-
import { Fragment as Fragment6, jsx as
|
|
5387
|
+
import { useCallback as useCallback5, useEffect as useEffect21, useState as useState18 } from "react";
|
|
5388
|
+
import { Box as Box32, Text as Text34 } from "ink";
|
|
5389
|
+
import { Fragment as Fragment6, jsx as jsx35, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
5318
5390
|
function OverviewSection({
|
|
5319
5391
|
config,
|
|
5320
5392
|
lastResult,
|
|
@@ -5326,32 +5398,32 @@ function OverviewSection({
|
|
|
5326
5398
|
const showComplianceHint = !hasConflicts && !!lastResult?.success;
|
|
5327
5399
|
return /* @__PURE__ */ jsxs33(Box32, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
5328
5400
|
config ? /* @__PURE__ */ jsxs33(Fragment6, { children: [
|
|
5329
|
-
/* @__PURE__ */
|
|
5330
|
-
config.lastSync && /* @__PURE__ */
|
|
5331
|
-
hasConflicts ? /* @__PURE__ */
|
|
5401
|
+
/* @__PURE__ */ jsx35(Box32, { marginBottom: SPACING.xs, children: /* @__PURE__ */ jsx35(Text34, { color: COLORS.textSecondary, children: t("sync_machine", { name: config.machineName }) }) }),
|
|
5402
|
+
config.lastSync && /* @__PURE__ */ jsx35(Box32, { marginBottom: SPACING.xs, children: /* @__PURE__ */ jsx35(Text34, { color: COLORS.textSecondary, children: t("sync_last_sync", { date: new Date(config.lastSync).toLocaleString() }) }) }),
|
|
5403
|
+
hasConflicts ? /* @__PURE__ */ jsx35(
|
|
5332
5404
|
ResultBanner,
|
|
5333
5405
|
{
|
|
5334
5406
|
status: "error",
|
|
5335
5407
|
message: t("sync_status_conflict", { count: String(conflicts.length) })
|
|
5336
5408
|
}
|
|
5337
|
-
) : lastResult?.success ? /* @__PURE__ */
|
|
5338
|
-
] }) : /* @__PURE__ */
|
|
5339
|
-
/* @__PURE__ */
|
|
5409
|
+
) : lastResult?.success ? /* @__PURE__ */ jsx35(ResultBanner, { status: "success", message: t("sync_status_ok") }) : null
|
|
5410
|
+
] }) : /* @__PURE__ */ jsx35(Box32, { marginBottom: SPACING.xs, children: /* @__PURE__ */ jsx35(Text34, { color: COLORS.textSecondary, children: t("sync_disabled") }) }),
|
|
5411
|
+
/* @__PURE__ */ jsx35(Box32, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs33(Text34, { color: COLORS.textSecondary, children: [
|
|
5340
5412
|
"s",
|
|
5341
|
-
/* @__PURE__ */ jsxs33(
|
|
5413
|
+
/* @__PURE__ */ jsxs33(Text34, { color: COLORS.gold, children: [
|
|
5342
5414
|
":",
|
|
5343
5415
|
t("hint_sync")
|
|
5344
5416
|
] }),
|
|
5345
5417
|
hasConflicts && /* @__PURE__ */ jsxs33(Fragment6, { children: [
|
|
5346
5418
|
" c",
|
|
5347
|
-
/* @__PURE__ */ jsxs33(
|
|
5419
|
+
/* @__PURE__ */ jsxs33(Text34, { color: COLORS.gold, children: [
|
|
5348
5420
|
":",
|
|
5349
5421
|
t("hint_conflict")
|
|
5350
5422
|
] })
|
|
5351
5423
|
] }),
|
|
5352
5424
|
showComplianceHint && /* @__PURE__ */ jsxs33(Fragment6, { children: [
|
|
5353
5425
|
" c",
|
|
5354
|
-
/* @__PURE__ */ jsxs33(
|
|
5426
|
+
/* @__PURE__ */ jsxs33(Text34, { color: COLORS.gold, children: [
|
|
5355
5427
|
":",
|
|
5356
5428
|
t("hint_check_compliance")
|
|
5357
5429
|
] })
|
|
@@ -5369,8 +5441,8 @@ function ConflictsList({
|
|
|
5369
5441
|
const isActive = i === cursor;
|
|
5370
5442
|
return /* @__PURE__ */ jsxs33(Box32, { flexDirection: "column", marginBottom: SPACING.xs, children: [
|
|
5371
5443
|
/* @__PURE__ */ jsxs33(SelectableRow, { isCurrent: isActive, children: [
|
|
5372
|
-
/* @__PURE__ */
|
|
5373
|
-
/* @__PURE__ */ jsxs33(
|
|
5444
|
+
/* @__PURE__ */ jsx35(Text34, { bold: true, color: isActive ? COLORS.text : COLORS.textSecondary, children: t("sync_conflict_title", { package: conflict.packageName }) }),
|
|
5445
|
+
/* @__PURE__ */ jsxs33(Text34, { color: COLORS.muted, children: [
|
|
5374
5446
|
" (",
|
|
5375
5447
|
conflict.packageType,
|
|
5376
5448
|
")"
|
|
@@ -5378,7 +5450,7 @@ function ConflictsList({
|
|
|
5378
5450
|
] }),
|
|
5379
5451
|
/* @__PURE__ */ jsxs33(Box32, { marginLeft: SPACING.sm, flexDirection: "column", children: [
|
|
5380
5452
|
/* @__PURE__ */ jsxs33(
|
|
5381
|
-
|
|
5453
|
+
Text34,
|
|
5382
5454
|
{
|
|
5383
5455
|
color: resolution === "use-local" ? COLORS.success : COLORS.textSecondary,
|
|
5384
5456
|
children: [
|
|
@@ -5389,7 +5461,7 @@ function ConflictsList({
|
|
|
5389
5461
|
}
|
|
5390
5462
|
),
|
|
5391
5463
|
/* @__PURE__ */ jsxs33(
|
|
5392
|
-
|
|
5464
|
+
Text34,
|
|
5393
5465
|
{
|
|
5394
5466
|
color: resolution === "use-remote" ? COLORS.success : COLORS.textSecondary,
|
|
5395
5467
|
children: [
|
|
@@ -5402,7 +5474,7 @@ function ConflictsList({
|
|
|
5402
5474
|
] })
|
|
5403
5475
|
] }, `${conflict.packageName}-${conflict.remoteMachine}`);
|
|
5404
5476
|
}),
|
|
5405
|
-
/* @__PURE__ */
|
|
5477
|
+
/* @__PURE__ */ jsx35(Box32, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs33(Text34, { color: COLORS.textSecondary, children: [
|
|
5406
5478
|
"j/k:",
|
|
5407
5479
|
t("hint_navigate"),
|
|
5408
5480
|
" l:",
|
|
@@ -5420,14 +5492,14 @@ function SyncView() {
|
|
|
5420
5492
|
const isPro = useLicenseStore((s) => s.isPro);
|
|
5421
5493
|
const navigate = useNavigationStore((s) => s.navigate);
|
|
5422
5494
|
const { config, lastResult, conflicts, loading, error, initialize, syncNow, resolveConflicts } = useSyncStore();
|
|
5423
|
-
const [phase, setPhase] =
|
|
5424
|
-
const [syncError, setSyncError] =
|
|
5425
|
-
const [conflictEntries, setConflictEntries] =
|
|
5426
|
-
const [cursor, setCursor] =
|
|
5427
|
-
|
|
5495
|
+
const [phase, setPhase] = useState18("overview");
|
|
5496
|
+
const [syncError, setSyncError] = useState18(null);
|
|
5497
|
+
const [conflictEntries, setConflictEntries] = useState18([]);
|
|
5498
|
+
const [cursor, setCursor] = useState18(0);
|
|
5499
|
+
useEffect21(() => {
|
|
5428
5500
|
void initialize(isPro());
|
|
5429
5501
|
}, []);
|
|
5430
|
-
|
|
5502
|
+
useEffect21(() => {
|
|
5431
5503
|
if (conflicts.length > 0) {
|
|
5432
5504
|
setConflictEntries(
|
|
5433
5505
|
conflicts.map((c) => ({ conflict: c, resolution: "pending" }))
|
|
@@ -5519,7 +5591,7 @@ function SyncView() {
|
|
|
5519
5591
|
}
|
|
5520
5592
|
});
|
|
5521
5593
|
if (phase === "confirming-sync") {
|
|
5522
|
-
return /* @__PURE__ */
|
|
5594
|
+
return /* @__PURE__ */ jsx35(
|
|
5523
5595
|
ConfirmDialog,
|
|
5524
5596
|
{
|
|
5525
5597
|
message: t("confirm_sync_now"),
|
|
@@ -5533,7 +5605,7 @@ function SyncView() {
|
|
|
5533
5605
|
);
|
|
5534
5606
|
}
|
|
5535
5607
|
if (phase === "confirming-apply") {
|
|
5536
|
-
return /* @__PURE__ */
|
|
5608
|
+
return /* @__PURE__ */ jsx35(
|
|
5537
5609
|
ConfirmDialog,
|
|
5538
5610
|
{
|
|
5539
5611
|
message: t("confirm_sync_apply", { count: String(conflictEntries.length) }),
|
|
@@ -5547,20 +5619,20 @@ function SyncView() {
|
|
|
5547
5619
|
);
|
|
5548
5620
|
}
|
|
5549
5621
|
if (phase === "syncing" || loading) {
|
|
5550
|
-
return /* @__PURE__ */
|
|
5622
|
+
return /* @__PURE__ */ jsx35(Loading, { message: t("sync_syncing") });
|
|
5551
5623
|
}
|
|
5552
5624
|
if (phase === "result") {
|
|
5553
5625
|
const isError = !!(syncError ?? error);
|
|
5554
5626
|
return /* @__PURE__ */ jsxs33(Box32, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
5555
|
-
/* @__PURE__ */
|
|
5556
|
-
/* @__PURE__ */
|
|
5627
|
+
/* @__PURE__ */ jsx35(SectionHeader, { emoji: "\u{1F504}", title: t("sync_title"), gradient: GRADIENTS.gold }),
|
|
5628
|
+
/* @__PURE__ */ jsx35(Box32, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx35(
|
|
5557
5629
|
ResultBanner,
|
|
5558
5630
|
{
|
|
5559
5631
|
status: isError ? "error" : "success",
|
|
5560
5632
|
message: isError ? t("sync_error", { error: syncError ?? error ?? "" }) : t("sync_success")
|
|
5561
5633
|
}
|
|
5562
5634
|
) }),
|
|
5563
|
-
/* @__PURE__ */
|
|
5635
|
+
/* @__PURE__ */ jsx35(Box32, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs33(Text34, { color: COLORS.textSecondary, children: [
|
|
5564
5636
|
"r:",
|
|
5565
5637
|
t("hint_refresh"),
|
|
5566
5638
|
" esc:",
|
|
@@ -5569,9 +5641,9 @@ function SyncView() {
|
|
|
5569
5641
|
] });
|
|
5570
5642
|
}
|
|
5571
5643
|
return /* @__PURE__ */ jsxs33(Box32, { flexDirection: "column", children: [
|
|
5572
|
-
/* @__PURE__ */
|
|
5573
|
-
error && phase === "overview" && /* @__PURE__ */
|
|
5574
|
-
phase === "overview" && /* @__PURE__ */
|
|
5644
|
+
/* @__PURE__ */ jsx35(SectionHeader, { emoji: "\u{1F504}", title: t("sync_title"), gradient: GRADIENTS.gold }),
|
|
5645
|
+
error && phase === "overview" && /* @__PURE__ */ jsx35(Box32, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx35(ResultBanner, { status: "error", message: t("sync_error", { error }) }) }),
|
|
5646
|
+
phase === "overview" && /* @__PURE__ */ jsx35(
|
|
5575
5647
|
OverviewSection,
|
|
5576
5648
|
{
|
|
5577
5649
|
config,
|
|
@@ -5585,15 +5657,15 @@ function SyncView() {
|
|
|
5585
5657
|
}
|
|
5586
5658
|
),
|
|
5587
5659
|
phase === "conflicts" && /* @__PURE__ */ jsxs33(Box32, { flexDirection: "column", children: [
|
|
5588
|
-
/* @__PURE__ */
|
|
5589
|
-
/* @__PURE__ */
|
|
5660
|
+
/* @__PURE__ */ jsx35(SectionHeader, { emoji: "\u26A0", title: t("sync_status_conflict", { count: String(conflictEntries.length) }), gradient: GRADIENTS.gold }),
|
|
5661
|
+
/* @__PURE__ */ jsx35(ConflictsList, { entries: conflictEntries, cursor })
|
|
5590
5662
|
] })
|
|
5591
5663
|
] });
|
|
5592
5664
|
}
|
|
5593
5665
|
|
|
5594
5666
|
// src/views/compliance.tsx
|
|
5595
|
-
import { useCallback as useCallback6, useEffect as
|
|
5596
|
-
import { Box as Box33, Text as
|
|
5667
|
+
import { useCallback as useCallback6, useEffect as useEffect22, useRef as useRef11, useState as useState19 } from "react";
|
|
5668
|
+
import { Box as Box33, Text as Text35 } from "ink";
|
|
5597
5669
|
import { TextInput as TextInput7 } from "@inkjs/ui";
|
|
5598
5670
|
|
|
5599
5671
|
// src/lib/compliance/compliance-remediator.ts
|
|
@@ -5638,27 +5710,27 @@ async function* remediateViolations(violations, isPro) {
|
|
|
5638
5710
|
|
|
5639
5711
|
// src/views/compliance.tsx
|
|
5640
5712
|
import { join as join4 } from "path";
|
|
5641
|
-
import { jsx as
|
|
5713
|
+
import { jsx as jsx36, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
5642
5714
|
function ComplianceScore({ report }) {
|
|
5643
5715
|
const color = report.score >= 80 ? COLORS.success : report.score >= 50 ? COLORS.warning : COLORS.error;
|
|
5644
5716
|
const bars = Math.round(report.score / 10);
|
|
5645
5717
|
return /* @__PURE__ */ jsxs34(Box33, { flexDirection: "column", marginBottom: SPACING.xs, children: [
|
|
5646
5718
|
/* @__PURE__ */ jsxs34(Box33, { children: [
|
|
5647
|
-
/* @__PURE__ */ jsxs34(
|
|
5719
|
+
/* @__PURE__ */ jsxs34(Text35, { color, children: [
|
|
5648
5720
|
"\u2593".repeat(bars),
|
|
5649
5721
|
"\u2591".repeat(10 - bars)
|
|
5650
5722
|
] }),
|
|
5651
|
-
/* @__PURE__ */ jsxs34(
|
|
5723
|
+
/* @__PURE__ */ jsxs34(Text35, { color, bold: true, children: [
|
|
5652
5724
|
" ",
|
|
5653
5725
|
report.score,
|
|
5654
5726
|
"%"
|
|
5655
5727
|
] }),
|
|
5656
|
-
/* @__PURE__ */ jsxs34(
|
|
5728
|
+
/* @__PURE__ */ jsxs34(Text35, { color: COLORS.textSecondary, children: [
|
|
5657
5729
|
" ",
|
|
5658
5730
|
t("compliance_score", { score: String(report.score) })
|
|
5659
5731
|
] })
|
|
5660
5732
|
] }),
|
|
5661
|
-
/* @__PURE__ */ jsxs34(
|
|
5733
|
+
/* @__PURE__ */ jsxs34(Text35, { color: COLORS.muted, dimColor: true, children: [
|
|
5662
5734
|
t("compliance_policy_name", { name: report.policyName }),
|
|
5663
5735
|
" \xB7 ",
|
|
5664
5736
|
t("compliance_machine", { name: report.machineName })
|
|
@@ -5669,11 +5741,11 @@ function ViolationItem({ violation }) {
|
|
|
5669
5741
|
const color = violation.severity === "error" ? COLORS.error : COLORS.warning;
|
|
5670
5742
|
const prefix = violation.severity === "error" ? "\u2717" : "\u26A0";
|
|
5671
5743
|
return /* @__PURE__ */ jsxs34(Box33, { marginBottom: SPACING.none, children: [
|
|
5672
|
-
/* @__PURE__ */ jsxs34(
|
|
5744
|
+
/* @__PURE__ */ jsxs34(Text35, { color, children: [
|
|
5673
5745
|
prefix,
|
|
5674
5746
|
" "
|
|
5675
5747
|
] }),
|
|
5676
|
-
/* @__PURE__ */
|
|
5748
|
+
/* @__PURE__ */ jsx36(Text35, { color, children: violation.detail })
|
|
5677
5749
|
] });
|
|
5678
5750
|
}
|
|
5679
5751
|
function ViolationList({ violations }) {
|
|
@@ -5681,31 +5753,31 @@ function ViolationList({ violations }) {
|
|
|
5681
5753
|
const warnings = violations.filter((v) => v.severity === "warning");
|
|
5682
5754
|
return /* @__PURE__ */ jsxs34(Box33, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
5683
5755
|
errors.length > 0 && /* @__PURE__ */ jsxs34(Box33, { flexDirection: "column", marginBottom: SPACING.xs, children: [
|
|
5684
|
-
/* @__PURE__ */ jsxs34(
|
|
5756
|
+
/* @__PURE__ */ jsxs34(Text35, { color: COLORS.error, bold: true, children: [
|
|
5685
5757
|
t("compliance_violations", { count: String(errors.length) }),
|
|
5686
5758
|
" (errors)"
|
|
5687
5759
|
] }),
|
|
5688
|
-
errors.map((v) => /* @__PURE__ */
|
|
5760
|
+
errors.map((v) => /* @__PURE__ */ jsx36(ViolationItem, { violation: v }, `${v.type}-${v.packageName}`))
|
|
5689
5761
|
] }),
|
|
5690
5762
|
warnings.length > 0 && /* @__PURE__ */ jsxs34(Box33, { flexDirection: "column", children: [
|
|
5691
|
-
/* @__PURE__ */ jsxs34(
|
|
5763
|
+
/* @__PURE__ */ jsxs34(Text35, { color: COLORS.warning, bold: true, children: [
|
|
5692
5764
|
t("compliance_violations", { count: String(warnings.length) }),
|
|
5693
5765
|
" (warnings)"
|
|
5694
5766
|
] }),
|
|
5695
|
-
warnings.map((v) => /* @__PURE__ */
|
|
5767
|
+
warnings.map((v) => /* @__PURE__ */ jsx36(ViolationItem, { violation: v }, `${v.type}-${v.packageName}`))
|
|
5696
5768
|
] })
|
|
5697
5769
|
] });
|
|
5698
5770
|
}
|
|
5699
5771
|
function ComplianceView() {
|
|
5700
5772
|
const isPro = useLicenseStore((s) => s.isPro);
|
|
5701
5773
|
const { policy, report, loading, error, importPolicy, runCheck } = useComplianceStore();
|
|
5702
|
-
const [phase, setPhase] =
|
|
5703
|
-
const [resultMessage, setResultMessage] =
|
|
5704
|
-
const [streamLines, setStreamLines] =
|
|
5705
|
-
const [streamRunning, setStreamRunning] =
|
|
5706
|
-
const generatorRef =
|
|
5707
|
-
const mountedRef =
|
|
5708
|
-
|
|
5774
|
+
const [phase, setPhase] = useState19("overview");
|
|
5775
|
+
const [resultMessage, setResultMessage] = useState19(null);
|
|
5776
|
+
const [streamLines, setStreamLines] = useState19([]);
|
|
5777
|
+
const [streamRunning, setStreamRunning] = useState19(false);
|
|
5778
|
+
const generatorRef = useRef11(null);
|
|
5779
|
+
const mountedRef = useRef11(true);
|
|
5780
|
+
useEffect22(() => {
|
|
5709
5781
|
mountedRef.current = true;
|
|
5710
5782
|
return () => {
|
|
5711
5783
|
mountedRef.current = false;
|
|
@@ -5817,7 +5889,7 @@ function ComplianceView() {
|
|
|
5817
5889
|
const actionable = report.violations.filter(
|
|
5818
5890
|
(v) => v.type === "missing" || v.type === "wrong-version"
|
|
5819
5891
|
);
|
|
5820
|
-
return /* @__PURE__ */
|
|
5892
|
+
return /* @__PURE__ */ jsx36(
|
|
5821
5893
|
ConfirmDialog,
|
|
5822
5894
|
{
|
|
5823
5895
|
message: t("confirm_compliance_remediate", { count: String(actionable.length) }),
|
|
@@ -5833,23 +5905,23 @@ function ComplianceView() {
|
|
|
5833
5905
|
if (phase === "remediating" || loading && phase !== "importing") {
|
|
5834
5906
|
if (phase === "remediating") {
|
|
5835
5907
|
return /* @__PURE__ */ jsxs34(Box33, { flexDirection: "column", children: [
|
|
5836
|
-
/* @__PURE__ */
|
|
5837
|
-
/* @__PURE__ */
|
|
5908
|
+
/* @__PURE__ */ jsx36(SectionHeader, { emoji: "\u{1F50D}", title: t("compliance_title"), gradient: GRADIENTS.gold }),
|
|
5909
|
+
/* @__PURE__ */ jsx36(Box33, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx36(ProgressLog, { lines: streamLines, isRunning: streamRunning, title: t("compliance_remediating") }) })
|
|
5838
5910
|
] });
|
|
5839
5911
|
}
|
|
5840
|
-
return /* @__PURE__ */
|
|
5912
|
+
return /* @__PURE__ */ jsx36(Loading, { message: t("compliance_title") });
|
|
5841
5913
|
}
|
|
5842
5914
|
if (phase === "result" && resultMessage) {
|
|
5843
5915
|
return /* @__PURE__ */ jsxs34(Box33, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
5844
|
-
/* @__PURE__ */
|
|
5845
|
-
/* @__PURE__ */
|
|
5916
|
+
/* @__PURE__ */ jsx36(SectionHeader, { emoji: "\u{1F50D}", title: t("compliance_title"), gradient: GRADIENTS.gold }),
|
|
5917
|
+
/* @__PURE__ */ jsx36(Box33, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx36(
|
|
5846
5918
|
ResultBanner,
|
|
5847
5919
|
{
|
|
5848
5920
|
status: resultMessage.ok ? "success" : "error",
|
|
5849
5921
|
message: resultMessage.text
|
|
5850
5922
|
}
|
|
5851
5923
|
) }),
|
|
5852
|
-
/* @__PURE__ */
|
|
5924
|
+
/* @__PURE__ */ jsx36(Box33, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs34(Text35, { color: COLORS.textSecondary, children: [
|
|
5853
5925
|
"r:",
|
|
5854
5926
|
t("hint_refresh"),
|
|
5855
5927
|
" esc:",
|
|
@@ -5858,11 +5930,11 @@ function ComplianceView() {
|
|
|
5858
5930
|
] });
|
|
5859
5931
|
}
|
|
5860
5932
|
return /* @__PURE__ */ jsxs34(Box33, { flexDirection: "column", children: [
|
|
5861
|
-
/* @__PURE__ */
|
|
5862
|
-
error && /* @__PURE__ */
|
|
5933
|
+
/* @__PURE__ */ jsx36(SectionHeader, { emoji: "\u{1F50D}", title: t("compliance_title"), gradient: GRADIENTS.gold }),
|
|
5934
|
+
error && /* @__PURE__ */ jsx36(Box33, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx36(ResultBanner, { status: "error", message: t("compliance_import_error", { error }) }) }),
|
|
5863
5935
|
phase === "importing" && /* @__PURE__ */ jsxs34(Box33, { marginTop: SPACING.xs, flexDirection: "column", children: [
|
|
5864
|
-
/* @__PURE__ */
|
|
5865
|
-
/* @__PURE__ */
|
|
5936
|
+
/* @__PURE__ */ jsx36(Text35, { color: COLORS.textSecondary, children: t("compliance_import_prompt") }),
|
|
5937
|
+
/* @__PURE__ */ jsx36(Box33, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx36(
|
|
5866
5938
|
TextInput7,
|
|
5867
5939
|
{
|
|
5868
5940
|
defaultValue: "",
|
|
@@ -5871,31 +5943,31 @@ function ComplianceView() {
|
|
|
5871
5943
|
}
|
|
5872
5944
|
}
|
|
5873
5945
|
) }),
|
|
5874
|
-
/* @__PURE__ */
|
|
5946
|
+
/* @__PURE__ */ jsx36(Box33, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsxs34(Text35, { color: COLORS.muted, dimColor: true, children: [
|
|
5875
5947
|
"esc:",
|
|
5876
5948
|
t("hint_back")
|
|
5877
5949
|
] }) })
|
|
5878
5950
|
] }),
|
|
5879
5951
|
phase === "overview" && /* @__PURE__ */ jsxs34(Box33, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
5880
|
-
!policy ? /* @__PURE__ */
|
|
5881
|
-
/* @__PURE__ */
|
|
5952
|
+
!policy ? /* @__PURE__ */ jsx36(Box33, { flexDirection: "column", children: /* @__PURE__ */ jsx36(Text35, { color: COLORS.textSecondary, children: t("compliance_no_policy") }) }) : /* @__PURE__ */ jsxs34(Box33, { flexDirection: "column", children: [
|
|
5953
|
+
/* @__PURE__ */ jsx36(Text35, { color: COLORS.textSecondary, bold: true, children: t("compliance_policy_by", { maintainer: policy.meta.maintainer }) }),
|
|
5882
5954
|
report ? /* @__PURE__ */ jsxs34(Box33, { flexDirection: "column", marginTop: SPACING.xs, children: [
|
|
5883
|
-
/* @__PURE__ */
|
|
5884
|
-
report.compliant ? /* @__PURE__ */
|
|
5885
|
-
] }) : /* @__PURE__ */
|
|
5955
|
+
/* @__PURE__ */ jsx36(ComplianceScore, { report }),
|
|
5956
|
+
report.compliant ? /* @__PURE__ */ jsx36(ResultBanner, { status: "success", message: t("compliance_ok") }) : /* @__PURE__ */ jsx36(ViolationList, { violations: report.violations })
|
|
5957
|
+
] }) : /* @__PURE__ */ jsx36(Box33, { marginTop: SPACING.xs, children: /* @__PURE__ */ jsx36(Text35, { color: COLORS.muted, dimColor: true, children: t("compliance_press_r_hint") }) })
|
|
5886
5958
|
] }),
|
|
5887
|
-
/* @__PURE__ */
|
|
5959
|
+
/* @__PURE__ */ jsx36(Box33, { marginTop: SPACING.sm, flexWrap: "wrap", children: /* @__PURE__ */ jsxs34(Text35, { color: COLORS.textSecondary, children: [
|
|
5888
5960
|
"i:",
|
|
5889
5961
|
t("hint_import"),
|
|
5890
|
-
policy && /* @__PURE__ */ jsxs34(
|
|
5962
|
+
policy && /* @__PURE__ */ jsxs34(Text35, { children: [
|
|
5891
5963
|
" r:",
|
|
5892
5964
|
t("hint_scan")
|
|
5893
5965
|
] }),
|
|
5894
|
-
report && /* @__PURE__ */ jsxs34(
|
|
5966
|
+
report && /* @__PURE__ */ jsxs34(Text35, { children: [
|
|
5895
5967
|
" e:",
|
|
5896
5968
|
t("hint_export")
|
|
5897
5969
|
] }),
|
|
5898
|
-
report && report.violations.some((v) => v.type === "missing" || v.type === "wrong-version") && /* @__PURE__ */ jsxs34(
|
|
5970
|
+
report && report.violations.some((v) => v.type === "missing" || v.type === "wrong-version") && /* @__PURE__ */ jsxs34(Text35, { children: [
|
|
5899
5971
|
" c:",
|
|
5900
5972
|
t("hint_clean")
|
|
5901
5973
|
] }),
|
|
@@ -5907,10 +5979,10 @@ function ComplianceView() {
|
|
|
5907
5979
|
}
|
|
5908
5980
|
|
|
5909
5981
|
// src/app.tsx
|
|
5910
|
-
import { Fragment as Fragment7, jsx as
|
|
5982
|
+
import { Fragment as Fragment7, jsx as jsx37, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
5911
5983
|
function LicenseInitializer() {
|
|
5912
5984
|
const initLicense = useLicenseStore((s) => s.initialize);
|
|
5913
|
-
|
|
5985
|
+
useEffect23(() => {
|
|
5914
5986
|
initLicense();
|
|
5915
5987
|
}, []);
|
|
5916
5988
|
return null;
|
|
@@ -5919,65 +5991,65 @@ function ViewRouter({ currentView }) {
|
|
|
5919
5991
|
const isPro = useLicenseStore((s) => s.isPro);
|
|
5920
5992
|
const isTeam = useLicenseStore((s) => s.isTeam);
|
|
5921
5993
|
if (isProView(currentView) && !isPro()) {
|
|
5922
|
-
return /* @__PURE__ */
|
|
5994
|
+
return /* @__PURE__ */ jsx37(UpgradePrompt, { viewId: currentView });
|
|
5923
5995
|
}
|
|
5924
5996
|
if (isTeamView(currentView) && !isTeam()) {
|
|
5925
|
-
return /* @__PURE__ */
|
|
5997
|
+
return /* @__PURE__ */ jsx37(UpgradePrompt, { viewId: currentView });
|
|
5926
5998
|
}
|
|
5927
5999
|
switch (currentView) {
|
|
5928
6000
|
case "dashboard":
|
|
5929
|
-
return /* @__PURE__ */
|
|
6001
|
+
return /* @__PURE__ */ jsx37(DashboardView, {});
|
|
5930
6002
|
case "installed":
|
|
5931
|
-
return /* @__PURE__ */
|
|
6003
|
+
return /* @__PURE__ */ jsx37(InstalledView, {});
|
|
5932
6004
|
case "search":
|
|
5933
|
-
return /* @__PURE__ */
|
|
6005
|
+
return /* @__PURE__ */ jsx37(SearchView, {});
|
|
5934
6006
|
case "outdated":
|
|
5935
|
-
return /* @__PURE__ */
|
|
6007
|
+
return /* @__PURE__ */ jsx37(OutdatedView, {});
|
|
5936
6008
|
case "package-info":
|
|
5937
|
-
return /* @__PURE__ */
|
|
6009
|
+
return /* @__PURE__ */ jsx37(PackageInfoView, {});
|
|
5938
6010
|
case "services":
|
|
5939
|
-
return /* @__PURE__ */
|
|
6011
|
+
return /* @__PURE__ */ jsx37(ServicesView, {});
|
|
5940
6012
|
case "doctor":
|
|
5941
|
-
return /* @__PURE__ */
|
|
6013
|
+
return /* @__PURE__ */ jsx37(DoctorView, {});
|
|
5942
6014
|
case "profiles":
|
|
5943
|
-
return /* @__PURE__ */
|
|
6015
|
+
return /* @__PURE__ */ jsx37(ProfilesView, {});
|
|
5944
6016
|
case "smart-cleanup":
|
|
5945
|
-
return /* @__PURE__ */
|
|
6017
|
+
return /* @__PURE__ */ jsx37(SmartCleanupView, {});
|
|
5946
6018
|
case "history":
|
|
5947
|
-
return /* @__PURE__ */
|
|
6019
|
+
return /* @__PURE__ */ jsx37(HistoryView, {});
|
|
5948
6020
|
case "rollback":
|
|
5949
|
-
return /* @__PURE__ */
|
|
6021
|
+
return /* @__PURE__ */ jsx37(RollbackView, {});
|
|
5950
6022
|
case "brewfile":
|
|
5951
|
-
return /* @__PURE__ */
|
|
6023
|
+
return /* @__PURE__ */ jsx37(BrewfileView, {});
|
|
5952
6024
|
case "sync":
|
|
5953
|
-
return /* @__PURE__ */
|
|
6025
|
+
return /* @__PURE__ */ jsx37(SyncView, {});
|
|
5954
6026
|
case "security-audit":
|
|
5955
|
-
return /* @__PURE__ */
|
|
6027
|
+
return /* @__PURE__ */ jsx37(SecurityAuditView, {});
|
|
5956
6028
|
case "compliance":
|
|
5957
|
-
return /* @__PURE__ */
|
|
6029
|
+
return /* @__PURE__ */ jsx37(ComplianceView, {});
|
|
5958
6030
|
case "account":
|
|
5959
|
-
return /* @__PURE__ */
|
|
6031
|
+
return /* @__PURE__ */ jsx37(AccountView, {});
|
|
5960
6032
|
}
|
|
5961
6033
|
}
|
|
5962
6034
|
function App() {
|
|
5963
6035
|
const { exit } = useApp();
|
|
5964
6036
|
const currentView = useNavigationStore((s) => s.currentView);
|
|
5965
6037
|
const isTestEnv = typeof process !== "undefined" && false;
|
|
5966
|
-
const [showWelcome, setShowWelcome] =
|
|
5967
|
-
|
|
6038
|
+
const [showWelcome, setShowWelcome] = useState20(isTestEnv ? false : null);
|
|
6039
|
+
useEffect23(() => {
|
|
5968
6040
|
if (isTestEnv) return;
|
|
5969
6041
|
void hasCompletedOnboarding().then((done) => setShowWelcome(!done));
|
|
5970
6042
|
}, []);
|
|
5971
6043
|
useGlobalKeyboard({ onQuit: exit });
|
|
5972
6044
|
if (showWelcome === null) {
|
|
5973
|
-
return /* @__PURE__ */
|
|
6045
|
+
return /* @__PURE__ */ jsx37(AppLayout, { children: /* @__PURE__ */ jsx37(Fragment7, {}) });
|
|
5974
6046
|
}
|
|
5975
6047
|
if (showWelcome) {
|
|
5976
|
-
return /* @__PURE__ */
|
|
6048
|
+
return /* @__PURE__ */ jsx37(AppLayout, { children: /* @__PURE__ */ jsx37(WelcomeView, { onContinue: () => setShowWelcome(false) }) });
|
|
5977
6049
|
}
|
|
5978
6050
|
return /* @__PURE__ */ jsxs35(AppLayout, { children: [
|
|
5979
|
-
/* @__PURE__ */
|
|
5980
|
-
/* @__PURE__ */
|
|
6051
|
+
/* @__PURE__ */ jsx37(LicenseInitializer, {}),
|
|
6052
|
+
/* @__PURE__ */ jsx37(ViewRouter, { currentView })
|
|
5981
6053
|
] });
|
|
5982
6054
|
}
|
|
5983
6055
|
|
|
@@ -6061,7 +6133,7 @@ async function reportError(err, context = {}) {
|
|
|
6061
6133
|
const config = await resolveConfig();
|
|
6062
6134
|
if (!config.enabled || !config.endpoint) return;
|
|
6063
6135
|
const machineId = await getMachineId();
|
|
6064
|
-
const version = true ? "0.9.
|
|
6136
|
+
const version = true ? "0.9.2" : "unknown";
|
|
6065
6137
|
await postReport(buildReport("error", err, context, machineId, version), config);
|
|
6066
6138
|
}
|
|
6067
6139
|
async function installCrashReporter() {
|
|
@@ -6070,7 +6142,7 @@ async function installCrashReporter() {
|
|
|
6070
6142
|
if (!config.enabled || !config.endpoint) return;
|
|
6071
6143
|
_installed = true;
|
|
6072
6144
|
const machineId = await getMachineId();
|
|
6073
|
-
const version = true ? "0.9.
|
|
6145
|
+
const version = true ? "0.9.2" : "unknown";
|
|
6074
6146
|
process.on("uncaughtException", (err) => {
|
|
6075
6147
|
void postReport(buildReport("fatal", err, { kind: "uncaughtException" }, machineId, version), config);
|
|
6076
6148
|
});
|
|
@@ -6081,11 +6153,11 @@ async function installCrashReporter() {
|
|
|
6081
6153
|
}
|
|
6082
6154
|
|
|
6083
6155
|
// src/index.tsx
|
|
6084
|
-
import { jsx as
|
|
6156
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
6085
6157
|
var [, , command, arg] = process.argv;
|
|
6086
6158
|
async function runCli() {
|
|
6087
6159
|
if (command === "--version" || command === "-v" || command === "version") {
|
|
6088
|
-
process.stdout.write("0.9.
|
|
6160
|
+
process.stdout.write("0.9.2\n");
|
|
6089
6161
|
return;
|
|
6090
6162
|
}
|
|
6091
6163
|
await ensureDataDirs();
|
|
@@ -6201,7 +6273,7 @@ Snapshots: ${snapshots.length} (latest: ${latest ? formatDate(latest.capturedAt)
|
|
|
6201
6273
|
} catch {
|
|
6202
6274
|
}
|
|
6203
6275
|
try {
|
|
6204
|
-
const { loadSyncConfig: loadSyncConfig2 } = await import("./sync-engine-
|
|
6276
|
+
const { loadSyncConfig: loadSyncConfig2 } = await import("./sync-engine-76YMONYH.js");
|
|
6205
6277
|
const syncConfig = await loadSyncConfig2();
|
|
6206
6278
|
if (syncConfig?.lastSync) {
|
|
6207
6279
|
console.log(`Sync: last sync ${formatDate(syncConfig.lastSync)}`);
|
|
@@ -6224,8 +6296,9 @@ Snapshots: ${snapshots.length} (latest: ${latest ? formatDate(latest.capturedAt)
|
|
|
6224
6296
|
if (command === "install-brewbar") {
|
|
6225
6297
|
await useLicenseStore.getState().initialize();
|
|
6226
6298
|
const isPro = useLicenseStore.getState().isPro();
|
|
6227
|
-
const { installBrewBar } = await import("./brewbar-installer-
|
|
6299
|
+
const { installBrewBar } = await import("./brewbar-installer-GWJ76J6G.js");
|
|
6228
6300
|
try {
|
|
6301
|
+
console.log(t("cli_brewbarInstalling"));
|
|
6229
6302
|
await installBrewBar(isPro, arg === "--force");
|
|
6230
6303
|
console.log(t("cli_brewbarInstalled"));
|
|
6231
6304
|
} catch (err) {
|
|
@@ -6235,7 +6308,7 @@ Snapshots: ${snapshots.length} (latest: ${latest ? formatDate(latest.capturedAt)
|
|
|
6235
6308
|
return;
|
|
6236
6309
|
}
|
|
6237
6310
|
if (command === "uninstall-brewbar") {
|
|
6238
|
-
const { uninstallBrewBar } = await import("./brewbar-installer-
|
|
6311
|
+
const { uninstallBrewBar } = await import("./brewbar-installer-GWJ76J6G.js");
|
|
6239
6312
|
try {
|
|
6240
6313
|
await uninstallBrewBar();
|
|
6241
6314
|
console.log(t("cli_brewbarUninstalled"));
|
|
@@ -6260,14 +6333,14 @@ Snapshots: ${snapshots.length} (latest: ${latest ? formatDate(latest.capturedAt)
|
|
|
6260
6333
|
await ensureBrewBarRunning();
|
|
6261
6334
|
process.env.BREW_TUI_TUI_MODE = "1";
|
|
6262
6335
|
process.stdout.write("\x1B[2J\x1B[3J\x1B[H");
|
|
6263
|
-
render(/* @__PURE__ */
|
|
6336
|
+
render(/* @__PURE__ */ jsx38(App, {}));
|
|
6264
6337
|
}
|
|
6265
6338
|
async function ensureBrewBarRunning() {
|
|
6266
6339
|
if (process.platform !== "darwin") return;
|
|
6267
6340
|
await useLicenseStore.getState().initialize();
|
|
6268
6341
|
if (!useLicenseStore.getState().isPro()) return;
|
|
6269
|
-
const { isBrewBarInstalled, installBrewBar, launchBrewBar } = await import("./brewbar-installer-
|
|
6270
|
-
const { checkBrewBarVersion } = await import("./version-check-
|
|
6342
|
+
const { isBrewBarInstalled, installBrewBar, launchBrewBar } = await import("./brewbar-installer-GWJ76J6G.js");
|
|
6343
|
+
const { checkBrewBarVersion } = await import("./version-check-LHQYDFDA.js");
|
|
6271
6344
|
try {
|
|
6272
6345
|
if (!await isBrewBarInstalled()) {
|
|
6273
6346
|
console.log(t("cli_brewbarInstalling"));
|