@wix/ditto-codegen-public 1.0.31 → 1.0.33
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 +227 -208
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -120258,6 +120258,10 @@ var require_http_impl = __commonJS({
|
|
|
120258
120258
|
{
|
|
120259
120259
|
srcPath: "/data/v1/external-database-connections",
|
|
120260
120260
|
destPath: "/v1/external-database-connections"
|
|
120261
|
+
},
|
|
120262
|
+
{
|
|
120263
|
+
srcPath: "/data/v1/data-collection-sharing",
|
|
120264
|
+
destPath: "/v1/data-collection-sharing"
|
|
120261
120265
|
}
|
|
120262
120266
|
],
|
|
120263
120267
|
"www.wixgateway.com": [
|
|
@@ -120278,6 +120282,10 @@ var require_http_impl = __commonJS({
|
|
|
120278
120282
|
{
|
|
120279
120283
|
srcPath: "/_api/cloud-data/v1/external-database-connections",
|
|
120280
120284
|
destPath: "/v1/external-database-connections"
|
|
120285
|
+
},
|
|
120286
|
+
{
|
|
120287
|
+
srcPath: "/data/v1/data-collection-sharing",
|
|
120288
|
+
destPath: "/v1/data-collection-sharing"
|
|
120281
120289
|
}
|
|
120282
120290
|
]
|
|
120283
120291
|
};
|
|
@@ -121286,6 +121294,10 @@ var require_http_impl2 = __commonJS({
|
|
|
121286
121294
|
{
|
|
121287
121295
|
srcPath: "/data/v1/external-database-connections",
|
|
121288
121296
|
destPath: "/v1/external-database-connections"
|
|
121297
|
+
},
|
|
121298
|
+
{
|
|
121299
|
+
srcPath: "/data/v1/data-collection-sharing",
|
|
121300
|
+
destPath: "/v1/data-collection-sharing"
|
|
121289
121301
|
}
|
|
121290
121302
|
],
|
|
121291
121303
|
"www.wixgateway.com": [
|
|
@@ -121306,6 +121318,10 @@ var require_http_impl2 = __commonJS({
|
|
|
121306
121318
|
{
|
|
121307
121319
|
srcPath: "/_api/cloud-data/v1/external-database-connections",
|
|
121308
121320
|
destPath: "/v1/external-database-connections"
|
|
121321
|
+
},
|
|
121322
|
+
{
|
|
121323
|
+
srcPath: "/data/v1/data-collection-sharing",
|
|
121324
|
+
destPath: "/v1/data-collection-sharing"
|
|
121309
121325
|
}
|
|
121310
121326
|
]
|
|
121311
121327
|
};
|
|
@@ -123129,6 +123145,68 @@ var require_dist11 = __commonJS({
|
|
|
123129
123145
|
}
|
|
123130
123146
|
});
|
|
123131
123147
|
|
|
123148
|
+
// dist/utils.js
|
|
123149
|
+
var require_utils18 = __commonJS({
|
|
123150
|
+
"dist/utils.js"(exports2) {
|
|
123151
|
+
"use strict";
|
|
123152
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
123153
|
+
exports2.serializeError = serializeError;
|
|
123154
|
+
exports2.mapGroupBy = mapGroupBy;
|
|
123155
|
+
function serializeError(error) {
|
|
123156
|
+
if (error instanceof Error) {
|
|
123157
|
+
const base = {
|
|
123158
|
+
name: error.name,
|
|
123159
|
+
message: error.message,
|
|
123160
|
+
stack: error.stack
|
|
123161
|
+
};
|
|
123162
|
+
const anyErr = error;
|
|
123163
|
+
for (const key in anyErr) {
|
|
123164
|
+
if (!(key in base)) {
|
|
123165
|
+
try {
|
|
123166
|
+
base[key] = anyErr[key];
|
|
123167
|
+
} catch {
|
|
123168
|
+
}
|
|
123169
|
+
}
|
|
123170
|
+
}
|
|
123171
|
+
const withCause = error;
|
|
123172
|
+
if (withCause && "cause" in withCause) {
|
|
123173
|
+
base.cause = withCause.cause;
|
|
123174
|
+
}
|
|
123175
|
+
const maybeHttp = error;
|
|
123176
|
+
if (maybeHttp?.response?.data !== void 0)
|
|
123177
|
+
base.data = maybeHttp.response.data;
|
|
123178
|
+
if (maybeHttp?.code !== void 0)
|
|
123179
|
+
base.code = maybeHttp.code;
|
|
123180
|
+
if (maybeHttp?.details !== void 0)
|
|
123181
|
+
base.details = maybeHttp.details;
|
|
123182
|
+
return base;
|
|
123183
|
+
}
|
|
123184
|
+
if (typeof error === "object" && error !== null) {
|
|
123185
|
+
try {
|
|
123186
|
+
return JSON.parse(JSON.stringify(error));
|
|
123187
|
+
} catch {
|
|
123188
|
+
return { message: String(error) };
|
|
123189
|
+
}
|
|
123190
|
+
}
|
|
123191
|
+
return { message: String(error) };
|
|
123192
|
+
}
|
|
123193
|
+
function mapGroupBy(items, keyExtractor) {
|
|
123194
|
+
const groups = /* @__PURE__ */ new Map();
|
|
123195
|
+
for (const item of items) {
|
|
123196
|
+
const key = keyExtractor(item);
|
|
123197
|
+
if (key === void 0 || key === null) {
|
|
123198
|
+
continue;
|
|
123199
|
+
}
|
|
123200
|
+
if (!groups.has(key)) {
|
|
123201
|
+
groups.set(key, []);
|
|
123202
|
+
}
|
|
123203
|
+
groups.get(key).push(item);
|
|
123204
|
+
}
|
|
123205
|
+
return groups;
|
|
123206
|
+
}
|
|
123207
|
+
}
|
|
123208
|
+
});
|
|
123209
|
+
|
|
123132
123210
|
// dist/validators/TypescriptValidator.js
|
|
123133
123211
|
var require_TypescriptValidator = __commonJS({
|
|
123134
123212
|
"dist/validators/TypescriptValidator.js"(exports2) {
|
|
@@ -123216,87 +123294,67 @@ var require_ValidatorFactory = __commonJS({
|
|
|
123216
123294
|
}
|
|
123217
123295
|
});
|
|
123218
123296
|
|
|
123219
|
-
// dist/system-prompts/fixers/naiveFixerSystemPrompt.js
|
|
123220
|
-
var require_naiveFixerSystemPrompt = __commonJS({
|
|
123221
|
-
"dist/system-prompts/fixers/naiveFixerSystemPrompt.js"(exports2) {
|
|
123222
|
-
"use strict";
|
|
123223
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
123224
|
-
exports2.naiveFixerSystemPrompt = void 0;
|
|
123225
|
-
exports2.naiveFixerSystemPrompt = `You are a senior TypeScript engineer and build tooling expert.
|
|
123226
|
-
You receive a single broken line that caused a build/compile error.
|
|
123227
|
-
You also receive the entire file content.
|
|
123228
|
-
Your task is to return the minimal set of line edits required to fix the error.
|
|
123229
|
-
You should use 3 operators:
|
|
123230
|
-
- replace
|
|
123231
|
-
- insert
|
|
123232
|
-
- delete
|
|
123233
|
-
Add the operator to the response object.
|
|
123234
|
-
|
|
123235
|
-
Rules:
|
|
123236
|
-
- Return ONLY a JSON array of objects with shape: { lineNumber, content, operator }
|
|
123237
|
-
- Preserve the original intent of the lines; fix only syntax/type/identifier issues
|
|
123238
|
-
- Keep imports/names consistent and valid for TypeScript
|
|
123239
|
-
- If generics/JSX/parens are needed, add them correctly
|
|
123240
|
-
- Do NOT add comments or surrounding lines
|
|
123241
|
-
`;
|
|
123242
|
-
exports2.default = exports2.naiveFixerSystemPrompt;
|
|
123243
|
-
}
|
|
123244
|
-
});
|
|
123245
|
-
|
|
123246
123297
|
// dist/agents/NaiveFixerAgent.js
|
|
123247
123298
|
var require_NaiveFixerAgent = __commonJS({
|
|
123248
123299
|
"dist/agents/NaiveFixerAgent.js"(exports2) {
|
|
123249
123300
|
"use strict";
|
|
123250
|
-
var __importDefault2 = exports2 && exports2.__importDefault || function(mod2) {
|
|
123251
|
-
return mod2 && mod2.__esModule ? mod2 : { "default": mod2 };
|
|
123252
|
-
};
|
|
123253
123301
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
123254
|
-
exports2.NaiveFixerAgent = void 0;
|
|
123255
123302
|
var zod_1 = require_zod();
|
|
123256
123303
|
var ai_1 = require_dist7();
|
|
123257
123304
|
var anthropic_1 = require_dist5();
|
|
123258
|
-
var
|
|
123259
|
-
|
|
123260
|
-
|
|
123261
|
-
lineNumber: zod_1.z.number().describe("1-based line number that should be replaced"),
|
|
123262
|
-
content: zod_1.z.string().describe("Full content of the replacement line (single line)"),
|
|
123263
|
-
operator: zod_1.z.enum(["replace", "insert", "delete"]).describe("The operator to use to fix the line")
|
|
123264
|
-
}))
|
|
123305
|
+
var BatchFixSchema = zod_1.z.object({
|
|
123306
|
+
fixedContent: zod_1.z.string().describe("The complete fixed file content with all errors resolved"),
|
|
123307
|
+
summary: zod_1.z.string().describe("Brief summary of what was fixed in the file")
|
|
123265
123308
|
});
|
|
123266
123309
|
var NaiveFixerAgent = class {
|
|
123267
123310
|
constructor(apiKey) {
|
|
123268
123311
|
this.apiKey = apiKey;
|
|
123269
123312
|
}
|
|
123270
|
-
async
|
|
123271
|
-
const system =
|
|
123272
|
-
|
|
123273
|
-
|
|
123274
|
-
|
|
123275
|
-
|
|
123276
|
-
|
|
123277
|
-
|
|
123278
|
-
|
|
123279
|
-
|
|
123280
|
-
|
|
123281
|
-
|
|
123282
|
-
|
|
123313
|
+
async fixFileWithMultipleErrors(input) {
|
|
123314
|
+
const system = `You are an expert TypeScript/JavaScript developer. Your task is to fix ALL compilation errors in a file by providing the complete corrected file content.
|
|
123315
|
+
|
|
123316
|
+
Key principles:
|
|
123317
|
+
1. Fix ALL errors listed in the input
|
|
123318
|
+
2. Make minimal changes - only fix what's broken
|
|
123319
|
+
3. Preserve code style and formatting as much as possible
|
|
123320
|
+
4. Return the COMPLETE file content, not just diffs
|
|
123321
|
+
5. Use block replacements instead of line-by-line changes
|
|
123322
|
+
6. Think like Cursor - analyze the context and make intelligent fixes
|
|
123323
|
+
|
|
123324
|
+
Focus on common TypeScript errors:
|
|
123325
|
+
- Missing imports
|
|
123326
|
+
- Type mismatches
|
|
123327
|
+
- Undefined variables
|
|
123328
|
+
- Syntax errors
|
|
123329
|
+
- Missing semicolons or brackets
|
|
123330
|
+
- Incorrect component props`;
|
|
123331
|
+
const errorsList = input.errors.map((error, index) => `${index + 1}. Line ${error.line}, Column ${error.column}: ${error.message}`).join("\n");
|
|
123332
|
+
const prompt = `File: ${input.filePath}
|
|
123333
|
+
Language: ${input.language}
|
|
123334
|
+
|
|
123335
|
+
ERRORS TO FIX:
|
|
123336
|
+
${errorsList}
|
|
123337
|
+
|
|
123338
|
+
CURRENT FILE CONTENT:
|
|
123339
|
+
${input.content}
|
|
123340
|
+
|
|
123341
|
+
Please provide the complete fixed file content that resolves ALL the errors listed above.`;
|
|
123283
123342
|
const model = (0, anthropic_1.createAnthropic)({ apiKey: this.apiKey })("claude-sonnet-4-20250514");
|
|
123284
123343
|
const result = await (0, ai_1.generateObject)({
|
|
123285
123344
|
model,
|
|
123286
|
-
schema:
|
|
123345
|
+
schema: BatchFixSchema,
|
|
123287
123346
|
system,
|
|
123288
123347
|
prompt,
|
|
123289
|
-
maxRetries:
|
|
123290
|
-
temperature: 0,
|
|
123348
|
+
maxRetries: 2,
|
|
123349
|
+
temperature: 0.1,
|
|
123291
123350
|
experimental_telemetry: {
|
|
123292
123351
|
isEnabled: true,
|
|
123293
|
-
functionId: "
|
|
123352
|
+
functionId: "BatchFixAgent"
|
|
123294
123353
|
}
|
|
123295
123354
|
});
|
|
123296
123355
|
return result.object;
|
|
123297
123356
|
}
|
|
123298
123357
|
};
|
|
123299
|
-
exports2.NaiveFixerAgent = NaiveFixerAgent;
|
|
123300
123358
|
exports2.default = NaiveFixerAgent;
|
|
123301
123359
|
}
|
|
123302
123360
|
});
|
|
@@ -123316,65 +123374,41 @@ var require_NaiveErrorFixer = __commonJS({
|
|
|
123316
123374
|
constructor(apiKey) {
|
|
123317
123375
|
this.apiKey = apiKey;
|
|
123318
123376
|
}
|
|
123319
|
-
async
|
|
123320
|
-
|
|
123321
|
-
}
|
|
123322
|
-
async naiveFixError(outputPath, error) {
|
|
123323
|
-
if (!error.filePath || !error.line) {
|
|
123377
|
+
async fixMultipleErrors(projectDir, filePath, errors) {
|
|
123378
|
+
if (errors.length === 0) {
|
|
123324
123379
|
return;
|
|
123325
123380
|
}
|
|
123326
|
-
const absolutePath = path_1.default.isAbsolute(
|
|
123327
|
-
|
|
123328
|
-
|
|
123329
|
-
const lines = content.split(/\r?\n/);
|
|
123330
|
-
const idx = error.line - 1;
|
|
123331
|
-
const originalLine = lines[idx] ?? "";
|
|
123332
|
-
const fixerAgent = new NaiveFixerAgent_1.default(this.apiKey);
|
|
123333
|
-
const linesToFix = await fixerAgent.fixLines({
|
|
123334
|
-
filePath: error.filePath,
|
|
123335
|
-
line: error.line,
|
|
123336
|
-
column: error.column,
|
|
123337
|
-
message: error.message,
|
|
123338
|
-
brokenLine: originalLine,
|
|
123339
|
-
language: "typescript",
|
|
123340
|
-
relevantFiles: [{ path: absolutePath, content }]
|
|
123341
|
-
});
|
|
123342
|
-
console.log("linesToFix", linesToFix);
|
|
123343
|
-
const { fixes } = linesToFix;
|
|
123344
|
-
if (fixes.length === 0) {
|
|
123381
|
+
const absolutePath = path_1.default.isAbsolute(filePath) ? filePath : path_1.default.join(projectDir, filePath);
|
|
123382
|
+
if (!fs_1.default.existsSync(absolutePath)) {
|
|
123383
|
+
console.warn(`\u26A0\uFE0F File not found: ${absolutePath}`);
|
|
123345
123384
|
return;
|
|
123346
123385
|
}
|
|
123347
|
-
|
|
123348
|
-
|
|
123349
|
-
|
|
123350
|
-
|
|
123351
|
-
|
|
123352
|
-
|
|
123353
|
-
|
|
123354
|
-
|
|
123386
|
+
const originalContent = fs_1.default.readFileSync(absolutePath, "utf8");
|
|
123387
|
+
const fixerAgent = new NaiveFixerAgent_1.default(this.apiKey);
|
|
123388
|
+
try {
|
|
123389
|
+
const batchResult = await fixerAgent.fixFileWithMultipleErrors({
|
|
123390
|
+
filePath,
|
|
123391
|
+
content: originalContent,
|
|
123392
|
+
errors: errors.map((error) => ({
|
|
123393
|
+
line: error.line || 1,
|
|
123394
|
+
column: error.column || 1,
|
|
123395
|
+
message: error.message || "Unknown error"
|
|
123396
|
+
})),
|
|
123397
|
+
language: "typescript"
|
|
123398
|
+
});
|
|
123399
|
+
if (batchResult.fixedContent) {
|
|
123400
|
+
fs_1.default.writeFileSync(absolutePath, batchResult.fixedContent, "utf8");
|
|
123401
|
+
console.log(`\u2705 Applied block replacements to ${filePath}`);
|
|
123402
|
+
if (batchResult.summary) {
|
|
123403
|
+
console.log(`\u{1F4CB} Fix summary: ${batchResult.summary}`);
|
|
123355
123404
|
}
|
|
123356
|
-
|
|
123357
|
-
|
|
123358
|
-
const contextLine = lines[targetIdx];
|
|
123359
|
-
const originalIndent = (contextLine.match(/^\s*/) || [""])[0];
|
|
123360
|
-
const providedIndent = (lineFix.content.match(/^\s*/) || [""])[0];
|
|
123361
|
-
const replacementLine = providedIndent.length === 0 ? `${originalIndent}${lineFix.content}` : lineFix.content;
|
|
123362
|
-
if (op === "insert") {
|
|
123363
|
-
const insertIdx = Math.min(Math.max(0, targetIdx), lines.length);
|
|
123364
|
-
lines.splice(insertIdx, 0, replacementLine);
|
|
123365
|
-
console.log(`\u2795 Inserted line at ${lineFix.lineNumber} in ${error.filePath}. Content: ${replacementLine}`);
|
|
123366
|
-
continue;
|
|
123405
|
+
} else {
|
|
123406
|
+
console.warn(`\u26A0\uFE0F No fixes generated for ${filePath}`);
|
|
123367
123407
|
}
|
|
123368
|
-
|
|
123369
|
-
|
|
123370
|
-
|
|
123408
|
+
} catch (error) {
|
|
123409
|
+
console.error(`\u274C Batch fix failed for ${filePath}:`, error);
|
|
123410
|
+
throw error;
|
|
123371
123411
|
}
|
|
123372
|
-
fs_1.default.writeFileSync(absolutePath, lines.join(newlineSymbol), "utf8");
|
|
123373
|
-
}
|
|
123374
|
-
getNewLineSymbol(content) {
|
|
123375
|
-
const usesCRLF = content.includes("\r\n");
|
|
123376
|
-
const newline = usesCRLF ? "\r\n" : "\n";
|
|
123377
|
-
return newline;
|
|
123378
123412
|
}
|
|
123379
123413
|
};
|
|
123380
123414
|
exports2.default = NaiveErrorFixer;
|
|
@@ -124327,7 +124361,7 @@ var require_fs = __commonJS({
|
|
|
124327
124361
|
});
|
|
124328
124362
|
|
|
124329
124363
|
// ../../node_modules/fs-extra/lib/mkdirs/utils.js
|
|
124330
|
-
var
|
|
124364
|
+
var require_utils19 = __commonJS({
|
|
124331
124365
|
"../../node_modules/fs-extra/lib/mkdirs/utils.js"(exports2, module2) {
|
|
124332
124366
|
"use strict";
|
|
124333
124367
|
var path2 = require("path");
|
|
@@ -124349,7 +124383,7 @@ var require_make_dir = __commonJS({
|
|
|
124349
124383
|
"../../node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports2, module2) {
|
|
124350
124384
|
"use strict";
|
|
124351
124385
|
var fs4 = require_fs();
|
|
124352
|
-
var { checkPath } =
|
|
124386
|
+
var { checkPath } = require_utils19();
|
|
124353
124387
|
var getMode = (options) => {
|
|
124354
124388
|
const defaults = { mode: 511 };
|
|
124355
124389
|
if (typeof options === "number") return options;
|
|
@@ -125242,7 +125276,7 @@ var require_ensure = __commonJS({
|
|
|
125242
125276
|
});
|
|
125243
125277
|
|
|
125244
125278
|
// ../../node_modules/jsonfile/utils.js
|
|
125245
|
-
var
|
|
125279
|
+
var require_utils20 = __commonJS({
|
|
125246
125280
|
"../../node_modules/jsonfile/utils.js"(exports2, module2) {
|
|
125247
125281
|
function stringify(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
|
|
125248
125282
|
const EOF = finalEOL ? EOL : "";
|
|
@@ -125267,7 +125301,7 @@ var require_jsonfile = __commonJS({
|
|
|
125267
125301
|
_fs = require("fs");
|
|
125268
125302
|
}
|
|
125269
125303
|
var universalify = require_universalify();
|
|
125270
|
-
var { stringify, stripBom } =
|
|
125304
|
+
var { stringify, stripBom } = require_utils20();
|
|
125271
125305
|
async function _readFile(file, options = {}) {
|
|
125272
125306
|
if (typeof options === "string") {
|
|
125273
125307
|
options = { encoding: options };
|
|
@@ -125378,7 +125412,7 @@ var require_output_file = __commonJS({
|
|
|
125378
125412
|
var require_output_json = __commonJS({
|
|
125379
125413
|
"../../node_modules/fs-extra/lib/json/output-json.js"(exports2, module2) {
|
|
125380
125414
|
"use strict";
|
|
125381
|
-
var { stringify } =
|
|
125415
|
+
var { stringify } = require_utils20();
|
|
125382
125416
|
var { outputFile } = require_output_file();
|
|
125383
125417
|
async function outputJson(file, data, options = {}) {
|
|
125384
125418
|
const str = stringify(data, options);
|
|
@@ -125392,7 +125426,7 @@ var require_output_json = __commonJS({
|
|
|
125392
125426
|
var require_output_json_sync = __commonJS({
|
|
125393
125427
|
"../../node_modules/fs-extra/lib/json/output-json-sync.js"(exports2, module2) {
|
|
125394
125428
|
"use strict";
|
|
125395
|
-
var { stringify } =
|
|
125429
|
+
var { stringify } = require_utils20();
|
|
125396
125430
|
var { outputFileSync } = require_output_file();
|
|
125397
125431
|
function outputJsonSync(file, data, options) {
|
|
125398
125432
|
const str = stringify(data, options);
|
|
@@ -126205,7 +126239,7 @@ var require_glob_parent = __commonJS({
|
|
|
126205
126239
|
});
|
|
126206
126240
|
|
|
126207
126241
|
// ../../node_modules/braces/lib/utils.js
|
|
126208
|
-
var
|
|
126242
|
+
var require_utils21 = __commonJS({
|
|
126209
126243
|
"../../node_modules/braces/lib/utils.js"(exports2) {
|
|
126210
126244
|
"use strict";
|
|
126211
126245
|
exports2.isInteger = (num) => {
|
|
@@ -126290,7 +126324,7 @@ var require_utils20 = __commonJS({
|
|
|
126290
126324
|
var require_stringify = __commonJS({
|
|
126291
126325
|
"../../node_modules/braces/lib/stringify.js"(exports2, module2) {
|
|
126292
126326
|
"use strict";
|
|
126293
|
-
var utils =
|
|
126327
|
+
var utils = require_utils21();
|
|
126294
126328
|
module2.exports = (ast, options = {}) => {
|
|
126295
126329
|
const stringify = (node, parent = {}) => {
|
|
126296
126330
|
const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
|
|
@@ -126743,7 +126777,7 @@ var require_compile = __commonJS({
|
|
|
126743
126777
|
"../../node_modules/braces/lib/compile.js"(exports2, module2) {
|
|
126744
126778
|
"use strict";
|
|
126745
126779
|
var fill = require_fill_range();
|
|
126746
|
-
var utils =
|
|
126780
|
+
var utils = require_utils21();
|
|
126747
126781
|
var compile = (ast, options = {}) => {
|
|
126748
126782
|
const walk = (node, parent = {}) => {
|
|
126749
126783
|
const invalidBlock = utils.isInvalidBrace(parent);
|
|
@@ -126796,7 +126830,7 @@ var require_expand = __commonJS({
|
|
|
126796
126830
|
"use strict";
|
|
126797
126831
|
var fill = require_fill_range();
|
|
126798
126832
|
var stringify = require_stringify();
|
|
126799
|
-
var utils =
|
|
126833
|
+
var utils = require_utils21();
|
|
126800
126834
|
var append = (queue = "", stash = "", enclose = false) => {
|
|
126801
126835
|
const result = [];
|
|
126802
126836
|
queue = [].concat(queue);
|
|
@@ -127484,7 +127518,7 @@ var require_constants7 = __commonJS({
|
|
|
127484
127518
|
});
|
|
127485
127519
|
|
|
127486
127520
|
// ../../node_modules/picomatch/lib/utils.js
|
|
127487
|
-
var
|
|
127521
|
+
var require_utils22 = __commonJS({
|
|
127488
127522
|
"../../node_modules/picomatch/lib/utils.js"(exports2) {
|
|
127489
127523
|
"use strict";
|
|
127490
127524
|
var path2 = require("path");
|
|
@@ -127548,7 +127582,7 @@ var require_utils21 = __commonJS({
|
|
|
127548
127582
|
var require_scan = __commonJS({
|
|
127549
127583
|
"../../node_modules/picomatch/lib/scan.js"(exports2, module2) {
|
|
127550
127584
|
"use strict";
|
|
127551
|
-
var utils =
|
|
127585
|
+
var utils = require_utils22();
|
|
127552
127586
|
var {
|
|
127553
127587
|
CHAR_ASTERISK,
|
|
127554
127588
|
/* * */
|
|
@@ -127879,7 +127913,7 @@ var require_parse5 = __commonJS({
|
|
|
127879
127913
|
"../../node_modules/picomatch/lib/parse.js"(exports2, module2) {
|
|
127880
127914
|
"use strict";
|
|
127881
127915
|
var constants = require_constants7();
|
|
127882
|
-
var utils =
|
|
127916
|
+
var utils = require_utils22();
|
|
127883
127917
|
var {
|
|
127884
127918
|
MAX_LENGTH,
|
|
127885
127919
|
POSIX_REGEX_SOURCE,
|
|
@@ -128654,7 +128688,7 @@ var require_picomatch = __commonJS({
|
|
|
128654
128688
|
var path2 = require("path");
|
|
128655
128689
|
var scan = require_scan();
|
|
128656
128690
|
var parse = require_parse5();
|
|
128657
|
-
var utils =
|
|
128691
|
+
var utils = require_utils22();
|
|
128658
128692
|
var constants = require_constants7();
|
|
128659
128693
|
var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
128660
128694
|
var picomatch = (glob, options, returnState = false) => {
|
|
@@ -128803,7 +128837,7 @@ var require_micromatch = __commonJS({
|
|
|
128803
128837
|
var util = require("util");
|
|
128804
128838
|
var braces = require_braces();
|
|
128805
128839
|
var picomatch = require_picomatch2();
|
|
128806
|
-
var utils =
|
|
128840
|
+
var utils = require_utils22();
|
|
128807
128841
|
var isEmptyString = (v) => v === "" || v === "./";
|
|
128808
128842
|
var hasBraces = (v) => {
|
|
128809
128843
|
const index = v.indexOf("{");
|
|
@@ -129282,7 +129316,7 @@ var require_string = __commonJS({
|
|
|
129282
129316
|
});
|
|
129283
129317
|
|
|
129284
129318
|
// ../../node_modules/fast-glob/out/utils/index.js
|
|
129285
|
-
var
|
|
129319
|
+
var require_utils23 = __commonJS({
|
|
129286
129320
|
"../../node_modules/fast-glob/out/utils/index.js"(exports2) {
|
|
129287
129321
|
"use strict";
|
|
129288
129322
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -129310,7 +129344,7 @@ var require_tasks = __commonJS({
|
|
|
129310
129344
|
"use strict";
|
|
129311
129345
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
129312
129346
|
exports2.convertPatternGroupToTask = exports2.convertPatternGroupsToTasks = exports2.groupPatternsByBaseDirectory = exports2.getNegativePatternsAsPositive = exports2.getPositivePatterns = exports2.convertPatternsToTasks = exports2.generate = void 0;
|
|
129313
|
-
var utils =
|
|
129347
|
+
var utils = require_utils23();
|
|
129314
129348
|
function generate(input, settings) {
|
|
129315
129349
|
const patterns = processPatterns(input, settings);
|
|
129316
129350
|
const ignore = processPatterns(settings.ignore, settings);
|
|
@@ -129653,7 +129687,7 @@ var require_fs4 = __commonJS({
|
|
|
129653
129687
|
});
|
|
129654
129688
|
|
|
129655
129689
|
// ../../node_modules/@nodelib/fs.scandir/out/utils/index.js
|
|
129656
|
-
var
|
|
129690
|
+
var require_utils24 = __commonJS({
|
|
129657
129691
|
"../../node_modules/@nodelib/fs.scandir/out/utils/index.js"(exports2) {
|
|
129658
129692
|
"use strict";
|
|
129659
129693
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -129688,7 +129722,7 @@ var require_async4 = __commonJS({
|
|
|
129688
129722
|
var fsStat = require_out();
|
|
129689
129723
|
var rpl = require_run_parallel();
|
|
129690
129724
|
var constants_1 = require_constants8();
|
|
129691
|
-
var utils =
|
|
129725
|
+
var utils = require_utils24();
|
|
129692
129726
|
var common = require_common4();
|
|
129693
129727
|
function read(directory, settings, callback) {
|
|
129694
129728
|
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
@@ -129797,7 +129831,7 @@ var require_sync3 = __commonJS({
|
|
|
129797
129831
|
exports2.readdir = exports2.readdirWithFileTypes = exports2.read = void 0;
|
|
129798
129832
|
var fsStat = require_out();
|
|
129799
129833
|
var constants_1 = require_constants8();
|
|
129800
|
-
var utils =
|
|
129834
|
+
var utils = require_utils24();
|
|
129801
129835
|
var common = require_common4();
|
|
129802
129836
|
function read(directory, settings) {
|
|
129803
129837
|
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
@@ -130621,7 +130655,7 @@ var require_reader3 = __commonJS({
|
|
|
130621
130655
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
130622
130656
|
var path2 = require("path");
|
|
130623
130657
|
var fsStat = require_out();
|
|
130624
|
-
var utils =
|
|
130658
|
+
var utils = require_utils23();
|
|
130625
130659
|
var Reader = class {
|
|
130626
130660
|
constructor(_settings) {
|
|
130627
130661
|
this._settings = _settings;
|
|
@@ -130754,7 +130788,7 @@ var require_matcher = __commonJS({
|
|
|
130754
130788
|
"../../node_modules/fast-glob/out/providers/matchers/matcher.js"(exports2) {
|
|
130755
130789
|
"use strict";
|
|
130756
130790
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
130757
|
-
var utils =
|
|
130791
|
+
var utils = require_utils23();
|
|
130758
130792
|
var Matcher = class {
|
|
130759
130793
|
constructor(_patterns, _settings, _micromatchOptions) {
|
|
130760
130794
|
this._patterns = _patterns;
|
|
@@ -130842,7 +130876,7 @@ var require_deep = __commonJS({
|
|
|
130842
130876
|
"../../node_modules/fast-glob/out/providers/filters/deep.js"(exports2) {
|
|
130843
130877
|
"use strict";
|
|
130844
130878
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
130845
|
-
var utils =
|
|
130879
|
+
var utils = require_utils23();
|
|
130846
130880
|
var partial_1 = require_partial();
|
|
130847
130881
|
var DeepFilter = class {
|
|
130848
130882
|
constructor(_settings, _micromatchOptions) {
|
|
@@ -130907,7 +130941,7 @@ var require_entry = __commonJS({
|
|
|
130907
130941
|
"../../node_modules/fast-glob/out/providers/filters/entry.js"(exports2) {
|
|
130908
130942
|
"use strict";
|
|
130909
130943
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
130910
|
-
var utils =
|
|
130944
|
+
var utils = require_utils23();
|
|
130911
130945
|
var EntryFilter = class {
|
|
130912
130946
|
constructor(_settings, _micromatchOptions) {
|
|
130913
130947
|
this._settings = _settings;
|
|
@@ -130995,7 +131029,7 @@ var require_error3 = __commonJS({
|
|
|
130995
131029
|
"../../node_modules/fast-glob/out/providers/filters/error.js"(exports2) {
|
|
130996
131030
|
"use strict";
|
|
130997
131031
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
130998
|
-
var utils =
|
|
131032
|
+
var utils = require_utils23();
|
|
130999
131033
|
var ErrorFilter = class {
|
|
131000
131034
|
constructor(_settings) {
|
|
131001
131035
|
this._settings = _settings;
|
|
@@ -131016,7 +131050,7 @@ var require_entry2 = __commonJS({
|
|
|
131016
131050
|
"../../node_modules/fast-glob/out/providers/transformers/entry.js"(exports2) {
|
|
131017
131051
|
"use strict";
|
|
131018
131052
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
131019
|
-
var utils =
|
|
131053
|
+
var utils = require_utils23();
|
|
131020
131054
|
var EntryTransformer = class {
|
|
131021
131055
|
constructor(_settings) {
|
|
131022
131056
|
this._settings = _settings;
|
|
@@ -131306,7 +131340,7 @@ var require_out4 = __commonJS({
|
|
|
131306
131340
|
var stream_1 = require_stream5();
|
|
131307
131341
|
var sync_1 = require_sync7();
|
|
131308
131342
|
var settings_1 = require_settings4();
|
|
131309
|
-
var utils =
|
|
131343
|
+
var utils = require_utils23();
|
|
131310
131344
|
async function FastGlob(source, options) {
|
|
131311
131345
|
assertPatternsInput2(source);
|
|
131312
131346
|
const works = getWorks(source, async_1.default, options);
|
|
@@ -132323,11 +132357,12 @@ var require_orchestrator = __commonJS({
|
|
|
132323
132357
|
var types_1 = require_types_impl();
|
|
132324
132358
|
var ditto_scaffolding_1 = require_dist11();
|
|
132325
132359
|
var fs_1 = __importDefault2(require("fs"));
|
|
132360
|
+
var utils_1 = require_utils18();
|
|
132326
132361
|
var ValidatorFactory_1 = __importDefault2(require_ValidatorFactory());
|
|
132327
132362
|
var FixerFactory_1 = __importDefault2(require_FixerFactory());
|
|
132328
132363
|
var extensionGenerators_1 = require_extensionGenerators();
|
|
132329
132364
|
var extensionIndexer_1 = require_extensionIndexer();
|
|
132330
|
-
var
|
|
132365
|
+
var MAX_ERRORS_PER_BATCH = 20;
|
|
132331
132366
|
var DittoOrchestrator = class extends events_1.EventEmitter {
|
|
132332
132367
|
constructor(agentsFactory, apiKey) {
|
|
132333
132368
|
super();
|
|
@@ -132430,6 +132465,9 @@ var require_orchestrator = __commonJS({
|
|
|
132430
132465
|
async processExtension({ extension, blueprint, outputPath, createdCollections }) {
|
|
132431
132466
|
this.emitEvent("scaffold:start", { extension });
|
|
132432
132467
|
const scaffolds = await (0, ditto_scaffolding_1.copyScaffoldingTemplate)(extension, outputPath);
|
|
132468
|
+
if (!scaffolds) {
|
|
132469
|
+
console.error(`\u274C Failed to scaffold ${extension.type}`);
|
|
132470
|
+
}
|
|
132433
132471
|
this.emitEvent("scaffold:done", {
|
|
132434
132472
|
extension,
|
|
132435
132473
|
scaffoldPath: scaffolds.map((s) => s.path).join(", ")
|
|
@@ -132662,38 +132700,66 @@ var require_orchestrator = __commonJS({
|
|
|
132662
132700
|
}
|
|
132663
132701
|
async startFixFlow(request) {
|
|
132664
132702
|
const { projectDir, apiKey } = request;
|
|
132703
|
+
if (!apiKey) {
|
|
132704
|
+
throw new Error("\u26A0\uFE0F No API key provided for fix flow - fixes may be limited");
|
|
132705
|
+
}
|
|
132665
132706
|
this.emitEvent("validation:start", { outputPath: projectDir });
|
|
132666
132707
|
const fixerFactory = new FixerFactory_1.default(apiKey);
|
|
132667
132708
|
const validatorFactory = new ValidatorFactory_1.default();
|
|
132668
132709
|
const validator = validatorFactory.getValidator();
|
|
132669
|
-
|
|
132670
|
-
|
|
132671
|
-
|
|
132672
|
-
|
|
132673
|
-
|
|
132674
|
-
|
|
132675
|
-
|
|
132710
|
+
console.log("\u{1F50D} Running validation and batch fix...");
|
|
132711
|
+
const initialValidation = await validator.validate(projectDir);
|
|
132712
|
+
if (initialValidation.status === 0) {
|
|
132713
|
+
console.log(`\u2705 ${validator.type} validation passed - no fixes needed`);
|
|
132714
|
+
this.emitEvent("validation:done", { outputPath: projectDir });
|
|
132715
|
+
return;
|
|
132716
|
+
}
|
|
132717
|
+
if (!initialValidation.parsedValidationErrors || initialValidation.parsedValidationErrors.length === 0) {
|
|
132718
|
+
const errorMessage2 = `Validation failed but no parsed errors available. Raw errors: ${initialValidation.validationErrors}`;
|
|
132719
|
+
console.warn(`\u26A0\uFE0F ${errorMessage2}`);
|
|
132720
|
+
this.emitEvent("validation:error", {
|
|
132721
|
+
error: new Error(errorMessage2)
|
|
132722
|
+
});
|
|
132723
|
+
throw new Error(errorMessage2);
|
|
132724
|
+
}
|
|
132725
|
+
const totalErrors = initialValidation.parsedValidationErrors.length;
|
|
132726
|
+
console.log(`\u{1F4DD} Found ${totalErrors} errors to fix`);
|
|
132727
|
+
const errorsByFile = (0, utils_1.mapGroupBy)(initialValidation.parsedValidationErrors, (error) => error.filePath);
|
|
132728
|
+
console.log(`\u{1F4C1} Errors span ${errorsByFile.size} files`);
|
|
132729
|
+
let totalFixesApplied = 0;
|
|
132730
|
+
const fixer = fixerFactory.getFixer();
|
|
132731
|
+
for (const [filePath, fileErrors] of errorsByFile) {
|
|
132732
|
+
const errorsToFix = fileErrors.slice(0, MAX_ERRORS_PER_BATCH);
|
|
132733
|
+
if (errorsToFix.length < fileErrors.length) {
|
|
132734
|
+
console.log(`\u{1F4CB} Processing ${errorsToFix.length}/${fileErrors.length} errors for ${filePath} (batching to prevent AI overload)`);
|
|
132735
|
+
} else {
|
|
132736
|
+
console.log(`\u{1F4CB} Processing ${errorsToFix.length} errors for ${filePath}`);
|
|
132676
132737
|
}
|
|
132677
|
-
|
|
132678
|
-
|
|
132679
|
-
|
|
132680
|
-
|
|
132681
|
-
|
|
132682
|
-
|
|
132683
|
-
|
|
132684
|
-
}
|
|
132685
|
-
const [firstError] = parsedValidationErrors;
|
|
132686
|
-
const fixer = fixerFactory.getFixer();
|
|
132687
|
-
await fixer.fixError(projectDir, firstError);
|
|
132738
|
+
try {
|
|
132739
|
+
await fixer.fixMultipleErrors(projectDir, filePath, errorsToFix);
|
|
132740
|
+
totalFixesApplied += errorsToFix.length;
|
|
132741
|
+
console.log(`\u2705 Applied batch fixes for ${filePath}`);
|
|
132742
|
+
} catch (fixError) {
|
|
132743
|
+
console.error(`\u274C Failed to fix errors in ${filePath}: ${fixError instanceof Error ? fixError.message : String(fixError)}`);
|
|
132744
|
+
continue;
|
|
132688
132745
|
}
|
|
132689
132746
|
}
|
|
132690
|
-
|
|
132747
|
+
console.log(`\u{1F4CA} Batch fix completed: ${totalFixesApplied} fixes applied across ${errorsByFile.size} files`);
|
|
132748
|
+
const finalValidation = await validator.validate(projectDir);
|
|
132749
|
+
if (finalValidation.status === 0) {
|
|
132750
|
+
console.log(`\u2705 ${validator.type} validation passed after batch fixes`);
|
|
132751
|
+
this.emitEvent("validation:done", { outputPath: projectDir });
|
|
132752
|
+
return;
|
|
132753
|
+
}
|
|
132754
|
+
const remainingErrors = finalValidation.parsedValidationErrors?.length || 0;
|
|
132755
|
+
const unfixedValidationErrors = finalValidation.validationErrors || "Unknown validation errors";
|
|
132756
|
+
console.log(`\u{1F4CB} ${remainingErrors} errors remaining after fixes`);
|
|
132757
|
+
const errorMessage = `Validation failed after batch fix attempt. Fixed ${totalFixesApplied} errors, but ${remainingErrors} remain:
|
|
132758
|
+
${unfixedValidationErrors}`;
|
|
132691
132759
|
this.emitEvent("validation:error", {
|
|
132692
|
-
error: new Error(
|
|
132693
|
-
${unfixedValidationErrors}`)
|
|
132760
|
+
error: new Error(errorMessage)
|
|
132694
132761
|
});
|
|
132695
|
-
throw new Error(
|
|
132696
|
-
${unfixedValidationErrors}`);
|
|
132762
|
+
throw new Error(errorMessage);
|
|
132697
132763
|
}
|
|
132698
132764
|
listGeneratedAppFiles(outputPath) {
|
|
132699
132765
|
const root = outputPath;
|
|
@@ -132721,53 +132787,6 @@ ${unfixedValidationErrors}`);
|
|
|
132721
132787
|
}
|
|
132722
132788
|
});
|
|
132723
132789
|
|
|
132724
|
-
// dist/utils.js
|
|
132725
|
-
var require_utils24 = __commonJS({
|
|
132726
|
-
"dist/utils.js"(exports2) {
|
|
132727
|
-
"use strict";
|
|
132728
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
132729
|
-
exports2.serializeError = serializeError;
|
|
132730
|
-
function serializeError(error) {
|
|
132731
|
-
if (error instanceof Error) {
|
|
132732
|
-
const base = {
|
|
132733
|
-
name: error.name,
|
|
132734
|
-
message: error.message,
|
|
132735
|
-
stack: error.stack
|
|
132736
|
-
};
|
|
132737
|
-
const anyErr = error;
|
|
132738
|
-
for (const key in anyErr) {
|
|
132739
|
-
if (!(key in base)) {
|
|
132740
|
-
try {
|
|
132741
|
-
base[key] = anyErr[key];
|
|
132742
|
-
} catch {
|
|
132743
|
-
}
|
|
132744
|
-
}
|
|
132745
|
-
}
|
|
132746
|
-
const withCause = error;
|
|
132747
|
-
if (withCause && "cause" in withCause) {
|
|
132748
|
-
base.cause = withCause.cause;
|
|
132749
|
-
}
|
|
132750
|
-
const maybeHttp = error;
|
|
132751
|
-
if (maybeHttp?.response?.data !== void 0)
|
|
132752
|
-
base.data = maybeHttp.response.data;
|
|
132753
|
-
if (maybeHttp?.code !== void 0)
|
|
132754
|
-
base.code = maybeHttp.code;
|
|
132755
|
-
if (maybeHttp?.details !== void 0)
|
|
132756
|
-
base.details = maybeHttp.details;
|
|
132757
|
-
return base;
|
|
132758
|
-
}
|
|
132759
|
-
if (typeof error === "object" && error !== null) {
|
|
132760
|
-
try {
|
|
132761
|
-
return JSON.parse(JSON.stringify(error));
|
|
132762
|
-
} catch {
|
|
132763
|
-
return { message: String(error) };
|
|
132764
|
-
}
|
|
132765
|
-
}
|
|
132766
|
-
return { message: String(error) };
|
|
132767
|
-
}
|
|
132768
|
-
}
|
|
132769
|
-
});
|
|
132770
|
-
|
|
132771
132790
|
// dist/flows/init-codegen.js
|
|
132772
132791
|
var require_init_codegen = __commonJS({
|
|
132773
132792
|
"dist/flows/init-codegen.js"(exports2) {
|
|
@@ -132785,7 +132804,7 @@ var require_init_codegen = __commonJS({
|
|
|
132785
132804
|
var job_context_storage_1 = require_job_context_storage();
|
|
132786
132805
|
var orchestrator_1 = require_orchestrator();
|
|
132787
132806
|
var CodeGenService_1 = require_CodeGenService();
|
|
132788
|
-
var utils_1 =
|
|
132807
|
+
var utils_1 = require_utils18();
|
|
132789
132808
|
var slugify = (str = "") => {
|
|
132790
132809
|
return str.toLowerCase().replace(/ /g, "-");
|
|
132791
132810
|
};
|
|
@@ -132851,7 +132870,7 @@ var require_iterate_codegen = __commonJS({
|
|
|
132851
132870
|
var job_context_storage_1 = require_job_context_storage();
|
|
132852
132871
|
var orchestrator_1 = require_orchestrator();
|
|
132853
132872
|
var CodeGenService_1 = require_CodeGenService();
|
|
132854
|
-
var utils_1 =
|
|
132873
|
+
var utils_1 = require_utils18();
|
|
132855
132874
|
var slugify = (str = "") => {
|
|
132856
132875
|
return str.toLowerCase().replace(/ /g, "-");
|
|
132857
132876
|
};
|
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.33",
|
|
4
4
|
"description": "AI-powered Wix CLI app generator - standalone executable",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "node build.mjs",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@wix/ditto-codegen": "1.0.0",
|
|
25
25
|
"esbuild": "^0.25.9"
|
|
26
26
|
},
|
|
27
|
-
"falconPackageHash": "
|
|
27
|
+
"falconPackageHash": "438aa2aa8435b6197cd12b43db755435ef7ea7471ad1e043a9c55443"
|
|
28
28
|
}
|