@codeyam/codeyam-cli 0.1.0-staging.8e7b1bd → 0.1.0-staging.b8a55ba
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 +7 -6
- package/analyzer-template/packages/ai/package.json +1 -1
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +2 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +22 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.ts +23 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +401 -106
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +60 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +661 -50
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +14 -2
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +715 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +123 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +19 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +23 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +23 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +34 -1
- package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +236 -24
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +18 -1
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +37 -4
- package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +5 -0
- package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +213 -12
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +11 -15
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +114 -11
- package/analyzer-template/packages/ai/src/lib/getConditionalUsagesFromCode.ts +143 -31
- package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +8 -2
- package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +7 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +42 -2
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +38 -2
- package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +28 -2
- package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +5 -0
- package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +8 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +339 -145
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +20 -0
- package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +8 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +158 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +107 -18
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +223 -103
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +10 -5
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +172 -83
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +2 -5
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +97 -27
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts +15 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts.map +1 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js +31 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js.map +1 -0
- package/analyzer-template/packages/aws/package.json +1 -1
- package/analyzer-template/packages/aws/s3/index.ts +1 -0
- package/analyzer-template/packages/aws/src/lib/s3/checkS3ObjectExists.ts +47 -0
- package/analyzer-template/packages/database/src/lib/kysely/db.ts +4 -4
- package/analyzer-template/packages/database/src/lib/kysely/tableRelations.ts +2 -2
- package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +20 -9
- package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +3 -2
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +9 -4
- package/analyzer-template/packages/generate/src/lib/deepMerge.ts +26 -1
- package/analyzer-template/packages/generate/src/lib/getComponentScenarioPath.ts +8 -3
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tableRelations.d.ts +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +8 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +14 -7
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +4 -2
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js +27 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.js +7 -3
- package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.d.ts +4 -3
- package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.js +1 -0
- package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +31 -1
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +51 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.js +21 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +48 -0
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.js +26 -2
- package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
- package/analyzer-template/packages/types/index.ts +8 -0
- package/analyzer-template/packages/types/src/types/Analysis.ts +32 -1
- package/analyzer-template/packages/types/src/types/Scenario.ts +75 -6
- package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +49 -0
- package/analyzer-template/packages/ui-components/package.json +4 -4
- package/analyzer-template/packages/ui-components/src/components/ScenarioDetailInteractiveView.tsx +23 -7
- package/analyzer-template/packages/utils/dist/types/index.d.ts +4 -3
- package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/index.js +1 -0
- package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +31 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +51 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js +21 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +48 -0
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.js +26 -2
- package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
- package/analyzer-template/packages/utils/src/lib/applyUniversalMocks.ts +28 -2
- package/analyzer-template/packages/utils/src/lib/lightweightEntityExtractor.ts +27 -0
- package/analyzer-template/playwright/takeElementScreenshot.ts +26 -11
- package/analyzer-template/playwright/takeScreenshot.ts +9 -7
- package/analyzer-template/project/TESTING.md +83 -0
- package/analyzer-template/project/constructMockCode.ts +151 -30
- package/analyzer-template/project/loadReadyToBeCaptured.ts +17 -1
- package/analyzer-template/project/orchestrateCapture/KyselyAnalysisLoader.ts +16 -9
- package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +77 -37
- package/analyzer-template/project/reconcileMockDataKeys.ts +104 -3
- package/analyzer-template/project/runMultiScenarioServer.ts +11 -10
- package/analyzer-template/project/serverOnlyModules.ts +288 -0
- package/analyzer-template/project/start.ts +10 -0
- package/analyzer-template/project/startScenarioCapture.ts +73 -41
- package/analyzer-template/project/writeMockDataTsx.ts +103 -40
- package/analyzer-template/project/writeScenarioComponents.ts +1162 -203
- package/analyzer-template/project/writeSimpleRoot.ts +26 -4
- package/analyzer-template/project/writeUniversalMocks.ts +32 -11
- package/background/src/lib/virtualized/project/constructMockCode.js +132 -25
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js +15 -1
- package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js +11 -6
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +67 -32
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +65 -4
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
- package/background/src/lib/virtualized/project/runMultiScenarioServer.js +11 -9
- package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
- package/background/src/lib/virtualized/project/serverOnlyModules.js +235 -0
- package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -0
- package/background/src/lib/virtualized/project/start.js +6 -0
- package/background/src/lib/virtualized/project/start.js.map +1 -1
- package/background/src/lib/virtualized/project/startScenarioCapture.js +54 -31
- package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +87 -34
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +852 -133
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/background/src/lib/virtualized/project/writeSimpleRoot.js +25 -2
- package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
- package/background/src/lib/virtualized/project/writeUniversalMocks.js +27 -12
- package/background/src/lib/virtualized/project/writeUniversalMocks.js.map +1 -1
- package/codeyam-cli/scripts/fixtures/formbricks/universal-mocks/apps/web/lib/instance/service.js +7 -0
- package/codeyam-cli/scripts/fixtures/formbricks/universal-mocks/apps/web/lib/instance/service.js.map +1 -0
- package/codeyam-cli/src/cli.js +2 -0
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/commands/debug.js +14 -2
- package/codeyam-cli/src/commands/debug.js.map +1 -1
- package/codeyam-cli/src/commands/recapture.js +215 -0
- package/codeyam-cli/src/commands/recapture.js.map +1 -0
- package/codeyam-cli/src/commands/report.js +26 -23
- package/codeyam-cli/src/commands/report.js.map +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js +2 -2
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/generateReport.js +252 -106
- package/codeyam-cli/src/utils/generateReport.js.map +1 -1
- package/codeyam-cli/src/utils/install-skills.js +2 -7
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +38 -0
- package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +140 -16
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/queue/manager.js +19 -7
- package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
- package/codeyam-cli/src/utils/queue/persistence.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/database.js +47 -0
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
- package/codeyam-cli/src/webserver/backgroundServer.js +5 -10
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/bootstrap.js +9 -0
- package/codeyam-cli/src/webserver/bootstrap.js.map +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-wXL1Z2Aq.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-DQeyk25_.js → EntityTypeBadge-CzGX-miz.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-CXFKsCOD.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-D-9pXIaY.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-CBQPrpT0.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/LoadingDots-D1CdlbrV.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/LogViewer-wDPcZNKx.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-4lcOlid-.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BfmDgXxG.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CUxUNEEC.js +15 -0
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-ayCJdUAc.js → TruncatedFilePath-6J7zDUD5.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/_index-DHImXdXq.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-2mG6mjVb.js +32 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.link-scenario-value-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.update-key-attributes-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.update-valid-values-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/chevron-down-BYimnrHg.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JMJ3UQ3L-BambyYE_.js +51 -0
- package/codeyam-cli/src/webserver/build/client/assets/circle-check-CaVsIRxt.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CgUsG7ib.js +21 -0
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-CKnwPCDr.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DW_hdGUc.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-FHOVOgFN.js → entity._sha._-zUEpfPsu.js} +22 -15
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DyB90fWk.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-D_3ero5o.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-CfLCUi9S.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-DKJyZfAY.js +29 -0
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-DAtOlaWE.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-ClR0d32A.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-D62Lxxmv.js +15 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-C6vQASxy.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-fmIEn3Bc.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-BosqDOlH.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-CzNNiTkw.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/keyAttributeCoverage-CTlFMihX.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-CNp9QFCX.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/manifest-09d684be.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/preload-helper-ckwbz45p.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-BxJUvKau.js +56 -0
- package/codeyam-cli/src/webserver/build/client/assets/scenarioStatus-B_8jpV3e.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/search-DDGjYAMJ.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/settings-DgTyB-Wg.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-CoNWGt0K.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-CBc5dE1s.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BMIGFP-m.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/useInteractiveMode-Dk_FQqWJ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-DOGXmJcI.js → useLastLogLine-BqPPNjAl.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DsJbgMY9.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-C07gRg7Z.js → useToast-DWHcCcl1.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-CV6i1S1A.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BDlyhfrv.js +175 -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/devServer.js +1 -3
- package/codeyam-cli/src/webserver/devServer.js.map +1 -1
- package/codeyam-cli/templates/debug-codeyam.md +620 -0
- package/package.json +14 -14
- package/packages/ai/src/lib/analyzeScope.js +2 -0
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +16 -0
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js +16 -0
- package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +305 -88
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +523 -42
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +12 -2
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +454 -0
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +103 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +16 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +19 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +20 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +28 -2
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +179 -17
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +6 -0
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarios.js +37 -4
- package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDataStructure.js +4 -0
- package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
- package/packages/ai/src/lib/generateEntityKeyAttributes.js +176 -9
- package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +11 -15
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +105 -9
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/getConditionalUsagesFromCode.js +84 -14
- package/packages/ai/src/lib/getConditionalUsagesFromCode.js.map +1 -1
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -1
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +6 -0
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +38 -2
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +38 -2
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js +16 -3
- package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
- package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js +4 -0
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +258 -110
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +18 -0
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/getImportedExports.js +6 -1
- package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +125 -0
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +74 -19
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +175 -58
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +10 -5
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +127 -69
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +2 -5
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +74 -23
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/database/src/lib/kysely/db.js +2 -2
- package/packages/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
- package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +4 -2
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
- package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
- package/packages/generate/src/lib/deepMerge.js +27 -1
- package/packages/generate/src/lib/deepMerge.js.map +1 -1
- package/packages/generate/src/lib/getComponentScenarioPath.js +7 -3
- package/packages/generate/src/lib/getComponentScenarioPath.js.map +1 -1
- package/packages/types/index.js +1 -0
- package/packages/types/index.js.map +1 -1
- package/packages/types/src/types/Scenario.js +21 -1
- package/packages/types/src/types/Scenario.js.map +1 -1
- package/packages/utils/src/lib/applyUniversalMocks.js +26 -2
- package/packages/utils/src/lib/applyUniversalMocks.js.map +1 -1
- package/packages/utils/src/lib/lightweightEntityExtractor.js +25 -0
- package/packages/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
- package/scripts/finalize-analyzer.cjs +3 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-CWKV2GEz.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-D2hFeDeg.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-C8K-4kKP.js +0 -26
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DgXLv61M.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/LogViewer-DFdLQbPS.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-DlRDjT4h.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-7UkVL-UI.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-XjtsGuPo.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/_index-D2eJjWLf.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-w6sbwlOd.js +0 -7
- package/codeyam-cli/src/webserver/build/client/assets/chevron-down-BBNQ8hup.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-Bex4RrGs.js +0 -26
- package/codeyam-cli/src/webserver/build/client/assets/circle-check-cdhjVtom.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-DkgmwwRC.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CwLmCS0J.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-YZ-kM3ZG.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-BeQlz94_.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-DN2XXM7Z.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-CUeAIQNI.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-ccMQfhGf.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-JmESAHx5.js +0 -12
- package/codeyam-cli/src/webserver/build/client/assets/globals-CO-U8Bpo.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-XQCGvadH.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/index-DsL9BiOc.js +0 -8
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-COYCR2oZ.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-90adba57.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-DfbVEEjF.js +0 -16
- package/codeyam-cli/src/webserver/build/client/assets/search-DvK9iMBu.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/server-build-CMKNK2uU.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-9LTbit4Z.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-BrxN5ZtV.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-Iv0p8T-1.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-BWmSRPH6.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-CE_1qXCG.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BY_VDhiD.js +0 -166
- package/codeyam-cli/templates/debug-command.md +0 -141
- /package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-CMKNK2uU.css → styles-CMKNK2uU.css} +0 -0
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import completionCall from './completionCall';
|
|
2
2
|
import { saveLlmCall } from '~codeyam/aws/dynamodb';
|
|
3
|
-
import {
|
|
3
|
+
import type {
|
|
4
|
+
Analysis,
|
|
5
|
+
CompoundConditional,
|
|
6
|
+
ConditionalUsage,
|
|
7
|
+
Entity,
|
|
8
|
+
} from '~codeyam/types';
|
|
4
9
|
import generateEntityKeyAttributesGenerator from './promptGenerators/generateEntityKeyAttributesGenerator';
|
|
5
10
|
import { awsLog } from '~codeyam/utils';
|
|
6
11
|
import { AI, DEFAULT_LARGER_MODEL } from '~codeyam/ai';
|
|
7
12
|
import isFrontend from './isFrontend';
|
|
8
13
|
import { gatherAttributesMap } from './promptGenerators/gatherAttributesMap';
|
|
14
|
+
import { formatConditionalUsagesForPrompt } from './getConditionalUsagesFromCode';
|
|
9
15
|
|
|
10
16
|
interface GenerateChangesEntityKeyAttributesArgs {
|
|
11
17
|
entity: Entity;
|
|
@@ -41,11 +47,22 @@ export default async function generateChangesEntityKeyAttributes({
|
|
|
41
47
|
true,
|
|
42
48
|
);
|
|
43
49
|
|
|
50
|
+
// Use pre-computed conditional usages from metadata for static analysis context
|
|
51
|
+
const conditionalUsages: Record<string, ConditionalUsage[]> =
|
|
52
|
+
isolatedDataStructure?.conditionalUsages ?? {};
|
|
53
|
+
const compoundConditionals: CompoundConditional[] =
|
|
54
|
+
isolatedDataStructure?.compoundConditionals ?? [];
|
|
55
|
+
const staticAnalysisContext = formatConditionalUsagesForPrompt(
|
|
56
|
+
conditionalUsages,
|
|
57
|
+
compoundConditionals,
|
|
58
|
+
);
|
|
59
|
+
|
|
44
60
|
const prompt = generateEntityKeyAttributesGenerator({
|
|
45
61
|
code: entity.code,
|
|
46
62
|
attributesMap,
|
|
47
63
|
existingKeyAttributes,
|
|
48
64
|
commitDiff,
|
|
65
|
+
staticAnalysisContext,
|
|
49
66
|
});
|
|
50
67
|
|
|
51
68
|
const response = await completionCall({
|
|
@@ -288,7 +288,16 @@ Focus scenario updates on demonstrating this change.${scenarioCount ? ` Generate
|
|
|
288
288
|
|
|
289
289
|
return `You are updating data scenarios after a code change. Determine which existing scenarios need updating, which should be removed, and if new ones are needed.
|
|
290
290
|
|
|
291
|
-
${contextSection}##
|
|
291
|
+
${contextSection}## Coverage Goals (IMPORTANT)
|
|
292
|
+
Your primary goal is to MAXIMIZE coverage of key attributes across all scenarios:
|
|
293
|
+
|
|
294
|
+
1. **Use indexed validValueOptions**: Each key attribute has indexed \`validValueOptions\` (with \`index\` and \`value\`). Reference these by index in your valueOptionRef.
|
|
295
|
+
|
|
296
|
+
2. **Prioritize attributes with dependencies**: Key attributes with a \`dependencies\` array control conditionally-rendered content. Satisfy these dependencies to reveal gated UI/behavior.
|
|
297
|
+
|
|
298
|
+
3. **Cover conditional branches**: Use \`codeUsages\` to identify all conditional paths that need coverage.
|
|
299
|
+
|
|
300
|
+
## Update Rules
|
|
292
301
|
|
|
293
302
|
### Removed Key Attributes
|
|
294
303
|
- Update scenarios using removed attributes—replace with new attributes or remove if no longer relevant
|
|
@@ -297,6 +306,7 @@ ${contextSection}## Update Rules
|
|
|
297
306
|
|
|
298
307
|
### Added Key Attributes
|
|
299
308
|
- Create or update scenarios to demonstrate new behavior
|
|
309
|
+
- Use different validValueOption indices than existing scenarios to maximize coverage
|
|
300
310
|
|
|
301
311
|
### Playwright Instructions
|
|
302
312
|
- Validate existing instructions still work after code changes
|
|
@@ -308,7 +318,26 @@ ${contextSection}## Update Rules
|
|
|
308
318
|
### Default Scenario
|
|
309
319
|
- First scenario must be "${DEFAULT_SCENARIO_NAME}" (exact name)
|
|
310
320
|
- NEVER include playwrightInstructions—captures initial state only
|
|
311
|
-
- Must include all current key attributes with valid values
|
|
321
|
+
- Must include all current key attributes with valid values from their validValueOptions
|
|
322
|
+
|
|
323
|
+
## keyAttributeInstructions Format
|
|
324
|
+
Use \`dataStructurePath\` as key. Include variable name, instruction, AND a valueOptionRef that references which validValueOption you're using:
|
|
325
|
+
\`\`\`json
|
|
326
|
+
{
|
|
327
|
+
"useStatus().status": {
|
|
328
|
+
"localVariable": "status",
|
|
329
|
+
"instruction": "Set to 'active' mode",
|
|
330
|
+
"valueOptionRef": { "index": 0, "refType": "exact" }
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
\`\`\`
|
|
334
|
+
|
|
335
|
+
### valueOptionRef Types
|
|
336
|
+
- \`"exact"\`: Uses the validValueOption at this index exactly
|
|
337
|
+
- \`"derived"\`: Based on this validValueOption but modified (include \`derivation\` field explaining how)
|
|
338
|
+
- \`"custom"\`: Value not from validValueOptions list (use sparingly)
|
|
339
|
+
|
|
340
|
+
The \`index\` refers to the validValueOptions array position (0 = first option).
|
|
312
341
|
|
|
313
342
|
## Response Format
|
|
314
343
|
|
|
@@ -332,7 +361,11 @@ Otherwise:
|
|
|
332
361
|
"testName": "it(\\"shows empty message when no notifications\\")",
|
|
333
362
|
"description": "User has no notifications.",
|
|
334
363
|
"keyAttributeInstructions": {
|
|
335
|
-
"notifications[]": {
|
|
364
|
+
"useData().notifications[]": {
|
|
365
|
+
"localVariable": "notifications[]",
|
|
366
|
+
"instruction": "Empty array [] to show empty state",
|
|
367
|
+
"valueOptionRef": { "index": 1, "refType": "exact" }
|
|
368
|
+
}
|
|
336
369
|
}
|
|
337
370
|
}
|
|
338
371
|
]
|
|
@@ -342,7 +375,7 @@ Otherwise:
|
|
|
342
375
|
## Rules
|
|
343
376
|
- Scenario names: letters, numbers, spaces only
|
|
344
377
|
- testName: Jest style with specific expectations
|
|
345
|
-
- Use values from \`validValueOptions\` in key attributes list
|
|
378
|
+
- Use values from \`validValueOptions\` in key attributes list (reference by index)
|
|
346
379
|
- Include dependency key attributes if dependencies involved
|
|
347
380
|
- React elements: simple only (\`<div>\`, \`<span>\`)
|
|
348
381
|
- No external library references—plain JS/TS values
|
|
@@ -3,6 +3,7 @@ import isolateScopes from './isolateScopes';
|
|
|
3
3
|
import analyzeScope from './analyzeScope';
|
|
4
4
|
import { FileAnalyzer } from '~codeyam/analyze';
|
|
5
5
|
import { AI, SerializableDataStructure } from '~codeyam/ai';
|
|
6
|
+
import { resetScopeDataStructureMetrics } from './dataStructure/ScopeDataStructure';
|
|
6
7
|
|
|
7
8
|
// import { awsLog } from '~codeyam/utils';
|
|
8
9
|
|
|
@@ -17,6 +18,10 @@ export default async function generateEntityDataStructure({
|
|
|
17
18
|
fileAnalyzer,
|
|
18
19
|
model,
|
|
19
20
|
}: GenerateEntityDataStructureArgs): Promise<SerializableDataStructure> {
|
|
21
|
+
// Reset metrics counters to prevent false "infinite loop" detection when
|
|
22
|
+
// processing multiple entities in the same run
|
|
23
|
+
resetScopeDataStructureMetrics();
|
|
24
|
+
|
|
20
25
|
// awsLog('CodeYam: Generating entity data structure', {
|
|
21
26
|
// filePath: entity.filePath,
|
|
22
27
|
// entityName: entity.name,
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import completionCall from './completionCall';
|
|
2
2
|
import { saveLlmCall } from '~codeyam/aws/dynamodb';
|
|
3
|
-
import { DataStructure, Entity } from '~codeyam/types';
|
|
3
|
+
import { DataStructure, Entity, SourceLocation } from '~codeyam/types';
|
|
4
4
|
import generateEntityKeyAttributesGenerator from './promptGenerators/generateEntityKeyAttributesGenerator';
|
|
5
5
|
import { awsLog } from '~codeyam/utils';
|
|
6
6
|
import { DEFAULT_LARGER_MODEL } from './aiConfig';
|
|
7
7
|
import { gatherAttributesMap } from './promptGenerators/gatherAttributesMap';
|
|
8
8
|
import { fillInDirectSchemaGapsAndUnknowns } from './dataStructure/helpers/fillInSchemaGapsAndUnknowns';
|
|
9
|
+
import { clearAttributesFromMapping } from './dataStructure/helpers/cleanNonObjectFunctions';
|
|
9
10
|
import isFrontend from './isFrontend';
|
|
10
11
|
import { AI } from '~codeyam/ai';
|
|
11
12
|
import { formatConditionalUsagesForPrompt } from './getConditionalUsagesFromCode';
|
|
12
|
-
import type { ConditionalUsage } from '~codeyam/types';
|
|
13
|
+
import type { CompoundConditional, ConditionalUsage } from '~codeyam/types';
|
|
13
14
|
|
|
14
15
|
interface GenerateEntityKeyAttributesArgs {
|
|
15
16
|
entity: Pick<Entity, 'sha' | 'name' | 'filePath' | 'code' | 'metadata'>;
|
|
@@ -38,6 +39,11 @@ export default async function generateEntityKeyAttributes({
|
|
|
38
39
|
true,
|
|
39
40
|
);
|
|
40
41
|
|
|
42
|
+
// Clean the attributes map to remove primitive-returning array method paths
|
|
43
|
+
// like .includes().functionCallReturnValue, .indexOf().functionCallReturnValue, etc.
|
|
44
|
+
// These paths are not mockable and should not be presented as key attributes.
|
|
45
|
+
clearAttributesFromMapping(attributesMap);
|
|
46
|
+
|
|
41
47
|
if (Object.keys(attributesMap).length === 0) {
|
|
42
48
|
console.log(
|
|
43
49
|
`CodeYam Error: No valid attributes found for ${entity.filePath} ${entity.name}`,
|
|
@@ -48,17 +54,31 @@ export default async function generateEntityKeyAttributes({
|
|
|
48
54
|
};
|
|
49
55
|
}
|
|
50
56
|
|
|
57
|
+
// Build merged schema for type inference (has more complete nested paths)
|
|
58
|
+
// Strip signature[N] prefix to match attributesMap format
|
|
59
|
+
const mergedSchemaForTypeLookup = Object.fromEntries(
|
|
60
|
+
Object.entries(mergedDataStructure.signatureSchema ?? {})
|
|
61
|
+
.filter(([k]) => k.startsWith('signature['))
|
|
62
|
+
.map(([k, v]) => [k.replace(/^signature\[\d+\]\./, ''), v]),
|
|
63
|
+
);
|
|
64
|
+
|
|
51
65
|
// Resolve unknown types using heuristics (e.g., "unknown | undefined" -> "string | undefined")
|
|
66
|
+
// Pass mergedSchema so checkIfObjectOrFunction can detect nested paths that prove a type is an object
|
|
52
67
|
const resolvedAttributesMap = fillInDirectSchemaGapsAndUnknowns({
|
|
53
68
|
scopeName: entity.name,
|
|
54
69
|
schema: { ...attributesMap },
|
|
70
|
+
mergedSchema: mergedSchemaForTypeLookup,
|
|
55
71
|
});
|
|
56
72
|
|
|
57
73
|
// Use pre-computed conditional usages from metadata, or compute on-the-fly as fallback
|
|
58
74
|
const conditionalUsages: Record<string, ConditionalUsage[]> =
|
|
59
75
|
entity.metadata?.isolatedDataStructure?.conditionalUsages ?? {};
|
|
60
|
-
const
|
|
61
|
-
|
|
76
|
+
const compoundConditionals: CompoundConditional[] =
|
|
77
|
+
entity.metadata?.isolatedDataStructure?.compoundConditionals ?? [];
|
|
78
|
+
const staticAnalysisContext = formatConditionalUsagesForPrompt(
|
|
79
|
+
conditionalUsages,
|
|
80
|
+
compoundConditionals,
|
|
81
|
+
);
|
|
62
82
|
|
|
63
83
|
const prompt = generateEntityKeyAttributesGenerator({
|
|
64
84
|
code: entity.code,
|
|
@@ -133,6 +153,106 @@ export default async function generateEntityKeyAttributes({
|
|
|
133
153
|
]),
|
|
134
154
|
);
|
|
135
155
|
|
|
156
|
+
// Helper to extract source locations from conditional usages for a given path
|
|
157
|
+
const getSourceLocationsForPath = (path: string): SourceLocation[] => {
|
|
158
|
+
const usages = conditionalUsages[path] || [];
|
|
159
|
+
const locations: SourceLocation[] = [];
|
|
160
|
+
|
|
161
|
+
for (const usage of usages.slice(0, 5)) {
|
|
162
|
+
// Limit to 5 locations
|
|
163
|
+
if (usage.sourceLocation) {
|
|
164
|
+
locations.push({
|
|
165
|
+
entityName: entity.name,
|
|
166
|
+
filePath: entity.filePath,
|
|
167
|
+
lineNumber: usage.sourceLocation.lineNumber,
|
|
168
|
+
column: usage.sourceLocation.column,
|
|
169
|
+
codeSnippet: usage.sourceLocation.codeSnippet,
|
|
170
|
+
usageType: 'conditional',
|
|
171
|
+
description: `Used in ${usage.location} statement (${usage.conditionType} check)`,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return locations;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
// Helper to find source locations by matching sourceDataPath
|
|
180
|
+
// This handles cases where local variables (e.g., displayState.hasError) trace back
|
|
181
|
+
// to data structure paths (e.g., getScenarioDisplayState().functionCallReturnValue.hasError)
|
|
182
|
+
const getSourceLocationsBySourceDataPath = (
|
|
183
|
+
targetPath: string,
|
|
184
|
+
): SourceLocation[] => {
|
|
185
|
+
const locations: SourceLocation[] = [];
|
|
186
|
+
|
|
187
|
+
// Search all conditional usages for ones whose sourceDataPath matches
|
|
188
|
+
for (const [, usages] of Object.entries(conditionalUsages)) {
|
|
189
|
+
for (const usage of usages) {
|
|
190
|
+
const sourceDataPath = (usage as { sourceDataPath?: string })
|
|
191
|
+
.sourceDataPath;
|
|
192
|
+
if (!sourceDataPath || !usage.sourceLocation) continue;
|
|
193
|
+
|
|
194
|
+
// Check if sourceDataPath ends with the target path
|
|
195
|
+
// e.g., "LibraryFunctionPreview.signature[0].isOutdated" ends with "isOutdated"
|
|
196
|
+
// or "getScenarioDisplayState.getScenarioDisplayState(...).functionCallReturnValue.hasError" ends with "hasError"
|
|
197
|
+
const normalizedSourcePath = sourceDataPath
|
|
198
|
+
.replace(/\.functionCallReturnValue/g, '')
|
|
199
|
+
.replace(/\([^)]*\)/g, '()');
|
|
200
|
+
|
|
201
|
+
if (
|
|
202
|
+
normalizedSourcePath.endsWith('.' + targetPath) ||
|
|
203
|
+
normalizedSourcePath.endsWith('.' + targetPath.replace(/\./g, '.'))
|
|
204
|
+
) {
|
|
205
|
+
locations.push({
|
|
206
|
+
entityName: entity.name,
|
|
207
|
+
filePath: entity.filePath,
|
|
208
|
+
lineNumber: usage.sourceLocation.lineNumber,
|
|
209
|
+
column: usage.sourceLocation.column,
|
|
210
|
+
codeSnippet: usage.sourceLocation.codeSnippet,
|
|
211
|
+
usageType: 'conditional',
|
|
212
|
+
description: `Used in ${usage.location} statement (${usage.conditionType} check)`,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return locations.slice(0, 5); // Limit to 5
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
// Helper to find source locations from LLM-provided code snippets
|
|
222
|
+
const getSourceLocationsFromSnippets = (
|
|
223
|
+
codeSnippets: string[] | undefined,
|
|
224
|
+
): SourceLocation[] => {
|
|
225
|
+
if (!codeSnippets || !Array.isArray(codeSnippets)) return [];
|
|
226
|
+
|
|
227
|
+
const locations: SourceLocation[] = [];
|
|
228
|
+
const codeLines = entity.code.split('\n');
|
|
229
|
+
|
|
230
|
+
for (const snippet of codeSnippets.slice(0, 3)) {
|
|
231
|
+
// Limit to 3 snippets
|
|
232
|
+
if (!snippet || typeof snippet !== 'string') continue;
|
|
233
|
+
|
|
234
|
+
// Normalize whitespace for matching
|
|
235
|
+
const normalizedSnippet = snippet.trim().replace(/\s+/g, ' ');
|
|
236
|
+
|
|
237
|
+
for (let i = 0; i < codeLines.length; i++) {
|
|
238
|
+
const normalizedLine = codeLines[i].replace(/\s+/g, ' ');
|
|
239
|
+
if (normalizedLine.includes(normalizedSnippet)) {
|
|
240
|
+
locations.push({
|
|
241
|
+
entityName: entity.name,
|
|
242
|
+
filePath: entity.filePath,
|
|
243
|
+
lineNumber: i + 1, // 1-based line numbers
|
|
244
|
+
codeSnippet: codeLines[i].trim(),
|
|
245
|
+
usageType: 'conditional',
|
|
246
|
+
description: `Key usage identified by analysis`,
|
|
247
|
+
});
|
|
248
|
+
break; // Only find first occurrence of each snippet
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return locations;
|
|
254
|
+
};
|
|
255
|
+
|
|
136
256
|
const fullKeyAttributes = keyAttributes
|
|
137
257
|
.filter(Boolean)
|
|
138
258
|
.filter(
|
|
@@ -144,6 +264,46 @@ export default async function generateEntityKeyAttributes({
|
|
|
144
264
|
.filter((keyAttribute) => fullPathToInternalPath[keyAttribute.fullPath])
|
|
145
265
|
.map((keyAttribute) => {
|
|
146
266
|
const internalPath = fullPathToInternalPath[keyAttribute.fullPath];
|
|
267
|
+
|
|
268
|
+
// Get source locations from conditional usages
|
|
269
|
+
// Try multiple path formats since conditionalUsages might use different formats:
|
|
270
|
+
// - internalPath: the short path like "status"
|
|
271
|
+
// - fullPath: the LLM's path like "signature[0].status"
|
|
272
|
+
// - dataStructurePath: the external path like "useStatus().status"
|
|
273
|
+
// - Also try stripping signature[N] prefix since conditional usages use AST paths
|
|
274
|
+
let sourceLocations = getSourceLocationsForPath(internalPath);
|
|
275
|
+
if (sourceLocations.length === 0) {
|
|
276
|
+
sourceLocations = getSourceLocationsForPath(keyAttribute.fullPath);
|
|
277
|
+
}
|
|
278
|
+
if (sourceLocations.length === 0) {
|
|
279
|
+
const dataStructurePath =
|
|
280
|
+
dataStructurePathMap[internalPath] || keyAttribute.fullPath;
|
|
281
|
+
sourceLocations = getSourceLocationsForPath(dataStructurePath);
|
|
282
|
+
}
|
|
283
|
+
// Also try the path without signature[N] prefix since AST uses local variable names
|
|
284
|
+
if (sourceLocations.length === 0) {
|
|
285
|
+
const pathWithoutSignature = internalPath.replace(
|
|
286
|
+
/^signature\[\d+\]\./,
|
|
287
|
+
'',
|
|
288
|
+
);
|
|
289
|
+
if (pathWithoutSignature !== internalPath) {
|
|
290
|
+
sourceLocations = getSourceLocationsForPath(pathWithoutSignature);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
// Finally, search by sourceDataPath which traces local variables back to data sources
|
|
294
|
+
// This handles cases like displayState.hasError → getScenarioDisplayState().hasError
|
|
295
|
+
if (sourceLocations.length === 0) {
|
|
296
|
+
sourceLocations = getSourceLocationsBySourceDataPath(internalPath);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// Last resort: use LLM-provided code snippets to find source locations
|
|
300
|
+
// This ensures every key attribute the LLM identifies has a source location
|
|
301
|
+
if (sourceLocations.length === 0 && keyAttribute.codeSnippets) {
|
|
302
|
+
sourceLocations = getSourceLocationsFromSnippets(
|
|
303
|
+
keyAttribute.codeSnippets,
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
|
|
147
307
|
return {
|
|
148
308
|
internalPath,
|
|
149
309
|
externalPath: associationMap[internalPath],
|
|
@@ -155,6 +315,9 @@ export default async function generateEntityKeyAttributes({
|
|
|
155
315
|
// Preserve new fields from LLM response
|
|
156
316
|
valueType: keyAttribute.valueType,
|
|
157
317
|
dependencies: keyAttribute.dependencies,
|
|
318
|
+
// Add source locations from static analysis or LLM snippets
|
|
319
|
+
sourceLocations:
|
|
320
|
+
sourceLocations.length > 0 ? sourceLocations : undefined,
|
|
158
321
|
};
|
|
159
322
|
});
|
|
160
323
|
|
|
@@ -184,15 +347,31 @@ NOT key attributes:
|
|
|
184
347
|
|
|
185
348
|
We've provided a list of variables that are used in conditional statements in the code. These are very likely key attributes.
|
|
186
349
|
|
|
187
|
-
Each conditional lists
|
|
350
|
+
Each conditional lists its source and how it is used. This should help you identify which attributes to include and what values to suggest.
|
|
351
|
+
|
|
352
|
+
**IMPORTANT**: Only include attributes with explicit evidence of impact in THIS code:
|
|
353
|
+
- Used directly in a conditional statement (if/ternary/switch)
|
|
354
|
+
- Displayed or rendered directly (e.g., text content, list length)
|
|
355
|
+
- Used in a computation that affects rendering
|
|
356
|
+
|
|
357
|
+
Do NOT include attributes that are only passed as arguments to other functions without direct usage here. We analyze those functions separately and merge their key attributes automatically.
|
|
188
358
|
|
|
189
359
|
## Path Format
|
|
190
360
|
|
|
191
361
|
Only return attributes from the "Attributes and Value Types" list — these are the only values we can control. Use the exact \`fullPath\` provided. Use \`functionCallReturnValue\` for function return values. Use \`[]\` for array items (e.g., \`items[]\`).
|
|
192
362
|
|
|
193
|
-
## Dependencies
|
|
363
|
+
## Dependencies and Compound Conditionals
|
|
364
|
+
|
|
365
|
+
When attributes are used in && chains (compound conditionals), they form dependencies on each other:
|
|
366
|
+
- Each attribute in the chain only has effect when ALL other conditions in the chain are satisfied
|
|
367
|
+
- Include these as dependencies with the required value for the code path to execute
|
|
194
368
|
|
|
195
|
-
|
|
369
|
+
Example: For \`a && b && !c\`:
|
|
370
|
+
- \`a\` has dependencies: \`b\` must be truthy, \`c\` must be falsy
|
|
371
|
+
- \`b\` has dependencies: \`a\` must be truthy, \`c\` must be falsy
|
|
372
|
+
- \`c\` has dependencies: \`a\` must be truthy, \`b\` must be truthy (for the falsy check to matter)
|
|
373
|
+
|
|
374
|
+
The static analysis section may show "Compound Conditionals" that list which conditions must be true together. Use this to populate the \`dependencies\` array with \`{ "path": "...", "requiredValue": "..." }\` entries.
|
|
196
375
|
|
|
197
376
|
## Value Type
|
|
198
377
|
|
|
@@ -218,8 +397,9 @@ List all key attributes in order from most impactful to least impactful regardin
|
|
|
218
397
|
{
|
|
219
398
|
"fullPath": "signature[0].user",
|
|
220
399
|
"description": "Controls whether the main form or redirect screen displays",
|
|
400
|
+
"codeSnippets": ["if (!user) return <Redirect />", "user.name"],
|
|
221
401
|
"dependencies": [
|
|
222
|
-
"signature[0].projectId": "must be a valid project ID for 'user' to have effect"
|
|
402
|
+
{ "path": "signature[0].projectId", "requiredValue": "truthy", "description": "must be a valid project ID for 'user' to have effect" }
|
|
223
403
|
],
|
|
224
404
|
"valueType": "object",
|
|
225
405
|
"validValueOptions": ["an empty object {}", "null/undefined"]
|
|
@@ -227,6 +407,8 @@ List all key attributes in order from most impactful to least impactful regardin
|
|
|
227
407
|
]
|
|
228
408
|
}
|
|
229
409
|
\`\`\`
|
|
410
|
+
|
|
411
|
+
The \`codeSnippets\` field is required - provide 1-3 short code excerpts (under 80 chars each) showing exactly where and how this attribute is used. These snippets must appear verbatim in the code.
|
|
230
412
|
`;
|
|
231
413
|
|
|
232
414
|
const BACKEND_SYSTEM_MESSAGE = `You analyze backend functions to identify key data attributes that significantly impact behavior.
|
|
@@ -248,15 +430,31 @@ NOT key attributes:
|
|
|
248
430
|
|
|
249
431
|
We've provided a list of variables that are used in conditional statements in the code. These are very likely key attributes.
|
|
250
432
|
|
|
251
|
-
Each conditional lists
|
|
433
|
+
Each conditional lists its source and how it is used. This should help you identify which attributes to include and what values to suggest.
|
|
434
|
+
|
|
435
|
+
**IMPORTANT**: Only include attributes with explicit evidence of impact in THIS code:
|
|
436
|
+
- Used directly in a conditional statement (if/ternary/switch)
|
|
437
|
+
- Displayed or rendered directly (e.g., text content, list length)
|
|
438
|
+
- Used in a computation that affects rendering
|
|
439
|
+
|
|
440
|
+
Do NOT include attributes that are only passed as arguments to other functions without direct usage here. We analyze those functions separately and merge their key attributes automatically.
|
|
252
441
|
|
|
253
442
|
## Path Format
|
|
254
443
|
|
|
255
444
|
Only return attributes from the "Attributes and Value Types" list — these are the only values we can control. Use the exact \`fullPath\` provided. Use \`functionCallReturnValue\` for function return values. Use \`[]\` for array items (e.g., \`items[]\`).
|
|
256
445
|
|
|
257
|
-
## Dependencies
|
|
446
|
+
## Dependencies and Compound Conditionals
|
|
258
447
|
|
|
259
|
-
|
|
448
|
+
When attributes are used in && chains (compound conditionals), they form dependencies on each other:
|
|
449
|
+
- Each attribute in the chain only has effect when ALL other conditions in the chain are satisfied
|
|
450
|
+
- Include these as dependencies with the required value for the code path to execute
|
|
451
|
+
|
|
452
|
+
Example: For \`a && b && !c\`:
|
|
453
|
+
- \`a\` has dependencies: \`b\` must be truthy, \`c\` must be falsy
|
|
454
|
+
- \`b\` has dependencies: \`a\` must be truthy, \`c\` must be falsy
|
|
455
|
+
- \`c\` has dependencies: \`a\` must be truthy, \`b\` must be truthy (for the falsy check to matter)
|
|
456
|
+
|
|
457
|
+
The static analysis section may show "Compound Conditionals" that list which conditions must be true together. Use this to populate the \`dependencies\` array with \`{ "path": "...", "requiredValue": "..." }\` entries.
|
|
260
458
|
|
|
261
459
|
## Value Type
|
|
262
460
|
|
|
@@ -282,8 +480,9 @@ List all key attributes in order from most impactful to least impactful using th
|
|
|
282
480
|
{
|
|
283
481
|
"fullPath": "signature[0].config.enabled",
|
|
284
482
|
"description": "Controls whether the main processing logic runs",
|
|
483
|
+
"codeSnippets": ["if (!config.enabled) return", "enabled && processData()"],
|
|
285
484
|
"dependencies": [
|
|
286
|
-
"signature[0].analysisMode": "must be 'full' for 'enabled' to have effect"
|
|
485
|
+
{ "path": "signature[0].analysisMode", "requiredValue": "full", "description": "must be 'full' for 'enabled' to have effect" }
|
|
287
486
|
],
|
|
288
487
|
"valueType": "boolean",
|
|
289
488
|
"validValueOptions": ["true", "false"]
|
|
@@ -291,4 +490,6 @@ List all key attributes in order from most impactful to least impactful using th
|
|
|
291
490
|
]
|
|
292
491
|
}
|
|
293
492
|
\`\`\`
|
|
493
|
+
|
|
494
|
+
The \`codeSnippets\` field is required - provide 1-3 short code excerpts (under 80 chars each) showing exactly where and how this attribute is used. These snippets must appear verbatim in the code.
|
|
294
495
|
`;
|
|
@@ -318,29 +318,25 @@ Use for relative dates. Code runs in Node (no browser APIs, no external librarie
|
|
|
318
318
|
Use simple elements only (\`<div>\`, \`<span>\`). No custom components.
|
|
319
319
|
|
|
320
320
|
## Mock Data Keys
|
|
321
|
-
|
|
321
|
+
**CRITICAL: Use keys EXACTLY as provided in the structure. Do NOT change key formats.**
|
|
322
322
|
|
|
323
|
-
|
|
323
|
+
Keys use the canonical format: \`EntityName::hookName::index\`
|
|
324
324
|
\`\`\`json
|
|
325
325
|
{
|
|
326
326
|
"mockData": {
|
|
327
|
-
"
|
|
328
|
-
"
|
|
327
|
+
"DashboardPage::useLoaderData::0": { "user": { "name": "John" } },
|
|
328
|
+
"DashboardPage::useFetcher::0": { "data": null, "state": "idle" },
|
|
329
|
+
"DashboardPage::useFetcher::1": { "data": { "reportId": "abc123" } }
|
|
329
330
|
}
|
|
330
331
|
}
|
|
331
332
|
\`\`\`
|
|
332
333
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
"reportFetcher <- useFetcher": { "data": { "reportId": "abc123" }, "state": "idle" }
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
\`\`\`
|
|
343
|
-
This reads as "entityDiffFetcher receives from useFetcher". Each variable gets its own distinct mock data.
|
|
334
|
+
The format is deterministic:
|
|
335
|
+
- \`EntityName\` - the component name
|
|
336
|
+
- \`hookName\` - the function/hook being called
|
|
337
|
+
- \`index\` - distinguishes multiple calls to the same hook (0, 1, 2...)
|
|
338
|
+
|
|
339
|
+
**You MUST use the exact keys provided in the structure. Do NOT substitute variable names or use alternative formats.**
|
|
344
340
|
|
|
345
341
|
## Response Format
|
|
346
342
|
\`\`\`json
|