@ai-dev-tools/test-copilot-core 1.0.19
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/README.md +6 -0
- package/azure-pipelines.yml +51 -0
- package/out/cli/commands/appInsightTelemetry.d.ts +7 -0
- package/out/cli/commands/appInsightTelemetry.d.ts.map +1 -0
- package/out/cli/commands/appInsightTelemetry.js +76 -0
- package/out/cli/commands/appInsightTelemetry.js.map +1 -0
- package/out/cli/commands/cliConfig.d.ts +4 -0
- package/out/cli/commands/cliConfig.d.ts.map +1 -0
- package/out/cli/commands/cliConfig.js +68 -0
- package/out/cli/commands/cliConfig.js.map +1 -0
- package/out/cli/commands/prompt.d.ts +6 -0
- package/out/cli/commands/prompt.d.ts.map +1 -0
- package/out/cli/commands/prompt.js +29 -0
- package/out/cli/commands/prompt.js.map +1 -0
- package/out/cli/commands/ut.d.ts +14 -0
- package/out/cli/commands/ut.d.ts.map +1 -0
- package/out/cli/commands/ut.js +72 -0
- package/out/cli/commands/ut.js.map +1 -0
- package/out/cli/commands/utPipeCmdWrapper.d.ts +18 -0
- package/out/cli/commands/utPipeCmdWrapper.d.ts.map +1 -0
- package/out/cli/commands/utPipeCmdWrapper.js +37 -0
- package/out/cli/commands/utPipeCmdWrapper.js.map +1 -0
- package/out/cli/config/index.d.ts +15 -0
- package/out/cli/config/index.d.ts.map +1 -0
- package/out/cli/config/index.js +10 -0
- package/out/cli/config/index.js.map +1 -0
- package/out/cli/index.d.ts +3 -0
- package/out/cli/index.d.ts.map +1 -0
- package/out/cli/index.js +169 -0
- package/out/cli/index.js.map +1 -0
- package/out/cli/type.d.ts +11 -0
- package/out/cli/type.d.ts.map +1 -0
- package/out/cli/type.js +3 -0
- package/out/cli/type.js.map +1 -0
- package/out/cli/utils/ds.d.ts +3 -0
- package/out/cli/utils/ds.d.ts.map +1 -0
- package/out/cli/utils/ds.js +50 -0
- package/out/cli/utils/ds.js.map +1 -0
- package/out/cli/utils/gpt.d.ts +3 -0
- package/out/cli/utils/gpt.d.ts.map +1 -0
- package/out/cli/utils/gpt.js +63 -0
- package/out/cli/utils/gpt.js.map +1 -0
- package/out/core/analyze/cjs.d.ts +61 -0
- package/out/core/analyze/cjs.d.ts.map +1 -0
- package/out/core/analyze/cjs.js +358 -0
- package/out/core/analyze/cjs.js.map +1 -0
- package/out/core/analyze/class.d.ts +4 -0
- package/out/core/analyze/class.d.ts.map +1 -0
- package/out/core/analyze/class.js +32 -0
- package/out/core/analyze/class.js.map +1 -0
- package/out/core/analyze/declares.d.ts +7 -0
- package/out/core/analyze/declares.d.ts.map +1 -0
- package/out/core/analyze/declares.js +316 -0
- package/out/core/analyze/declares.js.map +1 -0
- package/out/core/analyze/deps.d.ts +8 -0
- package/out/core/analyze/deps.d.ts.map +1 -0
- package/out/core/analyze/deps.js +210 -0
- package/out/core/analyze/deps.js.map +1 -0
- package/out/core/analyze/functionComponent.d.ts +4 -0
- package/out/core/analyze/functionComponent.d.ts.map +1 -0
- package/out/core/analyze/functionComponent.js +77 -0
- package/out/core/analyze/functionComponent.js.map +1 -0
- package/out/core/analyze/functions.d.ts +4 -0
- package/out/core/analyze/functions.d.ts.map +1 -0
- package/out/core/analyze/functions.js +46 -0
- package/out/core/analyze/functions.js.map +1 -0
- package/out/core/analyze/index.d.ts +16 -0
- package/out/core/analyze/index.d.ts.map +1 -0
- package/out/core/analyze/index.js +149 -0
- package/out/core/analyze/index.js.map +1 -0
- package/out/core/analyze/index.type.d.ts +69 -0
- package/out/core/analyze/index.type.d.ts.map +1 -0
- package/out/core/analyze/index.type.js +14 -0
- package/out/core/analyze/index.type.js.map +1 -0
- package/out/core/analyze/utils/global.d.ts +2 -0
- package/out/core/analyze/utils/global.d.ts.map +1 -0
- package/out/core/analyze/utils/global.js +84 -0
- package/out/core/analyze/utils/global.js.map +1 -0
- package/out/core/analyzev2/declare/class.d.ts +4 -0
- package/out/core/analyzev2/declare/class.d.ts.map +1 -0
- package/out/core/analyzev2/declare/class.js +24 -0
- package/out/core/analyzev2/declare/class.js.map +1 -0
- package/out/core/analyzev2/declare/funcLike.d.ts +8 -0
- package/out/core/analyzev2/declare/funcLike.d.ts.map +1 -0
- package/out/core/analyzev2/declare/funcLike.js +71 -0
- package/out/core/analyzev2/declare/funcLike.js.map +1 -0
- package/out/core/analyzev2/declare/variable.d.ts +3 -0
- package/out/core/analyzev2/declare/variable.d.ts.map +1 -0
- package/out/core/analyzev2/declare/variable.js +15 -0
- package/out/core/analyzev2/declare/variable.js.map +1 -0
- package/out/core/analyzev2/file.d.ts +19 -0
- package/out/core/analyzev2/file.d.ts.map +1 -0
- package/out/core/analyzev2/file.js +449 -0
- package/out/core/analyzev2/file.js.map +1 -0
- package/out/core/analyzev2/index.d.ts +5 -0
- package/out/core/analyzev2/index.d.ts.map +1 -0
- package/out/core/analyzev2/index.js +30 -0
- package/out/core/analyzev2/index.js.map +1 -0
- package/out/core/analyzev2/type.d.ts +35 -0
- package/out/core/analyzev2/type.d.ts.map +1 -0
- package/out/core/analyzev2/type.js +3 -0
- package/out/core/analyzev2/type.js.map +1 -0
- package/out/core/config/index.d.ts +25 -0
- package/out/core/config/index.d.ts.map +1 -0
- package/out/core/config/index.js +14 -0
- package/out/core/config/index.js.map +1 -0
- package/out/core/constants.d.ts +9 -0
- package/out/core/constants.d.ts.map +1 -0
- package/out/core/constants.js +12 -0
- package/out/core/constants.js.map +1 -0
- package/out/core/features/common/base.d.ts +20 -0
- package/out/core/features/common/base.d.ts.map +1 -0
- package/out/core/features/common/base.js +77 -0
- package/out/core/features/common/base.js.map +1 -0
- package/out/core/features/common/types.d.ts +16 -0
- package/out/core/features/common/types.d.ts.map +1 -0
- package/out/core/features/common/types.js +12 -0
- package/out/core/features/common/types.js.map +1 -0
- package/out/core/features/generateFile.d.ts +31 -0
- package/out/core/features/generateFile.d.ts.map +1 -0
- package/out/core/features/generateFile.js +148 -0
- package/out/core/features/generateFile.js.map +1 -0
- package/out/core/features/generateSingle.d.ts +28 -0
- package/out/core/features/generateSingle.d.ts.map +1 -0
- package/out/core/features/generateSingle.js +149 -0
- package/out/core/features/generateSingle.js.map +1 -0
- package/out/core/features/index.d.ts +9 -0
- package/out/core/features/index.d.ts.map +1 -0
- package/out/core/features/index.js +16 -0
- package/out/core/features/index.js.map +1 -0
- package/out/core/features/lintFix.d.ts +2 -0
- package/out/core/features/lintFix.d.ts.map +1 -0
- package/out/core/features/lintFix.js +33 -0
- package/out/core/features/lintFix.js.map +1 -0
- package/out/core/features/mergeUTFile.d.ts +19 -0
- package/out/core/features/mergeUTFile.d.ts.map +1 -0
- package/out/core/features/mergeUTFile.js +63 -0
- package/out/core/features/mergeUTFile.js.map +1 -0
- package/out/core/features/removeFailedCases.d.ts +23 -0
- package/out/core/features/removeFailedCases.d.ts.map +1 -0
- package/out/core/features/removeFailedCases.js +81 -0
- package/out/core/features/removeFailedCases.js.map +1 -0
- package/out/core/features/updateSpec.d.ts +20 -0
- package/out/core/features/updateSpec.d.ts.map +1 -0
- package/out/core/features/updateSpec.js +98 -0
- package/out/core/features/updateSpec.js.map +1 -0
- package/out/core/features/validFix.d.ts +29 -0
- package/out/core/features/validFix.d.ts.map +1 -0
- package/out/core/features/validFix.js +219 -0
- package/out/core/features/validFix.js.map +1 -0
- package/out/core/generate/UTGen.d.ts +79 -0
- package/out/core/generate/UTGen.d.ts.map +1 -0
- package/out/core/generate/UTGen.js +795 -0
- package/out/core/generate/UTGen.js.map +1 -0
- package/out/core/llm/index.d.ts +9 -0
- package/out/core/llm/index.d.ts.map +1 -0
- package/out/core/llm/index.js +39 -0
- package/out/core/llm/index.js.map +1 -0
- package/out/core/llm/prompts/config.d.ts +6 -0
- package/out/core/llm/prompts/config.d.ts.map +1 -0
- package/out/core/llm/prompts/config.js +239 -0
- package/out/core/llm/prompts/config.js.map +1 -0
- package/out/core/llm/prompts/templates/common.d.ts +3 -0
- package/out/core/llm/prompts/templates/common.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/common.js +27 -0
- package/out/core/llm/prompts/templates/common.js.map +1 -0
- package/out/core/llm/prompts/templates/fixCase.d.ts +4 -0
- package/out/core/llm/prompts/templates/fixCase.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/fixCase.js +46 -0
- package/out/core/llm/prompts/templates/fixCase.js.map +1 -0
- package/out/core/llm/prompts/templates/fixLint.d.ts +3 -0
- package/out/core/llm/prompts/templates/fixLint.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/fixLint.js +22 -0
- package/out/core/llm/prompts/templates/fixLint.js.map +1 -0
- package/out/core/llm/prompts/templates/genClassMemberUT.d.ts +5 -0
- package/out/core/llm/prompts/templates/genClassMemberUT.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/genClassMemberUT.js +115 -0
- package/out/core/llm/prompts/templates/genClassMemberUT.js.map +1 -0
- package/out/core/llm/prompts/templates/genFuncUT.d.ts +4 -0
- package/out/core/llm/prompts/templates/genFuncUT.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/genFuncUT.js +64 -0
- package/out/core/llm/prompts/templates/genFuncUT.js.map +1 -0
- package/out/core/llm/prompts/templates/mergeUT.d.ts +4 -0
- package/out/core/llm/prompts/templates/mergeUT.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/mergeUT.js +106 -0
- package/out/core/llm/prompts/templates/mergeUT.js.map +1 -0
- package/out/core/llm/prompts/templates/msnStudio.d.ts +3 -0
- package/out/core/llm/prompts/templates/msnStudio.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/msnStudio.js +36 -0
- package/out/core/llm/prompts/templates/msnStudio.js.map +1 -0
- package/out/core/llm/prompts/templates/snapshotUT.d.ts +4 -0
- package/out/core/llm/prompts/templates/snapshotUT.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/snapshotUT.js +68 -0
- package/out/core/llm/prompts/templates/snapshotUT.js.map +1 -0
- package/out/core/llm/prompts/templates/updateSpecBlock.d.ts +3 -0
- package/out/core/llm/prompts/templates/updateSpecBlock.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/updateSpecBlock.js +38 -0
- package/out/core/llm/prompts/templates/updateSpecBlock.js.map +1 -0
- package/out/core/llm/prompts/templates/updateSpecFile.d.ts +3 -0
- package/out/core/llm/prompts/templates/updateSpecFile.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/updateSpecFile.js +30 -0
- package/out/core/llm/prompts/templates/updateSpecFile.js.map +1 -0
- package/out/core/llm/types.d.ts +80 -0
- package/out/core/llm/types.d.ts.map +1 -0
- package/out/core/llm/types.js +5 -0
- package/out/core/llm/types.js.map +1 -0
- package/out/core/quality/validateMockedTest.d.ts +3 -0
- package/out/core/quality/validateMockedTest.d.ts.map +1 -0
- package/out/core/quality/validateMockedTest.js +211 -0
- package/out/core/quality/validateMockedTest.js.map +1 -0
- package/out/core/utils/checkTestIgnore.d.ts +4 -0
- package/out/core/utils/checkTestIgnore.d.ts.map +1 -0
- package/out/core/utils/checkTestIgnore.js +52 -0
- package/out/core/utils/checkTestIgnore.js.map +1 -0
- package/out/core/utils/common.d.ts +4 -0
- package/out/core/utils/common.d.ts.map +1 -0
- package/out/core/utils/common.js +34 -0
- package/out/core/utils/common.js.map +1 -0
- package/out/core/utils/console.d.ts +8 -0
- package/out/core/utils/console.d.ts.map +1 -0
- package/out/core/utils/console.js +24 -0
- package/out/core/utils/console.js.map +1 -0
- package/out/core/utils/deps.d.ts +3 -0
- package/out/core/utils/deps.d.ts.map +1 -0
- package/out/core/utils/deps.js +58 -0
- package/out/core/utils/deps.js.map +1 -0
- package/out/core/utils/eslintRuleHandler.d.ts +3 -0
- package/out/core/utils/eslintRuleHandler.d.ts.map +1 -0
- package/out/core/utils/eslintRuleHandler.js +98 -0
- package/out/core/utils/eslintRuleHandler.js.map +1 -0
- package/out/core/utils/file.d.ts +18 -0
- package/out/core/utils/file.d.ts.map +1 -0
- package/out/core/utils/file.js +142 -0
- package/out/core/utils/file.js.map +1 -0
- package/out/core/utils/lint.d.ts +9 -0
- package/out/core/utils/lint.d.ts.map +1 -0
- package/out/core/utils/lint.js +95 -0
- package/out/core/utils/lint.js.map +1 -0
- package/out/core/utils/lru.d.ts +12 -0
- package/out/core/utils/lru.d.ts.map +1 -0
- package/out/core/utils/lru.js +47 -0
- package/out/core/utils/lru.js.map +1 -0
- package/out/core/utils/move.d.ts +12 -0
- package/out/core/utils/move.d.ts.map +1 -0
- package/out/core/utils/move.js +93 -0
- package/out/core/utils/move.js.map +1 -0
- package/out/core/utils/msnStudio.d.ts +13 -0
- package/out/core/utils/msnStudio.d.ts.map +1 -0
- package/out/core/utils/msnStudio.js +150 -0
- package/out/core/utils/msnStudio.js.map +1 -0
- package/out/core/utils/parseCustomizedCmd.d.ts +2 -0
- package/out/core/utils/parseCustomizedCmd.d.ts.map +1 -0
- package/out/core/utils/parseCustomizedCmd.js +32 -0
- package/out/core/utils/parseCustomizedCmd.js.map +1 -0
- package/out/core/utils/specBlock.d.ts +20 -0
- package/out/core/utils/specBlock.d.ts.map +1 -0
- package/out/core/utils/specBlock.js +231 -0
- package/out/core/utils/specBlock.js.map +1 -0
- package/out/core/utils/system.d.ts +13 -0
- package/out/core/utils/system.d.ts.map +1 -0
- package/out/core/utils/system.js +86 -0
- package/out/core/utils/system.js.map +1 -0
- package/out/core/utils/telemetry.d.ts +9 -0
- package/out/core/utils/telemetry.d.ts.map +1 -0
- package/out/core/utils/telemetry.js +32 -0
- package/out/core/utils/telemetry.js.map +1 -0
- package/out/core/utils/tsMorph.d.ts +13 -0
- package/out/core/utils/tsMorph.d.ts.map +1 -0
- package/out/core/utils/tsMorph.js +76 -0
- package/out/core/utils/tsMorph.js.map +1 -0
- package/out/core/valid/customizedLint.d.ts +2 -0
- package/out/core/valid/customizedLint.d.ts.map +1 -0
- package/out/core/valid/customizedLint.js +64 -0
- package/out/core/valid/customizedLint.js.map +1 -0
- package/out/core/valid/customizedTest.d.ts +3 -0
- package/out/core/valid/customizedTest.d.ts.map +1 -0
- package/out/core/valid/customizedTest.js +58 -0
- package/out/core/valid/customizedTest.js.map +1 -0
- package/out/core/valid/extractVitestConfig.d.ts +5 -0
- package/out/core/valid/extractVitestConfig.d.ts.map +1 -0
- package/out/core/valid/extractVitestConfig.js +97 -0
- package/out/core/valid/extractVitestConfig.js.map +1 -0
- package/out/core/valid/getViteConfig.d.ts +2 -0
- package/out/core/valid/getViteConfig.d.ts.map +1 -0
- package/out/core/valid/getViteConfig.js +65 -0
- package/out/core/valid/getViteConfig.js.map +1 -0
- package/out/core/valid/index.d.ts +15 -0
- package/out/core/valid/index.d.ts.map +1 -0
- package/out/core/valid/index.js +99 -0
- package/out/core/valid/index.js.map +1 -0
- package/out/core/valid/jest.d.ts +4 -0
- package/out/core/valid/jest.d.ts.map +1 -0
- package/out/core/valid/jest.js +121 -0
- package/out/core/valid/jest.js.map +1 -0
- package/out/core/valid/mock.d.ts +2 -0
- package/out/core/valid/mock.d.ts.map +1 -0
- package/out/core/valid/mock.js +149 -0
- package/out/core/valid/mock.js.map +1 -0
- package/out/core/valid/remove.d.ts +5 -0
- package/out/core/valid/remove.d.ts.map +1 -0
- package/out/core/valid/remove.js +109 -0
- package/out/core/valid/remove.js.map +1 -0
- package/out/core/valid/tag.d.ts +3 -0
- package/out/core/valid/tag.d.ts.map +1 -0
- package/out/core/valid/tag.js +91 -0
- package/out/core/valid/tag.js.map +1 -0
- package/out/core/valid/type.d.ts +83 -0
- package/out/core/valid/type.d.ts.map +1 -0
- package/out/core/valid/type.js +3 -0
- package/out/core/valid/type.js.map +1 -0
- package/out/core/valid/vitest.d.ts +3 -0
- package/out/core/valid/vitest.d.ts.map +1 -0
- package/out/core/valid/vitest.js +82 -0
- package/out/core/valid/vitest.js.map +1 -0
- package/out/index.d.ts +20 -0
- package/out/index.d.ts.map +1 -0
- package/out/index.js +60 -0
- package/out/index.js.map +1 -0
- package/out/setup.d.ts +11 -0
- package/out/setup.d.ts.map +1 -0
- package/out/setup.js +14 -0
- package/out/setup.js.map +1 -0
- package/out/types.d.ts +23 -0
- package/out/types.d.ts.map +1 -0
- package/out/types.js +3 -0
- package/out/types.js.map +1 -0
- package/package.json +39 -0
- package/package_devops.json +42 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dataConnectorTemplate = exports.reGenClassMemberUT = exports.genClassMemberUT = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
exports.genClassMemberUT = {
|
|
6
|
+
default: [
|
|
7
|
+
{
|
|
8
|
+
prompt: `# You need to write unit tests with ${"<<<TestFramework>>>" /* PromptPlaceholder.TestFramework */} for the class \`${"<<<ClassName>>>" /* PromptPlaceholder.ClassName */}\`'s member \`${"<<<FunctionName>>>" /* PromptPlaceholder.FunctionName */}\` in a new spec file (${"<<<SpecFileName>>>" /* PromptPlaceholder.SpecFileName */}).
|
|
9
|
+
${common_1.baseUTGuidelines}${common_1.classMemberUTGuidelines}
|
|
10
|
+
# Class declaration:
|
|
11
|
+
\`\`\`typescript
|
|
12
|
+
${"<<<ClassDeclare>>>" /* PromptPlaceholder.ClassDeclare */}
|
|
13
|
+
\`\`\`
|
|
14
|
+
# ${"<<<FunctionName>>>" /* PromptPlaceholder.FunctionName */} implementation:
|
|
15
|
+
\`\`\`typescript
|
|
16
|
+
${"<<<SourceCode>>>" /* PromptPlaceholder.SourceCode */}
|
|
17
|
+
\`\`\``
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
prompt: `# MUST return the test code in the format of:
|
|
21
|
+
\`\`\`typescript
|
|
22
|
+
// ${"<<<SpecFileName>>>" /* PromptPlaceholder.SpecFileName */}
|
|
23
|
+
import ${"<<<ClassName>>>" /* PromptPlaceholder.ClassName */} from './${"<<<SourceFileName>>>" /* PromptPlaceholder.SourceFileName */}';
|
|
24
|
+
${"<<<MockCode>>>" /* PromptPlaceholder.MockCode */}
|
|
25
|
+
// Write your test cases here
|
|
26
|
+
\`\`\``,
|
|
27
|
+
conditions: {
|
|
28
|
+
valueExpected: {
|
|
29
|
+
["<<<ModuleType>>>" /* PromptPlaceholder.ModuleType */]: "esm" /* ModuleType.ESM */
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
prompt: `# MUST return the test code in the format of:
|
|
35
|
+
\`\`\`javascript
|
|
36
|
+
// ${"<<<SpecFileName>>>" /* PromptPlaceholder.SpecFileName */}
|
|
37
|
+
const ${"<<<ClassName>>>" /* PromptPlaceholder.ClassName */} = require('./${"<<<SourceFileName>>>" /* PromptPlaceholder.SourceFileName */}');
|
|
38
|
+
${"<<<MockCode>>>" /* PromptPlaceholder.MockCode */}
|
|
39
|
+
// Write your test cases here
|
|
40
|
+
\`\`\``,
|
|
41
|
+
conditions: {
|
|
42
|
+
valueExpected: {
|
|
43
|
+
["<<<ModuleType>>>" /* PromptPlaceholder.ModuleType */]: "cjs" /* ModuleType.CJS */
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
merge: true,
|
|
49
|
+
};
|
|
50
|
+
const reGenDefaultConfig = {
|
|
51
|
+
prompt: `# I have a class \`${"<<<ClassName>>>" /* PromptPlaceholder.ClassName */}\`'s member \`${"<<<FunctionName>>>" /* PromptPlaceholder.FunctionName */}\` in the file ${"<<<SourceCode>>>" /* PromptPlaceholder.SourceCode */}, and now it changed. I need to upgrade the unit test file ${"<<<SpecFileName>>>" /* PromptPlaceholder.SpecFileName */}.
|
|
52
|
+
${common_1.baseUTGuidelines}${common_1.classMemberUTGuidelines}
|
|
53
|
+
# Class declaration:
|
|
54
|
+
\`\`\`${"<<<Language>>>" /* PromptPlaceholder.Language */}
|
|
55
|
+
${"<<<ClassDeclare>>>" /* PromptPlaceholder.ClassDeclare */}
|
|
56
|
+
\`\`\`
|
|
57
|
+
# ${"<<<FunctionName>>>" /* PromptPlaceholder.FunctionName */} implementation:
|
|
58
|
+
\`\`\`${"<<<Language>>>" /* PromptPlaceholder.Language */}
|
|
59
|
+
${"<<<SourceCode>>>" /* PromptPlaceholder.SourceCode */}
|
|
60
|
+
\`\`\`
|
|
61
|
+
# Current spec codes:
|
|
62
|
+
\`\`\`${"<<<Language>>>" /* PromptPlaceholder.Language */}
|
|
63
|
+
${"<<<Spec>>>" /* PromptPlaceholder.SpecCode */}
|
|
64
|
+
\`\`\``
|
|
65
|
+
};
|
|
66
|
+
exports.reGenClassMemberUT = {
|
|
67
|
+
default: [reGenDefaultConfig]
|
|
68
|
+
};
|
|
69
|
+
const dataConnectorTemplate = (className, functionName) => `
|
|
70
|
+
import { Store, createStore } from "redux";
|
|
71
|
+
|
|
72
|
+
import { DynamicReducer } from "@msnews/experiences-dynamic-reducer";
|
|
73
|
+
import { RequestContext } from "@msnews/core";
|
|
74
|
+
|
|
75
|
+
const requestContext = new RequestContext({
|
|
76
|
+
spec: {
|
|
77
|
+
ver: "0.1.0",
|
|
78
|
+
spec: {}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
// Write mock statements here if needed
|
|
82
|
+
|
|
83
|
+
describe("${className}", (): void => {
|
|
84
|
+
// Write other setup here if needed
|
|
85
|
+
|
|
86
|
+
describe("${functionName}", () => {
|
|
87
|
+
it("should test ${functionName}", () => {
|
|
88
|
+
// All the ${className} instance should setup like this:
|
|
89
|
+
const rootReducer = new DynamicReducer();
|
|
90
|
+
jest.spyOn(rootReducer, "connector").mockImplementation((name: string) => {
|
|
91
|
+
// add mock data-connector here, so "this.rootReducer.getConnector(name)" will return the mock data-connector
|
|
92
|
+
});
|
|
93
|
+
const rootStore = createStore(rootReducer.reduce);
|
|
94
|
+
const connector = new ${className}(
|
|
95
|
+
"${className}",
|
|
96
|
+
"",
|
|
97
|
+
rootReducer,
|
|
98
|
+
new DynamicReducer(),
|
|
99
|
+
rootStore,
|
|
100
|
+
{
|
|
101
|
+
slots: {},
|
|
102
|
+
// fill the configs here if needed, the type is ${className.replace('Connector', 'Config')}
|
|
103
|
+
} as any,
|
|
104
|
+
requestContext
|
|
105
|
+
);
|
|
106
|
+
// End of setup
|
|
107
|
+
|
|
108
|
+
// Write test cases here
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// Write ther test cases if needed
|
|
112
|
+
});
|
|
113
|
+
});`;
|
|
114
|
+
exports.dataConnectorTemplate = dataConnectorTemplate;
|
|
115
|
+
//# sourceMappingURL=genClassMemberUT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genClassMemberUT.js","sourceRoot":"","sources":["../../../../../src/core/llm/prompts/templates/genClassMemberUT.ts"],"names":[],"mappings":";;;AAEA,qCAAqE;AAGxD,QAAA,gBAAgB,GAAiB;IAC1C,OAAO,EAAE;QACL;YACI,MAAM,EAAE,uCAAuC,2DAA+B,oBAAoB,mDAA2B,iBAAiB,yDAA8B,0BAA0B,yDAA8B;EAC9O,yBAAgB,GAAG,gCAAuB;;;EAG1C,yDAA8B;;IAE5B,yDAA8B;;EAEhC,qDAA4B;OACvB;SACE;QACD;YACI,MAAM,EAAE;;KAEf,yDAA8B;SAC1B,mDAA2B,YAAY,6DAAgC;EAC9E,iDAA0B;;OAErB;YACK,UAAU,EAAE;gBACR,aAAa,EAAE;oBACX,uDAA8B,4BAAgB;iBACjD;aACJ;SACJ;QACD;YACI,MAAM,EAAE;;KAEf,yDAA8B;QAC3B,mDAA2B,iBAAiB,6DAAgC;EAClF,iDAA0B;;OAErB;YACK,UAAU,EAAE;gBACR,aAAa,EAAE;oBACX,uDAA8B,4BAAgB;iBACjD;aACJ;SACJ;KACJ;IACD,KAAK,EAAE,IAAI;CACd,CAAC;AAEF,MAAM,kBAAkB,GAAqB;IACzC,MAAM,EAAE,sBAAsB,mDAA2B,iBAAiB,yDAA8B,kBAAkB,qDAA4B,8DAA8D,yDAA8B;EACpP,yBAAgB,GAAG,gCAAuB;;QAEpC,iDAA0B;EAChC,yDAA8B;;IAE5B,yDAA8B;QAC1B,iDAA0B;EAChC,qDAA4B;;;QAGtB,iDAA0B;EAChC,6CAA0B;OACrB;CACN,CAAC;AAEW,QAAA,kBAAkB,GAAiB;IAC5C,OAAO,EAAE,CAAC,kBAAkB,CAAC;CAChC,CAAC;AAEK,MAAM,qBAAqB,GAAG,CAAC,SAAiB,EAAE,YAAoB,EAAE,EAAE,CAAC;;;;;;;;;;;;;;YActE,SAAS;;;gBAGL,YAAY;0BACF,YAAY;yBACb,SAAS;;;;;;oCAME,SAAS;mBAC1B,SAAS;;;;;;;sEAO0C,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC;;;;;;;;;;;IAW1G,CAAC;AA5CQ,QAAA,qBAAqB,yBA4C7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genFuncUT.d.ts","sourceRoot":"","sources":["../../../../../src/core/llm/prompts/templates/genFuncUT.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAK9D,eAAO,MAAM,SAAS,EAAE,YAwCvB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,YAiBzB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reGenFuncUT = exports.genFuncUT = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
exports.genFuncUT = {
|
|
6
|
+
default: [
|
|
7
|
+
{
|
|
8
|
+
prompt: `# You need to write unit tests with ${"<<<TestFramework>>>" /* PromptPlaceholder.TestFramework */} for the function or function component \`${"<<<FunctionName>>>" /* PromptPlaceholder.FunctionName */}\` in a new spec file (${"<<<SpecFileName>>>" /* PromptPlaceholder.SpecFileName */}).
|
|
9
|
+
${common_1.baseUTGuidelines}
|
|
10
|
+
# Source codes:
|
|
11
|
+
\`\`\`typescript
|
|
12
|
+
${"<<<SourceCode>>>" /* PromptPlaceholder.SourceCode */}
|
|
13
|
+
\`\`\``
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
prompt: `# Result format:
|
|
17
|
+
\`\`\`typescript
|
|
18
|
+
// ${"<<<SpecFileName>>>" /* PromptPlaceholder.SpecFileName */}
|
|
19
|
+
import ${"<<<FunctionName>>>" /* PromptPlaceholder.FunctionName */} from './${"<<<SourceFileName>>>" /* PromptPlaceholder.SourceFileName */}';
|
|
20
|
+
${"<<<MockCode>>>" /* PromptPlaceholder.MockCode */}
|
|
21
|
+
// Write your test cases here
|
|
22
|
+
\`\`\``,
|
|
23
|
+
conditions: {
|
|
24
|
+
valueExpected: {
|
|
25
|
+
["<<<ModuleType>>>" /* PromptPlaceholder.ModuleType */]: "esm" /* ModuleType.ESM */
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
prompt: `# Result format:
|
|
31
|
+
\`\`\`javascript
|
|
32
|
+
// ${"<<<SpecFileName>>>" /* PromptPlaceholder.SpecFileName */}
|
|
33
|
+
const ${"<<<FunctionName>>>" /* PromptPlaceholder.FunctionName */} = require('./${"<<<SourceFileName>>>" /* PromptPlaceholder.SourceFileName */}');
|
|
34
|
+
${"<<<MockCode>>>" /* PromptPlaceholder.MockCode */}
|
|
35
|
+
// Write your test cases here
|
|
36
|
+
\`\`\``,
|
|
37
|
+
conditions: {
|
|
38
|
+
valueExpected: {
|
|
39
|
+
["<<<ModuleType>>>" /* PromptPlaceholder.ModuleType */]: "cjs" /* ModuleType.CJS */
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
merge: true
|
|
45
|
+
};
|
|
46
|
+
exports.reGenFuncUT = {
|
|
47
|
+
default: [
|
|
48
|
+
{
|
|
49
|
+
prompt: `# I have a function \`${"<<<FunctionName>>>" /* PromptPlaceholder.FunctionName */}\` in the file ${"<<<SourceFileName>>>" /* PromptPlaceholder.SourceFileName */}, and now it changed.
|
|
50
|
+
I need to upgrade the unit test file ${"<<<SpecFileName>>>" /* PromptPlaceholder.SpecFileName */}.
|
|
51
|
+
${common_1.baseUTGuidelines}
|
|
52
|
+
# Source codes:
|
|
53
|
+
\`\`\`${"<<<Language>>>" /* PromptPlaceholder.Language */}
|
|
54
|
+
${"<<<SourceCode>>>" /* PromptPlaceholder.SourceCode */}
|
|
55
|
+
\`\`\`
|
|
56
|
+
# Current spec codes:
|
|
57
|
+
\`\`\`${"<<<Language>>>" /* PromptPlaceholder.Language */}
|
|
58
|
+
${"<<<Spec>>>" /* PromptPlaceholder.SpecCode */}
|
|
59
|
+
\`\`\`
|
|
60
|
+
`
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=genFuncUT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genFuncUT.js","sourceRoot":"","sources":["../../../../../src/core/llm/prompts/templates/genFuncUT.ts"],"names":[],"mappings":";;;AAGA,qCAA4C;AAE/B,QAAA,SAAS,GAAiB;IACnC,OAAO,EAAE;QACL;YACI,MAAM,EAAE,uCAAuC,2DAA+B,6CAA6C,yDAA8B,0BAA0B,yDAA8B;EAC3N,yBAAgB;;;EAGhB,qDAA4B;OACvB;SACE;QACD;YACI,MAAM,EAAE;;KAEf,yDAA8B;SAC1B,yDAA8B,YAAY,6DAAgC;EACjF,iDAA0B;;OAErB;YACK,UAAU,EAAE;gBACR,aAAa,EAAE;oBACX,uDAA8B,4BAAgB;iBACjD;aACJ;SACJ;QACD;YACI,MAAM,EAAE;;KAEf,yDAA8B;QAC3B,yDAA8B,iBAAiB,6DAAgC;EACrF,iDAA0B;;OAErB;YACK,UAAU,EAAE;gBACR,aAAa,EAAE;oBACX,uDAA8B,4BAAgB;iBACjD;aACJ;SACJ;KACJ;IACD,KAAK,EAAE,IAAI;CACd,CAAC;AAEW,QAAA,WAAW,GAAiB;IACrC,OAAO,EAAE;QACL;YACI,MAAM,EAAE,yBAAyB,yDAA8B,kBAAkB,6DAAgC;uCACtF,yDAA8B;EACnE,yBAAgB;;QAEV,iDAA0B;EAChC,qDAA4B;;;QAGtB,iDAA0B;EAChC,6CAA0B;;CAE3B;SACQ;KACJ;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeUT.d.ts","sourceRoot":"","sources":["../../../../../src/core/llm/prompts/templates/mergeUT.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAE9D,eAAO,MAAM,WAAW,EAAE,YAmDzB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,YAiD1B,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeUTAgent = exports.mergeUTFile = void 0;
|
|
4
|
+
exports.mergeUTFile = {
|
|
5
|
+
default: [
|
|
6
|
+
{
|
|
7
|
+
prompt: `I have a source file \`${"<<<SourceFileName>>>" /* PromptPlaceholder.SourceFileName */}\` and two spec files:
|
|
8
|
+
- \`${"<<<SpecFileName>>>" /* PromptPlaceholder.SpecFileName */}\`
|
|
9
|
+
- \`${"<<<TargetFilePath>>>" /* PromptPlaceholder.TargetFilePath */}\`
|
|
10
|
+
|
|
11
|
+
Merge \`${"<<<SpecFileName>>>" /* PromptPlaceholder.SpecFileName */}\` into \`${"<<<TargetFilePath>>>" /* PromptPlaceholder.TargetFilePath */}\`, preserving all tests and resolving conflicts clearly.
|
|
12
|
+
|
|
13
|
+
Return only the merged file content within a single code block marked as \`\`\`typescript\`\`\`. Do not include explanations, file paths, metadata, or additional text.
|
|
14
|
+
|
|
15
|
+
Use ${"<<<TestFramework>>>" /* PromptPlaceholder.TestFramework */} as the test framework. Ensure the merged file is valid TypeScript and follows the framework's conventions.
|
|
16
|
+
|
|
17
|
+
# Guidelines:
|
|
18
|
+
1. **Imports**:
|
|
19
|
+
- Gather imports from both files.
|
|
20
|
+
- Remove duplicates and sort alphabetically at the top of the merged file.
|
|
21
|
+
|
|
22
|
+
2. **Mocks/Stubs**:
|
|
23
|
+
- Place mocks/stubs clearly within their relevant \`describe\` blocks.
|
|
24
|
+
- If a mock/stub is used across multiple describes, place it globally at the top, directly below imports.
|
|
25
|
+
|
|
26
|
+
3. **Describes/Context Blocks**:
|
|
27
|
+
- Merge blocks (\`describe\`, \`context\`, etc.) with identical titles by sequentially combining their contents.
|
|
28
|
+
- Preserve separate blocks with unique titles without modification.
|
|
29
|
+
- Maintain the original order from the target file; append new blocks from the source file afterward.
|
|
30
|
+
|
|
31
|
+
4. **Setup/Teardown Hooks** (\`beforeEach\`, \`afterEach\`, \`beforeAll\`, \`afterAll\`, or equivalent):
|
|
32
|
+
- When identical hooks exist in the same scope, sequentially combine their bodies, starting with the target file hook content, then source file hook content.
|
|
33
|
+
- Explicitly retain all hook statements without deduplication.
|
|
34
|
+
|
|
35
|
+
5. **Tests (\`it\`, \`test\`, etc.)**:
|
|
36
|
+
- Preserve all original test cases unchanged.
|
|
37
|
+
- Keep the \`@aiContributed-@{date}\` tag if it exists.
|
|
38
|
+
- Maintain tests within their original blocks after merging.
|
|
39
|
+
|
|
40
|
+
Do not alter or optimize test logic; preserve exact original behavior.
|
|
41
|
+
|
|
42
|
+
# Files
|
|
43
|
+
|
|
44
|
+
## ${"<<<SpecFileName>>>" /* PromptPlaceholder.SpecFileName */}
|
|
45
|
+
\`\`\`ts
|
|
46
|
+
${"<<<Spec>>>" /* PromptPlaceholder.SpecCode */}
|
|
47
|
+
\`\`\`
|
|
48
|
+
|
|
49
|
+
## ${"<<<TargetFilePath>>>" /* PromptPlaceholder.TargetFilePath */}
|
|
50
|
+
\`\`\`ts
|
|
51
|
+
${"<<<SpecTemplate>>>" /* PromptPlaceholder.SpecTemplate */}
|
|
52
|
+
\`\`\``
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
};
|
|
56
|
+
exports.mergeUTAgent = {
|
|
57
|
+
default: [
|
|
58
|
+
{
|
|
59
|
+
prompt: `# Action Required: Merge and Cleanup Separated Unit Test Files
|
|
60
|
+
|
|
61
|
+
## Task
|
|
62
|
+
Merge multiple separated TypeScript unit test files into a single comprehensive test file. The comprehensive test file may or may not exist; if it does not exist, create it.
|
|
63
|
+
|
|
64
|
+
## Files
|
|
65
|
+
### Merged Test File (Target):
|
|
66
|
+
${"<<<TargetFilePath>>>" /* PromptPlaceholder.TargetFilePath */}
|
|
67
|
+
|
|
68
|
+
### Separated Test Files (Sources to Merge):
|
|
69
|
+
${"<<<FilePathList>>>" /* PromptPlaceholder.FilePathList */}
|
|
70
|
+
|
|
71
|
+
## Instructions
|
|
72
|
+
Perform these steps strictly in order:
|
|
73
|
+
|
|
74
|
+
1. **Ensure Target File Exists**
|
|
75
|
+
- If the merged test file at \`${"<<<TargetFilePath>>>" /* PromptPlaceholder.TargetFilePath */}\` does not exist, create it first as an empty valid test file suitable for the framework \`${"<<<TestFramework>>>" /* PromptPlaceholder.TestFramework */}\`.
|
|
76
|
+
|
|
77
|
+
2. **Merge Test Cases**
|
|
78
|
+
- Append all tests from each separated test file listed above into the merged test file.
|
|
79
|
+
- Move module mocks inside corresponding \`describe\` blocks to prevent conflicts.
|
|
80
|
+
- Clearly resolve naming conflicts and duplication.
|
|
81
|
+
|
|
82
|
+
3. **Cleanup Merged File**
|
|
83
|
+
- Remove duplicate imports, redundant mocks, or unnecessary code.
|
|
84
|
+
- Ensure the merged test file is clean, readable, and correctly formatted.
|
|
85
|
+
|
|
86
|
+
4. **Validation**
|
|
87
|
+
- Run the merged test file using the testing framework \`${"<<<TestFramework>>>" /* PromptPlaceholder.TestFramework */}\`.
|
|
88
|
+
- Confirm that all tests pass without errors.
|
|
89
|
+
- **Do NOT proceed** if any tests fail.
|
|
90
|
+
|
|
91
|
+
5. **Delete Separated Files**
|
|
92
|
+
- Only after successful validation, delete all separated test files listed above.
|
|
93
|
+
|
|
94
|
+
## Safety Measures
|
|
95
|
+
- Keep the \`@aiContributed-@{date}\` tag before the test cases (if it exists).
|
|
96
|
+
- Do **NOT** delete any source files if merging or validation fails.
|
|
97
|
+
- Do **NOT** overwrite or delete unrelated files.
|
|
98
|
+
- Do **NOT** return or output any file contents or logs.
|
|
99
|
+
|
|
100
|
+
## Execution Note
|
|
101
|
+
Perform these actions silently and accurately, adhering strictly to these instructions.`
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
merge: true
|
|
105
|
+
};
|
|
106
|
+
//# sourceMappingURL=mergeUT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeUT.js","sourceRoot":"","sources":["../../../../../src/core/llm/prompts/templates/mergeUT.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAiB;IACrC,OAAO,EAAE;QACL;YACI,MAAM,EAAE,0BAA0B,6DAAgC;MACxE,yDAA8B;MAC9B,6DAAgC;;UAE5B,yDAA8B,aAAa,6DAAgC;;;;MAI/E,2DAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6BhC,yDAA8B;;EAEjC,6CAA0B;;;KAGvB,6DAAgC;;EAEnC,yDAA8B;OACzB;SACE;KACJ;CACJ,CAAC;AAEW,QAAA,YAAY,GAAiB;IACtC,OAAO,EAAE;QACL;YACI,MAAM,EAAE;;;;;;;EAOlB,6DAAgC;;;EAGhC,yDAA8B;;;;;;oCAMI,6DAAgC,+FAA+F,2DAA+B;;;;;;;;;;;;8DAYpI,2DAA+B;;;;;;;;;;;;;;wFAcL;SAC/E;KACJ;IACD,KAAK,EAAE,IAAI;CACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msnStudio.d.ts","sourceRoot":"","sources":["../../../../../src/core/llm/prompts/templates/msnStudio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAE9D,eAAO,MAAM,wBAAwB,EAAE,YA+BtC,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fillMsnStudioDocVariants = void 0;
|
|
4
|
+
exports.fillMsnStudioDocVariants = {
|
|
5
|
+
default: [
|
|
6
|
+
{
|
|
7
|
+
prompt: `I Created documentation file for the package "${"<<<PackageName>>>" /* PromptPlaceholder.PackageName */}".
|
|
8
|
+
|
|
9
|
+
# Task
|
|
10
|
+
Please fill the mock data in the variants section.
|
|
11
|
+
|
|
12
|
+
# Package folder path
|
|
13
|
+
${"<<<PackagePath>>>" /* PromptPlaceholder.PackagePath */}
|
|
14
|
+
|
|
15
|
+
# Documentation File Path
|
|
16
|
+
${"<<<TargetFilePath>>>" /* PromptPlaceholder.TargetFilePath */}
|
|
17
|
+
|
|
18
|
+
# Guidelines
|
|
19
|
+
- MUST make sure the type of the component props is correct.
|
|
20
|
+
- Do not have any TypeScript errors in the doc file.
|
|
21
|
+
- Separate the common mock data into a separate file and import them in the doc.
|
|
22
|
+
- The variant name must be meaningful and describe the scenario.
|
|
23
|
+
|
|
24
|
+
# If you need to create a new file for the mock data, please save it to the following path:
|
|
25
|
+
\`experiences/msn-studio/src/data/\``
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
prompt: `# Reference Files for create mock data\n${"<<<FilePathList>>>" /* PromptPlaceholder.FilePathList */}`,
|
|
29
|
+
conditions: {
|
|
30
|
+
valueRequired: ["<<<FilePathList>>>" /* PromptPlaceholder.FilePathList */],
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
merge: true
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=msnStudio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msnStudio.js","sourceRoot":"","sources":["../../../../../src/core/llm/prompts/templates/msnStudio.ts"],"names":[],"mappings":";;;AAEa,QAAA,wBAAwB,GAAiB;IAClD,OAAO,EAAE;QACL;YACI,MAAM,EAAE,iDAAiD,uDAA6B;;;;;;EAMhG,uDAA6B;;;EAG7B,6DAAgC;;;;;;;;;qCASG;SAC5B;QACD;YACI,MAAM,EAAE,2CAA2C,yDAA8B,EAAE;YACnF,UAAU,EAAE;gBACR,aAAa,EAAE,2DAAgC;aAClD;SACJ;KACJ;IACD,KAAK,EAAE,IAAI;CACd,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshotUT.d.ts","sourceRoot":"","sources":["../../../../../src/core/llm/prompts/templates/snapshotUT.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAE9D,eAAO,MAAM,wBAAwB,EAAE,YA+BtC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,YA+BrC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.snapshotUTAgentForReact = exports.snapshotUTAgentForFastWC = void 0;
|
|
4
|
+
exports.snapshotUTAgentForFastWC = {
|
|
5
|
+
default: [
|
|
6
|
+
{
|
|
7
|
+
prompt: `# You are an assistant that generates and runs Jest snapshot tests for FAST web components.
|
|
8
|
+
|
|
9
|
+
# Inputs:
|
|
10
|
+
- Target component file path: ${"<<<SourceFileName>>>" /* PromptPlaceholder.SourceFileName */}
|
|
11
|
+
- Package.json file path: ${"<<<PackageJsonPath>>>" /* PromptPlaceholder.PackageJsonPath */}
|
|
12
|
+
- Test file specifier: ${"<<<TestFileSpecifier>>>" /* PromptPlaceholder.TestFileSpecifier */}
|
|
13
|
+
|
|
14
|
+
# Steps:
|
|
15
|
+
1. Before generating a new test file, check if a snapshot test file already exists in the same directory:
|
|
16
|
+
- If it exists, skip generation and go directly to the snapshot update step.
|
|
17
|
+
2. Analyze the component at the given file path.
|
|
18
|
+
3. Generate a Jest snapshot test file that:
|
|
19
|
+
- Properly imports the component so it is defined.
|
|
20
|
+
- Uses @testing-library/dom and @microsoft/fast-element's Updates.next() to wait for rendering.
|
|
21
|
+
- Contains at least two tests:
|
|
22
|
+
a) Default render snapshot
|
|
23
|
+
b) Attribute/property change snapshot
|
|
24
|
+
- Uses a helper function to snapshot the shadowRoot (not outerHTML).
|
|
25
|
+
- Outputs clean, well-formatted TypeScript code. Use // comments only where strictly necessary.
|
|
26
|
+
4. Save the generated test file in the same directory as the component:
|
|
27
|
+
- File name must follow the pattern: ComponentName.${"<<<TestFileSpecifier>>>" /* PromptPlaceholder.TestFileSpecifier */}.ts or ComponentName.${"<<<TestFileSpecifier>>>" /* PromptPlaceholder.TestFileSpecifier */}.tsx
|
|
28
|
+
- Match the extension (.ts / .tsx) with the target component's extension.
|
|
29
|
+
5. After the test file is generated, determine the snapshot update command and run it strictly in the directory where ${"<<<PackageJsonPath>>>" /* PromptPlaceholder.PackageJsonPath */} is located:
|
|
30
|
+
- Run \`npx jest -u <newly_generated_test_file_path>\`.
|
|
31
|
+
6. Output only the full test file code (if newly generated), followed by confirmation of which command was executed.`
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
merge: true
|
|
35
|
+
};
|
|
36
|
+
exports.snapshotUTAgentForReact = {
|
|
37
|
+
default: [
|
|
38
|
+
{
|
|
39
|
+
prompt: `# You are an assistant that generates and runs Jest snapshot tests for React components.
|
|
40
|
+
|
|
41
|
+
# Inputs:
|
|
42
|
+
- Target component file path: ${"<<<SourceFileName>>>" /* PromptPlaceholder.SourceFileName */}
|
|
43
|
+
- Package.json file path: ${"<<<PackageJsonPath>>>" /* PromptPlaceholder.PackageJsonPath */}
|
|
44
|
+
- Test file specifier: ${"<<<TestFileSpecifier>>>" /* PromptPlaceholder.TestFileSpecifier */}
|
|
45
|
+
|
|
46
|
+
# Steps:
|
|
47
|
+
1. Before generating a new test file, check if a snapshot test file already exists in the same directory:
|
|
48
|
+
- If it exists, skip generation and go directly to the snapshot update step.
|
|
49
|
+
2. Analyze the React component at the given file path.
|
|
50
|
+
3. Generate a Jest snapshot test file that:
|
|
51
|
+
- Properly imports the component.
|
|
52
|
+
- Uses @testing-library/react's render method.
|
|
53
|
+
- Contains at least two tests:
|
|
54
|
+
a) Default render snapshot
|
|
55
|
+
b) Prop change snapshot
|
|
56
|
+
- Uses asFragment() from the render result to create the snapshot.
|
|
57
|
+
- Outputs clean, well-formatted TypeScript code. Use // comments only where strictly necessary.
|
|
58
|
+
4. Save the generated test file in the same directory as the component:
|
|
59
|
+
- File name must follow the pattern: ComponentName.${"<<<TestFileSpecifier>>>" /* PromptPlaceholder.TestFileSpecifier */}.ts or ComponentName.${"<<<TestFileSpecifier>>>" /* PromptPlaceholder.TestFileSpecifier */}.tsx
|
|
60
|
+
- Match the extension (.ts / .tsx) with the target component's extension.
|
|
61
|
+
5. After the test file is generated, determine the snapshot update command and run it strictly in the directory where ${"<<<PackageJsonPath>>>" /* PromptPlaceholder.PackageJsonPath */} is located:
|
|
62
|
+
- Run \`npx jest -u <newly_generated_test_file_path>\`.
|
|
63
|
+
6. Output only the full test file code (if newly generated), followed by confirmation of which command was executed.`
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
merge: true
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=snapshotUT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshotUT.js","sourceRoot":"","sources":["../../../../../src/core/llm/prompts/templates/snapshotUT.ts"],"names":[],"mappings":";;;AAEa,QAAA,wBAAwB,GAAiB;IAClD,OAAO,EAAE;QACL;YACI,MAAM,EAAE;;;gCAGY,6DAAgC;4BACpC,+DAAiC;yBACpC,mEAAmC;;;;;;;;;;;;;;;wDAeJ,mEAAmC,wBAAwB,mEAAmC;;wHAE9B,+DAAiC;;qHAEpC;SAC5G;KACJ;IACD,KAAK,EAAE,IAAI;CACd,CAAC;AAEW,QAAA,uBAAuB,GAAiB;IACjD,OAAO,EAAE;QACL;YACI,MAAM,EAAE;;;gCAGY,6DAAgC;4BACpC,+DAAiC;yBACpC,mEAAmC;;;;;;;;;;;;;;;wDAeJ,mEAAmC,wBAAwB,mEAAmC;;wHAE9B,+DAAiC;;qHAEpC;SAC5G;KACJ;IACD,KAAK,EAAE,IAAI;CACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateSpecBlock.d.ts","sourceRoot":"","sources":["../../../../../src/core/llm/prompts/templates/updateSpecBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAE9D,eAAO,MAAM,eAAe,EAAE,YAiC7B,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateSpecBlock = void 0;
|
|
4
|
+
exports.updateSpecBlock = {
|
|
5
|
+
default: [
|
|
6
|
+
{
|
|
7
|
+
prompt: `# Source code (./${"<<<SourceFileName>>>" /* PromptPlaceholder.SourceFileName */}):
|
|
8
|
+
\`\`\`${"<<<Language>>>" /* PromptPlaceholder.Language */}
|
|
9
|
+
${"<<<SourceCode>>>" /* PromptPlaceholder.SourceCode */}
|
|
10
|
+
\`\`\``
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
prompt: `# Target spec block in the spec file \`${"<<<SpecFileName>>>" /* PromptPlaceholder.SpecFileName */}\`:
|
|
14
|
+
\`\`\`${"<<<Language>>>" /* PromptPlaceholder.Language */}
|
|
15
|
+
${"<<<Spec>>>" /* PromptPlaceholder.SpecCode */}
|
|
16
|
+
\`\`\``
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
prompt: `# Import statements, mock statements, and lifecycles in the spec file \`${"<<<SpecFileName>>>" /* PromptPlaceholder.SpecFileName */}\`:
|
|
20
|
+
\`\`\`${"<<<Language>>>" /* PromptPlaceholder.Language */}
|
|
21
|
+
${"<<<CodeExtInfo>>>" /* PromptPlaceholder.CodeExtInfo */}
|
|
22
|
+
\`\`\``,
|
|
23
|
+
conditions: {
|
|
24
|
+
maxLength: 10000,
|
|
25
|
+
valueRequired: ["<<<CodeExtInfo>>>" /* PromptPlaceholder.CodeExtInfo */]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
prompt: `# Please fix the target spec block to increase the line coverage or fix the test code.
|
|
30
|
+
# Guidelines:
|
|
31
|
+
- If no need to update, please return \`NO_NEED_TO_CHANGE\` in a code block.
|
|
32
|
+
- Keep the existing JS Doc before the test case if any.
|
|
33
|
+
- DO NOT change anything outside the target spec block, if you do the the spec file will be invalid.
|
|
34
|
+
# Return the new spec block in the code block.`,
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=updateSpecBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateSpecBlock.js","sourceRoot":"","sources":["../../../../../src/core/llm/prompts/templates/updateSpecBlock.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAiB;IACzC,OAAO,EAAE;QACL;YACI,MAAM,EAAE,oBAAoB,6DAAgC;QAChE,iDAA0B;EAChC,qDAA4B;OACvB;SACE;QACD;YACI,MAAM,EAAE,0CAA0C,yDAA8B;QACpF,iDAA0B;EAChC,6CAA0B;OACrB;SACE;QACD;YACI,MAAM,EAAE,2EAA2E,yDAA8B;QACrH,iDAA0B;EAChC,uDAA6B;OACxB;YACK,UAAU,EAAE;gBACR,SAAS,EAAE,KAAK;gBAChB,aAAa,EAAE,yDAA+B;aACjD;SACJ;QACD;YACI,MAAM,EAAE;;;;;+CAK2B;SACtC;KACJ;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateSpecFile.d.ts","sourceRoot":"","sources":["../../../../../src/core/llm/prompts/templates/updateSpecFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAE9D,eAAO,MAAM,cAAc,EAAE,YAyB5B,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateSpecFile = void 0;
|
|
4
|
+
exports.updateSpecFile = {
|
|
5
|
+
default: [
|
|
6
|
+
{
|
|
7
|
+
prompt: `# Source code (./${"<<<SourceFileName>>>" /* PromptPlaceholder.SourceFileName */}):
|
|
8
|
+
\`\`\`${"<<<Language>>>" /* PromptPlaceholder.Language */}
|
|
9
|
+
${"<<<SourceCode>>>" /* PromptPlaceholder.SourceCode */}
|
|
10
|
+
\`\`\``
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
prompt: `# Current spec code (${"<<<SpecFileName>>>" /* PromptPlaceholder.SpecFileName */}):
|
|
14
|
+
\`\`\`${"<<<Language>>>" /* PromptPlaceholder.Language */}
|
|
15
|
+
${"<<<Spec>>>" /* PromptPlaceholder.SpecCode */}
|
|
16
|
+
\`\`\``
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
prompt: `# Please update the test code to increase the line coverage or fix the test code.
|
|
20
|
+
# Guidelines:
|
|
21
|
+
- Do not change the unrelated code in the spec file.
|
|
22
|
+
- Do not add redundant test cases if the line is already covered.
|
|
23
|
+
- Keep the JS Doc comments in the spec file.
|
|
24
|
+
- Skip the commented code.
|
|
25
|
+
- If no need to update, please return \`NO_NEED_TO_CHANGE\` in a code block.
|
|
26
|
+
# Return the complete spec file in the code block.`
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=updateSpecFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateSpecFile.js","sourceRoot":"","sources":["../../../../../src/core/llm/prompts/templates/updateSpecFile.ts"],"names":[],"mappings":";;;AAEa,QAAA,cAAc,GAAiB;IACxC,OAAO,EAAE;QACL;YACI,MAAM,EAAE,oBAAoB,6DAAgC;QAChE,iDAA0B;EAChC,qDAA4B;OACvB;SACE;QACD;YACI,MAAM,EAAE,wBAAwB,yDAA8B;QAClE,iDAA0B;EAChC,6CAA0B;OACrB;SACE;QACD;YACI,MAAM,EAAE;;;;;;;mDAO+B;SAC1C;KACJ;CACJ,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export declare const enum Role {
|
|
2
|
+
/** @deprecated */
|
|
3
|
+
System = "system",
|
|
4
|
+
User = "user",
|
|
5
|
+
Assistant = "assistant"
|
|
6
|
+
}
|
|
7
|
+
export type AIResponse = {
|
|
8
|
+
content?: string;
|
|
9
|
+
success: boolean;
|
|
10
|
+
reason?: string;
|
|
11
|
+
message?: string;
|
|
12
|
+
};
|
|
13
|
+
export interface LLMMessage {
|
|
14
|
+
role: Role;
|
|
15
|
+
content: string;
|
|
16
|
+
}
|
|
17
|
+
export interface LLMOptions {
|
|
18
|
+
momentum?: boolean;
|
|
19
|
+
flag?: string;
|
|
20
|
+
vendor?: string;
|
|
21
|
+
family?: string;
|
|
22
|
+
isRetry?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export type IGetResponse = (messages: LLMMessage[], options?: LLMOptions, ...args: any[]) => Promise<AIResponse>;
|
|
25
|
+
export declare const enum PromptKey {
|
|
26
|
+
GenFuncUT = "GenFuncUT",
|
|
27
|
+
RepairFuncUT = "RepairFuncUT",
|
|
28
|
+
GenClassMemberUT = "GenClassMemberUT",
|
|
29
|
+
RepairClassMemberUT = "RepairClassMemberUT",
|
|
30
|
+
FixTestErrors = "FixTestErrors",
|
|
31
|
+
FixLintErrors = "FixLintErrors",
|
|
32
|
+
FixTestDataErrors = "FixTestDataErrors",
|
|
33
|
+
UpdateSpecFile = "UpdateSpecFile",
|
|
34
|
+
UpdateSpecBlock = "UpdateSpecBlock",
|
|
35
|
+
FillMsnStudioDocVariants = "FillMsnStudioDocVariants",
|
|
36
|
+
MergeUTFile = "MergeUTFile",
|
|
37
|
+
MergeUTAgent = "MergeUTAgent",
|
|
38
|
+
SnapshotUTAgentForReact = "snapshotUTAgentForReact",
|
|
39
|
+
SnapshotUTAgentForFastWC = "snapshotUTAgentForFastWC"
|
|
40
|
+
}
|
|
41
|
+
export type PromptConfigs = Record<PromptKey, PromptConfig>;
|
|
42
|
+
export type PromptConfig = {
|
|
43
|
+
default: PromptConfigItem[];
|
|
44
|
+
merge?: boolean;
|
|
45
|
+
};
|
|
46
|
+
export interface PromptConfigItem {
|
|
47
|
+
prompt?: string;
|
|
48
|
+
defaultValues?: Partial<Record<PromptPlaceholder, string>>;
|
|
49
|
+
role?: Role;
|
|
50
|
+
promptPath?: string;
|
|
51
|
+
conditions?: {
|
|
52
|
+
maxLength?: number;
|
|
53
|
+
valueRequired?: PromptPlaceholder[];
|
|
54
|
+
valueExpected?: Partial<Record<PromptPlaceholder, any>>;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export declare const enum PromptPlaceholder {
|
|
58
|
+
SourceFileName = "<<<SourceFileName>>>",
|
|
59
|
+
ClassName = "<<<ClassName>>>",
|
|
60
|
+
ClassDeclare = "<<<ClassDeclare>>>",
|
|
61
|
+
FunctionName = "<<<FunctionName>>>",
|
|
62
|
+
SpecFileName = "<<<SpecFileName>>>",
|
|
63
|
+
TestFramework = "<<<TestFramework>>>",
|
|
64
|
+
SourceCode = "<<<SourceCode>>>",
|
|
65
|
+
CodeExtInfo = "<<<CodeExtInfo>>>",
|
|
66
|
+
SpecCode = "<<<Spec>>>",
|
|
67
|
+
SpecTemplate = "<<<SpecTemplate>>>",
|
|
68
|
+
MockCode = "<<<MockCode>>>",
|
|
69
|
+
TestErrors = "<<<TestErrors>>>",
|
|
70
|
+
LintErrors = "<<<LintErrors>>>",
|
|
71
|
+
Language = "<<<Language>>>",
|
|
72
|
+
ModuleType = "<<<ModuleType>>>",
|
|
73
|
+
PackageName = "<<<PackageName>>>",
|
|
74
|
+
PackagePath = "<<<PackagePath>>>",
|
|
75
|
+
PackageJsonPath = "<<<PackageJsonPath>>>",
|
|
76
|
+
TargetFilePath = "<<<TargetFilePath>>>",
|
|
77
|
+
FilePathList = "<<<FilePathList>>>",
|
|
78
|
+
TestFileSpecifier = "<<<TestFileSpecifier>>>"
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/llm/types.ts"],"names":[],"mappings":"AAEA,0BAAkB,IAAI;IAClB,kBAAkB;IAClB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,SAAS,cAAc;CAC1B;AAED,MAAM,MAAM,UAAU,GAAG;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,YAAY,GAAG,CACvB,QAAQ,EAAE,UAAU,EAAE,EACtB,OAAO,CAAC,EAAE,UAAU,EACpB,GAAG,IAAI,EAAE,GAAG,EAAE,KACb,OAAO,CAAC,UAAU,CAAC,CAAC;AAGzB,0BAAkB,SAAS;IACvB,SAAS,cAAc;IACvB,YAAY,iBAAiB;IAC7B,gBAAgB,qBAAqB;IACrC,mBAAmB,wBAAwB;IAC3C,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,iBAAiB,sBAAsB;IAEvC,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,wBAAwB,6BAA6B;IACrD,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAC7B,uBAAuB,4BAA4B;IACnD,wBAAwB,6BAA6B;CACxD;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AAC5D,MAAM,MAAM,YAAY,GAAG;IACvB,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3D,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE;QACT,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,aAAa,CAAC,EAAE,iBAAiB,EAAE,CAAC;QACpC,aAAa,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,CAAC;KAC3D,CAAA;CACJ;AAED,0BAAkB,iBAAiB;IAC/B,cAAc,yBAAyB;IACvC,SAAS,oBAAoB;IAC7B,YAAY,uBAAuB;IACnC,YAAY,uBAAuB;IACnC,YAAY,uBAAuB;IACnC,aAAa,wBAAwB;IAErC,UAAU,qBAAqB;IAE/B,WAAW,sBAAsB;IAEjC,QAAQ,eAAe;IACvB,YAAY,uBAAuB;IACnC,QAAQ,mBAAmB;IAC3B,UAAU,qBAAqB;IAC/B,UAAU,qBAAqB;IAC/B,QAAQ,mBAAmB;IAC3B,UAAU,qBAAqB;IAC/B,WAAW,sBAAsB;IACjC,WAAW,sBAAsB;IACjC,eAAe,0BAA0B;IACzC,cAAc,yBAAyB;IACvC,YAAY,uBAAuB;IACnC,iBAAiB,4BAA4B;CAChD"}
|