@algolia/wizard 0.9.0-rc.93.95 → 0.9.0-rc.96.109
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 +187 -129
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -17,10 +17,8 @@ function npxArgs(args) {
|
|
|
17
17
|
return ["--yes", "@algolia/cli@latest", ...args];
|
|
18
18
|
}
|
|
19
19
|
var shell = process.platform === "win32";
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
const { ALGOLIA_API_KEY: _adminKey, ...rest } = process.env;
|
|
23
|
-
return rest;
|
|
20
|
+
function mask(text, secret) {
|
|
21
|
+
return secret ? text.replaceAll(secret, "***") : text;
|
|
24
22
|
}
|
|
25
23
|
function lineSplitter(emit) {
|
|
26
24
|
let buffer = "";
|
|
@@ -45,14 +43,12 @@ var stderrSink = (stream, line) => {
|
|
|
45
43
|
if (stream === "stdout") return;
|
|
46
44
|
wizardSink(stream, line);
|
|
47
45
|
};
|
|
48
|
-
function runAlgoliaCli(args, { onOutput,
|
|
46
|
+
function runAlgoliaCli(args, { onOutput, redact } = {}) {
|
|
49
47
|
const store = useWizard.getState();
|
|
50
|
-
const
|
|
48
|
+
const command = mask(args.join(" "), redact);
|
|
49
|
+
const logId = store.logStart("tool", `algolia ${command}`);
|
|
51
50
|
return new Promise((resolve4, reject) => {
|
|
52
|
-
const child = spawn("npx", npxArgs(args), {
|
|
53
|
-
shell,
|
|
54
|
-
env: childEnv(withoutAdminKey)
|
|
55
|
-
});
|
|
51
|
+
const child = spawn("npx", npxArgs(args), { shell });
|
|
56
52
|
let stdout = "";
|
|
57
53
|
let stderr = "";
|
|
58
54
|
const splitters = {
|
|
@@ -79,13 +75,13 @@ function runAlgoliaCli(args, { onOutput, withoutAdminKey } = {}) {
|
|
|
79
75
|
const failed = stderr.trim();
|
|
80
76
|
let detail = "";
|
|
81
77
|
if (failed) {
|
|
82
|
-
detail = `: ${failed}`;
|
|
78
|
+
detail = `: ${mask(failed, redact)}`;
|
|
83
79
|
} else if (stdout.trim()) {
|
|
84
80
|
detail = " (no stderr; stdout withheld \u2014 it may contain credentials)";
|
|
85
81
|
}
|
|
86
82
|
reject(
|
|
87
83
|
new Error(
|
|
88
|
-
`Algolia CLI \`${
|
|
84
|
+
`Algolia CLI \`${command}\` failed (exit ${code})${detail}`
|
|
89
85
|
)
|
|
90
86
|
);
|
|
91
87
|
}
|
|
@@ -2161,7 +2157,7 @@ async function ensureApplication() {
|
|
|
2161
2157
|
}
|
|
2162
2158
|
|
|
2163
2159
|
// src/workflows/default.ts
|
|
2164
|
-
import { z as
|
|
2160
|
+
import { z as z28 } from "zod";
|
|
2165
2161
|
|
|
2166
2162
|
// src/actions/listIndices.ts
|
|
2167
2163
|
import { z as z5 } from "zod";
|
|
@@ -2421,22 +2417,48 @@ function writeFileTool(ctx) {
|
|
|
2421
2417
|
|
|
2422
2418
|
// src/lib/tools/writeAlgoliaCredentials.ts
|
|
2423
2419
|
import { tool as tool6 } from "ai";
|
|
2424
|
-
import
|
|
2420
|
+
import z13 from "zod";
|
|
2425
2421
|
import { mkdir as mkdir4, readFile as readFile4, writeFile as writeFile4 } from "node:fs/promises";
|
|
2426
2422
|
import { dirname as dirname5 } from "node:path";
|
|
2427
2423
|
|
|
2428
2424
|
// src/lib/algoliaApiKey.ts
|
|
2429
|
-
import { z as
|
|
2425
|
+
import { z as z12 } from "zod";
|
|
2430
2426
|
|
|
2431
2427
|
// src/lib/keychain.ts
|
|
2432
|
-
import { getPassword, setPassword } from "cross-keychain";
|
|
2428
|
+
import { deletePassword, getPassword, setPassword } from "cross-keychain";
|
|
2429
|
+
import { z as z11 } from "zod";
|
|
2433
2430
|
var SERVICE = "algolia-wizard";
|
|
2434
|
-
|
|
2431
|
+
var ACCOUNT = "api-keys";
|
|
2432
|
+
var storedKeysSchema = z11.record(z11.string(), z11.string());
|
|
2433
|
+
function entryId(kind, index, appId) {
|
|
2435
2434
|
return `${kind}:${appId}:${index}`;
|
|
2436
2435
|
}
|
|
2436
|
+
async function loadKeys() {
|
|
2437
|
+
const raw = await getPassword(SERVICE, ACCOUNT);
|
|
2438
|
+
if (!raw) return {};
|
|
2439
|
+
let payload;
|
|
2440
|
+
try {
|
|
2441
|
+
payload = JSON.parse(raw);
|
|
2442
|
+
} catch {
|
|
2443
|
+
payload = null;
|
|
2444
|
+
}
|
|
2445
|
+
const keys = storedKeysSchema.safeParse(payload);
|
|
2446
|
+
if (!keys.success) {
|
|
2447
|
+
logger.warn("the stored API keys are unreadable; treating them as empty");
|
|
2448
|
+
return {};
|
|
2449
|
+
}
|
|
2450
|
+
return keys.data;
|
|
2451
|
+
}
|
|
2452
|
+
var queue = Promise.resolve();
|
|
2453
|
+
function serialized(op) {
|
|
2454
|
+
const next = queue.then(op);
|
|
2455
|
+
queue = next.catch(() => {
|
|
2456
|
+
});
|
|
2457
|
+
return next;
|
|
2458
|
+
}
|
|
2437
2459
|
async function readStoredKey(kind, index, appId) {
|
|
2438
2460
|
try {
|
|
2439
|
-
return await
|
|
2461
|
+
return (await loadKeys())[entryId(kind, index, appId)] ?? null;
|
|
2440
2462
|
} catch (err) {
|
|
2441
2463
|
logger.warn(
|
|
2442
2464
|
{ err: err.message, kind, index, appId },
|
|
@@ -2445,19 +2467,40 @@ async function readStoredKey(kind, index, appId) {
|
|
|
2445
2467
|
return null;
|
|
2446
2468
|
}
|
|
2447
2469
|
}
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2470
|
+
function storeKey(kind, index, appId, value) {
|
|
2471
|
+
return serialized(async () => {
|
|
2472
|
+
const id = entryId(kind, index, appId);
|
|
2473
|
+
try {
|
|
2474
|
+
const keys = await loadKeys();
|
|
2475
|
+
await setPassword(
|
|
2476
|
+
SERVICE,
|
|
2477
|
+
ACCOUNT,
|
|
2478
|
+
JSON.stringify({ ...keys, [id]: value })
|
|
2479
|
+
);
|
|
2480
|
+
if ((await loadKeys())[id] !== value) {
|
|
2481
|
+
throw new Error("the keychain did not store the value");
|
|
2482
|
+
}
|
|
2483
|
+
} catch (err) {
|
|
2484
|
+
logger.warn(
|
|
2485
|
+
{ err: err.message, kind, index, appId },
|
|
2486
|
+
"could not store the API key in the keychain; the next run will create another"
|
|
2487
|
+
);
|
|
2454
2488
|
}
|
|
2455
|
-
}
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2489
|
+
});
|
|
2490
|
+
}
|
|
2491
|
+
function deleteStoredKeys() {
|
|
2492
|
+
return serialized(async () => {
|
|
2493
|
+
try {
|
|
2494
|
+
await deletePassword(SERVICE, ACCOUNT);
|
|
2495
|
+
} catch (err) {
|
|
2496
|
+
const message = err.message;
|
|
2497
|
+
if (/not found/i.test(message)) return;
|
|
2498
|
+
logger.warn(
|
|
2499
|
+
{ err: message },
|
|
2500
|
+
"could not delete the API keys from the keychain"
|
|
2501
|
+
);
|
|
2502
|
+
}
|
|
2503
|
+
});
|
|
2461
2504
|
}
|
|
2462
2505
|
|
|
2463
2506
|
// src/lib/algoliaApiKey.ts
|
|
@@ -2468,27 +2511,24 @@ var WRITE_ACLS = [
|
|
|
2468
2511
|
"editSettings",
|
|
2469
2512
|
"listIndexes"
|
|
2470
2513
|
];
|
|
2471
|
-
var createdKeySchema =
|
|
2472
|
-
key:
|
|
2473
|
-
value:
|
|
2514
|
+
var createdKeySchema = z12.object({
|
|
2515
|
+
key: z12.string().min(1).optional(),
|
|
2516
|
+
value: z12.string().min(1).optional()
|
|
2474
2517
|
}).transform((o) => o.key ?? o.value);
|
|
2475
2518
|
async function createKey(index, acls, description) {
|
|
2476
2519
|
logger.info({ index, acls }, "creating an API key");
|
|
2477
|
-
const stdout = await runAlgoliaCli(
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
],
|
|
2490
|
-
{ withoutAdminKey: true }
|
|
2491
|
-
);
|
|
2520
|
+
const stdout = await runAlgoliaCli([
|
|
2521
|
+
"apikeys",
|
|
2522
|
+
"create",
|
|
2523
|
+
"--acl",
|
|
2524
|
+
acls.join(","),
|
|
2525
|
+
"--indices",
|
|
2526
|
+
index,
|
|
2527
|
+
"--description",
|
|
2528
|
+
description,
|
|
2529
|
+
"-o",
|
|
2530
|
+
"json"
|
|
2531
|
+
]);
|
|
2492
2532
|
let payload;
|
|
2493
2533
|
try {
|
|
2494
2534
|
payload = JSON.parse(stdout);
|
|
@@ -2499,9 +2539,18 @@ async function createKey(index, acls, description) {
|
|
|
2499
2539
|
if (!created) throw new Error("apikeys create returned no key value");
|
|
2500
2540
|
return created;
|
|
2501
2541
|
}
|
|
2542
|
+
async function keyExists(key) {
|
|
2543
|
+
try {
|
|
2544
|
+
await runAlgoliaCli(["apikeys", "get", key, "-o", "json"], { redact: key });
|
|
2545
|
+
return true;
|
|
2546
|
+
} catch (err) {
|
|
2547
|
+
return !/does not exist/i.test(err.message);
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2502
2550
|
var resolved = /* @__PURE__ */ new Map();
|
|
2503
|
-
function forgetResolvedKeys() {
|
|
2551
|
+
async function forgetResolvedKeys() {
|
|
2504
2552
|
resolved.clear();
|
|
2553
|
+
await deleteStoredKeys();
|
|
2505
2554
|
}
|
|
2506
2555
|
function resolveKey(kind, index, appId, acls, description) {
|
|
2507
2556
|
const cacheKey = `${kind}:${appId}:${index}`;
|
|
@@ -2519,8 +2568,14 @@ function resolveKey(kind, index, appId, acls, description) {
|
|
|
2519
2568
|
async function provisionKey(kind, index, appId, acls, description) {
|
|
2520
2569
|
const stored = await readStoredKey(kind, index, appId);
|
|
2521
2570
|
if (stored) {
|
|
2522
|
-
|
|
2523
|
-
|
|
2571
|
+
if (await keyExists(stored)) {
|
|
2572
|
+
logger.info({ kind, index, appId }, "reusing the stored API key");
|
|
2573
|
+
return { key: stored, source: "keychain" };
|
|
2574
|
+
}
|
|
2575
|
+
logger.info(
|
|
2576
|
+
{ kind, index, appId },
|
|
2577
|
+
"the stored API key no longer exists; creating another"
|
|
2578
|
+
);
|
|
2524
2579
|
}
|
|
2525
2580
|
const key = await createKey(index, acls, description);
|
|
2526
2581
|
await storeKey(kind, index, appId, key);
|
|
@@ -2569,8 +2624,8 @@ function upsertEnv(content, name, value) {
|
|
|
2569
2624
|
function writeCredentialsTool(ctx) {
|
|
2570
2625
|
return tool6({
|
|
2571
2626
|
description: `Write the active Algolia credentials (${APP_ID_VAR} and ${API_KEY_VAR}) and the target index name (${INDEX_NAME_VAR}) into the given env file. The credentials come from the selected Algolia application, with a write key scoped to the target index; you only pass the path to the env file (e.g. ".env"). Any name the file already defines is left untouched.`,
|
|
2572
|
-
inputSchema:
|
|
2573
|
-
filePath:
|
|
2627
|
+
inputSchema: z13.object({
|
|
2628
|
+
filePath: z13.string().describe(
|
|
2574
2629
|
'Path to the env file to write credentials into (e.g. ".env")'
|
|
2575
2630
|
)
|
|
2576
2631
|
}),
|
|
@@ -2630,7 +2685,7 @@ function writeCredentialsTool(ctx) {
|
|
|
2630
2685
|
|
|
2631
2686
|
// src/lib/tools/searchFiles.ts
|
|
2632
2687
|
import { tool as tool7 } from "ai";
|
|
2633
|
-
import
|
|
2688
|
+
import z14 from "zod";
|
|
2634
2689
|
import { readdir as readdir2, readFile as readFile5 } from "node:fs/promises";
|
|
2635
2690
|
import { join as join7 } from "node:path";
|
|
2636
2691
|
var MAX_QUERY_LENGTH = 1e3;
|
|
@@ -2656,9 +2711,9 @@ async function walkFiles(dir) {
|
|
|
2656
2711
|
function searchFilesTool(ctx) {
|
|
2657
2712
|
return tool7({
|
|
2658
2713
|
description: "Search file contents for a JavaScript regular expression (RegExp syntax, not grep/PCRE). Returns matching lines as file:line:text.",
|
|
2659
|
-
inputSchema:
|
|
2660
|
-
query:
|
|
2661
|
-
path:
|
|
2714
|
+
inputSchema: z14.object({
|
|
2715
|
+
query: z14.string().describe("JavaScript RegExp pattern to search for"),
|
|
2716
|
+
path: z14.string().optional().describe("Directory to search in (default: cwd)")
|
|
2662
2717
|
}),
|
|
2663
2718
|
execute: async ({ query, path = "." }) => {
|
|
2664
2719
|
logger.info({ query, path }, "called searchFiles tool");
|
|
@@ -2702,7 +2757,7 @@ function searchFilesTool(ctx) {
|
|
|
2702
2757
|
|
|
2703
2758
|
// src/lib/tools/runShell.ts
|
|
2704
2759
|
import { tool as tool8 } from "ai";
|
|
2705
|
-
import
|
|
2760
|
+
import z15 from "zod";
|
|
2706
2761
|
import { relative as relative2 } from "node:path";
|
|
2707
2762
|
|
|
2708
2763
|
// src/lib/tools/utils/runShell.ts
|
|
@@ -2815,15 +2870,15 @@ function storeApproval(root) {
|
|
|
2815
2870
|
}
|
|
2816
2871
|
function runShellTool(ctx) {
|
|
2817
2872
|
return tool8({
|
|
2818
|
-
description: "Run a shell command in the project. Use this for anything the project needs done in its own ecosystem: installing dependencies, running a script you wrote, running the project's lint/typecheck/test commands. The user sees and approves every command before it runs, so write a clear `explanation`. If the user rejects a command, do not retry it \u2014 propose a different approach.",
|
|
2819
|
-
inputSchema:
|
|
2820
|
-
command:
|
|
2873
|
+
description: "Run a shell command in the project. Use this for anything the project needs done in its own ecosystem: installing dependencies, running a script you wrote, running the project's lint/typecheck/test commands. The user sees and approves every command before it runs, so write a clear `explanation`. If the user rejects a command, do not retry it \u2014 propose a different approach. Never `cd`, `pushd` or `popd` inside the command \u2014 pass `cwd` instead. Never leave the project root: no `..` in any path, no absolute paths outside the root, and no `-C`/`--prefix` flag pointing outside it. Everything you need is inside the root.",
|
|
2874
|
+
inputSchema: z15.object({
|
|
2875
|
+
command: z15.string().describe(
|
|
2821
2876
|
"The command to run, exactly as it would be typed in a shell. Pipes, && and redirects are allowed."
|
|
2822
2877
|
),
|
|
2823
|
-
cwd:
|
|
2878
|
+
cwd: z15.string().optional().describe(
|
|
2824
2879
|
"Directory to run in, relative to the project root. Defaults to the project root."
|
|
2825
2880
|
),
|
|
2826
|
-
explanation:
|
|
2881
|
+
explanation: z15.string().describe(
|
|
2827
2882
|
"One short line telling the user what this command does and why, including any side effect (e.g. writes records to Algolia). This is what they approve against."
|
|
2828
2883
|
)
|
|
2829
2884
|
}),
|
|
@@ -2892,7 +2947,7 @@ import { createAnthropic } from "@ai-sdk/anthropic";
|
|
|
2892
2947
|
import { nanoid as nanoid2 } from "nanoid";
|
|
2893
2948
|
import { mkdir as mkdir5, writeFile as writeFile5 } from "node:fs/promises";
|
|
2894
2949
|
import { dirname as dirname6 } from "node:path";
|
|
2895
|
-
import
|
|
2950
|
+
import z16 from "zod";
|
|
2896
2951
|
var DATA_DIR = ".algolia-wizard/data";
|
|
2897
2952
|
var RECORD_MODEL = "claude-haiku-4-5";
|
|
2898
2953
|
var MAX_RECORDS = 100;
|
|
@@ -2904,17 +2959,17 @@ var anthropic = createAnthropic({
|
|
|
2904
2959
|
function generateRecordTool(ctx) {
|
|
2905
2960
|
return tool9({
|
|
2906
2961
|
description: "Generate realistic sample records for an entity and write them to a JSON file in the worktree. Provide the entity name and its attributes; this tool asks a model to invent varied, realistic values, each with a unique objectID, and returns the file path to read them from at runtime. Do not invent the record values or objectIDs yourself, and do not inline the returned records into the script \u2014 call this tool and read the file it writes.",
|
|
2907
|
-
inputSchema:
|
|
2908
|
-
entityName:
|
|
2909
|
-
attributes:
|
|
2910
|
-
count:
|
|
2911
|
-
hint:
|
|
2962
|
+
inputSchema: z16.object({
|
|
2963
|
+
entityName: z16.string().describe("Name of the entity to generate records for."),
|
|
2964
|
+
attributes: z16.array(z16.string()).describe("Attribute names each record must contain."),
|
|
2965
|
+
count: z16.number().int().min(1).max(MAX_RECORDS).default(10).describe(`How many records to generate (max ${MAX_RECORDS}).`),
|
|
2966
|
+
hint: z16.string().optional().describe("Optional context to steer realistic values.")
|
|
2912
2967
|
}),
|
|
2913
2968
|
execute: async ({ entityName, attributes, count, hint }) => {
|
|
2914
2969
|
logger.info({ entityName, count }, "called generateRecord tool");
|
|
2915
2970
|
try {
|
|
2916
|
-
const value =
|
|
2917
|
-
const recordSchema =
|
|
2971
|
+
const value = z16.union([z16.string(), z16.number(), z16.boolean(), z16.null()]);
|
|
2972
|
+
const recordSchema = z16.object(
|
|
2918
2973
|
Object.fromEntries(attributes.map((attr) => [attr, value]))
|
|
2919
2974
|
);
|
|
2920
2975
|
const generateBatch = async (batchCount) => {
|
|
@@ -2924,8 +2979,8 @@ function generateRecordTool(ctx) {
|
|
|
2924
2979
|
const { output } = await generateText({
|
|
2925
2980
|
model: anthropic(RECORD_MODEL),
|
|
2926
2981
|
output: Output.object({
|
|
2927
|
-
schema:
|
|
2928
|
-
records:
|
|
2982
|
+
schema: z16.object({
|
|
2983
|
+
records: z16.array(recordSchema).length(batchCount)
|
|
2929
2984
|
})
|
|
2930
2985
|
}),
|
|
2931
2986
|
prompt: [
|
|
@@ -2983,12 +3038,12 @@ function generateRecordTool(ctx) {
|
|
|
2983
3038
|
|
|
2984
3039
|
// src/lib/tools/notifyUser.ts
|
|
2985
3040
|
import { tool as tool10 } from "ai";
|
|
2986
|
-
import
|
|
3041
|
+
import z17 from "zod";
|
|
2987
3042
|
function notifyUserTool() {
|
|
2988
3043
|
return tool10({
|
|
2989
3044
|
description: `Give the user a brief, high-level update on what you are currently doing or about to do next. This is for the big picture (e.g. "Reading through your data models", "Writing the search UI") \u2014 not granular detail like individual tool calls, which are already logged separately. Call it when you start a new phase of work or your focus shifts, just not on every step, enough to keep the user engaged. Don't say things like "starting", just describe what you are doing. Don't mention tool calls themselves, just general direction of the work.`,
|
|
2990
|
-
inputSchema:
|
|
2991
|
-
message:
|
|
3045
|
+
inputSchema: z17.object({
|
|
3046
|
+
message: z17.string().describe(
|
|
2992
3047
|
"Short, plain-language description of what you are doing now."
|
|
2993
3048
|
)
|
|
2994
3049
|
}),
|
|
@@ -3153,10 +3208,10 @@ async function runAgent(req) {
|
|
|
3153
3208
|
}
|
|
3154
3209
|
|
|
3155
3210
|
// src/actions/detectLanguage.ts
|
|
3156
|
-
import
|
|
3157
|
-
var detectLanguageSchema =
|
|
3158
|
-
languages:
|
|
3159
|
-
frameworks:
|
|
3211
|
+
import z20 from "zod";
|
|
3212
|
+
var detectLanguageSchema = z20.object({
|
|
3213
|
+
languages: z20.array(z20.object({ name: z20.string(), version: z20.string() })),
|
|
3214
|
+
frameworks: z20.array(z20.object({ name: z20.string(), version: z20.string() }))
|
|
3160
3215
|
});
|
|
3161
3216
|
var detectLanguage = () => runAgent({
|
|
3162
3217
|
instructions: [
|
|
@@ -3174,31 +3229,31 @@ var detectLanguage = () => runAgent({
|
|
|
3174
3229
|
});
|
|
3175
3230
|
|
|
3176
3231
|
// src/actions/analyzeCodebase.ts
|
|
3177
|
-
import
|
|
3232
|
+
import z21 from "zod";
|
|
3178
3233
|
var READONLY_TOOLS = [
|
|
3179
3234
|
"listFiles",
|
|
3180
3235
|
"changeDirectory",
|
|
3181
3236
|
"readFile",
|
|
3182
3237
|
"searchFiles"
|
|
3183
3238
|
];
|
|
3184
|
-
var ingestionAnalysisSchema =
|
|
3185
|
-
ingestionAnalysis:
|
|
3186
|
-
|
|
3187
|
-
name:
|
|
3188
|
-
paths:
|
|
3239
|
+
var ingestionAnalysisSchema = z21.object({
|
|
3240
|
+
ingestionAnalysis: z21.array(
|
|
3241
|
+
z21.object({
|
|
3242
|
+
name: z21.string(),
|
|
3243
|
+
paths: z21.array(z21.string()),
|
|
3189
3244
|
// indexable fields the agent found for this entity
|
|
3190
|
-
attributes:
|
|
3245
|
+
attributes: z21.array(z21.string())
|
|
3191
3246
|
})
|
|
3192
3247
|
)
|
|
3193
3248
|
});
|
|
3194
|
-
var searchImplementationAnalysisSchema =
|
|
3195
|
-
searchImplementationAnalysis:
|
|
3249
|
+
var searchImplementationAnalysisSchema = z21.object({
|
|
3250
|
+
searchImplementationAnalysis: z21.string()
|
|
3196
3251
|
});
|
|
3197
|
-
var verificationSchema =
|
|
3198
|
-
verification:
|
|
3252
|
+
var verificationSchema = z21.object({
|
|
3253
|
+
verification: z21.array(z21.string())
|
|
3199
3254
|
});
|
|
3200
3255
|
var confirmedEntitiesFieldSchema = ingestionAnalysisSchema.shape.ingestionAnalysis.optional();
|
|
3201
|
-
var analyzeCodebaseSchema =
|
|
3256
|
+
var analyzeCodebaseSchema = z21.object({
|
|
3202
3257
|
ingestionAnalysis: ingestionAnalysisSchema.shape.ingestionAnalysis.optional(),
|
|
3203
3258
|
searchImplementationAnalysis: searchImplementationAnalysisSchema.shape.searchImplementationAnalysis.optional(),
|
|
3204
3259
|
verification: verificationSchema.shape.verification.optional(),
|
|
@@ -3260,7 +3315,7 @@ async function runAnalysis(mode, extraInstructions = []) {
|
|
|
3260
3315
|
// package.json
|
|
3261
3316
|
var package_default = {
|
|
3262
3317
|
name: "@algolia/wizard",
|
|
3263
|
-
version: "0.9.0-rc.
|
|
3318
|
+
version: "0.9.0-rc.96.109",
|
|
3264
3319
|
description: "Magically implement Algolia functionality in your codebase",
|
|
3265
3320
|
type: "module",
|
|
3266
3321
|
engines: {
|
|
@@ -3379,8 +3434,8 @@ async function askList(ctx, prompt, { required = false } = {}) {
|
|
|
3379
3434
|
}
|
|
3380
3435
|
|
|
3381
3436
|
// src/actions/confirmLanguage.ts
|
|
3382
|
-
import
|
|
3383
|
-
var confirmLanguageSchema =
|
|
3437
|
+
import z23 from "zod";
|
|
3438
|
+
var confirmLanguageSchema = z23.object({
|
|
3384
3439
|
languages: detectLanguageSchema.shape.languages
|
|
3385
3440
|
});
|
|
3386
3441
|
async function confirmLanguage(ctx) {
|
|
@@ -3401,8 +3456,8 @@ async function confirmLanguage(ctx) {
|
|
|
3401
3456
|
}
|
|
3402
3457
|
|
|
3403
3458
|
// src/actions/confirmFramework.ts
|
|
3404
|
-
import
|
|
3405
|
-
var confirmFrameworkSchema =
|
|
3459
|
+
import z24 from "zod";
|
|
3460
|
+
var confirmFrameworkSchema = z24.object({
|
|
3406
3461
|
frameworks: detectLanguageSchema.shape.frameworks
|
|
3407
3462
|
});
|
|
3408
3463
|
var CURATED_FRAMEWORKS = [
|
|
@@ -3535,8 +3590,8 @@ async function promptUser(ctx, params) {
|
|
|
3535
3590
|
}
|
|
3536
3591
|
|
|
3537
3592
|
// src/actions/confirmEntities.ts
|
|
3538
|
-
import
|
|
3539
|
-
var confirmEntitiesSchema =
|
|
3593
|
+
import z25 from "zod";
|
|
3594
|
+
var confirmEntitiesSchema = z25.object({
|
|
3540
3595
|
// Final detection — the focused re-run may supersede project-scan's.
|
|
3541
3596
|
ingestionAnalysis: ingestionAnalysisSchema.shape.ingestionAnalysis.optional(),
|
|
3542
3597
|
confirmedEntities: confirmedEntitiesFieldSchema
|
|
@@ -3606,15 +3661,15 @@ async function confirmEntities(ctx) {
|
|
|
3606
3661
|
}
|
|
3607
3662
|
|
|
3608
3663
|
// src/actions/review.ts
|
|
3609
|
-
import { z as
|
|
3610
|
-
var reviewSchema =
|
|
3664
|
+
import { z as z26 } from "zod";
|
|
3665
|
+
var reviewSchema = z26.object({
|
|
3611
3666
|
// Broad, high-level takeaways grouped by theme (e.g. ingestion, search UI),
|
|
3612
3667
|
// not one entry per workflow step — a step's raw output can be a long,
|
|
3613
3668
|
// multi-paragraph blob (see implement.ts's summaries.join), and mirroring
|
|
3614
3669
|
// that 1:1 is what made the old per-step summary an unreadable wall of text.
|
|
3615
|
-
summaryPoints:
|
|
3616
|
-
reviewPrompt:
|
|
3617
|
-
nextSteps:
|
|
3670
|
+
summaryPoints: z26.array(z26.string()),
|
|
3671
|
+
reviewPrompt: z26.string(),
|
|
3672
|
+
nextSteps: z26.array(z26.string())
|
|
3618
3673
|
});
|
|
3619
3674
|
function formatCompletedSteps(steps) {
|
|
3620
3675
|
if (!steps.length) return "(no prior steps completed)";
|
|
@@ -3665,7 +3720,7 @@ ${formatCompletedSteps(ctx.completedSteps)}`,
|
|
|
3665
3720
|
};
|
|
3666
3721
|
|
|
3667
3722
|
// src/actions/implement.ts
|
|
3668
|
-
import
|
|
3723
|
+
import z27 from "zod";
|
|
3669
3724
|
|
|
3670
3725
|
// src/lib/worktree.ts
|
|
3671
3726
|
import { execFile } from "node:child_process";
|
|
@@ -3915,30 +3970,30 @@ function shellQuote(value) {
|
|
|
3915
3970
|
}
|
|
3916
3971
|
|
|
3917
3972
|
// src/actions/implement.ts
|
|
3918
|
-
var implementSchema =
|
|
3919
|
-
filesChanged:
|
|
3920
|
-
summary:
|
|
3921
|
-
worktreePath:
|
|
3922
|
-
ingestCommand:
|
|
3923
|
-
ingestScriptRan:
|
|
3924
|
-
ingestRecordCount:
|
|
3925
|
-
ingestDurationMs:
|
|
3926
|
-
ingestionSource:
|
|
3927
|
-
searchEnvVars:
|
|
3928
|
-
|
|
3929
|
-
name:
|
|
3930
|
-
value:
|
|
3973
|
+
var implementSchema = z27.object({
|
|
3974
|
+
filesChanged: z27.array(z27.string()),
|
|
3975
|
+
summary: z27.string(),
|
|
3976
|
+
worktreePath: z27.string().optional(),
|
|
3977
|
+
ingestCommand: z27.string().optional(),
|
|
3978
|
+
ingestScriptRan: z27.boolean().optional(),
|
|
3979
|
+
ingestRecordCount: z27.number().optional(),
|
|
3980
|
+
ingestDurationMs: z27.number().optional(),
|
|
3981
|
+
ingestionSource: z27.enum(["local", "fileUpload", "generated"]),
|
|
3982
|
+
searchEnvVars: z27.array(
|
|
3983
|
+
z27.object({
|
|
3984
|
+
name: z27.string(),
|
|
3985
|
+
value: z27.string()
|
|
3931
3986
|
})
|
|
3932
3987
|
).optional()
|
|
3933
3988
|
});
|
|
3934
|
-
var implementationOutputSchema =
|
|
3935
|
-
summary:
|
|
3936
|
-
ingestCommand:
|
|
3989
|
+
var implementationOutputSchema = z27.object({
|
|
3990
|
+
summary: z27.string(),
|
|
3991
|
+
ingestCommand: z27.string().optional()
|
|
3937
3992
|
});
|
|
3938
|
-
var verificationOutputSchema =
|
|
3939
|
-
summary:
|
|
3940
|
-
sufficient:
|
|
3941
|
-
additionalInstructions:
|
|
3993
|
+
var verificationOutputSchema = z27.object({
|
|
3994
|
+
summary: z27.string(),
|
|
3995
|
+
sufficient: z27.boolean(),
|
|
3996
|
+
additionalInstructions: z27.string().optional()
|
|
3942
3997
|
});
|
|
3943
3998
|
var MAX_IMPLEMENT_VERIFICATION_ATTEMPTS = 3;
|
|
3944
3999
|
var DEFAULT_IMPLEMENT_USE_CASES = ["ingestion", "search"];
|
|
@@ -4585,8 +4640,8 @@ var defaultWorkflow = {
|
|
|
4585
4640
|
defineStep({
|
|
4586
4641
|
id: "select-index",
|
|
4587
4642
|
title: "Set up index",
|
|
4588
|
-
outputSchema:
|
|
4589
|
-
selection:
|
|
4643
|
+
outputSchema: z28.object({
|
|
4644
|
+
selection: z28.string()
|
|
4590
4645
|
}),
|
|
4591
4646
|
run: (ctx) => selectIndexStep(ctx)
|
|
4592
4647
|
}),
|
|
@@ -4828,7 +4883,10 @@ Options:
|
|
|
4828
4883
|
--no-telemetry Send no telemetry or analytics for this run.
|
|
4829
4884
|
--reset-on-run Wipe this project's wizard state (run state, AI consent,
|
|
4830
4885
|
worktrees) before starting, so the run behaves like a
|
|
4831
|
-
first-ever run.
|
|
4886
|
+
first-ever run. Also drops every API key the wizard has
|
|
4887
|
+
stored in your keychain, for this project and any other, so
|
|
4888
|
+
later runs create new ones. Your Algolia login is not
|
|
4889
|
+
touched.
|
|
4832
4890
|
-h, --help Print this message.`;
|
|
4833
4891
|
function parseCliArgs(argv) {
|
|
4834
4892
|
const positionals = [];
|
|
@@ -4869,7 +4927,7 @@ import { join as join10 } from "node:path";
|
|
|
4869
4927
|
var KEEP = ["wizard.log"];
|
|
4870
4928
|
async function resetProjectState() {
|
|
4871
4929
|
const dir = stateDir();
|
|
4872
|
-
forgetResolvedKeys();
|
|
4930
|
+
await forgetResolvedKeys();
|
|
4873
4931
|
let entries;
|
|
4874
4932
|
try {
|
|
4875
4933
|
entries = await readdir4(dir);
|