@algolia/wizard 0.30.0 → 0.32.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 +150 -123
- 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 Box19, Text as Text19, useApp, useInput as
|
|
7
|
+
import { Box as Box19, Text as Text19, useApp, useInput as useInput6, useWindowSize as useWindowSize7 } from "ink";
|
|
8
8
|
import Spinner2 from "ink-spinner";
|
|
9
9
|
|
|
10
10
|
// src/core/store.ts
|
|
@@ -626,50 +626,107 @@ function Notices({
|
|
|
626
626
|
}
|
|
627
627
|
|
|
628
628
|
// src/ui/PromptInput.tsx
|
|
629
|
-
import { Box as Box9, Text as Text9
|
|
629
|
+
import { Box as Box9, Text as Text9 } from "ink";
|
|
630
630
|
import TextInput from "ink-text-input";
|
|
631
|
-
import { useState as
|
|
631
|
+
import { useState as useState6 } from "react";
|
|
632
632
|
|
|
633
633
|
// src/ui/CommandApproval.tsx
|
|
634
|
+
import { Box as Box6, Text as Text6 } from "ink";
|
|
635
|
+
|
|
636
|
+
// src/ui/DecisionSelect.tsx
|
|
634
637
|
import { Box as Box5, Text as Text5, useInput } from "ink";
|
|
638
|
+
import { useState as useState3 } from "react";
|
|
635
639
|
|
|
636
|
-
// src/ui/
|
|
640
|
+
// src/ui/SelectRow.tsx
|
|
637
641
|
import { Box as Box4, Text as Text4 } from "ink";
|
|
638
|
-
import {
|
|
639
|
-
function
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
642
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
643
|
+
function SelectRow({
|
|
644
|
+
highlighted,
|
|
645
|
+
label,
|
|
646
|
+
width,
|
|
647
|
+
labelWidth,
|
|
648
|
+
highlightBackground = true,
|
|
649
|
+
usePadding = false,
|
|
650
|
+
children
|
|
643
651
|
}) {
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
652
|
+
const labelColor = highlighted ? highlightBackground ? COLORS.highlight.fg : COLORS.success : COLORS.primary;
|
|
653
|
+
return /* @__PURE__ */ jsxs3(
|
|
654
|
+
Box4,
|
|
655
|
+
{
|
|
656
|
+
width,
|
|
657
|
+
paddingX: usePadding ? 1 : 0,
|
|
658
|
+
paddingY: usePadding ? 1 : 0,
|
|
659
|
+
backgroundColor: highlighted && highlightBackground ? COLORS.highlight.bg : void 0,
|
|
660
|
+
children: [
|
|
661
|
+
/* @__PURE__ */ jsx3(Box4, { width: labelWidth, children: /* @__PURE__ */ jsxs3(
|
|
662
|
+
Text4,
|
|
663
|
+
{
|
|
664
|
+
color: labelColor,
|
|
665
|
+
bold: highlighted && !highlightBackground,
|
|
666
|
+
wrap: "truncate",
|
|
667
|
+
children: [
|
|
668
|
+
highlighted ? "\u276F " : " ",
|
|
669
|
+
label
|
|
670
|
+
]
|
|
671
|
+
}
|
|
672
|
+
) }),
|
|
673
|
+
children
|
|
674
|
+
]
|
|
675
|
+
}
|
|
676
|
+
);
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// src/ui/DecisionSelect.tsx
|
|
680
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
681
|
+
function DecisionSelect({
|
|
682
|
+
actions,
|
|
683
|
+
onDecide
|
|
684
|
+
}) {
|
|
685
|
+
const [index, setIndex] = useState3(0);
|
|
686
|
+
useInput((input, key) => {
|
|
687
|
+
if (key.upArrow || input === "k") {
|
|
688
|
+
setIndex((i) => (i - 1 + actions.length) % actions.length);
|
|
689
|
+
} else if (key.downArrow || input === "j") {
|
|
690
|
+
setIndex((i) => (i + 1) % actions.length);
|
|
691
|
+
} else if (key.return) {
|
|
692
|
+
onDecide(actions[index].value);
|
|
693
|
+
} else if (key.escape) {
|
|
694
|
+
onDecide(actions[1].value);
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
return /* @__PURE__ */ jsxs4(Box5, { flexDirection: "column", gap: 1, children: [
|
|
698
|
+
/* @__PURE__ */ jsx4(Box5, { flexDirection: "column", children: actions.map((action, i) => /* @__PURE__ */ jsx4(
|
|
699
|
+
SelectRow,
|
|
700
|
+
{
|
|
701
|
+
highlighted: i === index,
|
|
702
|
+
highlightBackground: false,
|
|
703
|
+
label: action.label
|
|
704
|
+
},
|
|
705
|
+
action.label
|
|
706
|
+
)) }),
|
|
707
|
+
/* @__PURE__ */ jsxs4(Box5, { gap: 2, children: [
|
|
708
|
+
/* @__PURE__ */ jsxs4(Text5, { children: [
|
|
709
|
+
/* @__PURE__ */ jsx4(Text5, { color: COLORS.primary, children: "[\u2191] [\u2193]" }),
|
|
710
|
+
/* @__PURE__ */ jsx4(Text5, { color: COLORS.dim, children: " move" })
|
|
711
|
+
] }),
|
|
712
|
+
/* @__PURE__ */ jsxs4(Text5, { children: [
|
|
713
|
+
/* @__PURE__ */ jsx4(Text5, { color: COLORS.primary, children: "[enter]" }),
|
|
714
|
+
/* @__PURE__ */ jsx4(Text5, { color: COLORS.dim, children: " confirm" })
|
|
715
|
+
] })
|
|
655
716
|
] })
|
|
656
717
|
] });
|
|
657
718
|
}
|
|
658
719
|
|
|
659
720
|
// src/ui/CommandApproval.tsx
|
|
660
|
-
import { jsx as
|
|
721
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
661
722
|
function CommandApproval({
|
|
662
723
|
command,
|
|
663
724
|
onDecide
|
|
664
725
|
}) {
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
return /* @__PURE__ */ jsxs4(Box5, { flexDirection: "column", gap: 1, children: [
|
|
670
|
-
/* @__PURE__ */ jsx4(Text5, { color: COLORS.primary, bold: true, children: "Run this command?" }),
|
|
671
|
-
/* @__PURE__ */ jsxs4(
|
|
672
|
-
Box5,
|
|
726
|
+
return /* @__PURE__ */ jsxs5(Box6, { flexDirection: "column", gap: 1, children: [
|
|
727
|
+
/* @__PURE__ */ jsx5(Text6, { color: COLORS.primary, bold: true, children: "Run this command?" }),
|
|
728
|
+
/* @__PURE__ */ jsxs5(
|
|
729
|
+
Box6,
|
|
673
730
|
{
|
|
674
731
|
flexDirection: "column",
|
|
675
732
|
paddingLeft: 2,
|
|
@@ -680,36 +737,42 @@ function CommandApproval({
|
|
|
680
737
|
borderRight: false,
|
|
681
738
|
gap: 1,
|
|
682
739
|
children: [
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
685
|
-
/* @__PURE__ */
|
|
740
|
+
/* @__PURE__ */ jsxs5(Box6, { children: [
|
|
741
|
+
/* @__PURE__ */ jsx5(Text6, { color: COLORS.muted, children: "$ " }),
|
|
742
|
+
/* @__PURE__ */ jsx5(Text6, { color: COLORS.strong, wrap: "wrap", children: command.command })
|
|
686
743
|
] }),
|
|
687
|
-
/* @__PURE__ */
|
|
688
|
-
/* @__PURE__ */
|
|
689
|
-
/* @__PURE__ */
|
|
744
|
+
/* @__PURE__ */ jsxs5(Box6, { gap: 1, children: [
|
|
745
|
+
/* @__PURE__ */ jsx5(Text6, { color: COLORS.muted, children: "in:" }),
|
|
746
|
+
/* @__PURE__ */ jsx5(Text6, { color: COLORS.muted, wrap: "wrap", children: command.cwd })
|
|
690
747
|
] }),
|
|
691
|
-
command.explanation && /* @__PURE__ */
|
|
692
|
-
/* @__PURE__ */
|
|
693
|
-
/* @__PURE__ */
|
|
748
|
+
command.explanation && /* @__PURE__ */ jsxs5(Box6, { gap: 1, children: [
|
|
749
|
+
/* @__PURE__ */ jsx5(Text6, { color: COLORS.muted, children: "why:" }),
|
|
750
|
+
/* @__PURE__ */ jsx5(Text6, { color: COLORS.accent, wrap: "wrap", children: command.explanation })
|
|
694
751
|
] })
|
|
695
752
|
]
|
|
696
753
|
}
|
|
697
754
|
),
|
|
698
|
-
/* @__PURE__ */
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
755
|
+
/* @__PURE__ */ jsx5(
|
|
756
|
+
DecisionSelect,
|
|
757
|
+
{
|
|
758
|
+
actions: [
|
|
759
|
+
{ label: "approve", value: "approve" },
|
|
760
|
+
{ label: "reject", value: "reject" }
|
|
761
|
+
],
|
|
762
|
+
onDecide
|
|
763
|
+
}
|
|
764
|
+
)
|
|
702
765
|
] });
|
|
703
766
|
}
|
|
704
767
|
|
|
705
768
|
// src/ui/SelectPrompt.tsx
|
|
706
769
|
import { Box as Box8, Text as Text8, useInput as useInput2, useWindowSize as useWindowSize4 } from "ink";
|
|
707
|
-
import { useLayoutEffect as useLayoutEffect2, useRef as useRef3, useState as
|
|
770
|
+
import { useLayoutEffect as useLayoutEffect2, useRef as useRef3, useState as useState5 } from "react";
|
|
708
771
|
|
|
709
772
|
// src/ui/ScrollView.tsx
|
|
710
|
-
import { Box as
|
|
711
|
-
import { useCallback, useLayoutEffect, useRef as useRef2, useState as
|
|
712
|
-
import { jsxs as
|
|
773
|
+
import { Box as Box7, Text as Text7, measureElement as measureElement2, useWindowSize as useWindowSize3 } from "ink";
|
|
774
|
+
import { useCallback, useLayoutEffect, useRef as useRef2, useState as useState4 } from "react";
|
|
775
|
+
import { jsxs as jsxs6 } from "react/jsx-runtime";
|
|
713
776
|
var INDICATOR_ROWS = 2;
|
|
714
777
|
function fittedWidth(node, columns) {
|
|
715
778
|
let left = 0;
|
|
@@ -725,7 +788,7 @@ function useScrollWindow({
|
|
|
725
788
|
}) {
|
|
726
789
|
const viewportRef = useRef2(null);
|
|
727
790
|
const { columns } = useWindowSize3();
|
|
728
|
-
const [size, setSize] =
|
|
791
|
+
const [size, setSize] = useState4(
|
|
729
792
|
null
|
|
730
793
|
);
|
|
731
794
|
useLayoutEffect(() => {
|
|
@@ -738,7 +801,7 @@ function useScrollWindow({
|
|
|
738
801
|
});
|
|
739
802
|
const capacity = size === null || itemCount * rowHeight <= size.height ? itemCount : Math.max(Math.floor((size.height - INDICATOR_ROWS) / rowHeight), 1);
|
|
740
803
|
const maxOffset = Math.max(itemCount - capacity, 0);
|
|
741
|
-
const [offset, setOffset] =
|
|
804
|
+
const [offset, setOffset] = useState4(0);
|
|
742
805
|
const prevMaxOffsetRef = useRef2(0);
|
|
743
806
|
useLayoutEffect(() => {
|
|
744
807
|
const wasAtBottom = offset >= prevMaxOffsetRef.current;
|
|
@@ -779,14 +842,14 @@ function useScrollWindow({
|
|
|
779
842
|
};
|
|
780
843
|
}
|
|
781
844
|
function ScrollView({ scroll, children }) {
|
|
782
|
-
return /* @__PURE__ */
|
|
783
|
-
scroll.hiddenAbove > 0 && /* @__PURE__ */
|
|
845
|
+
return /* @__PURE__ */ jsxs6(Box7, { ref: scroll.viewportRef, flexDirection: "column", flexGrow: 1, children: [
|
|
846
|
+
scroll.hiddenAbove > 0 && /* @__PURE__ */ jsxs6(Text7, { color: COLORS.dim, children: [
|
|
784
847
|
"\u2191 ",
|
|
785
848
|
scroll.hiddenAbove,
|
|
786
849
|
" more"
|
|
787
850
|
] }),
|
|
788
851
|
children,
|
|
789
|
-
scroll.hiddenBelow > 0 && /* @__PURE__ */
|
|
852
|
+
scroll.hiddenBelow > 0 && /* @__PURE__ */ jsxs6(Text7, { color: COLORS.dim, children: [
|
|
790
853
|
"\u2193 ",
|
|
791
854
|
scroll.hiddenBelow,
|
|
792
855
|
" more"
|
|
@@ -794,45 +857,6 @@ function ScrollView({ scroll, children }) {
|
|
|
794
857
|
] });
|
|
795
858
|
}
|
|
796
859
|
|
|
797
|
-
// src/ui/SelectRow.tsx
|
|
798
|
-
import { Box as Box7, Text as Text7 } from "ink";
|
|
799
|
-
import { jsx as jsx5, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
800
|
-
function SelectRow({
|
|
801
|
-
highlighted,
|
|
802
|
-
label,
|
|
803
|
-
width,
|
|
804
|
-
labelWidth,
|
|
805
|
-
highlightBackground = true,
|
|
806
|
-
usePadding = false,
|
|
807
|
-
children
|
|
808
|
-
}) {
|
|
809
|
-
const labelColor = highlighted ? highlightBackground ? COLORS.highlight.fg : COLORS.success : void 0;
|
|
810
|
-
return /* @__PURE__ */ jsxs6(
|
|
811
|
-
Box7,
|
|
812
|
-
{
|
|
813
|
-
width,
|
|
814
|
-
paddingX: usePadding ? 1 : 0,
|
|
815
|
-
paddingY: usePadding ? 1 : 0,
|
|
816
|
-
backgroundColor: highlighted && highlightBackground ? COLORS.highlight.bg : void 0,
|
|
817
|
-
children: [
|
|
818
|
-
/* @__PURE__ */ jsx5(Box7, { width: labelWidth, children: /* @__PURE__ */ jsxs6(
|
|
819
|
-
Text7,
|
|
820
|
-
{
|
|
821
|
-
color: labelColor,
|
|
822
|
-
bold: highlighted && !highlightBackground,
|
|
823
|
-
wrap: "truncate",
|
|
824
|
-
children: [
|
|
825
|
-
highlighted ? "\u276F " : " ",
|
|
826
|
-
label
|
|
827
|
-
]
|
|
828
|
-
}
|
|
829
|
-
) }),
|
|
830
|
-
children
|
|
831
|
-
]
|
|
832
|
-
}
|
|
833
|
-
);
|
|
834
|
-
}
|
|
835
|
-
|
|
836
860
|
// src/ui/SelectPrompt.tsx
|
|
837
861
|
import { jsx as jsx6, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
838
862
|
var CANCEL = "cancel";
|
|
@@ -853,10 +877,10 @@ function SelectPrompt({
|
|
|
853
877
|
secondary,
|
|
854
878
|
defaultSelectedIndex = 0
|
|
855
879
|
}) {
|
|
856
|
-
const [index, setIndex] =
|
|
880
|
+
const [index, setIndex] = useState5(
|
|
857
881
|
() => defaultSelectedIndex > 0 && defaultSelectedIndex < options.length ? defaultSelectedIndex : 0
|
|
858
882
|
);
|
|
859
|
-
const [checked, setChecked] =
|
|
883
|
+
const [checked, setChecked] = useState5(() => /* @__PURE__ */ new Set());
|
|
860
884
|
const hasCancel = Boolean(multi || cancelable);
|
|
861
885
|
const rows = hasCancel ? [...options, "Cancel"] : options;
|
|
862
886
|
const cancelIndex = hasCancel ? options.length : -1;
|
|
@@ -866,7 +890,7 @@ function SelectPrompt({
|
|
|
866
890
|
hints.push({ key: "[enter]", label: "confirm" });
|
|
867
891
|
const containerRef = useRef3(null);
|
|
868
892
|
const { columns } = useWindowSize4();
|
|
869
|
-
const [width, setWidth] =
|
|
893
|
+
const [width, setWidth] = useState5(columns);
|
|
870
894
|
useLayoutEffect2(() => {
|
|
871
895
|
if (!containerRef.current) return;
|
|
872
896
|
const measured = fittedWidth(containerRef.current, columns);
|
|
@@ -978,22 +1002,24 @@ function EnterToContinuePrompt({
|
|
|
978
1002
|
messages,
|
|
979
1003
|
onDecide
|
|
980
1004
|
}) {
|
|
981
|
-
useInput3((_input, key) => {
|
|
982
|
-
if (key.return) onDecide(true);
|
|
983
|
-
else if (key.escape) onDecide(false);
|
|
984
|
-
});
|
|
985
1005
|
return /* @__PURE__ */ jsxs8(Box9, { flexDirection: "column", gap: 1, children: [
|
|
986
1006
|
messages?.map((m, i) => /* @__PURE__ */ jsx7(Text9, { color: COLORS.muted, children: m }, `msg-${i}`)),
|
|
987
1007
|
question && /* @__PURE__ */ jsx7(Text9, { color: COLORS.primary, children: question }),
|
|
988
|
-
/* @__PURE__ */
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1008
|
+
/* @__PURE__ */ jsx7(
|
|
1009
|
+
DecisionSelect,
|
|
1010
|
+
{
|
|
1011
|
+
actions: [
|
|
1012
|
+
{ label: "continue", value: true },
|
|
1013
|
+
{ label: "decline", value: false }
|
|
1014
|
+
],
|
|
1015
|
+
onDecide
|
|
1016
|
+
}
|
|
1017
|
+
)
|
|
992
1018
|
] });
|
|
993
1019
|
}
|
|
994
1020
|
function PromptInput() {
|
|
995
1021
|
const { phase, inputReq, submitInput } = useWizard();
|
|
996
|
-
const [draft, setDraft] =
|
|
1022
|
+
const [draft, setDraft] = useState6("");
|
|
997
1023
|
if (phase === "done" || phase === "error") {
|
|
998
1024
|
return /* @__PURE__ */ jsx7(Box9, { marginTop: 1, children: /* @__PURE__ */ jsx7(Text9, { color: "gray", dimColor: true, children: "Press Enter or Esc to exit" }) });
|
|
999
1025
|
}
|
|
@@ -1093,8 +1119,8 @@ function PromptInput() {
|
|
|
1093
1119
|
// src/ui/Welcome.tsx
|
|
1094
1120
|
import { dirname as dirname2, join as join3 } from "node:path";
|
|
1095
1121
|
import { fileURLToPath } from "node:url";
|
|
1096
|
-
import { useState as
|
|
1097
|
-
import { Box as Box10, Spacer, Text as Text10, useInput as
|
|
1122
|
+
import { useState as useState7 } from "react";
|
|
1123
|
+
import { Box as Box10, Spacer, Text as Text10, useInput as useInput3, useWindowSize as useWindowSize5 } from "ink";
|
|
1098
1124
|
|
|
1099
1125
|
// src/ui/copy/welcome.ts
|
|
1100
1126
|
var sidebarItems = [
|
|
@@ -1152,8 +1178,8 @@ function Welcome() {
|
|
|
1152
1178
|
{ label: "start wizard", run: confirmStart },
|
|
1153
1179
|
{ label: "learn more", run: openLearnMore }
|
|
1154
1180
|
];
|
|
1155
|
-
const [index, setIndex] =
|
|
1156
|
-
|
|
1181
|
+
const [index, setIndex] = useState7(0);
|
|
1182
|
+
useInput3((input, key) => {
|
|
1157
1183
|
if (key.upArrow || input === "k") {
|
|
1158
1184
|
setIndex((i) => (i - 1 + actions.length) % actions.length);
|
|
1159
1185
|
} else if (key.downArrow || input === "j") {
|
|
@@ -1239,8 +1265,8 @@ function Welcome() {
|
|
|
1239
1265
|
}
|
|
1240
1266
|
|
|
1241
1267
|
// src/ui/LearnMore.tsx
|
|
1242
|
-
import { Fragment
|
|
1243
|
-
import { Box as Box11, Text as Text11, useInput as
|
|
1268
|
+
import { Fragment } from "react";
|
|
1269
|
+
import { Box as Box11, Text as Text11, useInput as useInput4, useWindowSize as useWindowSize6 } from "ink";
|
|
1244
1270
|
|
|
1245
1271
|
// src/ui/copy/learn-more.ts
|
|
1246
1272
|
var accessIntro = "Everything runs locally on your machine. Nothing is written or sent without an explicit yes from you.";
|
|
@@ -1312,7 +1338,7 @@ function LearnMore() {
|
|
|
1312
1338
|
const backToHome = useWizard((s) => s.backToHome);
|
|
1313
1339
|
const { columns } = useWindowSize6();
|
|
1314
1340
|
const dividerWidth = Math.max(0, columns - PADDING_X * 2);
|
|
1315
|
-
|
|
1341
|
+
useInput4((_input, key) => {
|
|
1316
1342
|
if (key.escape) backToHome();
|
|
1317
1343
|
else if (key.return) confirmStart();
|
|
1318
1344
|
});
|
|
@@ -1347,7 +1373,7 @@ function LearnMore() {
|
|
|
1347
1373
|
segments: [{ text: "I NEVER", color: COLORS.danger, bold: true }]
|
|
1348
1374
|
}
|
|
1349
1375
|
),
|
|
1350
|
-
neverItems.map((item) => /* @__PURE__ */ jsxs10(
|
|
1376
|
+
neverItems.map((item) => /* @__PURE__ */ jsxs10(Fragment, { children: [
|
|
1351
1377
|
/* @__PURE__ */ jsx9(NeverLine, { width: dividerWidth }),
|
|
1352
1378
|
/* @__PURE__ */ jsx9(
|
|
1353
1379
|
NeverLine,
|
|
@@ -1520,10 +1546,10 @@ function Ribbon() {
|
|
|
1520
1546
|
}
|
|
1521
1547
|
|
|
1522
1548
|
// src/ui/App.tsx
|
|
1523
|
-
import { useState as
|
|
1549
|
+
import { useState as useState9 } from "react";
|
|
1524
1550
|
|
|
1525
1551
|
// src/ui/Logs.tsx
|
|
1526
|
-
import { Box as Box16, Text as Text16, useInput as
|
|
1552
|
+
import { Box as Box16, Text as Text16, useInput as useInput5 } from "ink";
|
|
1527
1553
|
import { jsx as jsx14, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1528
1554
|
var KIND_COLOR = {
|
|
1529
1555
|
tool: COLORS.primary,
|
|
@@ -1555,7 +1581,7 @@ function formatTimestamp(ms) {
|
|
|
1555
1581
|
function Logs() {
|
|
1556
1582
|
const logs = useWizard((s) => s.logs);
|
|
1557
1583
|
const scroll = useScrollWindow({ itemCount: logs.length, followBottom: true });
|
|
1558
|
-
|
|
1584
|
+
useInput5((_input, key) => {
|
|
1559
1585
|
if (key.upArrow) scroll.scrollBy(-1);
|
|
1560
1586
|
else if (key.downArrow) scroll.scrollBy(1);
|
|
1561
1587
|
});
|
|
@@ -1771,7 +1797,7 @@ function track(event, payload) {
|
|
|
1771
1797
|
}
|
|
1772
1798
|
|
|
1773
1799
|
// src/ui/Tips.tsx
|
|
1774
|
-
import { useEffect as useEffect3, useState as
|
|
1800
|
+
import { useEffect as useEffect3, useState as useState8 } from "react";
|
|
1775
1801
|
import { Box as Box18, Text as Text18 } from "ink";
|
|
1776
1802
|
import terminalLink from "terminal-link";
|
|
1777
1803
|
|
|
@@ -1998,8 +2024,8 @@ function TipContent({
|
|
|
1998
2024
|
) });
|
|
1999
2025
|
}
|
|
2000
2026
|
function Tips() {
|
|
2001
|
-
const [tipIndex, setTipIndex] =
|
|
2002
|
-
const [revealed, setRevealed] =
|
|
2027
|
+
const [tipIndex, setTipIndex] = useState8(0);
|
|
2028
|
+
const [revealed, setRevealed] = useState8(0);
|
|
2003
2029
|
const tip = tips[tipIndex];
|
|
2004
2030
|
const contentLength = tip.chunks.reduce((sum, c) => sum + c.value.length, 0);
|
|
2005
2031
|
const totalLength = tip.title.length + contentLength;
|
|
@@ -2059,7 +2085,7 @@ function App() {
|
|
|
2059
2085
|
} = useWizard();
|
|
2060
2086
|
const { exit } = useApp();
|
|
2061
2087
|
const { columns, rows } = useWindowSize7();
|
|
2062
|
-
const [showLogs, setShowLogs] =
|
|
2088
|
+
const [showLogs, setShowLogs] = useState9(false);
|
|
2063
2089
|
const finished = phase === "done" || phase === "error";
|
|
2064
2090
|
const currentStep = steps[currentStepIndex];
|
|
2065
2091
|
const isInitialAnalysisStep = currentStepIndex === 0;
|
|
@@ -2067,7 +2093,7 @@ function App() {
|
|
|
2067
2093
|
const showTips = phase === "running" && isInitialAnalysisStep && notices.length > 0;
|
|
2068
2094
|
const showNoticesInMain = !isInitialAnalysisStep;
|
|
2069
2095
|
const showNotices = !isAwaitingUserInput;
|
|
2070
|
-
|
|
2096
|
+
useInput6(
|
|
2071
2097
|
(_input, key) => {
|
|
2072
2098
|
if (key.return) {
|
|
2073
2099
|
exit();
|
|
@@ -2075,7 +2101,7 @@ function App() {
|
|
|
2075
2101
|
},
|
|
2076
2102
|
{ isActive: finished }
|
|
2077
2103
|
);
|
|
2078
|
-
|
|
2104
|
+
useInput6((_input, key) => {
|
|
2079
2105
|
if (phase === "idle" || phase === "authenticating") return;
|
|
2080
2106
|
if (key.tab) {
|
|
2081
2107
|
setShowLogs(!showLogs);
|
|
@@ -2087,7 +2113,7 @@ function App() {
|
|
|
2087
2113
|
}
|
|
2088
2114
|
});
|
|
2089
2115
|
const escOwnedElsewhere = phase === "idle" || phase === "authenticating" || phase === "awaitingInput" && (inputReq?.promptType === "enterToContinue" || inputReq?.promptType === "commandApproval");
|
|
2090
|
-
|
|
2116
|
+
useInput6((_input, key) => {
|
|
2091
2117
|
if (escOwnedElsewhere) return;
|
|
2092
2118
|
if (key.escape) {
|
|
2093
2119
|
track("AI Wizard Interaction", {
|
|
@@ -4038,7 +4064,7 @@ async function runAnalysis(mode, extraInstructions = []) {
|
|
|
4038
4064
|
// package.json
|
|
4039
4065
|
var package_default = {
|
|
4040
4066
|
name: "@algolia/wizard",
|
|
4041
|
-
version: "0.
|
|
4067
|
+
version: "0.32.0",
|
|
4042
4068
|
description: "Magically implement Algolia functionality in your codebase",
|
|
4043
4069
|
type: "module",
|
|
4044
4070
|
engines: {
|
|
@@ -4759,8 +4785,9 @@ function searchInstructions(input) {
|
|
|
4759
4785
|
] : [
|
|
4760
4786
|
"No bundled Algolia SDK reference exists for this stack, so rely on the project's own conventions and Algolia's official client for its language. Do not invent APIs \u2014 keep to the documented search endpoint and its parameters."
|
|
4761
4787
|
],
|
|
4762
|
-
`
|
|
4763
|
-
"
|
|
4788
|
+
`Create the search experience as its own component in a new file, following the project's existing component conventions (location, naming, styling approach). Do not write it inline into an existing file.`,
|
|
4789
|
+
`Import and render that new component from ${input.searchLocation ? `"${input.searchLocation}"` : "the best shared, always-rendered layout location (e.g. a header/nav component)"} so it is reachable across the app \u2014 at least a working search input and results list against the target index.`,
|
|
4790
|
+
"If a search box already exists, replace its usage with an import and render of your new component; remove the old implementation.",
|
|
4764
4791
|
`Read the index name from the ${publicIndexNameVar(input.publicEnvVarPrefix)} env var, which the wizard sets to "${input.targetIndex}". Never hardcode an index name or derive one from the project, file, or component name.`,
|
|
4765
4792
|
"Read the App ID, the search-only API key, and the index name from env vars; never hardcode them. A search-only key is safe to expose client-side.",
|
|
4766
4793
|
// The key is provisioned only after verification passes, and the wizard
|