@algolia/wizard 0.56.0 → 0.57.0-rc.151.376

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 +137 -11
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -3811,7 +3811,7 @@ async function runAnalysis(mode, extraInstructions = []) {
3811
3811
  // package.json
3812
3812
  var package_default = {
3813
3813
  name: "@algolia/wizard",
3814
- version: "0.56.0",
3814
+ version: "0.57.0-rc.151.376",
3815
3815
  description: "Magically implement Algolia functionality in your codebase",
3816
3816
  type: "module",
3817
3817
  engines: {
@@ -6640,8 +6640,122 @@ function delay(ms) {
6640
6640
  });
6641
6641
  }
6642
6642
 
6643
+ // package.json with { type: 'json' }
6644
+ var package_default2 = {
6645
+ name: "@algolia/wizard",
6646
+ version: "0.57.0-rc.151.376",
6647
+ description: "Magically implement Algolia functionality in your codebase",
6648
+ type: "module",
6649
+ engines: {
6650
+ node: ">=24"
6651
+ },
6652
+ bin: {
6653
+ wizard: "dist/main.js"
6654
+ },
6655
+ files: [
6656
+ "dist",
6657
+ "docs"
6658
+ ],
6659
+ scripts: {
6660
+ "build:proxy": "node scripts/build.mjs proxy",
6661
+ build: "node scripts/build.mjs",
6662
+ "dev:proxy": "touch .env && NODE_OPTIONS=--use-system-ca tsx watch --env-file=.env src/proxy/index.ts",
6663
+ dev: "touch .env && tsx --env-file=.env ./src/main.tsx",
6664
+ "env:load": "pnpm exec -- varlock load",
6665
+ prepare: "husky",
6666
+ prepublishOnly: "pnpm build",
6667
+ reset: "tsx ./scripts/reset-state.ts",
6668
+ "test:fixtures": "touch .env && tsx --env-file=.env ./fixtures/run-fixtures.ts",
6669
+ "test:tools": "tsx ./tool-evals/toolEval.ts",
6670
+ "test:tools:improve": "tsx ./tool-evals/improveFromPlan.ts",
6671
+ test: "vitest",
6672
+ typecheck: "tsc --noEmit -p tsconfig.json"
6673
+ },
6674
+ keywords: [],
6675
+ author: "",
6676
+ license: "ISC",
6677
+ packageManager: "pnpm@11.9.0+sha512.bd682d5d03fe525ef7c9fd6780c6884d1e756ac4c9c9fe00c538782824310dcf90e3ddc4f53835f06dfaebd5085e41855e0bcbb3b60de2ac5bbab89e5036f03b",
6678
+ devDependencies: {
6679
+ "@clack/prompts": "^1.6.0",
6680
+ "@types/ioredis-mock": "^8.2.7",
6681
+ "@types/node": "^25.9.1",
6682
+ "@types/react": "^19.2.16",
6683
+ esbuild: "^0.28.0",
6684
+ husky: "^9.1.7",
6685
+ "ink-testing-library": "^4.0.0",
6686
+ "ioredis-mock": "^8.13.1",
6687
+ "lint-staged": "^17.0.8",
6688
+ tsx: "^4.22.3",
6689
+ typescript: "^6.0.3",
6690
+ vitest: "^4.1.8"
6691
+ },
6692
+ dependencies: {
6693
+ "@ai-sdk/anthropic": "^3.0.81",
6694
+ "@ai-sdk/openai-compatible": "^2.0.47",
6695
+ "@hono/node-server": "^2.0.10",
6696
+ "@segment/analytics-node": "^3.1.0",
6697
+ ai: "^6.0.190",
6698
+ "cross-keychain": "^1.1.0",
6699
+ dotenv: "^17.4.2",
6700
+ hono: "^4.12.27",
6701
+ ink: "^7.0.5",
6702
+ "ink-picture": "^2.1.0",
6703
+ "ink-spinner": "^5.0.0",
6704
+ ioredis: "^5.11.1",
6705
+ nanoid: "^5.1.15",
6706
+ pino: "^10.3.1",
6707
+ react: "^19.2.7",
6708
+ "terminal-link": "^5.0.0",
6709
+ varlock: "^1.5.1",
6710
+ zod: "^4.4.3",
6711
+ zustand: "^5.0.14"
6712
+ }
6713
+ };
6714
+
6715
+ // src/lib/checkVersion.ts
6716
+ function isReleaseCandidate(version) {
6717
+ return version.includes("rc");
6718
+ }
6719
+ function parseVersion(version) {
6720
+ const [major = 0, minor = 0, patch = 0] = version.split("-")[0].split(".").map((part) => Number.parseInt(part, 10) || 0);
6721
+ return [major, minor, patch];
6722
+ }
6723
+ function isOlder(local, remote) {
6724
+ const a = parseVersion(local);
6725
+ const b = parseVersion(remote);
6726
+ for (let i = 0; i < 3; i++) {
6727
+ if (a[i] !== b[i]) return a[i] < b[i];
6728
+ }
6729
+ return false;
6730
+ }
6731
+ async function checkVersion() {
6732
+ if (isReleaseCandidate(package_default2.version)) return false;
6733
+ try {
6734
+ const res = await fetch(
6735
+ "https://registry.npmjs.org/@algolia/wizard/latest",
6736
+ { signal: AbortSignal.timeout(3e3) }
6737
+ );
6738
+ if (!res.ok) {
6739
+ throw Error(`npmjs registry responded ${res.status}`);
6740
+ }
6741
+ const { version } = await res.json();
6742
+ if (typeof version !== "string") {
6743
+ throw Error("npmjs registry returned no version");
6744
+ }
6745
+ return isOlder(package_default2.version, version);
6746
+ } catch {
6747
+ logger.error("Could not resolve remote version number from npmjs registry");
6748
+ return false;
6749
+ }
6750
+ }
6751
+
6643
6752
  // src/main.tsx
6644
6753
  import { jsx as jsx20 } from "react/jsx-runtime";
6754
+ async function exitProcessWithError(store, instance, message) {
6755
+ store.setError(message);
6756
+ await instance.waitUntilExit();
6757
+ process.exit(1);
6758
+ }
6645
6759
  async function startup() {
6646
6760
  setProjectRoot(process.cwd());
6647
6761
  let args;
@@ -6694,6 +6808,14 @@ async function run(opts) {
6694
6808
  const store = useWizard.getState();
6695
6809
  const instance = render(/* @__PURE__ */ jsx20(App, {}), { incrementalRendering: true });
6696
6810
  await store.waitForStart();
6811
+ const wizardOutdated = await checkVersion();
6812
+ if (wizardOutdated) {
6813
+ await exitProcessWithError(
6814
+ store,
6815
+ instance,
6816
+ "You have loaded an old version of the Wizard. Please use @algolia/wizard@latest"
6817
+ );
6818
+ }
6697
6819
  store.syncSteps(
6698
6820
  workflow.steps.map((s) => ({
6699
6821
  id: s.id,
@@ -6709,18 +6831,20 @@ async function run(opts) {
6709
6831
  try {
6710
6832
  await runAuthLogin();
6711
6833
  } catch (err) {
6712
- store.setError(err instanceof Error ? err.message : String(err));
6713
- await instance.waitUntilExit();
6714
- process.exit(1);
6834
+ await exitProcessWithError(
6835
+ store,
6836
+ instance,
6837
+ err instanceof Error ? err.message : String(err)
6838
+ );
6715
6839
  }
6716
6840
  store.endAuth();
6717
6841
  user = await getUser();
6718
6842
  if (!user) {
6719
- store.setError(
6843
+ await exitProcessWithError(
6844
+ store,
6845
+ instance,
6720
6846
  "Authentication completed but no Algolia user was returned. Try running `npx @algolia/cli@latest auth login` directly."
6721
6847
  );
6722
- await instance.waitUntilExit();
6723
- process.exit(1);
6724
6848
  }
6725
6849
  }
6726
6850
  store.setUser(user);
@@ -6730,12 +6854,14 @@ async function run(opts) {
6730
6854
  app = await ensureApplication(
6731
6855
  resumableState ? runAppId(resumableState) : void 0
6732
6856
  );
6857
+ runWorkflow(workflow, app.id, { skipResumePrompt, resumableState });
6733
6858
  } catch (err) {
6734
- store.setError(err instanceof Error ? err.message : String(err));
6735
- await instance.waitUntilExit();
6736
- process.exit(1);
6859
+ await exitProcessWithError(
6860
+ store,
6861
+ instance,
6862
+ err instanceof Error ? err.message : String(err)
6863
+ );
6737
6864
  }
6738
- runWorkflow(workflow, app.id, { skipResumePrompt, resumableState });
6739
6865
  }
6740
6866
  await requestTerminalSize();
6741
6867
  var started = await startup();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algolia/wizard",
3
- "version": "0.56.0",
3
+ "version": "0.57.0-rc.151.376",
4
4
  "description": "Magically implement Algolia functionality in your codebase",
5
5
  "type": "module",
6
6
  "engines": {