@wix/ditto-codegen-public 1.0.345 → 1.0.347

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 +69 -49
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -11235,7 +11235,6 @@ var require_constants5 = __commonJS({
11235
11235
  dashboardMenuPlugin: "dashboard menu plugin",
11236
11236
  embeddedScript: "embedded script",
11237
11237
  event: "backend event",
11238
- genericExtension: "extension",
11239
11238
  customElement: "custom element",
11240
11239
  siteComponent: "editor react component",
11241
11240
  editorReactComponent: "editor react component",
@@ -11248,7 +11247,8 @@ var require_constants5 = __commonJS({
11248
11247
  ecomPaymentSettings: "service plugin",
11249
11248
  bookingsStaffSortingProvider: "service plugin",
11250
11249
  contextProvider: "context provider",
11251
- functionLibrary: "function library"
11250
+ functionLibrary: "function library",
11251
+ dataCollections: "data collection"
11252
11252
  };
11253
11253
  function normalizeFilePath(filePath) {
11254
11254
  return filePath.replace(exports2.CONTAINER_ROOT_PREFIX, "");
@@ -11257,9 +11257,6 @@ var require_constants5 = __commonJS({
11257
11257
  return EXTENSION_FILE_PATTERN.test(filePath);
11258
11258
  }
11259
11259
  function detectExtension(content) {
11260
- if (content.includes("genericExtension(") && content.includes("DATA_COMPONENT")) {
11261
- return { extensionType: "dataCollection", label: "collection" };
11262
- }
11263
11260
  for (const [extensionType, label] of Object.entries(exports2.BUILDER_TO_EXTENSION_LABEL)) {
11264
11261
  if (content.includes(`extensions.${extensionType}(`) || content.includes(`experimentalExtensions.${extensionType}(`)) {
11265
11262
  return { extensionType, label };
@@ -12662,6 +12659,19 @@ var require_types4 = __commonJS({
12662
12659
  }
12663
12660
  });
12664
12661
 
12662
+ // dist/opencode-integration/internal-paths.js
12663
+ var require_internal_paths = __commonJS({
12664
+ "dist/opencode-integration/internal-paths.js"(exports2) {
12665
+ "use strict";
12666
+ Object.defineProperty(exports2, "__esModule", { value: true });
12667
+ exports2.isInternalPath = isInternalPath;
12668
+ var INTERNAL_PATH_PREFIXES = [".agents/"];
12669
+ function isInternalPath(path) {
12670
+ return INTERNAL_PATH_PREFIXES.some((prefix) => path.startsWith(prefix));
12671
+ }
12672
+ }
12673
+ });
12674
+
12665
12675
  // dist/opencode-integration/parser.js
12666
12676
  var require_parser = __commonJS({
12667
12677
  "dist/opencode-integration/parser.js"(exports2) {
@@ -12678,6 +12688,7 @@ var require_parser = __commonJS({
12678
12688
  var ditto_codegen_types_12 = require_dist4();
12679
12689
  var types_1 = require_types4();
12680
12690
  var constants_1 = require_constants5();
12691
+ var internal_paths_1 = require_internal_paths();
12681
12692
  function parseEvents(output, type) {
12682
12693
  return output.split("\n").filter((line) => line.trim()).map((line) => (0, types_1.tryParseJson)(line)).filter((event) => event !== null && event.type === type);
12683
12694
  }
@@ -12708,7 +12719,7 @@ var require_parser = __commonJS({
12708
12719
  const seenPaths = /* @__PURE__ */ new Set();
12709
12720
  const addFileChange = (filePath, operation) => {
12710
12721
  const normalizedPath = (0, constants_1.normalizeFilePath)(filePath);
12711
- if (normalizedPath && !seenPaths.has(normalizedPath)) {
12722
+ if (normalizedPath && !(0, internal_paths_1.isInternalPath)(normalizedPath) && !seenPaths.has(normalizedPath)) {
12712
12723
  seenPaths.add(normalizedPath);
12713
12724
  filesChanged.push({ path: normalizedPath, operation });
12714
12725
  }
@@ -13480,27 +13491,51 @@ var require_collect_extensions_created = __commonJS({
13480
13491
  var promises_1 = require("fs/promises");
13481
13492
  var ditto_codegen_types_12 = require_dist4();
13482
13493
  var constants_1 = require_constants5();
13494
+ var DATA_COLLECTION_MARKER = /import\s+(?:type\s+)?\{[^}]*\bDataCollection\b[^}]*\}\s+from\s+['"]@wix\/astro\/builders['"]/;
13483
13495
  var getExtensionDirectory = (extensionDefinitionPath) => `${path_1.posix.dirname(extensionDefinitionPath)}/`;
13484
13496
  var isFileInExtensionFolder = (filePath, extensionDefinitionPath) => filePath === extensionDefinitionPath || filePath.startsWith(getExtensionDirectory(extensionDefinitionPath));
13497
+ var resolveFilePath = (outputPath, filePath) => (0, path_1.isAbsolute)(filePath) ? filePath : (0, path_1.join)(outputPath, filePath);
13498
+ var buildJobExtension = (definitionPath, extensionType, contentForTitle, titlePath, files) => ({
13499
+ path: definitionPath,
13500
+ extensionType,
13501
+ title: (0, constants_1.extractExtensionDisplayTitle)(contentForTitle, titlePath),
13502
+ files: [...files]
13503
+ });
13504
+ async function collectDataCollectionEntries(outputPath, parentExtensionFile, folderFiles) {
13505
+ const entries = [];
13506
+ for (const file of folderFiles) {
13507
+ if (file.path === parentExtensionFile.path)
13508
+ continue;
13509
+ try {
13510
+ const content = await (0, promises_1.readFile)(resolveFilePath(outputPath, file.path), "utf-8");
13511
+ if (!DATA_COLLECTION_MARKER.test(content))
13512
+ continue;
13513
+ entries.push(buildJobExtension(parentExtensionFile.path, "dataCollection", content, file.path, [parentExtensionFile, file]));
13514
+ } catch {
13515
+ continue;
13516
+ }
13517
+ }
13518
+ return entries;
13519
+ }
13485
13520
  async function collectInsertedExtensionsMetadata(outputPath, files) {
13486
13521
  const results = [];
13487
- for (const f of files) {
13488
- if (f.operation !== ditto_codegen_types_12.ExtensionGenerationOperation.INSERT)
13522
+ for (const fileChange of files) {
13523
+ if (fileChange.operation !== ditto_codegen_types_12.ExtensionGenerationOperation.INSERT)
13489
13524
  continue;
13490
- if (!(0, constants_1.isExtensionsFile)(f.path))
13525
+ if (!(0, constants_1.isExtensionsFile)(fileChange.path))
13491
13526
  continue;
13492
- const fullPath = (0, path_1.isAbsolute)(f.path) ? f.path : (0, path_1.join)(outputPath, f.path);
13493
13527
  try {
13494
- const content = await (0, promises_1.readFile)(fullPath, "utf-8");
13528
+ const content = await (0, promises_1.readFile)(resolveFilePath(outputPath, fileChange.path), "utf-8");
13495
13529
  const detected = (0, constants_1.detectExtension)(content);
13496
13530
  if (!detected)
13497
13531
  continue;
13498
- results.push({
13499
- path: f.path,
13500
- extensionType: detected.extensionType,
13501
- title: (0, constants_1.extractExtensionDisplayTitle)(content, f.path),
13502
- files: files.filter((file) => isFileInExtensionFolder(file.path, f.path))
13503
- });
13532
+ const folderFiles = files.filter((file) => isFileInExtensionFolder(file.path, fileChange.path));
13533
+ if (detected.extensionType === "dataCollections") {
13534
+ const dataCollectionEntries = await collectDataCollectionEntries(outputPath, fileChange, folderFiles);
13535
+ results.push(...dataCollectionEntries);
13536
+ continue;
13537
+ }
13538
+ results.push(buildJobExtension(fileChange.path, detected.extensionType, content, fileChange.path, folderFiles));
13504
13539
  } catch {
13505
13540
  continue;
13506
13541
  }
@@ -13672,6 +13707,7 @@ var require_git_file_changes = __commonJS({
13672
13707
  var child_process_1 = require("child_process");
13673
13708
  var util_1 = require("util");
13674
13709
  var ditto_codegen_types_12 = require_dist4();
13710
+ var internal_paths_1 = require_internal_paths();
13675
13711
  var logger_12 = require_logger();
13676
13712
  var execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
13677
13713
  async function captureGitBaseline(cwd) {
@@ -13694,8 +13730,9 @@ var require_git_file_changes = __commonJS({
13694
13730
  ]);
13695
13731
  const files = parseDiffNameStatus(diffResult.stdout);
13696
13732
  appendUntrackedFiles(untrackedResult.stdout, files);
13697
- files.sort((a, b) => a.path.localeCompare(b.path));
13698
- return files;
13733
+ const userFiles = files.filter((f) => !(0, internal_paths_1.isInternalPath)(f.path));
13734
+ userFiles.sort((a, b) => a.path.localeCompare(b.path));
13735
+ return userFiles;
13699
13736
  } catch (error) {
13700
13737
  logger_12.logger.error("[OpenCode] Failed to collect git file changes", {
13701
13738
  error: error instanceof Error ? error.message : String(error)
@@ -19423,16 +19460,17 @@ var require_skills_installer = __commonJS({
19423
19460
  "use strict";
19424
19461
  Object.defineProperty(exports2, "__esModule", { value: true });
19425
19462
  exports2.installSkills = installSkills;
19426
- var child_process_1 = require("child_process");
19427
19463
  var fs_1 = require("fs");
19428
- var util_1 = require("util");
19464
+ var path_1 = require("path");
19429
19465
  var ditto_codegen_types_12 = require_dist4();
19430
19466
  var skills_override_1 = require_skills_override();
19431
- var execAsync = (0, util_1.promisify)(child_process_1.exec);
19432
- var SKILLS_INSTALL_COMMAND = "npx --yes skills add wix/skills -s wix-app wix-design-system -g -a opencode -y";
19467
+ function hasSkills(dir) {
19468
+ return (0, fs_1.existsSync)(dir) && (0, fs_1.readdirSync)(dir).length > 0;
19469
+ }
19433
19470
  async function installSkills(outputPath, log) {
19434
19471
  const skillsOverride = process.env.SKILLS_OVERRIDE_BRANCH;
19435
- const isPreInstalled = (0, fs_1.existsSync)(skills_override_1.SKILLS_DIR) && (0, fs_1.readdirSync)(skills_override_1.SKILLS_DIR).length > 0;
19472
+ const projectSkillsDir = (0, path_1.join)(outputPath, ".agents", "skills");
19473
+ const isPreInstalled = hasSkills(skills_override_1.SKILLS_DIR) || hasSkills(projectSkillsDir);
19436
19474
  if (isPreInstalled && !skillsOverride) {
19437
19475
  log.info("[Skills] Skipping runtime skills installation (pre-installed via Docker image)", { environment: process.env.CODEGEN_ENVIRONMENT });
19438
19476
  return;
@@ -19443,35 +19481,17 @@ var require_skills_installer = __commonJS({
19443
19481
  await (0, skills_override_1.overrideSkills)(overrides, outputPath, log);
19444
19482
  return;
19445
19483
  } catch (error) {
19446
- if (isPreInstalled) {
19447
- throw new ditto_codegen_types_12.ProcessExecutionError("Failed to override pre-installed skills", { processType: ditto_codegen_types_12.ProcessType.INITIALIZATION, cause: error });
19448
- }
19449
19484
  const errorMessage = error instanceof Error ? error.message : String(error);
19450
- log.warn("[Skills] Branch override failed, falling back to default", {
19451
- error: errorMessage
19452
- });
19485
+ log.error("[Skills] Branch override failed", { error: errorMessage });
19486
+ throw new ditto_codegen_types_12.ProcessExecutionError(isPreInstalled ? "Failed to override pre-installed skills" : "Skills override failed and no pre-installed skills available", { processType: ditto_codegen_types_12.ProcessType.INITIALIZATION, cause: error });
19453
19487
  }
19454
19488
  }
19455
- log.info("[Skills] Installing Wix skills globally", {
19456
- installInternalSkills: process.env.INSTALL_INTERNAL_SKILLS
19489
+ log.error("[Skills] No skills available \u2014 pre-install missing and no override", {
19490
+ globalSkillsDir: skills_override_1.SKILLS_DIR,
19491
+ projectSkillsDir,
19492
+ environment: process.env.CODEGEN_ENVIRONMENT
19457
19493
  });
19458
- try {
19459
- const { stdout, stderr } = await execAsync(SKILLS_INSTALL_COMMAND, {
19460
- cwd: outputPath
19461
- });
19462
- if (stderr && !stderr.includes("npm warn")) {
19463
- log.warn("[Skills] Installation stderr", { stderr });
19464
- }
19465
- console.log("[Skills] Skills installed successfully\n", stdout);
19466
- log.debug("[Skills] Skills installed successfully", { stdout });
19467
- } catch (error) {
19468
- const errorMessage = error instanceof Error ? error.message : String(error);
19469
- log.error("[Skills] Failed to install skills", { error: errorMessage });
19470
- throw new ditto_codegen_types_12.ProcessExecutionError("Failed to install Wix skills", {
19471
- processType: ditto_codegen_types_12.ProcessType.INITIALIZATION,
19472
- cause: error
19473
- });
19474
- }
19494
+ throw new ditto_codegen_types_12.ProcessExecutionError("Skills not pre-installed and no SKILLS_OVERRIDE_BRANCH set \u2014 verify the Docker image bake-time install ran successfully.", { processType: ditto_codegen_types_12.ProcessType.INITIALIZATION });
19475
19495
  }
19476
19496
  }
19477
19497
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.345",
3
+ "version": "1.0.347",
4
4
  "description": "AI-powered Wix CLI app generator - standalone executable",
5
5
  "scripts": {
6
6
  "build": "node build.mjs",
@@ -28,5 +28,5 @@
28
28
  "esbuild": "^0.27.2",
29
29
  "vitest": "^4.0.16"
30
30
  },
31
- "falconPackageHash": "fa273ae4cec1a778feb1e32b156c7b89b0638ac919a56d66298ecdd5"
31
+ "falconPackageHash": "08231ee565611b4b7a817e282b1afc9a2c80d4e437af9683d13fa37c"
32
32
  }