@algolia/wizard 0.38.0 → 0.40.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 +307 -201
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { render } from "ink";
|
|
5
5
|
|
|
6
6
|
// src/ui/App.tsx
|
|
7
|
-
import { Box as
|
|
7
|
+
import { Box as Box20, Text as Text20, useApp, useInput as useInput7, useWindowSize as useWindowSize7 } from "ink";
|
|
8
8
|
import Spinner2 from "ink-spinner";
|
|
9
9
|
|
|
10
10
|
// src/core/store.ts
|
|
@@ -251,6 +251,7 @@ var useWizard = create((set, get) => ({
|
|
|
251
251
|
_noticeQueue: [],
|
|
252
252
|
_noticeTimer: null,
|
|
253
253
|
cliOutput: [],
|
|
254
|
+
review: null,
|
|
254
255
|
targetIndex: null,
|
|
255
256
|
writtenFiles: [],
|
|
256
257
|
approvedCommands: /* @__PURE__ */ new Set(),
|
|
@@ -294,7 +295,8 @@ var useWizard = create((set, get) => ({
|
|
|
294
295
|
currentStepIndex: index,
|
|
295
296
|
output: "",
|
|
296
297
|
notices: [],
|
|
297
|
-
cliOutput: []
|
|
298
|
+
cliOutput: [],
|
|
299
|
+
review: null
|
|
298
300
|
});
|
|
299
301
|
},
|
|
300
302
|
setUser: (user) => set({ user }),
|
|
@@ -346,6 +348,7 @@ var useWizard = create((set, get) => ({
|
|
|
346
348
|
)
|
|
347
349
|
})),
|
|
348
350
|
clearCliOutput: () => set({ cliOutput: [] }),
|
|
351
|
+
setReview: (review2) => set({ review: review2 }),
|
|
349
352
|
setTargetIndex: (index) => set({ targetIndex: index }),
|
|
350
353
|
recordWrittenFile: (path) => set((s) => ({ writtenFiles: [...s.writtenFiles, path] })),
|
|
351
354
|
clearWrittenFiles: () => set({ writtenFiles: [] }),
|
|
@@ -399,6 +402,7 @@ var useWizard = create((set, get) => ({
|
|
|
399
402
|
output: "",
|
|
400
403
|
notices: [],
|
|
401
404
|
cliOutput: [],
|
|
405
|
+
review: null,
|
|
402
406
|
targetIndex: null,
|
|
403
407
|
writtenFiles: [],
|
|
404
408
|
approvedCommands: /* @__PURE__ */ new Set(),
|
|
@@ -837,6 +841,7 @@ function useScrollWindow({
|
|
|
837
841
|
const visibleCount = Math.min(capacity, Math.max(itemCount - offset, 0));
|
|
838
842
|
return {
|
|
839
843
|
viewportRef,
|
|
844
|
+
measured: size !== null,
|
|
840
845
|
width: size?.width ?? columns,
|
|
841
846
|
offset,
|
|
842
847
|
capacity,
|
|
@@ -1127,6 +1132,121 @@ function PromptInput() {
|
|
|
1127
1132
|
] });
|
|
1128
1133
|
}
|
|
1129
1134
|
|
|
1135
|
+
// src/ui/Review.tsx
|
|
1136
|
+
import { Box as Box10, Text as Text10, useInput as useInput3 } from "ink";
|
|
1137
|
+
import { useLayoutEffect as useLayoutEffect3, useState as useState7 } from "react";
|
|
1138
|
+
import { jsx as jsx8, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1139
|
+
var INGEST_SCRIPT = ".algolia-wizard/ingest.sh";
|
|
1140
|
+
function wrapText(text, width) {
|
|
1141
|
+
if (width <= 0) return [text];
|
|
1142
|
+
const lines = [];
|
|
1143
|
+
let line = "";
|
|
1144
|
+
for (const word of text.split(/\s+/).filter(Boolean)) {
|
|
1145
|
+
const candidate = line ? `${line} ${word}` : word;
|
|
1146
|
+
if (candidate.length <= width) {
|
|
1147
|
+
line = candidate;
|
|
1148
|
+
continue;
|
|
1149
|
+
}
|
|
1150
|
+
if (line) lines.push(line);
|
|
1151
|
+
let rest = word;
|
|
1152
|
+
while (rest.length > width) {
|
|
1153
|
+
lines.push(rest.slice(0, width));
|
|
1154
|
+
rest = rest.slice(width);
|
|
1155
|
+
}
|
|
1156
|
+
line = rest;
|
|
1157
|
+
}
|
|
1158
|
+
if (line) lines.push(line);
|
|
1159
|
+
return lines.length > 0 ? lines : [""];
|
|
1160
|
+
}
|
|
1161
|
+
function heading(text) {
|
|
1162
|
+
return { prefix: "", text, color: COLORS.strong, bold: true };
|
|
1163
|
+
}
|
|
1164
|
+
var BLANK = { prefix: "", text: " ", color: COLORS.dim };
|
|
1165
|
+
function itemRows(items, width, prefixFor, colorFor) {
|
|
1166
|
+
return items.flatMap((item, i) => {
|
|
1167
|
+
const { prefix, color: prefixColor } = prefixFor(i);
|
|
1168
|
+
const { color, bold } = colorFor(item);
|
|
1169
|
+
return wrapText(item, width - prefix.length).map((line, j) => ({
|
|
1170
|
+
prefix: j === 0 ? prefix : " ".repeat(prefix.length),
|
|
1171
|
+
prefixColor,
|
|
1172
|
+
text: line,
|
|
1173
|
+
color,
|
|
1174
|
+
bold
|
|
1175
|
+
}));
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
function buildRows(review2, width) {
|
|
1179
|
+
const { summaryPoints, nextSteps, reviewPrompt } = review2;
|
|
1180
|
+
const numberWidth = String(nextSteps.length).length + 2;
|
|
1181
|
+
const rows = [];
|
|
1182
|
+
if (summaryPoints.length > 0) {
|
|
1183
|
+
rows.push(heading("What we did"));
|
|
1184
|
+
rows.push(
|
|
1185
|
+
...itemRows(
|
|
1186
|
+
summaryPoints,
|
|
1187
|
+
width,
|
|
1188
|
+
() => ({ prefix: `${MARKER.done} `, color: COLORS.status.done }),
|
|
1189
|
+
() => ({ color: COLORS.primary, bold: false })
|
|
1190
|
+
)
|
|
1191
|
+
);
|
|
1192
|
+
}
|
|
1193
|
+
if (nextSteps.length > 0) {
|
|
1194
|
+
if (rows.length > 0) rows.push(BLANK);
|
|
1195
|
+
rows.push(heading("What to do next"));
|
|
1196
|
+
rows.push(
|
|
1197
|
+
...itemRows(
|
|
1198
|
+
nextSteps,
|
|
1199
|
+
width,
|
|
1200
|
+
(i) => ({
|
|
1201
|
+
prefix: `${i + 1}.`.padEnd(numberWidth),
|
|
1202
|
+
color: COLORS.secondary
|
|
1203
|
+
}),
|
|
1204
|
+
(step) => step.includes(INGEST_SCRIPT) ? { color: COLORS.brand, bold: true } : { color: COLORS.primary, bold: false }
|
|
1205
|
+
)
|
|
1206
|
+
);
|
|
1207
|
+
}
|
|
1208
|
+
if (reviewPrompt) {
|
|
1209
|
+
if (rows.length > 0) rows.push(BLANK);
|
|
1210
|
+
rows.push(
|
|
1211
|
+
...wrapText(reviewPrompt, width).map((line) => ({
|
|
1212
|
+
prefix: "",
|
|
1213
|
+
text: line,
|
|
1214
|
+
color: COLORS.brand
|
|
1215
|
+
}))
|
|
1216
|
+
);
|
|
1217
|
+
}
|
|
1218
|
+
return rows;
|
|
1219
|
+
}
|
|
1220
|
+
function ReviewPanel({ review: review2 }) {
|
|
1221
|
+
const [width, setWidth] = useState7(0);
|
|
1222
|
+
const rows = width > 0 ? buildRows(review2, width) : [];
|
|
1223
|
+
const scroll = useScrollWindow({ itemCount: rows.length });
|
|
1224
|
+
useLayoutEffect3(() => {
|
|
1225
|
+
if (scroll.measured) setWidth(scroll.width);
|
|
1226
|
+
}, [scroll.measured, scroll.width]);
|
|
1227
|
+
const scrollable = scroll.maxOffset > 0;
|
|
1228
|
+
useInput3(
|
|
1229
|
+
(_input, key) => {
|
|
1230
|
+
if (key.upArrow) scroll.scrollBy(-1);
|
|
1231
|
+
else if (key.downArrow) scroll.scrollBy(1);
|
|
1232
|
+
},
|
|
1233
|
+
{ isActive: scrollable }
|
|
1234
|
+
);
|
|
1235
|
+
const visible = rows.slice(scroll.offset, scroll.offset + scroll.capacity);
|
|
1236
|
+
return /* @__PURE__ */ jsxs9(Box10, { flexDirection: "column", flexGrow: 1, children: [
|
|
1237
|
+
/* @__PURE__ */ jsx8(ScrollView, { scroll, children: visible.map((row, i) => /* @__PURE__ */ jsxs9(Text10, { wrap: "truncate", children: [
|
|
1238
|
+
row.prefix && /* @__PURE__ */ jsx8(Text10, { color: row.prefixColor ?? row.color, bold: row.bold, children: row.prefix }),
|
|
1239
|
+
/* @__PURE__ */ jsx8(Text10, { color: row.color, bold: row.bold, children: row.text })
|
|
1240
|
+
] }, `review-row-${i}`)) }),
|
|
1241
|
+
scrollable && /* @__PURE__ */ jsx8(Text10, { color: COLORS.dim, children: "\u2191/\u2193 scroll" })
|
|
1242
|
+
] });
|
|
1243
|
+
}
|
|
1244
|
+
function Review() {
|
|
1245
|
+
const review2 = useWizard((s) => s.review);
|
|
1246
|
+
if (!review2) return null;
|
|
1247
|
+
return /* @__PURE__ */ jsx8(ReviewPanel, { review: review2 });
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1130
1250
|
// src/workflows/default.ts
|
|
1131
1251
|
import { z as z29 } from "zod";
|
|
1132
1252
|
|
|
@@ -2408,10 +2528,10 @@ import { spawn as spawn2 } from "node:child_process";
|
|
|
2408
2528
|
// src/lib/tools/context.ts
|
|
2409
2529
|
var DEFAULT_TOOL_LIMITS = {
|
|
2410
2530
|
list: 10,
|
|
2411
|
-
search:
|
|
2531
|
+
search: 20,
|
|
2412
2532
|
read: 20,
|
|
2413
2533
|
match: 100,
|
|
2414
|
-
shell:
|
|
2534
|
+
shell: 50
|
|
2415
2535
|
};
|
|
2416
2536
|
var DEFAULT_SHELL_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
2417
2537
|
async function refuseByDefault() {
|
|
@@ -3267,7 +3387,7 @@ async function runAnalysis(mode, extraInstructions = []) {
|
|
|
3267
3387
|
// package.json
|
|
3268
3388
|
var package_default = {
|
|
3269
3389
|
name: "@algolia/wizard",
|
|
3270
|
-
version: "0.
|
|
3390
|
+
version: "0.40.0",
|
|
3271
3391
|
description: "Magically implement Algolia functionality in your codebase",
|
|
3272
3392
|
type: "module",
|
|
3273
3393
|
engines: {
|
|
@@ -3633,23 +3753,6 @@ Output:
|
|
|
3633
3753
|
${JSON.stringify(s.output, null, 2)}`
|
|
3634
3754
|
).join("\n\n");
|
|
3635
3755
|
}
|
|
3636
|
-
function formatReviewSummary(result) {
|
|
3637
|
-
const nextStepLines = result.nextSteps.map((step) => {
|
|
3638
|
-
const isIngestCommand = step.includes(".algolia-wizard/ingest.sh");
|
|
3639
|
-
return {
|
|
3640
|
-
text: `\u2192 ${step}`,
|
|
3641
|
-
color: isIngestCommand ? COLORS.brand : void 0,
|
|
3642
|
-
bold: isIngestCommand
|
|
3643
|
-
};
|
|
3644
|
-
});
|
|
3645
|
-
return [
|
|
3646
|
-
// Plain lines, same as nextSteps' un-highlighted entries — the summary is
|
|
3647
|
-
// an overview, not a call to action, so it gets no arrow/color/bold.
|
|
3648
|
-
...result.summaryPoints,
|
|
3649
|
-
{ text: result.reviewPrompt, color: COLORS.brand },
|
|
3650
|
-
...nextStepLines
|
|
3651
|
-
];
|
|
3652
|
-
}
|
|
3653
3756
|
var reviewStep = async (ctx, options) => {
|
|
3654
3757
|
const result = await runAgent({
|
|
3655
3758
|
instructions: [
|
|
@@ -3668,7 +3771,8 @@ ${formatCompletedSteps(ctx.completedSteps)}`,
|
|
|
3668
3771
|
outputSchema: reviewSchema,
|
|
3669
3772
|
modelSize: "small"
|
|
3670
3773
|
});
|
|
3671
|
-
ctx.
|
|
3774
|
+
ctx.clearNotices();
|
|
3775
|
+
useWizard.getState().setReview(result);
|
|
3672
3776
|
return result;
|
|
3673
3777
|
};
|
|
3674
3778
|
|
|
@@ -4515,8 +4619,8 @@ function getWorkflow(id) {
|
|
|
4515
4619
|
// src/ui/Welcome.tsx
|
|
4516
4620
|
import { dirname as dirname8, join as join11 } from "node:path";
|
|
4517
4621
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
4518
|
-
import { useState as
|
|
4519
|
-
import { Box as
|
|
4622
|
+
import { useState as useState8 } from "react";
|
|
4623
|
+
import { Box as Box11, Spacer, Text as Text11, useInput as useInput4, useWindowSize as useWindowSize5 } from "ink";
|
|
4520
4624
|
|
|
4521
4625
|
// src/ui/copy/welcome.ts
|
|
4522
4626
|
var sidebarItems = [
|
|
@@ -4544,7 +4648,7 @@ var sidebarItems = [
|
|
|
4544
4648
|
|
|
4545
4649
|
// src/ui/Welcome.tsx
|
|
4546
4650
|
import Image, { TerminalInfoContext, defaultTerminalInfo } from "ink-picture";
|
|
4547
|
-
import { jsx as
|
|
4651
|
+
import { jsx as jsx9, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4548
4652
|
var IMAGE_PATH = join11(dirname8(fileURLToPath2(import.meta.url)), "algolia.png");
|
|
4549
4653
|
var TERMINAL_INFO = {
|
|
4550
4654
|
...defaultTerminalInfo,
|
|
@@ -4555,14 +4659,14 @@ function SidebarItem({
|
|
|
4555
4659
|
title,
|
|
4556
4660
|
description
|
|
4557
4661
|
}) {
|
|
4558
|
-
return /* @__PURE__ */
|
|
4559
|
-
/* @__PURE__ */
|
|
4560
|
-
/* @__PURE__ */
|
|
4561
|
-
/* @__PURE__ */
|
|
4662
|
+
return /* @__PURE__ */ jsxs10(Box11, { flexDirection: "column", children: [
|
|
4663
|
+
/* @__PURE__ */ jsxs10(Box11, { gap: 1, children: [
|
|
4664
|
+
/* @__PURE__ */ jsx9(Text11, { color: COLORS.success, children: "\u2192" }),
|
|
4665
|
+
/* @__PURE__ */ jsx9(Text11, { color: COLORS.strong, bold: true, children: title })
|
|
4562
4666
|
] }),
|
|
4563
|
-
/* @__PURE__ */
|
|
4564
|
-
/* @__PURE__ */
|
|
4565
|
-
/* @__PURE__ */
|
|
4667
|
+
/* @__PURE__ */ jsxs10(Box11, { flexDirection: "row", gap: 2, children: [
|
|
4668
|
+
/* @__PURE__ */ jsx9(Spacer, {}),
|
|
4669
|
+
/* @__PURE__ */ jsx9(Text11, { color: COLORS.muted, children: description })
|
|
4566
4670
|
] })
|
|
4567
4671
|
] });
|
|
4568
4672
|
}
|
|
@@ -4574,8 +4678,8 @@ function Welcome() {
|
|
|
4574
4678
|
{ label: "start wizard", run: confirmStart },
|
|
4575
4679
|
{ label: "learn more", run: openLearnMore }
|
|
4576
4680
|
];
|
|
4577
|
-
const [index, setIndex] =
|
|
4578
|
-
|
|
4681
|
+
const [index, setIndex] = useState8(0);
|
|
4682
|
+
useInput4((input, key) => {
|
|
4579
4683
|
if (key.upArrow || input === "k") {
|
|
4580
4684
|
setIndex((i) => (i - 1 + actions.length) % actions.length);
|
|
4581
4685
|
} else if (key.downArrow || input === "j") {
|
|
@@ -4598,16 +4702,16 @@ function Welcome() {
|
|
|
4598
4702
|
if (rows < 30) {
|
|
4599
4703
|
layout = scales["small"];
|
|
4600
4704
|
}
|
|
4601
|
-
return /* @__PURE__ */
|
|
4602
|
-
/* @__PURE__ */
|
|
4603
|
-
|
|
4705
|
+
return /* @__PURE__ */ jsxs10(Box11, { flexDirection: "row", justifyContent: "space-between", width: "100%", children: [
|
|
4706
|
+
/* @__PURE__ */ jsx9(
|
|
4707
|
+
Box11,
|
|
4604
4708
|
{
|
|
4605
4709
|
paddingY: layout.main.padding.y,
|
|
4606
4710
|
paddingX: layout.main.padding.x,
|
|
4607
4711
|
flexDirection: "column",
|
|
4608
4712
|
justifyContent: "center",
|
|
4609
|
-
children: /* @__PURE__ */
|
|
4610
|
-
/* @__PURE__ */
|
|
4713
|
+
children: /* @__PURE__ */ jsxs10(Box11, { flexDirection: "column", gap: 2, children: [
|
|
4714
|
+
/* @__PURE__ */ jsx9(TerminalInfoContext.Provider, { value: TERMINAL_INFO, children: /* @__PURE__ */ jsx9(
|
|
4611
4715
|
Image,
|
|
4612
4716
|
{
|
|
4613
4717
|
src: IMAGE_PATH,
|
|
@@ -4618,8 +4722,8 @@ function Welcome() {
|
|
|
4618
4722
|
protocol: "halfBlock"
|
|
4619
4723
|
}
|
|
4620
4724
|
) }),
|
|
4621
|
-
/* @__PURE__ */
|
|
4622
|
-
/* @__PURE__ */
|
|
4725
|
+
/* @__PURE__ */ jsx9(Text11, { color: COLORS.muted, children: "\u2726 From zero \u2192 working search in ~10 minutes" }),
|
|
4726
|
+
/* @__PURE__ */ jsx9(Box11, { flexDirection: "column", children: actions.map((action, i) => /* @__PURE__ */ jsx9(
|
|
4623
4727
|
SelectRow,
|
|
4624
4728
|
{
|
|
4625
4729
|
highlighted: i === index,
|
|
@@ -4628,21 +4732,21 @@ function Welcome() {
|
|
|
4628
4732
|
},
|
|
4629
4733
|
action.label
|
|
4630
4734
|
)) }),
|
|
4631
|
-
/* @__PURE__ */
|
|
4632
|
-
/* @__PURE__ */
|
|
4633
|
-
/* @__PURE__ */
|
|
4634
|
-
/* @__PURE__ */
|
|
4735
|
+
/* @__PURE__ */ jsxs10(Box11, { gap: 2, children: [
|
|
4736
|
+
/* @__PURE__ */ jsxs10(Text11, { children: [
|
|
4737
|
+
/* @__PURE__ */ jsx9(Text11, { color: COLORS.primary, children: "[\u2191] [\u2193]" }),
|
|
4738
|
+
/* @__PURE__ */ jsx9(Text11, { color: COLORS.dim, children: " move" })
|
|
4635
4739
|
] }),
|
|
4636
|
-
/* @__PURE__ */
|
|
4637
|
-
/* @__PURE__ */
|
|
4638
|
-
/* @__PURE__ */
|
|
4740
|
+
/* @__PURE__ */ jsxs10(Text11, { children: [
|
|
4741
|
+
/* @__PURE__ */ jsx9(Text11, { color: COLORS.primary, children: "[enter]" }),
|
|
4742
|
+
/* @__PURE__ */ jsx9(Text11, { color: COLORS.dim, children: " confirm" })
|
|
4639
4743
|
] })
|
|
4640
4744
|
] })
|
|
4641
4745
|
] })
|
|
4642
4746
|
}
|
|
4643
4747
|
),
|
|
4644
|
-
/* @__PURE__ */
|
|
4645
|
-
|
|
4748
|
+
/* @__PURE__ */ jsxs10(
|
|
4749
|
+
Box11,
|
|
4646
4750
|
{
|
|
4647
4751
|
backgroundColor: COLORS.bg.sidebar,
|
|
4648
4752
|
width: 40,
|
|
@@ -4652,8 +4756,8 @@ function Welcome() {
|
|
|
4652
4756
|
flexDirection: "column",
|
|
4653
4757
|
justifyContent: "center",
|
|
4654
4758
|
children: [
|
|
4655
|
-
/* @__PURE__ */
|
|
4656
|
-
sidebarItems.map((i, idx) => /* @__PURE__ */
|
|
4759
|
+
/* @__PURE__ */ jsx9(Text11, { color: COLORS.muted, children: "WHAT THIS WIZARD WILL DO" }),
|
|
4760
|
+
sidebarItems.map((i, idx) => /* @__PURE__ */ jsx9(SidebarItem, { title: i.title, description: i.description }, idx))
|
|
4657
4761
|
]
|
|
4658
4762
|
}
|
|
4659
4763
|
)
|
|
@@ -4662,7 +4766,7 @@ function Welcome() {
|
|
|
4662
4766
|
|
|
4663
4767
|
// src/ui/LearnMore.tsx
|
|
4664
4768
|
import { Fragment } from "react";
|
|
4665
|
-
import { Box as
|
|
4769
|
+
import { Box as Box12, Text as Text12, useInput as useInput5, useWindowSize as useWindowSize6 } from "ink";
|
|
4666
4770
|
|
|
4667
4771
|
// src/ui/copy/learn-more.ts
|
|
4668
4772
|
var accessIntro = "Everything runs locally on your machine. Nothing is written or sent without an explicit yes from you.";
|
|
@@ -4704,7 +4808,7 @@ var policyLinks = [
|
|
|
4704
4808
|
];
|
|
4705
4809
|
|
|
4706
4810
|
// src/ui/LearnMore.tsx
|
|
4707
|
-
import { jsx as
|
|
4811
|
+
import { jsx as jsx10, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4708
4812
|
var TAG_COLORS = {
|
|
4709
4813
|
READ: COLORS.success,
|
|
4710
4814
|
WRITE: COLORS.badge,
|
|
@@ -4721,12 +4825,12 @@ function NeverLine({
|
|
|
4721
4825
|
}) {
|
|
4722
4826
|
const used = segments.reduce((n, s) => n + s.text.length, 0);
|
|
4723
4827
|
const rightPad = Math.max(0, width - 2 - NEVER_BOX_PAD_X - used);
|
|
4724
|
-
return /* @__PURE__ */
|
|
4725
|
-
/* @__PURE__ */
|
|
4828
|
+
return /* @__PURE__ */ jsxs11(Text12, { color: COLORS.primary, children: [
|
|
4829
|
+
/* @__PURE__ */ jsx10(Text12, { color: COLORS.danger, children: "\u2502" }),
|
|
4726
4830
|
" ".repeat(NEVER_BOX_PAD_X),
|
|
4727
|
-
segments.map((s, i) => /* @__PURE__ */
|
|
4831
|
+
segments.map((s, i) => /* @__PURE__ */ jsx10(Text12, { color: s.color, bold: s.bold, children: s.text }, i)),
|
|
4728
4832
|
" ".repeat(rightPad),
|
|
4729
|
-
/* @__PURE__ */
|
|
4833
|
+
/* @__PURE__ */ jsx10(Text12, { color: COLORS.danger, children: "\u2502" })
|
|
4730
4834
|
] });
|
|
4731
4835
|
}
|
|
4732
4836
|
function LearnMore() {
|
|
@@ -4734,12 +4838,12 @@ function LearnMore() {
|
|
|
4734
4838
|
const backToHome = useWizard((s) => s.backToHome);
|
|
4735
4839
|
const { columns } = useWindowSize6();
|
|
4736
4840
|
const dividerWidth = Math.max(0, columns - PADDING_X * 2);
|
|
4737
|
-
|
|
4841
|
+
useInput5((_input, key) => {
|
|
4738
4842
|
if (key.escape) backToHome();
|
|
4739
4843
|
else if (key.return) confirmStart();
|
|
4740
4844
|
});
|
|
4741
|
-
return /* @__PURE__ */
|
|
4742
|
-
|
|
4845
|
+
return /* @__PURE__ */ jsxs11(
|
|
4846
|
+
Box12,
|
|
4743
4847
|
{
|
|
4744
4848
|
flexDirection: "column",
|
|
4745
4849
|
paddingX: PADDING_X,
|
|
@@ -4747,31 +4851,31 @@ function LearnMore() {
|
|
|
4747
4851
|
width: "100%",
|
|
4748
4852
|
gap: 1,
|
|
4749
4853
|
children: [
|
|
4750
|
-
/* @__PURE__ */
|
|
4751
|
-
/* @__PURE__ */
|
|
4752
|
-
/* @__PURE__ */
|
|
4753
|
-
/* @__PURE__ */
|
|
4754
|
-
/* @__PURE__ */
|
|
4755
|
-
/* @__PURE__ */
|
|
4756
|
-
/* @__PURE__ */
|
|
4757
|
-
/* @__PURE__ */
|
|
4758
|
-
/* @__PURE__ */
|
|
4854
|
+
/* @__PURE__ */ jsx10(Text12, { color: COLORS.strong, bold: true, children: "What algolia wizard accesses" }),
|
|
4855
|
+
/* @__PURE__ */ jsx10(Text12, { color: COLORS.muted, children: accessIntro }),
|
|
4856
|
+
/* @__PURE__ */ jsx10(Box12, { flexDirection: "column", children: accessItems.map((item) => /* @__PURE__ */ jsxs11(Box12, { flexDirection: "column", marginTop: 1, children: [
|
|
4857
|
+
/* @__PURE__ */ jsx10(Text12, { color: COLORS.border, children: "\u2500".repeat(dividerWidth) }),
|
|
4858
|
+
/* @__PURE__ */ jsxs11(Box12, { flexDirection: "row", gap: 1, marginTop: 1, children: [
|
|
4859
|
+
/* @__PURE__ */ jsx10(Box12, { width: TAG_COLUMN_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx10(Text12, { color: TAG_COLORS[item.tag], bold: true, children: `[${item.tag}]` }) }),
|
|
4860
|
+
/* @__PURE__ */ jsx10(Box12, { flexDirection: "column", children: /* @__PURE__ */ jsxs11(Text12, { color: COLORS.primary, children: [
|
|
4861
|
+
/* @__PURE__ */ jsx10(Text12, { color: COLORS.strong, bold: true, children: item.title }),
|
|
4862
|
+
/* @__PURE__ */ jsx10(Text12, { color: COLORS.muted, children: ` \u2014 ${item.description}` })
|
|
4759
4863
|
] }) })
|
|
4760
4864
|
] })
|
|
4761
4865
|
] }, item.tag)) }),
|
|
4762
|
-
/* @__PURE__ */
|
|
4763
|
-
/* @__PURE__ */
|
|
4764
|
-
/* @__PURE__ */
|
|
4765
|
-
/* @__PURE__ */
|
|
4866
|
+
/* @__PURE__ */ jsxs11(Box12, { marginTop: 1, flexDirection: "column", children: [
|
|
4867
|
+
/* @__PURE__ */ jsx10(Text12, { color: COLORS.danger, children: `\u256D${"\u2500".repeat(Math.max(0, dividerWidth - 2))}\u256E` }),
|
|
4868
|
+
/* @__PURE__ */ jsx10(NeverLine, { width: dividerWidth }),
|
|
4869
|
+
/* @__PURE__ */ jsx10(
|
|
4766
4870
|
NeverLine,
|
|
4767
4871
|
{
|
|
4768
4872
|
width: dividerWidth,
|
|
4769
4873
|
segments: [{ text: "I NEVER", color: COLORS.danger, bold: true }]
|
|
4770
4874
|
}
|
|
4771
4875
|
),
|
|
4772
|
-
neverItems.map((item) => /* @__PURE__ */
|
|
4773
|
-
/* @__PURE__ */
|
|
4774
|
-
/* @__PURE__ */
|
|
4876
|
+
neverItems.map((item) => /* @__PURE__ */ jsxs11(Fragment, { children: [
|
|
4877
|
+
/* @__PURE__ */ jsx10(NeverLine, { width: dividerWidth }),
|
|
4878
|
+
/* @__PURE__ */ jsx10(
|
|
4775
4879
|
NeverLine,
|
|
4776
4880
|
{
|
|
4777
4881
|
width: dividerWidth,
|
|
@@ -4783,24 +4887,24 @@ function LearnMore() {
|
|
|
4783
4887
|
}
|
|
4784
4888
|
)
|
|
4785
4889
|
] }, item)),
|
|
4786
|
-
/* @__PURE__ */
|
|
4787
|
-
/* @__PURE__ */
|
|
4890
|
+
/* @__PURE__ */ jsx10(NeverLine, { width: dividerWidth }),
|
|
4891
|
+
/* @__PURE__ */ jsx10(Text12, { color: COLORS.danger, children: `\u2570${"\u2500".repeat(Math.max(0, dividerWidth - 2))}\u256F` })
|
|
4788
4892
|
] }),
|
|
4789
|
-
/* @__PURE__ */
|
|
4790
|
-
/* @__PURE__ */
|
|
4791
|
-
/* @__PURE__ */
|
|
4893
|
+
/* @__PURE__ */ jsx10(Box12, { marginTop: 1, flexDirection: "column", children: policyLinks.map((link) => /* @__PURE__ */ jsxs11(Box12, { flexDirection: "row", gap: 1, children: [
|
|
4894
|
+
/* @__PURE__ */ jsx10(Text12, { color: COLORS.strong, bold: true, children: `${link.label}:` }),
|
|
4895
|
+
/* @__PURE__ */ jsx10(Text12, { color: COLORS.accent, children: link.url })
|
|
4792
4896
|
] }, link.label)) }),
|
|
4793
|
-
/* @__PURE__ */
|
|
4794
|
-
/* @__PURE__ */
|
|
4795
|
-
/* @__PURE__ */
|
|
4796
|
-
/* @__PURE__ */
|
|
4797
|
-
/* @__PURE__ */
|
|
4897
|
+
/* @__PURE__ */ jsxs11(Box12, { marginTop: 1, flexDirection: "row", gap: 3, children: [
|
|
4898
|
+
/* @__PURE__ */ jsxs11(Box12, { flexDirection: "row", gap: 1, children: [
|
|
4899
|
+
/* @__PURE__ */ jsx10(Text12, { color: COLORS.muted, children: "[" }),
|
|
4900
|
+
/* @__PURE__ */ jsx10(Text12, { color: COLORS.primary, children: "esc" }),
|
|
4901
|
+
/* @__PURE__ */ jsx10(Text12, { color: COLORS.muted, children: "] back" })
|
|
4798
4902
|
] }),
|
|
4799
|
-
/* @__PURE__ */
|
|
4800
|
-
/* @__PURE__ */
|
|
4801
|
-
/* @__PURE__ */
|
|
4802
|
-
/* @__PURE__ */
|
|
4803
|
-
/* @__PURE__ */
|
|
4903
|
+
/* @__PURE__ */ jsxs11(Box12, { flexDirection: "row", gap: 1, children: [
|
|
4904
|
+
/* @__PURE__ */ jsx10(Text12, { color: COLORS.muted, children: "[" }),
|
|
4905
|
+
/* @__PURE__ */ jsx10(Text12, { color: COLORS.primary, children: "enter" }),
|
|
4906
|
+
/* @__PURE__ */ jsx10(Text12, { color: COLORS.muted, children: "]" }),
|
|
4907
|
+
/* @__PURE__ */ jsx10(Text12, { color: COLORS.success, bold: true, children: "start wizard" })
|
|
4804
4908
|
] })
|
|
4805
4909
|
] })
|
|
4806
4910
|
]
|
|
@@ -4809,17 +4913,17 @@ function LearnMore() {
|
|
|
4809
4913
|
}
|
|
4810
4914
|
|
|
4811
4915
|
// src/ui/Sidebar.tsx
|
|
4812
|
-
import { Box as
|
|
4916
|
+
import { Box as Box15, Text as Text15 } from "ink";
|
|
4813
4917
|
|
|
4814
4918
|
// src/ui/Steps.tsx
|
|
4815
|
-
import { Box as
|
|
4919
|
+
import { Box as Box13, Text as Text13 } from "ink";
|
|
4816
4920
|
import Spinner from "ink-spinner";
|
|
4817
|
-
import { jsx as
|
|
4921
|
+
import { jsx as jsx11, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4818
4922
|
function Steps() {
|
|
4819
4923
|
const { steps } = useWizard();
|
|
4820
4924
|
const visibleSteps = steps.filter(isStepVisible);
|
|
4821
|
-
return /* @__PURE__ */
|
|
4822
|
-
s.status === "running" ? /* @__PURE__ */
|
|
4925
|
+
return /* @__PURE__ */ jsx11(Box13, { flexDirection: "column", gap: 1, children: visibleSteps.map((s) => /* @__PURE__ */ jsx11(Box13, { flexDirection: "column", children: /* @__PURE__ */ jsxs12(Text13, { color: COLORS.status[s.status], children: [
|
|
4926
|
+
s.status === "running" ? /* @__PURE__ */ jsx11(Spinner, { type: "dots" }) : MARKER[s.status],
|
|
4823
4927
|
" ",
|
|
4824
4928
|
s.title
|
|
4825
4929
|
] }) }, s.id)) });
|
|
@@ -4828,27 +4932,27 @@ function CurrentStep() {
|
|
|
4828
4932
|
const { steps } = useWizard();
|
|
4829
4933
|
const currentStep = steps.filter(isStepVisible).find((s) => s.status === "running");
|
|
4830
4934
|
if (!currentStep) return null;
|
|
4831
|
-
return /* @__PURE__ */
|
|
4832
|
-
/* @__PURE__ */
|
|
4935
|
+
return /* @__PURE__ */ jsxs12(Text13, { color: COLORS.status.running, children: [
|
|
4936
|
+
/* @__PURE__ */ jsx11(Spinner, { type: "dots" }),
|
|
4833
4937
|
" ",
|
|
4834
4938
|
` ${currentStep.title}`
|
|
4835
4939
|
] });
|
|
4836
4940
|
}
|
|
4837
4941
|
|
|
4838
4942
|
// src/ui/Progress.tsx
|
|
4839
|
-
import { Box as
|
|
4840
|
-
import { jsx as
|
|
4943
|
+
import { Box as Box14, Text as Text14 } from "ink";
|
|
4944
|
+
import { jsx as jsx12, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4841
4945
|
function Progress() {
|
|
4842
4946
|
const { steps, currentStepIndex } = useWizard();
|
|
4843
4947
|
const visibleSteps = steps.filter(isStepVisible);
|
|
4844
4948
|
if (visibleSteps.length === 0) return null;
|
|
4845
4949
|
const visibleCountThroughCurrent = steps.slice(0, currentStepIndex + 1).filter(isStepVisible).length;
|
|
4846
4950
|
const activeStepNumber = Math.max(1, visibleCountThroughCurrent);
|
|
4847
|
-
return /* @__PURE__ */
|
|
4848
|
-
/* @__PURE__ */
|
|
4849
|
-
/* @__PURE__ */
|
|
4850
|
-
/* @__PURE__ */
|
|
4851
|
-
/* @__PURE__ */
|
|
4951
|
+
return /* @__PURE__ */ jsxs13(Box14, { flexDirection: "row", gap: 1, children: [
|
|
4952
|
+
/* @__PURE__ */ jsx12(Text14, { color: COLORS.muted, children: "STEP" }),
|
|
4953
|
+
/* @__PURE__ */ jsx12(Text14, { color: COLORS.strong, bold: true, children: activeStepNumber }),
|
|
4954
|
+
/* @__PURE__ */ jsx12(Text14, { color: COLORS.strong, bold: true, children: "/" }),
|
|
4955
|
+
/* @__PURE__ */ jsx12(Text14, { color: COLORS.strong, bold: true, children: visibleSteps.length })
|
|
4852
4956
|
] });
|
|
4853
4957
|
}
|
|
4854
4958
|
|
|
@@ -4859,10 +4963,10 @@ var sidebarCommands = [
|
|
|
4859
4963
|
];
|
|
4860
4964
|
|
|
4861
4965
|
// src/ui/Sidebar.tsx
|
|
4862
|
-
import { jsx as
|
|
4966
|
+
import { jsx as jsx13, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4863
4967
|
function Sidebar() {
|
|
4864
|
-
return /* @__PURE__ */
|
|
4865
|
-
|
|
4968
|
+
return /* @__PURE__ */ jsxs14(
|
|
4969
|
+
Box15,
|
|
4866
4970
|
{
|
|
4867
4971
|
backgroundColor: "#14171E",
|
|
4868
4972
|
width: 30,
|
|
@@ -4871,16 +4975,16 @@ function Sidebar() {
|
|
|
4871
4975
|
flexDirection: "column",
|
|
4872
4976
|
justifyContent: "space-between",
|
|
4873
4977
|
children: [
|
|
4874
|
-
/* @__PURE__ */
|
|
4875
|
-
/* @__PURE__ */
|
|
4876
|
-
/* @__PURE__ */
|
|
4978
|
+
/* @__PURE__ */ jsxs14(Box15, { flexDirection: "column", gap: 1, children: [
|
|
4979
|
+
/* @__PURE__ */ jsx13(Text15, { color: COLORS.muted, children: "PROGRESS" }),
|
|
4980
|
+
/* @__PURE__ */ jsx13(Steps, {})
|
|
4877
4981
|
] }),
|
|
4878
|
-
/* @__PURE__ */
|
|
4879
|
-
/* @__PURE__ */
|
|
4880
|
-
/* @__PURE__ */
|
|
4881
|
-
return /* @__PURE__ */
|
|
4882
|
-
/* @__PURE__ */
|
|
4883
|
-
/* @__PURE__ */
|
|
4982
|
+
/* @__PURE__ */ jsxs14(Box15, { flexDirection: "column", gap: 1, children: [
|
|
4983
|
+
/* @__PURE__ */ jsx13(Progress, {}),
|
|
4984
|
+
/* @__PURE__ */ jsx13(Box15, { flexDirection: "column", children: sidebarCommands.map((c) => {
|
|
4985
|
+
return /* @__PURE__ */ jsxs14(Box15, { flexDirection: "row", gap: 1, children: [
|
|
4986
|
+
/* @__PURE__ */ jsx13(Text15, { color: COLORS.primary, children: `[${c.keyHint}]` }),
|
|
4987
|
+
/* @__PURE__ */ jsx13(Text15, { color: COLORS.muted, children: c.description })
|
|
4884
4988
|
] });
|
|
4885
4989
|
}) })
|
|
4886
4990
|
] })
|
|
@@ -4890,12 +4994,12 @@ function Sidebar() {
|
|
|
4890
4994
|
}
|
|
4891
4995
|
|
|
4892
4996
|
// src/ui/Ribbon.tsx
|
|
4893
|
-
import { Box as
|
|
4894
|
-
import { jsx as
|
|
4997
|
+
import { Box as Box16, Text as Text16 } from "ink";
|
|
4998
|
+
import { jsx as jsx14, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4895
4999
|
function Ribbon() {
|
|
4896
5000
|
const firstCommand = sidebarCommands[0];
|
|
4897
|
-
return /* @__PURE__ */
|
|
4898
|
-
|
|
5001
|
+
return /* @__PURE__ */ jsxs15(
|
|
5002
|
+
Box16,
|
|
4899
5003
|
{
|
|
4900
5004
|
backgroundColor: "#14171E",
|
|
4901
5005
|
flexDirection: "row",
|
|
@@ -4903,11 +5007,11 @@ function Ribbon() {
|
|
|
4903
5007
|
paddingX: 2,
|
|
4904
5008
|
paddingY: 1,
|
|
4905
5009
|
children: [
|
|
4906
|
-
/* @__PURE__ */
|
|
4907
|
-
/* @__PURE__ */
|
|
4908
|
-
/* @__PURE__ */
|
|
4909
|
-
/* @__PURE__ */
|
|
4910
|
-
/* @__PURE__ */
|
|
5010
|
+
/* @__PURE__ */ jsx14(Progress, {}),
|
|
5011
|
+
/* @__PURE__ */ jsx14(CurrentStep, {}),
|
|
5012
|
+
/* @__PURE__ */ jsxs15(Box16, { flexDirection: "row", gap: 1, children: [
|
|
5013
|
+
/* @__PURE__ */ jsx14(Text16, { color: COLORS.primary, children: `[${firstCommand.keyHint}]` }),
|
|
5014
|
+
/* @__PURE__ */ jsx14(Text16, { color: COLORS.muted, children: firstCommand.description })
|
|
4911
5015
|
] })
|
|
4912
5016
|
]
|
|
4913
5017
|
}
|
|
@@ -4915,11 +5019,11 @@ function Ribbon() {
|
|
|
4915
5019
|
}
|
|
4916
5020
|
|
|
4917
5021
|
// src/ui/App.tsx
|
|
4918
|
-
import { useState as
|
|
5022
|
+
import { useState as useState10 } from "react";
|
|
4919
5023
|
|
|
4920
5024
|
// src/ui/Logs.tsx
|
|
4921
|
-
import { Box as
|
|
4922
|
-
import { jsx as
|
|
5025
|
+
import { Box as Box17, Text as Text17, useInput as useInput6 } from "ink";
|
|
5026
|
+
import { jsx as jsx15, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4923
5027
|
var KIND_COLOR = {
|
|
4924
5028
|
tool: COLORS.primary,
|
|
4925
5029
|
prompt: COLORS.badge
|
|
@@ -4950,14 +5054,14 @@ function formatTimestamp(ms) {
|
|
|
4950
5054
|
function Logs() {
|
|
4951
5055
|
const logs = useWizard((s) => s.logs);
|
|
4952
5056
|
const scroll = useScrollWindow({ itemCount: logs.length, followBottom: true });
|
|
4953
|
-
|
|
5057
|
+
useInput6((_input, key) => {
|
|
4954
5058
|
if (key.upArrow) scroll.scrollBy(-1);
|
|
4955
5059
|
else if (key.downArrow) scroll.scrollBy(1);
|
|
4956
5060
|
});
|
|
4957
5061
|
const visible = logs.slice(scroll.offset, scroll.offset + scroll.capacity);
|
|
4958
|
-
return /* @__PURE__ */
|
|
4959
|
-
logs.length === 0 && /* @__PURE__ */
|
|
4960
|
-
/* @__PURE__ */
|
|
5062
|
+
return /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", paddingX: 4, paddingY: 2, flexGrow: 1, children: [
|
|
5063
|
+
logs.length === 0 && /* @__PURE__ */ jsx15(Text17, { color: COLORS.dim, children: "No logs yet." }),
|
|
5064
|
+
/* @__PURE__ */ jsx15(ScrollView, { scroll, children: visible.map((entry) => {
|
|
4961
5065
|
const timestamp = `[${formatTimestamp(entry.startedAt)}]`;
|
|
4962
5066
|
const durationText = entry.kind === "tool" && entry.durationMs !== void 0 ? `${entry.durationMs}ms` : "";
|
|
4963
5067
|
const rawPreview = rawInputText(entry.input);
|
|
@@ -4967,25 +5071,25 @@ function Logs() {
|
|
|
4967
5071
|
const name = truncate2(entry.name, budget);
|
|
4968
5072
|
budget -= name.length;
|
|
4969
5073
|
const preview = rawPreview ? truncate2(rawPreview, budget) : "";
|
|
4970
|
-
return /* @__PURE__ */
|
|
4971
|
-
/* @__PURE__ */
|
|
4972
|
-
/* @__PURE__ */
|
|
4973
|
-
preview && /* @__PURE__ */
|
|
4974
|
-
durationText && /* @__PURE__ */
|
|
5074
|
+
return /* @__PURE__ */ jsxs16(Box17, { flexDirection: "row", gap: ROW_GAP, children: [
|
|
5075
|
+
/* @__PURE__ */ jsx15(Text17, { color: COLORS.dim, children: timestamp }),
|
|
5076
|
+
/* @__PURE__ */ jsx15(Text17, { color: logNameColor(entry), wrap: "truncate", children: name }),
|
|
5077
|
+
preview && /* @__PURE__ */ jsx15(Text17, { color: COLORS.dim, wrap: "truncate", children: preview }),
|
|
5078
|
+
durationText && /* @__PURE__ */ jsx15(Text17, { color: COLORS.dim, children: durationText })
|
|
4975
5079
|
] }, entry.id);
|
|
4976
5080
|
}) }),
|
|
4977
|
-
/* @__PURE__ */
|
|
5081
|
+
/* @__PURE__ */ jsx15(Text17, { color: COLORS.dim, children: "\u2191/\u2193 scroll" })
|
|
4978
5082
|
] });
|
|
4979
5083
|
}
|
|
4980
5084
|
|
|
4981
5085
|
// src/ui/Tips.tsx
|
|
4982
|
-
import { useEffect as useEffect3, useRef as useRef4, useState as
|
|
4983
|
-
import { Box as
|
|
5086
|
+
import { useEffect as useEffect3, useRef as useRef4, useState as useState9 } from "react";
|
|
5087
|
+
import { Box as Box19, Text as Text19 } from "ink";
|
|
4984
5088
|
import terminalLink from "terminal-link";
|
|
4985
5089
|
|
|
4986
5090
|
// src/ui/Code.tsx
|
|
4987
|
-
import { Box as
|
|
4988
|
-
import { jsx as
|
|
5091
|
+
import { Box as Box18, Text as Text18 } from "ink";
|
|
5092
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
4989
5093
|
var TOKEN_RE = /("(?:\\.|[^"\\])*"|\btrue\b|\bfalse\b|\bnull\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|[{}[\]:,])/g;
|
|
4990
5094
|
function highlightJson(json) {
|
|
4991
5095
|
const parts = json.split(TOKEN_RE);
|
|
@@ -4994,22 +5098,22 @@ function highlightJson(json) {
|
|
|
4994
5098
|
if (part[0] === '"') {
|
|
4995
5099
|
const next = parts.slice(i + 1).find((p) => p.trim());
|
|
4996
5100
|
const isKey = next?.trimStart().startsWith(":");
|
|
4997
|
-
return /* @__PURE__ */
|
|
5101
|
+
return /* @__PURE__ */ jsx16(Text18, { color: isKey ? "cyan" : "green", children: part }, i);
|
|
4998
5102
|
}
|
|
4999
5103
|
if (part === "true" || part === "false" || part === "null") {
|
|
5000
|
-
return /* @__PURE__ */
|
|
5104
|
+
return /* @__PURE__ */ jsx16(Text18, { color: "magenta", children: part }, i);
|
|
5001
5105
|
}
|
|
5002
5106
|
if (/^-?\d/.test(part)) {
|
|
5003
|
-
return /* @__PURE__ */
|
|
5107
|
+
return /* @__PURE__ */ jsx16(Text18, { color: "yellow", children: part }, i);
|
|
5004
5108
|
}
|
|
5005
5109
|
if (/^[{}[\]:,]$/.test(part)) {
|
|
5006
|
-
return /* @__PURE__ */
|
|
5110
|
+
return /* @__PURE__ */ jsx16(Text18, { color: COLORS.dim, children: part }, i);
|
|
5007
5111
|
}
|
|
5008
|
-
return /* @__PURE__ */
|
|
5112
|
+
return /* @__PURE__ */ jsx16(Text18, { children: part }, i);
|
|
5009
5113
|
});
|
|
5010
5114
|
}
|
|
5011
5115
|
function Code({ children }) {
|
|
5012
|
-
return /* @__PURE__ */
|
|
5116
|
+
return /* @__PURE__ */ jsx16(Box18, { children: /* @__PURE__ */ jsx16(Text18, { children: highlightJson(children) }) });
|
|
5013
5117
|
}
|
|
5014
5118
|
|
|
5015
5119
|
// src/ui/copy/tips.ts
|
|
@@ -5223,26 +5327,26 @@ function tipsByIds(ids) {
|
|
|
5223
5327
|
}
|
|
5224
5328
|
|
|
5225
5329
|
// src/ui/Tips.tsx
|
|
5226
|
-
import { jsx as
|
|
5330
|
+
import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5227
5331
|
var TICK_MS = 16;
|
|
5228
5332
|
var CHUNK_HOLD_MS = 2e3;
|
|
5229
5333
|
var HOLD_MS = 12e3;
|
|
5230
5334
|
function TipTitle({ children }) {
|
|
5231
|
-
return /* @__PURE__ */
|
|
5232
|
-
/* @__PURE__ */
|
|
5233
|
-
/* @__PURE__ */
|
|
5335
|
+
return /* @__PURE__ */ jsxs17(Box19, { gap: 1, children: [
|
|
5336
|
+
/* @__PURE__ */ jsx17(Text19, { color: "cyan", children: "\u2726" }),
|
|
5337
|
+
/* @__PURE__ */ jsx17(Text19, { color: "white", bold: true, children })
|
|
5234
5338
|
] });
|
|
5235
5339
|
}
|
|
5236
5340
|
function InlineSegment({ segment }) {
|
|
5237
5341
|
switch (segment.type) {
|
|
5238
5342
|
case "highlight":
|
|
5239
|
-
return /* @__PURE__ */
|
|
5343
|
+
return /* @__PURE__ */ jsx17(Text19, { color: COLORS.success, children: segment.value });
|
|
5240
5344
|
case "link":
|
|
5241
|
-
return /* @__PURE__ */
|
|
5345
|
+
return /* @__PURE__ */ jsx17(Text19, { color: "cyan", underline: true, children: segment.href ? terminalLink(segment.value, segment.href) : segment.value });
|
|
5242
5346
|
case "codeword":
|
|
5243
|
-
return /* @__PURE__ */
|
|
5347
|
+
return /* @__PURE__ */ jsx17(Text19, { color: COLORS.highlight.fg, backgroundColor: COLORS.highlight.bg, children: segment.value });
|
|
5244
5348
|
default:
|
|
5245
|
-
return /* @__PURE__ */
|
|
5349
|
+
return /* @__PURE__ */ jsx17(Text19, { color: COLORS.muted, children: segment.value });
|
|
5246
5350
|
}
|
|
5247
5351
|
}
|
|
5248
5352
|
function TipContent({
|
|
@@ -5276,10 +5380,10 @@ function TipContent({
|
|
|
5276
5380
|
blocks.push({ type: "inline", segments: [segment] });
|
|
5277
5381
|
}
|
|
5278
5382
|
}
|
|
5279
|
-
return /* @__PURE__ */
|
|
5280
|
-
(block, i) => block.type === "code" ? /* @__PURE__ */
|
|
5383
|
+
return /* @__PURE__ */ jsx17(Box19, { flexDirection: "column", marginLeft: 2, gap: 1, children: blocks.map(
|
|
5384
|
+
(block, i) => block.type === "code" ? /* @__PURE__ */ jsx17(Code, { children: block.segment.value }, i) : /* @__PURE__ */ jsx17(Text19, { children: block.segments.map((segment, j) => /* @__PURE__ */ jsxs17(Text19, { children: [
|
|
5281
5385
|
j > 0 && " ",
|
|
5282
|
-
/* @__PURE__ */
|
|
5386
|
+
/* @__PURE__ */ jsx17(InlineSegment, { segment })
|
|
5283
5387
|
] }, j)) }, i)
|
|
5284
5388
|
) });
|
|
5285
5389
|
}
|
|
@@ -5296,8 +5400,8 @@ function Tips({
|
|
|
5296
5400
|
progress.tipIndex = 0;
|
|
5297
5401
|
progress.revealed = 0;
|
|
5298
5402
|
}
|
|
5299
|
-
const [tipIndex, setTipIndex] =
|
|
5300
|
-
const [revealed, setRevealed] =
|
|
5403
|
+
const [tipIndex, setTipIndex] = useState9(resuming ? progress.tipIndex : 0);
|
|
5404
|
+
const [revealed, setRevealed] = useState9(resuming ? progress.revealed : 0);
|
|
5301
5405
|
const tip = tips2.length > 0 ? tips2[tipIndex % tips2.length] : void 0;
|
|
5302
5406
|
const contentLength = tip?.chunks.reduce((sum, c) => sum + c.value.length, 0) ?? 0;
|
|
5303
5407
|
const totalLength = (tip?.title.length ?? 0) + contentLength;
|
|
@@ -5356,14 +5460,14 @@ function Tips({
|
|
|
5356
5460
|
if (!tip) return null;
|
|
5357
5461
|
const titleRevealed = tip.title.slice(0, revealed);
|
|
5358
5462
|
const contentRevealed = Math.max(0, revealed - tip.title.length);
|
|
5359
|
-
return /* @__PURE__ */
|
|
5360
|
-
/* @__PURE__ */
|
|
5361
|
-
/* @__PURE__ */
|
|
5463
|
+
return /* @__PURE__ */ jsxs17(Box19, { flexDirection: "column", marginBottom: 1, gap: 1, children: [
|
|
5464
|
+
/* @__PURE__ */ jsx17(TipTitle, { children: titleRevealed }),
|
|
5465
|
+
/* @__PURE__ */ jsx17(TipContent, { chunks: tip.chunks, revealed: contentRevealed })
|
|
5362
5466
|
] });
|
|
5363
5467
|
}
|
|
5364
5468
|
|
|
5365
5469
|
// src/ui/App.tsx
|
|
5366
|
-
import { jsx as
|
|
5470
|
+
import { jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5367
5471
|
function App() {
|
|
5368
5472
|
const {
|
|
5369
5473
|
phase,
|
|
@@ -5373,12 +5477,13 @@ function App() {
|
|
|
5373
5477
|
steps,
|
|
5374
5478
|
inputReq,
|
|
5375
5479
|
user,
|
|
5376
|
-
workflow
|
|
5480
|
+
workflow,
|
|
5481
|
+
review: review2
|
|
5377
5482
|
} = useWizard();
|
|
5378
5483
|
const { exit } = useApp();
|
|
5379
5484
|
const { columns, rows } = useWindowSize7();
|
|
5380
|
-
const [showLogs, setShowLogs] =
|
|
5381
|
-
const [tipState, setTipState] =
|
|
5485
|
+
const [showLogs, setShowLogs] = useState10(false);
|
|
5486
|
+
const [tipState, setTipState] = useState10("idle");
|
|
5382
5487
|
const finished = phase === "done" || phase === "error";
|
|
5383
5488
|
const currentStep = steps[currentStepIndex];
|
|
5384
5489
|
const stepDef = workflow ? getWorkflow(workflow.id)?.steps.find((s) => s.id === currentStep?.id) : void 0;
|
|
@@ -5390,8 +5495,8 @@ function App() {
|
|
|
5390
5495
|
const holdForTip = stepHasTips && promptPending && tipState === "revealing";
|
|
5391
5496
|
const showTips = stepHasTips && (phase === "running" || isCommandApprovalPrompt || holdForTip);
|
|
5392
5497
|
const showNoticesInMain = !stepHasTips;
|
|
5393
|
-
const showNotices = !isAwaitingUserInput || holdForTip;
|
|
5394
|
-
|
|
5498
|
+
const showNotices = (!isAwaitingUserInput || holdForTip) && !review2;
|
|
5499
|
+
useInput7(
|
|
5395
5500
|
(_input, key) => {
|
|
5396
5501
|
if (key.return) {
|
|
5397
5502
|
exit();
|
|
@@ -5399,7 +5504,7 @@ function App() {
|
|
|
5399
5504
|
},
|
|
5400
5505
|
{ isActive: finished }
|
|
5401
5506
|
);
|
|
5402
|
-
|
|
5507
|
+
useInput7((_input, key) => {
|
|
5403
5508
|
if (phase === "idle" || phase === "authenticating") return;
|
|
5404
5509
|
if (key.tab) {
|
|
5405
5510
|
setShowLogs(!showLogs);
|
|
@@ -5411,7 +5516,7 @@ function App() {
|
|
|
5411
5516
|
}
|
|
5412
5517
|
});
|
|
5413
5518
|
const escOwnedElsewhere = phase === "idle" || phase === "authenticating" || phase === "awaitingInput" && !holdForTip && (inputReq?.promptType === "enterToContinue" || inputReq?.promptType === "commandApproval");
|
|
5414
|
-
|
|
5519
|
+
useInput7((_input, key) => {
|
|
5415
5520
|
if (escOwnedElsewhere) return;
|
|
5416
5521
|
if (key.escape) {
|
|
5417
5522
|
track("AI Wizard Interaction", {
|
|
@@ -5430,8 +5535,8 @@ function App() {
|
|
|
5430
5535
|
/* Clamped to exactly the viewport: a taller frame makes Ink clear and repaint
|
|
5431
5536
|
the whole screen, and the scrolling throws off its cursor arithmetic —
|
|
5432
5537
|
flicker and leftover rows. */
|
|
5433
|
-
/* @__PURE__ */
|
|
5434
|
-
|
|
5538
|
+
/* @__PURE__ */ jsxs18(
|
|
5539
|
+
Box20,
|
|
5435
5540
|
{
|
|
5436
5541
|
backgroundColor: COLORS.bg.main,
|
|
5437
5542
|
flexDirection: "row",
|
|
@@ -5439,16 +5544,16 @@ function App() {
|
|
|
5439
5544
|
height: scrollsPastViewport ? void 0 : rows,
|
|
5440
5545
|
overflow: scrollsPastViewport ? "visible" : "hidden",
|
|
5441
5546
|
children: [
|
|
5442
|
-
mainWindowVisible && /* @__PURE__ */
|
|
5443
|
-
|
|
5547
|
+
mainWindowVisible && /* @__PURE__ */ jsxs18(
|
|
5548
|
+
Box20,
|
|
5444
5549
|
{
|
|
5445
5550
|
flexDirection,
|
|
5446
5551
|
width: "100%",
|
|
5447
5552
|
maxHeight: rows,
|
|
5448
5553
|
justifyContent: "space-between",
|
|
5449
5554
|
children: [
|
|
5450
|
-
showLogs ? /* @__PURE__ */
|
|
5451
|
-
|
|
5555
|
+
showLogs ? /* @__PURE__ */ jsx18(Logs, {}) : /* @__PURE__ */ jsxs18(
|
|
5556
|
+
Box20,
|
|
5452
5557
|
{
|
|
5453
5558
|
flexDirection: "column",
|
|
5454
5559
|
paddingX: 4,
|
|
@@ -5457,24 +5562,24 @@ function App() {
|
|
|
5457
5562
|
flexGrow: 1,
|
|
5458
5563
|
gap: 1,
|
|
5459
5564
|
children: [
|
|
5460
|
-
/* @__PURE__ */
|
|
5461
|
-
phase === "preflight" && !user && /* @__PURE__ */
|
|
5462
|
-
/* @__PURE__ */
|
|
5565
|
+
/* @__PURE__ */ jsxs18(Box20, { flexGrow: 2, flexDirection: "column", children: [
|
|
5566
|
+
phase === "preflight" && !user && /* @__PURE__ */ jsx18(Box20, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsxs18(Text20, { color: COLORS.strong, bold: true, children: [
|
|
5567
|
+
/* @__PURE__ */ jsx18(Spinner2, { type: "dots" }),
|
|
5463
5568
|
" Signing in to Algolia"
|
|
5464
5569
|
] }) }),
|
|
5465
|
-
phase === "preflight" && user && /* @__PURE__ */
|
|
5466
|
-
/* @__PURE__ */
|
|
5570
|
+
phase === "preflight" && user && /* @__PURE__ */ jsx18(Box20, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsxs18(Text20, { color: COLORS.strong, bold: true, children: [
|
|
5571
|
+
/* @__PURE__ */ jsx18(Spinner2, { type: "dots" }),
|
|
5467
5572
|
" Getting things ready"
|
|
5468
5573
|
] }) }),
|
|
5469
|
-
phase === "authenticating" && /* @__PURE__ */
|
|
5470
|
-
/* @__PURE__ */
|
|
5471
|
-
/* @__PURE__ */
|
|
5574
|
+
phase === "authenticating" && /* @__PURE__ */ jsxs18(Box20, { flexDirection: "column", marginBottom: 1, children: [
|
|
5575
|
+
/* @__PURE__ */ jsxs18(Text20, { color: COLORS.strong, bold: true, children: [
|
|
5576
|
+
/* @__PURE__ */ jsx18(Spinner2, { type: "dots" }),
|
|
5472
5577
|
" Signing in to Algolia"
|
|
5473
5578
|
] }),
|
|
5474
|
-
/* @__PURE__ */
|
|
5579
|
+
/* @__PURE__ */ jsx18(Text20, { color: COLORS.muted, children: "A browser window will open \u2014 complete sign-in there." })
|
|
5475
5580
|
] }),
|
|
5476
|
-
/* @__PURE__ */
|
|
5477
|
-
showTips && currentStep && /* @__PURE__ */
|
|
5581
|
+
/* @__PURE__ */ jsx18(CliOutput, {}),
|
|
5582
|
+
showTips && currentStep && /* @__PURE__ */ jsx18(
|
|
5478
5583
|
Tips,
|
|
5479
5584
|
{
|
|
5480
5585
|
stepId: currentStep.id,
|
|
@@ -5482,23 +5587,24 @@ function App() {
|
|
|
5482
5587
|
onRevealStateChange: setTipState
|
|
5483
5588
|
}
|
|
5484
5589
|
),
|
|
5485
|
-
showNoticesInMain && showNotices && /* @__PURE__ */
|
|
5486
|
-
|
|
5487
|
-
|
|
5590
|
+
showNoticesInMain && showNotices && /* @__PURE__ */ jsx18(Notices, { showAll: true, border: false }),
|
|
5591
|
+
/* @__PURE__ */ jsx18(Review, {}),
|
|
5592
|
+
!showTips && /* @__PURE__ */ jsx18(PromptInput, {}),
|
|
5593
|
+
phase === "error" && error && /* @__PURE__ */ jsx18(Box20, { marginTop: 1, children: /* @__PURE__ */ jsxs18(Text20, { color: COLORS.status.error, children: [
|
|
5488
5594
|
"\u2716 ",
|
|
5489
5595
|
error
|
|
5490
5596
|
] }) })
|
|
5491
5597
|
] }),
|
|
5492
|
-
!showNoticesInMain && showNotices && /* @__PURE__ */
|
|
5493
|
-
showTips && !holdForTip && /* @__PURE__ */
|
|
5598
|
+
!showNoticesInMain && showNotices && /* @__PURE__ */ jsx18(Notices, {}),
|
|
5599
|
+
showTips && !holdForTip && /* @__PURE__ */ jsx18(PromptInput, {})
|
|
5494
5600
|
]
|
|
5495
5601
|
}
|
|
5496
5602
|
),
|
|
5497
|
-
showSidebar ? /* @__PURE__ */
|
|
5603
|
+
showSidebar ? /* @__PURE__ */ jsx18(Sidebar, {}) : /* @__PURE__ */ jsx18(Ribbon, {})
|
|
5498
5604
|
]
|
|
5499
5605
|
}
|
|
5500
5606
|
),
|
|
5501
|
-
phase === "idle" && (homeScreen === "learnMore" ? /* @__PURE__ */
|
|
5607
|
+
phase === "idle" && (homeScreen === "learnMore" ? /* @__PURE__ */ jsx18(LearnMore, {}) : /* @__PURE__ */ jsx18(Welcome, {}))
|
|
5502
5608
|
]
|
|
5503
5609
|
}
|
|
5504
5610
|
)
|
|
@@ -5917,7 +6023,7 @@ function delay(ms) {
|
|
|
5917
6023
|
}
|
|
5918
6024
|
|
|
5919
6025
|
// src/main.tsx
|
|
5920
|
-
import { jsx as
|
|
6026
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
5921
6027
|
async function startup() {
|
|
5922
6028
|
setProjectRoot(process.cwd());
|
|
5923
6029
|
let args;
|
|
@@ -5967,7 +6073,7 @@ ${formatStepList(workflow)}`);
|
|
|
5967
6073
|
}
|
|
5968
6074
|
async function run(workflow) {
|
|
5969
6075
|
const store = useWizard.getState();
|
|
5970
|
-
const instance = render(/* @__PURE__ */
|
|
6076
|
+
const instance = render(/* @__PURE__ */ jsx19(App, {}), { incrementalRendering: true });
|
|
5971
6077
|
await store.waitForStart();
|
|
5972
6078
|
store.syncSteps(
|
|
5973
6079
|
workflow.steps.map((s) => ({
|