@wix/ditto-codegen-public 1.0.226 → 1.0.227
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 +2 -194
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -105688,124 +105688,6 @@ Please provide the complete fixed file content that resolves ALL the errors list
|
|
|
105688
105688
|
}
|
|
105689
105689
|
});
|
|
105690
105690
|
|
|
105691
|
-
// dist/agents/BuildFixerAgent.js
|
|
105692
|
-
var require_BuildFixerAgent = __commonJS({
|
|
105693
|
-
"dist/agents/BuildFixerAgent.js"(exports2) {
|
|
105694
|
-
"use strict";
|
|
105695
|
-
var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
|
|
105696
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
105697
|
-
};
|
|
105698
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
105699
|
-
exports2.BuildFixerAgent = void 0;
|
|
105700
|
-
var zod_1 = require_zod();
|
|
105701
|
-
var ditto_codegen_types_12 = require_dist();
|
|
105702
|
-
var codegen_common_logic_1 = require_dist12();
|
|
105703
|
-
var dedent_1 = __importDefault2(require_dedent());
|
|
105704
|
-
var constants_1 = require_constants2();
|
|
105705
|
-
var customAnthropicProvider_1 = require_customAnthropicProvider();
|
|
105706
|
-
var tools_1 = require_tools2();
|
|
105707
|
-
var BuildFixSchema = zod_1.z.object({
|
|
105708
|
-
filePath: zod_1.z.string().describe("Relative path to the file to fix"),
|
|
105709
|
-
fixedContent: zod_1.z.string().describe("The complete fixed file content"),
|
|
105710
|
-
summary: zod_1.z.string().describe("Brief summary of what was fixed")
|
|
105711
|
-
});
|
|
105712
|
-
var SUBMIT_FIX_TOOL_NAME = "submit_fix";
|
|
105713
|
-
function createSubmitFixTool() {
|
|
105714
|
-
return {
|
|
105715
|
-
description: "Submit the fix for a build error. Use this after reading the file and understanding what needs to be fixed.",
|
|
105716
|
-
inputSchema: BuildFixSchema,
|
|
105717
|
-
execute: async (input) => input
|
|
105718
|
-
};
|
|
105719
|
-
}
|
|
105720
|
-
var BuildFixerAgent = class {
|
|
105721
|
-
constructor() {
|
|
105722
|
-
this.name = "BuildFixerAgent";
|
|
105723
|
-
}
|
|
105724
|
-
buildSystemPrompt() {
|
|
105725
|
-
return (0, dedent_1.default)`You are an expert TypeScript/JavaScript developer. Your task is to fix build errors.
|
|
105726
|
-
|
|
105727
|
-
WORKFLOW:
|
|
105728
|
-
1. Analyze the build output to identify the error type and files involved
|
|
105729
|
-
2. Read the relevant file(s) to understand the context
|
|
105730
|
-
3. ALWAYS call submit_fix with your fix - this is REQUIRED
|
|
105731
|
-
|
|
105732
|
-
EXTENSION-VALIDATOR ERRORS (most common):
|
|
105733
|
-
Format: "[field] message (... → ./path/source.ts)"
|
|
105734
|
-
- Look for the arrow (→) - it points to a source file path
|
|
105735
|
-
- The extension.ts config is in the SAME FOLDER as that source file
|
|
105736
|
-
- Example: "→ ./backend/spi/foo/plugin.ts" means read:
|
|
105737
|
-
- ./backend/spi/foo/plugin.ts (source)
|
|
105738
|
-
- ./backend/spi/foo/extension.ts (config)
|
|
105739
|
-
- READ BOTH files before deciding which one needs the fix
|
|
105740
|
-
|
|
105741
|
-
OTHER BUILD ERRORS:
|
|
105742
|
-
- Read the file mentioned in the error
|
|
105743
|
-
- Use the error message and file content to determine the fix
|
|
105744
|
-
|
|
105745
|
-
CRITICAL RULES:
|
|
105746
|
-
- You MUST call submit_fix at the end - never respond with just text
|
|
105747
|
-
- Read files FIRST, then submit the fix
|
|
105748
|
-
- Read only 1-2 files maximum
|
|
105749
|
-
- Make minimal changes - only fix what's broken
|
|
105750
|
-
- Preserve code style and formatting`;
|
|
105751
|
-
}
|
|
105752
|
-
formatPreviousBuildOutput(previousBuildOutput) {
|
|
105753
|
-
if (!previousBuildOutput) {
|
|
105754
|
-
return "";
|
|
105755
|
-
}
|
|
105756
|
-
return (0, dedent_1.default)`
|
|
105757
|
-
The following build output was from the previous fix attempt.
|
|
105758
|
-
Please try a DIFFERENT approach to solve the remaining errors:
|
|
105759
|
-
|
|
105760
|
-
${previousBuildOutput}
|
|
105761
|
-
`;
|
|
105762
|
-
}
|
|
105763
|
-
async fixBuildErrors(input) {
|
|
105764
|
-
const previousErrorsSection = this.formatPreviousBuildOutput(input.previousBuildOutput);
|
|
105765
|
-
const userMessage = (0, dedent_1.default)`
|
|
105766
|
-
BUILD OUTPUT:
|
|
105767
|
-
${input.buildOutput}
|
|
105768
|
-
|
|
105769
|
-
${previousErrorsSection}
|
|
105770
|
-
|
|
105771
|
-
Instructions:
|
|
105772
|
-
1. Identify the error type and files involved
|
|
105773
|
-
2. Read the relevant file(s) first to understand the context
|
|
105774
|
-
3. After reading, submit the fix for the file that needs changing
|
|
105775
|
-
`;
|
|
105776
|
-
console.log(`\u{1F527} BuildFixerAgent starting with tools...`);
|
|
105777
|
-
const model = (0, customAnthropicProvider_1.createCustomTextModel)()(constants_1.LLM_MODELS.CLAUDE_HAIKU_4_5, {
|
|
105778
|
-
agentName: this.name
|
|
105779
|
-
});
|
|
105780
|
-
try {
|
|
105781
|
-
const result = await (0, codegen_common_logic_1.generateAgentText)({
|
|
105782
|
-
agentName: this.name,
|
|
105783
|
-
model,
|
|
105784
|
-
tools: {
|
|
105785
|
-
[tools_1.TOOL_NAMES.READ_FILE]: (0, tools_1.createReadFileTool)(input.projectDir),
|
|
105786
|
-
[SUBMIT_FIX_TOOL_NAME]: createSubmitFixTool()
|
|
105787
|
-
},
|
|
105788
|
-
systemPrompt: this.buildSystemPrompt(),
|
|
105789
|
-
userMessage,
|
|
105790
|
-
stopWhen: (0, codegen_common_logic_1.stopOnToolCall)(SUBMIT_FIX_TOOL_NAME)
|
|
105791
|
-
});
|
|
105792
|
-
const fixResult = (0, codegen_common_logic_1.extractToolResult)(result.toolCalls, SUBMIT_FIX_TOOL_NAME);
|
|
105793
|
-
if (!fixResult) {
|
|
105794
|
-
throw new ditto_codegen_types_12.AutoFixError("BuildFixerAgent did not submit a fix", {
|
|
105795
|
-
validationType: ditto_codegen_types_12.ValidationType.BUILD
|
|
105796
|
-
});
|
|
105797
|
-
}
|
|
105798
|
-
console.log(`\u{1F527} BuildFixerAgent fix submitted for: ${fixResult.filePath}`);
|
|
105799
|
-
return fixResult;
|
|
105800
|
-
} catch (error) {
|
|
105801
|
-
throw (0, ditto_codegen_types_12.toCodegenError)(error);
|
|
105802
|
-
}
|
|
105803
|
-
}
|
|
105804
|
-
};
|
|
105805
|
-
exports2.BuildFixerAgent = BuildFixerAgent;
|
|
105806
|
-
}
|
|
105807
|
-
});
|
|
105808
|
-
|
|
105809
105691
|
// dist/fixers/NaiveErrorFixer.js
|
|
105810
105692
|
var require_NaiveErrorFixer = __commonJS({
|
|
105811
105693
|
"dist/fixers/NaiveErrorFixer.js"(exports2) {
|
|
@@ -105817,7 +105699,6 @@ var require_NaiveErrorFixer = __commonJS({
|
|
|
105817
105699
|
var fs_1 = __importDefault2(require("fs"));
|
|
105818
105700
|
var path_1 = __importDefault2(require("path"));
|
|
105819
105701
|
var NaiveFixerAgent_1 = require_NaiveFixerAgent();
|
|
105820
|
-
var BuildFixerAgent_1 = require_BuildFixerAgent();
|
|
105821
105702
|
var ditto_codegen_types_12 = require_dist();
|
|
105822
105703
|
var NaiveErrorFixer = class {
|
|
105823
105704
|
constructor() {
|
|
@@ -105860,30 +105741,6 @@ var require_NaiveErrorFixer = __commonJS({
|
|
|
105860
105741
|
throw (0, ditto_codegen_types_12.toCodegenError)(error);
|
|
105861
105742
|
}
|
|
105862
105743
|
}
|
|
105863
|
-
async fixBuildErrors(projectDir, buildOutput, previousBuildOutput) {
|
|
105864
|
-
const buildFixerAgent = new BuildFixerAgent_1.BuildFixerAgent();
|
|
105865
|
-
try {
|
|
105866
|
-
const result = await buildFixerAgent.fixBuildErrors({
|
|
105867
|
-
projectDir,
|
|
105868
|
-
buildOutput,
|
|
105869
|
-
previousBuildOutput
|
|
105870
|
-
});
|
|
105871
|
-
const absolutePath = path_1.default.join(projectDir, result.filePath);
|
|
105872
|
-
if (!fs_1.default.existsSync(absolutePath)) {
|
|
105873
|
-
console.warn(`\u26A0\uFE0F File not found: ${absolutePath}`);
|
|
105874
|
-
return { fixed: false, summary: result.summary };
|
|
105875
|
-
}
|
|
105876
|
-
fs_1.default.writeFileSync(absolutePath, result.fixedContent, "utf8");
|
|
105877
|
-
console.log(`\u2705 Applied build fix to ${result.filePath}`);
|
|
105878
|
-
if (result.summary) {
|
|
105879
|
-
console.log(`\u{1F4CB} Build fix summary: ${result.summary}`);
|
|
105880
|
-
}
|
|
105881
|
-
return { fixed: true, summary: result.summary };
|
|
105882
|
-
} catch (error) {
|
|
105883
|
-
console.error(`\u274C Build fix failed:`, error);
|
|
105884
|
-
throw (0, ditto_codegen_types_12.toCodegenError)(error);
|
|
105885
|
-
}
|
|
105886
|
-
}
|
|
105887
105744
|
};
|
|
105888
105745
|
exports2.default = NaiveErrorFixer;
|
|
105889
105746
|
var formatErrorToString = (err) => {
|
|
@@ -105927,7 +105784,6 @@ var require_fixFlow = __commonJS({
|
|
|
105927
105784
|
};
|
|
105928
105785
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
105929
105786
|
exports2.startFixFlow = startFixFlow;
|
|
105930
|
-
var child_process_1 = require("child_process");
|
|
105931
105787
|
var utils_1 = require_utils15();
|
|
105932
105788
|
var ValidatorFactory_1 = __importDefault2(require_ValidatorFactory());
|
|
105933
105789
|
var FixerFactory_1 = __importDefault2(require_FixerFactory());
|
|
@@ -105936,41 +105792,6 @@ var require_fixFlow = __commonJS({
|
|
|
105936
105792
|
var codeGenerationService_12 = require_codeGenerationService();
|
|
105937
105793
|
var MAX_ERRORS_PER_BATCH = 20;
|
|
105938
105794
|
var MAX_FIX_ATTEMPTS = 3;
|
|
105939
|
-
var MAX_BUILD_FIX_ATTEMPTS = 3;
|
|
105940
|
-
var runBuild = (projectDir) => {
|
|
105941
|
-
const result = (0, child_process_1.spawnSync)("npm", ["run", "build"], {
|
|
105942
|
-
cwd: projectDir,
|
|
105943
|
-
stdio: "pipe",
|
|
105944
|
-
shell: true,
|
|
105945
|
-
env: process.env
|
|
105946
|
-
});
|
|
105947
|
-
return {
|
|
105948
|
-
status: result.status ?? 1,
|
|
105949
|
-
output: (result.stdout?.toString() || "") + (result.stderr?.toString() || "")
|
|
105950
|
-
};
|
|
105951
|
-
};
|
|
105952
|
-
var runBuildFixLoop = async (projectDir, fixer, attempt = 1, previousBuildOutput) => {
|
|
105953
|
-
if (attempt > MAX_BUILD_FIX_ATTEMPTS) {
|
|
105954
|
-
return false;
|
|
105955
|
-
}
|
|
105956
|
-
const buildResult = runBuild(projectDir);
|
|
105957
|
-
if (buildResult.status === 0) {
|
|
105958
|
-
console.log(`\u2705 Build passed`);
|
|
105959
|
-
return true;
|
|
105960
|
-
}
|
|
105961
|
-
console.log(`\u274C Build failed (attempt ${attempt}/${MAX_BUILD_FIX_ATTEMPTS}), trying to fix...`);
|
|
105962
|
-
try {
|
|
105963
|
-
const buildFixResult = await fixer.fixBuildErrors(projectDir, buildResult.output, previousBuildOutput);
|
|
105964
|
-
if (!buildFixResult.fixed) {
|
|
105965
|
-
console.log(`\u26A0\uFE0F No fixes generated for build errors`);
|
|
105966
|
-
return false;
|
|
105967
|
-
}
|
|
105968
|
-
return runBuildFixLoop(projectDir, fixer, attempt + 1, buildResult.output);
|
|
105969
|
-
} catch (fixError) {
|
|
105970
|
-
console.error(`\u274C Failed to fix build errors: ${fixError instanceof Error ? fixError.message : String(fixError)}`);
|
|
105971
|
-
return false;
|
|
105972
|
-
}
|
|
105973
|
-
};
|
|
105974
105795
|
var toErrorSummary = (error) => ({
|
|
105975
105796
|
filePath: error.filePath,
|
|
105976
105797
|
line: error.line,
|
|
@@ -106056,22 +105877,9 @@ var require_fixFlow = __commonJS({
|
|
|
106056
105877
|
const isLastAttempt = attempt === MAX_FIX_ATTEMPTS;
|
|
106057
105878
|
if (validationPassed) {
|
|
106058
105879
|
const fixedErrors = getFixedErrors([]);
|
|
106059
|
-
console.log(`\u2705 ${validator.type} validation passed
|
|
106060
|
-
const buildPassed = await runBuildFixLoop(projectDir, fixer);
|
|
106061
|
-
if (!buildPassed) {
|
|
106062
|
-
const finalBuildResult = runBuild(projectDir);
|
|
106063
|
-
await updateFixTask(ditto_codegen_types_12.Status.COMPLETED, {
|
|
106064
|
-
description: `Fixed ${fixedErrors.length} TypeScript errors, but build still failing`,
|
|
106065
|
-
warning: `Build error: ${finalBuildResult.output.slice(0, 500)}`,
|
|
106066
|
-
fixedErrors: fixedErrors.map(toErrorSummary)
|
|
106067
|
-
});
|
|
106068
|
-
throw new ditto_codegen_types_12.CodeValidationError("Build failed after TypeScript passed", {
|
|
106069
|
-
validationType: ditto_codegen_types_12.ValidationType.BUILD,
|
|
106070
|
-
errors: []
|
|
106071
|
-
});
|
|
106072
|
-
}
|
|
105880
|
+
console.log(`\u2705 ${validator.type} validation passed`);
|
|
106073
105881
|
await updateFixTask(ditto_codegen_types_12.Status.COMPLETED, {
|
|
106074
|
-
description: `Fixed ${fixedErrors.length} TypeScript errors
|
|
105882
|
+
description: `Fixed ${fixedErrors.length} TypeScript errors.`,
|
|
106075
105883
|
fixedErrors: fixedErrors.map(toErrorSummary)
|
|
106076
105884
|
});
|
|
106077
105885
|
return;
|
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.227",
|
|
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.27.2"
|
|
26
26
|
},
|
|
27
|
-
"falconPackageHash": "
|
|
27
|
+
"falconPackageHash": "f3db2e05872ddc73fb7e494b1a002fb4a6c59424cdaf9bd7b60e5af9"
|
|
28
28
|
}
|