@wix/ditto-codegen-public 1.0.413 → 1.0.414

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 +72 -0
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -22967,6 +22967,76 @@ var require_tools_writer = __commonJS({
22967
22967
  }
22968
22968
  });
22969
22969
 
22970
+ // dist/opencode-integration/generated-files-guard.js
22971
+ var require_generated_files_guard = __commonJS({
22972
+ "dist/opencode-integration/generated-files-guard.js"(exports2) {
22973
+ "use strict";
22974
+ Object.defineProperty(exports2, "__esModule", { value: true });
22975
+ exports2.GENERATED_FILES_GUARD_PLUGIN_PATH = exports2.GUARD_MESSAGE = void 0;
22976
+ exports2.isEditorComponentManifest = isEditorComponentManifest;
22977
+ exports2.extractWritePaths = extractWritePaths;
22978
+ exports2.buildGeneratedFilesGuardSource = buildGeneratedFilesGuardSource;
22979
+ exports2.writeGeneratedFilesGuardPlugin = writeGeneratedFilesGuardPlugin;
22980
+ var promises_1 = require("fs/promises");
22981
+ var os_1 = require("os");
22982
+ var path_1 = require("path");
22983
+ var logger_12 = require_logger();
22984
+ var ERC_MANIFEST_RE = /(^|\/)src\/extensions\/site\/components\/.+\.generated\.tsx?$/;
22985
+ exports2.GUARD_MESSAGE = "BLOCKED: *.generated.ts is an auto-generated manifest. Do not create or edit it by hand. It is derived from the component's React markup (*.tsx) and CSS module (*.module.css) and regenerated by running `npx wix build && npx wix generate manifest`. To change it, edit the *.tsx / *.module.css / *.props.ts source and regenerate; to override manifest values, edit the component's *.extension.ts. Do not retry this write.";
22986
+ function isEditorComponentManifest(path) {
22987
+ return ERC_MANIFEST_RE.test(path);
22988
+ }
22989
+ function extractWritePaths(tool, args) {
22990
+ if (tool === "write" || tool === "edit") {
22991
+ return typeof args.filePath === "string" ? [args.filePath] : [];
22992
+ }
22993
+ const list = tool === "batch-write" ? args.files : tool === "multi-edit" ? args.edits : void 0;
22994
+ if (!list)
22995
+ return [];
22996
+ return list.map((item) => item.path).filter((p) => typeof p === "string");
22997
+ }
22998
+ var GLOBAL_PLUGIN_DIR = (0, path_1.join)((0, os_1.homedir)(), ".config", "opencode", "plugin");
22999
+ var GUARD_PLUGIN_FILENAME = "generated-files-guard.ts";
23000
+ exports2.GENERATED_FILES_GUARD_PLUGIN_PATH = (0, path_1.join)(GLOBAL_PLUGIN_DIR, GUARD_PLUGIN_FILENAME);
23001
+ function buildGeneratedFilesGuardSource() {
23002
+ return `// Generated by @wix/ditto-codegen (generated-files-guard). Do not edit.
23003
+ const ERC_MANIFEST_RE = /${ERC_MANIFEST_RE.source}/;
23004
+ const GUARD_MESSAGE = ${JSON.stringify(exports2.GUARD_MESSAGE)};
23005
+
23006
+ function extractWritePaths(tool, args) {
23007
+ if (tool === "${"write"}" || tool === "${"edit"}") {
23008
+ return typeof args.filePath === "string" ? [args.filePath] : [];
23009
+ }
23010
+ const list =
23011
+ tool === "${"batch-write"}" ? args.files : tool === "${"multi-edit"}" ? args.edits : undefined;
23012
+ if (!list) return [];
23013
+ return list
23014
+ .map((item) => item.path)
23015
+ .filter((p) => typeof p === "string");
23016
+ }
23017
+
23018
+ export const GeneratedFilesGuard = async () => ({
23019
+ "tool.execute.before": async (input, output) => {
23020
+ const blocked = extractWritePaths(input.tool, output.args).filter((p) =>
23021
+ ERC_MANIFEST_RE.test(p),
23022
+ );
23023
+ if (blocked.length > 0) {
23024
+ throw new Error(GUARD_MESSAGE + " (blocked: " + blocked.join(", ") + ")");
23025
+ }
23026
+ },
23027
+ });
23028
+ `;
23029
+ }
23030
+ async function writeGeneratedFilesGuardPlugin() {
23031
+ await (0, promises_1.mkdir)(GLOBAL_PLUGIN_DIR, { recursive: true });
23032
+ await (0, promises_1.writeFile)(exports2.GENERATED_FILES_GUARD_PLUGIN_PATH, buildGeneratedFilesGuardSource(), "utf-8");
23033
+ logger_12.logger.info("[OpenCode] Wrote generated-files guard plugin", {
23034
+ path: exports2.GENERATED_FILES_GUARD_PLUGIN_PATH
23035
+ });
23036
+ }
23037
+ }
23038
+ });
23039
+
22970
23040
  // dist/plugin-host.js
22971
23041
  var require_plugin_host = __commonJS({
22972
23042
  "dist/plugin-host.js"(exports2) {
@@ -23033,6 +23103,7 @@ var skills_installer_1 = require_skills_installer();
23033
23103
  var rules_writer_1 = require_rules_writer();
23034
23104
  var tools_writer_1 = require_tools_writer();
23035
23105
  var node_modules_guard_1 = require_node_modules_guard();
23106
+ var generated_files_guard_1 = require_generated_files_guard();
23036
23107
  var subagent_tool_logger_1 = require_subagent_tool_logger();
23037
23108
  var plugin_artifacts_1 = require_plugin_artifacts();
23038
23109
  var config_1 = require_config();
@@ -23108,6 +23179,7 @@ async function initOpenCode() {
23108
23179
  (0, skills_installer_1.applySkillsOverride)((0, codegen_flow_helpers_1.getOutputPath)(), logger_1.logger),
23109
23180
  (0, tools_writer_1.writeToolFiles)(pluginArtifacts.tools),
23110
23181
  (0, node_modules_guard_1.writeGuardPlugin)(),
23182
+ (0, generated_files_guard_1.writeGeneratedFilesGuardPlugin)(),
23111
23183
  (0, subagent_tool_logger_1.writeSubagentToolLoggerPlugin)()
23112
23184
  ]);
23113
23185
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.413",
3
+ "version": "1.0.414",
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": "9dbcb468e044e06b03b189b5fed7bf99f05b205e2f06c786a503690e"
32
+ "falconPackageHash": "3f4e50c396df8c8be63a1dbca9cd2473b5971b403ca96677f6b82bfc"
33
33
  }