@wix/ditto-codegen-public 1.0.509 → 1.0.511

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/out.js +134 -27
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -15533,7 +15533,7 @@ var require_config = __commonJS({
15533
15533
  "dist/opencode-integration/configuration/config.js"(exports2) {
15534
15534
  "use strict";
15535
15535
  Object.defineProperty(exports2, "__esModule", { value: true });
15536
- exports2.PROVIDER_CHUNK_TIMEOUT_MS = exports2.DEFAULT_TIMEOUT_MS = void 0;
15536
+ exports2.WIX_MCP_CONFIG = exports2.WIX_MCP_DISABLED_TOOLS = exports2.WIX_MCP_VERSION = exports2.PROVIDER_CHUNK_TIMEOUT_MS = exports2.DEFAULT_TIMEOUT_MS = void 0;
15537
15537
  exports2.getAnthropicBaseUrl = getAnthropicBaseUrl;
15538
15538
  exports2.getOpenAiBaseUrl = getOpenAiBaseUrl;
15539
15539
  exports2.getGoogleBaseUrl = getGoogleBaseUrl;
@@ -15657,19 +15657,39 @@ var require_config = __commonJS({
15657
15657
  }
15658
15658
  return provider;
15659
15659
  }
15660
- var WIX_MCP_CONFIG = {
15660
+ exports2.WIX_MCP_VERSION = "1.0.98";
15661
+ exports2.WIX_MCP_DISABLED_TOOLS = [
15662
+ "CheckDomainAvailability",
15663
+ "CreateSiteFromTemplate",
15664
+ "ExecuteWixAPI",
15665
+ "GetSiteContext",
15666
+ "GetSuggestedDomains",
15667
+ "ListWixSites",
15668
+ "ManageWixSite",
15669
+ "ReportIssueToWix",
15670
+ "SearchSiteTemplates",
15671
+ "SearchWixAPISpec",
15672
+ "StartDeployWebsite",
15673
+ "StartHeadlessBuild",
15674
+ "UploadHeadlessWebsiteFiles",
15675
+ "UploadImageToWixSite",
15676
+ "WixHarmonyEditorBuild",
15677
+ "pullSiteCreationJob"
15678
+ ];
15679
+ exports2.WIX_MCP_CONFIG = {
15661
15680
  [constants_1.WIX_MCP_SERVER_NAME]: {
15662
15681
  type: "local",
15663
15682
  command: [
15664
15683
  "npx",
15665
15684
  "-y",
15666
- "@wix/mcp@1.0.96",
15685
+ `@wix/mcp@${exports2.WIX_MCP_VERSION}`,
15667
15686
  "--tools",
15668
15687
  "SDK",
15669
- "--experimental",
15670
- "WIX_API_THROUGH_FS"
15688
+ "--wixApiKeyFile",
15689
+ `--disableTools=${exports2.WIX_MCP_DISABLED_TOOLS.join(",")}`
15671
15690
  ],
15672
- enabled: true
15691
+ enabled: true,
15692
+ timeout: 3e4
15673
15693
  }
15674
15694
  };
15675
15695
  var READABLE_EXTERNAL_DIRS = {
@@ -15778,7 +15798,7 @@ var require_config = __commonJS({
15778
15798
  permission,
15779
15799
  instructions: instructionPaths,
15780
15800
  lsp: false,
15781
- mcp: WIX_MCP_CONFIG,
15801
+ mcp: exports2.WIX_MCP_CONFIG,
15782
15802
  watcher: { ignore: WATCHER_IGNORE_PATTERNS },
15783
15803
  ...isCodeWritingFlow ? { autoupdate: false, share: "disabled" } : {},
15784
15804
  // Only code-writing flows register subagents. The read-only ask flow must
@@ -16800,15 +16820,31 @@ var require_file_changes = __commonJS({
16800
16820
  "dist/git/file-changes.js"(exports2) {
16801
16821
  "use strict";
16802
16822
  Object.defineProperty(exports2, "__esModule", { value: true });
16823
+ exports2.EMPTY_GIT_BASELINE = void 0;
16803
16824
  exports2.captureGitBaseline = captureGitBaseline;
16804
16825
  exports2.collectGitFileChanges = collectGitFileChanges;
16805
16826
  var child_process_1 = require("child_process");
16827
+ var promises_1 = require("fs/promises");
16828
+ var os_1 = require("os");
16829
+ var path_12 = require("path");
16806
16830
  var util_1 = require("util");
16807
16831
  var ditto_codegen_types_12 = require_dist4();
16808
16832
  var internal_paths_1 = require_internal_paths();
16809
16833
  var logger_12 = require_logger();
16810
16834
  var execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
16835
+ var GIT_MAX_BUFFER = 10 * 1024 * 1024;
16836
+ exports2.EMPTY_GIT_BASELINE = { commit: "", tree: "" };
16811
16837
  async function captureGitBaseline(cwd) {
16838
+ const [commit, tree] = await Promise.all([
16839
+ captureHead(cwd),
16840
+ snapshotWorkingTree(cwd).catch((error) => {
16841
+ logger_12.logger.warn("[OpenCode] Failed to snapshot the working tree, files uncommitted before the run will be reported as changes", { error: errorMessage(error) });
16842
+ return "";
16843
+ })
16844
+ ]);
16845
+ return { commit, tree };
16846
+ }
16847
+ async function captureHead(cwd) {
16812
16848
  try {
16813
16849
  const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD"], {
16814
16850
  cwd
@@ -16816,40 +16852,110 @@ var require_file_changes = __commonJS({
16816
16852
  return stdout.trim();
16817
16853
  } catch (error) {
16818
16854
  logger_12.logger.warn("[OpenCode] Failed to capture git baseline, file tracking may be incomplete", {
16819
- error: error instanceof Error ? error.message : String(error)
16855
+ error: errorMessage(error)
16820
16856
  });
16821
16857
  return "";
16822
16858
  }
16823
16859
  }
16860
+ async function snapshotWorkingTree(cwd, seedTree) {
16861
+ const dir = await (0, promises_1.mkdtemp)((0, path_12.join)((0, os_1.tmpdir)(), "codegen-git-snapshot-"));
16862
+ const indexFile = (0, path_12.join)(dir, "index");
16863
+ const env = { ...process.env, GIT_INDEX_FILE: indexFile };
16864
+ try {
16865
+ if (seedTree) {
16866
+ await execFileAsync("git", ["read-tree", seedTree], { cwd, env });
16867
+ } else {
16868
+ await copyRealIndex(cwd, indexFile);
16869
+ }
16870
+ await execFileAsync("git", ["add", "--all"], {
16871
+ cwd,
16872
+ env,
16873
+ maxBuffer: GIT_MAX_BUFFER
16874
+ });
16875
+ const { stdout } = await execFileAsync("git", ["write-tree"], {
16876
+ cwd,
16877
+ env
16878
+ });
16879
+ return stdout.trim();
16880
+ } finally {
16881
+ await (0, promises_1.rm)(dir, { recursive: true, force: true });
16882
+ }
16883
+ }
16884
+ async function copyRealIndex(cwd, indexFile) {
16885
+ const { stdout: indexPath } = await execFileAsync("git", ["rev-parse", "--git-path", "index"], { cwd });
16886
+ try {
16887
+ await (0, promises_1.copyFile)((0, path_12.resolve)(cwd, indexPath.trim()), indexFile);
16888
+ } catch (error) {
16889
+ if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) {
16890
+ throw error;
16891
+ }
16892
+ }
16893
+ }
16894
+ function errorMessage(error) {
16895
+ return error instanceof Error ? error.message : String(error);
16896
+ }
16824
16897
  async function collectGitFileChanges(cwd, baseline) {
16825
16898
  try {
16826
- const [diffResult, untrackedResult] = await Promise.all([
16827
- execFileAsync("git", [
16828
- "-c",
16829
- "core.quotepath=off",
16830
- "diff",
16831
- "--name-status",
16832
- "--no-renames",
16833
- "-z",
16834
- baseline
16835
- ], { cwd, maxBuffer: 10 * 1024 * 1024 }),
16836
- execFileAsync("git", ["ls-files", "--others", "--exclude-standard", "-z"], { cwd, maxBuffer: 10 * 1024 * 1024 })
16837
- ]);
16838
- const files = parseDiffNameStatus(diffResult.stdout);
16839
- appendUntrackedFiles(untrackedResult.stdout, files);
16899
+ const files = await collectRawChanges(cwd, baseline);
16840
16900
  const userFiles = files.filter((f) => !(0, internal_paths_1.isInternalPath)(f.path));
16841
16901
  userFiles.sort((a, b) => a.path.localeCompare(b.path));
16842
16902
  return userFiles;
16843
16903
  } catch (error) {
16844
16904
  logger_12.logger.error("[OpenCode] Failed to collect git file changes", {
16845
- error: error instanceof Error ? error.message : String(error)
16905
+ error: errorMessage(error)
16846
16906
  });
16847
16907
  return [];
16848
16908
  }
16849
16909
  }
16910
+ async function collectRawChanges(cwd, baseline) {
16911
+ if (baseline.tree) {
16912
+ try {
16913
+ return await diffAgainstSnapshot(cwd, baseline.tree);
16914
+ } catch (error) {
16915
+ logger_12.logger.warn("[OpenCode] Failed to diff against the working tree snapshot, falling back to the HEAD diff", { error: errorMessage(error) });
16916
+ }
16917
+ }
16918
+ return diffAgainstCommit(cwd, baseline.commit);
16919
+ }
16920
+ async function diffAgainstSnapshot(cwd, baselineTree) {
16921
+ const currentTree = await snapshotWorkingTree(cwd, baselineTree);
16922
+ const { stdout } = await execFileAsync("git", [
16923
+ "-c",
16924
+ "core.quotepath=off",
16925
+ "diff-tree",
16926
+ "-r",
16927
+ "--name-status",
16928
+ "--no-renames",
16929
+ "-z",
16930
+ baselineTree,
16931
+ currentTree
16932
+ ], { cwd, maxBuffer: GIT_MAX_BUFFER });
16933
+ return parseDiffNameStatus(stdout);
16934
+ }
16935
+ async function diffAgainstCommit(cwd, commit) {
16936
+ const [diffResult, untrackedResult] = await Promise.all([
16937
+ execFileAsync("git", [
16938
+ "-c",
16939
+ "core.quotepath=off",
16940
+ "diff",
16941
+ "--name-status",
16942
+ "--no-renames",
16943
+ "-z",
16944
+ commit
16945
+ ], { cwd, maxBuffer: GIT_MAX_BUFFER }),
16946
+ execFileAsync("git", ["ls-files", "--others", "--exclude-standard", "-z"], {
16947
+ cwd,
16948
+ maxBuffer: GIT_MAX_BUFFER
16949
+ })
16950
+ ]);
16951
+ const files = parseDiffNameStatus(diffResult.stdout);
16952
+ appendUntrackedFiles(untrackedResult.stdout, files);
16953
+ return files;
16954
+ }
16850
16955
  var GIT_STATUS_TO_OPERATION = {
16851
16956
  A: ditto_codegen_types_12.ExtensionGenerationOperation.INSERT,
16852
16957
  M: ditto_codegen_types_12.ExtensionGenerationOperation.EDIT,
16958
+ T: ditto_codegen_types_12.ExtensionGenerationOperation.EDIT,
16853
16959
  D: ditto_codegen_types_12.ExtensionGenerationOperation.DELETE
16854
16960
  };
16855
16961
  function parseDiffNameStatus(raw) {
@@ -18261,7 +18367,7 @@ var require_executor = __commonJS({
18261
18367
  });
18262
18368
  logger_12.logger.debug("[OpenCode] Full prompt", { prompt });
18263
18369
  const env = (0, config_12.getOpenCodeEnv)(projectId, job_context_storage_12.jobContextStorage.getStore()?.kind);
18264
- env.CODEGEN_VALIDATION_BASELINE = options.gitBaseline;
18370
+ env.CODEGEN_VALIDATION_BASELINE = options.gitBaseline.commit;
18265
18371
  env.CODEGEN_PREPARE_EXTENSION_METADATA = options.prepareExtensionMetadata ? "1" : "0";
18266
18372
  env.CODEGEN_REQUIRE_VALIDATION = attempt > 1 ? "1" : "0";
18267
18373
  ctx.child = (0, child_process_1.spawn)("opencode", args, {
@@ -18362,7 +18468,7 @@ var require_opencode_runner = __commonJS({
18362
18468
  projectId,
18363
18469
  gitBaseline,
18364
18470
  prepareExtensionMetadata: true,
18365
- postRunValidation: (stdout) => (0, session_validation_1.validateSessionOrFallback)(outputPath, stdout, gitBaseline),
18471
+ postRunValidation: (stdout) => (0, session_validation_1.validateSessionOrFallback)(outputPath, stdout, gitBaseline.commit),
18366
18472
  onStdout,
18367
18473
  onStderr
18368
18474
  });
@@ -18376,7 +18482,7 @@ var require_opencode_runner = __commonJS({
18376
18482
  projectId,
18377
18483
  gitBaseline,
18378
18484
  prepareExtensionMetadata: true,
18379
- postRunValidation: (stdout) => (0, session_validation_1.validateSessionOrFallback)(outputPath, stdout, gitBaseline),
18485
+ postRunValidation: (stdout) => (0, session_validation_1.validateSessionOrFallback)(outputPath, stdout, gitBaseline.commit),
18380
18486
  onStdout,
18381
18487
  onStderr
18382
18488
  });
@@ -129231,6 +129337,7 @@ var require_job_timeout_monitor = __commonJS({
129231
129337
  var logger_12 = require_logger();
129232
129338
  var context_12 = require_context();
129233
129339
  var job_context_storage_12 = require_job_context_storage();
129340
+ var file_changes_1 = require_file_changes();
129234
129341
  var codegen_flow_helpers_12 = require_codegen_flow_helpers();
129235
129342
  var types_1 = require_types_impl();
129236
129343
  var bi_events_1 = require_bi_events();
@@ -129263,7 +129370,7 @@ var require_job_timeout_monitor = __commonJS({
129263
129370
  const codegenError = this.resolveTimeoutError(jobId, job);
129264
129371
  await (0, utils_12.updateAllRunningTasks)(jobId, ditto_codegen_types_12.Status.FAILED, codegenError);
129265
129372
  await this.codeGenerationService.updateJobStatus(jobId, ditto_codegen_types_12.Status.FAILED);
129266
- const failedRunPayload = await (0, codegen_flow_helpers_12.buildFailedRunPayload)(codegenError, (0, codegen_flow_helpers_12.getOutputPath)(), job_context_storage_12.jobContextStorage.getStore()?.gitBaseline ?? "");
129373
+ const failedRunPayload = await (0, codegen_flow_helpers_12.buildFailedRunPayload)(codegenError, (0, codegen_flow_helpers_12.getOutputPath)(), job_context_storage_12.jobContextStorage.getStore()?.gitBaseline ?? file_changes_1.EMPTY_GIT_BASELINE);
129267
129374
  await this.codeGenerationService.updateJob(jobId, {
129268
129375
  ...job?.payload,
129269
129376
  ...failedRunPayload
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.509",
3
+ "version": "1.0.511",
4
4
  "description": "AI-powered Wix CLI app generator - standalone executable",
5
5
  "scripts": {
6
6
  "build": "node build.mjs",
@@ -29,5 +29,5 @@
29
29
  "esbuild": "^0.27.2",
30
30
  "vitest": "^4.0.16"
31
31
  },
32
- "falconPackageHash": "fba31ef34931d17b62143ee61de9f7d9a47949cdec191c6894d7757e"
32
+ "falconPackageHash": "06353a55bb42ce8e3da2d97ce6b7d43efde480792d85421c1c86c281"
33
33
  }