@algolia/wizard 0.79.0 → 0.81.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 +155 -123
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2306,7 +2306,7 @@ async function ensureApplication(resumeAppId) {
|
|
|
2306
2306
|
// package.json
|
|
2307
2307
|
var package_default = {
|
|
2308
2308
|
name: "@algolia/wizard",
|
|
2309
|
-
version: "0.
|
|
2309
|
+
version: "0.81.0",
|
|
2310
2310
|
description: "Magically implement Algolia functionality in your codebase",
|
|
2311
2311
|
type: "module",
|
|
2312
2312
|
engines: {
|
|
@@ -3858,6 +3858,14 @@ function reviewScriptTool(ctx) {
|
|
|
3858
3858
|
});
|
|
3859
3859
|
}
|
|
3860
3860
|
|
|
3861
|
+
// src/lib/tools/utils/redactSecrets.ts
|
|
3862
|
+
function redactSecrets(output, secrets) {
|
|
3863
|
+
return [...new Set(Object.values(secrets).filter(Boolean))].sort((a, b) => b.length - a.length).reduce(
|
|
3864
|
+
(redacted, secret) => redacted.split(secret).join("[REDACTED]"),
|
|
3865
|
+
output
|
|
3866
|
+
);
|
|
3867
|
+
}
|
|
3868
|
+
|
|
3861
3869
|
// src/lib/tools/utils/runShell.ts
|
|
3862
3870
|
import { spawn as spawn2 } from "node:child_process";
|
|
3863
3871
|
|
|
@@ -3879,9 +3887,14 @@ var DEFAULT_SHELL_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
|
3879
3887
|
async function refuseByDefault() {
|
|
3880
3888
|
return "reject";
|
|
3881
3889
|
}
|
|
3890
|
+
async function emptyShellEnv() {
|
|
3891
|
+
await Promise.resolve();
|
|
3892
|
+
return {};
|
|
3893
|
+
}
|
|
3882
3894
|
function createShellContext(overrides = {}) {
|
|
3883
3895
|
return {
|
|
3884
|
-
env:
|
|
3896
|
+
env: emptyShellEnv,
|
|
3897
|
+
secretEnv: emptyShellEnv,
|
|
3885
3898
|
timeoutMs: DEFAULT_SHELL_TIMEOUT_MS,
|
|
3886
3899
|
executions: [],
|
|
3887
3900
|
approve: refuseByDefault,
|
|
@@ -3924,7 +3937,9 @@ function runShell(command, opts) {
|
|
|
3924
3937
|
clearTimeout(killTimer);
|
|
3925
3938
|
resolve6({
|
|
3926
3939
|
exitCode,
|
|
3927
|
-
output: truncateText(
|
|
3940
|
+
output: truncateText(
|
|
3941
|
+
redactSecrets(output.trim(), opts.secrets ?? {})
|
|
3942
|
+
),
|
|
3928
3943
|
timedOut,
|
|
3929
3944
|
durationMs: Date.now() - startedAt
|
|
3930
3945
|
});
|
|
@@ -4250,13 +4265,22 @@ async function resolveShellEnv(ctx, command) {
|
|
|
4250
4265
|
return {};
|
|
4251
4266
|
});
|
|
4252
4267
|
}
|
|
4253
|
-
async function
|
|
4268
|
+
async function resolveSecretShellEnv(ctx, command) {
|
|
4269
|
+
return ctx.shell.secretEnv().catch((err) => {
|
|
4270
|
+
logger.warn(
|
|
4271
|
+
{ err, command },
|
|
4272
|
+
"runShell: could not resolve secret command env"
|
|
4273
|
+
);
|
|
4274
|
+
return {};
|
|
4275
|
+
});
|
|
4276
|
+
}
|
|
4277
|
+
async function runAndRecord(ctx, command, environment) {
|
|
4254
4278
|
useWizard.getState().pushNotice({ messages: [`Running: ${command}`] });
|
|
4255
|
-
const env = resolvedEnv ?? await resolveShellEnv(ctx, command);
|
|
4256
4279
|
const run2 = await (ctx.shell.run ?? runShell)(command, {
|
|
4257
|
-
cwd,
|
|
4258
|
-
env,
|
|
4259
|
-
timeoutMs: ctx.shell.timeoutMs
|
|
4280
|
+
cwd: environment.cwd,
|
|
4281
|
+
env: environment.values,
|
|
4282
|
+
timeoutMs: ctx.shell.timeoutMs,
|
|
4283
|
+
secrets: environment.secrets
|
|
4260
4284
|
});
|
|
4261
4285
|
logger.info(
|
|
4262
4286
|
{
|
|
@@ -4268,29 +4292,40 @@ async function runAndRecord(ctx, command, cwd, resolvedEnv) {
|
|
|
4268
4292
|
"runShell finished"
|
|
4269
4293
|
);
|
|
4270
4294
|
await markInteraction();
|
|
4295
|
+
const output = redactSecrets(run2.output, environment.secrets);
|
|
4271
4296
|
ctx.shell.executions.push({
|
|
4272
4297
|
command,
|
|
4273
|
-
cwd,
|
|
4298
|
+
cwd: environment.cwd,
|
|
4274
4299
|
approved: true,
|
|
4275
4300
|
exitCode: run2.exitCode,
|
|
4276
|
-
output
|
|
4301
|
+
output,
|
|
4277
4302
|
timedOut: run2.timedOut,
|
|
4278
4303
|
durationMs: run2.durationMs
|
|
4279
4304
|
});
|
|
4280
4305
|
return {
|
|
4281
4306
|
exitCode: run2.exitCode,
|
|
4282
4307
|
timedOut: run2.timedOut,
|
|
4283
|
-
output
|
|
4308
|
+
output
|
|
4284
4309
|
};
|
|
4285
4310
|
}
|
|
4286
4311
|
async function runReviewedCommand(ctx, command, cwd) {
|
|
4287
4312
|
const approval = getReviewedCommandApproval(ctx, command, cwd);
|
|
4288
4313
|
if (!approval) return void 0;
|
|
4289
|
-
const env = await resolveShellEnv(ctx, command);
|
|
4290
4314
|
if (!await reviewedCommandApprovalIsCurrent(approval)) {
|
|
4291
4315
|
return `Refused: ${relative5(ctx.root, approval.filePath)} changed after review. Call reviewScript again before running it.`;
|
|
4292
4316
|
}
|
|
4293
|
-
const
|
|
4317
|
+
const [env, secrets] = await Promise.all([
|
|
4318
|
+
resolveShellEnv(ctx, command),
|
|
4319
|
+
resolveSecretShellEnv(ctx, command)
|
|
4320
|
+
]);
|
|
4321
|
+
if (!await reviewedCommandApprovalIsCurrent(approval)) {
|
|
4322
|
+
return `Refused: ${relative5(ctx.root, approval.filePath)} changed after review. Call reviewScript again before running it.`;
|
|
4323
|
+
}
|
|
4324
|
+
const result = await runAndRecord(
|
|
4325
|
+
ctx,
|
|
4326
|
+
command,
|
|
4327
|
+
{ cwd, values: { ...env, ...secrets }, secrets }
|
|
4328
|
+
);
|
|
4294
4329
|
if (result.exitCode === SUCCESS_EXIT_CODE && !result.timedOut) {
|
|
4295
4330
|
clearReviewedCommandApproval(ctx);
|
|
4296
4331
|
}
|
|
@@ -4303,7 +4338,14 @@ async function approveAndRun(ctx, command, cwd, explanation) {
|
|
|
4303
4338
|
logger.info({ command }, "runShell: user rejected the command");
|
|
4304
4339
|
return "The user rejected this command. Do not retry it. Propose a different command, or report the limitation via reportStatus.";
|
|
4305
4340
|
}
|
|
4306
|
-
return
|
|
4341
|
+
return runUnreviewedCommand(ctx, command, cwd);
|
|
4342
|
+
}
|
|
4343
|
+
async function runUnreviewedCommand(ctx, command, cwd) {
|
|
4344
|
+
const [env, secrets] = await Promise.all([
|
|
4345
|
+
resolveShellEnv(ctx, command),
|
|
4346
|
+
resolveSecretShellEnv(ctx, command)
|
|
4347
|
+
]);
|
|
4348
|
+
return runAndRecord(ctx, command, { cwd, values: env, secrets });
|
|
4307
4349
|
}
|
|
4308
4350
|
function runShellTool(ctx, createModel = defaultCreateModel) {
|
|
4309
4351
|
return tool9({
|
|
@@ -4362,7 +4404,7 @@ function runShellTool(ctx, createModel = defaultCreateModel) {
|
|
|
4362
4404
|
if (lateReview !== void 0) return lateReview;
|
|
4363
4405
|
const storedApprovalIsCurrent = !usedStoredApproval || useWizard.getState().isCommandApproved(command, resolved2.target);
|
|
4364
4406
|
if (isSafe && storedApprovalIsCurrent) {
|
|
4365
|
-
return
|
|
4407
|
+
return runUnreviewedCommand(ctx, command, resolved2.target);
|
|
4366
4408
|
}
|
|
4367
4409
|
return approveAndRun(ctx, command, resolved2.target, explanation);
|
|
4368
4410
|
});
|
|
@@ -5867,12 +5909,12 @@ function ingestFailure(attempt, executions) {
|
|
|
5867
5909
|
}
|
|
5868
5910
|
return { reason: `it failed (exit ${attempt.exitCode ?? "unknown"})`, detail };
|
|
5869
5911
|
}
|
|
5870
|
-
function makeToolContext(root, appId, env = async () => ({})) {
|
|
5912
|
+
function makeToolContext(root, appId, env = async () => ({}), secretEnv = async () => ({})) {
|
|
5871
5913
|
return {
|
|
5872
5914
|
...createToolContext(
|
|
5873
5915
|
DEFAULT_TOOL_LIMITS,
|
|
5874
5916
|
root,
|
|
5875
|
-
createShellContext({ env, approve: storeApproval(root) })
|
|
5917
|
+
createShellContext({ env, secretEnv, approve: storeApproval(root) })
|
|
5876
5918
|
),
|
|
5877
5919
|
appId
|
|
5878
5920
|
};
|
|
@@ -6096,11 +6138,17 @@ async function implement(ctx, useCases = DEFAULT_IMPLEMENT_USE_CASES) {
|
|
|
6096
6138
|
let ingestDurationMs;
|
|
6097
6139
|
let ingestOutcomeMessage;
|
|
6098
6140
|
const ingestKeyAppId = ingestAppId;
|
|
6099
|
-
const ingestionTools = ingestKeyAppId && ingestWriteKey ? makeToolContext(
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6141
|
+
const ingestionTools = ingestKeyAppId && ingestWriteKey ? makeToolContext(
|
|
6142
|
+
repoRoot,
|
|
6143
|
+
ctx.appId,
|
|
6144
|
+
async () => ({
|
|
6145
|
+
[APP_ID_VAR]: ingestKeyAppId,
|
|
6146
|
+
[INDEX_NAME_VAR]: targetIndex
|
|
6147
|
+
}),
|
|
6148
|
+
async () => ({
|
|
6149
|
+
[API_KEY_VAR]: ingestWriteKey
|
|
6150
|
+
})
|
|
6151
|
+
) : makeToolContext(repoRoot, ctx.appId);
|
|
6104
6152
|
async function runImplementationUseCase(currentUseCase, extraInstructions = [], isRetry = false) {
|
|
6105
6153
|
if (agentRuns > 0) ctx.recordStepExecution();
|
|
6106
6154
|
agentRuns += 1;
|
|
@@ -6387,17 +6435,12 @@ var defaultWorkflow = {
|
|
|
6387
6435
|
id: "default",
|
|
6388
6436
|
title: "Default Workflow",
|
|
6389
6437
|
description: "This workflow explores your repo and implements Algolia on your behalf",
|
|
6438
|
+
tips: true,
|
|
6390
6439
|
steps: [
|
|
6391
6440
|
defineStep({
|
|
6392
6441
|
id: "project-scan",
|
|
6393
6442
|
title: "project scan",
|
|
6394
6443
|
outputSchema: projectScanSchema,
|
|
6395
|
-
tips: [
|
|
6396
|
-
"apps-and-indices",
|
|
6397
|
-
"records-are-json",
|
|
6398
|
-
"speed",
|
|
6399
|
-
"searchable-attributes"
|
|
6400
|
-
],
|
|
6401
6444
|
run: (ctx) => {
|
|
6402
6445
|
ctx.notify({
|
|
6403
6446
|
messages: [
|
|
@@ -6433,7 +6476,6 @@ var defaultWorkflow = {
|
|
|
6433
6476
|
id: "ingestion",
|
|
6434
6477
|
title: "ingest records",
|
|
6435
6478
|
outputSchema: implementSchema,
|
|
6436
|
-
tips: ["facets", "test-relevance", "search-analytics", "recommend"],
|
|
6437
6479
|
run: (ctx) => {
|
|
6438
6480
|
ctx.notify({
|
|
6439
6481
|
messages: [
|
|
@@ -6454,7 +6496,6 @@ var defaultWorkflow = {
|
|
|
6454
6496
|
id: "search",
|
|
6455
6497
|
title: "create search ui",
|
|
6456
6498
|
outputSchema: implementSchema,
|
|
6457
|
-
tips: ["typo-tolerance", "synonyms", "multi-index-search", "rules"],
|
|
6458
6499
|
run: (ctx) => {
|
|
6459
6500
|
ctx.notify({
|
|
6460
6501
|
messages: ["Building your Algolia search experience\u2026"]
|
|
@@ -6465,6 +6506,7 @@ var defaultWorkflow = {
|
|
|
6465
6506
|
defineStep({
|
|
6466
6507
|
id: "review",
|
|
6467
6508
|
title: "done",
|
|
6509
|
+
hideTips: true,
|
|
6468
6510
|
outputSchema: reviewSchema,
|
|
6469
6511
|
run: (ctx) => {
|
|
6470
6512
|
ctx.notify({
|
|
@@ -7127,7 +7169,6 @@ var playbookWorkflow = {
|
|
|
7127
7169
|
id: "select-index",
|
|
7128
7170
|
title: "Select index",
|
|
7129
7171
|
outputSchema: selectIndexSchema,
|
|
7130
|
-
tips: ["apps-and-indices", "records-are-json", "speed"],
|
|
7131
7172
|
run: (ctx) => selectIndexStep2(ctx)
|
|
7132
7173
|
}),
|
|
7133
7174
|
defineStep({
|
|
@@ -7135,7 +7176,6 @@ var playbookWorkflow = {
|
|
|
7135
7176
|
title: "Confirm sample index creation",
|
|
7136
7177
|
outputSchema: confirmIndexSchema,
|
|
7137
7178
|
visible: false,
|
|
7138
|
-
tips: ["apps-and-indices", "records-are-json", "speed"],
|
|
7139
7179
|
run: (ctx) => confirmIndexStep(ctx)
|
|
7140
7180
|
}),
|
|
7141
7181
|
defineStep({
|
|
@@ -7740,7 +7780,6 @@ function Code({ children }) {
|
|
|
7740
7780
|
// src/ui/copy/tips.ts
|
|
7741
7781
|
var tips = [
|
|
7742
7782
|
{
|
|
7743
|
-
id: "apps-and-indices",
|
|
7744
7783
|
title: "An Application is like your library. Indices are the books in it.",
|
|
7745
7784
|
chunks: [
|
|
7746
7785
|
{
|
|
@@ -7754,7 +7793,6 @@ var tips = [
|
|
|
7754
7793
|
]
|
|
7755
7794
|
},
|
|
7756
7795
|
{
|
|
7757
|
-
id: "records-are-json",
|
|
7758
7796
|
title: "A Record is a JSON object inside of an index.",
|
|
7759
7797
|
chunks: [
|
|
7760
7798
|
{
|
|
@@ -7788,7 +7826,6 @@ var tips = [
|
|
|
7788
7826
|
]
|
|
7789
7827
|
},
|
|
7790
7828
|
{
|
|
7791
|
-
id: "speed",
|
|
7792
7829
|
title: "Speed isn't a feature, it's our business",
|
|
7793
7830
|
chunks: [
|
|
7794
7831
|
{
|
|
@@ -7802,7 +7839,6 @@ var tips = [
|
|
|
7802
7839
|
]
|
|
7803
7840
|
},
|
|
7804
7841
|
{
|
|
7805
|
-
id: "searchable-attributes",
|
|
7806
7842
|
title: "Searchable attributes are your relevance dial #1",
|
|
7807
7843
|
chunks: [
|
|
7808
7844
|
{
|
|
@@ -7818,7 +7854,6 @@ var tips = [
|
|
|
7818
7854
|
]
|
|
7819
7855
|
},
|
|
7820
7856
|
{
|
|
7821
|
-
id: "facets",
|
|
7822
7857
|
title: "Facets aren't just filters, they help build your UI",
|
|
7823
7858
|
chunks: [
|
|
7824
7859
|
{ type: "codeword", value: "attributesForFaceting" },
|
|
@@ -7829,7 +7864,6 @@ var tips = [
|
|
|
7829
7864
|
]
|
|
7830
7865
|
},
|
|
7831
7866
|
{
|
|
7832
|
-
id: "test-relevance",
|
|
7833
7867
|
title: "Test relevance in the dashboard before you write a line of ranking code",
|
|
7834
7868
|
chunks: [
|
|
7835
7869
|
{
|
|
@@ -7848,7 +7882,6 @@ var tips = [
|
|
|
7848
7882
|
]
|
|
7849
7883
|
},
|
|
7850
7884
|
{
|
|
7851
|
-
id: "search-analytics",
|
|
7852
7885
|
title: "Search Analytics helps you discover opportunities",
|
|
7853
7886
|
chunks: [
|
|
7854
7887
|
{
|
|
@@ -7862,7 +7895,6 @@ var tips = [
|
|
|
7862
7895
|
]
|
|
7863
7896
|
},
|
|
7864
7897
|
{
|
|
7865
|
-
id: "typo-tolerance",
|
|
7866
7898
|
title: "Your users will misspell things. Algolia already handles it.",
|
|
7867
7899
|
chunks: [
|
|
7868
7900
|
{
|
|
@@ -7876,7 +7908,6 @@ var tips = [
|
|
|
7876
7908
|
]
|
|
7877
7909
|
},
|
|
7878
7910
|
{
|
|
7879
|
-
id: "synonyms",
|
|
7880
7911
|
title: "Synonyms teach the engine your words",
|
|
7881
7912
|
chunks: [
|
|
7882
7913
|
{
|
|
@@ -7894,7 +7925,6 @@ var tips = [
|
|
|
7894
7925
|
]
|
|
7895
7926
|
},
|
|
7896
7927
|
{
|
|
7897
|
-
id: "multi-index-search",
|
|
7898
7928
|
title: "One search box, many indices",
|
|
7899
7929
|
chunks: [
|
|
7900
7930
|
{
|
|
@@ -7908,7 +7938,6 @@ var tips = [
|
|
|
7908
7938
|
]
|
|
7909
7939
|
},
|
|
7910
7940
|
{
|
|
7911
|
-
id: "rules",
|
|
7912
7941
|
title: "Rules let you put a thumb on the scale",
|
|
7913
7942
|
chunks: [
|
|
7914
7943
|
{
|
|
@@ -7926,7 +7955,6 @@ var tips = [
|
|
|
7926
7955
|
]
|
|
7927
7956
|
},
|
|
7928
7957
|
{
|
|
7929
|
-
id: "recommend",
|
|
7930
7958
|
title: "Let Algolia act as your recommendation engine",
|
|
7931
7959
|
chunks: [
|
|
7932
7960
|
{
|
|
@@ -7940,18 +7968,12 @@ var tips = [
|
|
|
7940
7968
|
]
|
|
7941
7969
|
}
|
|
7942
7970
|
];
|
|
7943
|
-
var tipsById = Object.fromEntries(
|
|
7944
|
-
tips.map((tip) => [tip.id, tip])
|
|
7945
|
-
);
|
|
7946
|
-
function tipsByIds(ids) {
|
|
7947
|
-
return ids.map((id) => tipsById[id]).filter((tip) => tip !== void 0);
|
|
7948
|
-
}
|
|
7949
7971
|
|
|
7950
7972
|
// src/ui/Tips.tsx
|
|
7951
7973
|
import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
7952
7974
|
var TICK_MS = 16;
|
|
7953
7975
|
var CHUNK_HOLD_MS = 2e3;
|
|
7954
|
-
var
|
|
7976
|
+
var TIP_DURATION_MS = 25e3;
|
|
7955
7977
|
function TipTitle({ children }) {
|
|
7956
7978
|
return /* @__PURE__ */ jsxs19(Box21, { gap: 1, children: [
|
|
7957
7979
|
/* @__PURE__ */ jsx20(Text22, { color: "cyan", children: "\u2726" }),
|
|
@@ -8008,45 +8030,53 @@ function TipContent({
|
|
|
8008
8030
|
] }, j)) }, i)
|
|
8009
8031
|
) });
|
|
8010
8032
|
}
|
|
8011
|
-
var
|
|
8033
|
+
var noPauseAfterText = [
|
|
8034
|
+
"highlight",
|
|
8035
|
+
"link",
|
|
8036
|
+
"codeword"
|
|
8037
|
+
];
|
|
8038
|
+
function revealSchedule(tip) {
|
|
8039
|
+
const segments = [
|
|
8040
|
+
{ type: "text", value: tip.title },
|
|
8041
|
+
...tip.chunks
|
|
8042
|
+
];
|
|
8043
|
+
const schedule = [];
|
|
8044
|
+
let at = 0;
|
|
8045
|
+
segments.forEach((segment, i) => {
|
|
8046
|
+
for (let c = 0; c < segment.value.length; c++) {
|
|
8047
|
+
const pause = i > 0 && c === 0 && !noPauseAfterText.includes(segment.type);
|
|
8048
|
+
at += pause ? CHUNK_HOLD_MS : TICK_MS;
|
|
8049
|
+
schedule.push(at);
|
|
8050
|
+
}
|
|
8051
|
+
});
|
|
8052
|
+
return schedule;
|
|
8053
|
+
}
|
|
8054
|
+
var clock = { tipIndex: 0, elapsedMs: 0, complete: false };
|
|
8012
8055
|
function Tips({
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
onRevealStateChange
|
|
8056
|
+
onRevealStateChange,
|
|
8057
|
+
onComplete
|
|
8016
8058
|
}) {
|
|
8017
|
-
const
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
const tip =
|
|
8027
|
-
const
|
|
8028
|
-
const
|
|
8029
|
-
const
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
const
|
|
8034
|
-
"highlight",
|
|
8035
|
-
"link",
|
|
8036
|
-
"codeword"
|
|
8037
|
-
];
|
|
8038
|
-
const chunkBoundaries = [];
|
|
8039
|
-
let cumulative = 0;
|
|
8040
|
-
for (let i = 0; i < segments.length - 1; i++) {
|
|
8041
|
-
cumulative += segments[i].length;
|
|
8042
|
-
const skipPause = noPauseAfterText.includes(
|
|
8043
|
-
segments[i + 1].type
|
|
8044
|
-
);
|
|
8045
|
-
if (!skipPause) chunkBoundaries.push(cumulative);
|
|
8046
|
-
}
|
|
8047
|
-
const revealState = tips2.length === 0 ? "idle" : revealed < totalLength ? "revealing" : "revealed";
|
|
8059
|
+
const [position, setPosition] = useState11(() => {
|
|
8060
|
+
const now = Date.now();
|
|
8061
|
+
return {
|
|
8062
|
+
tipIndex: clock.tipIndex,
|
|
8063
|
+
startedAt: now - clock.elapsedMs,
|
|
8064
|
+
now,
|
|
8065
|
+
complete: clock.complete
|
|
8066
|
+
};
|
|
8067
|
+
});
|
|
8068
|
+
const tip = tips[position.tipIndex];
|
|
8069
|
+
const elapsedMs = position.now - position.startedAt;
|
|
8070
|
+
const schedule = revealSchedule(tip);
|
|
8071
|
+
const revealed = schedule.filter((at) => at <= elapsedMs).length;
|
|
8072
|
+
const fullyTyped = revealed === schedule.length;
|
|
8073
|
+
const nextAt = fullyTyped ? TIP_DURATION_MS : schedule[revealed];
|
|
8074
|
+
const midSentence = !fullyTyped && revealed > 0 && nextAt - schedule[revealed - 1] === TICK_MS;
|
|
8075
|
+
const revealState = position.complete ? "idle" : midSentence ? "typing" : "resting";
|
|
8048
8076
|
const onRevealStateChangeRef = useRef4(onRevealStateChange);
|
|
8049
8077
|
onRevealStateChangeRef.current = onRevealStateChange;
|
|
8078
|
+
const onCompleteRef = useRef4(onComplete);
|
|
8079
|
+
onCompleteRef.current = onComplete;
|
|
8050
8080
|
const reportedRef = useRef4(null);
|
|
8051
8081
|
useEffect3(() => {
|
|
8052
8082
|
if (reportedRef.current === revealState) return;
|
|
@@ -8055,30 +8085,35 @@ function Tips({
|
|
|
8055
8085
|
}, [revealState]);
|
|
8056
8086
|
useEffect3(() => () => onRevealStateChangeRef.current?.("idle"), []);
|
|
8057
8087
|
useEffect3(() => {
|
|
8058
|
-
if (
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
const timer2 = setTimeout(() => {
|
|
8062
|
-
setRevealed((r) => {
|
|
8063
|
-
const next = r + 1;
|
|
8064
|
-
progress.revealed = next;
|
|
8065
|
-
return next;
|
|
8066
|
-
});
|
|
8067
|
-
}, delay2);
|
|
8068
|
-
return () => clearTimeout(timer2);
|
|
8088
|
+
if (position.complete) {
|
|
8089
|
+
onCompleteRef.current?.();
|
|
8090
|
+
return;
|
|
8069
8091
|
}
|
|
8070
8092
|
const timer = setTimeout(() => {
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8093
|
+
const now = Date.now();
|
|
8094
|
+
const tipComplete = now - position.startedAt >= TIP_DURATION_MS;
|
|
8095
|
+
if (tipComplete && position.tipIndex === tips.length - 1) {
|
|
8096
|
+
clock.complete = true;
|
|
8097
|
+
setPosition({ ...position, now, complete: true });
|
|
8098
|
+
return;
|
|
8099
|
+
}
|
|
8100
|
+
setPosition(
|
|
8101
|
+
tipComplete ? {
|
|
8102
|
+
tipIndex: position.tipIndex + 1,
|
|
8103
|
+
startedAt: now,
|
|
8104
|
+
now,
|
|
8105
|
+
complete: false
|
|
8106
|
+
} : { ...position, now }
|
|
8107
|
+
);
|
|
8108
|
+
}, nextAt - elapsedMs);
|
|
8109
|
+
return () => {
|
|
8110
|
+
clearTimeout(timer);
|
|
8111
|
+
if (clock.complete) return;
|
|
8112
|
+
clock.tipIndex = position.tipIndex;
|
|
8113
|
+
clock.elapsedMs = Date.now() - position.startedAt;
|
|
8114
|
+
};
|
|
8115
|
+
}, [position, nextAt, elapsedMs]);
|
|
8116
|
+
if (position.complete) return null;
|
|
8082
8117
|
const titleRevealed = tip.title.slice(0, revealed);
|
|
8083
8118
|
const contentRevealed = Math.max(0, revealed - tip.title.length);
|
|
8084
8119
|
return /* @__PURE__ */ jsxs19(Box21, { flexDirection: "column", marginBottom: 1, gap: 1, children: [
|
|
@@ -8146,17 +8181,16 @@ function App() {
|
|
|
8146
8181
|
const compactRun = isCompactTerminal(columns, rows);
|
|
8147
8182
|
const [showLogs, setShowLogs] = useState12(false);
|
|
8148
8183
|
const [tipState, setTipState] = useState12("idle");
|
|
8184
|
+
const [tipsComplete, setTipsComplete] = useState12(false);
|
|
8149
8185
|
const finished = phase === "done" || phase === "error";
|
|
8150
8186
|
const currentStep = steps[currentStepIndex];
|
|
8151
|
-
const
|
|
8152
|
-
const
|
|
8153
|
-
const
|
|
8187
|
+
const workflowDef = workflow ? getWorkflow(workflow.id) : void 0;
|
|
8188
|
+
const stepHidesTips = workflowDef?.steps.find((s) => s.id === currentStep?.id)?.hideTips === true;
|
|
8189
|
+
const tipsActive = workflowDef?.tips === true && !tipsComplete && !stepHidesTips;
|
|
8154
8190
|
const isAwaitingUserInput = phase === "awaitingInput" && !!inputReq;
|
|
8155
|
-
const
|
|
8156
|
-
const
|
|
8157
|
-
const
|
|
8158
|
-
const showTips = !compactRun && stepHasTips && (phase === "running" && currentStep?.status === "running" && !loadingMessage && !settingUpAppId || isCommandApprovalPrompt);
|
|
8159
|
-
const showNoticesInMain = !stepHasTips;
|
|
8191
|
+
const holdForTip = !compactRun && tipsActive && isAwaitingUserInput && tipState === "typing";
|
|
8192
|
+
const showTips = !compactRun && tipsActive && (phase === "running" && currentStep?.status === "running" && !loadingMessage && !settingUpAppId || holdForTip);
|
|
8193
|
+
const showNoticesInMain = !tipsActive;
|
|
8160
8194
|
const showNotices = !compactRun && (!isAwaitingUserInput || holdForTip) && !review2;
|
|
8161
8195
|
useInput9(
|
|
8162
8196
|
(_input, key) => {
|
|
@@ -8251,12 +8285,11 @@ function App() {
|
|
|
8251
8285
|
loadingMessage
|
|
8252
8286
|
] }) }),
|
|
8253
8287
|
/* @__PURE__ */ jsx21(CliOutput, {}),
|
|
8254
|
-
showTips &&
|
|
8288
|
+
showTips && /* @__PURE__ */ jsx21(
|
|
8255
8289
|
Tips,
|
|
8256
8290
|
{
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
onRevealStateChange: setTipState
|
|
8291
|
+
onRevealStateChange: setTipState,
|
|
8292
|
+
onComplete: () => setTipsComplete(true)
|
|
8260
8293
|
}
|
|
8261
8294
|
),
|
|
8262
8295
|
showNoticesInMain && showNotices && /* @__PURE__ */ jsx21(Notices, { showAll: true, border: false }),
|
|
@@ -8267,8 +8300,7 @@ function App() {
|
|
|
8267
8300
|
error
|
|
8268
8301
|
] }) })
|
|
8269
8302
|
] }),
|
|
8270
|
-
!showNoticesInMain && showNotices && /* @__PURE__ */ jsx21(Notices, {})
|
|
8271
|
-
showTips && !holdForTip && /* @__PURE__ */ jsx21(PromptInput, {})
|
|
8303
|
+
!showNoticesInMain && showNotices && /* @__PURE__ */ jsx21(Notices, {})
|
|
8272
8304
|
]
|
|
8273
8305
|
}
|
|
8274
8306
|
),
|
|
@@ -8515,7 +8547,7 @@ async function resetProjectState() {
|
|
|
8515
8547
|
// package.json with { type: 'json' }
|
|
8516
8548
|
var package_default2 = {
|
|
8517
8549
|
name: "@algolia/wizard",
|
|
8518
|
-
version: "0.
|
|
8550
|
+
version: "0.81.0",
|
|
8519
8551
|
description: "Magically implement Algolia functionality in your codebase",
|
|
8520
8552
|
type: "module",
|
|
8521
8553
|
engines: {
|