@wix/evalforge-evaluator 0.82.0 → 0.84.0

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/build/index.mjs CHANGED
@@ -385,7 +385,7 @@ import {
385
385
  } from "@wix/eval-assertions";
386
386
 
387
387
  // src/run-scenario/environment.ts
388
- import { mkdirSync, existsSync, rmSync } from "fs";
388
+ import { mkdirSync, existsSync, rmSync, readFileSync, writeFileSync } from "fs";
389
389
  import { tmpdir } from "os";
390
390
  import path from "path";
391
391
  import { fetchGitHubFolder as fetchGitHubFolder2 } from "@wix/evalforge-github-client";
@@ -458,6 +458,26 @@ async function fetchAndWriteTemplateFiles(template, workDir) {
458
458
  });
459
459
  await writeSkillFiles(workDir, files);
460
460
  }
461
+ function writeWixEnvFile(workDir) {
462
+ const configPath = path.join(workDir, "wix.config.json");
463
+ if (!existsSync(configPath)) {
464
+ return;
465
+ }
466
+ try {
467
+ const config = JSON.parse(readFileSync(configPath, "utf-8"));
468
+ if (config.appId) {
469
+ writeFileSync(
470
+ path.join(workDir, ".env"),
471
+ `WIX_CLIENT_ID=${config.appId}
472
+ `,
473
+ "utf-8"
474
+ );
475
+ console.log("[environment] Wrote WIX_CLIENT_ID to .env");
476
+ }
477
+ } catch {
478
+ console.warn("[environment] Failed to read wix.config.json");
479
+ }
480
+ }
461
481
  async function prepareWorkingDirectory(config, evalRunId2, targetId, scenarioId, template) {
462
482
  const baseDir = config.evaluationsDir ?? path.join(tmpdir(), "evalforge-evaluations");
463
483
  if (template) {
@@ -473,6 +493,7 @@ async function prepareWorkingDirectory(config, evalRunId2, targetId, scenarioId,
473
493
  mkdirSync(workDir2, { recursive: true });
474
494
  await fetchAndWriteTemplateFiles(template, workDir2);
475
495
  console.log(`Template files written to ${workDir2}`);
496
+ writeWixEnvFile(workDir2);
476
497
  return workDir2;
477
498
  }
478
499
  const workDir = path.join(baseDir, `${evalRunId2}_${targetId}_${scenarioId}`);
@@ -1676,7 +1697,7 @@ var claudeCodeAdapter = new ClaudeCodeAdapter();
1676
1697
  defaultRegistry.register(claudeCodeAdapter);
1677
1698
 
1678
1699
  // src/run-scenario/file-diff.ts
1679
- import { readdirSync, readFileSync, statSync, existsSync as existsSync2 } from "fs";
1700
+ import { readdirSync, readFileSync as readFileSync2, statSync, existsSync as existsSync2 } from "fs";
1680
1701
  import { join as join5, relative } from "path";
1681
1702
 
1682
1703
  // ../../node_modules/diff/lib/index.mjs
@@ -2310,7 +2331,7 @@ function snapshotDirectory(dir, baseDir) {
2310
2331
  if (stats.size > MAX_FILE_SIZE) {
2311
2332
  continue;
2312
2333
  }
2313
- const content = readFileSync(fullPath, "utf-8");
2334
+ const content = readFileSync2(fullPath, "utf-8");
2314
2335
  snapshot[relativePath] = content;
2315
2336
  } catch {
2316
2337
  continue;