@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
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
import { Entity } from '~codeyam/types';
|
|
9
9
|
import { FileAnalyzer, ProjectAnalyzer } from '~codeyam/analyze';
|
|
10
10
|
import { analyzeScopeLocal } from '../analyzeScope';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
ScopeInfo,
|
|
13
|
+
resetScopeDataStructureMetrics,
|
|
14
|
+
} from '../dataStructure/ScopeDataStructure';
|
|
12
15
|
import { SerializableDataStructure } from './SerializableDataStructure';
|
|
13
16
|
import { AI } from '~codeyam/ai';
|
|
14
17
|
import { setThreadContext } from '~codeyam/utils';
|
|
@@ -48,6 +51,10 @@ let fileAnalyzerPath: string | null = null;
|
|
|
48
51
|
export default async function runAnalyzeScope(
|
|
49
52
|
input: AnalyzeScopeWorkerInput,
|
|
50
53
|
): Promise<AnalyzeScopeWorkerOutput> {
|
|
54
|
+
// Reset metrics counters at the start of each entity analysis to prevent
|
|
55
|
+
// false "infinite loop" detection when processing multiple entities
|
|
56
|
+
resetScopeDataStructureMetrics();
|
|
57
|
+
|
|
51
58
|
try {
|
|
52
59
|
const { entity, project, dirPath, filePath, file, scope, model } = input;
|
|
53
60
|
|
|
@@ -17,6 +17,10 @@ import {
|
|
|
17
17
|
} from '~codeyam/ai';
|
|
18
18
|
import type { AnalysisOptions } from '../analyzeEntities';
|
|
19
19
|
|
|
20
|
+
// VERSION MARKER: server-only-detection-v2 (2025-12-28)
|
|
21
|
+
// This version includes automatic detection of "use server" and "server-only" files
|
|
22
|
+
// and runs server-only detection even for cached entities
|
|
23
|
+
|
|
20
24
|
/**
|
|
21
25
|
* PHASE 2: Prepare entity data structures
|
|
22
26
|
* Generate data structures for all entities upfront, before graph traversal.
|
|
@@ -30,157 +34,237 @@ export default async function prepareEntityDataStructures(
|
|
|
30
34
|
// Process entities in parallel for speed
|
|
31
35
|
await Promise.all(
|
|
32
36
|
Array.from(allEntities).map(async (entity) => {
|
|
33
|
-
//
|
|
37
|
+
// Check if already has cached data structure (unless force is set)
|
|
34
38
|
const hasCache = !!entity.metadata?.isolatedDataStructure;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
try
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
awsLog(
|
|
45
|
-
`CodeYam: prepareEntityDataStructures: FileAnalyzer not found`,
|
|
46
|
-
{
|
|
47
|
-
entityFilePath: entity.filePath,
|
|
48
|
-
entityName: entity.name,
|
|
49
|
-
},
|
|
39
|
+
const shouldRegenerateDataStructure =
|
|
40
|
+
!hasCache || options.force || options.forceAll;
|
|
41
|
+
|
|
42
|
+
// PHASE 1: Generate data structure (only for non-cached entities or when forced)
|
|
43
|
+
// Wrapped in its own try-catch so PHASE 2 always runs even if this fails
|
|
44
|
+
if (shouldRegenerateDataStructure) {
|
|
45
|
+
try {
|
|
46
|
+
const fileAnalyzer = projectAnalyzer.getFileAnalyzerByPath(
|
|
47
|
+
entity.resolvedFilePath ?? entity.filePath,
|
|
50
48
|
);
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const dataStructureInfo = await getEntityDataStructureAndFunctionCalls({
|
|
55
|
-
entity,
|
|
56
|
-
fileAnalyzer,
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
if (!dataStructureInfo?.isolatedDataStructure) {
|
|
60
|
-
// Data structure generation failed - entity will proceed with empty schemas
|
|
61
|
-
// This is okay - the entity can still be analyzed, just without detailed type info
|
|
62
|
-
if (['visual', 'library'].includes(entity.entityType)) {
|
|
63
|
-
// we'd really expect these to have data structures
|
|
49
|
+
if (!fileAnalyzer) {
|
|
64
50
|
awsLog(
|
|
65
|
-
`CodeYam: prepareEntityDataStructures:
|
|
51
|
+
`CodeYam: prepareEntityDataStructures: FileAnalyzer not found`,
|
|
52
|
+
{
|
|
53
|
+
entityFilePath: entity.filePath,
|
|
54
|
+
entityName: entity.name,
|
|
55
|
+
},
|
|
66
56
|
);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
// Still continue to PHASE 2 for server-only detection
|
|
58
|
+
} else {
|
|
59
|
+
const dataStructureInfo =
|
|
60
|
+
await getEntityDataStructureAndFunctionCalls({
|
|
61
|
+
entity,
|
|
62
|
+
fileAnalyzer,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
if (!dataStructureInfo?.isolatedDataStructure) {
|
|
66
|
+
// Data structure generation failed - entity will proceed with empty schemas
|
|
67
|
+
// This is okay - the entity can still be analyzed, just without detailed type info
|
|
68
|
+
if (['visual', 'library'].includes(entity.entityType)) {
|
|
69
|
+
// we'd really expect these to have data structures
|
|
70
|
+
awsLog(
|
|
71
|
+
`CodeYam: prepareEntityDataStructures: Failed to generate data structure for ${entity.filePath}:${entity.name}`,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
// Still continue to PHASE 2 for server-only detection
|
|
75
|
+
} else {
|
|
76
|
+
const {
|
|
77
|
+
isolatedDataStructure,
|
|
78
|
+
functionCalls,
|
|
79
|
+
callVariableNames,
|
|
80
|
+
} = dataStructureInfo;
|
|
81
|
+
|
|
82
|
+
// Store data structure in entity metadata
|
|
83
|
+
entity.metadata ||= {};
|
|
84
|
+
|
|
85
|
+
// Deep clone dependencySchemas to avoid shared references
|
|
86
|
+
// We need to clone because getReturnValue() returns direct references to schema objects
|
|
87
|
+
// and multiple entities might reference the same dependency
|
|
88
|
+
const clonedDependencySchemas: typeof isolatedDataStructure.dependencySchemas =
|
|
89
|
+
{};
|
|
90
|
+
for (const filePath in isolatedDataStructure.dependencySchemas) {
|
|
91
|
+
clonedDependencySchemas[filePath] = {};
|
|
92
|
+
for (const entityName in isolatedDataStructure
|
|
93
|
+
.dependencySchemas[filePath]) {
|
|
94
|
+
const depSchema =
|
|
95
|
+
isolatedDataStructure.dependencySchemas[filePath][
|
|
96
|
+
entityName
|
|
97
|
+
];
|
|
98
|
+
clonedDependencySchemas[filePath][entityName] = {
|
|
99
|
+
signatureSchema: { ...depSchema.signatureSchema },
|
|
100
|
+
returnValueSchema: { ...depSchema.returnValueSchema },
|
|
101
|
+
usageEquivalencies: depSchema.usageEquivalencies,
|
|
102
|
+
sourceEquivalencies: depSchema.sourceEquivalencies,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
70
106
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
107
|
+
entity.metadata.isolatedDataStructure = {
|
|
108
|
+
signatureSchema: deduplicateFunctionSchemas(
|
|
109
|
+
isolatedDataStructure.signatureSchema,
|
|
110
|
+
),
|
|
111
|
+
returnValueSchema: deduplicateFunctionSchemas(
|
|
112
|
+
isolatedDataStructure.returnValueSchema,
|
|
113
|
+
),
|
|
114
|
+
equivalentSignatureVariables:
|
|
115
|
+
isolatedDataStructure.equivalentSignatureVariables,
|
|
116
|
+
dependencySchemas: clonedDependencySchemas,
|
|
117
|
+
environmentVariables:
|
|
118
|
+
isolatedDataStructure.environmentVariables,
|
|
119
|
+
// Use enriched conditional usages with source tracing from analysis
|
|
120
|
+
conditionalUsages: isolatedDataStructure.conditionalUsages,
|
|
121
|
+
// Include root entity's equivalencies for merge step
|
|
122
|
+
usageEquivalencies: isolatedDataStructure.usageEquivalencies,
|
|
123
|
+
sourceEquivalencies: isolatedDataStructure.sourceEquivalencies,
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// Detect wrapper requirements (Context providers, etc.)
|
|
127
|
+
const wrapperRequirements = detectWrapperRequirements({
|
|
128
|
+
entity,
|
|
129
|
+
fileAnalyzer,
|
|
130
|
+
});
|
|
131
|
+
if (wrapperRequirements.length > 0) {
|
|
132
|
+
entity.metadata.wrapperRequirements = wrapperRequirements;
|
|
133
|
+
}
|
|
97
134
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
};
|
|
135
|
+
// Annotate imported exports with function call information
|
|
136
|
+
const importedExports = entity.metadata.importedExports ?? [];
|
|
137
|
+
for (const importedExport of importedExports) {
|
|
138
|
+
const relevantCalls = functionCalls[importedExport.name];
|
|
139
|
+
if (relevantCalls) {
|
|
140
|
+
importedExport.calls = relevantCalls;
|
|
141
|
+
}
|
|
142
|
+
const relevantVariableNames =
|
|
143
|
+
callVariableNames[importedExport.name];
|
|
144
|
+
if (relevantVariableNames) {
|
|
145
|
+
importedExport.callVariableNames = relevantVariableNames;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
112
148
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
149
|
+
// Annotate node module imports with function call information
|
|
150
|
+
for (const [path, infos] of Object.entries(
|
|
151
|
+
entity.metadata.nodeModuleImports ?? {},
|
|
152
|
+
)) {
|
|
153
|
+
for (const info of infos) {
|
|
154
|
+
const relevantCalls = functionCalls[info.name];
|
|
155
|
+
if (relevantCalls) {
|
|
156
|
+
info.calls = relevantCalls;
|
|
157
|
+
}
|
|
158
|
+
const relevantVariableNames = callVariableNames[info.name];
|
|
159
|
+
if (relevantVariableNames) {
|
|
160
|
+
info.callVariableNames = relevantVariableNames;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
} catch (phase1Error) {
|
|
167
|
+
console.warn(
|
|
168
|
+
`CodeYam: prepareEntityDataStructures: PHASE 1 error for ${entity.filePath}:${entity.name}:`,
|
|
169
|
+
phase1Error,
|
|
170
|
+
);
|
|
171
|
+
// Continue to PHASE 2 - server-only detection should still run
|
|
120
172
|
}
|
|
173
|
+
}
|
|
121
174
|
|
|
122
|
-
|
|
123
|
-
|
|
175
|
+
try {
|
|
176
|
+
// PHASE 2: Server-only detection and isMocked determination
|
|
177
|
+
// This runs for ALL entities, even those with cached data structures
|
|
178
|
+
// because server-only detection may have been added after the entity was cached
|
|
179
|
+
const importedExports = entity.metadata?.importedExports ?? [];
|
|
180
|
+
const mockedDependencies = determineMockedDependencies(entity);
|
|
124
181
|
for (const importedExport of importedExports) {
|
|
125
|
-
|
|
126
|
-
if
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
182
|
+
// Skip if already has a definitive isMocked value (true or false, not null)
|
|
183
|
+
// But re-check if isMocked is null or undefined - this handles previously cached entities
|
|
184
|
+
if (
|
|
185
|
+
importedExport.isMocked === true ||
|
|
186
|
+
importedExport.isMocked === false
|
|
187
|
+
) {
|
|
188
|
+
console.log(
|
|
189
|
+
`CodeYam: [${entity.name}] SKIP ${importedExport.name} - already has isMocked=${importedExport.isMocked}`,
|
|
190
|
+
);
|
|
191
|
+
continue;
|
|
132
192
|
}
|
|
133
|
-
}
|
|
134
193
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
info.calls = relevantCalls;
|
|
143
|
-
}
|
|
144
|
-
const relevantVariableNames = callVariableNames[info.name];
|
|
145
|
-
if (relevantVariableNames) {
|
|
146
|
-
info.callVariableNames = relevantVariableNames;
|
|
147
|
-
}
|
|
194
|
+
// Never mock visual components - they render UI and should use real implementation
|
|
195
|
+
if (importedExport.entityType === 'visual') {
|
|
196
|
+
console.log(
|
|
197
|
+
`CodeYam: [${entity.name}] SKIP ${importedExport.name} - visual component, setting isMocked=false`,
|
|
198
|
+
);
|
|
199
|
+
importedExport.isMocked = false;
|
|
200
|
+
continue;
|
|
148
201
|
}
|
|
149
|
-
}
|
|
150
202
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
203
|
+
// Always mock imports from server-only files ("use server" or import "server-only")
|
|
204
|
+
// These files contain Server Actions or server-only code that cannot run on the client
|
|
205
|
+
const importedFilePath =
|
|
206
|
+
importedExport.resolvedFilePath ?? importedExport.filePath;
|
|
207
|
+
const importedFileAnalyzer =
|
|
208
|
+
projectAnalyzer.getFileAnalyzerByPath(importedFilePath);
|
|
209
|
+
// Use sourceFile.getText() which is always available, unlike file.content which is lazy-loaded
|
|
210
|
+
const importedFileContent =
|
|
211
|
+
importedFileAnalyzer?.sourceFile?.getText();
|
|
212
|
+
|
|
213
|
+
const isServerOnly = importedFileContent
|
|
214
|
+
? isServerOnlyFile(importedFileContent)
|
|
215
|
+
: false;
|
|
216
|
+
console.log(
|
|
217
|
+
`CodeYam: [${entity.name}] CHECK ${importedExport.name} from ${importedFilePath}:`,
|
|
218
|
+
{
|
|
219
|
+
hasFileAnalyzer: !!importedFileAnalyzer,
|
|
220
|
+
hasSourceFile: !!importedFileAnalyzer?.sourceFile,
|
|
221
|
+
hasFileContent: !!importedFileContent,
|
|
222
|
+
contentFirst50Chars: importedFileContent
|
|
223
|
+
?.substring(0, 50)
|
|
224
|
+
?.replace(/\n/g, '\\n'),
|
|
225
|
+
isServerOnly,
|
|
226
|
+
},
|
|
227
|
+
);
|
|
160
228
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
dep.entityName === importedExport.name,
|
|
229
|
+
if (importedFileContent && isServerOnly) {
|
|
230
|
+
console.log(
|
|
231
|
+
`CodeYam: [${entity.name}] ✓ MARKING ${importedExport.name} as isMocked=true (server-only file detected)`,
|
|
165
232
|
);
|
|
233
|
+
importedExport.isMocked = true;
|
|
234
|
+
continue;
|
|
166
235
|
}
|
|
236
|
+
|
|
237
|
+
const matchesMockedDep = mockedDependencies.some(
|
|
238
|
+
(dep) =>
|
|
239
|
+
dep.filePath === importedExport.filePath &&
|
|
240
|
+
dep.entityName === importedExport.name,
|
|
241
|
+
);
|
|
242
|
+
importedExport.isMocked = matchesMockedDep;
|
|
243
|
+
console.log(
|
|
244
|
+
`CodeYam: [${entity.name}] ${importedExport.name} isMocked=${matchesMockedDep} (from mockedDependencies)`,
|
|
245
|
+
);
|
|
167
246
|
}
|
|
168
247
|
|
|
169
248
|
// Browser globals that should always be mocked (they make network calls)
|
|
170
249
|
const alwaysMockedBrowserGlobals = ['fetch', 'EventSource'];
|
|
171
250
|
|
|
172
251
|
for (const [path, infos] of Object.entries(
|
|
173
|
-
entity.metadata
|
|
252
|
+
entity.metadata?.nodeModuleImports ?? {},
|
|
174
253
|
)) {
|
|
175
254
|
for (const info of infos) {
|
|
176
|
-
if (info.isMocked === undefined) {
|
|
255
|
+
if (info.isMocked === undefined || info.isMocked === null) {
|
|
177
256
|
// Browser globals should always be mocked
|
|
178
257
|
if (alwaysMockedBrowserGlobals.includes(path)) {
|
|
179
258
|
info.isMocked = true;
|
|
180
259
|
} else {
|
|
260
|
+
// Check if this dependency should be mocked
|
|
261
|
+
// Match both exact entityName and variable-qualified entityNames
|
|
262
|
+
// e.g., "useFetcher" matches "useFetcher" OR "useFetcher::userFetcher"
|
|
181
263
|
info.isMocked = mockedDependencies.some(
|
|
182
264
|
(dep) =>
|
|
183
|
-
dep.filePath === path &&
|
|
265
|
+
dep.filePath === path &&
|
|
266
|
+
(dep.entityName === info.name ||
|
|
267
|
+
dep.entityName.startsWith(info.name + '::')),
|
|
184
268
|
);
|
|
185
269
|
}
|
|
186
270
|
}
|
|
@@ -269,6 +353,104 @@ async function getEntityDataStructureAndFunctionCalls({
|
|
|
269
353
|
getSourceEquivalencies(dataStructure, importedExport.name) ?? {},
|
|
270
354
|
};
|
|
271
355
|
|
|
356
|
+
// Also create variable-qualified entries to preserve distinct return type schemas
|
|
357
|
+
// when the same function is called multiple times with different type parameters
|
|
358
|
+
// (e.g., useFetcher<UserData>() vs useFetcher<ReportData>()).
|
|
359
|
+
//
|
|
360
|
+
// Each parameterized call is a SEPARATE entry in externalFunctionCalls, so we need
|
|
361
|
+
// to iterate over ALL matching calls (not just the first one).
|
|
362
|
+
const matchingCalls = dataStructure.externalFunctionCalls.filter(
|
|
363
|
+
(fc) =>
|
|
364
|
+
fc.name === importedExport.name ||
|
|
365
|
+
fc.name.startsWith(importedExport.name + '<'),
|
|
366
|
+
);
|
|
367
|
+
|
|
368
|
+
// Track how many times each variable name has been seen across ALL matching calls
|
|
369
|
+
// This handles the case where multiple parameterized calls (e.g., useFetcher<ConfigData>,
|
|
370
|
+
// useFetcher<SettingsData>) assign to the same variable name
|
|
371
|
+
const varNameCounts: Record<string, number> = {};
|
|
372
|
+
|
|
373
|
+
for (const efc of matchingCalls) {
|
|
374
|
+
// Check if this call has perVariableSchemas (multiple calls with same signature)
|
|
375
|
+
if (efc?.perVariableSchemas) {
|
|
376
|
+
for (const [varName, perVarSchema] of Object.entries(
|
|
377
|
+
efc.perVariableSchemas,
|
|
378
|
+
)) {
|
|
379
|
+
// Track occurrences of this variable name
|
|
380
|
+
const occurrence = varNameCounts[varName] ?? 0;
|
|
381
|
+
varNameCounts[varName] = occurrence + 1;
|
|
382
|
+
|
|
383
|
+
// Use indexed key if variable name is reused (e.g., fetcher, fetcher[1])
|
|
384
|
+
const indexedVarName =
|
|
385
|
+
occurrence === 0 ? varName : `${varName}[${occurrence}]`;
|
|
386
|
+
const qualifiedKey = `${importedExport.name}::${indexedVarName}`;
|
|
387
|
+
acc[importedExport.filePath][qualifiedKey] = {
|
|
388
|
+
signatureSchema: deduplicateFunctionSchemas({
|
|
389
|
+
...signatureSchema,
|
|
390
|
+
}),
|
|
391
|
+
returnValueSchema: deduplicateFunctionSchemas({
|
|
392
|
+
...perVarSchema,
|
|
393
|
+
}),
|
|
394
|
+
usageEquivalencies:
|
|
395
|
+
getUsageEquivalencies(dataStructure, importedExport.name) ?? {},
|
|
396
|
+
sourceEquivalencies:
|
|
397
|
+
getSourceEquivalencies(dataStructure, importedExport.name) ??
|
|
398
|
+
{},
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
} else if (efc?.receivingVariableNames?.length === 1) {
|
|
402
|
+
// For parameterized calls like useFetcher<UserData>(), each is a separate entry
|
|
403
|
+
// with a single receivingVariableName. Create a variable-qualified entry using
|
|
404
|
+
// the specific return value for this parameterized call.
|
|
405
|
+
const varName = efc.receivingVariableNames[0];
|
|
406
|
+
|
|
407
|
+
// Track occurrences of this variable name across all efc entries
|
|
408
|
+
const occurrence = varNameCounts[varName] ?? 0;
|
|
409
|
+
varNameCounts[varName] = occurrence + 1;
|
|
410
|
+
|
|
411
|
+
// Use indexed key if variable name is reused (e.g., fetcher, fetcher[1])
|
|
412
|
+
const indexedVarName =
|
|
413
|
+
occurrence === 0 ? varName : `${varName}[${occurrence}]`;
|
|
414
|
+
const qualifiedKey = `${importedExport.name}::${indexedVarName}`;
|
|
415
|
+
|
|
416
|
+
// PREFER perVariableSchemas over getReturnValue() when available
|
|
417
|
+
// perVariableSchemas has the SPECIFIC schema for this parameterized call,
|
|
418
|
+
// while getReturnValue() may return merged schemas from multiple calls
|
|
419
|
+
let parameterizedReturnValue: Record<string, string> | null = null;
|
|
420
|
+
|
|
421
|
+
if (efc.perVariableSchemas && efc.perVariableSchemas[varName]) {
|
|
422
|
+
// Use the specific schema from perVariableSchemas
|
|
423
|
+
parameterizedReturnValue = efc.perVariableSchemas[varName] ?? null;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// Fallback to getReturnValue if perCallSignatureSchemas not available
|
|
427
|
+
if (!parameterizedReturnValue) {
|
|
428
|
+
parameterizedReturnValue = getReturnValue(dataStructure, {
|
|
429
|
+
functionName: efc.name, // Use the full parameterized name
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
if (
|
|
434
|
+
parameterizedReturnValue &&
|
|
435
|
+
Object.keys(parameterizedReturnValue).length > 0
|
|
436
|
+
) {
|
|
437
|
+
acc[importedExport.filePath][qualifiedKey] = {
|
|
438
|
+
signatureSchema: deduplicateFunctionSchemas({
|
|
439
|
+
...signatureSchema,
|
|
440
|
+
}),
|
|
441
|
+
returnValueSchema: deduplicateFunctionSchemas({
|
|
442
|
+
...parameterizedReturnValue,
|
|
443
|
+
}),
|
|
444
|
+
usageEquivalencies:
|
|
445
|
+
getUsageEquivalencies(dataStructure, importedExport.name) ?? {},
|
|
446
|
+
sourceEquivalencies:
|
|
447
|
+
getSourceEquivalencies(dataStructure, importedExport.name) ??
|
|
448
|
+
{},
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
272
454
|
return acc;
|
|
273
455
|
},
|
|
274
456
|
{} as {
|
|
@@ -301,6 +483,9 @@ async function getEntityDataStructureAndFunctionCalls({
|
|
|
301
483
|
// Get enriched conditional usages with source tracing
|
|
302
484
|
const conditionalUsages = getConditionalUsages(dataStructure);
|
|
303
485
|
|
|
486
|
+
const rawUsageEquivalencies = getUsageEquivalencies(dataStructure);
|
|
487
|
+
const rawSourceEquivalencies = getSourceEquivalencies(dataStructure);
|
|
488
|
+
|
|
304
489
|
const isolatedDataStructure = {
|
|
305
490
|
signatureSchema: deduplicateFunctionSchemas(clonedRawSignature),
|
|
306
491
|
returnValueSchema: deduplicateFunctionSchemas(clonedRawReturnValue),
|
|
@@ -310,6 +495,11 @@ async function getEntityDataStructureAndFunctionCalls({
|
|
|
310
495
|
environmentVariables: dataStructure.environmentVariables,
|
|
311
496
|
conditionalUsages:
|
|
312
497
|
Object.keys(conditionalUsages).length > 0 ? conditionalUsages : undefined,
|
|
498
|
+
// Include root entity's equivalencies so they can be used during merge.
|
|
499
|
+
// These show how the parent's data flows to/from child components.
|
|
500
|
+
// E.g., for SurveysList, usageEquivalencies shows surveys[] → SurveyCard().signature[0].survey
|
|
501
|
+
usageEquivalencies: rawUsageEquivalencies ?? {},
|
|
502
|
+
sourceEquivalencies: rawSourceEquivalencies ?? {},
|
|
313
503
|
};
|
|
314
504
|
|
|
315
505
|
const functionCalls: Record<string, string[]> = {};
|
|
@@ -322,31 +512,6 @@ async function getEntityDataStructureAndFunctionCalls({
|
|
|
322
512
|
efc.callSignature.startsWith(entityName),
|
|
323
513
|
);
|
|
324
514
|
|
|
325
|
-
// DEBUG: Log external function calls info for useFetcher
|
|
326
|
-
if (entityName === 'useFetcher' || entityName.includes('Fetcher')) {
|
|
327
|
-
console.log(
|
|
328
|
-
'CodeYam DEBUG prepareDataStructures:',
|
|
329
|
-
JSON.stringify(
|
|
330
|
-
{
|
|
331
|
-
entityName,
|
|
332
|
-
filePath,
|
|
333
|
-
totalExternalFunctionCalls:
|
|
334
|
-
dataStructure.externalFunctionCalls.length,
|
|
335
|
-
matchingCallsCount: matchingCalls.length,
|
|
336
|
-
matchingCalls: matchingCalls.map((efc) => ({
|
|
337
|
-
name: efc.name,
|
|
338
|
-
callSignature: efc.callSignature,
|
|
339
|
-
allCallSignatures: efc.allCallSignatures,
|
|
340
|
-
receivingVariableNames: efc.receivingVariableNames,
|
|
341
|
-
callSignatureToVariable: efc.callSignatureToVariable,
|
|
342
|
-
})),
|
|
343
|
-
},
|
|
344
|
-
null,
|
|
345
|
-
2,
|
|
346
|
-
),
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
515
|
// Collect all call signatures from all matching efc entries
|
|
351
516
|
// Each efc may have just one callSignature, or allCallSignatures if merged
|
|
352
517
|
const allSignatures: string[] = [];
|
|
@@ -631,3 +796,32 @@ export function determineMockedDependencies(entity: Entity) {
|
|
|
631
796
|
|
|
632
797
|
return mockedEntities;
|
|
633
798
|
}
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* Check if a file is server-only based on its content.
|
|
802
|
+
*
|
|
803
|
+
* A file is considered server-only if it:
|
|
804
|
+
* 1. Starts with "use server" directive (Server Actions in Next.js)
|
|
805
|
+
* 2. Contains import "server-only" (explicit server-only marker)
|
|
806
|
+
*
|
|
807
|
+
* Server-only files should always be mocked when imported by client components
|
|
808
|
+
* because they contain code that cannot run in the browser.
|
|
809
|
+
*/
|
|
810
|
+
export function isServerOnlyFile(fileContent: string): boolean {
|
|
811
|
+
const trimmed = fileContent.trimStart();
|
|
812
|
+
|
|
813
|
+
// Check for "use server" directive at the start of the file
|
|
814
|
+
if (
|
|
815
|
+
trimmed.startsWith('"use server"') ||
|
|
816
|
+
trimmed.startsWith("'use server'")
|
|
817
|
+
) {
|
|
818
|
+
return true;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
// Check for server-only import anywhere in the file
|
|
822
|
+
if (/import\s+["']server-only["']/.test(fileContent)) {
|
|
823
|
+
return true;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
return false;
|
|
827
|
+
}
|
|
@@ -499,7 +499,23 @@ export default async function analyzeEntities({
|
|
|
499
499
|
|
|
500
500
|
const successfullyUpdated: Analysis[] = [];
|
|
501
501
|
|
|
502
|
+
console.log('CodeYam DEBUG: updateReadyAnalyses - newlyReady analyses:', {
|
|
503
|
+
count: newlyReady.length,
|
|
504
|
+
analyses: newlyReady.map((a) => ({
|
|
505
|
+
id: a.id,
|
|
506
|
+
filePath: a.filePath,
|
|
507
|
+
entityName: a.entityName,
|
|
508
|
+
scenarioCount: a.scenarios?.length ?? 0,
|
|
509
|
+
})),
|
|
510
|
+
});
|
|
511
|
+
|
|
502
512
|
for (const analysis of newlyReady) {
|
|
513
|
+
console.log('CodeYam DEBUG: Setting readyToBeCaptured=true for:', {
|
|
514
|
+
id: analysis.id,
|
|
515
|
+
filePath: analysis.filePath,
|
|
516
|
+
entityName: analysis.entityName,
|
|
517
|
+
});
|
|
518
|
+
|
|
503
519
|
const updatedStatus = await updateFreshAnalysisStatus(
|
|
504
520
|
analysis.id!,
|
|
505
521
|
(status) => {
|
|
@@ -511,6 +527,10 @@ export default async function analyzeEntities({
|
|
|
511
527
|
if (updatedStatus) {
|
|
512
528
|
analysis.status = updatedStatus;
|
|
513
529
|
successfullyUpdated.push(analysis);
|
|
530
|
+
console.log('CodeYam DEBUG: Successfully marked readyToBeCaptured:', {
|
|
531
|
+
id: analysis.id,
|
|
532
|
+
entityName: analysis.entityName,
|
|
533
|
+
});
|
|
514
534
|
} else {
|
|
515
535
|
console.warn(
|
|
516
536
|
`CodeYam: updateReadyAnalyses: Failed to update status for analysis ${analysis.id}`,
|
|
@@ -204,6 +204,13 @@ export default function getImportedExports(
|
|
|
204
204
|
}
|
|
205
205
|
const resolvedName = importedExportInfo.exportName;
|
|
206
206
|
|
|
207
|
+
// When a default export is re-exported as named (e.g., `export { default as X }`),
|
|
208
|
+
// isExportDefault will be false (it's exported as named from the barrel),
|
|
209
|
+
// but resolvedName will be 'default'. In this case, we need resolvedIsDefault
|
|
210
|
+
// to be true so that writeScenarioComponents adds the named re-export.
|
|
211
|
+
const resolvedIsDefault =
|
|
212
|
+
importedExportInfo.isExportDefault || resolvedName === 'default';
|
|
213
|
+
|
|
207
214
|
return {
|
|
208
215
|
fileId: importedExportFile.id,
|
|
209
216
|
filePath: actualResolvedPath,
|
|
@@ -213,7 +220,7 @@ export default function getImportedExports(
|
|
|
213
220
|
? undefined
|
|
214
221
|
: resolvedFilePath,
|
|
215
222
|
resolvedName: resolvedName === name ? undefined : resolvedName,
|
|
216
|
-
resolvedIsDefault
|
|
223
|
+
resolvedIsDefault,
|
|
217
224
|
entityType,
|
|
218
225
|
name,
|
|
219
226
|
code,
|