@algolia/wizard 0.6.0-rc.51.26 → 0.6.0-rc.51.33
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 +57 -18
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -2155,11 +2155,11 @@ function writeCredentialsTool(ctx) {
|
|
|
2155
2155
|
// src/lib/tools/searchFiles.ts
|
|
2156
2156
|
import { tool as tool7 } from "ai";
|
|
2157
2157
|
import z10 from "zod";
|
|
2158
|
-
import { readdir as readdir3, readFile as
|
|
2158
|
+
import { readdir as readdir3, readFile as readFile8 } from "node:fs/promises";
|
|
2159
2159
|
import { join as join10 } from "node:path";
|
|
2160
2160
|
|
|
2161
2161
|
// src/lib/languages.ts
|
|
2162
|
-
import { readdir as readdir2 } from "node:fs/promises";
|
|
2162
|
+
import { readdir as readdir2, readFile as readFile7 } from "node:fs/promises";
|
|
2163
2163
|
import { existsSync as existsSync2 } from "node:fs";
|
|
2164
2164
|
import { join as join9 } from "node:path";
|
|
2165
2165
|
|
|
@@ -2304,6 +2304,10 @@ var LANGUAGE_PROFILES = {
|
|
|
2304
2304
|
docKey: "python"
|
|
2305
2305
|
},
|
|
2306
2306
|
ingestEntrypointExample: `${INGEST_DIR}/ingest.py`,
|
|
2307
|
+
localSourceCaveat: {
|
|
2308
|
+
unless: "requirements.txt",
|
|
2309
|
+
message: "The ingestion script runs in its own environment under .algolia-wizard/, so it can install the Algolia client but not this project's packages (no requirements.txt to install from). If the script needs your database driver or ORM, add those packages to .algolia-wizard/requirements.txt and re-run the install."
|
|
2310
|
+
},
|
|
2307
2311
|
verification: [
|
|
2308
2312
|
{
|
|
2309
2313
|
// -x skips the venv this same directory holds; without it the check
|
|
@@ -2431,6 +2435,7 @@ var LANGUAGE_PROFILES = {
|
|
|
2431
2435
|
{
|
|
2432
2436
|
id: "maven",
|
|
2433
2437
|
detectFiles: ["pom.xml"],
|
|
2438
|
+
sdkVersionPin: "[4,5)",
|
|
2434
2439
|
dependency: { mode: "agent-declares", file: "pom.xml" },
|
|
2435
2440
|
installSteps: [{ argv: ["mvn", "-q", "-DskipTests", "compile"] }],
|
|
2436
2441
|
// The main class is a wizard constant the instructions require the agent
|
|
@@ -2462,7 +2467,8 @@ var LANGUAGE_PROFILES = {
|
|
|
2462
2467
|
ingest: {
|
|
2463
2468
|
kind: "manual",
|
|
2464
2469
|
entrypointExtensions: [".java"],
|
|
2465
|
-
runCommand: "./gradlew runAlgoliaIngest"
|
|
2470
|
+
runCommand: "./gradlew runAlgoliaIngest",
|
|
2471
|
+
requiresBuildTask: "runAlgoliaIngest"
|
|
2466
2472
|
}
|
|
2467
2473
|
}
|
|
2468
2474
|
],
|
|
@@ -2504,7 +2510,8 @@ var LANGUAGE_PROFILES = {
|
|
|
2504
2510
|
ingest: {
|
|
2505
2511
|
kind: "manual",
|
|
2506
2512
|
entrypointExtensions: [".kt"],
|
|
2507
|
-
runCommand: "./gradlew runAlgoliaIngest"
|
|
2513
|
+
runCommand: "./gradlew runAlgoliaIngest",
|
|
2514
|
+
requiresBuildTask: "runAlgoliaIngest"
|
|
2508
2515
|
}
|
|
2509
2516
|
},
|
|
2510
2517
|
// Kotlin/Maven is rare but real, and pom.xml is a Kotlin manifest — without
|
|
@@ -2514,6 +2521,7 @@ var LANGUAGE_PROFILES = {
|
|
|
2514
2521
|
{
|
|
2515
2522
|
id: "maven",
|
|
2516
2523
|
detectFiles: ["pom.xml"],
|
|
2524
|
+
sdkVersionPin: "[3,4)",
|
|
2517
2525
|
dependency: { mode: "agent-declares", file: "pom.xml" },
|
|
2518
2526
|
installSteps: [{ argv: ["mvn", "-q", "-DskipTests", "compile"] }],
|
|
2519
2527
|
ingest: {
|
|
@@ -2798,15 +2806,15 @@ async function pickIngestionCandidates(root, confirmedNames) {
|
|
|
2798
2806
|
return { candidates, confirmed: confirmed3, onDisk };
|
|
2799
2807
|
}
|
|
2800
2808
|
async function resolveToolchain(root, profile2) {
|
|
2809
|
+
const signals = (pm) => [
|
|
2810
|
+
...pm.lockfiles ?? [],
|
|
2811
|
+
...pm.detectFiles ?? []
|
|
2812
|
+
];
|
|
2801
2813
|
const matched = profile2.packageManagers.find(
|
|
2802
|
-
(pm) =>
|
|
2803
|
-
(f) => existsSync2(join9(root, f))
|
|
2804
|
-
)
|
|
2805
|
-
);
|
|
2806
|
-
const packageManager = resolveDeclaredManifest(
|
|
2807
|
-
root,
|
|
2808
|
-
matched ?? profile2.packageManagers[0]
|
|
2814
|
+
(pm) => signals(pm).some((f) => existsSync2(join9(root, f)))
|
|
2809
2815
|
);
|
|
2816
|
+
const fallback = profile2.packageManagers.find((pm) => signals(pm).length === 0) ?? profile2.packageManagers[0];
|
|
2817
|
+
const packageManager = resolveDeclaredManifest(root, matched ?? fallback);
|
|
2810
2818
|
let { installSteps, ingest } = packageManager;
|
|
2811
2819
|
installSteps = installSteps.map(
|
|
2812
2820
|
(step) => isWorktreeRelativeCommand(step.argv[0]) ? { ...step, argv: withCommand(step.argv, join9(root, step.argv[0])) } : step
|
|
@@ -2847,9 +2855,27 @@ function ingestScriptDir(profile2) {
|
|
|
2847
2855
|
const parts = profile2.ingestEntrypointExample.split("/");
|
|
2848
2856
|
return parts.slice(0, -1).join("/") || ".";
|
|
2849
2857
|
}
|
|
2858
|
+
function localSourceLimitation(root, profile2) {
|
|
2859
|
+
const caveat = profile2.localSourceCaveat;
|
|
2860
|
+
if (!caveat) return void 0;
|
|
2861
|
+
return existsSync2(join9(root, caveat.unless)) ? void 0 : caveat.message;
|
|
2862
|
+
}
|
|
2863
|
+
async function missingBuildTask(root, toolchain) {
|
|
2864
|
+
const { ingest, packageManager } = toolchain;
|
|
2865
|
+
if (ingest.kind !== "manual" || !ingest.requiresBuildTask) return void 0;
|
|
2866
|
+
if (packageManager.dependency.mode !== "agent-declares") return void 0;
|
|
2867
|
+
const buildFile = join9(root, packageManager.dependency.file);
|
|
2868
|
+
const contents = await readFile7(buildFile, "utf8").catch(() => void 0);
|
|
2869
|
+
if (contents === void 0) return void 0;
|
|
2870
|
+
return contents.includes(ingest.requiresBuildTask) ? void 0 : ingest.requiresBuildTask;
|
|
2871
|
+
}
|
|
2872
|
+
function sdkVersionPin(profile2, packageManager) {
|
|
2873
|
+
return packageManager.sdkVersionPin ?? profile2.sdk.versionPin;
|
|
2874
|
+
}
|
|
2850
2875
|
function dependencyInstruction(toolchain) {
|
|
2851
2876
|
const { profile: profile2, packageManager } = toolchain;
|
|
2852
|
-
const { packageName
|
|
2877
|
+
const { packageName } = profile2.sdk;
|
|
2878
|
+
const versionPin = sdkVersionPin(profile2, packageManager);
|
|
2853
2879
|
const also = profile2.sdk.alsoRequires ? ` ${profile2.sdk.alsoRequires}` : "";
|
|
2854
2880
|
switch (packageManager.dependency.mode) {
|
|
2855
2881
|
case "wizard-installs":
|
|
@@ -2900,7 +2926,7 @@ function searchFilesTool(ctx) {
|
|
|
2900
2926
|
for (const file of await walkFiles(resolved.target)) {
|
|
2901
2927
|
let content;
|
|
2902
2928
|
try {
|
|
2903
|
-
content = await
|
|
2929
|
+
content = await readFile8(file, "utf8");
|
|
2904
2930
|
} catch {
|
|
2905
2931
|
continue;
|
|
2906
2932
|
}
|
|
@@ -3467,7 +3493,7 @@ async function runAnalysis(mode, extraInstructions = []) {
|
|
|
3467
3493
|
// package.json
|
|
3468
3494
|
var package_default = {
|
|
3469
3495
|
name: "@algolia/wizard",
|
|
3470
|
-
version: "0.6.0-rc.51.
|
|
3496
|
+
version: "0.6.0-rc.51.33",
|
|
3471
3497
|
description: "Magically implement Algolia functionality in your codebase",
|
|
3472
3498
|
type: "module",
|
|
3473
3499
|
engines: {
|
|
@@ -3489,7 +3515,7 @@ var package_default = {
|
|
|
3489
3515
|
prepare: "husky",
|
|
3490
3516
|
prepublishOnly: "pnpm build",
|
|
3491
3517
|
reset: "tsx ./scripts/reset-state.ts",
|
|
3492
|
-
"test:
|
|
3518
|
+
"test:toolchains": "tsx ./scripts/verify-toolchains.ts",
|
|
3493
3519
|
"test:tools": "tsx ./tool-evals/toolEval.ts",
|
|
3494
3520
|
test: "vitest",
|
|
3495
3521
|
typecheck: "tsc --noEmit -p tsconfig.json"
|
|
@@ -3977,7 +4003,7 @@ import z24 from "zod";
|
|
|
3977
4003
|
// src/lib/worktree.ts
|
|
3978
4004
|
import { execFile } from "node:child_process";
|
|
3979
4005
|
import { existsSync as existsSync4 } from "node:fs";
|
|
3980
|
-
import { copyFile, mkdir as mkdir6, readdir as readdir4, readFile as
|
|
4006
|
+
import { copyFile, mkdir as mkdir6, readdir as readdir4, readFile as readFile9, stat as stat2, writeFile as writeFile6 } from "node:fs/promises";
|
|
3981
4007
|
import {
|
|
3982
4008
|
basename as basename2,
|
|
3983
4009
|
dirname as dirname7,
|
|
@@ -4188,7 +4214,7 @@ async function writeSearchEnvValues(worktreePath, vars) {
|
|
|
4188
4214
|
const target = join12(worktreePath, ".env");
|
|
4189
4215
|
let existing = "";
|
|
4190
4216
|
try {
|
|
4191
|
-
existing = await
|
|
4217
|
+
existing = await readFile9(target, "utf8");
|
|
4192
4218
|
} catch (err) {
|
|
4193
4219
|
if (err.code !== "ENOENT") throw err;
|
|
4194
4220
|
}
|
|
@@ -4465,7 +4491,7 @@ function ingestionInstructions(input) {
|
|
|
4465
4491
|
const { ingestionProfile: profile2, toolchain } = input;
|
|
4466
4492
|
const { ingest } = toolchain;
|
|
4467
4493
|
const extensions = ingest.entrypointExtensions.join(", ");
|
|
4468
|
-
const runInstruction = ingest.kind === "auto" ? `Return "entrypoint": the script path relative to the worktree root (e.g. "${profile2.ingestEntrypointExample}"), ending in one of ${extensions}. The wizard runs it with \`${describeIngestCommand(ingest, profile2.ingestEntrypointExample)}\`, so it must be a plain path with no flags or arguments and must run as-is under that command.` : `Return "entrypoint": the script path relative to the worktree root (e.g. "${profile2.ingestEntrypointExample}"), ending in one of ${extensions}. The wizard does NOT run ${profile2.displayName} ${toolchain.packageManager.id} projects itself \u2014 it tells the developer to run \`${describeIngestCommand(ingest, profile2.ingestEntrypointExample)}\`, so also add whatever build configuration that command needs.`;
|
|
4494
|
+
const runInstruction = ingest.kind === "auto" ? `Return "entrypoint": the script path relative to the worktree root (e.g. "${profile2.ingestEntrypointExample}"), ending in one of ${extensions}. The wizard runs it with \`${describeIngestCommand(ingest, profile2.ingestEntrypointExample)}\`, so it must be a plain path with no flags or arguments and must run as-is under that command.` : `Return "entrypoint": the script path relative to the worktree root (e.g. "${profile2.ingestEntrypointExample}"), ending in one of ${extensions}. The wizard does NOT run ${profile2.displayName} ${toolchain.packageManager.id} projects itself \u2014 it tells the developer to run \`${describeIngestCommand(ingest, profile2.ingestEntrypointExample)}\`, so also add whatever build configuration that command needs${ingest.kind === "manual" && ingest.requiresBuildTask ? `, including a "${ingest.requiresBuildTask}" task in "${toolchain.packageManager.dependency.mode === "agent-declares" ? toolchain.packageManager.dependency.file : "the build file"}" that runs the script` : ""}.`;
|
|
4469
4495
|
return [
|
|
4470
4496
|
...input.confirmed && input.confirmed.length ? [
|
|
4471
4497
|
`Write the ingestion script in ${profile2.displayName}, at "${ingestScriptDir(profile2)}/" in the repo.`,
|
|
@@ -4894,6 +4920,19 @@ ${run.output}` : status;
|
|
|
4894
4920
|
commandMessages.push(
|
|
4895
4921
|
`The wizard does not run ${ingestionProfile.displayName} ${toolchain.packageManager.id} projects \u2014 run the command above yourself to ingest.`
|
|
4896
4922
|
);
|
|
4923
|
+
const missingTask = await missingBuildTask(worktree, toolchain);
|
|
4924
|
+
if (missingTask) {
|
|
4925
|
+
const warning = `\u26A0\uFE0F The command above needs a "${missingTask}" task, which is not in ${toolchain.packageManager.dependency.mode === "agent-declares" ? toolchain.packageManager.dependency.file : "the build file"} \u2014 add it before running, or run the script through your IDE instead.`;
|
|
4926
|
+
commandMessages.push(warning);
|
|
4927
|
+
summaries.push(warning);
|
|
4928
|
+
}
|
|
4929
|
+
}
|
|
4930
|
+
}
|
|
4931
|
+
if (ingestionSource === "local") {
|
|
4932
|
+
const limitation = localSourceLimitation(worktree, ingestionProfile);
|
|
4933
|
+
if (limitation) {
|
|
4934
|
+
commandMessages.push(`\u26A0\uFE0F ${limitation}`);
|
|
4935
|
+
summaries.push(`\u26A0\uFE0F ${limitation}`);
|
|
4897
4936
|
}
|
|
4898
4937
|
}
|
|
4899
4938
|
await ctx.requestUserInput({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@algolia/wizard",
|
|
3
|
-
"version": "0.6.0-rc.51.
|
|
3
|
+
"version": "0.6.0-rc.51.33",
|
|
4
4
|
"description": "Magically implement Algolia functionality in your codebase",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"prepare": "husky",
|
|
23
23
|
"prepublishOnly": "pnpm build",
|
|
24
24
|
"reset": "tsx ./scripts/reset-state.ts",
|
|
25
|
-
"test:
|
|
25
|
+
"test:toolchains": "tsx ./scripts/verify-toolchains.ts",
|
|
26
26
|
"test:tools": "tsx ./tool-evals/toolEval.ts",
|
|
27
27
|
"test": "vitest",
|
|
28
28
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|