@algolia/wizard 0.24.0-rc.111.205 → 0.24.0-rc.117.213
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 +364 -90
- 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(
|
|
@@ -592,10 +567,13 @@ function parseHex(hex) {
|
|
|
592
567
|
b: parseInt(n.slice(4, 6), 16)
|
|
593
568
|
};
|
|
594
569
|
}
|
|
595
|
-
function Notices(
|
|
570
|
+
function Notices({
|
|
571
|
+
showAll = false,
|
|
572
|
+
border = true
|
|
573
|
+
} = {}) {
|
|
596
574
|
const notices = useWizard((s) => s.notices);
|
|
597
|
-
const
|
|
598
|
-
const visible =
|
|
575
|
+
const latest = notices[notices.length - 1];
|
|
576
|
+
const visible = showAll ? notices : latest ? [latest] : [];
|
|
599
577
|
const [pulseStep, setPulseStep] = useState2(0);
|
|
600
578
|
useEffect2(() => {
|
|
601
579
|
let direction = 1;
|
|
@@ -609,30 +587,41 @@ function Notices() {
|
|
|
609
587
|
}, PULSE_STEP_MS);
|
|
610
588
|
return () => clearInterval(id);
|
|
611
589
|
}, []);
|
|
612
|
-
if (
|
|
590
|
+
if (visible.length === 0) return null;
|
|
613
591
|
const pulseColor = PULSE_COLORS[pulseStep];
|
|
614
|
-
return /* @__PURE__ */ jsx2(
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
592
|
+
return /* @__PURE__ */ jsx2(
|
|
593
|
+
Box3,
|
|
594
|
+
{
|
|
595
|
+
borderColor: border ? COLORS.border : void 0,
|
|
596
|
+
borderStyle: border ? "single" : void 0,
|
|
597
|
+
borderBackgroundColor: COLORS.bg.main,
|
|
598
|
+
borderLeft: false,
|
|
599
|
+
borderRight: false,
|
|
600
|
+
borderBottom: false,
|
|
601
|
+
paddingTop: border ? 1 : 0,
|
|
602
|
+
flexDirection: "column",
|
|
603
|
+
gap: 1,
|
|
604
|
+
children: visible.map((notice, i) => /* @__PURE__ */ jsxs2(Box3, { flexDirection: "column", children: [
|
|
605
|
+
notice.messages?.map((m, j) => {
|
|
606
|
+
const line = typeof m === "string" ? { text: m } : m;
|
|
607
|
+
const prefix = j === 0 ? `${AGENT_MARKER} ` : " ";
|
|
608
|
+
return /* @__PURE__ */ jsxs2(
|
|
609
|
+
Text3,
|
|
610
|
+
{
|
|
611
|
+
color: !line.color ? notice === latest ? pulseColor : COLORS.dim : line.color ?? COLORS.dim,
|
|
612
|
+
bold: line.bold,
|
|
613
|
+
children: [
|
|
614
|
+
prefix,
|
|
615
|
+
line.text
|
|
616
|
+
]
|
|
617
|
+
},
|
|
618
|
+
`notice-line-${j}`
|
|
619
|
+
);
|
|
620
|
+
}),
|
|
621
|
+
notice.table && /* @__PURE__ */ jsx2(Table, { columns: notice.table.columns, rows: notice.table.rows })
|
|
622
|
+
] }, `notice-${i}`))
|
|
623
|
+
}
|
|
624
|
+
);
|
|
636
625
|
}
|
|
637
626
|
|
|
638
627
|
// src/ui/PromptInput.tsx
|
|
@@ -713,11 +702,11 @@ function CommandApproval({
|
|
|
713
702
|
}
|
|
714
703
|
|
|
715
704
|
// src/ui/SelectPrompt.tsx
|
|
716
|
-
import { Box as Box8, Text as Text8, useInput as useInput2, useWindowSize as
|
|
705
|
+
import { Box as Box8, Text as Text8, useInput as useInput2, useWindowSize as useWindowSize4 } from "ink";
|
|
717
706
|
import { useLayoutEffect as useLayoutEffect2, useRef as useRef3, useState as useState4 } from "react";
|
|
718
707
|
|
|
719
708
|
// src/ui/ScrollView.tsx
|
|
720
|
-
import { Box as Box6, Text as Text6, measureElement as measureElement2, useWindowSize as
|
|
709
|
+
import { Box as Box6, Text as Text6, measureElement as measureElement2, useWindowSize as useWindowSize3 } from "ink";
|
|
721
710
|
import { useCallback, useLayoutEffect, useRef as useRef2, useState as useState3 } from "react";
|
|
722
711
|
import { jsxs as jsxs5 } from "react/jsx-runtime";
|
|
723
712
|
var INDICATOR_ROWS = 2;
|
|
@@ -734,7 +723,7 @@ function useScrollWindow({
|
|
|
734
723
|
followBottom = false
|
|
735
724
|
}) {
|
|
736
725
|
const viewportRef = useRef2(null);
|
|
737
|
-
const { columns } =
|
|
726
|
+
const { columns } = useWindowSize3();
|
|
738
727
|
const [size, setSize] = useState3(
|
|
739
728
|
null
|
|
740
729
|
);
|
|
@@ -875,7 +864,7 @@ function SelectPrompt({
|
|
|
875
864
|
if (multi) hints.push({ key: "[space]", label: "select" });
|
|
876
865
|
hints.push({ key: "[enter]", label: "confirm" });
|
|
877
866
|
const containerRef = useRef3(null);
|
|
878
|
-
const { columns } =
|
|
867
|
+
const { columns } = useWindowSize4();
|
|
879
868
|
const [width, setWidth] = useState4(columns);
|
|
880
869
|
useLayoutEffect2(() => {
|
|
881
870
|
if (!containerRef.current) return;
|
|
@@ -1104,7 +1093,7 @@ function PromptInput() {
|
|
|
1104
1093
|
import { dirname as dirname2, join as join3 } from "node:path";
|
|
1105
1094
|
import { fileURLToPath } from "node:url";
|
|
1106
1095
|
import { useState as useState6 } from "react";
|
|
1107
|
-
import { Box as Box10, Spacer, Text as Text10, useInput as useInput4, useWindowSize as
|
|
1096
|
+
import { Box as Box10, Spacer, Text as Text10, useInput as useInput4, useWindowSize as useWindowSize5 } from "ink";
|
|
1108
1097
|
|
|
1109
1098
|
// src/ui/copy/welcome.ts
|
|
1110
1099
|
var sidebarItems = [
|
|
@@ -1157,7 +1146,7 @@ function SidebarItem({
|
|
|
1157
1146
|
function Welcome() {
|
|
1158
1147
|
const confirmStart = useWizard((s) => s.confirmStart);
|
|
1159
1148
|
const openLearnMore = useWizard((s) => s.openLearnMore);
|
|
1160
|
-
const { rows } =
|
|
1149
|
+
const { rows } = useWindowSize5();
|
|
1161
1150
|
const actions = [
|
|
1162
1151
|
{ label: "start wizard", run: confirmStart },
|
|
1163
1152
|
{ label: "learn more", run: openLearnMore }
|
|
@@ -1250,7 +1239,7 @@ function Welcome() {
|
|
|
1250
1239
|
|
|
1251
1240
|
// src/ui/LearnMore.tsx
|
|
1252
1241
|
import { Fragment as Fragment2 } from "react";
|
|
1253
|
-
import { Box as Box11, Text as Text11, useInput as useInput5, useWindowSize as
|
|
1242
|
+
import { Box as Box11, Text as Text11, useInput as useInput5, useWindowSize as useWindowSize6 } from "ink";
|
|
1254
1243
|
|
|
1255
1244
|
// src/ui/copy/learn-more.ts
|
|
1256
1245
|
var accessIntro = "Everything runs locally on your machine. Nothing is written or sent without an explicit yes from you.";
|
|
@@ -1320,7 +1309,7 @@ function NeverLine({
|
|
|
1320
1309
|
function LearnMore() {
|
|
1321
1310
|
const confirmStart = useWizard((s) => s.confirmStart);
|
|
1322
1311
|
const backToHome = useWizard((s) => s.backToHome);
|
|
1323
|
-
const { columns } =
|
|
1312
|
+
const { columns } = useWindowSize6();
|
|
1324
1313
|
const dividerWidth = Math.max(0, columns - PADDING_X * 2);
|
|
1325
1314
|
useInput5((_input, key) => {
|
|
1326
1315
|
if (key.escape) backToHome();
|
|
@@ -1530,7 +1519,7 @@ function Ribbon() {
|
|
|
1530
1519
|
}
|
|
1531
1520
|
|
|
1532
1521
|
// src/ui/App.tsx
|
|
1533
|
-
import { useState as
|
|
1522
|
+
import { useState as useState8 } from "react";
|
|
1534
1523
|
|
|
1535
1524
|
// src/ui/Logs.tsx
|
|
1536
1525
|
import { Box as Box16, Text as Text16, useInput as useInput6 } from "ink";
|
|
@@ -1780,15 +1769,294 @@ function track(event, payload) {
|
|
|
1780
1769
|
});
|
|
1781
1770
|
}
|
|
1782
1771
|
|
|
1772
|
+
// src/ui/Tips.tsx
|
|
1773
|
+
import { useEffect as useEffect3, useState as useState7 } from "react";
|
|
1774
|
+
import { Box as Box18, Text as Text18 } from "ink";
|
|
1775
|
+
import terminalLink from "terminal-link";
|
|
1776
|
+
|
|
1777
|
+
// src/ui/Code.tsx
|
|
1778
|
+
import { Box as Box17, Text as Text17 } from "ink";
|
|
1779
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1780
|
+
var TOKEN_RE = /("(?:\\.|[^"\\])*"|\btrue\b|\bfalse\b|\bnull\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|[{}[\]:,])/g;
|
|
1781
|
+
function highlightJson(json) {
|
|
1782
|
+
const parts = json.split(TOKEN_RE);
|
|
1783
|
+
return parts.map((part, i) => {
|
|
1784
|
+
if (!part) return null;
|
|
1785
|
+
if (part[0] === '"') {
|
|
1786
|
+
const next = parts.slice(i + 1).find((p) => p.trim());
|
|
1787
|
+
const isKey = next?.trimStart().startsWith(":");
|
|
1788
|
+
return /* @__PURE__ */ jsx15(Text17, { color: isKey ? "cyan" : "green", children: part }, i);
|
|
1789
|
+
}
|
|
1790
|
+
if (part === "true" || part === "false" || part === "null") {
|
|
1791
|
+
return /* @__PURE__ */ jsx15(Text17, { color: "magenta", children: part }, i);
|
|
1792
|
+
}
|
|
1793
|
+
if (/^-?\d/.test(part)) {
|
|
1794
|
+
return /* @__PURE__ */ jsx15(Text17, { color: "yellow", children: part }, i);
|
|
1795
|
+
}
|
|
1796
|
+
if (/^[{}[\]:,]$/.test(part)) {
|
|
1797
|
+
return /* @__PURE__ */ jsx15(Text17, { dimColor: true, children: part }, i);
|
|
1798
|
+
}
|
|
1799
|
+
return /* @__PURE__ */ jsx15(Text17, { children: part }, i);
|
|
1800
|
+
});
|
|
1801
|
+
}
|
|
1802
|
+
function Code({ children }) {
|
|
1803
|
+
return /* @__PURE__ */ jsx15(Box17, { children: /* @__PURE__ */ jsx15(Text17, { children: highlightJson(children) }) });
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
// src/ui/copy/tips.ts
|
|
1807
|
+
var tips = [
|
|
1808
|
+
{
|
|
1809
|
+
title: "An Application is like your library. Indices are the books in it.",
|
|
1810
|
+
chunks: [
|
|
1811
|
+
{
|
|
1812
|
+
type: "text",
|
|
1813
|
+
value: "Applications hold your API keys and Indices."
|
|
1814
|
+
},
|
|
1815
|
+
{
|
|
1816
|
+
type: "text",
|
|
1817
|
+
value: "Each index is a searchable collection of records (think: products, articles, orders, concerts)."
|
|
1818
|
+
}
|
|
1819
|
+
]
|
|
1820
|
+
},
|
|
1821
|
+
{
|
|
1822
|
+
title: "A Record is a JSON object inside of an index.",
|
|
1823
|
+
chunks: [
|
|
1824
|
+
{
|
|
1825
|
+
type: "text",
|
|
1826
|
+
value: "Every object you index is just a JSON document with a unique objectID."
|
|
1827
|
+
},
|
|
1828
|
+
{
|
|
1829
|
+
type: "text",
|
|
1830
|
+
value: "No fixed schema, no hard requirements."
|
|
1831
|
+
},
|
|
1832
|
+
{
|
|
1833
|
+
type: "text",
|
|
1834
|
+
value: "Everything else is up to you:"
|
|
1835
|
+
},
|
|
1836
|
+
{
|
|
1837
|
+
type: "code",
|
|
1838
|
+
value: JSON.stringify(
|
|
1839
|
+
{
|
|
1840
|
+
objectID: "sku_48213",
|
|
1841
|
+
name: "Trail Running Shoe",
|
|
1842
|
+
brand: "Northline",
|
|
1843
|
+
categories: ["Footwear", "Running", "Mens"],
|
|
1844
|
+
price: 129.99,
|
|
1845
|
+
in_stock: true,
|
|
1846
|
+
rating: 4.6
|
|
1847
|
+
},
|
|
1848
|
+
null,
|
|
1849
|
+
2
|
|
1850
|
+
)
|
|
1851
|
+
}
|
|
1852
|
+
]
|
|
1853
|
+
},
|
|
1854
|
+
{
|
|
1855
|
+
title: "Speed isn't a feature, it's our business",
|
|
1856
|
+
chunks: [
|
|
1857
|
+
{
|
|
1858
|
+
type: "text",
|
|
1859
|
+
value: "Algolia's engine processes most search queries in 1 to 50 milliseconds."
|
|
1860
|
+
},
|
|
1861
|
+
{
|
|
1862
|
+
type: "text",
|
|
1863
|
+
value: "This is why our search-as-you-type experience feels instant."
|
|
1864
|
+
}
|
|
1865
|
+
]
|
|
1866
|
+
},
|
|
1867
|
+
{
|
|
1868
|
+
title: "Searchable attributes are your relevance dial #1",
|
|
1869
|
+
chunks: [
|
|
1870
|
+
{
|
|
1871
|
+
type: "text",
|
|
1872
|
+
value: "Order matters. Attributes listed first in"
|
|
1873
|
+
},
|
|
1874
|
+
{ type: "codeword", value: "searchableAttributes" },
|
|
1875
|
+
{ type: "text", value: "carry more ranking weight." },
|
|
1876
|
+
{
|
|
1877
|
+
type: "text",
|
|
1878
|
+
value: "This is the single highest-leverage lever new users don't know exists."
|
|
1879
|
+
}
|
|
1880
|
+
]
|
|
1881
|
+
},
|
|
1882
|
+
{
|
|
1883
|
+
title: "Facets aren't just filters, they help build your UI",
|
|
1884
|
+
chunks: [
|
|
1885
|
+
{ type: "codeword", value: "attributesForFaceting" },
|
|
1886
|
+
{
|
|
1887
|
+
type: "text",
|
|
1888
|
+
value: "unlock category sidebars, price sliders, tag clouds without extra backend work."
|
|
1889
|
+
}
|
|
1890
|
+
]
|
|
1891
|
+
},
|
|
1892
|
+
{
|
|
1893
|
+
title: "Test relevance in the dashboard before you write a line of ranking code",
|
|
1894
|
+
chunks: [
|
|
1895
|
+
{
|
|
1896
|
+
type: "text",
|
|
1897
|
+
value: "Our Search dashboard has a live preview where you can browse results."
|
|
1898
|
+
},
|
|
1899
|
+
{
|
|
1900
|
+
type: "text",
|
|
1901
|
+
value: "Tune your settings and see how it alters your results in"
|
|
1902
|
+
},
|
|
1903
|
+
{
|
|
1904
|
+
type: "link",
|
|
1905
|
+
value: "real-time.",
|
|
1906
|
+
href: "https://dashboard.algolia.com/explorer/browse"
|
|
1907
|
+
}
|
|
1908
|
+
]
|
|
1909
|
+
},
|
|
1910
|
+
{
|
|
1911
|
+
title: "Search Analytics helps you discover opportunities",
|
|
1912
|
+
chunks: [
|
|
1913
|
+
{
|
|
1914
|
+
type: "text",
|
|
1915
|
+
value: "No click results for a particular query? Low click-through rates for another?"
|
|
1916
|
+
},
|
|
1917
|
+
{
|
|
1918
|
+
type: "text",
|
|
1919
|
+
value: "Our Search Analytics will help you identify synonyms, rules or other relevancy settings to improve your results."
|
|
1920
|
+
}
|
|
1921
|
+
]
|
|
1922
|
+
},
|
|
1923
|
+
{
|
|
1924
|
+
title: "Let Algolia act as your recommendation engine",
|
|
1925
|
+
chunks: [
|
|
1926
|
+
{
|
|
1927
|
+
type: "text",
|
|
1928
|
+
value: "Beyond search, Algolia Recommend runs models trained on your existing indices and event data to power your recommendation engine."
|
|
1929
|
+
},
|
|
1930
|
+
{
|
|
1931
|
+
type: "text",
|
|
1932
|
+
value: "You can improve engagement with related, popular or visually similar items."
|
|
1933
|
+
}
|
|
1934
|
+
]
|
|
1935
|
+
}
|
|
1936
|
+
];
|
|
1937
|
+
|
|
1938
|
+
// src/ui/Tips.tsx
|
|
1939
|
+
import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1940
|
+
var TICK_MS = 16;
|
|
1941
|
+
var CHUNK_HOLD_MS = 2e3;
|
|
1942
|
+
var HOLD_MS = 8e3;
|
|
1943
|
+
function TipTitle({ children }) {
|
|
1944
|
+
return /* @__PURE__ */ jsxs16(Box18, { gap: 1, children: [
|
|
1945
|
+
/* @__PURE__ */ jsx16(Text18, { color: "cyan", children: "\u2726" }),
|
|
1946
|
+
/* @__PURE__ */ jsx16(Text18, { color: "white", bold: true, children })
|
|
1947
|
+
] });
|
|
1948
|
+
}
|
|
1949
|
+
function InlineSegment({ segment }) {
|
|
1950
|
+
switch (segment.type) {
|
|
1951
|
+
case "highlight":
|
|
1952
|
+
return /* @__PURE__ */ jsx16(Text18, { color: COLORS.success, children: segment.value });
|
|
1953
|
+
case "link":
|
|
1954
|
+
return /* @__PURE__ */ jsx16(Text18, { color: "cyan", underline: true, children: segment.href ? terminalLink(segment.value, segment.href) : segment.value });
|
|
1955
|
+
case "codeword":
|
|
1956
|
+
return /* @__PURE__ */ jsx16(Text18, { color: COLORS.highlight.fg, backgroundColor: COLORS.highlight.bg, children: segment.value });
|
|
1957
|
+
default:
|
|
1958
|
+
return /* @__PURE__ */ jsx16(Text18, { color: COLORS.muted, children: segment.value });
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
function TipContent({
|
|
1962
|
+
chunks,
|
|
1963
|
+
revealed
|
|
1964
|
+
}) {
|
|
1965
|
+
let remaining = revealed;
|
|
1966
|
+
const slices = chunks.map((chunk) => {
|
|
1967
|
+
const slice = chunk.value.slice(0, Math.max(0, remaining));
|
|
1968
|
+
remaining -= chunk.value.length;
|
|
1969
|
+
return slice;
|
|
1970
|
+
});
|
|
1971
|
+
const blocks = [];
|
|
1972
|
+
for (let i = 0; i < chunks.length; i++) {
|
|
1973
|
+
const chunk = chunks[i];
|
|
1974
|
+
const slice = slices[i];
|
|
1975
|
+
if (!slice) continue;
|
|
1976
|
+
const segment = {
|
|
1977
|
+
type: chunk.type,
|
|
1978
|
+
value: slice,
|
|
1979
|
+
href: chunk.type === "link" ? chunk.href : void 0
|
|
1980
|
+
};
|
|
1981
|
+
if (chunk.type === "code") {
|
|
1982
|
+
blocks.push({ type: "code", segment });
|
|
1983
|
+
continue;
|
|
1984
|
+
}
|
|
1985
|
+
const last = blocks[blocks.length - 1];
|
|
1986
|
+
if (last?.type === "inline") {
|
|
1987
|
+
last.segments.push(segment);
|
|
1988
|
+
} else {
|
|
1989
|
+
blocks.push({ type: "inline", segments: [segment] });
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
return /* @__PURE__ */ jsx16(Box18, { flexDirection: "column", marginLeft: 2, gap: 1, children: blocks.map(
|
|
1993
|
+
(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: [
|
|
1994
|
+
j > 0 && " ",
|
|
1995
|
+
/* @__PURE__ */ jsx16(InlineSegment, { segment })
|
|
1996
|
+
] }, j)) }, i)
|
|
1997
|
+
) });
|
|
1998
|
+
}
|
|
1999
|
+
function Tips() {
|
|
2000
|
+
const [tipIndex, setTipIndex] = useState7(0);
|
|
2001
|
+
const [revealed, setRevealed] = useState7(0);
|
|
2002
|
+
const tip = tips[tipIndex];
|
|
2003
|
+
const contentLength = tip.chunks.reduce((sum, c) => sum + c.value.length, 0);
|
|
2004
|
+
const totalLength = tip.title.length + contentLength;
|
|
2005
|
+
const segments = [
|
|
2006
|
+
{ type: "title", length: tip.title.length },
|
|
2007
|
+
...tip.chunks.map((c) => ({ type: c.type, length: c.value.length }))
|
|
2008
|
+
];
|
|
2009
|
+
const noPauseAfterText = [
|
|
2010
|
+
"highlight",
|
|
2011
|
+
"link",
|
|
2012
|
+
"codeword"
|
|
2013
|
+
];
|
|
2014
|
+
const chunkBoundaries = [];
|
|
2015
|
+
let cumulative = 0;
|
|
2016
|
+
for (let i = 0; i < segments.length - 1; i++) {
|
|
2017
|
+
cumulative += segments[i].length;
|
|
2018
|
+
const skipPause = noPauseAfterText.includes(
|
|
2019
|
+
segments[i + 1].type
|
|
2020
|
+
);
|
|
2021
|
+
if (!skipPause) chunkBoundaries.push(cumulative);
|
|
2022
|
+
}
|
|
2023
|
+
useEffect3(() => {
|
|
2024
|
+
if (revealed < totalLength) {
|
|
2025
|
+
const delay2 = chunkBoundaries.includes(revealed) ? CHUNK_HOLD_MS : TICK_MS;
|
|
2026
|
+
const timer2 = setTimeout(() => setRevealed((r) => r + 1), delay2);
|
|
2027
|
+
return () => clearTimeout(timer2);
|
|
2028
|
+
}
|
|
2029
|
+
const timer = setTimeout(() => {
|
|
2030
|
+
setTipIndex((i) => {
|
|
2031
|
+
if (i < tips.length - 1) return i + 1;
|
|
2032
|
+
return 0;
|
|
2033
|
+
});
|
|
2034
|
+
setRevealed(0);
|
|
2035
|
+
}, HOLD_MS);
|
|
2036
|
+
return () => clearTimeout(timer);
|
|
2037
|
+
}, [revealed, totalLength]);
|
|
2038
|
+
const titleRevealed = tip.title.slice(0, revealed);
|
|
2039
|
+
const contentRevealed = Math.max(0, revealed - tip.title.length);
|
|
2040
|
+
return /* @__PURE__ */ jsxs16(Box18, { flexDirection: "column", marginBottom: 1, gap: 1, children: [
|
|
2041
|
+
/* @__PURE__ */ jsx16(TipTitle, { children: titleRevealed }),
|
|
2042
|
+
/* @__PURE__ */ jsx16(TipContent, { chunks: tip.chunks, revealed: contentRevealed })
|
|
2043
|
+
] });
|
|
2044
|
+
}
|
|
2045
|
+
|
|
1783
2046
|
// src/ui/App.tsx
|
|
1784
|
-
import { jsx as
|
|
2047
|
+
import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1785
2048
|
function App() {
|
|
1786
|
-
const { phase, error, homeScreen, currentStepIndex, steps, inputReq } = useWizard();
|
|
2049
|
+
const { phase, error, homeScreen, currentStepIndex, steps, inputReq, notices } = useWizard();
|
|
1787
2050
|
const { exit } = useApp();
|
|
1788
|
-
const { columns, rows } =
|
|
1789
|
-
const [showLogs, setShowLogs] =
|
|
2051
|
+
const { columns, rows } = useWindowSize7();
|
|
2052
|
+
const [showLogs, setShowLogs] = useState8(false);
|
|
1790
2053
|
const finished = phase === "done" || phase === "error";
|
|
1791
2054
|
const currentStep = steps[currentStepIndex];
|
|
2055
|
+
const isInitialAnalysisStep = currentStepIndex === 0;
|
|
2056
|
+
const isAwaitingUserInput = phase === "awaitingInput" && !!inputReq;
|
|
2057
|
+
const showTips = phase === "running" && isInitialAnalysisStep && notices.length > 0;
|
|
2058
|
+
const showNoticesInMain = !isInitialAnalysisStep;
|
|
2059
|
+
const showNotices = !isAwaitingUserInput;
|
|
1792
2060
|
useInput7(
|
|
1793
2061
|
(_input, key) => {
|
|
1794
2062
|
if (key.return) {
|
|
@@ -1828,8 +2096,8 @@ function App() {
|
|
|
1828
2096
|
/* Clamped to exactly the viewport: a taller frame makes Ink clear and repaint
|
|
1829
2097
|
the whole screen, and the scrolling throws off its cursor arithmetic —
|
|
1830
2098
|
flicker and leftover rows. */
|
|
1831
|
-
/* @__PURE__ */
|
|
1832
|
-
|
|
2099
|
+
/* @__PURE__ */ jsxs17(
|
|
2100
|
+
Box19,
|
|
1833
2101
|
{
|
|
1834
2102
|
backgroundColor: COLORS.bg.main,
|
|
1835
2103
|
flexDirection: "row",
|
|
@@ -1837,42 +2105,47 @@ function App() {
|
|
|
1837
2105
|
height: scrollsPastViewport ? void 0 : rows,
|
|
1838
2106
|
overflow: scrollsPastViewport ? "visible" : "hidden",
|
|
1839
2107
|
children: [
|
|
1840
|
-
mainWindowVisible && /* @__PURE__ */
|
|
1841
|
-
|
|
2108
|
+
mainWindowVisible && /* @__PURE__ */ jsxs17(
|
|
2109
|
+
Box19,
|
|
1842
2110
|
{
|
|
1843
2111
|
flexDirection,
|
|
1844
2112
|
width: "100%",
|
|
1845
2113
|
maxHeight: rows,
|
|
1846
2114
|
justifyContent: "space-between",
|
|
1847
2115
|
children: [
|
|
1848
|
-
showLogs ? /* @__PURE__ */
|
|
1849
|
-
|
|
2116
|
+
showLogs ? /* @__PURE__ */ jsx17(Logs, {}) : /* @__PURE__ */ jsxs17(
|
|
2117
|
+
Box19,
|
|
1850
2118
|
{
|
|
1851
2119
|
flexDirection: "column",
|
|
1852
2120
|
paddingX: 4,
|
|
1853
2121
|
paddingY: 2,
|
|
1854
2122
|
width: showSidebar ? 70 : "100%",
|
|
1855
2123
|
flexGrow: 1,
|
|
2124
|
+
gap: 1,
|
|
1856
2125
|
children: [
|
|
1857
|
-
|
|
1858
|
-
/* @__PURE__ */
|
|
1859
|
-
|
|
2126
|
+
/* @__PURE__ */ jsxs17(Box19, { flexGrow: 2, flexDirection: "column", children: [
|
|
2127
|
+
phase === "authenticating" && /* @__PURE__ */ jsxs17(Box19, { flexDirection: "column", marginBottom: 1, children: [
|
|
2128
|
+
/* @__PURE__ */ jsx17(Text19, { color: COLORS.strong, bold: true, children: "Signing in to Algolia" }),
|
|
2129
|
+
/* @__PURE__ */ jsx17(Text19, { color: COLORS.muted, children: "A browser window will open \u2014 complete sign-in there." })
|
|
2130
|
+
] }),
|
|
2131
|
+
/* @__PURE__ */ jsx17(CliOutput, {}),
|
|
2132
|
+
showTips && /* @__PURE__ */ jsx17(Tips, {}),
|
|
2133
|
+
showNoticesInMain && showNotices && /* @__PURE__ */ jsx17(Notices, { showAll: true, border: false }),
|
|
2134
|
+
/* @__PURE__ */ jsx17(PromptInput, {}),
|
|
2135
|
+
phase === "error" && error && /* @__PURE__ */ jsx17(Box19, { marginTop: 1, children: /* @__PURE__ */ jsxs17(Text19, { color: COLORS.status.error, children: [
|
|
2136
|
+
"\u2716 ",
|
|
2137
|
+
error
|
|
2138
|
+
] }) })
|
|
1860
2139
|
] }),
|
|
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
|
-
] }) })
|
|
2140
|
+
!showNoticesInMain && showNotices && /* @__PURE__ */ jsx17(Notices, {})
|
|
1868
2141
|
]
|
|
1869
2142
|
}
|
|
1870
2143
|
),
|
|
1871
|
-
showSidebar ? /* @__PURE__ */
|
|
2144
|
+
showSidebar ? /* @__PURE__ */ jsx17(Sidebar, {}) : /* @__PURE__ */ jsx17(Ribbon, {})
|
|
1872
2145
|
]
|
|
1873
2146
|
}
|
|
1874
2147
|
),
|
|
1875
|
-
phase === "idle" && (homeScreen === "learnMore" ? /* @__PURE__ */
|
|
2148
|
+
phase === "idle" && (homeScreen === "learnMore" ? /* @__PURE__ */ jsx17(LearnMore, {}) : /* @__PURE__ */ jsx17(Welcome, {}))
|
|
1876
2149
|
]
|
|
1877
2150
|
}
|
|
1878
2151
|
)
|
|
@@ -3426,10 +3699,10 @@ import { tool as tool11 } from "ai";
|
|
|
3426
3699
|
import z18 from "zod";
|
|
3427
3700
|
function notifyUserTool() {
|
|
3428
3701
|
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.`,
|
|
3702
|
+
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
3703
|
inputSchema: z18.object({
|
|
3431
|
-
message: z18.string().describe(
|
|
3432
|
-
"Short, plain-language description of what you are doing now."
|
|
3704
|
+
message: z18.string().max(140).describe(
|
|
3705
|
+
"Short, plain-language description of what you are doing now. Under 140 characters \u2014 only the latest update is shown, on one line."
|
|
3433
3706
|
)
|
|
3434
3707
|
}),
|
|
3435
3708
|
execute: async ({ message }) => {
|
|
@@ -3705,7 +3978,7 @@ async function runAnalysis(mode, extraInstructions = []) {
|
|
|
3705
3978
|
// package.json
|
|
3706
3979
|
var package_default = {
|
|
3707
3980
|
name: "@algolia/wizard",
|
|
3708
|
-
version: "0.24.0-rc.
|
|
3981
|
+
version: "0.24.0-rc.117.213",
|
|
3709
3982
|
description: "Magically implement Algolia functionality in your codebase",
|
|
3710
3983
|
type: "module",
|
|
3711
3984
|
engines: {
|
|
@@ -3767,6 +4040,7 @@ var package_default = {
|
|
|
3767
4040
|
nanoid: "^5.1.15",
|
|
3768
4041
|
pino: "^10.3.1",
|
|
3769
4042
|
react: "^19.2.7",
|
|
4043
|
+
"terminal-link": "^5.0.0",
|
|
3770
4044
|
varlock: "^1.5.1",
|
|
3771
4045
|
zod: "^4.4.3",
|
|
3772
4046
|
zustand: "^5.0.14"
|
|
@@ -5318,7 +5592,7 @@ function delay(ms) {
|
|
|
5318
5592
|
}
|
|
5319
5593
|
|
|
5320
5594
|
// src/main.tsx
|
|
5321
|
-
import { jsx as
|
|
5595
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
5322
5596
|
async function startup() {
|
|
5323
5597
|
setProjectRoot(process.cwd());
|
|
5324
5598
|
let args;
|
|
@@ -5368,7 +5642,7 @@ ${formatStepList(workflow)}`);
|
|
|
5368
5642
|
}
|
|
5369
5643
|
async function run(workflow) {
|
|
5370
5644
|
const store = useWizard.getState();
|
|
5371
|
-
const instance = render(/* @__PURE__ */
|
|
5645
|
+
const instance = render(/* @__PURE__ */ jsx18(App, {}), { incrementalRendering: true });
|
|
5372
5646
|
await store.waitForStart();
|
|
5373
5647
|
let user = await getUser();
|
|
5374
5648
|
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.213",
|
|
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"
|