@ai-dev-tools/csharp-copilot-core 0.0.37 → 0.0.38

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.
@@ -1,4 +1,4 @@
1
1
  import { GenResult } from "../types/genResult";
2
2
  export declare function autoFixTestCode(prompts: any[], sourceCodePath: string, sourceCode: string, dependency: string, testCode: string, testProjectPath: string, testFilePath: string, testFramework: string, isXapCode: boolean, isVsPlugin: boolean, testFileExist: boolean, keepFailedTests: boolean, insertedRanges?: [number, number][], retryTimes?: number, isBenchmark?: boolean, originalTestLength?: number): Promise<GenResult>;
3
- export declare function generateAutoFixCode(prompts: any[], sourceCodePath: string, sourceCode: string, dependency: string, generatedCode: string, errorMessage: string, isBuildFailure: boolean, testFilePath: string, testFramework: string, isXapCode: boolean, testFileExist: boolean): Promise<string>;
3
+ export declare function generateAutoFixCode(prompts: any[], sourceCodePath: string, sourceCode: string, dependency: string, generatedCode: string, errorMessage: string, isBuildFailure: boolean, testFilePath: string, testFramework: string, isXapCode: boolean, testFileExist: boolean, buildResult?: any, testResult?: any): Promise<string>;
4
4
  export declare function autoRetryTestCode(prompts: any[], sourceCodePath: string, testCode: string, testProjectPath: string, testFilePath: string, testFramework: string, isXapCode: boolean, retryTimes?: number): Promise<GenResult>;
@@ -9,6 +9,7 @@ const preparePrompt_1 = require("../llm/preparePrompt");
9
9
  const verifyBuildErrorCausedFile_1 = require("../utils/verifyBuildErrorCausedFile");
10
10
  const verifyGeneratedCode_1 = require("../utils/verifyGeneratedCode");
11
11
  const removeFailedTestMethods_1 = require("../utils/removeFailedTestMethods");
12
+ const moreUTAutoFixUtil_1 = require("../utils/moreUTAutoFixUtil");
12
13
  const writeGenCode_1 = require("../utils/writeGenCode");
13
14
  const fileUtils_1 = require("../utils/fileUtils");
14
15
  const writeFailedVerifyResult_1 = require("../utils/writeFailedVerifyResult");
@@ -92,7 +93,7 @@ async function autoFixTestCode(prompts, sourceCodePath, sourceCode, dependency,
92
93
  console.error("!!!Verify process failed, retrying...");
93
94
  continue;
94
95
  }
95
- generatedCode = await generateAutoFixCode(prompts, sourceCodePath, sourceCode, dependency, generatedCode, errorMessage, isBuildFailure, testFilePath, testFramework, isXapCode, testFileExist);
96
+ generatedCode = await generateAutoFixCode(prompts, sourceCodePath, sourceCode, dependency, generatedCode, errorMessage, isBuildFailure, testFilePath, testFramework, isXapCode, testFileExist, buildResult, testResult);
96
97
  }
97
98
  // Try to remove failed test methods and return success if possible (only when keepFailedTests is false)
98
99
  if (!keepFailedTests) {
@@ -151,13 +152,17 @@ function verifyBuildErrorCausedLines(buildResult, insertedRanges) {
151
152
  }
152
153
  return true; // All errors are in inserted ranges
153
154
  }
