@wix/ditto-codegen-public 1.0.288 → 1.0.290

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 +50 -143
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -11552,6 +11552,7 @@ var require_constants5 = __commonJS({
11552
11552
  exports2.detectExtension = detectExtension;
11553
11553
  exports2.toTitleCase = toTitleCase;
11554
11554
  exports2.extractExtensionName = extractExtensionName;
11555
+ exports2.injectCreatedBy = injectCreatedBy;
11555
11556
  exports2.getWrittenContent = getWrittenContent;
11556
11557
  var ditto_codegen_types_12 = require_dist4();
11557
11558
  exports2.CONTAINER_ROOT_PREFIX = /^\/user-code\//;
@@ -11625,6 +11626,18 @@ var require_constants5 = __commonJS({
11625
11626
  const folderName = parts[parts.length - 2] || "";
11626
11627
  return toTitleCase(folderName);
11627
11628
  }
11629
+ function injectCreatedBy(content) {
11630
+ if (content.includes("createdBy"))
11631
+ return content;
11632
+ return content.replace(/(\S)(\n)(}\))(;?\s*)$/, (_match, preChar, newline, closeBrace, tail) => {
11633
+ const needsComma = preChar !== "," && preChar !== "{";
11634
+ const separator = needsComma ? `${preChar},` : preChar;
11635
+ return `${separator}${newline} createdBy: {
11636
+ author: "CODE_GEN",
11637
+ },
11638
+ ${closeBrace}${tail}`;
11639
+ });
11640
+ }
11628
11641
  function getWrittenContent(tool, state) {
11629
11642
  if (!state.input)
11630
11643
  return null;
@@ -11637,130 +11650,6 @@ var require_constants5 = __commonJS({
11637
11650
  }
11638
11651
  });
11639
11652
 
11640
- // dist/opencode-integration/rules/orchestrator-rules.js
11641
- var require_orchestrator_rules = __commonJS({
11642
- "dist/opencode-integration/rules/orchestrator-rules.js"(exports2) {
11643
- "use strict";
11644
- Object.defineProperty(exports2, "__esModule", { value: true });
11645
- exports2.ORCHESTRATOR_RULES = void 0;
11646
- exports2.ORCHESTRATOR_RULES = `# Wix CLI Extension Orchestrator
11647
-
11648
- ## Quick Decision Helper
11649
-
11650
- Answer these questions to find the right extension:
11651
-
11652
- 1. **What are you trying to build?**
11653
- - Admin interface \u2192 Dashboard Extensions
11654
- - Backend logic \u2192 Backend Extensions
11655
- - Data storage / CMS collections \u2192 Data Collection
11656
- - Site component \u2192 Site Extensions (app projects only)
11657
-
11658
- 2. **Who will see it?**
11659
- - Admin users only \u2192 Dashboard Extensions
11660
- - Site visitors \u2192 Site Extensions
11661
- - Server-side only \u2192 Backend Extensions
11662
-
11663
- 3. **Where will it appear?**
11664
- - Dashboard sidebar/page \u2192 Dashboard Page or Modal
11665
- - Existing Wix app dashboard (widget) \u2192 Dashboard Plugin
11666
- - Existing Wix app dashboard (menu item) \u2192 Dashboard Menu Plugin
11667
- - Anywhere on site \u2192 Site Widget
11668
- - Anywhere on site (with editor manifest) \u2192 Site Component
11669
- - Wix business solution page \u2192 Site Plugin
11670
- - During business flow \u2192 Service Plugin
11671
- - After event occurs \u2192 Event Extension
11672
-
11673
- ## Decision Flow
11674
-
11675
- - **Admin:** Need full-page UI? \u2192 Dashboard Page. Need popup/form? \u2192 Dashboard Modal. Extending Wix app dashboard with a visual widget? \u2192 Dashboard Plugin. Adding a menu item to a Wix app dashboard's more-actions or bulk-actions menu? \u2192 Dashboard Menu Plugin. **Modal constraint:** Dashboard Pages cannot use \`<Modal />\`; use a separate Dashboard Modal extension and \`dashboard.openModal()\`.
11676
- - **Backend:** During business flow (checkout/shipping/tax)? \u2192 Service Plugin. After event (webhooks/sync)? \u2192 Event Extension. Custom HTTP endpoints? \u2192 Backend Endpoints. Need CMS collections for app data? \u2192 Data Collection.
11677
- - **Site:** User places anywhere (standalone)? \u2192 Site Widget. React component with editor manifest (styling, content, elements)? \u2192 Site Component. Fixed slot on Wix app page? \u2192 Site Plugin. Scripts/analytics only? \u2192 Embedded Script.
11678
-
11679
- ## Extension Type \u2192 Skill Reference
11680
-
11681
- | Extension Type | Category | Visibility | Use When | Skill |
11682
- | --------------------- | --------- | ----------- | ----------------------------- | ------------------------- |
11683
- | Dashboard Page | Dashboard | Admin only | Full admin pages | \`wix-cli-dashboard-page\` |
11684
- | Dashboard Modal | Dashboard | Admin only | Popup dialogs | \`wix-cli-dashboard-modal\` |
11685
- | Dashboard Plugin | Dashboard | Admin only | Extend Wix app dashboards | \`wix-cli-dashboard-plugin\` |
11686
- | Dashboard Menu Plugin | Dashboard | Admin only | Add menu items to Wix app dashboards | \`wix-cli-dashboard-menu-plugin\` |
11687
- | Service Plugin | Backend | Server-side | Customize business flows | \`wix-cli-service-plugin\` |
11688
- | Event Extension | Backend | Server-side | React to events | \`wix-cli-backend-event\` |
11689
- | Backend Endpoints | Backend | API | Custom HTTP handlers | \`wix-cli-backend-api\` |
11690
- | Data Collection | Backend | Data | CMS collections for app data | \`wix-cli-data-collection\` |
11691
- | Site Component | Site | Public | React components with editor manifests | \`wix-cli-site-component\` |
11692
- | Site Widget | Site | Public | Standalone widgets | \`wix-cli-site-widget\` |
11693
- | Site Plugin | Site | Public | Extend Wix business solutions | \`wix-cli-site-plugin\` |
11694
- | Embedded Script | Site | Public | Inject scripts/analytics | \`wix-cli-embedded-script\` |
11695
-
11696
- | Site Widget vs Site Component vs Site Plugin | Dashboard Page vs Modal | Service Plugin vs Event |
11697
- | -------------------------------------------- | ----------------------- | ----------------------- |
11698
- | Widget: standalone interactive component. Component: React with editor manifest (CSS/data/elements). Plugin: fixed slot in Wix app page. | Page: full page. Modal: overlay; use for popups. | Service: during flow. Event: after event. |
11699
-
11700
- ## Data Collection Inference
11701
-
11702
- **CRITICAL:** Data collections are often needed implicitly \u2014 don't wait for the user to explicitly say "create a CMS collection." Infer the need automatically.
11703
-
11704
- **Skip this section if the user provides a collection ID directly** (e.g., an existing site-level collection). In that case, use the provided ID as-is \u2014 no Data Collection extension or namespace scoping needed.
11705
-
11706
- **Always include a Data Collection extension when ANY of these are true:**
11707
-
11708
- | Indicator | Example |
11709
- | --- | --- |
11710
- | User mentions saving/storing/persisting app-specific data | "save the fee amount", "store product recommendations" |
11711
- | A dashboard page will **manage** (CRUD) domain entities | "dashboard to manage fees", "admin page to edit rules" |
11712
- | A service plugin reads app-configured data at runtime | "fetch fee rules at checkout", "look up shipping rates" |
11713
- | User mentions "dedicated database/collection" | "save in a dedicated database collection" |
11714
- | Multiple extensions reference the same custom data | Dashboard manages fees + service plugin reads fees |
11715
-
11716
- **Why this matters:** Without the Data Collection extension, the collection won't be created when the app is installed, the Wix Data APIs may not work (code editor not enabled), and collection IDs won't be properly scoped to the app namespace.
11717
-
11718
- When creating a Data Collection, the user MUST provide their app namespace from Wix Dev Center. Collection IDs must be scoped: \`<app-namespace>/<idSuffix>\` \u2014 pass the full ID to all extensions that reference the collection.
11719
-
11720
- ## Wix Stores Versioning Requirement
11721
-
11722
- **Applies when ANY Wix Stores API is used** (products, inventory, orders, etc.):
11723
-
11724
- 1. Load the \`wix-stores-versioning\` skill
11725
- 2. All Stores operations must check catalog version first using \`getCatalogVersion()\`
11726
- 3. Use the correct module based on version: \`productsV3\` (V3) vs \`products\` (V1)
11727
-
11728
- This is non-negotiable \u2014 V1 and V3 are NOT backwards compatible.
11729
-
11730
- ## API Reference Discovery
11731
-
11732
- **Workflow: Check skill references first, use MCP only for gaps.**
11733
-
11734
- 1. Identify required APIs from user requirements
11735
- 2. Check relevant reference files in the loaded skill
11736
- 3. ONLY use MCP if the API is NOT found in reference files
11737
-
11738
- **Platform APIs (always in skill references \u2014 skip MCP):**
11739
- - Wix Data, Dashboard SDK, Event SDK (common events), Service Plugin SPIs
11740
-
11741
- **Vertical APIs (use MCP if needed):**
11742
- - Wix Stores (\u26A0\uFE0F MUST use \`wix-stores-versioning\` skill), Wix Bookings, Wix Members, Wix Pricing Plans
11743
-
11744
- | User Requirement | MCP Needed? | Reason |
11745
- | --- | --- | --- |
11746
- | "Display store products" | \u2705 YES | Wix Stores API \u2014 also load \`wix-stores-versioning\` skill |
11747
- | "Show booking calendar" | \u2705 YES | Wix Bookings API not in reference files |
11748
- | "Send emails to users" | \u2705 YES | Wix Triggered Emails not in reference files |
11749
- | "Get member info" | \u2705 YES | Wix Members API not in reference files |
11750
- | "Listen for cart events" | Check \`COMMON-EVENTS.md\` | MCP only if event missing in reference |
11751
- | "Store data in collection" | \u274C NO | Covered by \`WIX_DATA.md\` in skill refs |
11752
- | "Show dashboard toast" | \u274C NO | Covered by \`DASHBOARD_API.md\` in skill refs |
11753
- | "UI only (forms, inputs)" | \u274C NO | No external API needed |
11754
-
11755
- **MCP Tools to use for discovery:**
11756
- - \`SearchWixSDKDocumentation\` - SDK methods and APIs (**Always use maxResults: 5**)
11757
- - \`ReadFullDocsArticle\` - Full documentation when needed (only if search results need more detail)
11758
- - \`ReadFullDocsMethodSchema\` - **Always call this** for any SDK method you plan to use. The schema is the source of truth for parameter shapes. Code examples may have incorrect call signatures.
11759
-
11760
- \u26A0\uFE0F MANDATORY when using WDS: Invoke the wds-docs skill FIRST to get correct imports.`;
11761
- }
11762
- });
11763
-
11764
11653
  // dist/opencode-integration/rules/codegen-rules.js
11765
11654
  var require_codegen_rules = __commonJS({
11766
11655
  "dist/opencode-integration/rules/codegen-rules.js"(exports2) {
@@ -11779,7 +11668,7 @@ MINIMIZE TEXT OUTPUT \u2014 CRITICAL:
11779
11668
  - Every text token costs money. Use tools, not words.
11780
11669
 
11781
11670
  TOOL USAGE:
11782
- - \`validate\` for all validation (tsc + build). Do NOT load the \`wix-cli-app-validation\` skill.
11671
+ - \`validate\` for all validation (tsc + build).
11783
11672
  - \`uuid\` to generate UUIDs (supports count param for multiple). Do NOT use bash.
11784
11673
  - \`batch-write\` to create new files. NEVER use \`write\` for new files (corrupts newlines).
11785
11674
  - \`batch-read\` to read multiple files at once.
@@ -11789,12 +11678,11 @@ TOOL USAGE:
11789
11678
  - NEVER run preview, dev, release, or promote commands.
11790
11679
 
11791
11680
  IMPLEMENTATION WORKFLOW:
11792
- 1. **Plan**: Determine extension types using the orchestrator rule. Generate ALL UUIDs upfront.
11793
- 2. **Load skills**: Load ALL needed extension skills.
11794
- 3. **Build**: Create each extension using \`batch-write\`. Build all extensions before registering.
11795
- 4. **Register**: Register all extensions in \`src/extensions.ts\`.
11796
- 5. **Validate**: Run \`validate\` with installDeps: true ONCE. Fix any errors and re-validate.
11797
- 6. **Stop**: Once validation passes, STOP. Do NOT refactor, clean up, or verify.
11681
+ 1. **Plan**: Determine extension types using the \`wix-app\` skill. Generate ALL UUIDs upfront.
11682
+ 2. **Build**: Create each extension using \`batch-write\`. Build all extensions before registering.
11683
+ 3. **Register**: Register all extensions in \`src/extensions.ts\`.
11684
+ 4. **Validate**: Run \`validate\` with installDeps: true ONCE. Fix any errors and re-validate.
11685
+ 5. **Stop**: Once validation passes, STOP. Do NOT refactor, clean up, or verify.
11798
11686
 
11799
11687
  EFFICIENCY:
11800
11688
  - Batch ALL tool calls that can run in parallel into the same step.
@@ -11854,24 +11742,21 @@ var require_rules_writer = __commonJS({
11854
11742
  "dist/opencode-integration/rules-writer.js"(exports2) {
11855
11743
  "use strict";
11856
11744
  Object.defineProperty(exports2, "__esModule", { value: true });
11857
- exports2.ASK_RULES_PATH = exports2.ORCHESTRATOR_RULES_PATH = exports2.CODEGEN_RULES_PATH = void 0;
11745
+ exports2.ASK_RULES_PATH = exports2.CODEGEN_RULES_PATH = void 0;
11858
11746
  exports2.writeRuleFiles = writeRuleFiles;
11859
11747
  var promises_1 = require("fs/promises");
11860
11748
  var os_1 = require("os");
11861
11749
  var path_1 = require("path");
11862
- var orchestrator_rules_1 = require_orchestrator_rules();
11863
11750
  var codegen_rules_1 = require_codegen_rules();
11864
11751
  var ask_rules_1 = require_ask_rules();
11865
11752
  var logger_12 = require_logger();
11866
11753
  var GLOBAL_RULES_DIR = (0, path_1.join)((0, os_1.homedir)(), ".config", "opencode", "rules");
11867
11754
  exports2.CODEGEN_RULES_PATH = (0, path_1.join)(GLOBAL_RULES_DIR, "codegen-instructions.md");
11868
- exports2.ORCHESTRATOR_RULES_PATH = (0, path_1.join)(GLOBAL_RULES_DIR, "orchestrator.md");
11869
11755
  exports2.ASK_RULES_PATH = (0, path_1.join)(GLOBAL_RULES_DIR, "ask-instructions.md");
11870
11756
  async function writeRuleFiles() {
11871
11757
  await (0, promises_1.mkdir)(GLOBAL_RULES_DIR, { recursive: true });
11872
11758
  await Promise.all([
11873
11759
  (0, promises_1.writeFile)(exports2.CODEGEN_RULES_PATH, codegen_rules_1.CODEGEN_RULES, "utf-8"),
11874
- (0, promises_1.writeFile)(exports2.ORCHESTRATOR_RULES_PATH, orchestrator_rules_1.ORCHESTRATOR_RULES, "utf-8"),
11875
11760
  (0, promises_1.writeFile)(exports2.ASK_RULES_PATH, ask_rules_1.ASK_RULES, "utf-8")
11876
11761
  ]);
11877
11762
  logger_12.logger.info("[OpenCode] Wrote global rule files", { dir: GLOBAL_RULES_DIR });
@@ -11977,9 +11862,7 @@ var require_config = __commonJS({
11977
11862
  "skill"
11978
11863
  /* OpenCodeTool.Skill */
11979
11864
  ]: {
11980
- "*": "allow",
11981
- "wix-cli-orchestrator": "deny",
11982
- "wix-cli-app-validation": "deny"
11865
+ "*": "allow"
11983
11866
  },
11984
11867
  task: "deny",
11985
11868
  doom_loop: "allow",
@@ -11997,7 +11880,7 @@ var require_config = __commonJS({
11997
11880
  "/root/.opencode/**": "allow"
11998
11881
  }
11999
11882
  },
12000
- instructions: [rules_writer_12.CODEGEN_RULES_PATH, rules_writer_12.ORCHESTRATOR_RULES_PATH],
11883
+ instructions: [rules_writer_12.CODEGEN_RULES_PATH],
12001
11884
  autoupdate: false,
12002
11885
  share: "disabled",
12003
11886
  lsp: false,
@@ -12316,6 +12199,8 @@ var require_extension_handler = __commonJS({
12316
12199
  "use strict";
12317
12200
  Object.defineProperty(exports2, "__esModule", { value: true });
12318
12201
  exports2.ExtensionTaskHandler = void 0;
12202
+ var promises_1 = require("fs/promises");
12203
+ var path_1 = require("path");
12319
12204
  var ditto_codegen_types_12 = require_dist4();
12320
12205
  var codeGenerationService_12 = require_codeGenerationService();
12321
12206
  var logger_12 = require_logger();
@@ -12338,6 +12223,7 @@ var require_extension_handler = __commonJS({
12338
12223
  const extension = (0, constants_1.detectExtension)(content);
12339
12224
  if (!extension)
12340
12225
  return;
12226
+ await this.ensureCreatedBy(filePath, ctx.workingDirectory);
12341
12227
  const normalizedPath = (0, constants_1.normalizeFilePath)(filePath);
12342
12228
  if (this.extensionTasksCreated.has(normalizedPath))
12343
12229
  return;
@@ -12345,6 +12231,25 @@ var require_extension_handler = __commonJS({
12345
12231
  await this.completeInitTask(ctx);
12346
12232
  await this.createExtensionTask(normalizedPath, extension.label, filePath, ctx);
12347
12233
  }
12234
+ /** Reads an extension file from disk and injects createdBy if missing. */
12235
+ async ensureCreatedBy(filePath, workingDirectory) {
12236
+ const fullPath = (0, path_1.isAbsolute)(filePath) ? filePath : (0, path_1.join)(workingDirectory, filePath);
12237
+ try {
12238
+ const original = await (0, promises_1.readFile)(fullPath, "utf-8");
12239
+ const updated = (0, constants_1.injectCreatedBy)(original);
12240
+ if (updated !== original) {
12241
+ await (0, promises_1.writeFile)(fullPath, updated, "utf-8");
12242
+ logger_12.logger.info("[OpenCode] Injected createdBy into extension file", {
12243
+ filePath
12244
+ });
12245
+ }
12246
+ } catch (error) {
12247
+ logger_12.logger.error("[OpenCode] Failed to inject createdBy", {
12248
+ filePath,
12249
+ error: error instanceof Error ? error.message : String(error)
12250
+ });
12251
+ }
12252
+ }
12348
12253
  /** Completes the INIT_CODEGEN task once the extension tasks are created. */
12349
12254
  async completeInitTask(ctx) {
12350
12255
  const { store } = ctx;
@@ -12475,7 +12380,7 @@ var require_task_tracker = __commonJS({
12475
12380
  var extension_handler_1 = require_extension_handler();
12476
12381
  var category_handler_1 = require_category_handler();
12477
12382
  var OpenCodeTaskTracker = class {
12478
- constructor() {
12383
+ constructor(workingDirectory) {
12479
12384
  this.trackedTasks = /* @__PURE__ */ new Map();
12480
12385
  this.taskCounter = 0;
12481
12386
  this.collectedFiles = [];
@@ -12483,6 +12388,7 @@ var require_task_tracker = __commonJS({
12483
12388
  this.extensionHandler = new extension_handler_1.ExtensionTaskHandler();
12484
12389
  this.categoryHandler = new category_handler_1.CategoryTaskHandler();
12485
12390
  this.store = job_context_storage_12.jobContextStorage.getStore();
12391
+ this.workingDirectory = workingDirectory;
12486
12392
  }
12487
12393
  getSkillsUsed() {
12488
12394
  return Array.from(this.skillsUsed);
@@ -12502,7 +12408,8 @@ var require_task_tracker = __commonJS({
12502
12408
  store: this.store,
12503
12409
  trackedTasks: this.trackedTasks,
12504
12410
  collectedFiles: this.collectedFiles,
12505
- taskCounter: this.taskCounter
12411
+ taskCounter: this.taskCounter,
12412
+ workingDirectory: this.workingDirectory
12506
12413
  };
12507
12414
  }
12508
12415
  async processLine(line) {
@@ -12938,7 +12845,7 @@ var require_executor = __commonJS({
12938
12845
  async function executeOpenCodeOnce(options, attempt) {
12939
12846
  const { prompt, outputPath, projectId, onStdout, onStderr } = options;
12940
12847
  const startTime = Date.now();
12941
- const taskTracker = new task_tracker_1.OpenCodeTaskTracker();
12848
+ const taskTracker = new task_tracker_1.OpenCodeTaskTracker(outputPath);
12942
12849
  return new Promise((resolve) => {
12943
12850
  const state = {
12944
12851
  stdout: "",
@@ -18282,7 +18189,7 @@ var require_skills_installer = __commonJS({
18282
18189
  var ditto_codegen_types_12 = require_dist4();
18283
18190
  var skills_override_1 = require_skills_override();
18284
18191
  var execAsync = (0, util_1.promisify)(child_process_1.exec);
18285
- var SKILLS_INSTALL_COMMAND = "npx --yes skills add wix/skills -g -a opencode -y";
18192
+ var SKILLS_INSTALL_COMMAND = "npx --yes skills add wix/skills -s wix-app wds-docs -g -a opencode -y";
18286
18193
  async function installSkills(outputPath, log) {
18287
18194
  const skillsOverride = process.env.SKILLS_OVERRIDE_BRANCH;
18288
18195
  const isPreInstalled = (0, fs_1.existsSync)(skills_override_1.SKILLS_DIR) && (0, fs_1.readdirSync)(skills_override_1.SKILLS_DIR).length > 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.288",
3
+ "version": "1.0.290",
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": "551a68456ef9b2e4c6447344130a9234b5767cb0b0551c7afb0f2edb"
30
+ "falconPackageHash": "17f19685a652e4c3b3d509a30f412f378e89916cf064254b3ed38497"
31
31
  }