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