@wix/ditto-codegen-public 1.0.285 → 1.0.287

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 +92 -23
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -39,7 +39,7 @@ var require_types_impl = __commonJS({
39
39
  "../../node_modules/@wix/ambassador-ctp-codegen-job-service-v1-job/cjs/build/types.impl.js"(exports2) {
40
40
  "use strict";
41
41
  Object.defineProperty(exports2, "__esModule", { value: true });
42
- exports2.UserDecisionQuestionType = exports2.Status = exports2.TaskKind = void 0;
42
+ exports2.Environment = exports2.UserDecisionQuestionType = exports2.Status = exports2.TaskKind = void 0;
43
43
  var TaskKind;
44
44
  (function(TaskKind2) {
45
45
  TaskKind2["UNKNOWN_TASK_KIND"] = "UNKNOWN_TASK_KIND";
@@ -65,6 +65,12 @@ var require_types_impl = __commonJS({
65
65
  UserDecisionQuestionType2["UNKNOWN_QUESTION_TYPE"] = "UNKNOWN_QUESTION_TYPE";
66
66
  UserDecisionQuestionType2["UI_COMPONENT_TYPE"] = "UI_COMPONENT_TYPE";
67
67
  })(UserDecisionQuestionType || (exports2.UserDecisionQuestionType = UserDecisionQuestionType = {}));
68
+ var Environment;
69
+ (function(Environment2) {
70
+ Environment2["UNKNOWN_ENVIRONMENT"] = "UNKNOWN_ENVIRONMENT";
71
+ Environment2["APP_BUILDER"] = "APP_BUILDER";
72
+ Environment2["STUDIO_2"] = "STUDIO_2";
73
+ })(Environment || (exports2.Environment = Environment = {}));
68
74
  }
69
75
  });
70
76
 
@@ -11581,7 +11587,7 @@ var require_constants5 = __commonJS({
11581
11587
  event: "backend event",
11582
11588
  genericExtension: "extension",
11583
11589
  customElement: "custom element",
11584
- siteComponent: "site component",
11590
+ siteComponent: "editor react component",
11585
11591
  sitePlugin: "site plugin",
11586
11592
  ecomShippingRates: "service plugin",
11587
11593
  ecomAdditionalFees: "service plugin",
@@ -17668,20 +17674,20 @@ var require_pre_run_decision = __commonJS({
17668
17674
  const selectedType = await (0, job_decision_manager_1.askJobChoice)(jobId, `What type of site UI element would you like to create for "${extensionName}"?`, [
17669
17675
  {
17670
17676
  id: types_1.ExtensionType.SITE_WIDGET,
17671
- label: "Site Widget (Custom Element)",
17677
+ label: "Custom Element Widget",
17672
17678
  description: "A self-contained widget built as a Custom Element, embedded on the site. Best for standalone, reusable components."
17673
17679
  },
17674
17680
  {
17675
17681
  id: types_1.ExtensionType.SITE_COMPONENT,
17676
- label: "Site Component (React)",
17682
+ label: "Editor React Component",
17677
17683
  description: "A React component that integrates with the site builder. Best for components that need to work with Wix editor features."
17678
17684
  }
17679
- ], "Site Widgets are standalone embeddable units with their own styling, while Site Components integrate more deeply with the Wix editor and builder.");
17685
+ ], "Custom Element Widgets are standalone embeddable units with their own styling, while Editor React Components integrate more deeply with the Wix editor and builder.");
17680
17686
  const isTypeChanged = selectedType !== currentType;
17681
17687
  logger_12.logger.info(`[PreDecision] User selected ${selectedType} for "${extensionName}"${isTypeChanged ? ` (changed from ${currentType})` : " (unchanged)"}`);
17682
17688
  const appliedDecision = {
17683
17689
  type: "SITE_UI_TYPE",
17684
- question: "Site Widget vs Site Component",
17690
+ question: "Custom Element Widget vs Editor React Component",
17685
17691
  selectedOptionId: selectedType
17686
17692
  };
17687
17693
  return {
@@ -18192,6 +18198,68 @@ var require_job_timeout_monitor = __commonJS({
18192
18198
  }
18193
18199
  });
18194
18200
 
18201
+ // dist/opencode-integration/skills-override.js
18202
+ var require_skills_override = __commonJS({
18203
+ "dist/opencode-integration/skills-override.js"(exports2) {
18204
+ "use strict";
18205
+ Object.defineProperty(exports2, "__esModule", { value: true });
18206
+ exports2.SKILLS_DIR = void 0;
18207
+ exports2.parseSkillsOverrides = parseSkillsOverrides;
18208
+ exports2.overrideSkills = overrideSkills;
18209
+ var child_process_1 = require("child_process");
18210
+ var util_1 = require("util");
18211
+ var execAsync = (0, util_1.promisify)(child_process_1.exec);
18212
+ exports2.SKILLS_DIR = "/root/.agents/skills";
18213
+ function tarballUrl(repo, branch) {
18214
+ return `https://github.com/${repo}/archive/${branch}.tar.gz`;
18215
+ }
18216
+ function buildListSkillsCommand(repo, branch) {
18217
+ return `curl -sL ${tarballUrl(repo, branch)} | tar tz --wildcards "*/skills/*" | sed 's|^[^/]*/skills/||' | cut -d/ -f1 | sort -u`;
18218
+ }
18219
+ function buildOverrideCommand(repo, branch) {
18220
+ return `mkdir -p ${exports2.SKILLS_DIR} && curl -sL ${tarballUrl(repo, branch)} | tar xz --strip-components=2 -C ${exports2.SKILLS_DIR} --wildcards "*/skills/*"`;
18221
+ }
18222
+ function parseSkillsOverrides(value) {
18223
+ return value.split(",").map((entry) => entry.trim()).filter(Boolean).map((entry) => {
18224
+ const colonIndex = entry.lastIndexOf(":");
18225
+ if (colonIndex === -1) {
18226
+ throw new Error(`Invalid skills override entry "${entry}": expected format "repo:branch"`);
18227
+ }
18228
+ return {
18229
+ repo: entry.slice(0, colonIndex),
18230
+ branch: entry.slice(colonIndex + 1)
18231
+ };
18232
+ });
18233
+ }
18234
+ async function overrideSkills(overrides, outputPath, log) {
18235
+ for (const { repo, branch } of overrides) {
18236
+ log.info("[Skills] Listing skills from repo", { repo, branch });
18237
+ const { stdout } = await execAsync(buildListSkillsCommand(repo, branch));
18238
+ const skillNames = stdout.trim().split("\n").filter(Boolean);
18239
+ if (skillNames.length === 0) {
18240
+ log.warn("[Skills] No skills found in repo, skipping", { repo, branch });
18241
+ continue;
18242
+ }
18243
+ log.info("[Skills] Removing existing skills before override", {
18244
+ repo,
18245
+ branch,
18246
+ skillNames
18247
+ });
18248
+ const paths = skillNames.map((name) => `${exports2.SKILLS_DIR}/${name}`).join(" ");
18249
+ await execAsync(`rm -rf ${paths}`);
18250
+ log.info("[Skills] Extracting skills from repo", { repo, branch });
18251
+ await execAsync(buildOverrideCommand(repo, branch), {
18252
+ cwd: outputPath
18253
+ });
18254
+ log.info("[Skills] Skills overridden from repo successfully", {
18255
+ repo,
18256
+ branch
18257
+ });
18258
+ }
18259
+ }
18260
+ }
18261
+ });
18262
+
18195
18263
  // dist/opencode-integration/skills-installer.js
18196
18264
  var require_skills_installer = __commonJS({
18197
18265
  "dist/opencode-integration/skills-installer.js"(exports2) {
@@ -18199,36 +18267,37 @@ var require_skills_installer = __commonJS({
18199
18267
  Object.defineProperty(exports2, "__esModule", { value: true });
18200
18268
  exports2.installSkills = installSkills;
18201
18269
  var child_process_1 = require("child_process");
18270
+ var fs_1 = require("fs");
18202
18271
  var util_1 = require("util");
18203
18272
  var ditto_codegen_types_12 = require_dist4();
18273
+ var skills_override_1 = require_skills_override();
18204
18274
  var execAsync = (0, util_1.promisify)(child_process_1.exec);
18205
- var SKILLS_DIR = "/root/.agents/skills";
18206
18275
  var SKILLS_INSTALL_COMMAND = "npx --yes skills add wix/skills -g -a opencode -y";
18207
- function buildOverrideCommand(branch) {
18208
- return `rm -rf ${SKILLS_DIR} && mkdir -p ${SKILLS_DIR} && curl -sL https://github.com/wix/skills/archive/${branch}.tar.gz | tar xz --strip-components=2 -C ${SKILLS_DIR} --wildcards "*/skills/*"`;
18209
- }
18210
18276
  async function installSkills(outputPath, log) {
18211
- log.info("[Skills] Installing Wix skills globally", {
18212
- installInternalSkills: process.env.INSTALL_INTERNAL_SKILLS
18213
- });
18214
- const overrideBranch = process.env.SKILLS_OVERRIDE_BRANCH;
18215
- if (overrideBranch) {
18277
+ const skillsOverride = process.env.SKILLS_OVERRIDE_BRANCH;
18278
+ const isPreInstalled = (0, fs_1.existsSync)(skills_override_1.SKILLS_DIR) && (0, fs_1.readdirSync)(skills_override_1.SKILLS_DIR).length > 0;
18279
+ if (isPreInstalled && !skillsOverride) {
18280
+ log.info("[Skills] Skipping runtime skills installation (pre-installed via Docker image)", { environment: process.env.CODEGEN_ENVIRONMENT });
18281
+ return;
18282
+ }
18283
+ if (skillsOverride) {
18216
18284
  try {
18217
- log.info("[Skills] Installing skills from branch", {
18218
- branch: overrideBranch
18219
- });
18220
- await execAsync(buildOverrideCommand(overrideBranch), {
18221
- cwd: outputPath
18222
- });
18223
- log.info("[Skills] Skills installed from branch successfully");
18285
+ const overrides = (0, skills_override_1.parseSkillsOverrides)(skillsOverride);
18286
+ await (0, skills_override_1.overrideSkills)(overrides, outputPath, log);
18224
18287
  return;
18225
18288
  } catch (error) {
18289
+ if (isPreInstalled) {
18290
+ throw new ditto_codegen_types_12.ProcessExecutionError("Failed to override pre-installed skills", { processType: ditto_codegen_types_12.ProcessType.INITIALIZATION, cause: error });
18291
+ }
18226
18292
  const errorMessage = error instanceof Error ? error.message : String(error);
18227
- log.warn("[Skills] Branch install failed, falling back to default", {
18293
+ log.warn("[Skills] Branch override failed, falling back to default", {
18228
18294
  error: errorMessage
18229
18295
  });
18230
18296
  }
18231
18297
  }
18298
+ log.info("[Skills] Installing Wix skills globally", {
18299
+ installInternalSkills: process.env.INSTALL_INTERNAL_SKILLS
18300
+ });
18232
18301
  try {
18233
18302
  const { stdout, stderr } = await execAsync(SKILLS_INSTALL_COMMAND, {
18234
18303
  cwd: outputPath
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.285",
3
+ "version": "1.0.287",
4
4
  "description": "AI-powered Wix CLI app generator - standalone executable",
5
5
  "scripts": {
6
6
  "build": "node build.mjs",
@@ -27,5 +27,5 @@
27
27
  "@wix/ditto-codegen": "1.0.0",
28
28
  "esbuild": "^0.27.2"
29
29
  },
30
- "falconPackageHash": "82fdf19541855b8bcfaf5dc954f1d7afc0a2a0549bfbecd2e2ce7421"
30
+ "falconPackageHash": "cfca0a7d26f668b5e6db9393a69bea9ac4300d1ae7d0b2084d0543a1"
31
31
  }