@wix/ditto-codegen-public 1.0.486 → 1.0.487
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.
- package/dist/out.js +91 -28
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -13884,7 +13884,7 @@ var require_site = __commonJS({
|
|
|
13884
13884
|
"../codegen-common-logic/dist/tool-policies/site.js"(exports2) {
|
|
13885
13885
|
"use strict";
|
|
13886
13886
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
13887
|
-
exports2.SITE_POLICIES = exports2.SITE_PACKAGE_LOCK_POLICY = exports2.SITE_DATA_COLLECTION_GENERATE_POLICY = exports2.STORES_VERSIONING_POLICY = void 0;
|
|
13887
|
+
exports2.SITE_POLICIES = exports2.BACKEND_MONITORING_READ_POLICY = exports2.BACKEND_MONITORING_GENERATE_POLICY = exports2.SITE_PACKAGE_LOCK_POLICY = exports2.SITE_DATA_COLLECTION_GENERATE_POLICY = exports2.STORES_VERSIONING_POLICY = void 0;
|
|
13888
13888
|
exports2.STORES_VERSIONING_POLICY = {
|
|
13889
13889
|
type: "read",
|
|
13890
13890
|
mode: "prepend",
|
|
@@ -13907,10 +13907,31 @@ var require_site = __commonJS({
|
|
|
13907
13907
|
],
|
|
13908
13908
|
message: `BLOCKED: do not disable the package lockfile (--package-lock=false, --package-lock false, --no-package-lock). Run the install without it; if the packages are heavy, install them in several smaller commands (the sandbox has a memory limit).`
|
|
13909
13909
|
};
|
|
13910
|
+
var BACKEND_MONITORING_MESSAGE = `BACKEND MONITORING: if this job writes or edits a backend extension (service plugin, backend event or backend API endpoint), invoke the wix-backend-monitoring skill before writing its handler code and follow it: every handler is wrapped with its monitoring helper, and your final message tells the user about the monitoring logs.`;
|
|
13911
|
+
exports2.BACKEND_MONITORING_GENERATE_POLICY = {
|
|
13912
|
+
type: "generateOutput",
|
|
13913
|
+
extensionTypes: ["SERVICE_PLUGIN", "EVENT", "HTTP_ENDPOINT"],
|
|
13914
|
+
message: BACKEND_MONITORING_MESSAGE
|
|
13915
|
+
};
|
|
13916
|
+
exports2.BACKEND_MONITORING_READ_POLICY = {
|
|
13917
|
+
type: "read",
|
|
13918
|
+
mode: "prepend",
|
|
13919
|
+
isInstruction: true,
|
|
13920
|
+
pathFragments: [
|
|
13921
|
+
"wix-app/references/SERVICE_PLUGIN",
|
|
13922
|
+
"wix-app/references/service-plugin/",
|
|
13923
|
+
"wix-app/references/BACKEND_EVENT",
|
|
13924
|
+
"wix-app/references/backend-event/",
|
|
13925
|
+
"wix-app/references/BACKEND_API"
|
|
13926
|
+
],
|
|
13927
|
+
message: BACKEND_MONITORING_MESSAGE
|
|
13928
|
+
};
|
|
13910
13929
|
exports2.SITE_POLICIES = [
|
|
13911
13930
|
exports2.STORES_VERSIONING_POLICY,
|
|
13912
13931
|
exports2.SITE_DATA_COLLECTION_GENERATE_POLICY,
|
|
13913
|
-
exports2.SITE_PACKAGE_LOCK_POLICY
|
|
13932
|
+
exports2.SITE_PACKAGE_LOCK_POLICY,
|
|
13933
|
+
exports2.BACKEND_MONITORING_GENERATE_POLICY,
|
|
13934
|
+
exports2.BACKEND_MONITORING_READ_POLICY
|
|
13914
13935
|
];
|
|
13915
13936
|
}
|
|
13916
13937
|
});
|
|
@@ -25002,16 +25023,21 @@ var require_tool_policies3 = __commonJS({
|
|
|
25002
25023
|
"dist/opencode-integration/plugins/tool-policies.js"(exports2) {
|
|
25003
25024
|
"use strict";
|
|
25004
25025
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
25005
|
-
exports2.TOOL_POLICIES_FILENAME = exports2.GENERATE_CMD_RE = void 0;
|
|
25026
|
+
exports2.TOOL_POLICIES_FILENAME = exports2.SCAFFOLD_CMD_RE = exports2.GENERATE_CMD_RE = void 0;
|
|
25006
25027
|
exports2.buildToolPoliciesPluginSource = buildToolPoliciesPluginSource;
|
|
25007
25028
|
exports2.writeToolPoliciesPlugin = writeToolPoliciesPlugin;
|
|
25008
25029
|
var ditto_codegen_types_12 = require_dist4();
|
|
25009
25030
|
var write_plugin_1 = require_write_plugin();
|
|
25010
25031
|
exports2.GENERATE_CMD_RE = /\bwix\s+(schema\s+)?generate\b/;
|
|
25032
|
+
exports2.SCAFFOLD_CMD_RE = /\bwix\s+generate\b/;
|
|
25011
25033
|
exports2.TOOL_POLICIES_FILENAME = "tool-policies.ts";
|
|
25012
25034
|
function buildToolPoliciesPluginSource(policies) {
|
|
25013
25035
|
const emitKind = (type, toRuntime, extraFilter = () => true) => JSON.stringify(policies.filter((policy) => policy.type === type).filter(extraFilter).map(toRuntime));
|
|
25014
|
-
const emitReads = (mode) => emitKind("read", ({ pathFragments, message }) => ({
|
|
25036
|
+
const emitReads = (mode) => emitKind("read", ({ pathFragments, isInstruction, message }) => ({
|
|
25037
|
+
pathFragments,
|
|
25038
|
+
isInstruction,
|
|
25039
|
+
message
|
|
25040
|
+
}), (policy) => policy.mode === mode);
|
|
25015
25041
|
const generatePolicies = emitKind("generate", ({ blockedExtensionTypes, whenArgsInclude, message }) => ({
|
|
25016
25042
|
blockedExtensionTypes,
|
|
25017
25043
|
whenArgsInclude,
|
|
@@ -25026,6 +25052,7 @@ var require_tool_policies3 = __commonJS({
|
|
|
25026
25052
|
skillNames,
|
|
25027
25053
|
message
|
|
25028
25054
|
}));
|
|
25055
|
+
const generateOutputPrepends = emitKind("generateOutput", ({ extensionTypes, message }) => ({ extensionTypes, message }));
|
|
25029
25056
|
return `// Generated by @wix/ditto-codegen (tool-policies). Do not edit.
|
|
25030
25057
|
const BLOCK_READS = ${emitReads("block")};
|
|
25031
25058
|
const PREPEND_READS = ${emitReads("prepend")};
|
|
@@ -25033,10 +25060,11 @@ const GENERATE_POLICIES = ${generatePolicies};
|
|
|
25033
25060
|
const COMMAND_PREPENDS = ${commandPrepends};
|
|
25034
25061
|
const COMMAND_BLOCKS = ${commandBlocks};
|
|
25035
25062
|
const SKILL_PREPENDS = ${skillPrepends};
|
|
25036
|
-
|
|
25037
|
-
//
|
|
25063
|
+
const GENERATE_OUTPUT_PREPENDS = ${generateOutputPrepends};
|
|
25064
|
+
// See OVERRIDE_AUTHORITY_NOTE.
|
|
25038
25065
|
const AUTHORITY_NOTE = ${JSON.stringify(ditto_codegen_types_12.OVERRIDE_AUTHORITY_NOTE)};
|
|
25039
25066
|
const GENERATE_CMD_RE = /${exports2.GENERATE_CMD_RE.source}/;
|
|
25067
|
+
const SCAFFOLD_CMD_RE = /${exports2.SCAFFOLD_CMD_RE.source}/;
|
|
25040
25068
|
|
|
25041
25069
|
function extractReadPaths(tool, args) {
|
|
25042
25070
|
if (tool === "${"read"}") {
|
|
@@ -25056,6 +25084,26 @@ function matchingPolicies(policies, paths) {
|
|
|
25056
25084
|
);
|
|
25057
25085
|
}
|
|
25058
25086
|
|
|
25087
|
+
// Params of every extension a wix-generate call scaffolds, skipping entries
|
|
25088
|
+
// with no extension type.
|
|
25089
|
+
function wixGenerateParams(tool, args) {
|
|
25090
|
+
if (tool !== "${"wix-generate"}" || !Array.isArray(args.extensions)) {
|
|
25091
|
+
return [];
|
|
25092
|
+
}
|
|
25093
|
+
return args.extensions
|
|
25094
|
+
.map((extension) => extension?.params)
|
|
25095
|
+
.filter((params) => typeof params?.extensionType === "string");
|
|
25096
|
+
}
|
|
25097
|
+
|
|
25098
|
+
// The bash command when it is a \`wix generate\` / \`wix schema generate\` call.
|
|
25099
|
+
function generateCommandOf(tool, args) {
|
|
25100
|
+
return tool === "${"bash"}" &&
|
|
25101
|
+
typeof args.command === "string" &&
|
|
25102
|
+
GENERATE_CMD_RE.test(args.command)
|
|
25103
|
+
? args.command
|
|
25104
|
+
: null;
|
|
25105
|
+
}
|
|
25106
|
+
|
|
25059
25107
|
function generateArgsMatch(policy, haystack) {
|
|
25060
25108
|
return (
|
|
25061
25109
|
!policy.whenArgsInclude ||
|
|
@@ -25081,30 +25129,23 @@ export const ToolPolicies = async () => ({
|
|
|
25081
25129
|
}
|
|
25082
25130
|
|
|
25083
25131
|
if (GENERATE_POLICIES.length === 0) return;
|
|
25084
|
-
|
|
25085
|
-
|
|
25086
|
-
|
|
25087
|
-
if (
|
|
25088
|
-
|
|
25089
|
-
|
|
25090
|
-
|
|
25091
|
-
|
|
25092
|
-
generateArgsMatch(policy, params)
|
|
25093
|
-
) {
|
|
25094
|
-
throw new Error(policy.message);
|
|
25095
|
-
}
|
|
25132
|
+
for (const params of wixGenerateParams(input.tool, args)) {
|
|
25133
|
+
const serialized = JSON.stringify(params);
|
|
25134
|
+
for (const policy of GENERATE_POLICIES) {
|
|
25135
|
+
if (
|
|
25136
|
+
policy.blockedExtensionTypes.includes(params.extensionType) &&
|
|
25137
|
+
generateArgsMatch(policy, serialized)
|
|
25138
|
+
) {
|
|
25139
|
+
throw new Error(policy.message);
|
|
25096
25140
|
}
|
|
25097
25141
|
}
|
|
25098
25142
|
}
|
|
25099
|
-
|
|
25100
|
-
|
|
25101
|
-
typeof args.command === "string" &&
|
|
25102
|
-
GENERATE_CMD_RE.test(args.command)
|
|
25103
|
-
) {
|
|
25143
|
+
const generateCommand = generateCommandOf(input.tool, args);
|
|
25144
|
+
if (generateCommand) {
|
|
25104
25145
|
for (const policy of GENERATE_POLICIES) {
|
|
25105
25146
|
if (
|
|
25106
|
-
policy.blockedExtensionTypes.some((type) =>
|
|
25107
|
-
generateArgsMatch(policy,
|
|
25147
|
+
policy.blockedExtensionTypes.some((type) => generateCommand.includes(type)) &&
|
|
25148
|
+
generateArgsMatch(policy, generateCommand)
|
|
25108
25149
|
) {
|
|
25109
25150
|
throw new Error(policy.message);
|
|
25110
25151
|
}
|
|
@@ -25130,10 +25171,32 @@ export const ToolPolicies = async () => ({
|
|
|
25130
25171
|
...SKILL_PREPENDS.filter((policy) => policy.skillNames.includes(args.name)),
|
|
25131
25172
|
);
|
|
25132
25173
|
}
|
|
25133
|
-
|
|
25174
|
+
const scaffoldedTypes = wixGenerateParams(input.tool, args).map(
|
|
25175
|
+
(params) => params.extensionType,
|
|
25176
|
+
);
|
|
25177
|
+
// Each \`wix generate\` in a chained command, never \`wix schema generate\`.
|
|
25178
|
+
const scaffoldCommands = (generateCommandOf(input.tool, args) ?? "")
|
|
25179
|
+
.replace(/\\\\\\n/g, " ")
|
|
25180
|
+
.split(/&&|\\|\\||[;|\\n]/)
|
|
25181
|
+
.filter((command) => SCAFFOLD_CMD_RE.test(command));
|
|
25182
|
+
// The type as a whole token, so EVENT doesn't match EVENT_BANNER, myEVENT or my-EVENT.
|
|
25183
|
+
const commandScaffolds = (type) =>
|
|
25184
|
+
scaffoldCommands.some((command) =>
|
|
25185
|
+
new RegExp("(^|[^A-Za-z0-9_-])" + type + "($|[^A-Za-z0-9_-])").test(command),
|
|
25186
|
+
);
|
|
25187
|
+
const notes = GENERATE_OUTPUT_PREPENDS.filter((policy) =>
|
|
25188
|
+
policy.extensionTypes.some(
|
|
25189
|
+
(type) => scaffoldedTypes.includes(type) || commandScaffolds(type),
|
|
25190
|
+
),
|
|
25191
|
+
);
|
|
25192
|
+
if (matched.length === 0 && notes.length === 0) return;
|
|
25193
|
+
const overrides = matched.filter((policy) => !policy.isInstruction);
|
|
25194
|
+
const instructions = matched.filter((policy) => policy.isInstruction);
|
|
25134
25195
|
output.output = [
|
|
25135
|
-
...
|
|
25136
|
-
AUTHORITY_NOTE,
|
|
25196
|
+
...overrides.map((policy) => policy.message),
|
|
25197
|
+
...(overrides.length > 0 ? [AUTHORITY_NOTE] : []),
|
|
25198
|
+
...instructions.map((policy) => policy.message),
|
|
25199
|
+
...notes.map((policy) => policy.message),
|
|
25137
25200
|
output.output,
|
|
25138
25201
|
].join("\\n\\n");
|
|
25139
25202
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/ditto-codegen-public",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.487",
|
|
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": "
|
|
32
|
+
"falconPackageHash": "6fd0be2dc573990ec91fcba1effd9da210c8a4965eeed7a9f76fd1e2"
|
|
33
33
|
}
|