@wix/ditto-codegen-public 1.0.356 → 1.0.357

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 +38 -17
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -19497,7 +19497,8 @@ var require_skills_installer = __commonJS({
19497
19497
  "dist/opencode-integration/skills-installer.js"(exports2) {
19498
19498
  "use strict";
19499
19499
  Object.defineProperty(exports2, "__esModule", { value: true });
19500
- exports2.installSkills = installSkills;
19500
+ exports2.applySkillsOverride = applySkillsOverride;
19501
+ exports2.ensureSkillsReady = ensureSkillsReady;
19501
19502
  var fs_1 = require("fs");
19502
19503
  var path_1 = require("path");
19503
19504
  var ditto_codegen_types_12 = require_dist4();
@@ -19505,31 +19506,50 @@ var require_skills_installer = __commonJS({
19505
19506
  function hasSkills(dir) {
19506
19507
  return (0, fs_1.existsSync)(dir) && (0, fs_1.readdirSync)(dir).length > 0;
19507
19508
  }
19508
- async function installSkills(outputPath, log) {
19509
+ var delay2 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
19510
+ async function applySkillsOverride(outputPath, log) {
19509
19511
  const skillsOverride = process.env.SKILLS_OVERRIDE_BRANCH;
19512
+ if (!skillsOverride) {
19513
+ return;
19514
+ }
19515
+ try {
19516
+ const overrides = (0, skills_override_1.parseSkillsOverrides)(skillsOverride);
19517
+ await (0, skills_override_1.overrideSkills)(overrides, outputPath, log);
19518
+ } catch (error) {
19519
+ const errorMessage = error instanceof Error ? error.message : String(error);
19520
+ log.error("[Skills] Branch override failed", { error: errorMessage });
19521
+ throw new ditto_codegen_types_12.ProcessExecutionError("Failed to apply SKILLS_OVERRIDE_BRANCH", {
19522
+ processType: ditto_codegen_types_12.ProcessType.INITIALIZATION,
19523
+ cause: error
19524
+ });
19525
+ }
19526
+ }
19527
+ async function ensureSkillsReady(outputPath, log, { timeoutMs = 6e4, intervalMs = 1e3 } = {}) {
19510
19528
  const projectSkillsDir = (0, path_1.join)(outputPath, ".agents", "skills");
19511
- const isPreInstalled = hasSkills(skills_override_1.SKILLS_DIR) || hasSkills(projectSkillsDir);
19512
- if (isPreInstalled && !skillsOverride) {
19513
- log.info("[Skills] Skipping runtime skills installation (pre-installed via Docker image)", { environment: process.env.CODEGEN_ENVIRONMENT });
19529
+ const skillsPresent = () => hasSkills(skills_override_1.SKILLS_DIR) || hasSkills(projectSkillsDir);
19530
+ if (skillsPresent()) {
19514
19531
  return;
19515
19532
  }
19516
- if (skillsOverride) {
19517
- try {
19518
- const overrides = (0, skills_override_1.parseSkillsOverrides)(skillsOverride);
19519
- await (0, skills_override_1.overrideSkills)(overrides, outputPath, log);
19533
+ log.info("[Skills] Not present yet \u2014 waiting for the startup install", {
19534
+ globalSkillsDir: skills_override_1.SKILLS_DIR,
19535
+ projectSkillsDir,
19536
+ timeoutMs
19537
+ });
19538
+ const deadline = Date.now() + timeoutMs;
19539
+ while (Date.now() < deadline) {
19540
+ await delay2(intervalMs);
19541
+ if (skillsPresent()) {
19542
+ log.info("[Skills] Skills became available");
19520
19543
  return;
19521
- } catch (error) {
19522
- const errorMessage = error instanceof Error ? error.message : String(error);
19523
- log.error("[Skills] Branch override failed", { error: errorMessage });
19524
- 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 });
19525
19544
  }
19526
19545
  }
19527
- log.error("[Skills] No skills available \u2014 pre-install missing and no override", {
19546
+ log.error("[Skills] No skills available after waiting", {
19528
19547
  globalSkillsDir: skills_override_1.SKILLS_DIR,
19529
19548
  projectSkillsDir,
19530
- environment: process.env.CODEGEN_ENVIRONMENT
19549
+ environment: process.env.CODEGEN_ENVIRONMENT,
19550
+ timeoutMs
19531
19551
  });
19532
- 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 });
19552
+ throw new ditto_codegen_types_12.ProcessExecutionError("Skills not available \u2014 verify the install-skills step (codegen-install --phase startup) ran and populated /root/.agents/skills.", { processType: ditto_codegen_types_12.ProcessType.INITIALIZATION });
19533
19553
  }
19534
19554
  }
19535
19555
  });
@@ -19684,7 +19704,7 @@ async function initOpenCode() {
19684
19704
  await Promise.all([
19685
19705
  (0, rules_writer_1.writeRuleFiles)([...envConfig.codegenRules, ...pluginArtifacts.rules]),
19686
19706
  (0, rules_writer_1.writeRuleFiles)(envConfig.askRules),
19687
- (0, skills_installer_1.installSkills)((0, codegen_flow_helpers_1.getOutputPath)(), logger_1.logger),
19707
+ (0, skills_installer_1.applySkillsOverride)((0, codegen_flow_helpers_1.getOutputPath)(), logger_1.logger),
19688
19708
  (0, tools_writer_1.writeToolFiles)(pluginArtifacts.tools)
19689
19709
  ]);
19690
19710
  }
@@ -19765,6 +19785,7 @@ async function processJob(job) {
19765
19785
  keys: Object.keys(agentData)
19766
19786
  });
19767
19787
  }
19788
+ await (0, skills_installer_1.ensureSkillsReady)((0, codegen_flow_helpers_1.getOutputPath)(), logger_1.logger);
19768
19789
  if (task.kind === CodeGenService_1.TaskKind.ASK_CODEGEN) {
19769
19790
  await (0, opencode_ask_1.runOpencodeAskFlow)(history);
19770
19791
  } else if (task.kind === CodeGenService_1.TaskKind.ITERATE_CODEGEN) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.356",
3
+ "version": "1.0.357",
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": "46430d23524ff58385dfa134d092b0d3cee668df1418e967dec43c10"
32
+ "falconPackageHash": "236fead8ed789d2e79367a542151458b9890fc135b057e67784bb6f9"
33
33
  }