@algolia/wizard 0.84.0-rc.202.650 → 0.84.0-rc.202.652

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 +26 -10
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -2315,7 +2315,7 @@ async function ensureApplication(resumeAppId) {
2315
2315
  // package.json
2316
2316
  var package_default = {
2317
2317
  name: "@algolia/wizard",
2318
- version: "0.84.0-rc.202.650",
2318
+ version: "0.84.0-rc.202.652",
2319
2319
  description: "Magically implement Algolia functionality in your codebase",
2320
2320
  type: "module",
2321
2321
  engines: {
@@ -6115,6 +6115,12 @@ function browseUrl(appId, indexName) {
6115
6115
  return `${base}/${encodeURIComponent(indexName)}`;
6116
6116
  }
6117
6117
 
6118
+ // src/lib/clipboard.ts
6119
+ function copyToClipboard(text, stream = process.stdout) {
6120
+ const encoded = Buffer.from(text, "utf8").toString("base64");
6121
+ stream.write(`\x1B]52;c;${encoded}\x07`);
6122
+ }
6123
+
6118
6124
  // src/lib/algoliaDocs.ts
6119
6125
  import { readFileSync, readdirSync, existsSync } from "node:fs";
6120
6126
  import { dirname as dirname4, join as join10 } from "node:path";
@@ -6328,6 +6334,7 @@ function ingestionInstructions(input) {
6328
6334
  'Then, without changing directories, run the script yourself via runShell using the exact same command and cwd. Report the exact command you ran as "ingestCommand", with no cwd note or other text, so the developer can re-run it. Its explanation must say that running it writes records to Algolia.',
6329
6335
  "When the script reads from a database or another service, find how the project connects to it locally (env files, README, socket or TCP settings). If that connection needs a local service, such as a database proxy (for example cloud-sql-proxy) or a tunnel, make the script check the connection before it reads. If the check fails, the script must print an error that names the service, then print exactly one last line to stdout in the form `ALGOLIA_WIZARD_START_HINT=<command>`, where <command> is the command from the project docs that starts the service, and exit with an error. Omit that line when the project docs name no start command.",
6330
6336
  "Make sure that the start command and the script connect to the same address (the same socket path, or the same host and port). If the project env points at an address that only a deployed environment has, such as a /cloudsql socket, make the script connect to the address of the start command. Set that address in the script before it loads the project database module. Do not edit project env or config files for this.",
6337
+ "When the script uses the project database client or ORM, load that client's env file (the project .env the client already reads) so credentials such as DB user, password, and database name are present. Load the wizard Algolia .env first, then the project .env, so Algolia keys win under dotenv versions that ignore `override`. Do not rely on `override: true`.",
6331
6338
  "If external data access fails, do not run authentication commands, change accounts or machine configuration, or start proxies, containers, or services.",
6332
6339
  "Do not troubleshoot unavailable external infrastructure. Preserve the script and command, report success, and let the developer prepare the data source.",
6333
6340
  "If the script cannot access an external data source because credentials or a service are unavailable, do not report status=fail. Report status=success with the completed script, ingestCommand, and a concise failure summary. The wizard handles this run failure and tells the developer how to retry.",
@@ -6454,7 +6461,7 @@ function validationInstructions(input) {
6454
6461
  `The confirmed placement candidate was "${input.searchLocation ?? "unknown"}", but verify the actual mount rather than assuming the candidate was used.`,
6455
6462
  "Inspect the generated search component, its actual mount file, that file's parent layout and sibling controls, and the relevant content UI. Do not rely only on type checks or tests.",
6456
6463
  "Confirm that the application renders exactly one search bar. Check for an old search bar and duplicate mounts.",
6457
- "If the project sets a Content-Security-Policy, confirm that connect-src allows https://*.algolia.net, https://*.algolianet.com, and https://insights.algolia.io, and that search-insights is loaded from npm. Otherwise set sufficient=false.",
6464
+ "If the project sets a Content-Security-Policy, confirm that connect-src allows https://*.algolia.net, https://*.algolianet.com, and https://insights.algolia.io, and that search-insights is loaded from npm (not a CDN). If a CSP exists and fails either check, set sufficient=false. If the project has no CSP, skip both checks: do not set sufficient=false, and do not ask to add a CSP.",
6458
6465
  "Confirm content-specific search is placed with the corresponding content or task controls. Shared navigation is valid only for genuinely app-wide search that fits the visual hierarchy and responsive layout without crowding primary actions.",
6459
6466
  "Confirm the input has a persistent accessible name; widget-provided combobox, popup, and item relationships and keyboard behavior are preserved; and loading, empty, and error status text is perceivable to assistive technology.",
6460
6467
  "Inspect the CSS that actually applies to the generated DOM. Confirm the results panel and the element drawing the input frame have non-transparent surfaces, the input frame is distinguishable from its surrounding background in every supported theme, text meets 4.5:1 contrast, meaningful boundaries and focus indicators meet 3:1, and no state relies on color alone.",
@@ -6574,6 +6581,15 @@ function outputTail(output) {
6574
6581
  if (!trimmed) return void 0;
6575
6582
  return trimmed.length > INGEST_OUTPUT_TAIL_CHARS ? `\u2026${trimmed.slice(-INGEST_OUTPUT_TAIL_CHARS)}` : trimmed;
6576
6583
  }
6584
+ function errorLine(output) {
6585
+ const lines = output?.split("\n").map((l) => l.trim()).filter(Boolean) ?? [];
6586
+ const message = [...lines].reverse().find((l) => /^(?:\w+)?(?:Error|Exception)\b/.test(l));
6587
+ if (message) return message;
6588
+ const tail = outputTail(output);
6589
+ if (!tail) return void 0;
6590
+ const tailLines = tail.split("\n").map((l) => l.trim()).filter(Boolean);
6591
+ return [...tailLines].reverse().find((l) => /\w*(Error|Exception)\b/.test(l)) ?? tailLines.at(-1);
6592
+ }
6577
6593
  function jsTypeName(value) {
6578
6594
  if (value === null) return "null";
6579
6595
  if (Array.isArray(value)) return "array";
@@ -6625,24 +6641,24 @@ function ingestFailure(attempt, executions) {
6625
6641
  };
6626
6642
  }
6627
6643
  if (!attempt.approved) return { reason: "you declined to run it" };
6628
- const detail = outputTail(attempt.output);
6644
+ const detail = errorLine(attempt.output);
6629
6645
  if (attempt.timedOut) {
6630
6646
  const seconds = Math.round((attempt.durationMs ?? 0) / 1e3);
6631
6647
  return { reason: `it timed out after ${seconds}s`, detail };
6632
6648
  }
6633
6649
  return { reason: `it failed (exit ${attempt.exitCode ?? "unknown"})`, detail };
6634
6650
  }
6635
- function errorLine(output) {
6636
- const lines = output?.split("\n").map((l) => l.trim()).filter(Boolean) ?? [];
6637
- return [...lines].reverse().find((l) => /\w*(Error|Exception)\b/.test(l)) ?? lines.at(-1);
6638
- }
6639
6651
  function ingestFailureMessages(headline, detail, command, cwd, startHint) {
6652
+ if (startHint) copyToClipboard(startHint);
6640
6653
  return [
6641
6654
  headline,
6642
6655
  // One message per line: Notices.tsx counts a message as one wrapped
6643
6656
  // line, so an embedded newline overflows the panel's height accounting.
6644
6657
  ...detail?.split("\n").filter((l) => l.trim()) ?? [],
6645
- ...startHint ? [`Start the data source with: ${startHint}`] : [],
6658
+ ...startHint ? [
6659
+ "Start the data source with this command (copied to clipboard):",
6660
+ startHint
6661
+ ] : [],
6646
6662
  ...command ? [
6647
6663
  `Ingestion command: ${command}`,
6648
6664
  ...cwd !== "." ? [`Working directory: ${cwd}`] : []
@@ -6967,7 +6983,7 @@ async function implement(ctx, useCases = DEFAULT_IMPLEMENT_USE_CASES) {
6967
6983
  options: [INGEST_RETRY.retry, INGEST_RETRY.skip],
6968
6984
  messages: ingestFailureMessages(
6969
6985
  `\u26A0\uFE0F Records were not indexed \u2014 ${reason}.`,
6970
- errorLine(detail),
6986
+ detail,
6971
6987
  attempt.command,
6972
6988
  relativeIngestCwd(attempt, repoRoot),
6973
6989
  parseStartHint(attempt.output)
@@ -9354,7 +9370,7 @@ async function resetProjectState() {
9354
9370
  // package.json with { type: 'json' }
9355
9371
  var package_default2 = {
9356
9372
  name: "@algolia/wizard",
9357
- version: "0.84.0-rc.202.650",
9373
+ version: "0.84.0-rc.202.652",
9358
9374
  description: "Magically implement Algolia functionality in your codebase",
9359
9375
  type: "module",
9360
9376
  engines: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algolia/wizard",
3
- "version": "0.84.0-rc.202.650",
3
+ "version": "0.84.0-rc.202.652",
4
4
  "description": "Magically implement Algolia functionality in your codebase",
5
5
  "type": "module",
6
6
  "engines": {