@codeyam/codeyam-cli 0.1.0-bleeding-edge.8afd3ee → 0.1.0-staging.09652b8
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/analyzer-template/.build-info.json +7 -7
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +1 -1
- package/analyzer-template/packages/ai/index.ts +0 -1
- package/analyzer-template/packages/ai/scripts/ai-test-matrix.mjs +424 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +6 -16
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +197 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/paths.ts +28 -2
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +113 -4
- package/analyzer-template/packages/ai/src/lib/checkAllAttributes.ts +1 -3
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +430 -7
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +12 -6
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityDocumentation.ts +20 -2
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +56 -160
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +79 -265
- package/analyzer-template/packages/ai/src/lib/generateEntityDocumentation.ts +16 -2
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +53 -154
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +84 -254
- package/analyzer-template/packages/ai/src/lib/generateStatementAnalysis.ts +48 -71
- package/analyzer-template/packages/ai/src/lib/getLLMCallStats.ts +0 -14
- package/analyzer-template/packages/ai/src/lib/modelInfo.ts +15 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityDocumentationGenerator.ts +8 -33
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +54 -62
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +93 -109
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityDocumentationGenerator.ts +8 -27
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +33 -38
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +30 -30
- package/analyzer-template/packages/ai/src/lib/types/index.ts +2 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +15 -7
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.ts +28 -21
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.ts +18 -11
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +28 -21
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js +18 -11
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/index.d.ts +1 -0
- package/analyzer-template/packages/github/dist/utils/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/index.js +1 -0
- package/analyzer-template/packages/github/dist/utils/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.js +2 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js +2 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts +12 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js +32 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js.map +1 -0
- package/analyzer-template/packages/ui-components/src/scenario-editor/components/DataItemEditor.tsx +1 -1
- package/analyzer-template/packages/utils/dist/utils/index.d.ts +1 -0
- package/analyzer-template/packages/utils/dist/utils/index.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/index.js +1 -0
- package/analyzer-template/packages/utils/dist/utils/index.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.js +2 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js +2 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts +12 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js +32 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js.map +1 -0
- package/analyzer-template/packages/utils/index.ts +1 -0
- package/analyzer-template/packages/utils/src/lib/frameworks/getNextRoutePath.ts +2 -1
- package/analyzer-template/packages/utils/src/lib/frameworks/nextRouteFileNameToRoute.ts +2 -1
- package/analyzer-template/packages/utils/src/lib/frameworks/sanitizeNextRouteSegments.ts +33 -0
- package/analyzer-template/project/startScenarioCapture.ts +24 -0
- package/analyzer-template/project/trackGeneratedFiles.ts +41 -0
- package/analyzer-template/project/writeMockDataTsx.ts +94 -4
- package/analyzer-template/project/writeScenarioComponents.ts +35 -27
- package/background/src/lib/virtualized/project/startScenarioCapture.js +18 -0
- package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/trackGeneratedFiles.js +30 -0
- package/background/src/lib/virtualized/project/trackGeneratedFiles.js.map +1 -0
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +71 -3
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +15 -11
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/codeyam-cli/src/commands/init.js +4 -23
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/utils/webappDetection.js +2 -1
- package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-B9Sf8e9w.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-B0oiPem-.js → InteractivePreview-CDnfNKKQ.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DUS-3h7I.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-BKKG1s2B.js → LogViewer-TJzDQku1.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BgdlWM6p.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioPreview-Bl6GY-OE.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-DmjXUj6m.js → ScenarioViewer-BDq8RX50.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/_index-Bh3y3Wsl.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-tq7Bl6-t.js +10 -0
- package/codeyam-cli/src/webserver/build/client/assets/{chart-column-VXBS6qOn.js → chart-column-q9_nHfwv.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-DvL0YqDJ.js +26 -0
- package/codeyam-cli/src/webserver/build/client/assets/{circle-alert-n5GUC2AS.js → circle-alert-CKMpA1v_.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{clock-DKqtX8js.js → clock-Wnfog8Qw.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-C_ixaqqh.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-BHiWkb_W.js → entity._sha._-3bYjyojg.js} +10 -10
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-DtfwpN9J.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-QecTs_sq.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-hnkEgHrC.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/file-text-CvCVdKLW.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-DgUCYhbd.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-WoKohOtW.js +12 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-DZfbt0u5.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-Vvbl94Xc.js +8 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-v3c6DFp4.js → loader-circle-Bxm63UxG.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-c90b8608.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-DrVZQamX.js +16 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-DA14wXpu.js → search-CJkk16Ct.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{settings-COJUrwGu.js → settings-ConzHeiL.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-LuiJ1UIm.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-B9LRwAej.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-Lumm1t01.js → useLastLogLine-CpUcCv1V.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useToast-DOxmMaSg.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{zap-BvukH0eN.js → zap-D5R1FAcH.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-DzbqTxoN.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-DGGis3OZ.js +166 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/src/webserver/server.js +1 -1
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/templates/codeyam-setup-skill.md +5 -0
- package/package.json +7 -7
- package/packages/ai/index.js +0 -1
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +6 -15
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
- package/packages/ai/src/lib/astScopes/methodSemantics.js +134 -0
- package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
- package/packages/ai/src/lib/astScopes/paths.js +28 -3
- package/packages/ai/src/lib/astScopes/paths.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +99 -3
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/checkAllAttributes.js +1 -3
- package/packages/ai/src/lib/checkAllAttributes.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +308 -2
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +12 -6
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityDocumentation.js +19 -1
- package/packages/ai/src/lib/generateChangesEntityDocumentation.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js +55 -156
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarios.js +79 -262
- package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDocumentation.js +15 -1
- package/packages/ai/src/lib/generateEntityDocumentation.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +52 -152
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +88 -258
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateStatementAnalysis.js +46 -71
- package/packages/ai/src/lib/generateStatementAnalysis.js.map +1 -1
- package/packages/ai/src/lib/getLLMCallStats.js +0 -14
- package/packages/ai/src/lib/getLLMCallStats.js.map +1 -1
- package/packages/ai/src/lib/modelInfo.js +15 -0
- package/packages/ai/src/lib/modelInfo.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityDocumentationGenerator.js +8 -33
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityDocumentationGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +35 -41
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +59 -72
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityDocumentationGenerator.js +8 -27
- package/packages/ai/src/lib/promptGenerators/generateEntityDocumentationGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +24 -27
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +21 -22
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/types/index.js +2 -0
- package/packages/ai/src/lib/types/index.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +16 -7
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +28 -21
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js +18 -11
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js.map +1 -1
- package/packages/utils/index.js +1 -0
- package/packages/utils/index.js.map +1 -1
- package/packages/utils/src/lib/frameworks/getNextRoutePath.js +2 -1
- package/packages/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
- package/packages/utils/src/lib/frameworks/nextRouteFileNameToRoute.js +2 -1
- package/packages/utils/src/lib/frameworks/nextRouteFileNameToRoute.js.map +1 -1
- package/packages/utils/src/lib/frameworks/sanitizeNextRouteSegments.js +32 -0
- package/packages/utils/src/lib/frameworks/sanitizeNextRouteSegments.js.map +1 -0
- package/analyzer-template/packages/ai/src/lib/generateEntityDataMap.ts +0 -375
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-rqv54FUY.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DqXXjAJ7.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-DU_jxCPD.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioPreview-5DY-YIxu.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/_index-DvSrcxsk.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CsaMd9mb.js +0 -10
- package/codeyam-cli/src/webserver/build/client/assets/components-Dj-Ggnl2.js +0 -40
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BbR3FwNc.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-L7M9Vr5z.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-C9w-q7P3.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-CdGoUs8A.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/file-text-B6Er7j5k.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-KcDVw1FY.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-B9uZ8eSJ.js +0 -12
- package/codeyam-cli/src/webserver/build/client/assets/globals-B0f88RTV.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-fca08d7e.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-Cf8VBqIb.js +0 -16
- package/codeyam-cli/src/webserver/build/client/assets/settings-NU_ZquhK.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-CNaMJ-nR.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useToast-BRShB17p.js +0 -1
- package/codeyam-cli/src/webserver/build/client/cy-logo-cli.svg +0 -13
- package/codeyam-cli/src/webserver/build/client/favicon.svg +0 -13
- package/codeyam-cli/src/webserver/build/server/assets/index-DHr4rT4u.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-Bi1mj14J.js +0 -166
- package/codeyam-cli/src/webserver/public/cy-logo-cli.svg +0 -13
- package/codeyam-cli/src/webserver/public/favicon.svg +0 -13
- package/packages/ai/src/lib/generateEntityDataMap.js +0 -335
- package/packages/ai/src/lib/generateEntityDataMap.js.map +0 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityDataMapGenerator.js +0 -17
- package/packages/ai/src/lib/promptGenerators/generateEntityDataMapGenerator.js.map +0 -1
|
@@ -152,85 +152,52 @@ export default async function generateStatementAnalysis({
|
|
|
152
152
|
return { sha, structure, equivalentVariables, llmCall };
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
const SYSTEM_MESSAGE = (
|
|
155
|
+
const SYSTEM_MESSAGE = (
|
|
156
|
+
reservedStrategies: string[],
|
|
157
|
+
) => `Analyze a code snippet to extract:
|
|
156
158
|
|
|
157
|
-
|
|
159
|
+
1. **structure**: The data type of each variable and property path (string, number, boolean, array, object, function, or unknown)
|
|
160
|
+
2. **equivalentVariables**: Assignments between variables, where the key is the target (left side) and value is the source (right side)
|
|
158
161
|
|
|
159
|
-
|
|
162
|
+
## Type Rules
|
|
160
163
|
|
|
161
|
-
|
|
162
|
-
|
|
164
|
+
- Use type annotations when available; otherwise infer from context or use "unknown"
|
|
165
|
+
- Non-primitive types are "object"
|
|
166
|
+
- Function calls are "function"
|
|
163
167
|
|
|
164
|
-
|
|
168
|
+
## Equivalency Rules
|
|
165
169
|
|
|
166
|
-
|
|
170
|
+
For assignments like \`const a = b\`, record \`"a": "b"\`.
|
|
167
171
|
|
|
168
|
-
|
|
169
|
-
- Every variable in the code snippet has a data structure.
|
|
170
|
-
- The data structure of a variable is the type of data it holds. For example, a variable could hold a string, a number, an array, an object, a function, etc.
|
|
171
|
-
- We want to identify every aspect of every variable in the code snippet.
|
|
172
|
+
For destructuring like \`const { x } = obj\`, record \`"x": "obj.x"\`.
|
|
172
173
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
\`\`\`
|
|
174
|
+
For function calls like \`const result = foo(arg)\`:
|
|
175
|
+
- Record \`"result": "foo(arg).functionCallReturnValue"\`
|
|
176
|
+
- Record \`"foo(arg).signature[0]": "arg"\`
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
For destructured function returns like \`const { data } = foo()\`:
|
|
179
|
+
- Record \`"data": "foo().functionCallReturnValue.data"\`
|
|
179
180
|
|
|
180
|
-
|
|
181
|
-
{
|
|
182
|
-
"structure": {
|
|
183
|
-
"person": "object",
|
|
184
|
-
"person.name": "string",
|
|
185
|
-
"person.age": "number"
|
|
186
|
-
"name": "string",
|
|
187
|
-
"age": "number"
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
\`\`\`
|
|
191
|
-
|
|
192
|
-
Equivalent Variables:
|
|
193
|
-
- In the code variables or aspects of a variable may be assigned to one another, passed in as arguments to a function call, or assigned to the return value of a function call.
|
|
194
|
-
- We want to track all of these equivalent variables so that we can merge the data structure of all equivalencies together.
|
|
195
|
-
- The key should be the variable or aspect of a variable that is recieving existing data from the other variable, which is the path.
|
|
181
|
+
## Example
|
|
196
182
|
|
|
197
|
-
Example:
|
|
198
183
|
\`\`\`typescript
|
|
199
|
-
const { name
|
|
200
|
-
|
|
184
|
+
const { name } = person;
|
|
185
|
+
const result = process(name);
|
|
201
186
|
\`\`\`
|
|
202
187
|
|
|
203
|
-
Here we have a number of equivalencies:
|
|
204
|
-
|
|
205
|
-
\`\`\`
|
|
206
|
-
{
|
|
207
|
-
"equivalentVariables": {
|
|
208
|
-
"name": "person.name",
|
|
209
|
-
"hobbies": "person.hobbies",
|
|
210
|
-
"hobbies[0].started": "selectedHobby.alreadyStarted"
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
\`\`\`
|
|
214
|
-
|
|
215
|
-
**Response:**
|
|
216
|
-
|
|
217
|
-
Combine these together to form the response:
|
|
218
|
-
|
|
219
188
|
\`\`\`json
|
|
220
189
|
{
|
|
221
190
|
"structure": {
|
|
222
191
|
"person": "object",
|
|
223
192
|
"person.name": "string",
|
|
224
|
-
"
|
|
225
|
-
"
|
|
226
|
-
"
|
|
227
|
-
"selectedHobby": "object",
|
|
228
|
-
"selectedHobby.alreadyStarted": "boolean"
|
|
193
|
+
"name": "string",
|
|
194
|
+
"process(name)": "function",
|
|
195
|
+
"result": "unknown"
|
|
229
196
|
},
|
|
230
197
|
"equivalentVariables": {
|
|
231
198
|
"name": "person.name",
|
|
232
|
-
"
|
|
233
|
-
"
|
|
199
|
+
"process(name).signature[0]": "name",
|
|
200
|
+
"result": "process(name).functionCallReturnValue"
|
|
234
201
|
}
|
|
235
202
|
}
|
|
236
203
|
\`\`\`
|
|
@@ -239,10 +206,7 @@ ${relevantExamples(reservedStrategies)}
|
|
|
239
206
|
|
|
240
207
|
---
|
|
241
208
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
- Take your time and analyze the code snippet carefully. Capture all the data structures, function calls, and equivalencies you can find. If you miss any the simulation will fail.
|
|
245
|
-
- Double check your work to ensure nothing was missed and all rules are followed.
|
|
209
|
+
Analyze carefully. Missing equivalencies will cause simulation failures.
|
|
246
210
|
`;
|
|
247
211
|
|
|
248
212
|
function keywords(reservedStrategies: string[]) {
|
|
@@ -348,7 +312,20 @@ const STRATEGIES = {
|
|
|
348
312
|
name: 'Basic Variable Assignment',
|
|
349
313
|
examples: [
|
|
350
314
|
{
|
|
351
|
-
name: 'Simple',
|
|
315
|
+
name: 'Simple Assignment',
|
|
316
|
+
code: `const selectedPerson = person;`,
|
|
317
|
+
response: `{
|
|
318
|
+
"structure": {
|
|
319
|
+
"selectedPerson": "unknown",
|
|
320
|
+
"person": "unknown"
|
|
321
|
+
},
|
|
322
|
+
"equivalentVariables": {
|
|
323
|
+
"selectedPerson": "person"
|
|
324
|
+
}
|
|
325
|
+
}`,
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
name: 'Property Assignment',
|
|
352
329
|
code: `selectedPerson.position = position.name;`,
|
|
353
330
|
response: `{
|
|
354
331
|
"structure": {
|
|
@@ -363,7 +340,7 @@ const STRATEGIES = {
|
|
|
363
340
|
}`,
|
|
364
341
|
},
|
|
365
342
|
{
|
|
366
|
-
name: '
|
|
343
|
+
name: 'Destructuring',
|
|
367
344
|
code: `const { name, age } = getPerson(personId);`,
|
|
368
345
|
response: `{
|
|
369
346
|
"structure": {
|
|
@@ -404,10 +381,10 @@ const STRATEGIES = {
|
|
|
404
381
|
response: `{
|
|
405
382
|
"structure": {
|
|
406
383
|
"person": "object",
|
|
407
|
-
"options: "object"
|
|
384
|
+
"options": "object"
|
|
408
385
|
},
|
|
409
386
|
"equivalentVariables": {
|
|
410
|
-
"person": "signature[0]"
|
|
387
|
+
"person": "signature[0]",
|
|
411
388
|
"options": "signature[1]"
|
|
412
389
|
}
|
|
413
390
|
}`,
|
|
@@ -477,7 +454,7 @@ const STRATEGIES = {
|
|
|
477
454
|
"name": "string",
|
|
478
455
|
"title": "string",
|
|
479
456
|
"category": "string",
|
|
480
|
-
"age": "number"
|
|
457
|
+
"age": "number"
|
|
481
458
|
},
|
|
482
459
|
"equivalentVariables": {
|
|
483
460
|
"name": "signature[0].name",
|
|
@@ -932,10 +909,10 @@ const STRATEGIES = {
|
|
|
932
909
|
response: `{
|
|
933
910
|
"structure": {
|
|
934
911
|
"age": "number",
|
|
935
|
-
"returnValue": "number"
|
|
912
|
+
"returnValue": "number"
|
|
936
913
|
},
|
|
937
914
|
"equivalentVariables": {
|
|
938
|
-
"returnValue: "age"
|
|
915
|
+
"returnValue": "age"
|
|
939
916
|
}
|
|
940
917
|
}`,
|
|
941
918
|
},
|
|
@@ -988,7 +965,7 @@ const STRATEGIES = {
|
|
|
988
965
|
"structure": {
|
|
989
966
|
"items": "array",
|
|
990
967
|
"items.filter(cyScope1())": "function",
|
|
991
|
-
"cyScope1()"
|
|
968
|
+
"cyScope1()": "function",
|
|
992
969
|
"List()": "function",
|
|
993
970
|
"div()": "function"
|
|
994
971
|
},
|
|
@@ -1684,7 +1661,7 @@ const STRATEGIES = {
|
|
|
1684
1661
|
"foo(arg1).bar({ arg2, arg3 }).bar().baz(arg4, arg5).boo()": "function"
|
|
1685
1662
|
},
|
|
1686
1663
|
"equivalentVariables": {
|
|
1687
|
-
"data": "foo(arg1).bar({ arg2, arg3 }).bar().baz(arg4, arg5).boo().functionCallReturnValue.data"
|
|
1664
|
+
"data": "foo(arg1).bar({ arg2, arg3 }).bar().baz(arg4, arg5).boo().functionCallReturnValue.data",
|
|
1688
1665
|
"error": "foo(arg1).bar({ arg2, arg3 }).bar().baz(arg4, arg5).boo().functionCallReturnValue.error"
|
|
1689
1666
|
}
|
|
1690
1667
|
}`,
|
|
@@ -2,13 +2,6 @@ import OpenAI from 'openai';
|
|
|
2
2
|
import { getLLMCallCost } from './getLLMCallCost';
|
|
3
3
|
import { AI, LlmCallStats } from './types';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* It looks like this function can be massively simplified, and I (AG) think
|
|
7
|
-
* that we aren't using openrouter anymore. But, until this is figured out, it
|
|
8
|
-
* might not be worth refactoring and messing something subtle up. Ideally
|
|
9
|
-
* whatever implicit functionality is in here can be represented in the new
|
|
10
|
-
* `getLLMCallStats` such that this get replaced by it.
|
|
11
|
-
*/
|
|
12
5
|
export function getLLMCallStats({
|
|
13
6
|
chatRequest,
|
|
14
7
|
chatCompletion,
|
|
@@ -28,13 +21,6 @@ export function getLLMCallStats({
|
|
|
28
21
|
error: JSON.stringify(chatCompletion.error),
|
|
29
22
|
};
|
|
30
23
|
}
|
|
31
|
-
if (!chatRequest.model) {
|
|
32
|
-
// this was previously used to indicate openrouter calls, but we aren't
|
|
33
|
-
// doing that anymore and anyway it was a pretty obscure way to indicate
|
|
34
|
-
// that state of affairs. if we bring multi-provider back, we will want
|
|
35
|
-
// to rewrite a fair bit of this.
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
24
|
|
|
39
25
|
const usage = chatCompletion.usage || {
|
|
40
26
|
prompt_tokens: 0,
|
|
@@ -27,6 +27,14 @@ export interface ModelInfo {
|
|
|
27
27
|
|
|
28
28
|
export const MODEL_INFO: Record<AI.Model, ModelInfo> = {
|
|
29
29
|
// OpenAI models - served directly by OpenAI
|
|
30
|
+
[AI.Model.OPENAI_GPT5_1]: {
|
|
31
|
+
id: AI.Model.OPENAI_GPT5_1,
|
|
32
|
+
provider: OPENAI_PROVIDER,
|
|
33
|
+
apiModelName: 'gpt-5.1',
|
|
34
|
+
maxCompletionTokens: 128000,
|
|
35
|
+
pricing: { input: 1.25, output: 10.0 },
|
|
36
|
+
reasoningEffort: 'none',
|
|
37
|
+
},
|
|
30
38
|
[AI.Model.OPENAI_GPT5]: {
|
|
31
39
|
id: AI.Model.OPENAI_GPT5,
|
|
32
40
|
provider: OPENAI_PROVIDER,
|
|
@@ -175,6 +183,13 @@ export const MODEL_INFO: Record<AI.Model, ModelInfo> = {
|
|
|
175
183
|
maxCompletionTokens: 200000,
|
|
176
184
|
pricing: { input: 3.0, output: 15.0 },
|
|
177
185
|
},
|
|
186
|
+
[AI.Model.ANTHROPIC_CLAUDE_4_5_OPUS]: {
|
|
187
|
+
id: AI.Model.ANTHROPIC_CLAUDE_4_5_OPUS,
|
|
188
|
+
provider: ANTHROPIC_PROVIDER,
|
|
189
|
+
apiModelName: 'claude-opus-4-5',
|
|
190
|
+
maxCompletionTokens: 200000,
|
|
191
|
+
pricing: { input: 5.0, output: 25.0 },
|
|
192
|
+
},
|
|
178
193
|
|
|
179
194
|
// Deprecated models (kept for backward compatibility)
|
|
180
195
|
[AI.Model.PHIND_CODELLAMA]: {
|
|
@@ -4,44 +4,19 @@ export default function generateChangesEntityDocumentationGenerator(
|
|
|
4
4
|
entity: Entity,
|
|
5
5
|
previousDocumentation: string,
|
|
6
6
|
) {
|
|
7
|
-
return
|
|
7
|
+
return `## Task
|
|
8
|
+
Review if the existing documentation is still accurate after code changes. If accurate, respond "No changes needed". Otherwise, provide updated documentation.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
## Current Documentation
|
|
10
11
|
${previousDocumentation}
|
|
11
|
-
"""
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"""
|
|
13
|
+
## Updated Code
|
|
14
|
+
\`\`\`typescript
|
|
16
15
|
${entity.code}
|
|
17
|
-
"""
|
|
18
|
-
|
|
19
|
-
If the existing documentation is still accurate please respond with "No changes needed".
|
|
20
|
-
|
|
21
|
-
Otherwise, please update the documentation to reflect the changes in the code. Using these instructions:
|
|
22
|
-
|
|
23
|
-
- Start with an overview that describes the overall intent of the code. Be concise in your language. Immediately start with the intent of the code. Here is an example Overview:
|
|
24
|
-
|
|
25
|
-
\`\`\` Overview
|
|
26
|
-
Displays details about a specific Git commit. It shows the commit message, author, date, and provides a link to the commit on GitHub. Users can copy the commit SHA to their clipboard, with a visual indication of the copy action.
|
|
27
16
|
\`\`\`
|
|
28
17
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- Next, specify the inputs (with details about types, how the input is used, and examples) and expected outputs (with details about types and examples).
|
|
32
|
-
|
|
33
|
-
- Finally, provide examples of how the code can be used with clear inputs and outputs for each example. Provide diverse examples (there's no need to include repetitive examples).
|
|
34
|
-
|
|
35
|
-
Write the documentation as markdown. Be concise. Use bullets when possible. No one wants to read long paragraphs of text.
|
|
36
|
-
|
|
37
|
-
Provide no other text than the documentation in proper markdown using the headers below.
|
|
38
|
-
|
|
39
|
-
## Overview
|
|
40
|
-
|
|
41
|
-
## Inputs
|
|
42
|
-
|
|
43
|
-
## Output
|
|
18
|
+
## Overview Example
|
|
19
|
+
Good: "Displays details about a specific Git commit. Shows the commit message, author, date, and provides a link to GitHub."
|
|
44
20
|
|
|
45
|
-
|
|
46
|
-
`;
|
|
21
|
+
Bad: "The CommitDetails function takes a commit object..." (mentions the function name)`;
|
|
47
22
|
}
|
|
@@ -52,77 +52,69 @@ export default function generateChangesEntityScenarioDataGenerator(
|
|
|
52
52
|
defaultScenarioData?: ScenarioData,
|
|
53
53
|
incompleteResponse?: string,
|
|
54
54
|
) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Here is the incomplete response. Please use this and the following data to complete the response, only returning the missing data.
|
|
60
|
-
|
|
61
|
-
Just pick up where this response left off. It will be improper json but we will combine the responses into proper json.
|
|
62
|
-
|
|
63
|
-
\`\`\` START INCOMPLETE RESPONSE \`\`\`
|
|
55
|
+
const incompleteSection = incompleteResponse
|
|
56
|
+
? `## Incomplete Response
|
|
57
|
+
Continue from where this left off (combine for valid JSON):
|
|
58
|
+
\`\`\`
|
|
64
59
|
${incompleteResponse}
|
|
65
|
-
\`\`\`
|
|
60
|
+
\`\`\`
|
|
66
61
|
|
|
67
62
|
`
|
|
68
|
-
|
|
69
|
-
}## Scenario
|
|
70
|
-
|
|
71
|
-
This scenario needs mock data to support it. Here are the keyAttributeInstructions for generating this scenario:
|
|
72
|
-
\`\`\`
|
|
73
|
-
${JSON.stringify(
|
|
74
|
-
{
|
|
75
|
-
name: scenario.name,
|
|
76
|
-
description: scenario.description,
|
|
77
|
-
keyAttributeInstructions: scenario.metadata.keyAttributeInstructions,
|
|
78
|
-
},
|
|
79
|
-
null,
|
|
80
|
-
2,
|
|
81
|
-
)}
|
|
82
|
-
\`\`\`
|
|
63
|
+
: '';
|
|
83
64
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
null,
|
|
94
|
-
2,
|
|
95
|
-
)}
|
|
96
|
-
\`\`\`
|
|
97
|
-
${
|
|
98
|
-
defaultScenarioData
|
|
99
|
-
? `
|
|
100
|
-
## Default Scenario
|
|
65
|
+
const scenarioJson = JSON.stringify(
|
|
66
|
+
{
|
|
67
|
+
name: scenario.name,
|
|
68
|
+
description: scenario.description,
|
|
69
|
+
keyAttributeInstructions: scenario.metadata.keyAttributeInstructions,
|
|
70
|
+
},
|
|
71
|
+
null,
|
|
72
|
+
2,
|
|
73
|
+
);
|
|
101
74
|
|
|
102
|
-
|
|
103
|
-
|
|
75
|
+
const existingJson = JSON.stringify(
|
|
76
|
+
{
|
|
77
|
+
name: existingScenario.name,
|
|
78
|
+
data: filterData(structure, existingScenario.metadata.data),
|
|
79
|
+
},
|
|
80
|
+
null,
|
|
81
|
+
2,
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const defaultSection = defaultScenarioData
|
|
85
|
+
? `
|
|
86
|
+
## Default Scenario Data (merge base, do not modify)
|
|
87
|
+
\`\`\`json
|
|
104
88
|
${JSON.stringify(defaultScenarioData.data, null, 2)}
|
|
105
89
|
\`\`\`
|
|
106
90
|
`
|
|
107
|
-
: ''
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
\`\`\`
|
|
91
|
+
: '';
|
|
92
|
+
|
|
93
|
+
const mockDataSection = structure.dataForMocks
|
|
94
|
+
? `## mockData Structure
|
|
95
|
+
\`\`\`json
|
|
113
96
|
${JSON.stringify(structure.dataForMocks, null, 2)}
|
|
114
|
-
|
|
115
|
-
`
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
structure.arguments
|
|
121
|
-
? `The argumentsData structure (for the default scenario provide robust values for the entire structure):
|
|
122
|
-
\`\`\`
|
|
97
|
+
\`\`\``
|
|
98
|
+
: '## mockData Structure\nNone—return `{}` for mockData.';
|
|
99
|
+
|
|
100
|
+
const argumentsSection = structure.arguments
|
|
101
|
+
? `## argumentsData Structure
|
|
102
|
+
\`\`\`json
|
|
123
103
|
${JSON.stringify(structure.arguments, null, 2)}
|
|
104
|
+
\`\`\``
|
|
105
|
+
: '## argumentsData Structure\nNone—return `[]` for argumentsData.';
|
|
106
|
+
|
|
107
|
+
return `${incompleteSection}## Scenario (new instructions)
|
|
108
|
+
\`\`\`json
|
|
109
|
+
${scenarioJson}
|
|
124
110
|
\`\`\`
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
111
|
+
|
|
112
|
+
## Existing Scenario (preserve where possible)
|
|
113
|
+
\`\`\`json
|
|
114
|
+
${existingJson}
|
|
115
|
+
\`\`\`
|
|
116
|
+
${defaultSection}
|
|
117
|
+
${mockDataSection}
|
|
118
|
+
|
|
119
|
+
${argumentsSection}`;
|
|
128
120
|
}
|
|
@@ -41,7 +41,7 @@ export default function generateChangesEntityScenariosGenerator({
|
|
|
41
41
|
const filePath = (attr as any).filePath;
|
|
42
42
|
const entityName = (attr as any).originalEntityName;
|
|
43
43
|
|
|
44
|
-
if (!filePath || !entityName) continue;
|
|
44
|
+
if (!filePath || !entityName) continue;
|
|
45
45
|
|
|
46
46
|
if (!relevantDependentKeyAttributes[filePath]) {
|
|
47
47
|
relevantDependentKeyAttributes[filePath] = {};
|
|
@@ -52,128 +52,112 @@ export default function generateChangesEntityScenariosGenerator({
|
|
|
52
52
|
relevantDependentKeyAttributes[filePath][entityName].push(attr);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
\`\`\`
|
|
79
|
-
|
|
80
|
-
${
|
|
81
|
-
changedDataStructureFields.length > 0
|
|
82
|
-
? `Changed Data Structure Fields:
|
|
83
|
-
|
|
84
|
-
The following fields in the data structure have changed (type changed, added, or removed):
|
|
85
|
-
|
|
86
|
-
\`\`\`
|
|
55
|
+
const formatKeyAttrs = (attrs: Analysis['metadata']['keyAttributes']) =>
|
|
56
|
+
attrs.map((ka) => ({
|
|
57
|
+
dataStructurePath: ka.dataStructurePath,
|
|
58
|
+
localVariable: ka.internalPath,
|
|
59
|
+
description: ka.description,
|
|
60
|
+
validValueOptions: ka.validValueOptions,
|
|
61
|
+
}));
|
|
62
|
+
|
|
63
|
+
const addedSection =
|
|
64
|
+
addedKeyAttributes?.length > 0
|
|
65
|
+
? JSON.stringify(formatKeyAttrs(addedKeyAttributes), null, 2)
|
|
66
|
+
: 'None';
|
|
67
|
+
|
|
68
|
+
const removedSection =
|
|
69
|
+
removedKeyAttributes?.length > 0
|
|
70
|
+
? JSON.stringify(removedKeyAttributes, null, 2)
|
|
71
|
+
: 'None';
|
|
72
|
+
|
|
73
|
+
const changedFieldsSection =
|
|
74
|
+
changedDataStructureFields.length > 0
|
|
75
|
+
? `
|
|
76
|
+
## Changed Data Structure Fields
|
|
77
|
+
Fields that changed type, were added, or removed:
|
|
78
|
+
\`\`\`json
|
|
87
79
|
${JSON.stringify(changedDataStructureFields, null, 2)}
|
|
88
80
|
\`\`\`
|
|
89
81
|
|
|
90
|
-
**
|
|
91
|
-
- If "stats.visualEntities" changed from an array to a number, update keyAttributeInstructions from "Array of 10 objects" to "10 (count of visual entities)"
|
|
92
|
-
- If a field was removed, remove it from keyAttributeInstructions
|
|
93
|
-
- If a field was added, you may add it to keyAttributeInstructions if relevant for the scenario
|
|
94
|
-
|
|
95
|
-
Fields that did NOT change can retain their existing keyAttributeInstructions.
|
|
96
|
-
|
|
82
|
+
**Update keyAttributeInstructions for affected scenarios** (e.g., if "stats.visualEntities" changed from array to number).
|
|
97
83
|
`
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
84
|
+
: '';
|
|
85
|
+
|
|
86
|
+
const existingScenariosJson = JSON.stringify(
|
|
87
|
+
existingScenarios
|
|
88
|
+
.filter((s) => (error ? !!s.metadata.error : !s.metadata.error))
|
|
89
|
+
.map((s) => ({
|
|
90
|
+
name: s.name,
|
|
91
|
+
description: s.description,
|
|
92
|
+
keyAttributeInstructions: s.metadata.keyAttributeInstructions,
|
|
93
|
+
playwrightInstructions: s.metadata.playwrightInstructions,
|
|
94
|
+
})),
|
|
95
|
+
null,
|
|
96
|
+
2,
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const diffSection = commitDiff
|
|
100
|
+
? `
|
|
101
|
+
## Code Change (Diff)
|
|
102
|
+
\`\`\`diff
|
|
103
|
+
${commitDiff}
|
|
104
|
+
\`\`\``
|
|
105
|
+
: '';
|
|
106
|
+
|
|
107
|
+
const dependencySection =
|
|
108
|
+
!error &&
|
|
109
|
+
relevantDependentKeyAttributes &&
|
|
110
|
+
Object.keys(relevantDependentKeyAttributes).length > 0
|
|
111
|
+
? `
|
|
112
|
+
## Dependency Key Attributes
|
|
113
|
+
\`\`\`json
|
|
103
114
|
${JSON.stringify(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
Object.keys(relevantDependentKeyAttributes).reduce((acc: any, path) => {
|
|
116
|
+
acc[path] = Object.keys(relevantDependentKeyAttributes[path]).reduce(
|
|
117
|
+
(entityAcc: any, entityName) => {
|
|
118
|
+
entityAcc[entityName] = relevantDependentKeyAttributes[path][
|
|
119
|
+
entityName
|
|
120
|
+
].map((ka: any) => ({
|
|
121
|
+
dataStructurePath: ka.dataStructurePath,
|
|
122
|
+
localVariable: ka.path || ka.internalPath,
|
|
123
|
+
description: ka.description,
|
|
124
|
+
validValueOptions: ka.validValueOptions,
|
|
125
|
+
}));
|
|
126
|
+
return entityAcc;
|
|
127
|
+
},
|
|
128
|
+
{},
|
|
129
|
+
);
|
|
130
|
+
return acc;
|
|
131
|
+
}, {}),
|
|
110
132
|
null,
|
|
111
133
|
2,
|
|
112
134
|
)}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
Existing Scenarios:
|
|
135
|
+
\`\`\``
|
|
136
|
+
: '';
|
|
116
137
|
|
|
138
|
+
return `## Added Key Attributes
|
|
139
|
+
\`\`\`json
|
|
140
|
+
${addedSection}
|
|
117
141
|
\`\`\`
|
|
118
|
-
${JSON.stringify(
|
|
119
|
-
existingScenarios
|
|
120
|
-
.filter((s) => (error ? !!s.metadata.error : !s.metadata.error))
|
|
121
|
-
.map((s) => ({
|
|
122
|
-
name: s.name,
|
|
123
|
-
description: s.description,
|
|
124
|
-
keyAttributeInstructions: s.metadata.keyAttributeInstructions,
|
|
125
|
-
playwrightInstructions: s.metadata.playwrightInstructions,
|
|
126
|
-
})),
|
|
127
|
-
null,
|
|
128
|
-
2,
|
|
129
|
-
)}
|
|
130
|
-
\`\`\`
|
|
131
|
-
|
|
132
|
-
${
|
|
133
|
-
commitDiff
|
|
134
|
-
? `
|
|
135
|
-
Code Change:
|
|
136
142
|
|
|
143
|
+
## Removed Key Attributes
|
|
144
|
+
\`\`\`json
|
|
145
|
+
${removedSection}
|
|
137
146
|
\`\`\`
|
|
138
|
-
${
|
|
147
|
+
${changedFieldsSection}
|
|
148
|
+
## Current Key Attributes
|
|
149
|
+
\`\`\`json
|
|
150
|
+
${JSON.stringify(formatKeyAttrs(keyAttributes), null, 2)}
|
|
139
151
|
\`\`\`
|
|
140
|
-
`
|
|
141
|
-
: ''
|
|
142
|
-
}
|
|
143
|
-
Function Code:
|
|
144
152
|
|
|
153
|
+
## Existing Scenarios
|
|
154
|
+
\`\`\`json
|
|
155
|
+
${existingScenariosJson}
|
|
145
156
|
\`\`\`
|
|
146
|
-
${
|
|
147
|
-
\`\`\`
|
|
157
|
+
${diffSection}
|
|
148
158
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
? `Key Attributes for Dependencies:
|
|
154
|
-
\`\`\`
|
|
155
|
-
${JSON.stringify(
|
|
156
|
-
Object.keys(relevantDependentKeyAttributes).reduce((acc: any, path) => {
|
|
157
|
-
acc[path] = Object.keys(
|
|
158
|
-
(relevantDependentKeyAttributes as any)[path],
|
|
159
|
-
).reduce((entityAcc: any, entityName) => {
|
|
160
|
-
entityAcc[entityName] = (relevantDependentKeyAttributes as any)[path][
|
|
161
|
-
entityName
|
|
162
|
-
].map((ka: any) => ({
|
|
163
|
-
dataStructurePath: ka.dataStructurePath, // Full path in mockData
|
|
164
|
-
localVariable: ka.path || ka.internalPath, // Local variable name
|
|
165
|
-
description: ka.description,
|
|
166
|
-
validValueOptions: ka.validValueOptions,
|
|
167
|
-
}));
|
|
168
|
-
return entityAcc;
|
|
169
|
-
}, {});
|
|
170
|
-
return acc;
|
|
171
|
-
}, {}),
|
|
172
|
-
null,
|
|
173
|
-
2,
|
|
174
|
-
)}
|
|
175
|
-
\`\`\``
|
|
176
|
-
: ''
|
|
177
|
-
}
|
|
178
|
-
`;
|
|
159
|
+
## Current Code
|
|
160
|
+
\`\`\`typescript
|
|
161
|
+
${entity.code}
|
|
162
|
+
\`\`\`${dependencySection}`;
|
|
179
163
|
}
|