@wix/ditto-codegen-public 1.0.383 → 1.0.385

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 +443 -125
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -10840,6 +10840,7 @@ var require_CodeGenService = __commonJS({
10840
10840
  path: ext.path,
10841
10841
  extensionType: ext.extensionType,
10842
10842
  title: ext.title,
10843
+ isSpi: ext.isSpi,
10843
10844
  files: ext.files.map((f) => ({
10844
10845
  path: f.path,
10845
10846
  operation: FILE_OPERATION[f.operation] ?? types_1.FileOperation.UNKNOWN_FILE_OPERATION
@@ -11299,12 +11300,33 @@ var require_ask_prompt = __commonJS({
11299
11300
  }
11300
11301
  });
11301
11302
 
11303
+ // dist/opencode-integration/prompts/git-conflicts-prompt.js
11304
+ var require_git_conflicts_prompt = __commonJS({
11305
+ "dist/opencode-integration/prompts/git-conflicts-prompt.js"(exports2) {
11306
+ "use strict";
11307
+ Object.defineProperty(exports2, "__esModule", { value: true });
11308
+ exports2.buildGitConflictsPrompt = buildGitConflictsPrompt;
11309
+ var prompt_utils_1 = require_prompt_utils();
11310
+ function buildGitConflictsPrompt(history) {
11311
+ const { currentUserRequest } = (0, prompt_utils_1.extractUserRequestAndFilteredHistory)(history);
11312
+ const base = "Fix all Git merge conflicts in the current project. Resolve every conflict marker (<<<<<<<, =======, >>>>>>>) so the code compiles correctly.";
11313
+ const sections = [
11314
+ base,
11315
+ currentUserRequest ? `Additional context from user: "${currentUserRequest}"` : "",
11316
+ (0, prompt_utils_1.formatChatHistory)(history.slice(-5), "CONVERSATION CONTEXT"),
11317
+ (0, prompt_utils_1.buildAppContext)()
11318
+ ];
11319
+ return sections.filter(Boolean).join("\n\n");
11320
+ }
11321
+ }
11322
+ });
11323
+
11302
11324
  // dist/opencode-integration/prompts/index.js
11303
11325
  var require_prompts = __commonJS({
11304
11326
  "dist/opencode-integration/prompts/index.js"(exports2) {
11305
11327
  "use strict";
11306
11328
  Object.defineProperty(exports2, "__esModule", { value: true });
11307
- exports2.buildAskPrompt = exports2.buildIterationPrompt = exports2.buildRecoveryPrompt = exports2.buildInitPrompt = void 0;
11329
+ exports2.buildGitConflictsPrompt = exports2.buildAskPrompt = exports2.buildIterationPrompt = exports2.buildRecoveryPrompt = exports2.buildInitPrompt = void 0;
11308
11330
  var codegen_prompt_1 = require_codegen_prompt();
11309
11331
  Object.defineProperty(exports2, "buildInitPrompt", { enumerable: true, get: function() {
11310
11332
  return codegen_prompt_1.buildInitPrompt;
@@ -11320,6 +11342,10 @@ var require_prompts = __commonJS({
11320
11342
  Object.defineProperty(exports2, "buildAskPrompt", { enumerable: true, get: function() {
11321
11343
  return ask_prompt_1.buildAskPrompt;
11322
11344
  } });
11345
+ var git_conflicts_prompt_1 = require_git_conflicts_prompt();
11346
+ Object.defineProperty(exports2, "buildGitConflictsPrompt", { enumerable: true, get: function() {
11347
+ return git_conflicts_prompt_1.buildGitConflictsPrompt;
11348
+ } });
11323
11349
  }
11324
11350
  });
11325
11351
 
@@ -11328,8 +11354,9 @@ var require_constants5 = __commonJS({
11328
11354
  "dist/opencode-integration/task-tracker/constants.js"(exports2) {
11329
11355
  "use strict";
11330
11356
  Object.defineProperty(exports2, "__esModule", { value: true });
11331
- exports2.BUILDER_TO_EXTENSION_LABEL = exports2.WIX_MCP_SERVER_NAME = exports2.CONTAINER_ROOT_PREFIX = void 0;
11357
+ exports2.WIX_MCP_SERVER_NAME = exports2.CONTAINER_ROOT_PREFIX = void 0;
11332
11358
  exports2.resolveFileOperation = resolveFileOperation;
11359
+ exports2.isSpiExtension = isSpiExtension;
11333
11360
  exports2.normalizeFilePath = normalizeFilePath;
11334
11361
  exports2.isExtensionsFile = isExtensionsFile;
11335
11362
  exports2.detectExtension = detectExtension;
@@ -11350,28 +11377,35 @@ var require_constants5 = __commonJS({
11350
11377
  }
11351
11378
  return null;
11352
11379
  }
11353
- exports2.BUILDER_TO_EXTENSION_LABEL = {
11354
- dashboardPage: "dashboard page",
11355
- dashboardModal: "dashboard modal",
11356
- dashboardPlugin: "dashboard plugin",
11357
- dashboardMenuPlugin: "dashboard menu plugin",
11358
- embeddedScript: "embedded script",
11359
- event: "backend event",
11360
- customElement: "custom element",
11361
- siteComponent: "editor react component",
11362
- editorReactComponent: "editor react component",
11363
- sitePlugin: "site plugin",
11364
- ecomShippingRates: "service plugin",
11365
- ecomAdditionalFees: "service plugin",
11366
- ecomValidations: "service plugin",
11367
- ecomDiscountTriggers: "service plugin",
11368
- ecomGiftCards: "service plugin",
11369
- ecomPaymentSettings: "service plugin",
11370
- bookingsStaffSortingProvider: "service plugin",
11371
- contextProvider: "context provider",
11372
- functionLibrary: "function library",
11373
- dataCollections: "data collection"
11374
- };
11380
+ var SPI_EXTENSION_TYPES = [
11381
+ "ecomShippingRates",
11382
+ "ecomAdditionalFees",
11383
+ "ecomValidations",
11384
+ "ecomDiscountTriggers",
11385
+ "ecomGiftCards",
11386
+ "ecomPaymentSettings",
11387
+ "bookingsStaffSortingProvider"
11388
+ ];
11389
+ var BUILDER_EXTENSION_TYPES = [
11390
+ "dashboardPage",
11391
+ "dashboardModal",
11392
+ "dashboardPlugin",
11393
+ "dashboardMenuPlugin",
11394
+ "embeddedScript",
11395
+ "event",
11396
+ "customElement",
11397
+ "siteComponent",
11398
+ "editorReactComponent",
11399
+ "sitePlugin",
11400
+ ...SPI_EXTENSION_TYPES,
11401
+ "contextProvider",
11402
+ "functionLibrary",
11403
+ "dataCollections"
11404
+ ];
11405
+ var SPI_EXTENSION_TYPE_SET = new Set(SPI_EXTENSION_TYPES);
11406
+ function isSpiExtension(extensionType) {
11407
+ return SPI_EXTENSION_TYPE_SET.has(extensionType);
11408
+ }
11375
11409
  function normalizeFilePath(filePath) {
11376
11410
  return filePath.replace(exports2.CONTAINER_ROOT_PREFIX, "");
11377
11411
  }
@@ -11379,9 +11413,9 @@ var require_constants5 = __commonJS({
11379
11413
  return EXTENSION_FILE_PATTERN.test(filePath);
11380
11414
  }
11381
11415
  function detectExtension(content) {
11382
- for (const [extensionType, label] of Object.entries(exports2.BUILDER_TO_EXTENSION_LABEL)) {
11416
+ for (const extensionType of BUILDER_EXTENSION_TYPES) {
11383
11417
  if (content.includes(`extensions.${extensionType}(`) || content.includes(`experimentalExtensions.${extensionType}(`)) {
11384
- return { extensionType, label };
11418
+ return extensionType;
11385
11419
  }
11386
11420
  }
11387
11421
  return null;
@@ -11489,6 +11523,9 @@ var require_rules_writer = __commonJS({
11489
11523
  return (0, path_1.join)(GLOBAL_RULES_DIR, filename);
11490
11524
  }
11491
11525
  async function writeRuleFiles(rules) {
11526
+ if (rules.length === 0) {
11527
+ return [];
11528
+ }
11492
11529
  await (0, promises_1.mkdir)(GLOBAL_RULES_DIR, { recursive: true });
11493
11530
  const paths = rules.map((rule) => getRulePath(rule.filename));
11494
11531
  await Promise.all(rules.map((rule) => (0, promises_1.writeFile)(getRulePath(rule.filename), rule.content, "utf-8")));
@@ -11674,6 +11711,7 @@ var require_dist5 = __commonJS({
11674
11711
  exports2.appBuilderCodegenConfig = {
11675
11712
  codegenRules: [],
11676
11713
  askRules: [],
11714
+ gitConflictsRules: [],
11677
11715
  decisionCheckers: [],
11678
11716
  plugins: []
11679
11717
  };
@@ -13904,6 +13942,7 @@ var require_dist8 = __commonJS({
13904
13942
  { filename: "site-data-layer-rules.md", content: codegen_common_logic_1.SITE_DATA_LAYER_RULES }
13905
13943
  ],
13906
13944
  askRules: [],
13945
+ gitConflictsRules: [],
13907
13946
  decisionCheckers: [],
13908
13947
  plugins: [codegen_checkpoint_plugin_1.checkpointPluginFactory]
13909
13948
  };
@@ -14254,6 +14293,7 @@ var require_dist10 = __commonJS({
14254
14293
  { filename: "site-data-layer-rules.md", content: codegen_common_logic_1.SITE_DATA_LAYER_RULES }
14255
14294
  ],
14256
14295
  askRules: [],
14296
+ gitConflictsRules: [],
14257
14297
  decisionCheckers: [],
14258
14298
  plugins: [codegen_feature_vibe_plugin_1.featureVibePluginFactory]
14259
14299
  };
@@ -14379,6 +14419,61 @@ DEBUGGING GUIDANCE:
14379
14419
  }
14380
14420
  });
14381
14421
 
14422
+ // dist/opencode-integration/rules/git-conflicts-rules.js
14423
+ var require_git_conflicts_rules = __commonJS({
14424
+ "dist/opencode-integration/rules/git-conflicts-rules.js"(exports2) {
14425
+ "use strict";
14426
+ Object.defineProperty(exports2, "__esModule", { value: true });
14427
+ exports2.GIT_CONFLICTS_RULES = void 0;
14428
+ exports2.GIT_CONFLICTS_RULES = `CORE PRINCIPLES:
14429
+ - You are a Git merge conflict resolver. Your ONLY job is to fix merge conflict markers in files.
14430
+ - Do NOT generate new features, refactor code, or make changes beyond resolving conflicts.
14431
+ - NEVER use mocks, placeholders, or TODOs.
14432
+
14433
+ UNDERSTAND INTENT FIRST:
14434
+ - Before resolving a conflict, understand WHAT each side was trying to accomplish and WHY \u2014 not just which lines differ. Read enough of the surrounding file (and the imports/usages the conflict touches) to know the intent of both sides.
14435
+ - When the change is non-trivial, inspect recent history to learn what the incoming branch refactored: \`git log -p -n 3 -- <file>\` and \`git diff\` are READ-ONLY and safe. NEVER run \`git merge\`, \`git rebase\`, \`git checkout\`, \`git reset\`, \`git add\`, or \`git commit\` \u2014 only the agent's edit tools change files; git state is managed by the host.
14436
+
14437
+ CONFLICT RESOLUTION STRATEGY:
14438
+ - Identify all files containing conflict markers: <<<<<<<, =======, >>>>>>>
14439
+ - The HEAD (OURS) section (between <<<<<<< and =======) represents the current branch's changes \u2014 preserve this code.
14440
+ - The incoming (THEIRS) section (between ======= and >>>>>>>) represents the changes being merged in.
14441
+ - Resolve each conflict by merging both sides logically \u2014 judge by SEMANTIC meaning, not line-by-line text:
14442
+ - If both sides add independent, non-overlapping code \u2014 include both.
14443
+ - If they modify the same logic \u2014 prefer HEAD (OURS) and incorporate non-conflicting parts from THEIRS.
14444
+ - If THEIRS deletes something that HEAD modifies \u2014 keep HEAD's version.
14445
+ - De-duplicate when merging both sides: combine and dedupe additive changes such as imports, exports, list/array entries, object keys, and config \u2014 NEVER leave two copies of the same import or declaration.
14446
+ - After resolving, remove ALL conflict markers. The final file must contain zero conflict markers.
14447
+ - Do NOT revert or undo any working code that existed before the conflict.
14448
+
14449
+ SEMANTIC CORRECTNESS \u2014 beyond removing markers:
14450
+ - A clean merge has NO markers AND is logically coherent. Watch for semantic conflicts: code that compiles after the markers are gone but is contradictory or broken (duplicate/clashing declarations, a variable renamed on one side but still referenced by the other, a function signature changed on one side but called the old way on the other, half-merged statements).
14451
+ - After merging, re-read the resolved region in context to confirm both sides' intent is preserved and the result type-checks. This is what the \`validate\` step exists to catch \u2014 fix anything it surfaces.
14452
+
14453
+ MINIMIZE TEXT OUTPUT \u2014 CRITICAL:
14454
+ - Do NOT narrate your actions or explain your decisions.
14455
+ - Every text token costs money. Use tools, not words.
14456
+
14457
+ TOOL USAGE:
14458
+ - \`validate\` for all validation (tsc + build). Run it after resolving the conflicts to make sure nothing breaks.
14459
+ - Package dependencies \u2014 \`npm install <pkg>\` any package not already in \`package.json\` BEFORE the first \`validate\` (do NOT wait for \`TS2307\`); install all needed packages in ONE command. Do NOT hand-edit \`package.json\` for deps unless npm cannot be used.
14460
+ - File operations \u2014 pick the BATCH tool whenever you have 2+ files; the single-file variants are 5\u201310\xD7 slower:
14461
+ - \`batch-read\` to read N files in one call. NEVER call \`read\` more than once per turn \u2014 use batch-read instead.
14462
+ - \`multi-edit\` to apply N find-and-replace edits across one or more files in one call. NEVER call \`edit\` more than once per turn \u2014 use multi-edit instead. \`edit\` is reserved for a single edit to one file. When resolving conflicts across N files, use ONE \`multi-edit\` with all N edits.
14463
+ - \`batch-write\` to create N new files in one call. NEVER call \`write\` more than once per turn \u2014 use batch-write instead. \`write\` is reserved for single-file creation.
14464
+ - Tool arguments are strict JSON. For multiline strings in \`write\`, \`edit\`, \`batch-write\`, and \`multi-edit\`, use JSON escape sequences (\`\\n\`, \`\\t\`, \`\\"\`) \u2014 do NOT put raw (unescaped) newlines inside JSON string values (that breaks parsing). \`batch-write\` and \`multi-edit\` also normalize literal two-character escape sequences before writing; prefer proper JSON escapes.
14465
+ - For tools where no batch variant exists (e.g. \`grep\`, \`glob\`), still emit MULTIPLE \`tool_use\` blocks in a SINGLE response when the calls are independent. Sequential turns waste a model round-trip per call.
14466
+ - NEVER run preview, dev, release, or promote commands.
14467
+
14468
+ WORKFLOW:
14469
+ 1. **Find**: Use \`grep\` to locate all files containing "<<<<<<<".
14470
+ 2. **Resolve**: Read (\`batch-read\`) and fix all conflicts using \`multi-edit\`. Do NOT add new logic \u2014 only remove markers and merge the two sides.
14471
+ 3. **Verify markers**: Run \`grep\` again to confirm zero conflict markers remain.
14472
+ 4. **Validate**: Run \`validate\` (typecheck only). Fix any errors and re-validate until tsc passes, then run \`validate({ runBuild: true })\` ONCE to confirm the resolution did not break the build. Pass \`installDeps: true\` ONLY when \`package.json\` changed without already running \`npm install <package-name>\` in this iteration; otherwise omit it (node_modules is pre-installed).
14473
+ 5. **Stop**: STOP immediately after validation passes. Do NOT refactor or make changes beyond resolving conflicts.`;
14474
+ }
14475
+ });
14476
+
14382
14477
  // dist/job-decision-manager.js
14383
14478
  var require_job_decision_manager = __commonJS({
14384
14479
  "dist/job-decision-manager.js"(exports2) {
@@ -14487,6 +14582,7 @@ var require_environments = __commonJS({
14487
14582
  var codegen_harmony_config_1 = require_dist10();
14488
14583
  var codegen_rules_1 = require_codegen_rules();
14489
14584
  var ask_rules_1 = require_ask_rules();
14585
+ var git_conflicts_rules_1 = require_git_conflicts_rules();
14490
14586
  var job_decision_manager_1 = require_job_decision_manager();
14491
14587
  var logger_12 = require_logger();
14492
14588
  var SHARED_CODEGEN_RULE = {
@@ -14497,10 +14593,15 @@ var require_environments = __commonJS({
14497
14593
  filename: "ask-instructions.md",
14498
14594
  content: ask_rules_1.ASK_RULES
14499
14595
  };
14596
+ var SHARED_GIT_CONFLICTS_RULE = {
14597
+ filename: "git-conflicts-instructions.md",
14598
+ content: git_conflicts_rules_1.GIT_CONFLICTS_RULES
14599
+ };
14500
14600
  var withSharedRules = (env) => ({
14501
14601
  ...env,
14502
14602
  codegenRules: [SHARED_CODEGEN_RULE, ...env.codegenRules],
14503
- askRules: [SHARED_ASK_RULE, ...env.askRules]
14603
+ askRules: [SHARED_ASK_RULE, ...env.askRules],
14604
+ gitConflictsRules: [SHARED_GIT_CONFLICTS_RULE, ...env.gitConflictsRules]
14504
14605
  });
14505
14606
  function getCodegenEnvironmentConfig() {
14506
14607
  switch (process.env.CODEGEN_ENVIRONMENT) {
@@ -14541,6 +14642,7 @@ var require_config = __commonJS({
14541
14642
  var rules_writer_12 = require_rules_writer();
14542
14643
  var node_modules_guard_12 = require_node_modules_guard();
14543
14644
  var environments_12 = require_environments();
14645
+ var CodeGenService_12 = require_CodeGenService();
14544
14646
  exports2.DEFAULT_TIMEOUT_MS = 20 * 60 * 1e3;
14545
14647
  exports2.DEFAULT_MODEL = "anthropic/claude-sonnet-4-6";
14546
14648
  exports2.DEFAULT_SMALL_MODEL = "anthropic/claude-haiku-4-5-20251001";
@@ -14599,93 +14701,96 @@ var require_config = __commonJS({
14599
14701
  enabled: true
14600
14702
  }
14601
14703
  };
14602
- function getOpenCodeConfig(instructionPaths) {
14704
+ var READABLE_EXTERNAL_DIRS = {
14705
+ "/root/.agents/**": "allow",
14706
+ "/root/.claude/**": "allow",
14707
+ "/root/.opencode/**": "allow",
14708
+ "/tmp/**": "allow"
14709
+ };
14710
+ var PLANNING_TOOLS_DENIED = {
14711
+ task: "deny",
14712
+ [
14713
+ "todowrite"
14714
+ /* OpenCodeTool.TodoWrite */
14715
+ ]: "deny",
14716
+ [
14717
+ "todoread"
14718
+ /* OpenCodeTool.TodoRead */
14719
+ ]: "deny"
14720
+ };
14721
+ var CODEGEN_PERMISSIONS = {
14722
+ ...PLANNING_TOOLS_DENIED,
14723
+ [
14724
+ "skill"
14725
+ /* OpenCodeTool.Skill */
14726
+ ]: { "*": "allow" },
14727
+ doom_loop: "allow",
14728
+ external_directory: READABLE_EXTERNAL_DIRS
14729
+ };
14730
+ var GIT_CONFLICTS_PERMISSIONS = {
14731
+ ...CODEGEN_PERMISSIONS,
14732
+ [
14733
+ "progress"
14734
+ /* OpenCodeTool.Progress */
14735
+ ]: "deny",
14736
+ [
14737
+ "uuid"
14738
+ /* OpenCodeTool.Uuid */
14739
+ ]: "deny",
14740
+ [
14741
+ "wix-generate"
14742
+ /* OpenCodeTool.WixGenerate */
14743
+ ]: "deny",
14744
+ [
14745
+ "required-permissions"
14746
+ /* OpenCodeTool.RequiredPermissions */
14747
+ ]: "deny",
14748
+ [
14749
+ "user-actions"
14750
+ /* OpenCodeTool.UserActions */
14751
+ ]: "deny"
14752
+ };
14753
+ var ASK_PERMISSIONS = {
14754
+ ...PLANNING_TOOLS_DENIED,
14755
+ [
14756
+ "edit"
14757
+ /* OpenCodeTool.Edit */
14758
+ ]: "deny",
14759
+ [
14760
+ "bash"
14761
+ /* OpenCodeTool.Bash */
14762
+ ]: "deny",
14763
+ [
14764
+ "batch-write"
14765
+ /* OpenCodeTool.BatchWrite */
14766
+ ]: "deny",
14767
+ [
14768
+ "multi-edit"
14769
+ /* OpenCodeTool.MultiEdit */
14770
+ ]: "deny",
14771
+ [
14772
+ "validate"
14773
+ /* OpenCodeTool.Validate */
14774
+ ]: "deny",
14775
+ [
14776
+ "uuid"
14777
+ /* OpenCodeTool.Uuid */
14778
+ ]: "deny",
14779
+ external_directory: READABLE_EXTERNAL_DIRS
14780
+ };
14781
+ function buildConfig(instructionPaths, permission, { guardNodeModules = false } = {}) {
14603
14782
  return {
14604
14783
  model: exports2.DEFAULT_MODEL,
14605
14784
  small_model: exports2.DEFAULT_SMALL_MODEL,
14606
14785
  provider: getProviderConfig(),
14607
14786
  compaction: { prune: true },
14608
14787
  // drop old tool outputs so --continue replays stay bounded
14609
- permission: {
14610
- [
14611
- "skill"
14612
- /* OpenCodeTool.Skill */
14613
- ]: {
14614
- "*": "allow"
14615
- },
14616
- task: "deny",
14617
- doom_loop: "allow",
14618
- [
14619
- "todowrite"
14620
- /* OpenCodeTool.TodoWrite */
14621
- ]: "deny",
14622
- [
14623
- "todoread"
14624
- /* OpenCodeTool.TodoRead */
14625
- ]: "deny",
14626
- external_directory: {
14627
- "/root/.agents/**": "allow",
14628
- "/root/.claude/**": "allow",
14629
- "/root/.opencode/**": "allow",
14630
- "/tmp/**": "allow"
14631
- }
14632
- },
14788
+ permission,
14633
14789
  instructions: instructionPaths,
14634
- // Blocks node_modules SDK-spelunking bash turns after a small exploratory
14635
- // budget and steers back to the loaded references (see node-modules-guard.ts).
14636
- plugin: [node_modules_guard_12.GUARD_PLUGIN_PATH],
14637
- autoupdate: false,
14638
- share: "disabled",
14639
14790
  lsp: false,
14640
14791
  mcp: WIX_MCP_CONFIG,
14641
- watcher: { ignore: WATCHER_IGNORE_PATTERNS }
14642
- };
14643
- }
14644
- function getOpenCodeAskConfig(instructionPaths) {
14645
- return {
14646
- model: exports2.DEFAULT_MODEL,
14647
- small_model: exports2.DEFAULT_SMALL_MODEL,
14648
- provider: getProviderConfig(),
14649
- compaction: { prune: true },
14650
- permission: {
14651
- [
14652
- "edit"
14653
- /* OpenCodeTool.Edit */
14654
- ]: "deny",
14655
- [
14656
- "bash"
14657
- /* OpenCodeTool.Bash */
14658
- ]: "deny",
14659
- task: "deny",
14660
- [
14661
- "todowrite"
14662
- /* OpenCodeTool.TodoWrite */
14663
- ]: "deny",
14664
- [
14665
- "todoread"
14666
- /* OpenCodeTool.TodoRead */
14667
- ]: "deny",
14668
- [
14669
- "batch-write"
14670
- /* OpenCodeTool.BatchWrite */
14671
- ]: "deny",
14672
- [
14673
- "multi-edit"
14674
- /* OpenCodeTool.MultiEdit */
14675
- ]: "deny",
14676
- [
14677
- "validate"
14678
- /* OpenCodeTool.Validate */
14679
- ]: "deny",
14680
- [
14681
- "uuid"
14682
- /* OpenCodeTool.Uuid */
14683
- ]: "deny"
14684
- },
14685
- instructions: instructionPaths,
14686
- lsp: false,
14687
- mcp: WIX_MCP_CONFIG,
14688
- watcher: { ignore: WATCHER_IGNORE_PATTERNS }
14792
+ watcher: { ignore: WATCHER_IGNORE_PATTERNS },
14793
+ ...guardNodeModules ? { plugin: [node_modules_guard_12.GUARD_PLUGIN_PATH], autoupdate: false, share: "disabled" } : {}
14689
14794
  };
14690
14795
  }
14691
14796
  function ensureOpenCodeInPath() {
@@ -14708,12 +14813,24 @@ var require_config = __commonJS({
14708
14813
  OPENCODE_DISABLE_FILETIME_CHECK: "true"
14709
14814
  };
14710
14815
  }
14711
- function getOpenCodeEnv(projectId, isAsk = false) {
14712
- const envConfig = (0, environments_12.getCodegenEnvironmentConfig)();
14713
- const rules = isAsk ? envConfig.askRules : envConfig.codegenRules;
14714
- const paths = rules.map((r) => (0, rules_writer_12.getRulePath)(r.filename));
14715
- const config = isAsk ? getOpenCodeAskConfig(paths) : getOpenCodeConfig(paths);
14716
- return buildOpenCodeEnv(projectId, config);
14816
+ function getOpenCodeEnv(projectId, kind) {
14817
+ return buildOpenCodeEnv(projectId, buildConfigForKind(kind));
14818
+ }
14819
+ function buildConfigForKind(kind) {
14820
+ const env = (0, environments_12.getCodegenEnvironmentConfig)();
14821
+ const paths = (rules) => rules.map((r) => (0, rules_writer_12.getRulePath)(r.filename));
14822
+ switch (kind) {
14823
+ case CodeGenService_12.TaskKind.ASK_CODEGEN:
14824
+ return buildConfig(paths(env.askRules), ASK_PERMISSIONS);
14825
+ case CodeGenService_12.TaskKind.FIX_GIT_CONFLICTS:
14826
+ return buildConfig(paths(env.gitConflictsRules), GIT_CONFLICTS_PERMISSIONS, {
14827
+ guardNodeModules: true
14828
+ });
14829
+ default:
14830
+ return buildConfig(paths(env.codegenRules), CODEGEN_PERMISSIONS, {
14831
+ guardNodeModules: true
14832
+ });
14833
+ }
14717
14834
  }
14718
14835
  }
14719
14836
  });
@@ -15528,8 +15645,7 @@ var require_executor = __commonJS({
15528
15645
  return finalResult;
15529
15646
  }
15530
15647
  async function logOpenCodeStats(options) {
15531
- const isAsk = job_context_storage_12.jobContextStorage.getStore()?.kind === ditto_codegen_types_12.TaskKind.ASK_CODEGEN;
15532
- const env = (0, config_12.getOpenCodeEnv)(options.projectId, isAsk);
15648
+ const env = (0, config_12.getOpenCodeEnv)(options.projectId, job_context_storage_12.jobContextStorage.getStore()?.kind);
15533
15649
  const stats = await (0, cost_tracker_1.fetchOpenCodeStats)(options.outputPath, env);
15534
15650
  if (stats) {
15535
15651
  console.log("[OpenCode] Stats\n", stats);
@@ -15581,8 +15697,7 @@ var require_executor = __commonJS({
15581
15697
  continueSession
15582
15698
  });
15583
15699
  logger_12.logger.debug("[OpenCode] Full prompt", { prompt });
15584
- const isAsk = job_context_storage_12.jobContextStorage.getStore()?.kind === ditto_codegen_types_12.TaskKind.ASK_CODEGEN;
15585
- const env = (0, config_12.getOpenCodeEnv)(projectId, isAsk);
15700
+ const env = (0, config_12.getOpenCodeEnv)(projectId, job_context_storage_12.jobContextStorage.getStore()?.kind);
15586
15701
  ctx.child = (0, child_process_1.spawn)("opencode", args, {
15587
15702
  cwd: outputPath,
15588
15703
  env,
@@ -15625,6 +15740,7 @@ var require_opencode_runner = __commonJS({
15625
15740
  exports2.runOpenCodeInit = runOpenCodeInit;
15626
15741
  exports2.runOpenCodeIteration = runOpenCodeIteration;
15627
15742
  exports2.runOpenCodeAsk = runOpenCodeAsk;
15743
+ exports2.runOpenCodeGitConflicts = runOpenCodeGitConflicts;
15628
15744
  var prompts_1 = require_prompts();
15629
15745
  var executor_1 = require_executor();
15630
15746
  var parser_1 = require_parser();
@@ -15672,6 +15788,18 @@ var require_opencode_runner = __commonJS({
15672
15788
  error: result.error
15673
15789
  };
15674
15790
  }
15791
+ async function runOpenCodeGitConflicts(options) {
15792
+ const { outputPath, projectId, chatHistory, gitBaseline, onStdout, onStderr } = options;
15793
+ const prompt = (0, prompts_1.buildGitConflictsPrompt)(chatHistory);
15794
+ return (0, executor_1.executeOpenCode)({
15795
+ prompt,
15796
+ outputPath,
15797
+ projectId,
15798
+ gitBaseline,
15799
+ onStdout,
15800
+ onStderr
15801
+ });
15802
+ }
15675
15803
  }
15676
15804
  });
15677
15805
 
@@ -15694,7 +15822,8 @@ var require_collect_extensions_created = __commonJS({
15694
15822
  path: definitionPath,
15695
15823
  extensionType,
15696
15824
  title: (0, constants_1.extractExtensionDisplayTitle)(contentForTitle, titlePath),
15697
- files: [...files]
15825
+ files: [...files],
15826
+ isSpi: (0, constants_1.isSpiExtension)(extensionType)
15698
15827
  });
15699
15828
  async function collectDataCollectionEntries(outputPath, parentExtensionFile, folderFiles) {
15700
15829
  const entries = [];
@@ -15721,16 +15850,16 @@ var require_collect_extensions_created = __commonJS({
15721
15850
  continue;
15722
15851
  try {
15723
15852
  const content = await (0, promises_1.readFile)(resolveFilePath(outputPath, fileChange.path), "utf-8");
15724
- const detected = (0, constants_1.detectExtension)(content);
15725
- if (!detected)
15853
+ const extensionType = (0, constants_1.detectExtension)(content);
15854
+ if (!extensionType)
15726
15855
  continue;
15727
15856
  const folderFiles = files.filter((file) => isFileInExtensionFolder(file.path, fileChange.path));
15728
- if (detected.extensionType === "dataCollections") {
15857
+ if (extensionType === "dataCollections") {
15729
15858
  const dataCollectionEntries = await collectDataCollectionEntries(outputPath, fileChange, folderFiles);
15730
15859
  results.push(...dataCollectionEntries);
15731
15860
  continue;
15732
15861
  }
15733
- results.push(buildJobExtension(fileChange.path, detected.extensionType, content, fileChange.path, folderFiles));
15862
+ results.push(buildJobExtension(fileChange.path, extensionType, content, fileChange.path, folderFiles));
15734
15863
  } catch {
15735
15864
  continue;
15736
15865
  }
@@ -15749,7 +15878,7 @@ var require_opencode_integration = __commonJS({
15749
15878
  "dist/opencode-integration/index.js"(exports2) {
15750
15879
  "use strict";
15751
15880
  Object.defineProperty(exports2, "__esModule", { value: true });
15752
- exports2.collectInsertedExtensionsMetadata = exports2.buildExtensionsJobPayload = exports2.OpenCodeTaskTracker = exports2.runOpenCodeAsk = exports2.runOpenCodeIteration = exports2.runOpenCodeInit = void 0;
15881
+ exports2.collectInsertedExtensionsMetadata = exports2.buildExtensionsJobPayload = exports2.OpenCodeTaskTracker = exports2.runOpenCodeGitConflicts = exports2.runOpenCodeAsk = exports2.runOpenCodeIteration = exports2.runOpenCodeInit = void 0;
15753
15882
  var opencode_runner_1 = require_opencode_runner();
15754
15883
  Object.defineProperty(exports2, "runOpenCodeInit", { enumerable: true, get: function() {
15755
15884
  return opencode_runner_1.runOpenCodeInit;
@@ -15760,6 +15889,9 @@ var require_opencode_integration = __commonJS({
15760
15889
  Object.defineProperty(exports2, "runOpenCodeAsk", { enumerable: true, get: function() {
15761
15890
  return opencode_runner_1.runOpenCodeAsk;
15762
15891
  } });
15892
+ Object.defineProperty(exports2, "runOpenCodeGitConflicts", { enumerable: true, get: function() {
15893
+ return opencode_runner_1.runOpenCodeGitConflicts;
15894
+ } });
15763
15895
  var task_tracker_1 = require_task_tracker2();
15764
15896
  Object.defineProperty(exports2, "OpenCodeTaskTracker", { enumerable: true, get: function() {
15765
15897
  return task_tracker_1.OpenCodeTaskTracker;
@@ -21528,6 +21660,185 @@ var require_opencode_ask = __commonJS({
21528
21660
  }
21529
21661
  });
21530
21662
 
21663
+ // dist/OpenCodeGitConflictsOrchestrator.js
21664
+ var require_OpenCodeGitConflictsOrchestrator = __commonJS({
21665
+ "dist/OpenCodeGitConflictsOrchestrator.js"(exports2) {
21666
+ "use strict";
21667
+ Object.defineProperty(exports2, "__esModule", { value: true });
21668
+ exports2.OpenCodeGitConflictsOrchestrator = void 0;
21669
+ var ditto_codegen_types_12 = require_dist4();
21670
+ var DittoEventEmitter_1 = require_DittoEventEmitter();
21671
+ var opencode_integration_1 = require_opencode_integration();
21672
+ var logger_12 = require_logger();
21673
+ var OpenCodeGitConflictsOrchestrator = class extends DittoEventEmitter_1.DittoEventEmitter {
21674
+ constructor() {
21675
+ super();
21676
+ }
21677
+ async fixConflicts(request) {
21678
+ const { outputPath, projectId, chatHistory, gitBaseline } = request;
21679
+ this.emitEvent("start:git-conflicts", { outputPath });
21680
+ this.emitEvent("opencode:start", { outputPath });
21681
+ const start = Date.now();
21682
+ const result = await (0, opencode_integration_1.runOpenCodeGitConflicts)({
21683
+ outputPath,
21684
+ projectId,
21685
+ chatHistory,
21686
+ gitBaseline,
21687
+ onStdout: (data) => {
21688
+ this.emitEvent("opencode:output", { data });
21689
+ },
21690
+ onStderr: (data) => {
21691
+ logger_12.logger.error("[OpenCode Git Conflicts] stderr", { output: data });
21692
+ }
21693
+ });
21694
+ this.lastUsage = result.usage;
21695
+ const durationMs = Date.now() - start;
21696
+ if (!result.success) {
21697
+ this.emitEvent("opencode:error", {
21698
+ error: result.error?.message,
21699
+ exitCode: result.exitCode,
21700
+ durationMs
21701
+ });
21702
+ throw result.error ?? new ditto_codegen_types_12.ProcessExecutionError("Git conflicts flow failed", {
21703
+ processType: ditto_codegen_types_12.ProcessType.EXECUTION,
21704
+ exitCode: result.exitCode ?? void 0
21705
+ });
21706
+ }
21707
+ this.emitEvent("opencode:done", { durationMs });
21708
+ this.emitEvent("finish:git-conflicts", { outputPath, durationMs });
21709
+ return result;
21710
+ }
21711
+ };
21712
+ exports2.OpenCodeGitConflictsOrchestrator = OpenCodeGitConflictsOrchestrator;
21713
+ }
21714
+ });
21715
+
21716
+ // dist/flows/opencode-fix-git-conflicts.js
21717
+ var require_opencode_fix_git_conflicts = __commonJS({
21718
+ "dist/flows/opencode-fix-git-conflicts.js"(exports2) {
21719
+ "use strict";
21720
+ Object.defineProperty(exports2, "__esModule", { value: true });
21721
+ exports2.runOpencodeGitConflictsFlow = void 0;
21722
+ var codeGenerationService_12 = require_codeGenerationService();
21723
+ var cli_listeners_1 = require_cli_listeners();
21724
+ var job_context_storage_12 = require_job_context_storage();
21725
+ var ditto_codegen_types_12 = require_dist4();
21726
+ var OpenCodeGitConflictsOrchestrator_1 = require_OpenCodeGitConflictsOrchestrator();
21727
+ var types_1 = require_types_impl();
21728
+ var codegen_flow_helpers_12 = require_codegen_flow_helpers();
21729
+ var context_12 = require_context();
21730
+ var logger_12 = require_logger();
21731
+ var config_12 = require_config();
21732
+ var git_file_changes_1 = require_git_file_changes();
21733
+ var collect_extensions_created_1 = require_collect_extensions_created();
21734
+ var biEvents_1 = require_biEvents();
21735
+ var plugins_runtime_1 = require_plugins_runtime();
21736
+ var runOpencodeGitConflictsFlow = async (chatHistory) => {
21737
+ const store = job_context_storage_12.jobContextStorage.getStore();
21738
+ if (!store?.jobId || !store?.taskId) {
21739
+ throw new Error("Job context not available - jobId and taskId are required");
21740
+ }
21741
+ const { jobId, taskId, kind } = store;
21742
+ const localJobContext = { jobId, taskId };
21743
+ const environment = process.env.CODEGEN_ENVIRONMENT ?? types_1.Environment.UNKNOWN_ENVIRONMENT;
21744
+ const flowStartTime = Date.now();
21745
+ store.flowStartTime = flowStartTime;
21746
+ const biBase = {
21747
+ jobId,
21748
+ taskId,
21749
+ appId: context_12.ctx.projectId,
21750
+ devMachineSessionId: process.env.CODEGEN_SESSION_ID,
21751
+ runKind: kind,
21752
+ jobInput: JSON.stringify(chatHistory),
21753
+ environment
21754
+ };
21755
+ logger_12.logger.info("[OpenCode Git Conflicts] Starting task", { taskId });
21756
+ await codeGenerationService_12.codeGenerationService.updateTask(jobId, taskId, ditto_codegen_types_12.Status.RUNNING, {});
21757
+ logger_12.logger.info("[OpenCode Git Conflicts] Marked task RUNNING", { taskId });
21758
+ await (0, biEvents_1.reportSessionStart)({
21759
+ ...biBase,
21760
+ taskModel: config_12.DEFAULT_MODEL,
21761
+ taskType: kind
21762
+ });
21763
+ const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
21764
+ const gitBaseline = await (0, git_file_changes_1.captureGitBaseline)(outputPath);
21765
+ const orchestrator = new OpenCodeGitConflictsOrchestrator_1.OpenCodeGitConflictsOrchestrator();
21766
+ let caughtError;
21767
+ try {
21768
+ (0, cli_listeners_1.attachOrchestratorListeners)(orchestrator);
21769
+ const result = await orchestrator.fixConflicts({
21770
+ outputPath,
21771
+ projectId: context_12.ctx.projectId,
21772
+ chatHistory,
21773
+ gitBaseline
21774
+ });
21775
+ const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
21776
+ const extensions = await (0, collect_extensions_created_1.buildExtensionsJobPayload)(outputPath, files);
21777
+ await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
21778
+ requiredPermissions: result.requiredPermissions,
21779
+ files,
21780
+ extensions
21781
+ });
21782
+ await codeGenerationService_12.codeGenerationService.updateTask(jobId, taskId, ditto_codegen_types_12.Status.COMPLETED, {
21783
+ taskOutput: { files }
21784
+ });
21785
+ await (0, biEvents_1.reportSessionEnd)({
21786
+ ...biBase,
21787
+ taskModel: config_12.DEFAULT_MODEL,
21788
+ taskType: kind,
21789
+ taskCost: Math.round(result.usage.cost * 1e6),
21790
+ taskStatus: ditto_codegen_types_12.Status.COMPLETED,
21791
+ agentOutput: JSON.stringify({ files }),
21792
+ jobDuration: String(Date.now() - flowStartTime),
21793
+ skillsUsed: result.skillsUsed
21794
+ });
21795
+ logger_12.logger.info("[OpenCode Git Conflicts] Completed task", { taskId });
21796
+ } catch (error) {
21797
+ caughtError = error;
21798
+ const codegenError = (0, ditto_codegen_types_12.toCodegenError)(error);
21799
+ const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
21800
+ const extensions = await (0, collect_extensions_created_1.buildExtensionsJobPayload)(outputPath, files);
21801
+ await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
21802
+ requiredPermissions: [],
21803
+ error: codegenError,
21804
+ files,
21805
+ extensions
21806
+ });
21807
+ await (0, codegen_flow_helpers_12.updateParentTaskStatus)(localJobContext, ditto_codegen_types_12.Status.FAILED, codegenError);
21808
+ const taskCost = orchestrator.lastUsage ? Math.round(orchestrator.lastUsage.cost * 1e6) : void 0;
21809
+ await (0, biEvents_1.reportSessionEnd)({
21810
+ ...biBase,
21811
+ taskModel: config_12.DEFAULT_MODEL,
21812
+ taskType: kind,
21813
+ taskCost,
21814
+ taskStatus: ditto_codegen_types_12.Status.FAILED,
21815
+ agentOutput: JSON.stringify({ files }),
21816
+ jobDuration: String(Date.now() - flowStartTime)
21817
+ });
21818
+ await (0, biEvents_1.reportSessionError)({
21819
+ ...biBase,
21820
+ taskModel: config_12.DEFAULT_MODEL,
21821
+ taskType: kind,
21822
+ agentOutput: JSON.stringify(codegenError),
21823
+ errorDesc: codegenError.errorType,
21824
+ errorMessage: codegenError.message,
21825
+ errorJson: JSON.stringify(codegenError),
21826
+ isRetryable: codegenError.retryable,
21827
+ isExpected: codegenError.expected,
21828
+ validationType: codegenError.validationType
21829
+ });
21830
+ logger_12.logger.error("[OpenCode Git Conflicts] Failed task", {
21831
+ taskId,
21832
+ error: error instanceof Error ? error.message : String(error)
21833
+ });
21834
+ } finally {
21835
+ await (0, plugins_runtime_1.runOnFlowEnd)((0, plugins_runtime_1.getActivePlugins)(), { codegenFailed: caughtError !== void 0, codegenError: caughtError }, logger_12.logger);
21836
+ }
21837
+ };
21838
+ exports2.runOpencodeGitConflictsFlow = runOpencodeGitConflictsFlow;
21839
+ }
21840
+ });
21841
+
21531
21842
  // dist/job-cancellation-monitor.js
21532
21843
  var require_job_cancellation_monitor = __commonJS({
21533
21844
  "dist/job-cancellation-monitor.js"(exports2) {
@@ -21861,6 +22172,7 @@ var job_context_storage_1 = require_job_context_storage();
21861
22172
  var opencode_init_1 = require_opencode_init();
21862
22173
  var opencode_iterate_1 = require_opencode_iterate();
21863
22174
  var opencode_ask_1 = require_opencode_ask();
22175
+ var opencode_fix_git_conflicts_1 = require_opencode_fix_git_conflicts();
21864
22176
  var codegen_flow_helpers_1 = require_codegen_flow_helpers();
21865
22177
  var job_cancellation_monitor_1 = require_job_cancellation_monitor();
21866
22178
  var job_timeout_monitor_1 = require_job_timeout_monitor();
@@ -21927,8 +22239,12 @@ async function initOpenCode() {
21927
22239
  const envConfig = (0, environments_1.getCodegenEnvironmentConfig)();
21928
22240
  const pluginArtifacts = (0, plugin_artifacts_1.collectPluginArtifacts)(envConfig);
21929
22241
  await Promise.all([
21930
- (0, rules_writer_1.writeRuleFiles)([...envConfig.codegenRules, ...pluginArtifacts.rules]),
21931
- (0, rules_writer_1.writeRuleFiles)(envConfig.askRules),
22242
+ (0, rules_writer_1.writeRuleFiles)([
22243
+ ...envConfig.codegenRules,
22244
+ ...pluginArtifacts.rules,
22245
+ ...envConfig.askRules,
22246
+ ...envConfig.gitConflictsRules
22247
+ ]),
21932
22248
  (0, skills_installer_1.applySkillsOverride)((0, codegen_flow_helpers_1.getOutputPath)(), logger_1.logger),
21933
22249
  (0, tools_writer_1.writeToolFiles)(pluginArtifacts.tools),
21934
22250
  (0, node_modules_guard_1.writeGuardPlugin)()
@@ -21948,7 +22264,7 @@ var getFirstTask = (job) => {
21948
22264
  return job.tasks?.[0];
21949
22265
  };
21950
22266
  function buildPluginsForTask(jobId, taskId, kind, payload) {
21951
- if (kind !== CodeGenService_1.TaskKind.INIT_CODEGEN && kind !== CodeGenService_1.TaskKind.ITERATE_CODEGEN) {
22267
+ if (kind !== CodeGenService_1.TaskKind.INIT_CODEGEN && kind !== CodeGenService_1.TaskKind.ITERATE_CODEGEN && kind !== CodeGenService_1.TaskKind.FIX_GIT_CONFLICTS) {
21952
22268
  return void 0;
21953
22269
  }
21954
22270
  const userInput = extractUserInput(kind, payload);
@@ -21969,7 +22285,7 @@ function extractUserInput(kind, payload) {
21969
22285
  if (kind === CodeGenService_1.TaskKind.INIT_CODEGEN) {
21970
22286
  return payload.blueprint?.summary?.trim() || void 0;
21971
22287
  }
21972
- if (kind === CodeGenService_1.TaskKind.ITERATE_CODEGEN) {
22288
+ if (kind === CodeGenService_1.TaskKind.ITERATE_CODEGEN || kind === CodeGenService_1.TaskKind.FIX_GIT_CONFLICTS) {
21973
22289
  const history = payload.history ?? [];
21974
22290
  for (let i = history.length - 1; i >= 0; i--) {
21975
22291
  if (history[i].role === "USER") {
@@ -22019,6 +22335,8 @@ async function processJob(job) {
22019
22335
  await (0, opencode_iterate_1.runOpencodeIterateFlow)(history, agentData);
22020
22336
  } else if (task.kind === CodeGenService_1.TaskKind.INIT_CODEGEN && blueprint) {
22021
22337
  await (0, opencode_init_1.runOpencodeInitFlow)(blueprint, history, agentData);
22338
+ } else if (task.kind === CodeGenService_1.TaskKind.FIX_GIT_CONFLICTS) {
22339
+ await (0, opencode_fix_git_conflicts_1.runOpencodeGitConflictsFlow)(history);
22022
22340
  }
22023
22341
  } finally {
22024
22342
  jobCancellationMonitor.stop();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.383",
3
+ "version": "1.0.385",
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": "9eeb81c88135bb782b2dba1cee39f9a4a74efce788a4e05022ca7519"
32
+ "falconPackageHash": "5f06712568df646c3f5e3252edb7f7cd16e99e7b27e710c506b70686"
33
33
  }