@algolia/wizard 0.46.0-rc.146.324 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +338 -336
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { render } from "ink";
|
|
5
5
|
|
|
6
6
|
// src/ui/App.tsx
|
|
7
|
-
import { Box as
|
|
7
|
+
import { Box as Box20, Text as Text20, useApp, useInput as useInput7, useWindowSize as useWindowSize7 } from "ink";
|
|
8
8
|
import Spinner2 from "ink-spinner";
|
|
9
9
|
|
|
10
10
|
// src/core/store.ts
|
|
@@ -499,112 +499,23 @@ function CliOutput() {
|
|
|
499
499
|
}
|
|
500
500
|
|
|
501
501
|
// src/ui/Notices.tsx
|
|
502
|
-
import { Box as
|
|
503
|
-
import { useEffect as useEffect2, useState as
|
|
504
|
-
|
|
505
|
-
// src/ui/ScrollView.tsx
|
|
506
|
-
import { Box as Box2, Text as Text2, measureElement, useWindowSize as useWindowSize2 } from "ink";
|
|
507
|
-
import { useCallback, useLayoutEffect, useRef, useState } from "react";
|
|
508
|
-
import { jsxs as jsxs2 } from "react/jsx-runtime";
|
|
509
|
-
var INDICATOR_ROWS = 2;
|
|
510
|
-
function fittedWidth(node, columns) {
|
|
511
|
-
let left = 0;
|
|
512
|
-
for (let n = node; n; n = n.parentNode) {
|
|
513
|
-
left += n.yogaNode?.getComputedLeft() ?? 0;
|
|
514
|
-
}
|
|
515
|
-
return Math.max(Math.min(measureElement(node).width, columns - left), 0);
|
|
516
|
-
}
|
|
517
|
-
function useScrollWindow({
|
|
518
|
-
itemCount,
|
|
519
|
-
rowHeight = 1,
|
|
520
|
-
followBottom = false
|
|
521
|
-
}) {
|
|
522
|
-
const viewportRef = useRef(null);
|
|
523
|
-
const { columns } = useWindowSize2();
|
|
524
|
-
const [size, setSize] = useState(
|
|
525
|
-
null
|
|
526
|
-
);
|
|
527
|
-
useLayoutEffect(() => {
|
|
528
|
-
if (!viewportRef.current) return;
|
|
529
|
-
const width = fittedWidth(viewportRef.current, columns);
|
|
530
|
-
const { height } = measureElement(viewportRef.current);
|
|
531
|
-
setSize(
|
|
532
|
-
(prev) => prev?.width === width && prev.height === height ? prev : { width, height }
|
|
533
|
-
);
|
|
534
|
-
});
|
|
535
|
-
const capacity = size === null || itemCount * rowHeight <= size.height ? itemCount : Math.max(Math.floor((size.height - INDICATOR_ROWS) / rowHeight), 1);
|
|
536
|
-
const maxOffset = Math.max(itemCount - capacity, 0);
|
|
537
|
-
const [offset, setOffset] = useState(0);
|
|
538
|
-
const prevMaxOffsetRef = useRef(0);
|
|
539
|
-
useLayoutEffect(() => {
|
|
540
|
-
const wasAtBottom = offset >= prevMaxOffsetRef.current;
|
|
541
|
-
prevMaxOffsetRef.current = maxOffset;
|
|
542
|
-
setOffset(
|
|
543
|
-
(o) => followBottom && wasAtBottom ? maxOffset : Math.min(o, maxOffset)
|
|
544
|
-
);
|
|
545
|
-
}, [maxOffset, followBottom]);
|
|
546
|
-
const scrollBy = useCallback(
|
|
547
|
-
(delta) => {
|
|
548
|
-
setOffset((o) => Math.min(Math.max(o + delta, 0), maxOffset));
|
|
549
|
-
},
|
|
550
|
-
[maxOffset]
|
|
551
|
-
);
|
|
552
|
-
const revealIndex = useCallback(
|
|
553
|
-
(index) => {
|
|
554
|
-
setOffset((o) => {
|
|
555
|
-
if (index < o) return index;
|
|
556
|
-
if (index >= o + capacity) {
|
|
557
|
-
return Math.min(index - capacity + 1, maxOffset);
|
|
558
|
-
}
|
|
559
|
-
return o;
|
|
560
|
-
});
|
|
561
|
-
},
|
|
562
|
-
[capacity, maxOffset]
|
|
563
|
-
);
|
|
564
|
-
const visibleCount = Math.min(capacity, Math.max(itemCount - offset, 0));
|
|
565
|
-
return {
|
|
566
|
-
viewportRef,
|
|
567
|
-
measured: size !== null,
|
|
568
|
-
width: size?.width ?? columns,
|
|
569
|
-
offset,
|
|
570
|
-
capacity,
|
|
571
|
-
maxOffset,
|
|
572
|
-
hiddenAbove: Math.min(offset, itemCount),
|
|
573
|
-
hiddenBelow: Math.max(itemCount - offset - visibleCount, 0),
|
|
574
|
-
scrollBy,
|
|
575
|
-
revealIndex
|
|
576
|
-
};
|
|
577
|
-
}
|
|
578
|
-
function ScrollView({ scroll, children }) {
|
|
579
|
-
return /* @__PURE__ */ jsxs2(Box2, { ref: scroll.viewportRef, flexDirection: "column", flexGrow: 1, children: [
|
|
580
|
-
scroll.hiddenAbove > 0 && /* @__PURE__ */ jsxs2(Text2, { color: COLORS.dim, children: [
|
|
581
|
-
"\u2191 ",
|
|
582
|
-
scroll.hiddenAbove,
|
|
583
|
-
" more"
|
|
584
|
-
] }),
|
|
585
|
-
children,
|
|
586
|
-
scroll.hiddenBelow > 0 && /* @__PURE__ */ jsxs2(Text2, { color: COLORS.dim, children: [
|
|
587
|
-
"\u2193 ",
|
|
588
|
-
scroll.hiddenBelow,
|
|
589
|
-
" more"
|
|
590
|
-
] })
|
|
591
|
-
] });
|
|
592
|
-
}
|
|
502
|
+
import { Box as Box3, Text as Text3 } from "ink";
|
|
503
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
593
504
|
|
|
594
505
|
// src/ui/Table.tsx
|
|
595
|
-
import { Box as
|
|
596
|
-
import { useEffect, useRef
|
|
506
|
+
import { Box as Box2, Text as Text2, measureElement, useWindowSize as useWindowSize2 } from "ink";
|
|
507
|
+
import { useEffect, useRef, useState } from "react";
|
|
597
508
|
import { jsx } from "react/jsx-runtime";
|
|
598
509
|
function Table({ columns, rows }) {
|
|
599
|
-
const { columns: termCols } =
|
|
600
|
-
const ref =
|
|
601
|
-
const [width, setWidth] =
|
|
510
|
+
const { columns: termCols } = useWindowSize2();
|
|
511
|
+
const ref = useRef(null);
|
|
512
|
+
const [width, setWidth] = useState(0);
|
|
602
513
|
useEffect(() => {
|
|
603
|
-
if (ref.current) setWidth(
|
|
514
|
+
if (ref.current) setWidth(measureElement(ref.current).width);
|
|
604
515
|
}, [termCols, columns, rows]);
|
|
605
516
|
if (rows.length === 0) return null;
|
|
606
517
|
const lines = formatTable(columns, rows, width || void 0);
|
|
607
|
-
return /* @__PURE__ */ jsx(
|
|
518
|
+
return /* @__PURE__ */ jsx(Box2, { flexDirection: "column", ref, children: lines.map((line, i) => /* @__PURE__ */ jsx(Text2, { color: COLORS.primary, wrap: "truncate", children: line }, `tbl-${i}`)) });
|
|
608
519
|
}
|
|
609
520
|
function formatTable(columns, rows, width) {
|
|
610
521
|
const natural = columns.map(
|
|
@@ -645,7 +556,7 @@ function resize(widths, budget) {
|
|
|
645
556
|
var truncate = (s, width) => s.length <= width ? s : width <= 1 ? s.slice(0, width) : `${s.slice(0, width - 1)}\u2026`;
|
|
646
557
|
|
|
647
558
|
// src/ui/Notices.tsx
|
|
648
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
559
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
649
560
|
var AGENT_MARKER = "\u2726";
|
|
650
561
|
var PULSE_STEPS = 12;
|
|
651
562
|
var PULSE_STEP_MS = 150;
|
|
@@ -667,48 +578,14 @@ function parseHex(hex) {
|
|
|
667
578
|
b: parseInt(n.slice(4, 6), 16)
|
|
668
579
|
};
|
|
669
580
|
}
|
|
670
|
-
function flattenRows(notices, width) {
|
|
671
|
-
const rows = [];
|
|
672
|
-
notices.forEach((notice, noticeIndex) => {
|
|
673
|
-
if (noticeIndex > 0 && notice.table) {
|
|
674
|
-
rows.push({ noticeIndex, text: " ", plain: true });
|
|
675
|
-
}
|
|
676
|
-
notice.messages?.forEach((m, j) => {
|
|
677
|
-
const line = typeof m === "string" ? { text: m } : m;
|
|
678
|
-
rows.push({
|
|
679
|
-
noticeIndex,
|
|
680
|
-
text: `${j === 0 ? `${AGENT_MARKER} ` : " "}${line.text}`,
|
|
681
|
-
color: line.color,
|
|
682
|
-
bold: line.bold
|
|
683
|
-
});
|
|
684
|
-
});
|
|
685
|
-
if (notice.table) {
|
|
686
|
-
for (const text of formatTable(
|
|
687
|
-
notice.table.columns,
|
|
688
|
-
notice.table.rows,
|
|
689
|
-
width
|
|
690
|
-
)) {
|
|
691
|
-
rows.push({ noticeIndex, text, plain: true });
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
});
|
|
695
|
-
return rows;
|
|
696
|
-
}
|
|
697
581
|
function Notices({
|
|
698
582
|
showAll = false,
|
|
699
583
|
border = true
|
|
700
584
|
} = {}) {
|
|
701
585
|
const notices = useWizard((s) => s.notices);
|
|
702
|
-
const
|
|
703
|
-
const
|
|
704
|
-
const
|
|
705
|
-
const latestRowIndex = showAll ? latestIndex : 0;
|
|
706
|
-
const measuredRows = flattenRows(visible, columns);
|
|
707
|
-
const scroll = useScrollWindow({
|
|
708
|
-
itemCount: measuredRows.length,
|
|
709
|
-
followBottom: true
|
|
710
|
-
});
|
|
711
|
-
const [pulseStep, setPulseStep] = useState3(0);
|
|
586
|
+
const latest = notices[notices.length - 1];
|
|
587
|
+
const visible = showAll ? notices : latest ? [latest] : [];
|
|
588
|
+
const [pulseStep, setPulseStep] = useState2(0);
|
|
712
589
|
useEffect2(() => {
|
|
713
590
|
let direction = 1;
|
|
714
591
|
const id = setInterval(() => {
|
|
@@ -723,10 +600,8 @@ function Notices({
|
|
|
723
600
|
}, []);
|
|
724
601
|
if (visible.length === 0) return null;
|
|
725
602
|
const pulseColor = PULSE_COLORS[pulseStep];
|
|
726
|
-
const rows = scroll.width === columns ? measuredRows : flattenRows(visible, scroll.width);
|
|
727
|
-
const windowed = rows.slice(scroll.offset, scroll.offset + scroll.capacity);
|
|
728
603
|
return /* @__PURE__ */ jsx2(
|
|
729
|
-
|
|
604
|
+
Box3,
|
|
730
605
|
{
|
|
731
606
|
borderColor: border ? COLORS.border : void 0,
|
|
732
607
|
borderStyle: border ? "single" : void 0,
|
|
@@ -736,18 +611,26 @@ function Notices({
|
|
|
736
611
|
borderBottom: false,
|
|
737
612
|
paddingTop: border ? 1 : 0,
|
|
738
613
|
flexDirection: "column",
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
614
|
+
gap: 1,
|
|
615
|
+
children: visible.map((notice, i) => /* @__PURE__ */ jsxs2(Box3, { flexDirection: "column", children: [
|
|
616
|
+
notice.messages?.map((m, j) => {
|
|
617
|
+
const line = typeof m === "string" ? { text: m } : m;
|
|
618
|
+
const prefix = j === 0 ? `${AGENT_MARKER} ` : " ";
|
|
619
|
+
return /* @__PURE__ */ jsxs2(
|
|
620
|
+
Text3,
|
|
621
|
+
{
|
|
622
|
+
color: !line.color ? notice === latest ? pulseColor : COLORS.dim : line.color ?? COLORS.dim,
|
|
623
|
+
bold: line.bold,
|
|
624
|
+
children: [
|
|
625
|
+
prefix,
|
|
626
|
+
line.text
|
|
627
|
+
]
|
|
628
|
+
},
|
|
629
|
+
`notice-line-${j}`
|
|
630
|
+
);
|
|
631
|
+
}),
|
|
632
|
+
notice.table && /* @__PURE__ */ jsx2(Table, { columns: notice.table.columns, rows: notice.table.rows })
|
|
633
|
+
] }, `notice-${i}`))
|
|
751
634
|
}
|
|
752
635
|
);
|
|
753
636
|
}
|
|
@@ -758,14 +641,14 @@ import TextInput from "ink-text-input";
|
|
|
758
641
|
import { useState as useState6 } from "react";
|
|
759
642
|
|
|
760
643
|
// src/ui/CommandApproval.tsx
|
|
761
|
-
import { Box as
|
|
644
|
+
import { Box as Box6, Text as Text6 } from "ink";
|
|
762
645
|
|
|
763
646
|
// src/ui/DecisionSelect.tsx
|
|
764
|
-
import { Box as
|
|
765
|
-
import { useState as
|
|
647
|
+
import { Box as Box5, Text as Text5, useInput } from "ink";
|
|
648
|
+
import { useState as useState3 } from "react";
|
|
766
649
|
|
|
767
650
|
// src/ui/SelectRow.tsx
|
|
768
|
-
import { Box as
|
|
651
|
+
import { Box as Box4, Text as Text4 } from "ink";
|
|
769
652
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
770
653
|
function SelectRow({
|
|
771
654
|
highlighted,
|
|
@@ -778,15 +661,15 @@ function SelectRow({
|
|
|
778
661
|
}) {
|
|
779
662
|
const labelColor = highlighted ? highlightBackground ? COLORS.highlight.fg : COLORS.success : COLORS.primary;
|
|
780
663
|
return /* @__PURE__ */ jsxs3(
|
|
781
|
-
|
|
664
|
+
Box4,
|
|
782
665
|
{
|
|
783
666
|
width,
|
|
784
667
|
paddingX: usePadding ? 1 : 0,
|
|
785
668
|
paddingY: usePadding ? 1 : 0,
|
|
786
669
|
backgroundColor: highlighted && highlightBackground ? COLORS.highlight.bg : void 0,
|
|
787
670
|
children: [
|
|
788
|
-
/* @__PURE__ */ jsx3(
|
|
789
|
-
|
|
671
|
+
/* @__PURE__ */ jsx3(Box4, { width: labelWidth, children: /* @__PURE__ */ jsxs3(
|
|
672
|
+
Text4,
|
|
790
673
|
{
|
|
791
674
|
color: labelColor,
|
|
792
675
|
bold: highlighted && !highlightBackground,
|
|
@@ -809,7 +692,7 @@ function DecisionSelect({
|
|
|
809
692
|
actions,
|
|
810
693
|
onDecide
|
|
811
694
|
}) {
|
|
812
|
-
const [index, setIndex] =
|
|
695
|
+
const [index, setIndex] = useState3(0);
|
|
813
696
|
useInput((input, key) => {
|
|
814
697
|
if (key.upArrow || input === "k") {
|
|
815
698
|
setIndex((i) => (i - 1 + actions.length) % actions.length);
|
|
@@ -821,8 +704,8 @@ function DecisionSelect({
|
|
|
821
704
|
onDecide(actions[1].value);
|
|
822
705
|
}
|
|
823
706
|
});
|
|
824
|
-
return /* @__PURE__ */ jsxs4(
|
|
825
|
-
/* @__PURE__ */ jsx4(
|
|
707
|
+
return /* @__PURE__ */ jsxs4(Box5, { flexDirection: "column", gap: 1, children: [
|
|
708
|
+
/* @__PURE__ */ jsx4(Box5, { flexDirection: "column", children: actions.map((action, i) => /* @__PURE__ */ jsx4(
|
|
826
709
|
SelectRow,
|
|
827
710
|
{
|
|
828
711
|
highlighted: i === index,
|
|
@@ -831,14 +714,14 @@ function DecisionSelect({
|
|
|
831
714
|
},
|
|
832
715
|
action.label
|
|
833
716
|
)) }),
|
|
834
|
-
/* @__PURE__ */ jsxs4(
|
|
835
|
-
/* @__PURE__ */ jsxs4(
|
|
836
|
-
/* @__PURE__ */ jsx4(
|
|
837
|
-
/* @__PURE__ */ jsx4(
|
|
717
|
+
/* @__PURE__ */ jsxs4(Box5, { gap: 2, children: [
|
|
718
|
+
/* @__PURE__ */ jsxs4(Text5, { children: [
|
|
719
|
+
/* @__PURE__ */ jsx4(Text5, { color: COLORS.primary, children: "[\u2191] [\u2193]" }),
|
|
720
|
+
/* @__PURE__ */ jsx4(Text5, { color: COLORS.dim, children: " move" })
|
|
838
721
|
] }),
|
|
839
|
-
/* @__PURE__ */ jsxs4(
|
|
840
|
-
/* @__PURE__ */ jsx4(
|
|
841
|
-
/* @__PURE__ */ jsx4(
|
|
722
|
+
/* @__PURE__ */ jsxs4(Text5, { children: [
|
|
723
|
+
/* @__PURE__ */ jsx4(Text5, { color: COLORS.primary, children: "[enter]" }),
|
|
724
|
+
/* @__PURE__ */ jsx4(Text5, { color: COLORS.dim, children: " confirm" })
|
|
842
725
|
] })
|
|
843
726
|
] })
|
|
844
727
|
] });
|
|
@@ -850,10 +733,10 @@ function CommandApproval({
|
|
|
850
733
|
command,
|
|
851
734
|
onDecide
|
|
852
735
|
}) {
|
|
853
|
-
return /* @__PURE__ */ jsxs5(
|
|
854
|
-
/* @__PURE__ */ jsx5(
|
|
736
|
+
return /* @__PURE__ */ jsxs5(Box6, { flexDirection: "column", gap: 1, children: [
|
|
737
|
+
/* @__PURE__ */ jsx5(Text6, { color: COLORS.primary, bold: true, children: "Run this command?" }),
|
|
855
738
|
/* @__PURE__ */ jsxs5(
|
|
856
|
-
|
|
739
|
+
Box6,
|
|
857
740
|
{
|
|
858
741
|
flexDirection: "column",
|
|
859
742
|
paddingLeft: 2,
|
|
@@ -864,17 +747,17 @@ function CommandApproval({
|
|
|
864
747
|
borderRight: false,
|
|
865
748
|
gap: 1,
|
|
866
749
|
children: [
|
|
867
|
-
/* @__PURE__ */ jsxs5(
|
|
868
|
-
/* @__PURE__ */ jsx5(
|
|
869
|
-
/* @__PURE__ */ jsx5(
|
|
750
|
+
/* @__PURE__ */ jsxs5(Box6, { children: [
|
|
751
|
+
/* @__PURE__ */ jsx5(Text6, { color: COLORS.muted, children: "$ " }),
|
|
752
|
+
/* @__PURE__ */ jsx5(Text6, { color: COLORS.strong, wrap: "wrap", children: command.command })
|
|
870
753
|
] }),
|
|
871
|
-
/* @__PURE__ */ jsxs5(
|
|
872
|
-
/* @__PURE__ */ jsx5(
|
|
873
|
-
/* @__PURE__ */ jsx5(
|
|
754
|
+
/* @__PURE__ */ jsxs5(Box6, { gap: 1, children: [
|
|
755
|
+
/* @__PURE__ */ jsx5(Text6, { color: COLORS.muted, children: "in:" }),
|
|
756
|
+
/* @__PURE__ */ jsx5(Text6, { color: COLORS.muted, wrap: "wrap", children: command.cwd })
|
|
874
757
|
] }),
|
|
875
|
-
command.explanation && /* @__PURE__ */ jsxs5(
|
|
876
|
-
/* @__PURE__ */ jsx5(
|
|
877
|
-
/* @__PURE__ */ jsx5(
|
|
758
|
+
command.explanation && /* @__PURE__ */ jsxs5(Box6, { gap: 1, children: [
|
|
759
|
+
/* @__PURE__ */ jsx5(Text6, { color: COLORS.muted, children: "why:" }),
|
|
760
|
+
/* @__PURE__ */ jsx5(Text6, { color: COLORS.accent, wrap: "wrap", children: command.explanation })
|
|
878
761
|
] })
|
|
879
762
|
]
|
|
880
763
|
}
|
|
@@ -893,9 +776,100 @@ function CommandApproval({
|
|
|
893
776
|
}
|
|
894
777
|
|
|
895
778
|
// src/ui/SelectPrompt.tsx
|
|
896
|
-
import { Box as Box8, Text as Text8, useInput as useInput2, useWindowSize as
|
|
779
|
+
import { Box as Box8, Text as Text8, useInput as useInput2, useWindowSize as useWindowSize4 } from "ink";
|
|
897
780
|
import { useLayoutEffect as useLayoutEffect2, useRef as useRef3, useState as useState5 } from "react";
|
|
898
|
-
|
|
781
|
+
|
|
782
|
+
// src/ui/ScrollView.tsx
|
|
783
|
+
import { Box as Box7, Text as Text7, measureElement as measureElement2, useWindowSize as useWindowSize3 } from "ink";
|
|
784
|
+
import { useCallback, useLayoutEffect, useRef as useRef2, useState as useState4 } from "react";
|
|
785
|
+
import { jsxs as jsxs6 } from "react/jsx-runtime";
|
|
786
|
+
var INDICATOR_ROWS = 2;
|
|
787
|
+
function fittedWidth(node, columns) {
|
|
788
|
+
let left = 0;
|
|
789
|
+
for (let n = node; n; n = n.parentNode) {
|
|
790
|
+
left += n.yogaNode?.getComputedLeft() ?? 0;
|
|
791
|
+
}
|
|
792
|
+
return Math.max(Math.min(measureElement2(node).width, columns - left), 0);
|
|
793
|
+
}
|
|
794
|
+
function useScrollWindow({
|
|
795
|
+
itemCount,
|
|
796
|
+
rowHeight = 1,
|
|
797
|
+
followBottom = false
|
|
798
|
+
}) {
|
|
799
|
+
const viewportRef = useRef2(null);
|
|
800
|
+
const { columns } = useWindowSize3();
|
|
801
|
+
const [size, setSize] = useState4(
|
|
802
|
+
null
|
|
803
|
+
);
|
|
804
|
+
useLayoutEffect(() => {
|
|
805
|
+
if (!viewportRef.current) return;
|
|
806
|
+
const width = fittedWidth(viewportRef.current, columns);
|
|
807
|
+
const { height } = measureElement2(viewportRef.current);
|
|
808
|
+
setSize(
|
|
809
|
+
(prev) => prev?.width === width && prev.height === height ? prev : { width, height }
|
|
810
|
+
);
|
|
811
|
+
});
|
|
812
|
+
const capacity = size === null || itemCount * rowHeight <= size.height ? itemCount : Math.max(Math.floor((size.height - INDICATOR_ROWS) / rowHeight), 1);
|
|
813
|
+
const maxOffset = Math.max(itemCount - capacity, 0);
|
|
814
|
+
const [offset, setOffset] = useState4(0);
|
|
815
|
+
const prevMaxOffsetRef = useRef2(0);
|
|
816
|
+
useLayoutEffect(() => {
|
|
817
|
+
const wasAtBottom = offset >= prevMaxOffsetRef.current;
|
|
818
|
+
prevMaxOffsetRef.current = maxOffset;
|
|
819
|
+
setOffset(
|
|
820
|
+
(o) => followBottom && wasAtBottom ? maxOffset : Math.min(o, maxOffset)
|
|
821
|
+
);
|
|
822
|
+
}, [maxOffset, followBottom]);
|
|
823
|
+
const scrollBy = useCallback(
|
|
824
|
+
(delta) => {
|
|
825
|
+
setOffset((o) => Math.min(Math.max(o + delta, 0), maxOffset));
|
|
826
|
+
},
|
|
827
|
+
[maxOffset]
|
|
828
|
+
);
|
|
829
|
+
const revealIndex = useCallback(
|
|
830
|
+
(index) => {
|
|
831
|
+
setOffset((o) => {
|
|
832
|
+
if (index < o) return index;
|
|
833
|
+
if (index >= o + capacity) {
|
|
834
|
+
return Math.min(index - capacity + 1, maxOffset);
|
|
835
|
+
}
|
|
836
|
+
return o;
|
|
837
|
+
});
|
|
838
|
+
},
|
|
839
|
+
[capacity, maxOffset]
|
|
840
|
+
);
|
|
841
|
+
const visibleCount = Math.min(capacity, Math.max(itemCount - offset, 0));
|
|
842
|
+
return {
|
|
843
|
+
viewportRef,
|
|
844
|
+
measured: size !== null,
|
|
845
|
+
width: size?.width ?? columns,
|
|
846
|
+
offset,
|
|
847
|
+
capacity,
|
|
848
|
+
maxOffset,
|
|
849
|
+
hiddenAbove: Math.min(offset, itemCount),
|
|
850
|
+
hiddenBelow: Math.max(itemCount - offset - visibleCount, 0),
|
|
851
|
+
scrollBy,
|
|
852
|
+
revealIndex
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
function ScrollView({ scroll, children }) {
|
|
856
|
+
return /* @__PURE__ */ jsxs6(Box7, { ref: scroll.viewportRef, flexDirection: "column", flexGrow: 1, children: [
|
|
857
|
+
scroll.hiddenAbove > 0 && /* @__PURE__ */ jsxs6(Text7, { color: COLORS.dim, children: [
|
|
858
|
+
"\u2191 ",
|
|
859
|
+
scroll.hiddenAbove,
|
|
860
|
+
" more"
|
|
861
|
+
] }),
|
|
862
|
+
children,
|
|
863
|
+
scroll.hiddenBelow > 0 && /* @__PURE__ */ jsxs6(Text7, { color: COLORS.dim, children: [
|
|
864
|
+
"\u2193 ",
|
|
865
|
+
scroll.hiddenBelow,
|
|
866
|
+
" more"
|
|
867
|
+
] })
|
|
868
|
+
] });
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
// src/ui/SelectPrompt.tsx
|
|
872
|
+
import { jsx as jsx6, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
899
873
|
var CANCEL = "cancel";
|
|
900
874
|
var ARROW_WIDTH = 4;
|
|
901
875
|
var COLUMN_GAP = 2;
|
|
@@ -926,7 +900,7 @@ function SelectPrompt({
|
|
|
926
900
|
if (multi) hints.push({ key: "[space]", label: "select" });
|
|
927
901
|
hints.push({ key: "[enter]", label: "confirm" });
|
|
928
902
|
const containerRef = useRef3(null);
|
|
929
|
-
const { columns } =
|
|
903
|
+
const { columns } = useWindowSize4();
|
|
930
904
|
const [width, setWidth] = useState5(columns);
|
|
931
905
|
useLayoutEffect2(() => {
|
|
932
906
|
if (!containerRef.current) return;
|
|
@@ -980,12 +954,12 @@ function SelectPrompt({
|
|
|
980
954
|
}
|
|
981
955
|
}
|
|
982
956
|
});
|
|
983
|
-
return /* @__PURE__ */ jsx6(Box8, { ref: containerRef, flexGrow: 1, children: /* @__PURE__ */
|
|
984
|
-
/* @__PURE__ */
|
|
957
|
+
return /* @__PURE__ */ jsx6(Box8, { ref: containerRef, flexGrow: 1, children: /* @__PURE__ */ jsxs7(Box8, { flexDirection: "column", gap: 1, width, children: [
|
|
958
|
+
/* @__PURE__ */ jsxs7(Box8, { flexDirection: "column", gap: 1, flexShrink: 0, children: [
|
|
985
959
|
error && /* @__PURE__ */ jsx6(Text8, { color: COLORS.danger, children: error }),
|
|
986
960
|
messages?.map((m, i) => /* @__PURE__ */ jsx6(Text8, { color: COLORS.muted, children: m }, `msg-${i}`)),
|
|
987
961
|
table && /* @__PURE__ */ jsx6(Table, { columns: table.columns, rows: table.rows }),
|
|
988
|
-
/* @__PURE__ */
|
|
962
|
+
/* @__PURE__ */ jsxs7(Box8, { flexDirection: "column", children: [
|
|
989
963
|
question && /* @__PURE__ */ jsx6(Text8, { color: COLORS.muted, children: question }),
|
|
990
964
|
helpText && /* @__PURE__ */ jsx6(Text8, { color: COLORS.dim, children: helpText })
|
|
991
965
|
] })
|
|
@@ -997,7 +971,7 @@ function SelectPrompt({
|
|
|
997
971
|
const bullet = multi && !isCancel ? checked.has(i) ? "\u25CF " : "\u25CB " : "";
|
|
998
972
|
const sec = isCancel ? void 0 : secondary?.[i];
|
|
999
973
|
const isText = sec?.kind === "text";
|
|
1000
|
-
return /* @__PURE__ */
|
|
974
|
+
return /* @__PURE__ */ jsxs7(
|
|
1001
975
|
SelectRow,
|
|
1002
976
|
{
|
|
1003
977
|
highlighted,
|
|
@@ -1020,10 +994,10 @@ function SelectPrompt({
|
|
|
1020
994
|
`row-${i}`
|
|
1021
995
|
);
|
|
1022
996
|
}) }),
|
|
1023
|
-
/* @__PURE__ */ jsx6(Box8, { flexShrink: 0, children: /* @__PURE__ */ jsx6(Text8, { color: COLORS.dim, children: hints.map(({ key, label }, i) => /* @__PURE__ */
|
|
997
|
+
/* @__PURE__ */ jsx6(Box8, { flexShrink: 0, children: /* @__PURE__ */ jsx6(Text8, { color: COLORS.dim, children: hints.map(({ key, label }, i) => /* @__PURE__ */ jsxs7(Text8, { color: COLORS.dim, children: [
|
|
1024
998
|
i > 0 ? " " : "",
|
|
1025
999
|
/* @__PURE__ */ jsx6(Text8, { color: COLORS.primary, children: key }),
|
|
1026
|
-
/* @__PURE__ */
|
|
1000
|
+
/* @__PURE__ */ jsxs7(Text8, { color: COLORS.dim, children: [
|
|
1027
1001
|
" ",
|
|
1028
1002
|
label
|
|
1029
1003
|
] })
|
|
@@ -1032,14 +1006,14 @@ function SelectPrompt({
|
|
|
1032
1006
|
}
|
|
1033
1007
|
|
|
1034
1008
|
// src/ui/PromptInput.tsx
|
|
1035
|
-
import { jsx as jsx7, jsxs as
|
|
1009
|
+
import { jsx as jsx7, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1036
1010
|
var ACCEPT_REJECT_OPTIONS = ["Accept", "Reject"];
|
|
1037
1011
|
function EnterToContinuePrompt({
|
|
1038
1012
|
question,
|
|
1039
1013
|
messages,
|
|
1040
1014
|
onDecide
|
|
1041
1015
|
}) {
|
|
1042
|
-
return /* @__PURE__ */
|
|
1016
|
+
return /* @__PURE__ */ jsxs8(Box9, { flexDirection: "column", gap: 1, children: [
|
|
1043
1017
|
messages?.map((m, i) => /* @__PURE__ */ jsx7(Text9, { color: COLORS.muted, children: m }, `msg-${i}`)),
|
|
1044
1018
|
question && /* @__PURE__ */ jsx7(Text9, { color: COLORS.primary, children: question }),
|
|
1045
1019
|
/* @__PURE__ */ jsx7(
|
|
@@ -1135,11 +1109,11 @@ function PromptInput() {
|
|
|
1135
1109
|
promptKey
|
|
1136
1110
|
) });
|
|
1137
1111
|
}
|
|
1138
|
-
return /* @__PURE__ */
|
|
1112
|
+
return /* @__PURE__ */ jsxs8(Box9, { flexDirection: "column", children: [
|
|
1139
1113
|
inputReq.error && /* @__PURE__ */ jsx7(Text9, { color: COLORS.danger, children: inputReq.error }),
|
|
1140
1114
|
inputReq.messages?.map((m, i) => /* @__PURE__ */ jsx7(Text9, { color: COLORS.muted, children: m }, `msg-${i}`)),
|
|
1141
|
-
/* @__PURE__ */
|
|
1142
|
-
/* @__PURE__ */
|
|
1115
|
+
/* @__PURE__ */ jsxs8(Box9, { children: [
|
|
1116
|
+
/* @__PURE__ */ jsxs8(Text9, { color: COLORS.primary, children: [
|
|
1143
1117
|
inputReq.prompt,
|
|
1144
1118
|
" "
|
|
1145
1119
|
] }),
|
|
@@ -1161,7 +1135,7 @@ function PromptInput() {
|
|
|
1161
1135
|
// src/ui/Review.tsx
|
|
1162
1136
|
import { Box as Box10, Text as Text10, useInput as useInput3 } from "ink";
|
|
1163
1137
|
import { useLayoutEffect as useLayoutEffect3, useState as useState7 } from "react";
|
|
1164
|
-
import { jsx as jsx8, jsxs as
|
|
1138
|
+
import { jsx as jsx8, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1165
1139
|
var INGEST_SCRIPT = ".algolia-wizard/ingest.sh";
|
|
1166
1140
|
function wrapText(text, width) {
|
|
1167
1141
|
if (width <= 0) return [text];
|
|
@@ -1259,8 +1233,8 @@ function ReviewPanel({ review: review2 }) {
|
|
|
1259
1233
|
{ isActive: scrollable }
|
|
1260
1234
|
);
|
|
1261
1235
|
const visible = rows.slice(scroll.offset, scroll.offset + scroll.capacity);
|
|
1262
|
-
return /* @__PURE__ */
|
|
1263
|
-
/* @__PURE__ */ jsx8(ScrollView, { scroll, children: visible.map((row, i) => /* @__PURE__ */
|
|
1236
|
+
return /* @__PURE__ */ jsxs9(Box10, { flexDirection: "column", flexGrow: 1, children: [
|
|
1237
|
+
/* @__PURE__ */ jsx8(ScrollView, { scroll, children: visible.map((row, i) => /* @__PURE__ */ jsxs9(Text10, { wrap: "truncate", children: [
|
|
1264
1238
|
row.prefix && /* @__PURE__ */ jsx8(Text10, { color: row.prefixColor ?? row.color, bold: row.bold, children: row.prefix }),
|
|
1265
1239
|
/* @__PURE__ */ jsx8(Text10, { color: row.color, bold: row.bold, children: row.text })
|
|
1266
1240
|
] }, `review-row-${i}`)) }),
|
|
@@ -3535,7 +3509,7 @@ async function runAnalysis(mode, extraInstructions = []) {
|
|
|
3535
3509
|
// package.json
|
|
3536
3510
|
var package_default = {
|
|
3537
3511
|
name: "@algolia/wizard",
|
|
3538
|
-
version: "0.46.0
|
|
3512
|
+
version: "0.46.0",
|
|
3539
3513
|
description: "Magically implement Algolia functionality in your codebase",
|
|
3540
3514
|
type: "module",
|
|
3541
3515
|
engines: {
|
|
@@ -4823,7 +4797,7 @@ function getWorkflow(id) {
|
|
|
4823
4797
|
import { dirname as dirname8, join as join11 } from "node:path";
|
|
4824
4798
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
4825
4799
|
import { useState as useState8 } from "react";
|
|
4826
|
-
import { Box as Box11, Spacer, Text as Text11, useInput as useInput4, useWindowSize as
|
|
4800
|
+
import { Box as Box11, Spacer, Text as Text11, useInput as useInput4, useWindowSize as useWindowSize5 } from "ink";
|
|
4827
4801
|
|
|
4828
4802
|
// src/ui/copy/welcome.ts
|
|
4829
4803
|
var sidebarItems = [
|
|
@@ -4851,7 +4825,7 @@ var sidebarItems = [
|
|
|
4851
4825
|
|
|
4852
4826
|
// src/ui/Welcome.tsx
|
|
4853
4827
|
import Image, { TerminalInfoContext, defaultTerminalInfo } from "ink-picture";
|
|
4854
|
-
import { jsx as jsx9, jsxs as
|
|
4828
|
+
import { jsx as jsx9, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4855
4829
|
var IMAGE_PATH = join11(dirname8(fileURLToPath2(import.meta.url)), "algolia.png");
|
|
4856
4830
|
var TERMINAL_INFO = {
|
|
4857
4831
|
...defaultTerminalInfo,
|
|
@@ -4862,12 +4836,12 @@ function SidebarItem({
|
|
|
4862
4836
|
title,
|
|
4863
4837
|
description
|
|
4864
4838
|
}) {
|
|
4865
|
-
return /* @__PURE__ */
|
|
4866
|
-
/* @__PURE__ */
|
|
4839
|
+
return /* @__PURE__ */ jsxs10(Box11, { flexDirection: "column", children: [
|
|
4840
|
+
/* @__PURE__ */ jsxs10(Box11, { gap: 1, children: [
|
|
4867
4841
|
/* @__PURE__ */ jsx9(Text11, { color: COLORS.success, children: "\u2192" }),
|
|
4868
4842
|
/* @__PURE__ */ jsx9(Text11, { color: COLORS.strong, bold: true, children: title })
|
|
4869
4843
|
] }),
|
|
4870
|
-
/* @__PURE__ */
|
|
4844
|
+
/* @__PURE__ */ jsxs10(Box11, { flexDirection: "row", gap: 2, children: [
|
|
4871
4845
|
/* @__PURE__ */ jsx9(Spacer, {}),
|
|
4872
4846
|
/* @__PURE__ */ jsx9(Text11, { color: COLORS.muted, children: description })
|
|
4873
4847
|
] })
|
|
@@ -4876,7 +4850,7 @@ function SidebarItem({
|
|
|
4876
4850
|
function Welcome() {
|
|
4877
4851
|
const confirmStart = useWizard((s) => s.confirmStart);
|
|
4878
4852
|
const openLearnMore = useWizard((s) => s.openLearnMore);
|
|
4879
|
-
const { rows } =
|
|
4853
|
+
const { rows } = useWindowSize5();
|
|
4880
4854
|
const actions = [
|
|
4881
4855
|
{ label: "start wizard", run: confirmStart },
|
|
4882
4856
|
{ label: "learn more", run: openLearnMore }
|
|
@@ -4905,7 +4879,7 @@ function Welcome() {
|
|
|
4905
4879
|
if (rows < 30) {
|
|
4906
4880
|
layout = scales["small"];
|
|
4907
4881
|
}
|
|
4908
|
-
return /* @__PURE__ */
|
|
4882
|
+
return /* @__PURE__ */ jsxs10(Box11, { flexDirection: "row", justifyContent: "space-between", width: "100%", children: [
|
|
4909
4883
|
/* @__PURE__ */ jsx9(
|
|
4910
4884
|
Box11,
|
|
4911
4885
|
{
|
|
@@ -4913,7 +4887,7 @@ function Welcome() {
|
|
|
4913
4887
|
paddingX: layout.main.padding.x,
|
|
4914
4888
|
flexDirection: "column",
|
|
4915
4889
|
justifyContent: "center",
|
|
4916
|
-
children: /* @__PURE__ */
|
|
4890
|
+
children: /* @__PURE__ */ jsxs10(Box11, { flexDirection: "column", gap: 2, children: [
|
|
4917
4891
|
/* @__PURE__ */ jsx9(TerminalInfoContext.Provider, { value: TERMINAL_INFO, children: /* @__PURE__ */ jsx9(
|
|
4918
4892
|
Image,
|
|
4919
4893
|
{
|
|
@@ -4935,12 +4909,12 @@ function Welcome() {
|
|
|
4935
4909
|
},
|
|
4936
4910
|
action.label
|
|
4937
4911
|
)) }),
|
|
4938
|
-
/* @__PURE__ */
|
|
4939
|
-
/* @__PURE__ */
|
|
4912
|
+
/* @__PURE__ */ jsxs10(Box11, { gap: 2, children: [
|
|
4913
|
+
/* @__PURE__ */ jsxs10(Text11, { children: [
|
|
4940
4914
|
/* @__PURE__ */ jsx9(Text11, { color: COLORS.primary, children: "[\u2191] [\u2193]" }),
|
|
4941
4915
|
/* @__PURE__ */ jsx9(Text11, { color: COLORS.dim, children: " move" })
|
|
4942
4916
|
] }),
|
|
4943
|
-
/* @__PURE__ */
|
|
4917
|
+
/* @__PURE__ */ jsxs10(Text11, { children: [
|
|
4944
4918
|
/* @__PURE__ */ jsx9(Text11, { color: COLORS.primary, children: "[enter]" }),
|
|
4945
4919
|
/* @__PURE__ */ jsx9(Text11, { color: COLORS.dim, children: " confirm" })
|
|
4946
4920
|
] })
|
|
@@ -4948,7 +4922,7 @@ function Welcome() {
|
|
|
4948
4922
|
] })
|
|
4949
4923
|
}
|
|
4950
4924
|
),
|
|
4951
|
-
/* @__PURE__ */
|
|
4925
|
+
/* @__PURE__ */ jsxs10(
|
|
4952
4926
|
Box11,
|
|
4953
4927
|
{
|
|
4954
4928
|
backgroundColor: COLORS.bg.sidebar,
|
|
@@ -4969,7 +4943,7 @@ function Welcome() {
|
|
|
4969
4943
|
|
|
4970
4944
|
// src/ui/LearnMore.tsx
|
|
4971
4945
|
import { Fragment } from "react";
|
|
4972
|
-
import { Box as Box12, Text as Text12, useInput as useInput5, useWindowSize as
|
|
4946
|
+
import { Box as Box12, Text as Text12, useInput as useInput5, useWindowSize as useWindowSize6 } from "ink";
|
|
4973
4947
|
|
|
4974
4948
|
// src/ui/copy/learn-more.ts
|
|
4975
4949
|
var accessIntro = "Everything runs locally on your machine. Nothing is written or sent without an explicit yes from you.";
|
|
@@ -5011,7 +4985,7 @@ var policyLinks = [
|
|
|
5011
4985
|
];
|
|
5012
4986
|
|
|
5013
4987
|
// src/ui/LearnMore.tsx
|
|
5014
|
-
import { jsx as jsx10, jsxs as
|
|
4988
|
+
import { jsx as jsx10, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
5015
4989
|
var TAG_COLORS = {
|
|
5016
4990
|
READ: COLORS.success,
|
|
5017
4991
|
WRITE: COLORS.badge,
|
|
@@ -5028,7 +5002,7 @@ function NeverLine({
|
|
|
5028
5002
|
}) {
|
|
5029
5003
|
const used = segments.reduce((n, s) => n + s.text.length, 0);
|
|
5030
5004
|
const rightPad = Math.max(0, width - 2 - NEVER_BOX_PAD_X - used);
|
|
5031
|
-
return /* @__PURE__ */
|
|
5005
|
+
return /* @__PURE__ */ jsxs11(Text12, { color: COLORS.primary, children: [
|
|
5032
5006
|
/* @__PURE__ */ jsx10(Text12, { color: COLORS.danger, children: "\u2502" }),
|
|
5033
5007
|
" ".repeat(NEVER_BOX_PAD_X),
|
|
5034
5008
|
segments.map((s, i) => /* @__PURE__ */ jsx10(Text12, { color: s.color, bold: s.bold, children: s.text }, i)),
|
|
@@ -5039,13 +5013,13 @@ function NeverLine({
|
|
|
5039
5013
|
function LearnMore() {
|
|
5040
5014
|
const confirmStart = useWizard((s) => s.confirmStart);
|
|
5041
5015
|
const backToHome = useWizard((s) => s.backToHome);
|
|
5042
|
-
const { columns } =
|
|
5016
|
+
const { columns } = useWindowSize6();
|
|
5043
5017
|
const dividerWidth = Math.max(0, columns - PADDING_X * 2);
|
|
5044
5018
|
useInput5((_input, key) => {
|
|
5045
5019
|
if (key.escape) backToHome();
|
|
5046
5020
|
else if (key.return) confirmStart();
|
|
5047
5021
|
});
|
|
5048
|
-
return /* @__PURE__ */
|
|
5022
|
+
return /* @__PURE__ */ jsxs11(
|
|
5049
5023
|
Box12,
|
|
5050
5024
|
{
|
|
5051
5025
|
flexDirection: "column",
|
|
@@ -5056,17 +5030,17 @@ function LearnMore() {
|
|
|
5056
5030
|
children: [
|
|
5057
5031
|
/* @__PURE__ */ jsx10(Text12, { color: COLORS.strong, bold: true, children: "What algolia wizard accesses" }),
|
|
5058
5032
|
/* @__PURE__ */ jsx10(Text12, { color: COLORS.muted, children: accessIntro }),
|
|
5059
|
-
/* @__PURE__ */ jsx10(Box12, { flexDirection: "column", children: accessItems.map((item) => /* @__PURE__ */
|
|
5033
|
+
/* @__PURE__ */ jsx10(Box12, { flexDirection: "column", children: accessItems.map((item) => /* @__PURE__ */ jsxs11(Box12, { flexDirection: "column", marginTop: 1, children: [
|
|
5060
5034
|
/* @__PURE__ */ jsx10(Text12, { color: COLORS.border, children: "\u2500".repeat(dividerWidth) }),
|
|
5061
|
-
/* @__PURE__ */
|
|
5035
|
+
/* @__PURE__ */ jsxs11(Box12, { flexDirection: "row", gap: 1, marginTop: 1, children: [
|
|
5062
5036
|
/* @__PURE__ */ jsx10(Box12, { width: TAG_COLUMN_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx10(Text12, { color: TAG_COLORS[item.tag], bold: true, children: `[${item.tag}]` }) }),
|
|
5063
|
-
/* @__PURE__ */ jsx10(Box12, { flexDirection: "column", children: /* @__PURE__ */
|
|
5037
|
+
/* @__PURE__ */ jsx10(Box12, { flexDirection: "column", children: /* @__PURE__ */ jsxs11(Text12, { color: COLORS.primary, children: [
|
|
5064
5038
|
/* @__PURE__ */ jsx10(Text12, { color: COLORS.strong, bold: true, children: item.title }),
|
|
5065
5039
|
/* @__PURE__ */ jsx10(Text12, { color: COLORS.muted, children: ` \u2014 ${item.description}` })
|
|
5066
5040
|
] }) })
|
|
5067
5041
|
] })
|
|
5068
5042
|
] }, item.tag)) }),
|
|
5069
|
-
/* @__PURE__ */
|
|
5043
|
+
/* @__PURE__ */ jsxs11(Box12, { marginTop: 1, flexDirection: "column", children: [
|
|
5070
5044
|
/* @__PURE__ */ jsx10(Text12, { color: COLORS.danger, children: `\u256D${"\u2500".repeat(Math.max(0, dividerWidth - 2))}\u256E` }),
|
|
5071
5045
|
/* @__PURE__ */ jsx10(NeverLine, { width: dividerWidth }),
|
|
5072
5046
|
/* @__PURE__ */ jsx10(
|
|
@@ -5076,7 +5050,7 @@ function LearnMore() {
|
|
|
5076
5050
|
segments: [{ text: "I NEVER", color: COLORS.danger, bold: true }]
|
|
5077
5051
|
}
|
|
5078
5052
|
),
|
|
5079
|
-
neverItems.map((item) => /* @__PURE__ */
|
|
5053
|
+
neverItems.map((item) => /* @__PURE__ */ jsxs11(Fragment, { children: [
|
|
5080
5054
|
/* @__PURE__ */ jsx10(NeverLine, { width: dividerWidth }),
|
|
5081
5055
|
/* @__PURE__ */ jsx10(
|
|
5082
5056
|
NeverLine,
|
|
@@ -5093,17 +5067,17 @@ function LearnMore() {
|
|
|
5093
5067
|
/* @__PURE__ */ jsx10(NeverLine, { width: dividerWidth }),
|
|
5094
5068
|
/* @__PURE__ */ jsx10(Text12, { color: COLORS.danger, children: `\u2570${"\u2500".repeat(Math.max(0, dividerWidth - 2))}\u256F` })
|
|
5095
5069
|
] }),
|
|
5096
|
-
/* @__PURE__ */ jsx10(Box12, { marginTop: 1, flexDirection: "column", children: policyLinks.map((link) => /* @__PURE__ */
|
|
5070
|
+
/* @__PURE__ */ jsx10(Box12, { marginTop: 1, flexDirection: "column", children: policyLinks.map((link) => /* @__PURE__ */ jsxs11(Box12, { flexDirection: "row", gap: 1, children: [
|
|
5097
5071
|
/* @__PURE__ */ jsx10(Text12, { color: COLORS.strong, bold: true, children: `${link.label}:` }),
|
|
5098
5072
|
/* @__PURE__ */ jsx10(Text12, { color: COLORS.accent, children: link.url })
|
|
5099
5073
|
] }, link.label)) }),
|
|
5100
|
-
/* @__PURE__ */
|
|
5101
|
-
/* @__PURE__ */
|
|
5074
|
+
/* @__PURE__ */ jsxs11(Box12, { marginTop: 1, flexDirection: "row", gap: 3, children: [
|
|
5075
|
+
/* @__PURE__ */ jsxs11(Box12, { flexDirection: "row", gap: 1, children: [
|
|
5102
5076
|
/* @__PURE__ */ jsx10(Text12, { color: COLORS.muted, children: "[" }),
|
|
5103
5077
|
/* @__PURE__ */ jsx10(Text12, { color: COLORS.primary, children: "esc" }),
|
|
5104
5078
|
/* @__PURE__ */ jsx10(Text12, { color: COLORS.muted, children: "] back" })
|
|
5105
5079
|
] }),
|
|
5106
|
-
/* @__PURE__ */
|
|
5080
|
+
/* @__PURE__ */ jsxs11(Box12, { flexDirection: "row", gap: 1, children: [
|
|
5107
5081
|
/* @__PURE__ */ jsx10(Text12, { color: COLORS.muted, children: "[" }),
|
|
5108
5082
|
/* @__PURE__ */ jsx10(Text12, { color: COLORS.primary, children: "enter" }),
|
|
5109
5083
|
/* @__PURE__ */ jsx10(Text12, { color: COLORS.muted, children: "]" }),
|
|
@@ -5121,11 +5095,11 @@ import { Box as Box15, Text as Text15 } from "ink";
|
|
|
5121
5095
|
// src/ui/Steps.tsx
|
|
5122
5096
|
import { Box as Box13, Text as Text13 } from "ink";
|
|
5123
5097
|
import Spinner from "ink-spinner";
|
|
5124
|
-
import { jsx as jsx11, jsxs as
|
|
5098
|
+
import { jsx as jsx11, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5125
5099
|
function Steps() {
|
|
5126
5100
|
const { steps } = useWizard();
|
|
5127
5101
|
const visibleSteps = steps.filter(isStepVisible);
|
|
5128
|
-
return /* @__PURE__ */ jsx11(Box13, { flexDirection: "column", gap: 1, children: visibleSteps.map((s) => /* @__PURE__ */ jsx11(Box13, { flexDirection: "column", children: /* @__PURE__ */
|
|
5102
|
+
return /* @__PURE__ */ jsx11(Box13, { flexDirection: "column", gap: 1, children: visibleSteps.map((s) => /* @__PURE__ */ jsx11(Box13, { flexDirection: "column", children: /* @__PURE__ */ jsxs12(Text13, { color: COLORS.status[s.status], children: [
|
|
5129
5103
|
s.status === "running" ? /* @__PURE__ */ jsx11(Spinner, { type: "dots" }) : MARKER[s.status],
|
|
5130
5104
|
" ",
|
|
5131
5105
|
s.title
|
|
@@ -5135,7 +5109,7 @@ function CurrentStep() {
|
|
|
5135
5109
|
const { steps } = useWizard();
|
|
5136
5110
|
const currentStep = steps.filter(isStepVisible).find((s) => s.status === "running");
|
|
5137
5111
|
if (!currentStep) return null;
|
|
5138
|
-
return /* @__PURE__ */
|
|
5112
|
+
return /* @__PURE__ */ jsxs12(Text13, { color: COLORS.status.running, children: [
|
|
5139
5113
|
/* @__PURE__ */ jsx11(Spinner, { type: "dots" }),
|
|
5140
5114
|
" ",
|
|
5141
5115
|
` ${currentStep.title}`
|
|
@@ -5144,14 +5118,14 @@ function CurrentStep() {
|
|
|
5144
5118
|
|
|
5145
5119
|
// src/ui/Progress.tsx
|
|
5146
5120
|
import { Box as Box14, Text as Text14 } from "ink";
|
|
5147
|
-
import { jsx as jsx12, jsxs as
|
|
5121
|
+
import { jsx as jsx12, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5148
5122
|
function Progress() {
|
|
5149
5123
|
const { steps, currentStepIndex } = useWizard();
|
|
5150
5124
|
const visibleSteps = steps.filter(isStepVisible);
|
|
5151
5125
|
if (visibleSteps.length === 0) return null;
|
|
5152
5126
|
const visibleCountThroughCurrent = steps.slice(0, currentStepIndex + 1).filter(isStepVisible).length;
|
|
5153
5127
|
const activeStepNumber = Math.max(1, visibleCountThroughCurrent);
|
|
5154
|
-
return /* @__PURE__ */
|
|
5128
|
+
return /* @__PURE__ */ jsxs13(Box14, { flexDirection: "row", gap: 1, children: [
|
|
5155
5129
|
/* @__PURE__ */ jsx12(Text14, { color: COLORS.muted, children: "STEP" }),
|
|
5156
5130
|
/* @__PURE__ */ jsx12(Text14, { color: COLORS.strong, bold: true, children: activeStepNumber }),
|
|
5157
5131
|
/* @__PURE__ */ jsx12(Text14, { color: COLORS.strong, bold: true, children: "/" }),
|
|
@@ -5166,9 +5140,9 @@ var sidebarCommands = [
|
|
|
5166
5140
|
];
|
|
5167
5141
|
|
|
5168
5142
|
// src/ui/Sidebar.tsx
|
|
5169
|
-
import { jsx as jsx13, jsxs as
|
|
5143
|
+
import { jsx as jsx13, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5170
5144
|
function Sidebar() {
|
|
5171
|
-
return /* @__PURE__ */
|
|
5145
|
+
return /* @__PURE__ */ jsxs14(
|
|
5172
5146
|
Box15,
|
|
5173
5147
|
{
|
|
5174
5148
|
backgroundColor: "#14171E",
|
|
@@ -5178,14 +5152,14 @@ function Sidebar() {
|
|
|
5178
5152
|
flexDirection: "column",
|
|
5179
5153
|
justifyContent: "space-between",
|
|
5180
5154
|
children: [
|
|
5181
|
-
/* @__PURE__ */
|
|
5155
|
+
/* @__PURE__ */ jsxs14(Box15, { flexDirection: "column", gap: 1, children: [
|
|
5182
5156
|
/* @__PURE__ */ jsx13(Text15, { color: COLORS.muted, children: "PROGRESS" }),
|
|
5183
5157
|
/* @__PURE__ */ jsx13(Steps, {})
|
|
5184
5158
|
] }),
|
|
5185
|
-
/* @__PURE__ */
|
|
5159
|
+
/* @__PURE__ */ jsxs14(Box15, { flexDirection: "column", gap: 1, children: [
|
|
5186
5160
|
/* @__PURE__ */ jsx13(Progress, {}),
|
|
5187
5161
|
/* @__PURE__ */ jsx13(Box15, { flexDirection: "column", children: sidebarCommands.map((c) => {
|
|
5188
|
-
return /* @__PURE__ */
|
|
5162
|
+
return /* @__PURE__ */ jsxs14(Box15, { flexDirection: "row", gap: 1, children: [
|
|
5189
5163
|
/* @__PURE__ */ jsx13(Text15, { color: COLORS.primary, children: `[${c.keyHint}]` }),
|
|
5190
5164
|
/* @__PURE__ */ jsx13(Text15, { color: COLORS.muted, children: c.description })
|
|
5191
5165
|
] }, c.keyHint);
|
|
@@ -5198,10 +5172,10 @@ function Sidebar() {
|
|
|
5198
5172
|
|
|
5199
5173
|
// src/ui/Ribbon.tsx
|
|
5200
5174
|
import { Box as Box16, Text as Text16 } from "ink";
|
|
5201
|
-
import { jsx as jsx14, jsxs as
|
|
5175
|
+
import { jsx as jsx14, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5202
5176
|
function Ribbon() {
|
|
5203
5177
|
const firstCommand = sidebarCommands[0];
|
|
5204
|
-
return /* @__PURE__ */
|
|
5178
|
+
return /* @__PURE__ */ jsxs15(
|
|
5205
5179
|
Box16,
|
|
5206
5180
|
{
|
|
5207
5181
|
backgroundColor: "#14171E",
|
|
@@ -5212,7 +5186,7 @@ function Ribbon() {
|
|
|
5212
5186
|
children: [
|
|
5213
5187
|
/* @__PURE__ */ jsx14(Progress, {}),
|
|
5214
5188
|
/* @__PURE__ */ jsx14(CurrentStep, {}),
|
|
5215
|
-
/* @__PURE__ */
|
|
5189
|
+
/* @__PURE__ */ jsxs15(Box16, { flexDirection: "row", gap: 1, children: [
|
|
5216
5190
|
/* @__PURE__ */ jsx14(Text16, { color: COLORS.primary, children: `[${firstCommand.keyHint}]` }),
|
|
5217
5191
|
/* @__PURE__ */ jsx14(Text16, { color: COLORS.muted, children: firstCommand.description })
|
|
5218
5192
|
] })
|
|
@@ -5226,7 +5200,7 @@ import { useState as useState10 } from "react";
|
|
|
5226
5200
|
|
|
5227
5201
|
// src/ui/Logs.tsx
|
|
5228
5202
|
import { Box as Box17, Text as Text17, useInput as useInput6 } from "ink";
|
|
5229
|
-
import { jsx as jsx15, jsxs as
|
|
5203
|
+
import { jsx as jsx15, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5230
5204
|
var KIND_COLOR = {
|
|
5231
5205
|
tool: COLORS.primary,
|
|
5232
5206
|
prompt: COLORS.badge
|
|
@@ -5262,7 +5236,7 @@ function Logs() {
|
|
|
5262
5236
|
else if (key.downArrow) scroll.scrollBy(1);
|
|
5263
5237
|
});
|
|
5264
5238
|
const visible = logs.slice(scroll.offset, scroll.offset + scroll.capacity);
|
|
5265
|
-
return /* @__PURE__ */
|
|
5239
|
+
return /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", paddingX: 4, paddingY: 2, flexGrow: 1, children: [
|
|
5266
5240
|
logs.length === 0 && /* @__PURE__ */ jsx15(Text17, { color: COLORS.dim, children: "No logs yet." }),
|
|
5267
5241
|
/* @__PURE__ */ jsx15(ScrollView, { scroll, children: visible.map((entry) => {
|
|
5268
5242
|
const timestamp = `[${formatTimestamp(entry.startedAt)}]`;
|
|
@@ -5274,7 +5248,7 @@ function Logs() {
|
|
|
5274
5248
|
const name = truncate3(entry.name, budget);
|
|
5275
5249
|
budget -= name.length;
|
|
5276
5250
|
const preview = rawPreview ? truncate3(rawPreview, budget) : "";
|
|
5277
|
-
return /* @__PURE__ */
|
|
5251
|
+
return /* @__PURE__ */ jsxs16(Box17, { flexDirection: "row", gap: ROW_GAP, children: [
|
|
5278
5252
|
/* @__PURE__ */ jsx15(Text17, { color: COLORS.dim, children: timestamp }),
|
|
5279
5253
|
/* @__PURE__ */ jsx15(Text17, { color: logNameColor(entry), wrap: "truncate", children: name }),
|
|
5280
5254
|
preview && /* @__PURE__ */ jsx15(Text17, { color: COLORS.dim, wrap: "truncate", children: preview }),
|
|
@@ -5287,9 +5261,38 @@ function Logs() {
|
|
|
5287
5261
|
|
|
5288
5262
|
// src/ui/Tips.tsx
|
|
5289
5263
|
import { useEffect as useEffect3, useRef as useRef4, useState as useState9 } from "react";
|
|
5290
|
-
import { Box as
|
|
5264
|
+
import { Box as Box19, Text as Text19 } from "ink";
|
|
5291
5265
|
import terminalLink from "terminal-link";
|
|
5292
5266
|
|
|
5267
|
+
// src/ui/Code.tsx
|
|
5268
|
+
import { Box as Box18, Text as Text18 } from "ink";
|
|
5269
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
5270
|
+
var TOKEN_RE = /("(?:\\.|[^"\\])*"|\btrue\b|\bfalse\b|\bnull\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|[{}[\]:,])/g;
|
|
5271
|
+
function highlightJson(json) {
|
|
5272
|
+
const parts = json.split(TOKEN_RE);
|
|
5273
|
+
return parts.map((part, i) => {
|
|
5274
|
+
if (!part) return null;
|
|
5275
|
+
if (part[0] === '"') {
|
|
5276
|
+
const next = parts.slice(i + 1).find((p) => p.trim());
|
|
5277
|
+
const isKey = next?.trimStart().startsWith(":");
|
|
5278
|
+
return /* @__PURE__ */ jsx16(Text18, { color: isKey ? "cyan" : "green", children: part }, i);
|
|
5279
|
+
}
|
|
5280
|
+
if (part === "true" || part === "false" || part === "null") {
|
|
5281
|
+
return /* @__PURE__ */ jsx16(Text18, { color: "magenta", children: part }, i);
|
|
5282
|
+
}
|
|
5283
|
+
if (/^-?\d/.test(part)) {
|
|
5284
|
+
return /* @__PURE__ */ jsx16(Text18, { color: "yellow", children: part }, i);
|
|
5285
|
+
}
|
|
5286
|
+
if (/^[{}[\]:,]$/.test(part)) {
|
|
5287
|
+
return /* @__PURE__ */ jsx16(Text18, { color: COLORS.dim, children: part }, i);
|
|
5288
|
+
}
|
|
5289
|
+
return /* @__PURE__ */ jsx16(Text18, { children: part }, i);
|
|
5290
|
+
});
|
|
5291
|
+
}
|
|
5292
|
+
function Code({ children }) {
|
|
5293
|
+
return /* @__PURE__ */ jsx16(Box18, { children: /* @__PURE__ */ jsx16(Text18, { children: highlightJson(children) }) });
|
|
5294
|
+
}
|
|
5295
|
+
|
|
5293
5296
|
// src/ui/copy/tips.ts
|
|
5294
5297
|
var tips = [
|
|
5295
5298
|
{
|
|
@@ -5320,7 +5323,23 @@ var tips = [
|
|
|
5320
5323
|
},
|
|
5321
5324
|
{
|
|
5322
5325
|
type: "text",
|
|
5323
|
-
value: "
|
|
5326
|
+
value: "Everything else is up to you:"
|
|
5327
|
+
},
|
|
5328
|
+
{
|
|
5329
|
+
type: "code",
|
|
5330
|
+
value: JSON.stringify(
|
|
5331
|
+
{
|
|
5332
|
+
objectID: "sku_48213",
|
|
5333
|
+
name: "Trail Running Shoe",
|
|
5334
|
+
brand: "Northline",
|
|
5335
|
+
categories: ["Footwear", "Running", "Mens"],
|
|
5336
|
+
price: 129.99,
|
|
5337
|
+
in_stock: true,
|
|
5338
|
+
rating: 4.6
|
|
5339
|
+
},
|
|
5340
|
+
null,
|
|
5341
|
+
2
|
|
5342
|
+
)
|
|
5324
5343
|
}
|
|
5325
5344
|
]
|
|
5326
5345
|
},
|
|
@@ -5485,26 +5504,26 @@ function tipsByIds(ids) {
|
|
|
5485
5504
|
}
|
|
5486
5505
|
|
|
5487
5506
|
// src/ui/Tips.tsx
|
|
5488
|
-
import { jsx as
|
|
5507
|
+
import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5489
5508
|
var TICK_MS = 16;
|
|
5490
5509
|
var CHUNK_HOLD_MS = 2e3;
|
|
5491
5510
|
var HOLD_MS = 12e3;
|
|
5492
5511
|
function TipTitle({ children }) {
|
|
5493
|
-
return /* @__PURE__ */
|
|
5494
|
-
/* @__PURE__ */
|
|
5495
|
-
/* @__PURE__ */
|
|
5512
|
+
return /* @__PURE__ */ jsxs17(Box19, { gap: 1, children: [
|
|
5513
|
+
/* @__PURE__ */ jsx17(Text19, { color: "cyan", children: "\u2726" }),
|
|
5514
|
+
/* @__PURE__ */ jsx17(Text19, { color: "white", bold: true, children })
|
|
5496
5515
|
] });
|
|
5497
5516
|
}
|
|
5498
5517
|
function InlineSegment({ segment }) {
|
|
5499
5518
|
switch (segment.type) {
|
|
5500
5519
|
case "highlight":
|
|
5501
|
-
return /* @__PURE__ */
|
|
5520
|
+
return /* @__PURE__ */ jsx17(Text19, { color: COLORS.success, children: segment.value });
|
|
5502
5521
|
case "link":
|
|
5503
|
-
return /* @__PURE__ */
|
|
5522
|
+
return /* @__PURE__ */ jsx17(Text19, { color: "cyan", underline: true, children: segment.href ? terminalLink(segment.value, segment.href) : segment.value });
|
|
5504
5523
|
case "codeword":
|
|
5505
|
-
return /* @__PURE__ */
|
|
5524
|
+
return /* @__PURE__ */ jsx17(Text19, { color: COLORS.highlight.fg, backgroundColor: COLORS.highlight.bg, children: segment.value });
|
|
5506
5525
|
default:
|
|
5507
|
-
return /* @__PURE__ */
|
|
5526
|
+
return /* @__PURE__ */ jsx17(Text19, { color: COLORS.muted, children: segment.value });
|
|
5508
5527
|
}
|
|
5509
5528
|
}
|
|
5510
5529
|
function TipContent({
|
|
@@ -5512,42 +5531,38 @@ function TipContent({
|
|
|
5512
5531
|
revealed
|
|
5513
5532
|
}) {
|
|
5514
5533
|
let remaining = revealed;
|
|
5515
|
-
const
|
|
5516
|
-
for (const chunk of chunks) {
|
|
5534
|
+
const slices = chunks.map((chunk) => {
|
|
5517
5535
|
const slice = chunk.value.slice(0, Math.max(0, remaining));
|
|
5518
5536
|
remaining -= chunk.value.length;
|
|
5537
|
+
return slice;
|
|
5538
|
+
});
|
|
5539
|
+
const blocks = [];
|
|
5540
|
+
for (let i = 0; i < chunks.length; i++) {
|
|
5541
|
+
const chunk = chunks[i];
|
|
5542
|
+
const slice = slices[i];
|
|
5519
5543
|
if (!slice) continue;
|
|
5520
|
-
const
|
|
5521
|
-
if (chunk.type === "text" && last?.type === "text") {
|
|
5522
|
-
last.value = `${last.value} ${slice}`;
|
|
5523
|
-
continue;
|
|
5524
|
-
}
|
|
5525
|
-
segments.push({
|
|
5544
|
+
const segment = {
|
|
5526
5545
|
type: chunk.type,
|
|
5527
5546
|
value: slice,
|
|
5528
5547
|
href: chunk.type === "link" ? chunk.href : void 0
|
|
5529
|
-
}
|
|
5548
|
+
};
|
|
5549
|
+
if (chunk.type === "code") {
|
|
5550
|
+
blocks.push({ type: "code", segment });
|
|
5551
|
+
continue;
|
|
5552
|
+
}
|
|
5553
|
+
const last = blocks[blocks.length - 1];
|
|
5554
|
+
if (last?.type === "inline") {
|
|
5555
|
+
last.segments.push(segment);
|
|
5556
|
+
} else {
|
|
5557
|
+
blocks.push({ type: "inline", segments: [segment] });
|
|
5558
|
+
}
|
|
5530
5559
|
}
|
|
5531
|
-
return /* @__PURE__ */
|
|
5532
|
-
i
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
}
|
|
5536
|
-
|
|
5537
|
-
function TipCard({
|
|
5538
|
-
tip,
|
|
5539
|
-
revealed
|
|
5540
|
-
}) {
|
|
5541
|
-
return /* @__PURE__ */ jsxs16(Box18, { flexDirection: "column", gap: 1, children: [
|
|
5542
|
-
/* @__PURE__ */ jsx16(TipTitle, { children: tip.title.slice(0, revealed) }),
|
|
5543
|
-
/* @__PURE__ */ jsx16(
|
|
5544
|
-
TipContent,
|
|
5545
|
-
{
|
|
5546
|
-
chunks: tip.chunks,
|
|
5547
|
-
revealed: Math.max(0, revealed - tip.title.length)
|
|
5548
|
-
}
|
|
5549
|
-
)
|
|
5550
|
-
] });
|
|
5560
|
+
return /* @__PURE__ */ jsx17(Box19, { flexDirection: "column", marginLeft: 2, gap: 1, children: blocks.map(
|
|
5561
|
+
(block, i) => block.type === "code" ? /* @__PURE__ */ jsx17(Code, { children: block.segment.value }, i) : /* @__PURE__ */ jsx17(Text19, { children: block.segments.map((segment, j) => /* @__PURE__ */ jsxs17(Text19, { children: [
|
|
5562
|
+
j > 0 && " ",
|
|
5563
|
+
/* @__PURE__ */ jsx17(InlineSegment, { segment })
|
|
5564
|
+
] }, j)) }, i)
|
|
5565
|
+
) });
|
|
5551
5566
|
}
|
|
5552
5567
|
var progress = { stepId: null, tipIndex: 0, revealed: 0 };
|
|
5553
5568
|
function Tips({
|
|
@@ -5620,11 +5635,16 @@ function Tips({
|
|
|
5620
5635
|
return () => clearTimeout(timer);
|
|
5621
5636
|
}, [revealed, totalLength, tips2.length]);
|
|
5622
5637
|
if (!tip) return null;
|
|
5623
|
-
|
|
5638
|
+
const titleRevealed = tip.title.slice(0, revealed);
|
|
5639
|
+
const contentRevealed = Math.max(0, revealed - tip.title.length);
|
|
5640
|
+
return /* @__PURE__ */ jsxs17(Box19, { flexDirection: "column", marginBottom: 1, gap: 1, children: [
|
|
5641
|
+
/* @__PURE__ */ jsx17(TipTitle, { children: titleRevealed }),
|
|
5642
|
+
/* @__PURE__ */ jsx17(TipContent, { chunks: tip.chunks, revealed: contentRevealed })
|
|
5643
|
+
] });
|
|
5624
5644
|
}
|
|
5625
5645
|
|
|
5626
5646
|
// src/ui/App.tsx
|
|
5627
|
-
import { jsx as
|
|
5647
|
+
import { jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5628
5648
|
function App() {
|
|
5629
5649
|
const {
|
|
5630
5650
|
phase,
|
|
@@ -5638,7 +5658,7 @@ function App() {
|
|
|
5638
5658
|
review: review2
|
|
5639
5659
|
} = useWizard();
|
|
5640
5660
|
const { exit } = useApp();
|
|
5641
|
-
const { columns, rows } =
|
|
5661
|
+
const { columns, rows } = useWindowSize7();
|
|
5642
5662
|
const [showLogs, setShowLogs] = useState10(false);
|
|
5643
5663
|
const [tipState, setTipState] = useState10("idle");
|
|
5644
5664
|
const finished = phase === "done" || phase === "error";
|
|
@@ -5651,6 +5671,7 @@ function App() {
|
|
|
5651
5671
|
const promptPending = isAwaitingUserInput && !isCommandApprovalPrompt;
|
|
5652
5672
|
const holdForTip = stepHasTips && promptPending && tipState === "revealing";
|
|
5653
5673
|
const showTips = stepHasTips && (phase === "running" || isCommandApprovalPrompt || holdForTip);
|
|
5674
|
+
const showNoticesInMain = !stepHasTips;
|
|
5654
5675
|
const showNotices = (!isAwaitingUserInput || holdForTip) && !review2;
|
|
5655
5676
|
useInput7(
|
|
5656
5677
|
(_input, key) => {
|
|
@@ -5685,15 +5706,14 @@ function App() {
|
|
|
5685
5706
|
});
|
|
5686
5707
|
const mainWindowVisible = phase === "authenticating" || phase === "preflight" || phase === "running" || phase === "awaitingInput" || phase === "error" || phase === "done";
|
|
5687
5708
|
const flexDirection = columns > 90 ? "row" : "column";
|
|
5688
|
-
const tipPanelRows = Math.min(TIP_PANEL_ROWS, Math.max(8, rows - 16));
|
|
5689
5709
|
const showSidebar = flexDirection === "row";
|
|
5690
5710
|
const scrollsPastViewport = phase === "idle" && homeScreen === "learnMore";
|
|
5691
5711
|
return (
|
|
5692
5712
|
/* Clamped to exactly the viewport: a taller frame makes Ink clear and repaint
|
|
5693
5713
|
the whole screen, and the scrolling throws off its cursor arithmetic —
|
|
5694
5714
|
flicker and leftover rows. */
|
|
5695
|
-
/* @__PURE__ */
|
|
5696
|
-
|
|
5715
|
+
/* @__PURE__ */ jsxs18(
|
|
5716
|
+
Box20,
|
|
5697
5717
|
{
|
|
5698
5718
|
backgroundColor: COLORS.bg.main,
|
|
5699
5719
|
flexDirection: "row",
|
|
@@ -5701,16 +5721,16 @@ function App() {
|
|
|
5701
5721
|
height: scrollsPastViewport ? void 0 : rows,
|
|
5702
5722
|
overflow: scrollsPastViewport ? "visible" : "hidden",
|
|
5703
5723
|
children: [
|
|
5704
|
-
mainWindowVisible && /* @__PURE__ */
|
|
5705
|
-
|
|
5724
|
+
mainWindowVisible && /* @__PURE__ */ jsxs18(
|
|
5725
|
+
Box20,
|
|
5706
5726
|
{
|
|
5707
5727
|
flexDirection,
|
|
5708
5728
|
width: "100%",
|
|
5709
5729
|
maxHeight: rows,
|
|
5710
5730
|
justifyContent: "space-between",
|
|
5711
5731
|
children: [
|
|
5712
|
-
showLogs ? /* @__PURE__ */
|
|
5713
|
-
|
|
5732
|
+
showLogs ? /* @__PURE__ */ jsx18(Logs, {}) : /* @__PURE__ */ jsxs18(
|
|
5733
|
+
Box20,
|
|
5714
5734
|
{
|
|
5715
5735
|
flexDirection: "column",
|
|
5716
5736
|
paddingX: 4,
|
|
@@ -5719,67 +5739,49 @@ function App() {
|
|
|
5719
5739
|
flexGrow: 1,
|
|
5720
5740
|
gap: 1,
|
|
5721
5741
|
children: [
|
|
5722
|
-
/* @__PURE__ */
|
|
5723
|
-
phase === "preflight" && !user && /* @__PURE__ */
|
|
5724
|
-
/* @__PURE__ */
|
|
5742
|
+
/* @__PURE__ */ jsxs18(Box20, { flexGrow: 2, flexDirection: "column", children: [
|
|
5743
|
+
phase === "preflight" && !user && /* @__PURE__ */ jsx18(Box20, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsxs18(Text20, { color: COLORS.strong, bold: true, children: [
|
|
5744
|
+
/* @__PURE__ */ jsx18(Spinner2, { type: "dots" }),
|
|
5725
5745
|
" Signing in to Algolia"
|
|
5726
5746
|
] }) }),
|
|
5727
|
-
phase === "preflight" && user && /* @__PURE__ */
|
|
5728
|
-
/* @__PURE__ */
|
|
5747
|
+
phase === "preflight" && user && /* @__PURE__ */ jsx18(Box20, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsxs18(Text20, { color: COLORS.strong, bold: true, children: [
|
|
5748
|
+
/* @__PURE__ */ jsx18(Spinner2, { type: "dots" }),
|
|
5729
5749
|
" Getting things ready"
|
|
5730
5750
|
] }) }),
|
|
5731
|
-
phase === "authenticating" && /* @__PURE__ */
|
|
5732
|
-
/* @__PURE__ */
|
|
5733
|
-
/* @__PURE__ */
|
|
5751
|
+
phase === "authenticating" && /* @__PURE__ */ jsxs18(Box20, { flexDirection: "column", marginBottom: 1, children: [
|
|
5752
|
+
/* @__PURE__ */ jsxs18(Text20, { color: COLORS.strong, bold: true, children: [
|
|
5753
|
+
/* @__PURE__ */ jsx18(Spinner2, { type: "dots" }),
|
|
5734
5754
|
" Signing in to Algolia"
|
|
5735
5755
|
] }),
|
|
5736
|
-
/* @__PURE__ */
|
|
5756
|
+
/* @__PURE__ */ jsx18(Text20, { color: COLORS.muted, children: "A browser window will open \u2014 complete sign-in there." })
|
|
5737
5757
|
] }),
|
|
5738
|
-
/* @__PURE__ */
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5758
|
+
/* @__PURE__ */ jsx18(CliOutput, {}),
|
|
5759
|
+
showTips && currentStep && /* @__PURE__ */ jsx18(
|
|
5760
|
+
Tips,
|
|
5761
|
+
{
|
|
5762
|
+
stepId: currentStep.id,
|
|
5763
|
+
ids: tipIds,
|
|
5764
|
+
onRevealStateChange: setTipState
|
|
5765
|
+
}
|
|
5766
|
+
),
|
|
5767
|
+
showNoticesInMain && showNotices && /* @__PURE__ */ jsx18(Notices, { showAll: true, border: false }),
|
|
5768
|
+
/* @__PURE__ */ jsx18(Review, {}),
|
|
5769
|
+
!showTips && /* @__PURE__ */ jsx18(PromptInput, {}),
|
|
5770
|
+
phase === "error" && error && /* @__PURE__ */ jsx18(Box20, { marginTop: 1, children: /* @__PURE__ */ jsxs18(Text20, { color: COLORS.status.error, children: [
|
|
5743
5771
|
"\u2716 ",
|
|
5744
5772
|
error
|
|
5745
5773
|
] }) })
|
|
5746
5774
|
] }),
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
walk its scroll window. */
|
|
5750
|
-
/* @__PURE__ */ jsx17(
|
|
5751
|
-
Box19,
|
|
5752
|
-
{
|
|
5753
|
-
borderColor: COLORS.border,
|
|
5754
|
-
borderStyle: "single",
|
|
5755
|
-
borderBackgroundColor: COLORS.bg.main,
|
|
5756
|
-
borderLeft: false,
|
|
5757
|
-
borderRight: false,
|
|
5758
|
-
borderBottom: false,
|
|
5759
|
-
paddingTop: 1,
|
|
5760
|
-
height: tipPanelRows,
|
|
5761
|
-
flexShrink: 0,
|
|
5762
|
-
overflow: "hidden",
|
|
5763
|
-
flexDirection: "column",
|
|
5764
|
-
children: /* @__PURE__ */ jsx17(
|
|
5765
|
-
Tips,
|
|
5766
|
-
{
|
|
5767
|
-
stepId: currentStep.id,
|
|
5768
|
-
ids: tipIds,
|
|
5769
|
-
onRevealStateChange: setTipState
|
|
5770
|
-
}
|
|
5771
|
-
)
|
|
5772
|
-
}
|
|
5773
|
-
),
|
|
5774
|
-
showTips && !holdForTip && /* @__PURE__ */ jsx17(PromptInput, {})
|
|
5775
|
+
!showNoticesInMain && showNotices && /* @__PURE__ */ jsx18(Notices, {}),
|
|
5776
|
+
showTips && !holdForTip && /* @__PURE__ */ jsx18(PromptInput, {})
|
|
5775
5777
|
]
|
|
5776
5778
|
}
|
|
5777
5779
|
),
|
|
5778
|
-
showSidebar ? /* @__PURE__ */
|
|
5780
|
+
showSidebar ? /* @__PURE__ */ jsx18(Sidebar, {}) : /* @__PURE__ */ jsx18(Ribbon, {})
|
|
5779
5781
|
]
|
|
5780
5782
|
}
|
|
5781
5783
|
),
|
|
5782
|
-
phase === "idle" && (homeScreen === "learnMore" ? /* @__PURE__ */
|
|
5784
|
+
phase === "idle" && (homeScreen === "learnMore" ? /* @__PURE__ */ jsx18(LearnMore, {}) : /* @__PURE__ */ jsx18(Welcome, {}))
|
|
5783
5785
|
]
|
|
5784
5786
|
}
|
|
5785
5787
|
)
|
|
@@ -6198,7 +6200,7 @@ function delay(ms) {
|
|
|
6198
6200
|
}
|
|
6199
6201
|
|
|
6200
6202
|
// src/main.tsx
|
|
6201
|
-
import { jsx as
|
|
6203
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
6202
6204
|
async function startup() {
|
|
6203
6205
|
setProjectRoot(process.cwd());
|
|
6204
6206
|
let args;
|
|
@@ -6248,7 +6250,7 @@ ${formatStepList(workflow)}`);
|
|
|
6248
6250
|
}
|
|
6249
6251
|
async function run(workflow) {
|
|
6250
6252
|
const store = useWizard.getState();
|
|
6251
|
-
const instance = render(/* @__PURE__ */
|
|
6253
|
+
const instance = render(/* @__PURE__ */ jsx19(App, {}), { incrementalRendering: true });
|
|
6252
6254
|
await store.waitForStart();
|
|
6253
6255
|
store.syncSteps(
|
|
6254
6256
|
workflow.steps.map((s) => ({
|