154
- async function generateAutoFixCode(prompts, sourceCodePath, sourceCode, dependency, generatedCode, errorMessage, isBuildFailure, testFilePath, testFramework, isXapCode, testFileExist) {
155
+ async function generateAutoFixCode(prompts, sourceCodePath, sourceCode, dependency, generatedCode, errorMessage, isBuildFailure, testFilePath, testFramework, isXapCode, testFileExist, buildResult, testResult) {
155
156
  console.log("start auto-fix process...");
156
157
  const autofixPrompt = testFileExist
157
158
  ? (0, preparePrompt_1.prepareMoreUtAutoFixPrompt)(sourceCode, dependency, generatedCode, errorMessage, isBuildFailure, isXapCode)
158
159
  : (0, preparePrompt_1.prepareUtAutoFixPrompt)(prompts, generatedCode, errorMessage, isBuildFailure);
160
+ // Extract error test method names for the more UT auto-fix scenario
161
+ const errorMethodNames = testFileExist
162
+ ? (0, moreUTAutoFixUtil_1.extractErrorTestMethodNames)(generatedCode, isBuildFailure, buildResult, testResult)
163
+ : undefined;
159
164
  // get valid code from LLM response with retry
160
- const llmResult = await (0, ensureValidLLMResponse_1.ensureValidLLMResponse)(autofixPrompt, testFramework, isXapCode, false, testFilePath, true, 3, sourceCode);
165
+ const llmResult = await (0, ensureValidLLMResponse_1.ensureValidLLMResponse)(autofixPrompt, testFramework, isXapCode, testFileExist, testFilePath, true, 3, sourceCode, errorMethodNames);
161
166
  const newGeneratedCode = llmResult?.testCode;
162
167
  // if generate code is valid, write test code to test project
163
168
  !!newGeneratedCode && (0, fileUtils_1.writeTestCode)(newGeneratedCode, testFilePath);
@@ -1 +1 @@
1
- {"version":3,"file":"autoFix.js","sourceRoot":"","sources":["../../src/gen/autoFix.ts"],"names":[],"mappings":";;AAYA,0CAsIC;AAoCD,kDA0BC;AAID,8CA+BC;AAlPD,gEAA6D;AAC7D,qEAAkE;AAClE,wDAA0F;AAC1F,oFAAiF;AACjF,sEAAmE;AACnE,8EAA2E;AAC3E,wDAAqD;AACrD,kDAAiE;AACjE,8EAA2E;AAC3E,wEAA4E;AAErE,KAAK,UAAU,eAAe,CACjC,OAAc,EACd,cAAsB,EACtB,UAAkB,EAClB,UAAkB,EAClB,QAAgB,EAChB,eAAuB,EACvB,YAAoB,EACpB,aAAqB,EACrB,SAAkB,EAClB,UAAmB,EACnB,aAAsB,EACtB,eAAwB,EACxB,iBAAqC,SAAS,EAC9C,aAAqB,CAAC,EACtB,cAAuB,KAAK,EAC5B,qBAA6B,CAAC;IAE9B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,IAAI,aAAa,GAAG,QAAQ,CAAC;IAC7B,IAAI,UAAU,CAAC;IACf,IAAI,WAAW,CAAC;IAChB,IAAI,YAAY,CAAC;IACjB,IAAI,cAAc,GAAG,IAAI,CAAC;IAC1B,IAAI,CAAC;QACD,MAAM,qBAAqB,GAAG,IAAA,kDAA2B,EAAC,cAAc,CAAC,CAAC;QAC1E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;YACnC,2DAA2D;YAC3D,CAAC,UAAU,IAAI,IAAA,2BAAY,EAAC,cAAc,EAAE,aAAa,EAAE,CAAC,EAAE,qBAAqB,CAAC,CAAC;YAErF,6EAA6E;YAC7E,IAAI,CAAC,aAAa,EAAE,CAAC;gBACjB,OAAO,CAAC,KAAK,CAAC,qEA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E,CAAC;IAE7B,IAAI,aAAa,GAAG,QAAQ,CAAC;IAC7B,IAAI,SAAS,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,IAAI,CAAC,KAAK,UAAU,EAAE,CAAC;YACnB,OAAO,CAAC,KAAK,CAAC,uCAAuC,UAAU,YAAY,CAAC,CAAC;YAC7E,MAAM;QACV,CAAC;QAED,MAAM,aAAa,GAAG,OAAO,CAAC;QAC9B,mCAAmC;QACnC,MAAM,SAAS,GAAG,MAAM,IAAA,+CAAsB,EAAC,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;QACnH,aAAa,GAAG,SAAS,EAAE,QAAQ,CAAC;QACpC,kCAAkC;QAClC,IAAA,yBAAa,EAAC,aAAa,EAAE,YAAY,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,GAAG,IAAI,UAAU,CAAC,CAAC;IAExE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AAClJ,CAAC","sourcesContent":["import { GenResult } from \"../types/genResult\";\r\nimport { checkCodeSyntax } from \"../analyze/checkCodeSyntax\";\r\nimport { ensureValidLLMResponse } from \"./ensureValidLLMResponse\";\r\nimport { prepareUtAutoFixPrompt, prepareMoreUtAutoFixPrompt } from \"../llm/preparePrompt\";\r\nimport { verifyBuildErrorCausedFile } from \"../utils/verifyBuildErrorCausedFile\";\r\nimport { verifyGeneratedCode } from \"../utils/verifyGeneratedCode\";\r\nimport { removeFailedTestMethods } from \"../utils/removeFailedTestMethods\";\r\nimport { writeGenCode } from \"../utils/writeGenCode\";\r\nimport { writeTestCode, readTestCode } from \"../utils/fileUtils\";\r\nimport { writeFailedVerifyResult } from \"../utils/writeFailedVerifyResult\";\r\nimport { getSourceFileCsprojFilePath } from \"../utils/getCodeStructurePath\";\r\n\r\nexport async function autoFixTestCode(\r\n prompts: any[],\r\n sourceCodePath: string,\r\n sourceCode: string,\r\n dependency: string,\r\n testCode: string,\r\n testProjectPath: string,\r\n testFilePath: string,\r\n testFramework: string,\r\n isXapCode: boolean,\r\n isVsPlugin: boolean,\r\n testFileExist: boolean,\r\n keepFailedTests: boolean,\r\n insertedRanges: [number, number][] = undefined,\r\n retryTimes: number = 3,\r\n isBenchmark: boolean = false,\r\n originalTestLength: number = 0\r\n): Promise<GenResult> {\r\n const startTime = Date.now();\r\n\r\n let generatedCode = testCode;\r\n let testResult;\r\n let buildResult;\r\n let errorMessage;\r\n let isBuildFailure = true;\r\n try {\r\n const sourceCodeProjectPath = getSourceFileCsprojFilePath(sourceCodePath);\r\n for (let i = 0; i <= retryTimes; i++) {\r\n // write generated code, to review and improve code quality\r\n !isVsPlugin && writeGenCode(sourceCodePath, generatedCode, i, sourceCodeProjectPath);\r\n\r\n // for case: generatedCode is invalid, just retry instead of auto fix process\r\n if (!generatedCode) {\r\n console.error(`Generated code is invalid, try to regenerate. \\nGenerated code: \\n${generatedCode}`);\r\n const llmResult = await ensureValidLLMResponse(prompts, testFramework, isXapCode, testFileExist, testFilePath, false, 3, sourceCode);\r\n generatedCode = llmResult?.testCode;\r\n insertedRanges = llmResult?.insertedRanges;\r\n continue;\r\n }\r\n\r\n // analyze generated code issue before verify: build, because build will cost much time.\r\n const syntaxResult = await checkCodeSyntax(testFilePath);\r\n if (syntaxResult.success) {\r\n // if generated code passed the syntax check, verify the generated test code\r\n // const { success, message, buildErrors, vsTestResult } = await verifyTestCode(generatedCode, testProjectPath);\r\n const verifyResult = await verifyGeneratedCode(generatedCode, testProjectPath, testFilePath, isVsPlugin);\r\n errorMessage = verifyResult.message;\r\n testResult = verifyResult.testResult;\r\n buildResult = verifyResult.buildErrors;\r\n isBuildFailure = !testResult;\r\n\r\n if (verifyResult.success) {\r\n // Check if new code length is greater than original test length\r\n const currentCode = readTestCode(testFilePath);\r\n if (originalTestLength > 0 && currentCode && currentCode.length <= originalTestLength) {\r\n console.error(\"Generated code length is not greater than original test code length, treating as failure.\");\r\n } else {\r\n console.log(\"XapUt code generated successfully\");\r\n return { success: true, testFilePath, testProjectPath, codeFilePath: sourceCodePath, buildResult, testResult };\r\n }\r\n }\r\n\r\n console.error(\"Failed to verifyTestCode, error:\", errorMessage);\r\n } else {\r\n buildResult = syntaxResult.buildErrors;\r\n errorMessage = syntaxResult.message;\r\n console.error(\"Failed to check the generated UT code syntax, error:\", errorMessage);\r\n }\r\n\r\n // if errors caused by other code files instead of generate test code, abort generation\r\n const validBuildError = verifyBuildErrorCausedFile(testFilePath, buildResult);\r\n if (!validBuildError) {\r\n console.error(\"Due to errors caused by other code files, abort generation, please fix it first.\");\r\n return { success: false, testFilePath, testProjectPath, codeFilePath: sourceCodePath, buildResult, testResult };\r\n }\r\n\r\n // if errors are caused by original test lines (not inserted lines), abort generation\r\n // Only check on first iteration since insertedRanges becomes stale after code is modified\r\n if (i === 0 && insertedRanges && insertedRanges.length > 0) {\r\n const isErrorInInsertedLines = verifyBuildErrorCausedLines(buildResult, insertedRanges);\r\n if (!isErrorInInsertedLines) {\r\n console.error(\"Errors are caused by original test code lines, not by inserted code. Abort generation.\");\r\n return { success: false, testFilePath, testProjectPath, codeFilePath: sourceCodePath, buildResult, testResult };\r\n }\r\n }\r\n\r\n !isVsPlugin && writeFailedVerifyResult(sourceCodePath, i, sourceCodeProjectPath, errorMessage, !testResult);\r\n // keep test failed tast cases in test file automatically\r\n // if (!isBuildFailure && vsTestRes.passed !== 0) {\r\n // console.log(\"remove failed test cases in test file\");\r\n // removeFailedTestCasesInTestFile(vsTestRes, testCodePath);\r\n // return { success: true, testCode: generatedCode };\r\n // }\r\n\r\n if (i === retryTimes) {\r\n console.log(`Autofix failed after ${retryTimes} attempts, will try to remove failed test methods...`);\r\n break;\r\n }\r\n\r\n // case: vs plugin no response or msbuild/vstest failed.\r\n if (!buildResult && !testResult) {\r\n console.error(\"!!!Verify process failed, retrying...\");\r\n continue;\r\n }\r\n\r\n generatedCode = await generateAutoFixCode(prompts, sourceCodePath, sourceCode, dependency, generatedCode, errorMessage, isBuildFailure, testFilePath, testFramework, isXapCode, testFileExist);\r\n }\r\n\r\n // Try to remove failed test methods and return success if possible (only when keepFailedTests is false)\r\n if (!keepFailedTests) {\r\n const removeResult = await removeFailedTestMethods(generatedCode, testFilePath, testProjectPath, sourceCodePath, buildResult, testResult, isVsPlugin, originalTestLength);\r\n if (removeResult) {\r\n if (removeResult.success) {\r\n // Check if there are still test methods left in the code\r\n const remainingCode = readTestCode(testFilePath);\r\n const hasTestMethods = /\\[(TestMethod|Test|Fact|Theory)\\]/i.test(remainingCode || '');\r\n if (!hasTestMethods) {\r\n console.error(\"No test methods remaining after removing failed tests.\");\r\n return { success: false, testFilePath, testProjectPath, codeFilePath: sourceCodePath, buildResult, testResult };\r\n }\r\n }\r\n console.log(`Remove failed test methods ${removeResult.success ? 'succeeded' : 'failed'}.`);\r\n return removeResult;\r\n }\r\n }\r\n\r\n console.error(\"Failed to generate valid test code after all attempts.\");\r\n return { success: false, testFilePath, testProjectPath, codeFilePath: sourceCodePath, buildResult, testResult };\r\n } catch (error) {\r\n console.error(\"Error during auto-fix process:\", error);\r\n return { success: false, testFilePath, testProjectPath, codeFilePath: sourceCodePath, buildResult: null, testResult: null };\r\n } finally {\r\n console.log(`Autofix time: ${(Date.now() - startTime) / 1000} seconds`);\r\n }\r\n}\r\n\r\n/**\r\n * Verify if build errors are caused by the inserted lines.\r\n * Returns true if all build errors are within the inserted ranges (meaning they are caused by new code).\r\n\r\n * Returns false if any build error is outside the inserted ranges (meaning it's caused by original code).\r\n */\r\nfunction verifyBuildErrorCausedLines(buildResult: any, insertedRanges: [number, number][]): boolean {\r\n if (!buildResult || !buildResult.errors || buildResult.errors.length === 0) {\r\n return true; // No build errors\r\n }\r\n\r\n for (const error of buildResult.errors) {\r\n const errorLine = error.line;\r\n if (!errorLine) continue;\r\n\r\n let isInInsertedRange = false;\r\n for (const [start, end] of insertedRanges) {\r\n if (errorLine >= start && errorLine <= end) {\r\n isInInsertedRange = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!isInInsertedRange) {\r\n // This error is in original code, not in inserted code\r\n console.error(`Build error at line ${errorLine} is in original test code, not in inserted code.`);\r\n return false;\r\n }\r\n }\r\n\r\n return true; // All errors are in inserted ranges\r\n}\r\n\r\n\r\nexport async function generateAutoFixCode(\r\n prompts: any[],\r\n sourceCodePath: string,\r\n sourceCode: string,\r\n dependency: string,\r\n generatedCode: string,\r\n errorMessage: string,\r\n isBuildFailure: boolean,\r\n testFilePath: string,\r\n testFramework: string,\r\n isXapCode: boolean,\r\n testFileExist: boolean\r\n): Promise<string> {\r\n console.log(\"start auto-fix process...\");\r\n const autofixPrompt = testFileExist \r\n ? prepareMoreUtAutoFixPrompt(sourceCode, dependency, generatedCode, errorMessage, isBuildFailure, isXapCode)\r\n : prepareUtAutoFixPrompt(prompts, generatedCode, errorMessage, isBuildFailure);\r\n\r\n // get valid code from LLM response with retry\r\n const llmResult = await ensureValidLLMResponse(autofixPrompt, testFramework, isXapCode, false, testFilePath, true, 3, sourceCode);\r\n const newGeneratedCode = llmResult?.testCode;\r\n\r\n // if generate code is valid, write test code to test project\r\n !!newGeneratedCode && writeTestCode(newGeneratedCode, testFilePath);\r\n\r\n return newGeneratedCode;\r\n}\r\n\r\n\r\n// use for quick dev test\r\nexport async function autoRetryTestCode(\r\n prompts: any[],\r\n sourceCodePath: string,\r\n testCode: string,\r\n testProjectPath: string,\r\n testFilePath: string,\r\n testFramework: string,\r\n isXapCode: boolean,\r\n retryTimes: number = 3\r\n): Promise<GenResult> {\r\n const startTime = Date.now();\r\n\r\n let generatedCode = testCode;\r\n let vsTestRes;\r\n for (let i = 0; i <= retryTimes; i++) {\r\n if (i === retryTimes) {\r\n console.error(`Failed to generate XapUt code after ${retryTimes} attempts.`);\r\n break;\r\n }\r\n\r\n const autofixPrompt = prompts;\r\n // get valid code from LLM response\r\n const llmResult = await ensureValidLLMResponse(autofixPrompt, testFramework, isXapCode, false, testFilePath, true);\r\n generatedCode = llmResult?.testCode;\r\n // write test code to test project\r\n writeTestCode(generatedCode, testFilePath);\r\n }\r\n\r\n console.log(`Autofix time: ${(Date.now() - startTime) / 1000} seconds`);\r\n\r\n return { success: true, testFilePath: testFilePath, testProjectPath, codeFilePath: sourceCodePath, buildResult: null, testResult: vsTestRes };\r\n}"]}
1
+ {"version":3,"file":"autoFix.js","sourceRoot":"","sources":["../../src/gen/autoFix.ts"],"names":[],"mappings":";;AAaA,0CAsIC;AAoCD,kDAiCC;AAID,8CA+BC;AA1PD,gEAA6D;AAC7D,qEAAkE;AAClE,wDAA0F;AAC1F,oFAAiF;AACjF,sEAAmE;AACnE,8EAA2E;AAC3E,kEAAyE;AACzE,wDAAqD;AACrD,kDAAiE;AACjE,8EAA2E;AAC3E,wEAA4E;AAErE,KAAK,UAAU,eAAe,CACjC,OAAc,EACd,cAAsB,EACtB,UAAkB,EAClB,UAAkB,EAClB,QAAgB,EAChB,eAAuB,EACvB,YAAoB,EACpB,aAAqB,EACrB,SAAkB,EAClB,UAAmB,EACnB,aAAsB,EACtB,eAAwB,EACxB,iBAAqC,SAAS,EAC9C,aAAqB,CAAC,EACtB,cAAuB,KAAK,EAC5B,qBAA6B,CAAC;IAE9B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,IAAI,aAAa,GAAG,QAAQ,CAAC;IAC7B,IAAI,UAAU,CAAC;IACf,IAAI,WAAW,CAAC;IAChB,IAAI,YAAY,CAAC;IACjB,IAAI,cAAc,GAAG,IAAI,CAAC;IAC1B,IAAI,CAAC;QACD,MAAM,qBAAqB,GAAG,IAAA,kDAA2B,EAAC,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AAI,UAAU,CAAC,CAAC;IAExE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AAClJ,CAAC","sourcesContent":["import { GenResult } from \"../types/genResult\";\r\nimport { checkCodeSyntax } from \"../analyze/checkCodeSyntax\";\r\nimport { ensureValidLLMResponse } from \"./ensureValidLLMResponse\";\r\nimport { prepareUtAutoFixPrompt, prepareMoreUtAutoFixPrompt } from \"../llm/preparePrompt\";\r\nimport { verifyBuildErrorCausedFile } from \"../utils/verifyBuildErrorCausedFile\";\r\nimport { verifyGeneratedCode } from \"../utils/verifyGeneratedCode\";\r\nimport { removeFailedTestMethods } from \"../utils/removeFailedTestMethods\";\r\nimport { extractErrorTestMethodNames } from \"../utils/moreUTAutoFixUtil\";\r\nimport { writeGenCode } from \"../utils/writeGenCode\";\r\nimport { writeTestCode, readTestCode } from \"../utils/fileUtils\";\r\nimport { writeFailedVerifyResult } from \"../utils/writeFailedVerifyResult\";\r\nimport { getSourceFileCsprojFilePath } from \"../utils/getCodeStructurePath\";\r\n\r\nexport async function autoFixTestCode(\r\n prompts: any[],\r\n sourceCodePath: string,\r\n sourceCode: string,\r\n dependency: string,\r\n testCode: string,\r\n testProjectPath: string,\r\n testFilePath: string,\r\n testFramework: string,\r\n isXapCode: boolean,\r\n isVsPlugin: boolean,\r\n testFileExist: boolean,\r\n keepFailedTests: boolean,\r\n insertedRanges: [number, number][] = undefined,\r\n retryTimes: number = 3,\r\n isBenchmark: boolean = false,\r\n originalTestLength: number = 0\r\n): Promise<GenResult> {\r\n const startTime = Date.now();\r\n\r\n let generatedCode = testCode;\r\n let testResult;\r\n let buildResult;\r\n let errorMessage;\r\n let isBuildFailure = true;\r\n try {\r\n const sourceCodeProjectPath = getSourceFileCsprojFilePath(sourceCodePath);\r\n for (let i = 0; i <= retryTimes; i++) {\r\n // write generated code, to review and improve code quality\r\n !isVsPlugin && writeGenCode(sourceCodePath, generatedCode, i, sourceCodeProjectPath);\r\n\r\n // for case: generatedCode is invalid, just retry instead of auto fix process\r\n if (!generatedCode) {\r\n console.error(`Generated code is invalid, try to regenerate. \\nGenerated code: \\n${generatedCode}`);\r\n const llmResult = await ensureValidLLMResponse(prompts, testFramework, isXapCode, testFileExist, testFilePath, false, 3, sourceCode);\r\n generatedCode = llmResult?.testCode;\r\n insertedRanges = llmResult?.insertedRanges;\r\n continue;\r\n }\r\n\r\n // analyze generated code issue before verify: build, because build will cost much time.\r\n const syntaxResult = await checkCodeSyntax(testFilePath);\r\n if (syntaxResult.success) {\r\n // if generated code passed the syntax check, verify the generated test code\r\n // const { success, message, buildErrors, vsTestResult } = await verifyTestCode(generatedCode, testProjectPath);\r\n const verifyResult = await verifyGeneratedCode(generatedCode, testProjectPath, testFilePath, isVsPlugin);\r\n errorMessage = verifyResult.message;\r\n testResult = verifyResult.testResult;\r\n buildResult = verifyResult.buildErrors;\r\n isBuildFailure = !testResult;\r\n\r\n if (verifyResult.success) {\r\n // Check if new code length is greater than original test length\r\n const currentCode = readTestCode(testFilePath);\r\n if (originalTestLength > 0 && currentCode && currentCode.length <= originalTestLength) {\r\n console.error(\"Generated code length is not greater than original test code length, treating as failure.\");\r\n } else {\r\n console.log(\"XapUt code generated successfully\");\r\n return { success: true, testFilePath, testProjectPath, codeFilePath: sourceCodePath, buildResult, testResult };\r\n }\r\n }\r\n\r\n console.error(\"Failed to verifyTestCode, error:\", errorMessage);\r\n } else {\r\n buildResult = syntaxResult.buildErrors;\r\n errorMessage = syntaxResult.message;\r\n console.error(\"Failed to check the generated UT code syntax, error:\", errorMessage);\r\n }\r\n\r\n // if errors caused by other code files instead of generate test code, abort generation\r\n const validBuildError = verifyBuildErrorCausedFile(testFilePath, buildResult);\r\n if (!validBuildError) {\r\n console.error(\"Due to errors caused by other code files, abort generation, please fix it first.\");\r\n return { success: false, testFilePath, testProjectPath, codeFilePath: sourceCodePath, buildResult, testResult };\r\n }\r\n\r\n // if errors are caused by original test lines (not inserted lines), abort generation\r\n // Only check on first iteration since insertedRanges becomes stale after code is modified\r\n if (i === 0 && insertedRanges && insertedRanges.length > 0) {\r\n const isErrorInInsertedLines = verifyBuildErrorCausedLines(buildResult, insertedRanges);\r\n if (!isErrorInInsertedLines) {\r\n console.error(\"Errors are caused by original test code lines, not by inserted code. Abort generation.\");\r\n return { success: false, testFilePath, testProjectPath, codeFilePath: sourceCodePath, buildResult, testResult };\r\n }\r\n }\r\n\r\n !isVsPlugin && writeFailedVerifyResult(sourceCodePath, i, sourceCodeProjectPath, errorMessage, !testResult);\r\n // keep test failed tast cases in test file automatically\r\n // if (!isBuildFailure && vsTestRes.passed !== 0) {\r\n // console.log(\"remove failed test cases in test file\");\r\n // removeFailedTestCasesInTestFile(vsTestRes, testCodePath);\r\n // return { success: true, testCode: generatedCode };\r\n // }\r\n\r\n if (i === retryTimes) {\r\n console.log(`Autofix failed after ${retryTimes} attempts, will try to remove failed test methods...`);\r\n break;\r\n }\r\n\r\n // case: vs plugin no response or msbuild/vstest failed.\r\n if (!buildResult && !testResult) {\r\n console.error(\"!!!Verify process failed, retrying...\");\r\n continue;\r\n }\r\n\r\n generatedCode = await generateAutoFixCode(prompts, sourceCodePath, sourceCode, dependency, generatedCode, errorMessage, isBuildFailure, testFilePath, testFramework, isXapCode, testFileExist, buildResult, testResult);\r\n }\r\n\r\n // Try to remove failed test methods and return success if possible (only when keepFailedTests is false)\r\n if (!keepFailedTests) {\r\n const removeResult = await removeFailedTestMethods(generatedCode, testFilePath, testProjectPath, sourceCodePath, buildResult, testResult, isVsPlugin, originalTestLength);\r\n if (removeResult) {\r\n if (removeResult.success) {\r\n // Check if there are still test methods left in the code\r\n const remainingCode = readTestCode(testFilePath);\r\n const hasTestMethods = /\\[(TestMethod|Test|Fact|Theory)\\]/i.test(remainingCode || '');\r\n if (!hasTestMethods) {\r\n console.error(\"No test methods remaining after removing failed tests.\");\r\n return { success: false, testFilePath, testProjectPath, codeFilePath: sourceCodePath, buildResult, testResult };\r\n }\r\n }\r\n console.log(`Remove failed test methods ${removeResult.success ? 'succeeded' : 'failed'}.`);\r\n return removeResult;\r\n }\r\n }\r\n\r\n console.error(\"Failed to generate valid test code after all attempts.\");\r\n return { success: false, testFilePath, testProjectPath, codeFilePath: sourceCodePath, buildResult, testResult };\r\n } catch (error) {\r\n console.error(\"Error during auto-fix process:\", error);\r\n return { success: false, testFilePath, testProjectPath, codeFilePath: sourceCodePath, buildResult: null, testResult: null };\r\n } finally {\r\n console.log(`Autofix time: ${(Date.now() - startTime) / 1000} seconds`);\r\n }\r\n}\r\n\r\n/**\r\n * Verify if build errors are caused by the inserted lines.\r\n * Returns true if all build errors are within the inserted ranges (meaning they are caused by new code).\r\n\r\n * Returns false if any build error is outside the inserted ranges (meaning it's caused by original code).\r\n */\r\nfunction verifyBuildErrorCausedLines(buildResult: any, insertedRanges: [number, number][]): boolean {\r\n if (!buildResult || !buildResult.errors || buildResult.errors.length === 0) {\r\n return true; // No build errors\r\n }\r\n\r\n for (const error of buildResult.errors) {\r\n const errorLine = error.line;\r\n if (!errorLine) continue;\r\n\r\n let isInInsertedRange = false;\r\n for (const [start, end] of insertedRanges) {\r\n if (errorLine >= start && errorLine <= end) {\r\n isInInsertedRange = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!isInInsertedRange) {\r\n // This error is in original code, not in inserted code\r\n console.error(`Build error at line ${errorLine} is in original test code, not in inserted code.`);\r\n return false;\r\n }\r\n }\r\n\r\n return true; // All errors are in inserted ranges\r\n}\r\n\r\n\r\nexport async function generateAutoFixCode(\r\n prompts: any[],\r\n sourceCodePath: string,\r\n sourceCode: string,\r\n dependency: string,\r\n generatedCode: string,\r\n errorMessage: string,\r\n isBuildFailure: boolean,\r\n testFilePath: string,\r\n testFramework: string,\r\n isXapCode: boolean,\r\n testFileExist: boolean,\r\n buildResult?: any,\r\n testResult?: any\r\n): Promise<string> {\r\n console.log(\"start auto-fix process...\");\r\n const autofixPrompt = testFileExist \r\n ? prepareMoreUtAutoFixPrompt(sourceCode, dependency, generatedCode, errorMessage, isBuildFailure, isXapCode)\r\n : prepareUtAutoFixPrompt(prompts, generatedCode, errorMessage, isBuildFailure);\r\n\r\n // Extract error test method names for the more UT auto-fix scenario\r\n const errorMethodNames = testFileExist\r\n ? extractErrorTestMethodNames(generatedCode, isBuildFailure, buildResult, testResult)\r\n : undefined;\r\n\r\n // get valid code from LLM response with retry\r\n const llmResult = await ensureValidLLMResponse(autofixPrompt, testFramework, isXapCode, testFileExist, testFilePath, true, 3, sourceCode, errorMethodNames);\r\n const newGeneratedCode = llmResult?.testCode;\r\n\r\n // if generate code is valid, write test code to test project\r\n !!newGeneratedCode && writeTestCode(newGeneratedCode, testFilePath);\r\n\r\n return newGeneratedCode;\r\n}\r\n\r\n\r\n// use for quick dev test\r\nexport async function autoRetryTestCode(\r\n prompts: any[],\r\n sourceCodePath: string,\r\n testCode: string,\r\n testProjectPath: string,\r\n testFilePath: string,\r\n testFramework: string,\r\n isXapCode: boolean,\r\n retryTimes: number = 3\r\n): Promise<GenResult> {\r\n const startTime = Date.now();\r\n\r\n let generatedCode = testCode;\r\n let vsTestRes;\r\n for (let i = 0; i <= retryTimes; i++) {\r\n if (i === retryTimes) {\r\n console.error(`Failed to generate XapUt code after ${retryTimes} attempts.`);\r\n break;\r\n }\r\n\r\n const autofixPrompt = prompts;\r\n // get valid code from LLM response\r\n const llmResult = await ensureValidLLMResponse(autofixPrompt, testFramework, isXapCode, false, testFilePath, true);\r\n generatedCode = llmResult?.testCode;\r\n // write test code to test project\r\n writeTestCode(generatedCode, testFilePath);\r\n }\r\n\r\n console.log(`Autofix time: ${(Date.now() - startTime) / 1000} seconds`);\r\n\r\n return { success: true, testFilePath: testFilePath, testProjectPath, codeFilePath: sourceCodePath, buildResult: null, testResult: vsTestRes };\r\n}"]}
@@ -2,4 +2,4 @@ export interface LLMResponseResult {
2
2
  testCode: string;
3
3
  insertedRanges?: [number, number][];
4
4
  }
5
- export declare function ensureValidLLMResponse(prompt: any[], testFramework: string, isXapCode: boolean, testFileExist: boolean, testFilePath: string, isAutoFix?: boolean, retryTimes?: number, sourceCode?: string): Promise<LLMResponseResult>;
5
+ export declare function ensureValidLLMResponse(prompt: any[], testFramework: string, isXapCode: boolean, isMoreUTScenario: boolean, testFilePath: string, isAutoFix?: boolean, retryTimes?: number, sourceCode?: string, errorMethodNames?: string[]): Promise<LLMResponseResult>;
@@ -3,21 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ensureValidLLMResponse = ensureValidLLMResponse;
4
4
  const postGenProcess_1 = require("./postGen/postGenProcess");
5
5
  const postGenMoreUTProcess_1 = require("./postGen/postGenMoreUTProcess");
6
+ const postGenMoreUTAutofixProcess_1 = require("./postGen/postGenMoreUTAutofixProcess");
6
7
  const sendRequestToLLM_1 = require("../llm/sendRequestToLLM");
7
- async function ensureValidLLMResponse(prompt, testFramework, isXapCode, testFileExist, testFilePath, isAutoFix = false, retryTimes = 3, sourceCode) {
8
+ async function ensureValidLLMResponse(prompt, testFramework, isXapCode, isMoreUTScenario, testFilePath, isAutoFix = false, retryTimes = 3, sourceCode, errorMethodNames) {
8
9
  for (let i = 0; i < retryTimes; i++) {
9
10
  // call LLM service to gen code
10
11
  const { content: generatedCode } = await (0, sendRequestToLLM_1.sendRequestToLLM)(prompt);
11
12
  // extract valid code from LLM response
12
13
  let testCode;
13
14
  let insertedRanges = undefined;
14
- if (testFileExist && !isAutoFix) {
15
+ if (isMoreUTScenario && !isAutoFix) {
15
16
  const result = (0, postGenMoreUTProcess_1.postGenMoreUTProcess)(generatedCode, testFilePath, isXapCode);
16
17
  if (result) {
17
18
  testCode = result.testCode;
18
19
  insertedRanges = result.insertedRanges;
19
20
  }
20
21
  }
22
+ else if (isMoreUTScenario && isAutoFix) {
23
+ testCode = (0, postGenMoreUTAutofixProcess_1.postGenMoreUTAutofixProcess)(generatedCode, testFramework, isXapCode, sourceCode, testFilePath, errorMethodNames);
24
+ }
21
25
  else {
22
26
  testCode = (0, postGenProcess_1.postGenProcess)(generatedCode, testFramework, isXapCode, sourceCode);
23
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ensureValidLLMResponse.js","sourceRoot":"","sources":["../../src/gen/ensureValidLLMResponse.ts"],"names":[],"mappings":";;AASA,wDAwBC;AAjCD,6DAA0D;AAC1D,yEAAsE;AACtE,8DAA2D;AAOpD,KAAK,UAAU,sBAAsB,CAAC,MAAa,EAAE,aAAqB,EAAE,SAAkB,EAAE,aAAsB,EAAE,YAAoB,EAAE,YAAqB,KAAK,EAAE,aAAqB,CAAC,EAAE,UAAmB;IACxN,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,+BAA+B;QAC/B,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,MAAM,IAAA,mCAAgB,EAAC,MAAM,CAAC,CAAC;QAElE,uCAAuC;QACvC,IAAI,QAAgB,CAAC;QACrB,IAAI,cAAc,GAAuB,SAAS,CAAC;QACnD,IAAI,aAAa,IAAI,CAAC,SAAS,EAAE,CAAC;YAC9B,MAAM,MAAM,GAAG,IAAA,2CAAoB,EAAC,aAAa,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;YAC5E,IAAI,MAAM,EAAE,CAAC;gBACT,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;gBAC3B,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;YAC3C,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,QAAQ,GAAG,IAAA,+BAAc,EAAC,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;QACnF,CAAC;QACD,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;YACb,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;QACxC,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,GAAG,CAAC,IAAI,UAAU,GAAG,CAAC,CAAC;IAC5F,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC","sourcesContent":["import { postGenProcess } from \"./postGen/postGenProcess\";\r\nimport { postGenMoreUTProcess } from \"./postGen/postGenMoreUTProcess\";\r\nimport { sendRequestToLLM } from \"../llm/sendRequestToLLM\";\r\n\r\nexport interface LLMResponseResult {\r\n testCode: string;\r\n insertedRanges?: [number, number][];\r\n}\r\n\r\nexport async function ensureValidLLMResponse(prompt: any[], testFramework: string, isXapCode: boolean, testFileExist: boolean, testFilePath: string, isAutoFix: boolean = false, retryTimes: number = 3, sourceCode?: string): Promise<LLMResponseResult> {\r\n for (let i = 0; i < retryTimes; i++) {\r\n // call LLM service to gen code\r\n const { content: generatedCode } = await sendRequestToLLM(prompt);\r\n \r\n // extract valid code from LLM response\r\n let testCode: string;\r\n let insertedRanges: [number, number][] = undefined;\r\n if (testFileExist && !isAutoFix) {\r\n const result = postGenMoreUTProcess(generatedCode, testFilePath, isXapCode);\r\n if (result) {\r\n testCode = result.testCode;\r\n insertedRanges = result.insertedRanges;\r\n }\r\n } else {\r\n testCode = postGenProcess(generatedCode, testFramework, isXapCode, sourceCode);\r\n }\r\n if (!!testCode) {\r\n return { testCode, insertedRanges };\r\n }\r\n console.log(`Failed to generate valid test code, retrying... (${i + 1}/${retryTimes})`);\r\n }\r\n\r\n return undefined;\r\n}"]}
1
+ {"version":3,"file":"ensureValidLLMResponse.js","sourceRoot":"","sources":["../../src/gen/ensureValidLLMResponse.ts"],"names":[],"mappings":";;AAUA,wDA0BC;AApCD,6DAA0D;AAC1D,yEAAsE;AACtE,uFAAoF;AACpF,8DAA2D;AAOpD,KAAK,UAAU,sBAAsB,CAAC,MAAa,EAAE,aAAqB,EAAE,SAAkB,EAAE,gBAAyB,EAAE,YAAoB,EAAE,YAAqB,KAAK,EAAE,aAAqB,CAAC,EAAE,UAAmB,EAAE,gBAA2B;IACxP,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,+BAA+B;QAC/B,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,MAAM,IAAA,mCAAgB,EAAC,MAAM,CAAC,CAAC;QAElE,uCAAuC;QACvC,IAAI,QAAgB,CAAC;QACrB,IAAI,cAAc,GAAuB,SAAS,CAAC;QACnD,IAAI,gBAAgB,IAAI,CAAC,SAAS,EAAE,CAAC;YACjC,MAAM,MAAM,GAAG,IAAA,2CAAoB,EAAC,aAAa,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;YAC5E,IAAI,MAAM,EAAE,CAAC;gBACT,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;gBAC3B,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;YAC3C,CAAC;QACL,CAAC;aAAM,IAAI,gBAAgB,IAAI,SAAS,EAAE,CAAC;YACvC,QAAQ,GAAG,IAAA,yDAA2B,EAAC,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC;QAChI,CAAC;aAAM,CAAC;YACJ,QAAQ,GAAG,IAAA,+BAAc,EAAC,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;QACnF,CAAC;QACD,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;YACb,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;QACxC,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,GAAG,CAAC,IAAI,UAAU,GAAG,CAAC,CAAC;IAC5F,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC","sourcesContent":["import { postGenProcess } from \"./postGen/postGenProcess\";\r\nimport { postGenMoreUTProcess } from \"./postGen/postGenMoreUTProcess\";\r\nimport { postGenMoreUTAutofixProcess } from \"./postGen/postGenMoreUTAutofixProcess\";\r\nimport { sendRequestToLLM } from \"../llm/sendRequestToLLM\";\r\n\r\nexport interface LLMResponseResult {\r\n testCode: string;\r\n insertedRanges?: [number, number][];\r\n}\r\n\r\nexport async function ensureValidLLMResponse(prompt: any[], testFramework: string, isXapCode: boolean, isMoreUTScenario: boolean, testFilePath: string, isAutoFix: boolean = false, retryTimes: number = 3, sourceCode?: string, errorMethodNames?: string[]): Promise<LLMResponseResult> {\r\n for (let i = 0; i < retryTimes; i++) {\r\n // call LLM service to gen code\r\n const { content: generatedCode } = await sendRequestToLLM(prompt);\r\n \r\n // extract valid code from LLM response\r\n let testCode: string;\r\n let insertedRanges: [number, number][] = undefined;\r\n if (isMoreUTScenario && !isAutoFix) {\r\n const result = postGenMoreUTProcess(generatedCode, testFilePath, isXapCode);\r\n if (result) {\r\n testCode = result.testCode;\r\n insertedRanges = result.insertedRanges;\r\n }\r\n } else if (isMoreUTScenario && isAutoFix) {\r\n testCode = postGenMoreUTAutofixProcess(generatedCode, testFramework, isXapCode, sourceCode, testFilePath, errorMethodNames);\r\n } else {\r\n testCode = postGenProcess(generatedCode, testFramework, isXapCode, sourceCode);\r\n }\r\n if (!!testCode) {\r\n return { testCode, insertedRanges };\r\n }\r\n console.log(`Failed to generate valid test code, retrying... (${i + 1}/${retryTimes})`);\r\n }\r\n\r\n return undefined;\r\n}"]}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Post-process LLM response for the "more UT auto-fix" scenario.
3
+ *
4
+ * The LLM is asked to return the **complete** fixed test file, but it sometimes
5
+ * omits unchanged test methods. This function performs a *surgical merge*:
6
+ *
7
+ * 1. Extract & clean the AI code from the markdown response.
8
+ * 2. Replace **only** the error test methods in the original file with the
9
+ * AI-fixed versions.
10
+ * 3. Append any **new** test methods or helper methods that the AI added.
11
+ * 4. Replace the `using` block wholesale with the AI's version.
12
+ * 5. Apply standard namespace / Xap repairs.
13
+ *
14
+ * If `errorMethodNames` is empty or `testFilePath` is unavailable the function
15
+ * falls back to standard `postGenProcess`-style processing.
16
+ */
17
+ export declare function postGenMoreUTAutofixProcess(generatedCode: string, testFramework: string, isXapCode: boolean, sourceCode?: string, testFilePath?: string, errorMethodNames?: string[]): string;