@algolia/wizard 0.24.0-rc.111.205 → 0.24.0-rc.117.212
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 +352 -89
- package/package.json +2 -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 useWindowSize7 } from "ink";
|
|
8
8
|
|
|
9
9
|
// src/core/store.ts
|
|
10
10
|
import { create } from "zustand";
|
|
@@ -488,7 +488,7 @@ function CliOutput() {
|
|
|
488
488
|
}
|
|
489
489
|
|
|
490
490
|
// src/ui/Notices.tsx
|
|
491
|
-
import { Box as Box3, Text as Text3
|
|
491
|
+
import { Box as Box3, Text as Text3 } from "ink";
|
|
492
492
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
493
493
|
|
|
494
494
|
// src/ui/Table.tsx
|
|
@@ -547,31 +547,6 @@ var truncate = (s, width) => s.length <= width ? s : width <= 1 ? s.slice(0, wid
|
|
|
547
547
|
// src/ui/Notices.tsx
|
|
548
548
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
549
549
|
var AGENT_MARKER = "\u2726";
|
|
550
|
-
var RESERVED_ROWS2 = 14;
|
|
551
|
-
var PANEL_TEXT_WIDTH2 = 45;
|
|
552
|
-
function messageLineCount(text) {
|
|
553
|
-
return Math.max(1, Math.ceil(text.length / PANEL_TEXT_WIDTH2));
|
|
554
|
-
}
|
|
555
|
-
function noticeLineCount(notice) {
|
|
556
|
-
const messageLines = (notice.messages ?? []).reduce((sum, m) => {
|
|
557
|
-
const text = typeof m === "string" ? m : m.text;
|
|
558
|
-
return sum + messageLineCount(text);
|
|
559
|
-
}, 0);
|
|
560
|
-
const tableLines = notice.table ? notice.table.rows.length + 4 : 0;
|
|
561
|
-
return messageLines + tableLines;
|
|
562
|
-
}
|
|
563
|
-
function fitVisibleNotices(notices, windowRows) {
|
|
564
|
-
const budget = Math.max(windowRows - RESERVED_ROWS2, 3);
|
|
565
|
-
let used = 0;
|
|
566
|
-
let count = 0;
|
|
567
|
-
for (let i = notices.length - 1; i >= 0; i--) {
|
|
568
|
-
const height = noticeLineCount(notices[i]) + (count > 0 ? 1 : 0);
|
|
569
|
-
if (count > 0 && used + height > budget) break;
|
|
570
|
-
used += height;
|
|
571
|
-
count++;
|
|
572
|
-
}
|
|
573
|
-
return notices.slice(notices.length - count);
|
|
574
|
-
}
|
|
575
550
|
var PULSE_STEPS = 12;
|
|
576
551
|
var PULSE_STEP_MS = 150;
|
|
577
552
|
var PULSE_COLORS = Array.from(
|
|
@@ -594,8 +569,7 @@ function parseHex(hex) {
|
|
|
594
569
|
}
|
|
595
570
|
function Notices() {
|
|
596
571
|
const notices = useWizard((s) => s.notices);
|
|
597
|
-
const
|
|
598
|
-
const visible = fitVisibleNotices(notices, windowRows);
|
|
572
|
+
const latest = notices[notices.length - 1];
|
|
599
573
|
const [pulseStep, setPulseStep] = useState2(0);
|
|
600
574
|
useEffect2(() => {
|
|
601
575
|
let direction = 1;
|
|
@@ -609,30 +583,40 @@ function Notices() {
|
|
|
609
583
|
}, PULSE_STEP_MS);
|
|
610
584
|
return () => clearInterval(id);
|
|
611
585
|
}, []);
|
|
612
|
-
if (!
|
|
586
|
+
if (!latest) return null;
|
|
613
587
|
const pulseColor = PULSE_COLORS[pulseStep];
|
|
614
|
-
return /* @__PURE__ */
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
588
|
+
return /* @__PURE__ */ jsxs2(
|
|
589
|
+
Box3,
|
|
590
|
+
{
|
|
591
|
+
borderColor: COLORS.border,
|
|
592
|
+
borderStyle: "single",
|
|
593
|
+
borderBackgroundColor: COLORS.bg.main,
|
|
594
|
+
borderLeft: false,
|
|
595
|
+
borderRight: false,
|
|
596
|
+
borderBottom: false,
|
|
597
|
+
paddingTop: 1,
|
|
598
|
+
flexDirection: "column",
|
|
599
|
+
children: [
|
|
600
|
+
latest.messages?.map((m, j) => {
|
|
601
|
+
const line = typeof m === "string" ? { text: m } : m;
|
|
602
|
+
const prefix = j === 0 ? `${AGENT_MARKER} ` : " ";
|
|
603
|
+
return /* @__PURE__ */ jsxs2(
|
|
604
|
+
Text3,
|
|
605
|
+
{
|
|
606
|
+
color: !line.color ? pulseColor : line.color ?? COLORS.dim,
|
|
607
|
+
bold: line.bold,
|
|
608
|
+
children: [
|
|
609
|
+
prefix,
|
|
610
|
+
line.text
|
|
611
|
+
]
|
|
612
|
+
},
|
|
613
|
+
`notice-${j}`
|
|
614
|
+
);
|
|
615
|
+
}),
|
|
616
|
+
latest.table && /* @__PURE__ */ jsx2(Table, { columns: latest.table.columns, rows: latest.table.rows })
|
|
617
|
+
]
|
|
618
|
+
}
|
|
619
|
+
);
|
|
636
620
|
}
|
|
637
621
|
|
|
638
622
|
// src/ui/PromptInput.tsx
|
|
@@ -713,11 +697,11 @@ function CommandApproval({
|
|
|
713
697
|
}
|
|
714
698
|
|
|
715
699
|
// src/ui/SelectPrompt.tsx
|
|
716
|
-
import { Box as Box8, Text as Text8, useInput as useInput2, useWindowSize as
|
|
700
|
+
import { Box as Box8, Text as Text8, useInput as useInput2, useWindowSize as useWindowSize4 } from "ink";
|
|
717
701
|
import { useLayoutEffect as useLayoutEffect2, useRef as useRef3, useState as useState4 } from "react";
|
|
718
702
|
|
|
719
703
|
// src/ui/ScrollView.tsx
|
|
720
|
-
import { Box as Box6, Text as Text6, measureElement as measureElement2, useWindowSize as
|
|
704
|
+
import { Box as Box6, Text as Text6, measureElement as measureElement2, useWindowSize as useWindowSize3 } from "ink";
|
|
721
705
|
import { useCallback, useLayoutEffect, useRef as useRef2, useState as useState3 } from "react";
|
|
722
706
|
import { jsxs as jsxs5 } from "react/jsx-runtime";
|
|
723
707
|
var INDICATOR_ROWS = 2;
|
|
@@ -734,7 +718,7 @@ function useScrollWindow({
|
|
|
734
718
|
followBottom = false
|
|
735
719
|
}) {
|
|
736
720
|
const viewportRef = useRef2(null);
|
|
737
|
-
const { columns } =
|
|
721
|
+
const { columns } = useWindowSize3();
|
|
738
722
|
const [size, setSize] = useState3(
|
|
739
723
|
null
|
|
740
724
|
);
|
|
@@ -875,7 +859,7 @@ function SelectPrompt({
|
|
|
875
859
|
if (multi) hints.push({ key: "[space]", label: "select" });
|
|
876
860
|
hints.push({ key: "[enter]", label: "confirm" });
|
|
877
861
|
const containerRef = useRef3(null);
|
|
878
|
-
const { columns } =
|
|
862
|
+
const { columns } = useWindowSize4();
|
|
879
863
|
const [width, setWidth] = useState4(columns);
|
|
880
864
|
useLayoutEffect2(() => {
|
|
881
865
|
if (!containerRef.current) return;
|
|
@@ -1104,7 +1088,7 @@ function PromptInput() {
|
|
|
1104
1088
|
import { dirname as dirname2, join as join3 } from "node:path";
|
|
1105
1089
|
import { fileURLToPath } from "node:url";
|
|
1106
1090
|
import { useState as useState6 } from "react";
|
|
1107
|
-
import { Box as Box10, Spacer, Text as Text10, useInput as useInput4, useWindowSize as
|
|
1091
|
+
import { Box as Box10, Spacer, Text as Text10, useInput as useInput4, useWindowSize as useWindowSize5 } from "ink";
|
|
1108
1092
|
|
|
1109
1093
|
// src/ui/copy/welcome.ts
|
|
1110
1094
|
var sidebarItems = [
|
|
@@ -1157,7 +1141,7 @@ function SidebarItem({
|
|
|
1157
1141
|
function Welcome() {
|
|
1158
1142
|
const confirmStart = useWizard((s) => s.confirmStart);
|
|
1159
1143
|
const openLearnMore = useWizard((s) => s.openLearnMore);
|
|
1160
|
-
const { rows } =
|
|
1144
|
+
const { rows } = useWindowSize5();
|
|
1161
1145
|
const actions = [
|
|
1162
1146
|
{ label: "start wizard", run: confirmStart },
|
|
1163
1147
|
{ label: "learn more", run: openLearnMore }
|
|
@@ -1250,7 +1234,7 @@ function Welcome() {
|
|
|
1250
1234
|
|
|
1251
1235
|
// src/ui/LearnMore.tsx
|
|
1252
1236
|
import { Fragment as Fragment2 } from "react";
|
|
1253
|
-
import { Box as Box11, Text as Text11, useInput as useInput5, useWindowSize as
|
|
1237
|
+
import { Box as Box11, Text as Text11, useInput as useInput5, useWindowSize as useWindowSize6 } from "ink";
|
|
1254
1238
|
|
|
1255
1239
|
// src/ui/copy/learn-more.ts
|
|
1256
1240
|
var accessIntro = "Everything runs locally on your machine. Nothing is written or sent without an explicit yes from you.";
|
|
@@ -1320,7 +1304,7 @@ function NeverLine({
|
|
|
1320
1304
|
function LearnMore() {
|
|
1321
1305
|
const confirmStart = useWizard((s) => s.confirmStart);
|
|
1322
1306
|
const backToHome = useWizard((s) => s.backToHome);
|
|
1323
|
-
const { columns } =
|
|
1307
|
+
const { columns } = useWindowSize6();
|
|
1324
1308
|
const dividerWidth = Math.max(0, columns - PADDING_X * 2);
|
|
1325
1309
|
useInput5((_input, key) => {
|
|
1326
1310
|
if (key.escape) backToHome();
|
|
@@ -1530,7 +1514,7 @@ function Ribbon() {
|
|
|
1530
1514
|
}
|
|
1531
1515
|
|
|
1532
1516
|
// src/ui/App.tsx
|
|
1533
|
-
import { useState as
|
|
1517
|
+
import { useState as useState8 } from "react";
|
|
1534
1518
|
|
|
1535
1519
|
// src/ui/Logs.tsx
|
|
1536
1520
|
import { Box as Box16, Text as Text16, useInput as useInput6 } from "ink";
|
|
@@ -1780,13 +1764,287 @@ function track(event, payload) {
|
|
|
1780
1764
|
});
|
|
1781
1765
|
}
|
|
1782
1766
|
|
|
1767
|
+
// src/ui/Tips.tsx
|
|
1768
|
+
import { useEffect as useEffect3, useState as useState7 } from "react";
|
|
1769
|
+
import { Box as Box18, Text as Text18 } from "ink";
|
|
1770
|
+
import terminalLink from "terminal-link";
|
|
1771
|
+
|
|
1772
|
+
// src/ui/Code.tsx
|
|
1773
|
+
import { Box as Box17, Text as Text17 } from "ink";
|
|
1774
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1775
|
+
var TOKEN_RE = /("(?:\\.|[^"\\])*"|\btrue\b|\bfalse\b|\bnull\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|[{}[\]:,])/g;
|
|
1776
|
+
function highlightJson(json) {
|
|
1777
|
+
const parts = json.split(TOKEN_RE);
|
|
1778
|
+
return parts.map((part, i) => {
|
|
1779
|
+
if (!part) return null;
|
|
1780
|
+
if (part[0] === '"') {
|
|
1781
|
+
const next = parts.slice(i + 1).find((p) => p.trim());
|
|
1782
|
+
const isKey = next?.trimStart().startsWith(":");
|
|
1783
|
+
return /* @__PURE__ */ jsx15(Text17, { color: isKey ? "cyan" : "green", children: part }, i);
|
|
1784
|
+
}
|
|
1785
|
+
if (part === "true" || part === "false" || part === "null") {
|
|
1786
|
+
return /* @__PURE__ */ jsx15(Text17, { color: "magenta", children: part }, i);
|
|
1787
|
+
}
|
|
1788
|
+
if (/^-?\d/.test(part)) {
|
|
1789
|
+
return /* @__PURE__ */ jsx15(Text17, { color: "yellow", children: part }, i);
|
|
1790
|
+
}
|
|
1791
|
+
if (/^[{}[\]:,]$/.test(part)) {
|
|
1792
|
+
return /* @__PURE__ */ jsx15(Text17, { dimColor: true, children: part }, i);
|
|
1793
|
+
}
|
|
1794
|
+
return /* @__PURE__ */ jsx15(Text17, { children: part }, i);
|
|
1795
|
+
});
|
|
1796
|
+
}
|
|
1797
|
+
function Code({ children }) {
|
|
1798
|
+
return /* @__PURE__ */ jsx15(Box17, { children: /* @__PURE__ */ jsx15(Text17, { children: highlightJson(children) }) });
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
// src/ui/copy/tips.ts
|
|
1802
|
+
var tips = [
|
|
1803
|
+
{
|
|
1804
|
+
title: "An Application is like your library. Indices are the books in it.",
|
|
1805
|
+
chunks: [
|
|
1806
|
+
{
|
|
1807
|
+
type: "text",
|
|
1808
|
+
value: "Applications hold your API keys and Indices."
|
|
1809
|
+
},
|
|
1810
|
+
{
|
|
1811
|
+
type: "text",
|
|
1812
|
+
value: "Each index is a searchable collection of records (think: products, articles, orders, concerts)."
|
|
1813
|
+
}
|
|
1814
|
+
]
|
|
1815
|
+
},
|
|
1816
|
+
{
|
|
1817
|
+
title: "A Record is a JSON object inside of an index.",
|
|
1818
|
+
chunks: [
|
|
1819
|
+
{
|
|
1820
|
+
type: "text",
|
|
1821
|
+
value: "Every object you index is just a JSON document with a unique objectID."
|
|
1822
|
+
},
|
|
1823
|
+
{
|
|
1824
|
+
type: "text",
|
|
1825
|
+
value: "No fixed schema, no hard requirements."
|
|
1826
|
+
},
|
|
1827
|
+
{
|
|
1828
|
+
type: "text",
|
|
1829
|
+
value: "Everything else is up to you:"
|
|
1830
|
+
},
|
|
1831
|
+
{
|
|
1832
|
+
type: "code",
|
|
1833
|
+
value: JSON.stringify(
|
|
1834
|
+
{
|
|
1835
|
+
objectID: "sku_48213",
|
|
1836
|
+
name: "Trail Running Shoe",
|
|
1837
|
+
brand: "Northline",
|
|
1838
|
+
categories: ["Footwear", "Running", "Mens"],
|
|
1839
|
+
price: 129.99,
|
|
1840
|
+
in_stock: true,
|
|
1841
|
+
rating: 4.6
|
|
1842
|
+
},
|
|
1843
|
+
null,
|
|
1844
|
+
2
|
|
1845
|
+
)
|
|
1846
|
+
}
|
|
1847
|
+
]
|
|
1848
|
+
},
|
|
1849
|
+
{
|
|
1850
|
+
title: "Speed isn't a feature, it's our business",
|
|
1851
|
+
chunks: [
|
|
1852
|
+
{
|
|
1853
|
+
type: "text",
|
|
1854
|
+
value: "Algolia's engine processes most search queries in 1 to 50 milliseconds."
|
|
1855
|
+
},
|
|
1856
|
+
{
|
|
1857
|
+
type: "text",
|
|
1858
|
+
value: "This is why our search-as-you-type experience feels instant."
|
|
1859
|
+
}
|
|
1860
|
+
]
|
|
1861
|
+
},
|
|
1862
|
+
{
|
|
1863
|
+
title: "Searchable attributes are your relevance dial #1",
|
|
1864
|
+
chunks: [
|
|
1865
|
+
{
|
|
1866
|
+
type: "text",
|
|
1867
|
+
value: "Order matters. Attributes listed first in"
|
|
1868
|
+
},
|
|
1869
|
+
{ type: "codeword", value: "searchableAttributes" },
|
|
1870
|
+
{ type: "text", value: "carry more ranking weight." },
|
|
1871
|
+
{
|
|
1872
|
+
type: "text",
|
|
1873
|
+
value: "This is the single highest-leverage lever new users don't know exists."
|
|
1874
|
+
}
|
|
1875
|
+
]
|
|
1876
|
+
},
|
|
1877
|
+
{
|
|
1878
|
+
title: "Facets aren't just filters, they help build your UI",
|
|
1879
|
+
chunks: [
|
|
1880
|
+
{ type: "codeword", value: "attributesForFaceting" },
|
|
1881
|
+
{
|
|
1882
|
+
type: "text",
|
|
1883
|
+
value: "unlock category sidebars, price sliders, tag clouds without extra backend work."
|
|
1884
|
+
}
|
|
1885
|
+
]
|
|
1886
|
+
},
|
|
1887
|
+
{
|
|
1888
|
+
title: "Test relevance in the dashboard before you write a line of ranking code",
|
|
1889
|
+
chunks: [
|
|
1890
|
+
{
|
|
1891
|
+
type: "text",
|
|
1892
|
+
value: "Our Search dashboard has a live preview where you can browse results."
|
|
1893
|
+
},
|
|
1894
|
+
{
|
|
1895
|
+
type: "text",
|
|
1896
|
+
value: "Tune your settings and see how it alters your results in"
|
|
1897
|
+
},
|
|
1898
|
+
{
|
|
1899
|
+
type: "link",
|
|
1900
|
+
value: "real-time.",
|
|
1901
|
+
href: "https://dashboard.algolia.com/explorer/browse"
|
|
1902
|
+
}
|
|
1903
|
+
]
|
|
1904
|
+
},
|
|
1905
|
+
{
|
|
1906
|
+
title: "Search Analytics helps you discover opportunities",
|
|
1907
|
+
chunks: [
|
|
1908
|
+
{
|
|
1909
|
+
type: "text",
|
|
1910
|
+
value: "No click results for a particular query? Low click-through rates for another?"
|
|
1911
|
+
},
|
|
1912
|
+
{
|
|
1913
|
+
type: "text",
|
|
1914
|
+
value: "Our Search Analytics will help you identify synonyms, rules or other relevancy settings to improve your results."
|
|
1915
|
+
}
|
|
1916
|
+
]
|
|
1917
|
+
},
|
|
1918
|
+
{
|
|
1919
|
+
title: "Let Algolia act as your recommendation engine",
|
|
1920
|
+
chunks: [
|
|
1921
|
+
{
|
|
1922
|
+
type: "text",
|
|
1923
|
+
value: "Beyond search, Algolia Recommend runs models trained on your existing indices and event data to power your recommendation engine."
|
|
1924
|
+
},
|
|
1925
|
+
{
|
|
1926
|
+
type: "text",
|
|
1927
|
+
value: "You can improve engagement with related, popular or visually similar items."
|
|
1928
|
+
}
|
|
1929
|
+
]
|
|
1930
|
+
}
|
|
1931
|
+
];
|
|
1932
|
+
|
|
1933
|
+
// src/ui/Tips.tsx
|
|
1934
|
+
import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1935
|
+
var TICK_MS = 16;
|
|
1936
|
+
var CHUNK_HOLD_MS = 2e3;
|
|
1937
|
+
var HOLD_MS = 8e3;
|
|
1938
|
+
function TipTitle({ children }) {
|
|
1939
|
+
return /* @__PURE__ */ jsxs16(Box18, { gap: 1, children: [
|
|
1940
|
+
/* @__PURE__ */ jsx16(Text18, { color: "cyan", children: "\u2726" }),
|
|
1941
|
+
/* @__PURE__ */ jsx16(Text18, { color: "white", bold: true, children })
|
|
1942
|
+
] });
|
|
1943
|
+
}
|
|
1944
|
+
function InlineSegment({ segment }) {
|
|
1945
|
+
switch (segment.type) {
|
|
1946
|
+
case "highlight":
|
|
1947
|
+
return /* @__PURE__ */ jsx16(Text18, { color: COLORS.success, children: segment.value });
|
|
1948
|
+
case "link":
|
|
1949
|
+
return /* @__PURE__ */ jsx16(Text18, { color: "cyan", underline: true, children: segment.href ? terminalLink(segment.value, segment.href) : segment.value });
|
|
1950
|
+
case "codeword":
|
|
1951
|
+
return /* @__PURE__ */ jsx16(Text18, { color: COLORS.highlight.fg, backgroundColor: COLORS.highlight.bg, children: segment.value });
|
|
1952
|
+
default:
|
|
1953
|
+
return /* @__PURE__ */ jsx16(Text18, { color: COLORS.muted, children: segment.value });
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
function TipContent({
|
|
1957
|
+
chunks,
|
|
1958
|
+
revealed
|
|
1959
|
+
}) {
|
|
1960
|
+
let remaining = revealed;
|
|
1961
|
+
const slices = chunks.map((chunk) => {
|
|
1962
|
+
const slice = chunk.value.slice(0, Math.max(0, remaining));
|
|
1963
|
+
remaining -= chunk.value.length;
|
|
1964
|
+
return slice;
|
|
1965
|
+
});
|
|
1966
|
+
const blocks = [];
|
|
1967
|
+
for (let i = 0; i < chunks.length; i++) {
|
|
1968
|
+
const chunk = chunks[i];
|
|
1969
|
+
const slice = slices[i];
|
|
1970
|
+
if (!slice) continue;
|
|
1971
|
+
const segment = {
|
|
1972
|
+
type: chunk.type,
|
|
1973
|
+
value: slice,
|
|
1974
|
+
href: chunk.type === "link" ? chunk.href : void 0
|
|
1975
|
+
};
|
|
1976
|
+
if (chunk.type === "code") {
|
|
1977
|
+
blocks.push({ type: "code", segment });
|
|
1978
|
+
continue;
|
|
1979
|
+
}
|
|
1980
|
+
const last = blocks[blocks.length - 1];
|
|
1981
|
+
if (last?.type === "inline") {
|
|
1982
|
+
last.segments.push(segment);
|
|
1983
|
+
} else {
|
|
1984
|
+
blocks.push({ type: "inline", segments: [segment] });
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
return /* @__PURE__ */ jsx16(Box18, { flexDirection: "column", marginLeft: 2, gap: 1, children: blocks.map(
|
|
1988
|
+
(block, i) => block.type === "code" ? /* @__PURE__ */ jsx16(Code, { children: block.segment.value }, i) : /* @__PURE__ */ jsx16(Text18, { children: block.segments.map((segment, j) => /* @__PURE__ */ jsxs16(Text18, { children: [
|
|
1989
|
+
j > 0 && " ",
|
|
1990
|
+
/* @__PURE__ */ jsx16(InlineSegment, { segment })
|
|
1991
|
+
] }, j)) }, i)
|
|
1992
|
+
) });
|
|
1993
|
+
}
|
|
1994
|
+
function Tips() {
|
|
1995
|
+
const [tipIndex, setTipIndex] = useState7(0);
|
|
1996
|
+
const [revealed, setRevealed] = useState7(0);
|
|
1997
|
+
const tip = tips[tipIndex];
|
|
1998
|
+
const contentLength = tip.chunks.reduce((sum, c) => sum + c.value.length, 0);
|
|
1999
|
+
const totalLength = tip.title.length + contentLength;
|
|
2000
|
+
const segments = [
|
|
2001
|
+
{ type: "title", length: tip.title.length },
|
|
2002
|
+
...tip.chunks.map((c) => ({ type: c.type, length: c.value.length }))
|
|
2003
|
+
];
|
|
2004
|
+
const noPauseAfterText = [
|
|
2005
|
+
"highlight",
|
|
2006
|
+
"link",
|
|
2007
|
+
"codeword"
|
|
2008
|
+
];
|
|
2009
|
+
const chunkBoundaries = [];
|
|
2010
|
+
let cumulative = 0;
|
|
2011
|
+
for (let i = 0; i < segments.length - 1; i++) {
|
|
2012
|
+
cumulative += segments[i].length;
|
|
2013
|
+
const skipPause = noPauseAfterText.includes(
|
|
2014
|
+
segments[i + 1].type
|
|
2015
|
+
);
|
|
2016
|
+
if (!skipPause) chunkBoundaries.push(cumulative);
|
|
2017
|
+
}
|
|
2018
|
+
useEffect3(() => {
|
|
2019
|
+
if (revealed < totalLength) {
|
|
2020
|
+
const delay2 = chunkBoundaries.includes(revealed) ? CHUNK_HOLD_MS : TICK_MS;
|
|
2021
|
+
const timer2 = setTimeout(() => setRevealed((r) => r + 1), delay2);
|
|
2022
|
+
return () => clearTimeout(timer2);
|
|
2023
|
+
}
|
|
2024
|
+
const timer = setTimeout(() => {
|
|
2025
|
+
setTipIndex((i) => {
|
|
2026
|
+
if (i < tips.length - 1) return i + 1;
|
|
2027
|
+
return 0;
|
|
2028
|
+
});
|
|
2029
|
+
setRevealed(0);
|
|
2030
|
+
}, HOLD_MS);
|
|
2031
|
+
return () => clearTimeout(timer);
|
|
2032
|
+
}, [revealed, totalLength]);
|
|
2033
|
+
const titleRevealed = tip.title.slice(0, revealed);
|
|
2034
|
+
const contentRevealed = Math.max(0, revealed - tip.title.length);
|
|
2035
|
+
return /* @__PURE__ */ jsxs16(Box18, { flexDirection: "column", marginBottom: 1, gap: 1, children: [
|
|
2036
|
+
/* @__PURE__ */ jsx16(TipTitle, { children: titleRevealed }),
|
|
2037
|
+
/* @__PURE__ */ jsx16(TipContent, { chunks: tip.chunks, revealed: contentRevealed })
|
|
2038
|
+
] });
|
|
2039
|
+
}
|
|
2040
|
+
|
|
1783
2041
|
// src/ui/App.tsx
|
|
1784
|
-
import { jsx as
|
|
2042
|
+
import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1785
2043
|
function App() {
|
|
1786
|
-
const { phase, error, homeScreen, currentStepIndex, steps, inputReq } = useWizard();
|
|
2044
|
+
const { phase, error, homeScreen, currentStepIndex, steps, inputReq, notices } = useWizard();
|
|
1787
2045
|
const { exit } = useApp();
|
|
1788
|
-
const { columns, rows } =
|
|
1789
|
-
const [showLogs, setShowLogs] =
|
|
2046
|
+
const { columns, rows } = useWindowSize7();
|
|
2047
|
+
const [showLogs, setShowLogs] = useState8(false);
|
|
1790
2048
|
const finished = phase === "done" || phase === "error";
|
|
1791
2049
|
const currentStep = steps[currentStepIndex];
|
|
1792
2050
|
useInput7(
|
|
@@ -1828,8 +2086,8 @@ function App() {
|
|
|
1828
2086
|
/* Clamped to exactly the viewport: a taller frame makes Ink clear and repaint
|
|
1829
2087
|
the whole screen, and the scrolling throws off its cursor arithmetic —
|
|
1830
2088
|
flicker and leftover rows. */
|
|
1831
|
-
/* @__PURE__ */
|
|
1832
|
-
|
|
2089
|
+
/* @__PURE__ */ jsxs17(
|
|
2090
|
+
Box19,
|
|
1833
2091
|
{
|
|
1834
2092
|
backgroundColor: COLORS.bg.main,
|
|
1835
2093
|
flexDirection: "row",
|
|
@@ -1837,42 +2095,46 @@ function App() {
|
|
|
1837
2095
|
height: scrollsPastViewport ? void 0 : rows,
|
|
1838
2096
|
overflow: scrollsPastViewport ? "visible" : "hidden",
|
|
1839
2097
|
children: [
|
|
1840
|
-
mainWindowVisible && /* @__PURE__ */
|
|
1841
|
-
|
|
2098
|
+
mainWindowVisible && /* @__PURE__ */ jsxs17(
|
|
2099
|
+
Box19,
|
|
1842
2100
|
{
|
|
1843
2101
|
flexDirection,
|
|
1844
2102
|
width: "100%",
|
|
1845
2103
|
maxHeight: rows,
|
|
1846
2104
|
justifyContent: "space-between",
|
|
1847
2105
|
children: [
|
|
1848
|
-
showLogs ? /* @__PURE__ */
|
|
1849
|
-
|
|
2106
|
+
showLogs ? /* @__PURE__ */ jsx17(Logs, {}) : /* @__PURE__ */ jsxs17(
|
|
2107
|
+
Box19,
|
|
1850
2108
|
{
|
|
1851
2109
|
flexDirection: "column",
|
|
1852
2110
|
paddingX: 4,
|
|
1853
2111
|
paddingY: 2,
|
|
1854
2112
|
width: showSidebar ? 70 : "100%",
|
|
1855
2113
|
flexGrow: 1,
|
|
2114
|
+
gap: 1,
|
|
1856
2115
|
children: [
|
|
1857
|
-
|
|
1858
|
-
/* @__PURE__ */
|
|
1859
|
-
|
|
2116
|
+
/* @__PURE__ */ jsxs17(Box19, { flexGrow: 2, flexDirection: "column", children: [
|
|
2117
|
+
phase === "authenticating" && /* @__PURE__ */ jsxs17(Box19, { flexDirection: "column", marginBottom: 1, children: [
|
|
2118
|
+
/* @__PURE__ */ jsx17(Text19, { color: COLORS.strong, bold: true, children: "Signing in to Algolia" }),
|
|
2119
|
+
/* @__PURE__ */ jsx17(Text19, { color: COLORS.muted, children: "A browser window will open \u2014 complete sign-in there." })
|
|
2120
|
+
] }),
|
|
2121
|
+
/* @__PURE__ */ jsx17(CliOutput, {}),
|
|
2122
|
+
notices.length > 0 && phase === "running" && /* @__PURE__ */ jsx17(Tips, {}),
|
|
2123
|
+
/* @__PURE__ */ jsx17(PromptInput, {}),
|
|
2124
|
+
phase === "error" && error && /* @__PURE__ */ jsx17(Box19, { marginTop: 1, children: /* @__PURE__ */ jsxs17(Text19, { color: COLORS.status.error, children: [
|
|
2125
|
+
"\u2716 ",
|
|
2126
|
+
error
|
|
2127
|
+
] }) })
|
|
1860
2128
|
] }),
|
|
1861
|
-
/* @__PURE__ */
|
|
1862
|
-
/* @__PURE__ */ jsx15(Notices, {}),
|
|
1863
|
-
/* @__PURE__ */ jsx15(PromptInput, {}),
|
|
1864
|
-
phase === "error" && error && /* @__PURE__ */ jsx15(Box17, { marginTop: 1, children: /* @__PURE__ */ jsxs16(Text17, { color: COLORS.status.error, children: [
|
|
1865
|
-
"\u2716 ",
|
|
1866
|
-
error
|
|
1867
|
-
] }) })
|
|
2129
|
+
/* @__PURE__ */ jsx17(Notices, {})
|
|
1868
2130
|
]
|
|
1869
2131
|
}
|
|
1870
2132
|
),
|
|
1871
|
-
showSidebar ? /* @__PURE__ */
|
|
2133
|
+
showSidebar ? /* @__PURE__ */ jsx17(Sidebar, {}) : /* @__PURE__ */ jsx17(Ribbon, {})
|
|
1872
2134
|
]
|
|
1873
2135
|
}
|
|
1874
2136
|
),
|
|
1875
|
-
phase === "idle" && (homeScreen === "learnMore" ? /* @__PURE__ */
|
|
2137
|
+
phase === "idle" && (homeScreen === "learnMore" ? /* @__PURE__ */ jsx17(LearnMore, {}) : /* @__PURE__ */ jsx17(Welcome, {}))
|
|
1876
2138
|
]
|
|
1877
2139
|
}
|
|
1878
2140
|
)
|
|
@@ -3426,10 +3688,10 @@ import { tool as tool11 } from "ai";
|
|
|
3426
3688
|
import z18 from "zod";
|
|
3427
3689
|
function notifyUserTool() {
|
|
3428
3690
|
return tool11({
|
|
3429
|
-
description: `Give the user a brief, high-level update on what you are currently doing or about to do next. This is for the big picture (e.g. "Reading through your data models", "Writing the search UI") \u2014 not granular detail like individual tool calls, which are already logged separately. Call it when you start a new phase of work or your focus shifts, just not on every step, enough to keep the user engaged. Don't say things like "starting", just describe what you are doing. Don't mention tool calls themselves, just general direction of the work.`,
|
|
3691
|
+
description: `Give the user a brief, high-level update on what you are currently doing or about to do next. This is for the big picture (e.g. "Reading through your data models", "Writing the search UI") \u2014 not granular detail like individual tool calls, which are already logged separately. Call it when you start a new phase of work or your focus shifts, just not on every step, enough to keep the user engaged. Don't say things like "starting", just describe what you are doing. Don't mention tool calls themselves, just general direction of the work. Only the latest update is shown on screen, in one line, so keep it under 140 characters.`,
|
|
3430
3692
|
inputSchema: z18.object({
|
|
3431
|
-
message: z18.string().describe(
|
|
3432
|
-
"Short, plain-language description of what you are doing now."
|
|
3693
|
+
message: z18.string().max(140).describe(
|
|
3694
|
+
"Short, plain-language description of what you are doing now. Under 140 characters \u2014 only the latest update is shown, on one line."
|
|
3433
3695
|
)
|
|
3434
3696
|
}),
|
|
3435
3697
|
execute: async ({ message }) => {
|
|
@@ -3705,7 +3967,7 @@ async function runAnalysis(mode, extraInstructions = []) {
|
|
|
3705
3967
|
// package.json
|
|
3706
3968
|
var package_default = {
|
|
3707
3969
|
name: "@algolia/wizard",
|
|
3708
|
-
version: "0.24.0-rc.
|
|
3970
|
+
version: "0.24.0-rc.117.212",
|
|
3709
3971
|
description: "Magically implement Algolia functionality in your codebase",
|
|
3710
3972
|
type: "module",
|
|
3711
3973
|
engines: {
|
|
@@ -3767,6 +4029,7 @@ var package_default = {
|
|
|
3767
4029
|
nanoid: "^5.1.15",
|
|
3768
4030
|
pino: "^10.3.1",
|
|
3769
4031
|
react: "^19.2.7",
|
|
4032
|
+
"terminal-link": "^5.0.0",
|
|
3770
4033
|
varlock: "^1.5.1",
|
|
3771
4034
|
zod: "^4.4.3",
|
|
3772
4035
|
zustand: "^5.0.14"
|
|
@@ -5318,7 +5581,7 @@ function delay(ms) {
|
|
|
5318
5581
|
}
|
|
5319
5582
|
|
|
5320
5583
|
// src/main.tsx
|
|
5321
|
-
import { jsx as
|
|
5584
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
5322
5585
|
async function startup() {
|
|
5323
5586
|
setProjectRoot(process.cwd());
|
|
5324
5587
|
let args;
|
|
@@ -5368,7 +5631,7 @@ ${formatStepList(workflow)}`);
|
|
|
5368
5631
|
}
|
|
5369
5632
|
async function run(workflow) {
|
|
5370
5633
|
const store = useWizard.getState();
|
|
5371
|
-
const instance = render(/* @__PURE__ */
|
|
5634
|
+
const instance = render(/* @__PURE__ */ jsx18(App, {}), { incrementalRendering: true });
|
|
5372
5635
|
await store.waitForStart();
|
|
5373
5636
|
let user = await getUser();
|
|
5374
5637
|
if (!user) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@algolia/wizard",
|
|
3
|
-
"version": "0.24.0-rc.
|
|
3
|
+
"version": "0.24.0-rc.117.212",
|
|
4
4
|
"description": "Magically implement Algolia functionality in your codebase",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"nanoid": "^5.1.15",
|
|
63
63
|
"pino": "^10.3.1",
|
|
64
64
|
"react": "^19.2.7",
|
|
65
|
+
"terminal-link": "^5.0.0",
|
|
65
66
|
"varlock": "^1.5.1",
|
|
66
67
|
"zod": "^4.4.3",
|
|
67
68
|
"zustand": "^5.0.14"
|