@algolia/wizard 0.29.0 → 0.30.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.
Files changed (2) hide show
  1. package/dist/main.js +16 -24
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -2220,8 +2220,20 @@ function reconcileWorkflowState(state, workflow) {
2220
2220
  const definedIds = workflow.steps.map((s) => s.id).join("\n");
2221
2221
  if (persistedIds !== definedIds) return null;
2222
2222
  for (let i = 0; i < state.steps.length; i++) {
2223
- state.steps[i].title = workflow.steps[i].title;
2224
- state.steps[i].visible = workflow.steps[i].visible;
2223
+ const record = state.steps[i];
2224
+ const step = workflow.steps[i];
2225
+ if (record.status === "done") {
2226
+ const parsed = step.outputSchema.safeParse(record.output);
2227
+ if (!parsed.success) {
2228
+ logger.warn(
2229
+ { stepId: step.id, issues: parsed.error.issues },
2230
+ "reconcileWorkflowState: persisted output for a completed step no longer matches its schema; restarting the run from scratch"
2231
+ );
2232
+ return null;
2233
+ }
2234
+ }
2235
+ record.title = step.title;
2236
+ record.visible = step.visible;
2225
2237
  }
2226
2238
  return state;
2227
2239
  }
@@ -3559,28 +3571,9 @@ import { tool as tool9 } from "ai";
3559
3571
  import z16 from "zod";
3560
3572
  import { stat as stat2 } from "node:fs/promises";
3561
3573
  import { relative as relative5 } from "node:path";
3562
-
3563
- // src/lib/editor.ts
3564
- import { spawn as spawn3 } from "node:child_process";
3565
- function openInEditor(filePath) {
3566
- const { command, args } = process.platform === "darwin" ? (
3567
- // -t forces the default *text* editor; plain `open` on an extension
3568
- // with no handler (.mjs, .py) pops a "choose an application" dialog.
3569
- { command: "open", args: ["-t", filePath] }
3570
- ) : process.platform === "win32" ? { command: "cmd", args: ["/c", "start", "", filePath] } : { command: "xdg-open", args: [filePath] };
3571
- try {
3572
- const child = spawn3(command, args, { stdio: "ignore", detached: true });
3573
- child.on("error", () => {
3574
- });
3575
- child.unref();
3576
- } catch {
3577
- }
3578
- }
3579
-
3580
- // src/lib/tools/reviewScript.ts
3581
3574
  function reviewScriptTool(ctx) {
3582
3575
  return tool9({
3583
- description: "Show a script you have written to the user and wait while they read it. Call this as soon as the script is finished and before you run it for the first time, so nothing with a side effect happens behind their back. It opens the file in their editor and returns once they have confirmed.",
3576
+ description: "Call this as soon as the ingestion script is finished and before you run it, so the user can review it.It shows the file path and returns once they have confirmed reviewing it.",
3584
3577
  inputSchema: z16.object({
3585
3578
  filePath: z16.string().describe(
3586
3579
  "Path to the script to review, relative to the project root."
@@ -3598,7 +3591,6 @@ function reviewScriptTool(ctx) {
3598
3591
  return `Refused: ${filePath} is not a file. Write the script first, then review the path you wrote.`;
3599
3592
  }
3600
3593
  return serializePrompt(async () => {
3601
- openInEditor(resolved2.target);
3602
3594
  await useWizard.getState().requestUserInput({
3603
3595
  prompt: "",
3604
3596
  promptType: "enterToContinue",
@@ -4046,7 +4038,7 @@ async function runAnalysis(mode, extraInstructions = []) {
4046
4038
  // package.json
4047
4039
  var package_default = {
4048
4040
  name: "@algolia/wizard",
4049
- version: "0.29.0",
4041
+ version: "0.30.0",
4050
4042
  description: "Magically implement Algolia functionality in your codebase",
4051
4043
  type: "module",
4052
4044
  engines: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algolia/wizard",
3
- "version": "0.29.0",
3
+ "version": "0.30.0",
4
4
  "description": "Magically implement Algolia functionality in your codebase",
5
5
  "type": "module",
6
6
  "engines": {