@algolia/wizard 0.19.0-rc.111.186 → 0.19.0-rc.111.189
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/README.md +0 -14
- package/dist/main.js +15 -60
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,22 +12,8 @@ npx @algolia/wizard
|
|
|
12
12
|
|
|
13
13
|
# run a specific workflow by id
|
|
14
14
|
npx @algolia/wizard <workflow-id>
|
|
15
|
-
|
|
16
|
-
# see all options
|
|
17
|
-
npx @algolia/wizard --help
|
|
18
15
|
```
|
|
19
16
|
|
|
20
|
-
### Options
|
|
21
|
-
|
|
22
|
-
| Flag | Effect |
|
|
23
|
-
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
24
|
-
| `--seed <step-id>` | Start the workflow at the step with this id (e.g. `--seed ingestion`), with the earlier steps pre-filled with test data. Pass with no value to print the step ids. |
|
|
25
|
-
| `--no-telemetry` | Send no telemetry or analytics for this run. |
|
|
26
|
-
| `--reset-on-run` | Wipe this project's wizard state (run state, AI-changes consent) before starting, so the run behaves like a first-ever run. Credentials are untouched. |
|
|
27
|
-
| `-h`, `--help` | Print usage. |
|
|
28
|
-
|
|
29
|
-
`--seed` pre-fills the earlier steps with fabricated data so a single step can be exercised without running the whole workflow — useful for testing a step, not for a real implementation. It replaces any in-progress run for that workflow and pre-grants the AI-changes consent. See [Starting mid-workflow](CONTRIBUTING.md#starting-mid-workflow---seed).
|
|
30
|
-
|
|
31
17
|
On first run, Wizard checks whether you're signed in to the Algolia CLI. If you aren't, it runs `algolia auth login --non-interactive` — the browser opens for sign-in, and no prompts land in the wizard's terminal. It then asks which Algolia application to work in (skipping the question when the account has only one) and makes it current with `algolia application select`.
|
|
32
18
|
|
|
33
19
|
You'll also be asked once to consent to AI-authored changes to the repository.
|
package/dist/main.js
CHANGED
|
@@ -251,6 +251,7 @@ var useWizard = create((set, get) => ({
|
|
|
251
251
|
_noticeTimer: null,
|
|
252
252
|
cliOutput: [],
|
|
253
253
|
targetIndex: null,
|
|
254
|
+
writtenFiles: [],
|
|
254
255
|
logs: [],
|
|
255
256
|
error: null,
|
|
256
257
|
inputReq: null,
|
|
@@ -344,6 +345,8 @@ var useWizard = create((set, get) => ({
|
|
|
344
345
|
})),
|
|
345
346
|
clearCliOutput: () => set({ cliOutput: [] }),
|
|
346
347
|
setTargetIndex: (index) => set({ targetIndex: index }),
|
|
348
|
+
recordWrittenFile: (path) => set((s) => ({ writtenFiles: [...s.writtenFiles, path] })),
|
|
349
|
+
clearWrittenFiles: () => set({ writtenFiles: [] }),
|
|
347
350
|
logStart: (kind, name, input) => {
|
|
348
351
|
const id = nanoid();
|
|
349
352
|
set((s) => ({
|
|
@@ -391,6 +394,7 @@ var useWizard = create((set, get) => ({
|
|
|
391
394
|
notices: [],
|
|
392
395
|
cliOutput: [],
|
|
393
396
|
targetIndex: null,
|
|
397
|
+
writtenFiles: [],
|
|
394
398
|
logs: [],
|
|
395
399
|
error: null,
|
|
396
400
|
inputReq: null,
|
|
@@ -2496,6 +2500,7 @@ function writeFileTool(ctx) {
|
|
|
2496
2500
|
}
|
|
2497
2501
|
await mkdir3(dirname4(resolved2.target), { recursive: true });
|
|
2498
2502
|
await writeFile3(resolved2.target, content, "utf8");
|
|
2503
|
+
useWizard.getState().recordWrittenFile(resolved2.target);
|
|
2499
2504
|
return `Wrote to ${filePath}`;
|
|
2500
2505
|
} catch (err) {
|
|
2501
2506
|
return `Error writing ${filePath}: ${err.message}`;
|
|
@@ -3604,7 +3609,7 @@ async function runAnalysis(mode, extraInstructions = []) {
|
|
|
3604
3609
|
// package.json
|
|
3605
3610
|
var package_default = {
|
|
3606
3611
|
name: "@algolia/wizard",
|
|
3607
|
-
version: "0.19.0-rc.111.
|
|
3612
|
+
version: "0.19.0-rc.111.189",
|
|
3608
3613
|
description: "Magically implement Algolia functionality in your codebase",
|
|
3609
3614
|
type: "module",
|
|
3610
3615
|
engines: {
|
|
@@ -4009,7 +4014,7 @@ ${formatCompletedSteps(ctx.completedSteps)}`,
|
|
|
4009
4014
|
|
|
4010
4015
|
// src/actions/implement.ts
|
|
4011
4016
|
import z28 from "zod";
|
|
4012
|
-
import { join as join12 } from "node:path";
|
|
4017
|
+
import { join as join12, relative as relative6 } from "node:path";
|
|
4013
4018
|
|
|
4014
4019
|
// src/lib/git.ts
|
|
4015
4020
|
import { execFile as execFile2 } from "node:child_process";
|
|
@@ -4038,10 +4043,6 @@ async function assertGitRepoWithHead(repoRoot) {
|
|
|
4038
4043
|
);
|
|
4039
4044
|
}
|
|
4040
4045
|
}
|
|
4041
|
-
async function isWorkingTreeDirty(repoRoot) {
|
|
4042
|
-
const out = await git(["-C", repoRoot, "status", "--porcelain"]);
|
|
4043
|
-
return out.trim().length > 0;
|
|
4044
|
-
}
|
|
4045
4046
|
async function copyUploadIntoProject(repoRoot, ingestDir, sourcePath) {
|
|
4046
4047
|
const trimmed = sourcePath.trim();
|
|
4047
4048
|
if (!trimmed) {
|
|
@@ -4107,18 +4108,6 @@ async function writeSearchEnvValues(repoRoot, vars) {
|
|
|
4107
4108
|
await writeFile7(target, existing + prefix + lines, "utf8");
|
|
4108
4109
|
return missing.map((v) => v.name);
|
|
4109
4110
|
}
|
|
4110
|
-
async function listChangedFiles(repoRoot) {
|
|
4111
|
-
const raw = await git(["-C", repoRoot, "status", "--porcelain", "-z"]);
|
|
4112
|
-
const entries = raw.split("\0");
|
|
4113
|
-
const files = [];
|
|
4114
|
-
for (let i = 0; i < entries.length; i += 1) {
|
|
4115
|
-
const entry = entries[i];
|
|
4116
|
-
if (!entry) continue;
|
|
4117
|
-
files.push(entry.slice(3));
|
|
4118
|
-
if (["R", "C"].includes(entry[0]) || ["R", "C"].includes(entry[1])) i += 1;
|
|
4119
|
-
}
|
|
4120
|
-
return files;
|
|
4121
|
-
}
|
|
4122
4111
|
function normalizeFindingPaths(findings) {
|
|
4123
4112
|
return {
|
|
4124
4113
|
...findings,
|
|
@@ -4140,28 +4129,6 @@ function normalizeSearchLocation(path) {
|
|
|
4140
4129
|
function toRootRelative(p) {
|
|
4141
4130
|
return p.replace(/^\/+/, "");
|
|
4142
4131
|
}
|
|
4143
|
-
async function confirmDirtyWorkingTree(ctx, repoRoot) {
|
|
4144
|
-
const MAX_LISTED_DIRTY_FILES = 10;
|
|
4145
|
-
const dirty = await listChangedFiles(repoRoot);
|
|
4146
|
-
const shown = dirty.slice(0, MAX_LISTED_DIRTY_FILES);
|
|
4147
|
-
const overflow = dirty.length - shown.length;
|
|
4148
|
-
const answer = await ctx.requestUserInput({
|
|
4149
|
-
prompt: "Proceed with uncommitted changes in your checkout? The wizard will edit files there directly, alongside them.",
|
|
4150
|
-
promptType: "acceptReject",
|
|
4151
|
-
options: [],
|
|
4152
|
-
messages: [
|
|
4153
|
-
`${dirty.length} uncommitted change(s) detected:`,
|
|
4154
|
-
...shown.map((file) => ` \u2022 ${file}`),
|
|
4155
|
-
...overflow > 0 ? [` \u2022 \u2026and ${overflow} more`] : [],
|
|
4156
|
-
"Commit or stash them first if you want to review the wizard's changes on their own."
|
|
4157
|
-
]
|
|
4158
|
-
});
|
|
4159
|
-
if (answer !== true) {
|
|
4160
|
-
throw new Error(
|
|
4161
|
-
"implement aborted: commit or stash your changes first, then re-run the wizard."
|
|
4162
|
-
);
|
|
4163
|
-
}
|
|
4164
|
-
}
|
|
4165
4132
|
|
|
4166
4133
|
// src/lib/algoliaDocs.ts
|
|
4167
4134
|
import { readFileSync, readdirSync, existsSync } from "node:fs";
|
|
@@ -4223,7 +4190,6 @@ function getFrameworkSpecificDoc(frameworks) {
|
|
|
4223
4190
|
|
|
4224
4191
|
// src/actions/implement.ts
|
|
4225
4192
|
var implementSchema = z28.object({
|
|
4226
|
-
filesChanged: z28.array(z28.string()),
|
|
4227
4193
|
summary: z28.string(),
|
|
4228
4194
|
ingestCommand: z28.string().optional(),
|
|
4229
4195
|
ingestScriptRan: z28.boolean().optional(),
|
|
@@ -4585,11 +4551,6 @@ async function implement(ctx, useCases = DEFAULT_IMPLEMENT_USE_CASES) {
|
|
|
4585
4551
|
const targetIndex = selected?.selection;
|
|
4586
4552
|
useWizard.getState().setTargetIndex(targetIndex ?? null);
|
|
4587
4553
|
await assertGitRepoWithHead(repoRoot);
|
|
4588
|
-
const ingestionAlreadyRan = ctx.getStepOutput("ingestion") != null;
|
|
4589
|
-
if (!ingestionAlreadyRan && await isWorkingTreeDirty(repoRoot)) {
|
|
4590
|
-
await confirmDirtyWorkingTree(ctx, repoRoot);
|
|
4591
|
-
}
|
|
4592
|
-
const baselineFiles = new Set(await listChangedFiles(repoRoot));
|
|
4593
4554
|
const normalized = normalizeFindingPaths(findings);
|
|
4594
4555
|
const confirmed2 = normalized.confirmedEntities;
|
|
4595
4556
|
const searchLocation = normalized.searchImplementationAnalysis;
|
|
@@ -4764,7 +4725,7 @@ ${detail}` : ""}`
|
|
|
4764
4725
|
}
|
|
4765
4726
|
if (useCases.includes("search")) {
|
|
4766
4727
|
let extraInstructions = [];
|
|
4767
|
-
|
|
4728
|
+
useWizard.getState().clearWrittenFiles();
|
|
4768
4729
|
for (let attempt = 1; attempt <= MAX_IMPLEMENT_VERIFICATION_ATTEMPTS; attempt++) {
|
|
4769
4730
|
if (attempt > 1) {
|
|
4770
4731
|
logger.info(
|
|
@@ -4785,9 +4746,9 @@ ${detail}` : ""}`
|
|
|
4785
4746
|
summaries.push(formatSummary("verification", verification.summary));
|
|
4786
4747
|
if (verification.sufficient) {
|
|
4787
4748
|
ctx.setUserInput("implementation", "success");
|
|
4788
|
-
const searchFilesChanged =
|
|
4789
|
-
(
|
|
4790
|
-
);
|
|
4749
|
+
const searchFilesChanged = [
|
|
4750
|
+
...new Set(useWizard.getState().writtenFiles)
|
|
4751
|
+
].map((file) => relative6(repoRoot, file));
|
|
4791
4752
|
track("AI Wizard Frontend Component Generated", {
|
|
4792
4753
|
filePaths: searchFilesChanged
|
|
4793
4754
|
});
|
|
@@ -4830,7 +4791,10 @@ ${detail}` : ""}`
|
|
|
4830
4791
|
(v) => !v.value.startsWith("<")
|
|
4831
4792
|
);
|
|
4832
4793
|
if (resolvedSearchEnvVars.length > 0) {
|
|
4833
|
-
const written = await writeSearchEnvValues(
|
|
4794
|
+
const written = await writeSearchEnvValues(
|
|
4795
|
+
repoRoot,
|
|
4796
|
+
resolvedSearchEnvVars
|
|
4797
|
+
);
|
|
4834
4798
|
if (written.length > 0) {
|
|
4835
4799
|
summaries.push(`Wrote ${written.join(", ")} to .env.`);
|
|
4836
4800
|
}
|
|
@@ -4869,15 +4833,8 @@ ${detail}` : ""}`
|
|
|
4869
4833
|
} else {
|
|
4870
4834
|
ctx.setUserInput("implementation", "success");
|
|
4871
4835
|
}
|
|
4872
|
-
const filesChanged = (await listChangedFiles(repoRoot)).filter(
|
|
4873
|
-
(file) => !baselineFiles.has(file)
|
|
4874
|
-
);
|
|
4875
|
-
if (filesChanged.length === 0) {
|
|
4876
|
-
logger.warn("implement: agent reported success but no files changed");
|
|
4877
|
-
}
|
|
4878
4836
|
return {
|
|
4879
4837
|
ingestionSource,
|
|
4880
|
-
filesChanged,
|
|
4881
4838
|
summary: summaries.join("\n\n"),
|
|
4882
4839
|
...useCases.includes("ingestion") && ingestCommand ? {
|
|
4883
4840
|
ingestCommand,
|
|
@@ -5020,7 +4977,6 @@ var selectIndex = {
|
|
|
5020
4977
|
selection: "wizard_seed_products"
|
|
5021
4978
|
};
|
|
5022
4979
|
var ingestion = {
|
|
5023
|
-
filesChanged: ["algolia/ingest.mjs", "algolia/records.json", "package.json"],
|
|
5024
4980
|
summary: "Generated sample Product records and an ingestion script that pushes them to the target index with algoliasearch.",
|
|
5025
4981
|
ingestCommand: "node algolia/ingest.mjs",
|
|
5026
4982
|
ingestScriptRan: true,
|
|
@@ -5032,7 +4988,6 @@ var confirmFramework2 = {
|
|
|
5032
4988
|
frameworks: projectScan2.frameworks
|
|
5033
4989
|
};
|
|
5034
4990
|
var search = {
|
|
5035
|
-
filesChanged: ["src/components/Search.tsx", "src/components/Header.tsx", ".env"],
|
|
5036
4991
|
summary: "Added an InstantSearch-powered search box and results list, mounted in the shared header component.",
|
|
5037
4992
|
ingestionSource: "generated",
|
|
5038
4993
|
searchEnvVars: [
|