@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
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Testing writeScenarioComponents
|
|
2
|
+
|
|
3
|
+
This document describes how to test changes to `writeScenarioComponents.ts`.
|
|
4
|
+
|
|
5
|
+
## 1. Run the specific test
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx jest background/src/lib/virtualized/project/__tests__/writeScenarioComponents.test.ts -t "test name here" --no-coverage
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 2. Run all tests in the file
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx jest background/src/lib/virtualized/project/__tests__/writeScenarioComponents.test.ts --no-coverage -w 2
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 3. Rebuild and reinstall the CLI
|
|
18
|
+
|
|
19
|
+
The globally installed CLI must be reinstalled to pick up changes:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Remove the globally installed CLI and rebuild
|
|
23
|
+
rm -rf /Users/jaredcosulich/.nvm/versions/node/v20.16.0/lib/node_modules/@codeyam/codeyam-cli && pnpm cli
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 4. Restart the server in the client project
|
|
27
|
+
|
|
28
|
+
After rebuilding the CLI, restart the codeyam server in the client project:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
cd /Users/jaredcosulich/workspace/codeyam/formbricks && codeyam stop & codeyam
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## 5. Force analyzer update and run debug
|
|
35
|
+
|
|
36
|
+
The analyzer is cached in `/tmp/codeyam/local-dev/{project-slug}/codeyam/analyzer`.
|
|
37
|
+
To force it to use the new code:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Remove cached analyzer
|
|
41
|
+
rm -rf /tmp/codeyam/local-dev/formbricks-formbricks/codeyam/analyzer
|
|
42
|
+
|
|
43
|
+
# Run debug (from the project directory)
|
|
44
|
+
cd /Users/jaredcosulich/workspace/codeyam/formbricks && codeyam debug <analysis-id>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 6. Verify the fix
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Check version in logs (should match version in writeScenarioComponents.ts)
|
|
51
|
+
grep "CodeYam \[v" /tmp/codeyam/local-dev/formbricks-formbricks/codeyam/log.txt | tail -3
|
|
52
|
+
|
|
53
|
+
# Check generated files
|
|
54
|
+
head -30 /tmp/codeyam/local-dev/formbricks-formbricks/project/path/to/generated/file.tsx
|
|
55
|
+
|
|
56
|
+
# List data scenario files
|
|
57
|
+
ls -la /tmp/codeyam/local-dev/formbricks-formbricks/project/apps/web/lib/*_data_Default_Scenario*
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## 7. Start dev server and test in browser
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
cd /tmp/codeyam/local-dev/formbricks-formbricks/project/apps/web && pnpm next dev --turbopack -p 3112
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Test the actual simulation page (not just codeyam-sample):
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Format: /static/{project-slug}/{analysis-id}/{entity-name}/{scenario-name}/default
|
|
70
|
+
curl http://localhost:3112/static/formbricks-formbricks/7925cfe4-7789-470d-bddc-2a85e48ef356/SurveysPage/Default_Scenario/default
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Visit in browser: http://localhost:3112/static/formbricks-formbricks/7925cfe4-7789-470d-bddc-2a85e48ef356/SurveysPage/Default_Scenario/default
|
|
74
|
+
|
|
75
|
+
## Version Tracking
|
|
76
|
+
|
|
77
|
+
The version is defined in `writeScenarioComponents.ts`:
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
const WRITE_SCENARIO_COMPONENTS_VERSION = '2.5.13-strip-use-server-directive';
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Increment this when making changes to help track which version is running.
|
|
@@ -206,6 +206,8 @@ export default function constructMockCode(
|
|
|
206
206
|
mockName: string,
|
|
207
207
|
dependencySchemas: DeepReadonly<DataStructure['dependencySchemas']>,
|
|
208
208
|
entityType?: EntityType,
|
|
209
|
+
canonicalKey?: string,
|
|
210
|
+
options?: { keepOriginalFunctionName?: boolean },
|
|
209
211
|
) {
|
|
210
212
|
// Check for variable-qualified mock name (e.g., "entityDiffFetcher <- useFetcher")
|
|
211
213
|
// Format: "variableName <- functionName" which reads naturally as "variableName receives from functionName"
|
|
@@ -412,11 +414,15 @@ export default function constructMockCode(
|
|
|
412
414
|
// so "useLoaderData<typeof loader>()" becomes "useLoaderData()"
|
|
413
415
|
name = cleanOutTypes(name);
|
|
414
416
|
|
|
415
|
-
// For
|
|
416
|
-
//
|
|
417
|
-
|
|
417
|
+
// For root data access, use the canonical key if provided
|
|
418
|
+
// Canonical keys use format: EntityName::hookName::index (e.g., "Dashboard::useLoaderData::0")
|
|
419
|
+
if (isRootAccess && canonicalKey) {
|
|
420
|
+
return `?.["${canonicalKey}"]`;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// Fallback for variable-qualified mocks when no canonical key provided
|
|
424
|
+
// Format: "variableName <- functionName" (legacy format)
|
|
418
425
|
if (isRootAccess && variableQualifier) {
|
|
419
|
-
// Remove trailing () from the function name to match gatherDataForMocks key format
|
|
420
426
|
const baseName = name.replace(/\(\)$/, '');
|
|
421
427
|
name = `${variableQualifier} <- ${baseName}`;
|
|
422
428
|
}
|
|
@@ -662,10 +668,19 @@ export default function constructMockCode(
|
|
|
662
668
|
// When GENERIC array (using []) has nested content (like functions that need wrapping),
|
|
663
669
|
// use .map() to transform ALL elements instead of just creating [0]
|
|
664
670
|
// For DIFFERENTIATED arrays (using [0], [1], etc.), keep the static array structure
|
|
671
|
+
//
|
|
672
|
+
// IMPORTANT: If the nested content contains differentiated indices like [0], [1],
|
|
673
|
+
// we MUST use static array pattern, not .map(). The presence of differentiated
|
|
674
|
+
// indices means the array elements have different types/structures, so .map()
|
|
675
|
+
// would generate invalid code trying to treat them uniformly.
|
|
676
|
+
const hasDifferentiatedIndices =
|
|
677
|
+
nested &&
|
|
678
|
+
nested.some((n) => n.name.match(/^\[\d+\]$/) && n.name !== '[0]');
|
|
665
679
|
if (
|
|
666
680
|
isGenericArray &&
|
|
667
681
|
nestedContent.length > 0 &&
|
|
668
|
-
dataPaths.length > 0
|
|
682
|
+
dataPaths.length > 0 &&
|
|
683
|
+
!hasDifferentiatedIndices
|
|
669
684
|
) {
|
|
670
685
|
// Get the array base path (without the [0])
|
|
671
686
|
const arrayBasePath = dataPaths[0].replace(/\?\.\[0\]$/, '');
|
|
@@ -698,6 +713,13 @@ export default function constructMockCode(
|
|
|
698
713
|
if (args && args.length > 0) {
|
|
699
714
|
if (!isValidKey(name)) return;
|
|
700
715
|
|
|
716
|
+
// Skip array index patterns like [], [0], [1] when they have args
|
|
717
|
+
// These represent function calls on array elements, not property keys
|
|
718
|
+
// e.g., customSizes[].(args) means each array element is callable, not a property named "[]"
|
|
719
|
+
if (name.match(/^\[\d*\]$/)) {
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
|
|
701
723
|
const mostArgs = args.sort(
|
|
702
724
|
(a: string[], b: string[]) => b.length - a.length,
|
|
703
725
|
)[0];
|
|
@@ -757,8 +779,18 @@ export default function constructMockCode(
|
|
|
757
779
|
// Use all paths for fallback (existing behavior)
|
|
758
780
|
fallbackContent = `return ${returnValueContents}`;
|
|
759
781
|
} else {
|
|
760
|
-
//
|
|
761
|
-
|
|
782
|
+
// No explicit fallback paths - return the first literal's value as default
|
|
783
|
+
// Returning spread of all values is dangerous because if values are primitives (strings),
|
|
784
|
+
// spreading them creates objects with numeric keys like {0:'a', 1:'b', ...}
|
|
785
|
+
// which causes "Objects are not valid as React child" errors
|
|
786
|
+
const firstLiteralValue = literalKeys[0];
|
|
787
|
+
const firstGroupPaths = argGroups.get(firstLiteralValue);
|
|
788
|
+
if (firstGroupPaths && firstGroupPaths.length === 1) {
|
|
789
|
+
fallbackContent = `return ${firstGroupPaths[0]}`;
|
|
790
|
+
} else {
|
|
791
|
+
// Multiple paths for first literal - return undefined as safe fallback
|
|
792
|
+
fallbackContent = `return undefined`;
|
|
793
|
+
}
|
|
762
794
|
}
|
|
763
795
|
|
|
764
796
|
const funcContents =
|
|
@@ -888,6 +920,39 @@ export default function constructMockCode(
|
|
|
888
920
|
'jsx-component';
|
|
889
921
|
if (isJsxComponent) continue;
|
|
890
922
|
|
|
923
|
+
// Skip paths that bypass .functionCallReturnValue when there's a corresponding path with it.
|
|
924
|
+
// Example: If we have both:
|
|
925
|
+
// - trpc.customer.useQuery(...).data (incorrect - no .functionCallReturnValue)
|
|
926
|
+
// - trpc.customer.useQuery(...).functionCallReturnValue.data (correct)
|
|
927
|
+
// We should skip the first path because the second one properly captures the return value.
|
|
928
|
+
// This can happen when the analyzer sees both the raw property access and the return value structure.
|
|
929
|
+
if (!hasFunctionCallReturnValue) {
|
|
930
|
+
// This path has no .functionCallReturnValue. Check if any function call in this path
|
|
931
|
+
// has a corresponding .functionCallReturnValue path in the schema.
|
|
932
|
+
let shouldSkipKey = false;
|
|
933
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
934
|
+
const part = parts[i];
|
|
935
|
+
if (part.endsWith(')') && !isFunctionCallReturnValue(parts[i + 1])) {
|
|
936
|
+
// This part is a function call, and the next part is NOT .functionCallReturnValue
|
|
937
|
+
// Check if there's any path with .functionCallReturnValue for this function call
|
|
938
|
+
const functionCallPath = joinParenthesesAndArrays(
|
|
939
|
+
parts.slice(0, i + 1),
|
|
940
|
+
);
|
|
941
|
+
const hasProperFunctionCallPath = Object.keys(
|
|
942
|
+
relevantReturnValueSchema,
|
|
943
|
+
).some((k) =>
|
|
944
|
+
k.startsWith(functionCallPath + '.functionCallReturnValue'),
|
|
945
|
+
);
|
|
946
|
+
if (hasProperFunctionCallPath) {
|
|
947
|
+
// Skip this path - the .functionCallReturnValue path will handle it correctly
|
|
948
|
+
shouldSkipKey = true;
|
|
949
|
+
break;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
if (shouldSkipKey) continue;
|
|
954
|
+
}
|
|
955
|
+
|
|
891
956
|
const isFunctionPath =
|
|
892
957
|
['function', 'async-function'].includes(value) &&
|
|
893
958
|
parts[parts.length - 1].endsWith(')') &&
|
|
@@ -1197,17 +1262,22 @@ export default function constructMockCode(
|
|
|
1197
1262
|
) {
|
|
1198
1263
|
returnValueSection.nested.push(relevantPart);
|
|
1199
1264
|
}
|
|
1200
|
-
} else
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
const
|
|
1205
|
-
|
|
1206
|
-
|
|
1265
|
+
} else {
|
|
1266
|
+
// Add args to existing entry if current part has function arguments
|
|
1267
|
+
// This handles the case where bare `t` is processed first (creating {name: 't', args: undefined})
|
|
1268
|
+
// and then `t("common.close")` is processed - we need to add its args to the existing entry
|
|
1269
|
+
const currentArgs = funcArgs(part);
|
|
1270
|
+
const hasNewArgs = currentArgs.length > 0 || part.includes('(');
|
|
1271
|
+
|
|
1272
|
+
if (hasNewArgs) {
|
|
1273
|
+
const existingArgs = relevantPart.args?.find(
|
|
1274
|
+
(args) => args.join(',') === currentArgs.join(','),
|
|
1275
|
+
);
|
|
1207
1276
|
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1277
|
+
if (!existingArgs) {
|
|
1278
|
+
relevantPart.args ||= [];
|
|
1279
|
+
relevantPart.args.push(currentArgs);
|
|
1280
|
+
}
|
|
1211
1281
|
}
|
|
1212
1282
|
}
|
|
1213
1283
|
|
|
@@ -1289,12 +1359,14 @@ export default function constructMockCode(
|
|
|
1289
1359
|
let enhancedContents = contents;
|
|
1290
1360
|
if (needsIteratorMethods && contents.trim().startsWith('{')) {
|
|
1291
1361
|
// Add iterator methods that operate on the scenario data
|
|
1362
|
+
// Use canonical key if provided, otherwise fall back to legacy format
|
|
1363
|
+
const dataKey = canonicalKey || `${mockName}()`;
|
|
1292
1364
|
const iteratorMethods = `,
|
|
1293
|
-
entries: () => Object.entries(scenarios().data()?.["${
|
|
1294
|
-
keys: () => Object.keys(scenarios().data()?.["${
|
|
1295
|
-
values: () => Object.values(scenarios().data()?.["${
|
|
1296
|
-
forEach: (fn) => Object.entries(scenarios().data()?.["${
|
|
1297
|
-
has: (key) => Object.prototype.hasOwnProperty.call(scenarios().data()?.["${
|
|
1365
|
+
entries: () => Object.entries(scenarios().data()?.["${dataKey}"] || {}),
|
|
1366
|
+
keys: () => Object.keys(scenarios().data()?.["${dataKey}"] || {}),
|
|
1367
|
+
values: () => Object.values(scenarios().data()?.["${dataKey}"] || {}),
|
|
1368
|
+
forEach: (fn) => Object.entries(scenarios().data()?.["${dataKey}"] || {}).forEach(([k, v]) => fn(v, k)),
|
|
1369
|
+
has: (key) => Object.prototype.hasOwnProperty.call(scenarios().data()?.["${dataKey}"] || {}, key)`;
|
|
1298
1370
|
// Insert before the closing brace (handle trailing whitespace)
|
|
1299
1371
|
enhancedContents = contents.replace(/\}\s*$/, iteratorMethods + '\n}');
|
|
1300
1372
|
}
|
|
@@ -1311,12 +1383,14 @@ export default function constructMockCode(
|
|
|
1311
1383
|
const nameAssignment = isErrorSubclass
|
|
1312
1384
|
? `this.name = '${mockName}';`
|
|
1313
1385
|
: '';
|
|
1386
|
+
// Use canonical key if provided, otherwise fall back to legacy format
|
|
1387
|
+
const dataKey = canonicalKey || `${mockName}()`;
|
|
1314
1388
|
|
|
1315
1389
|
return `class ${mockName}${isErrorSubclass ? ' extends Error' : ''} {
|
|
1316
1390
|
constructor(message) {
|
|
1317
1391
|
${superCall}
|
|
1318
1392
|
${nameAssignment}
|
|
1319
|
-
Object.assign(this, scenarios().data()?.["${
|
|
1393
|
+
Object.assign(this, scenarios().data()?.["${dataKey}"] || {});
|
|
1320
1394
|
}
|
|
1321
1395
|
}`;
|
|
1322
1396
|
}
|
|
@@ -1324,17 +1398,64 @@ export default function constructMockCode(
|
|
|
1324
1398
|
// For variable-qualified mocks, use underscore separator in the function name
|
|
1325
1399
|
// e.g., "entityDiffFetcher <- useFetcher" becomes "useFetcher_entityDiffFetcher"
|
|
1326
1400
|
// For indexed qualifiers like "data[1]", convert to safe identifier: "useFetcher_data_1"
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1401
|
+
// EXCEPTION: When keepOriginalFunctionName is true (for single-call cases), use the base name
|
|
1402
|
+
const safeFunctionName =
|
|
1403
|
+
variableQualifier && !options?.keepOriginalFunctionName
|
|
1404
|
+
? `${baseMockName}_${safeVariableQualifier(variableQualifier)}`
|
|
1405
|
+
: baseMockName;
|
|
1406
|
+
|
|
1407
|
+
// Check if this function returns a function (detected by double-call pattern: mockName(args)())
|
|
1408
|
+
// This happens when the schema has keys like "wrapThrows(() => JSON.parse(savedFilters))()"
|
|
1409
|
+
// where the function call is immediately followed by another call.
|
|
1410
|
+
// Example usage: const result = wrapThrows(() => JSON.parse(x))(); // double call
|
|
1411
|
+
const isHigherOrderFunction = Object.keys(
|
|
1412
|
+
relevantReturnValueSchema ?? {},
|
|
1413
|
+
).some((key) => {
|
|
1414
|
+
if (!key.startsWith(baseMockName)) return false;
|
|
1415
|
+
|
|
1416
|
+
// Find the first ( after baseMockName (the start of the function call)
|
|
1417
|
+
const firstOpenParen = key.indexOf('(', baseMockName.length);
|
|
1418
|
+
if (firstOpenParen === -1) return false;
|
|
1419
|
+
|
|
1420
|
+
// Skip if the ( is not immediately after the mock name
|
|
1421
|
+
// (there might be type params like func<T>() - handle by checking for < or ()
|
|
1422
|
+
const between = key.slice(baseMockName.length, firstOpenParen);
|
|
1423
|
+
if (between.length > 0 && !between.startsWith('<')) return false;
|
|
1424
|
+
|
|
1425
|
+
// Find the matching ) for the first ( using depth counting
|
|
1426
|
+
let depth = 1;
|
|
1427
|
+
let i = firstOpenParen + 1;
|
|
1428
|
+
while (i < key.length && depth > 0) {
|
|
1429
|
+
if (key[i] === '(') depth++;
|
|
1430
|
+
if (key[i] === ')') depth--;
|
|
1431
|
+
i++;
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
if (depth !== 0) return false; // Unbalanced parentheses
|
|
1435
|
+
|
|
1436
|
+
// Now i points just after the matching )
|
|
1437
|
+
// Check if there's another ( immediately (indicating double call)
|
|
1438
|
+
const remaining = key.slice(i);
|
|
1439
|
+
if (remaining.startsWith('(')) return true;
|
|
1440
|
+
|
|
1441
|
+
return false;
|
|
1442
|
+
});
|
|
1443
|
+
|
|
1444
|
+
// For higher-order functions, wrap the return in an arrow function
|
|
1445
|
+
// so that mockFunc(arg)() works correctly (outer call returns a function, inner call gets the data)
|
|
1446
|
+
const returnValue = isHigherOrderFunction
|
|
1447
|
+
? `() => ${safeFunctionName}ReturnValue`
|
|
1448
|
+
: `${safeFunctionName}ReturnValue`;
|
|
1330
1449
|
|
|
1331
|
-
return `const ${safeFunctionName}ReturnValue = ${enhancedContents};\n\n${isRootAsyncFunction ? 'async ' : ''}function ${safeFunctionName}() {\n${indent(`return ${
|
|
1450
|
+
return `const ${safeFunctionName}ReturnValue = ${enhancedContents};\n\n${isRootAsyncFunction ? 'async ' : ''}function ${safeFunctionName}() {\n${indent(`return ${returnValue};`)}\n}`;
|
|
1332
1451
|
} else {
|
|
1333
1452
|
// For variable-qualified mocks, use underscore separator in the const name
|
|
1334
1453
|
// For indexed qualifiers like "data[1]", convert to safe identifier: "useFetcher_data_1"
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1454
|
+
// EXCEPTION: When keepOriginalFunctionName is true (for single-call cases), use the base name
|
|
1455
|
+
const safeName =
|
|
1456
|
+
variableQualifier && !options?.keepOriginalFunctionName
|
|
1457
|
+
? `${baseMockName}_${safeVariableQualifier(variableQualifier)}`
|
|
1458
|
+
: baseMockName;
|
|
1338
1459
|
|
|
1339
1460
|
// Get any jsx-component properties that need to be preserved from the original
|
|
1340
1461
|
const jsxProperties = getJsxComponentProperties(
|
|
@@ -88,7 +88,23 @@ async function gatherAllReferencedEntities(
|
|
|
88
88
|
if (!entities) return [];
|
|
89
89
|
|
|
90
90
|
// Filter to only the entities we need (loadEntities returns all for the file)
|
|
91
|
-
|
|
91
|
+
// Special handling: if we requested 'default' and got a default export entity,
|
|
92
|
+
// include it even though the name doesn't match (entities are stored by actual name, not 'default')
|
|
93
|
+
return entities.filter((e) => {
|
|
94
|
+
if (names.includes(e.name)) {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
// If we requested 'default' and this is a default export, include it
|
|
98
|
+
if (
|
|
99
|
+
names.includes('default') &&
|
|
100
|
+
e.metadata &&
|
|
101
|
+
!e.metadata.notExported &&
|
|
102
|
+
!e.metadata.namedExport
|
|
103
|
+
) {
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
});
|
|
92
108
|
},
|
|
93
109
|
);
|
|
94
110
|
|
|
@@ -46,10 +46,13 @@ export default class KyselyAnalysisLoader implements AnalysisLoader {
|
|
|
46
46
|
'status',
|
|
47
47
|
])
|
|
48
48
|
// Base condition: readyToBeCaptured = true
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
// Use json_extract for SQLite (returns 1 for boolean true)
|
|
50
|
+
.where((eb) =>
|
|
51
|
+
eb(
|
|
52
|
+
sql`json_extract(${sql.ref('status')}, '$.readyToBeCaptured')`,
|
|
53
|
+
'=',
|
|
54
|
+
sql`1`,
|
|
55
|
+
),
|
|
53
56
|
)
|
|
54
57
|
// Project filter (always required)
|
|
55
58
|
.where('project_id', '=', this.config.project.id);
|
|
@@ -94,11 +97,11 @@ export default class KyselyAnalysisLoader implements AnalysisLoader {
|
|
|
94
97
|
return false;
|
|
95
98
|
}
|
|
96
99
|
|
|
97
|
-
// Check: has
|
|
100
|
+
// Check: has scenarios needing capture
|
|
98
101
|
// Include if:
|
|
99
102
|
// - No scenarios field
|
|
100
103
|
// - Empty scenarios array
|
|
101
|
-
// - At least one scenario
|
|
104
|
+
// - At least one scenario that needs capture (no finishedAt OR has error)
|
|
102
105
|
const scenarios = status?.scenarios;
|
|
103
106
|
if (!scenarios || !Array.isArray(scenarios)) {
|
|
104
107
|
return true; // No scenarios field
|
|
@@ -107,12 +110,16 @@ export default class KyselyAnalysisLoader implements AnalysisLoader {
|
|
|
107
110
|
return true; // Empty array
|
|
108
111
|
}
|
|
109
112
|
|
|
110
|
-
// Check if at least one scenario
|
|
111
|
-
|
|
113
|
+
// Check if at least one scenario needs capture
|
|
114
|
+
// A scenario needs capture if it has no finishedAt AND no error
|
|
115
|
+
// (i.e., it hasn't been attempted yet)
|
|
116
|
+
// Scenarios with finishedAt are complete (successful)
|
|
117
|
+
// Scenarios with error are complete (failed, not retried automatically)
|
|
118
|
+
const needsCapture = scenarios.some(
|
|
112
119
|
(scenario: any) => !scenario.finishedAt && !scenario.error,
|
|
113
120
|
);
|
|
114
121
|
|
|
115
|
-
return
|
|
122
|
+
return needsCapture;
|
|
116
123
|
});
|
|
117
124
|
|
|
118
125
|
// Map to ReadyAnalysisData, excluding the status field
|
|
@@ -91,47 +91,59 @@ export default class SequentialCaptureTaskRunner implements CaptureTaskRunner {
|
|
|
91
91
|
|
|
92
92
|
// Derive paths
|
|
93
93
|
const parentDir = parentOfCodeyam;
|
|
94
|
-
const capturerPath = path.normalize(path.join(parentDir, 'capturer-1'));
|
|
95
94
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
// In CAPTURE_ONLY mode, run directly from the main project folder (skip rsync)
|
|
96
|
+
// This preserves any manual edits made to generated files
|
|
97
|
+
const captureOnly = process.env.CAPTURE_ONLY === 'true';
|
|
98
|
+
const capturerPath = captureOnly
|
|
99
|
+
? parentDir
|
|
100
|
+
: path.normalize(path.join(parentDir, 'capturer-1'));
|
|
102
101
|
|
|
103
|
-
|
|
104
|
-
// start.ts waits for repo checkout to complete before creating this runner
|
|
105
|
-
console.log('CodeYam: Copying codeyam/ and project/ to capturer-1/...');
|
|
106
|
-
await rsyncCopy({
|
|
107
|
-
sourcePath: parentDir,
|
|
108
|
-
destinationPath: capturerPath,
|
|
109
|
-
excludes: ['codeyam/log.txt', 'capturer-*'],
|
|
110
|
-
silent: false,
|
|
111
|
-
});
|
|
102
|
+
console.log(`CodeYam: Sequential runner using capturer at ${capturerPath}`);
|
|
112
103
|
|
|
113
|
-
|
|
114
|
-
const capturerProjectPath = path.join(capturerPath, 'project');
|
|
115
|
-
console.log('CodeYam: Sanitizing env files in capturer project...');
|
|
116
|
-
const sanitizeResult = sanitizeEnvFiles({
|
|
117
|
-
projectPath: capturerProjectPath,
|
|
118
|
-
log: (msg) => console.log(`CodeYam Sanitize: ${msg}`),
|
|
119
|
-
});
|
|
120
|
-
if (sanitizeResult.sanitizedFiles.length > 0) {
|
|
104
|
+
if (captureOnly) {
|
|
121
105
|
console.log(
|
|
122
|
-
|
|
106
|
+
'CodeYam: CAPTURE_ONLY mode - running from main project folder, skipping rsync',
|
|
123
107
|
);
|
|
124
|
-
}
|
|
108
|
+
} else {
|
|
109
|
+
// Create capturer base directory
|
|
110
|
+
if (!fs.existsSync(capturerPath)) {
|
|
111
|
+
fs.mkdirSync(capturerPath, { recursive: true });
|
|
112
|
+
}
|
|
125
113
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
console.log(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
114
|
+
// Copy both codeyam/ and project/ into capturer-1/
|
|
115
|
+
// start.ts waits for repo checkout to complete before creating this runner
|
|
116
|
+
console.log('CodeYam: Copying codeyam/ and project/ to capturer-1/...');
|
|
117
|
+
await rsyncCopy({
|
|
118
|
+
sourcePath: parentDir,
|
|
119
|
+
destinationPath: capturerPath,
|
|
120
|
+
excludes: ['codeyam/log.txt', 'capturer-*'],
|
|
121
|
+
silent: false,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// Sanitize env files in capturer project (replaces real values with mock placeholders)
|
|
125
|
+
const capturerProjectPath = path.join(capturerPath, 'project');
|
|
126
|
+
console.log('CodeYam: Sanitizing env files in capturer project...');
|
|
127
|
+
const sanitizeResult = sanitizeEnvFiles({
|
|
133
128
|
projectPath: capturerProjectPath,
|
|
129
|
+
log: (msg) => console.log(`CodeYam Sanitize: ${msg}`),
|
|
134
130
|
});
|
|
131
|
+
if (sanitizeResult.sanitizedFiles.length > 0) {
|
|
132
|
+
console.log(
|
|
133
|
+
`CodeYam: Env files sanitized: ${sanitizeResult.sanitizedFiles.join(', ')}`,
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Apply universal mocks to capturer project
|
|
138
|
+
if (context.universalMocks && context.universalMocks.length > 0) {
|
|
139
|
+
console.log(
|
|
140
|
+
`CodeYam: Applying ${context.universalMocks.length} universal mock(s) to capturer project...`,
|
|
141
|
+
);
|
|
142
|
+
await applyUniversalMocks({
|
|
143
|
+
mocks: context.universalMocks,
|
|
144
|
+
projectPath: capturerProjectPath,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
135
147
|
}
|
|
136
148
|
|
|
137
149
|
const runner = new SequentialCaptureTaskRunner(
|
|
@@ -247,6 +259,10 @@ export default class SequentialCaptureTaskRunner implements CaptureTaskRunner {
|
|
|
247
259
|
READY_TO_BE_CAPTURED: 'true',
|
|
248
260
|
PROJECT_SLUG: this.config.projectSlug,
|
|
249
261
|
CODEYAM_LOG_PATH: capturerLogPath,
|
|
262
|
+
// Pass CAPTURE_ONLY through from parent process to skip file regeneration
|
|
263
|
+
...(process.env.CAPTURE_ONLY && {
|
|
264
|
+
CAPTURE_ONLY: process.env.CAPTURE_ONLY,
|
|
265
|
+
}),
|
|
250
266
|
},
|
|
251
267
|
workingDir: capturerCodeyamPath,
|
|
252
268
|
processName: 'project',
|
|
@@ -280,14 +296,38 @@ export default class SequentialCaptureTaskRunner implements CaptureTaskRunner {
|
|
|
280
296
|
}, timeoutMs);
|
|
281
297
|
});
|
|
282
298
|
|
|
299
|
+
// Track which process exits first and when
|
|
300
|
+
const batchStartTime = Date.now();
|
|
301
|
+
let startExitCode: number | null = null;
|
|
302
|
+
let captureExitCode: number | null = null;
|
|
303
|
+
let firstToExit: 'start' | 'capture' | 'timeout' | null = null;
|
|
304
|
+
|
|
305
|
+
const startPromiseWithLogging = startResult.promise.then((code) => {
|
|
306
|
+
startExitCode = code;
|
|
307
|
+
if (!firstToExit) {
|
|
308
|
+
firstToExit = 'start';
|
|
309
|
+
}
|
|
310
|
+
return code;
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
const capturePromiseWithLogging = captureResult.promise.then((code) => {
|
|
314
|
+
captureExitCode = code;
|
|
315
|
+
if (!firstToExit) {
|
|
316
|
+
firstToExit = 'capture';
|
|
317
|
+
}
|
|
318
|
+
return code;
|
|
319
|
+
});
|
|
320
|
+
|
|
283
321
|
try {
|
|
284
|
-
//
|
|
322
|
+
// Wait for EITHER process to complete (or timeout)
|
|
323
|
+
// If start.js exits, we should investigate why - it shouldn't exit before capture is done
|
|
285
324
|
await Promise.race([
|
|
286
|
-
|
|
287
|
-
|
|
325
|
+
capturePromiseWithLogging,
|
|
326
|
+
startPromiseWithLogging,
|
|
288
327
|
timeoutPromise,
|
|
289
328
|
]);
|
|
290
|
-
|
|
329
|
+
const elapsed = ((Date.now() - batchStartTime) / 1000).toFixed(1);
|
|
330
|
+
console.log(`CodeYam: Batch processing completed after ${elapsed}s`);
|
|
291
331
|
} finally {
|
|
292
332
|
// Clean up timeout handle
|
|
293
333
|
if (timeoutHandle) {
|