@codeyam/codeyam-cli 0.1.0-staging.b8a55ba → 0.1.0-staging.d0ad4ae
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/common/execAsync.ts +1 -1
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +7 -4
- package/analyzer-template/packages/ai/package.json +1 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +14 -1
- package/analyzer-template/packages/ai/src/lib/checkAllAttributes.ts +29 -10
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +120 -19
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +2 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +91 -35
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +110 -74
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +11 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.ts +98 -0
- package/analyzer-template/packages/ai/src/lib/deepEqual.ts +30 -0
- package/analyzer-template/packages/ai/src/lib/findMatchingAttribute.ts +24 -17
- package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +214 -39
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +54 -1
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +72 -6
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +12 -5
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +39 -23
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +32 -0
- package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +14 -0
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/index.ts +1 -0
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/isAsyncFunction.ts +67 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +73 -69
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +6 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +3 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +22 -6
- package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +9 -5
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +49 -11
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.ts +102 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +399 -52
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.ts +128 -2
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +114 -70
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +34 -129
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +155 -79
- package/analyzer-template/packages/aws/codebuild/index.ts +1 -0
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts +11 -1
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js +29 -18
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts +2 -2
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js +2 -2
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts +8 -18
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js +17 -61
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js +8 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js.map +1 -1
- package/analyzer-template/packages/aws/package.json +1 -1
- package/analyzer-template/packages/aws/src/lib/codebuild/waitForBuild.ts +43 -19
- package/analyzer-template/packages/aws/src/lib/ecs/ecsDefineContainer.ts +3 -3
- package/analyzer-template/packages/aws/src/lib/ecs/ecsTaskFactory.ts +17 -69
- package/analyzer-template/packages/aws/src/lib/s3/uploadFileToS3.ts +8 -1
- package/analyzer-template/packages/generate/index.ts +3 -0
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.ts +17 -1
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +193 -0
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.ts +73 -0
- package/analyzer-template/packages/generate/src/lib/scenarioComponentForServer.ts +114 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/index.d.ts +3 -0
- package/analyzer-template/packages/github/dist/generate/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/index.js +3 -0
- package/analyzer-template/packages/github/dist/generate/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts +9 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts +20 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts +8 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js +89 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js.map +1 -0
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js +10 -0
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js +3 -0
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +6 -0
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/github/src/lib/loadOrCreateCommit.ts +14 -0
- package/analyzer-template/packages/github/src/lib/syncPrimaryBranch.ts +2 -0
- package/analyzer-template/packages/process/index.ts +2 -0
- package/analyzer-template/packages/process/package.json +12 -0
- package/analyzer-template/packages/process/tsconfig.json +8 -0
- package/analyzer-template/packages/types/src/types/Entity.ts +2 -0
- package/analyzer-template/packages/types/src/types/Scenario.ts +6 -0
- package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +6 -0
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/playwright/capture.ts +37 -18
- package/analyzer-template/playwright/waitForServer.ts +21 -6
- package/analyzer-template/project/constructMockCode.ts +781 -140
- package/analyzer-template/project/orchestrateCapture/KyselyAnalysisLoader.ts +3 -6
- package/analyzer-template/project/orchestrateCapture.ts +10 -3
- package/analyzer-template/project/reconcileMockDataKeys.ts +28 -100
- package/analyzer-template/project/runAnalysis.ts +5 -0
- package/analyzer-template/project/serverOnlyModules.ts +127 -2
- package/analyzer-template/project/start.ts +5 -3
- package/analyzer-template/project/startScenarioCapture.ts +6 -0
- package/analyzer-template/project/writeMockDataTsx.ts +50 -22
- package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
- package/analyzer-template/project/writeScenarioComponents.ts +162 -100
- package/analyzer-template/project/writeScenarioFiles.ts +26 -0
- package/analyzer-template/project/writeSimpleRoot.ts +11 -35
- package/analyzer-template/scripts/comboWorkerLoop.cjs +1 -0
- package/analyzer-template/scripts/defaultCmd.sh +9 -0
- package/background/src/lib/local/createLocalAnalyzer.js +1 -29
- package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
- package/background/src/lib/local/execAsync.js +1 -1
- package/background/src/lib/local/execAsync.js.map +1 -1
- package/background/src/lib/virtualized/common/execAsync.js +1 -1
- package/background/src/lib/virtualized/common/execAsync.js.map +1 -1
- package/background/src/lib/virtualized/project/constructMockCode.js +718 -127
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js +3 -2
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js +7 -4
- package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +25 -61
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
- package/background/src/lib/virtualized/project/runAnalysis.js +4 -0
- package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
- package/background/src/lib/virtualized/project/serverOnlyModules.js +106 -3
- package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -1
- package/background/src/lib/virtualized/project/start.js +5 -3
- package/background/src/lib/virtualized/project/start.js.map +1 -1
- package/background/src/lib/virtualized/project/startScenarioCapture.js +7 -0
- package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +52 -23
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js +15 -0
- package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js.map +1 -0
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +136 -83
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioFiles.js +19 -0
- package/background/src/lib/virtualized/project/writeScenarioFiles.js.map +1 -1
- package/background/src/lib/virtualized/project/writeSimpleRoot.js +11 -34
- package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
- package/codeyam-cli/src/cli.js +5 -1
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/commands/analyze.js +1 -1
- package/codeyam-cli/src/commands/analyze.js.map +1 -1
- package/codeyam-cli/src/commands/baseline.js +177 -0
- package/codeyam-cli/src/commands/baseline.js.map +1 -0
- package/codeyam-cli/src/commands/status.js +23 -1
- package/codeyam-cli/src/commands/status.js.map +1 -1
- package/codeyam-cli/src/commands/test-startup.js +1 -1
- package/codeyam-cli/src/commands/test-startup.js.map +1 -1
- package/codeyam-cli/src/commands/wipe.js +108 -0
- package/codeyam-cli/src/commands/wipe.js.map +1 -0
- package/codeyam-cli/src/utils/database.js +91 -5
- package/codeyam-cli/src/utils/database.js.map +1 -1
- package/codeyam-cli/src/utils/git.js +79 -0
- package/codeyam-cli/src/utils/git.js.map +1 -0
- package/codeyam-cli/src/utils/queue/job.js +104 -0
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/queue/persistence.js.map +1 -1
- package/codeyam-cli/src/utils/wipe.js +128 -0
- package/codeyam-cli/src/utils/wipe.js.map +1 -0
- package/codeyam-cli/src/webserver/app/lib/database.js +66 -17
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-wXL1Z2Aq.js → EntityItem-Cmysw5OP.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-CzGX-miz.js → EntityTypeBadge-DLqD3qNt.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-CXFKsCOD.js → EntityTypeIcon-CAneekK2.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-D-9pXIaY.js → InteractivePreview-Cu16OUmx.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CBQPrpT0.js → LibraryFunctionPreview-CVtiBnY5.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-D1CdlbrV.js → LoadingDots-B0GLXMsr.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-wDPcZNKx.js → LogViewer-xgeCVgSM.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-4lcOlid-.js → ReportIssueModal-DcAUIpD_.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-BfmDgXxG.js → SafeScreenshot-DuDvi0jm.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-BMKg0SAF.js +15 -0
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-6J7zDUD5.js → TruncatedFilePath-DyFZkK0l.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/_index-DSmTpjmK.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BF_aK4y6.js +32 -0
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-BYimnrHg.js → chevron-down-Cx24_aWc.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-EPOLDU6W-CXRTFQ3F.js +51 -0
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-CaVsIRxt.js → circle-check-BOARzkeR.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-CgUsG7ib.js → createLucideIcon-BdhJEx6B.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{dev.empty-DW_hdGUc.js → dev.empty-RJCf3Tvw.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-zUEpfPsu.js → entity._sha._-D0-YwkBh.js} +12 -12
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-EylcgScH.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-D_3ero5o.js → entity._sha_.create-scenario-DMe7kvgo.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CfLCUi9S.js → entity._sha_.edit._scenarioId-C1H_a_Y3.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DKJyZfAY.js → entry.client-CS2cb_eZ.js} +6 -6
- package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DAtOlaWE.js → fileTableUtils-DMJ7zii9.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{files-ClR0d32A.js → files-BW7Cyeyi.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{git-D62Lxxmv.js → git-CZu4fif0.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/globals-wHVy_II5.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-CzNNiTkw.js → index-B1h680n5.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-BosqDOlH.js → index-lzqtyFU8.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-CNp9QFCX.js → loader-circle-B7B9V-bu.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{manifest-09d684be.js → manifest-2d191949.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-FHgpM6gc.js +56 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-DDGjYAMJ.js → search-CxXUmBSd.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{settings-DgTyB-Wg.js → settings-6D8k8Jp5.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-CDJZnWhN.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-CBc5dE1s.js → triangle-alert-B6LgvRJg.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-BMIGFP-m.js → useCustomSizes-Dv18q8LD.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useInteractiveMode-Dk_FQqWJ.js → useInteractiveMode-0ToGk4K3.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-BqPPNjAl.js → useLastLogLine-aSv48UbS.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-DsJbgMY9.js → useReportContext-1BX144Eg.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-DWHcCcl1.js → useToast-mBRpZPiu.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/{index-CV6i1S1A.js → index-pU0o5t1o.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-YzfkRwdn.js +178 -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/templates/codeyam-setup-skill.md +138 -3
- package/codeyam-cli/templates/debug-codeyam.md +7 -2
- package/package.json +5 -5
- package/packages/ai/src/lib/astScopes/processExpression.js +13 -1
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/checkAllAttributes.js +24 -9
- package/packages/ai/src/lib/checkAllAttributes.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +94 -18
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +2 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +51 -23
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +70 -54
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +11 -0
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js +86 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js.map +1 -0
- package/packages/ai/src/lib/deepEqual.js +32 -0
- package/packages/ai/src/lib/deepEqual.js.map +1 -0
- package/packages/ai/src/lib/findMatchingAttribute.js +20 -16
- package/packages/ai/src/lib/findMatchingAttribute.js.map +1 -1
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +168 -41
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +42 -1
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js +59 -3
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarios.js +6 -6
- package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +32 -23
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +20 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
- package/packages/analyze/src/lib/FileAnalyzer.js +15 -0
- package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/index.js +1 -0
- package/packages/analyze/src/lib/asts/nodes/index.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js +52 -0
- package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js.map +1 -0
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +59 -50
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +6 -0
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +2 -0
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeChange.js +14 -4
- package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeEntity.js +7 -6
- package/packages/analyze/src/lib/files/analyzeEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +44 -10
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js +85 -0
- package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +314 -52
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js +97 -2
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +88 -52
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +26 -98
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +141 -75
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/aws/src/lib/ecs/ecsDefineContainer.js +2 -2
- package/packages/aws/src/lib/ecs/ecsDefineContainer.js.map +1 -1
- package/packages/aws/src/lib/ecs/ecsTaskFactory.js +17 -61
- package/packages/aws/src/lib/ecs/ecsTaskFactory.js.map +1 -1
- package/packages/generate/index.js +3 -0
- package/packages/generate/index.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
- package/packages/generate/src/lib/scenarioComponentForServer.js +89 -0
- package/packages/generate/src/lib/scenarioComponentForServer.js.map +1 -0
- package/packages/github/src/lib/loadOrCreateCommit.js +10 -0
- package/packages/github/src/lib/loadOrCreateCommit.js.map +1 -1
- package/packages/github/src/lib/syncPrimaryBranch.js +3 -0
- package/packages/github/src/lib/syncPrimaryBranch.js.map +1 -1
- package/packages/process/index.js +3 -0
- package/packages/process/index.js.map +1 -0
- package/packages/process/src/GlobalProcessManager.js.map +1 -0
- package/{background/src/lib/process → packages/process/src}/ProcessManager.js +1 -1
- package/packages/process/src/ProcessManager.js.map +1 -0
- package/packages/process/src/index.js.map +1 -0
- package/packages/process/src/managedExecAsync.js.map +1 -0
- package/analyzer-template/process/INTEGRATION_COMPLETE.md +0 -333
- package/analyzer-template/process/INTEGRATION_EXAMPLE.md +0 -525
- package/analyzer-template/process/README.md +0 -507
- package/background/src/lib/process/GlobalProcessManager.js.map +0 -1
- package/background/src/lib/process/ProcessManager.js.map +0 -1
- package/background/src/lib/process/index.js.map +0 -1
- package/background/src/lib/process/managedExecAsync.js.map +0 -1
- package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +0 -238
- package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +0 -1
- package/codeyam-cli/scripts/fixtures/formbricks/universal-mocks/apps/web/lib/instance/service.js +0 -7
- package/codeyam-cli/scripts/fixtures/formbricks/universal-mocks/apps/web/lib/instance/service.js.map +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CUxUNEEC.js +0 -15
- package/codeyam-cli/src/webserver/build/client/assets/_index-DHImXdXq.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-2mG6mjVb.js +0 -32
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JMJ3UQ3L-BambyYE_.js +0 -51
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DyB90fWk.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-C6vQASxy.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-BxJUvKau.js +0 -56
- package/codeyam-cli/src/webserver/build/client/assets/simulations-CoNWGt0K.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BDlyhfrv.js +0 -175
- /package/analyzer-template/{process → packages/process/src}/GlobalProcessManager.ts +0 -0
- /package/analyzer-template/{process → packages/process/src}/ProcessManager.ts +0 -0
- /package/analyzer-template/{process → packages/process/src}/index.ts +0 -0
- /package/analyzer-template/{process → packages/process/src}/managedExecAsync.ts +0 -0
- /package/{background/src/lib/process → packages/process/src}/GlobalProcessManager.js +0 -0
- /package/{background/src/lib/process → packages/process/src}/index.js +0 -0
- /package/{background/src/lib/process → packages/process/src}/managedExecAsync.js +0 -0
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
import validateJson from './validateJson';
|
|
12
12
|
import { awsLog, awsLogDebugLevel } from '~codeyam/utils';
|
|
13
13
|
import { AI, parseJsonSafe } from '~codeyam/ai';
|
|
14
|
+
import convertNullToUndefinedBySchema from './dataStructure/helpers/convertNullToUndefinedBySchema';
|
|
14
15
|
|
|
15
16
|
const DEFAULT_SCENARIO_NAME = 'Default Scenario';
|
|
16
17
|
|
|
@@ -144,8 +145,9 @@ export async function generateDataForScenario({
|
|
|
144
145
|
|
|
145
146
|
if (structure.dataForMocks && !fullScenarioData.data.argumentsData) {
|
|
146
147
|
fullScenarioData.data.argumentsData = [];
|
|
147
|
-
|
|
148
|
-
|
|
148
|
+
// Populate argumentsData from structure.arguments using top-level data values
|
|
149
|
+
// Bug fix: removed redundant !argumentsData check that was always false after setting to []
|
|
150
|
+
if (structure.arguments) {
|
|
149
151
|
for (let i = 0; i < structure.arguments.length; ++i) {
|
|
150
152
|
if (!fullScenarioData.data.argumentsData[i]) {
|
|
151
153
|
fullScenarioData.data.argumentsData[i] = {};
|
|
@@ -166,6 +168,27 @@ export async function generateDataForScenario({
|
|
|
166
168
|
}
|
|
167
169
|
}
|
|
168
170
|
|
|
171
|
+
// Convert null values to undefined based on schema type constraints.
|
|
172
|
+
// LLM uses null for "no value" (JSON doesn't support undefined), but TypeScript
|
|
173
|
+
// types like "string | undefined" don't accept null. This converts null→undefined
|
|
174
|
+
// for fields typed as "T | undefined" (but preserves null for "T | null").
|
|
175
|
+
if (structure.dataForMocks && fullScenarioData.data.mockData) {
|
|
176
|
+
convertNullToUndefinedBySchema(
|
|
177
|
+
fullScenarioData.data.mockData,
|
|
178
|
+
structure.dataForMocks,
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
if (structure.arguments && fullScenarioData.data.argumentsData) {
|
|
182
|
+
for (let i = 0; i < fullScenarioData.data.argumentsData.length; i++) {
|
|
183
|
+
if (structure.arguments[i]) {
|
|
184
|
+
convertNullToUndefinedBySchema(
|
|
185
|
+
fullScenarioData.data.argumentsData[i],
|
|
186
|
+
structure.arguments[i],
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
169
192
|
return {
|
|
170
193
|
scenarioData: fullScenarioData,
|
|
171
194
|
llmCall: { name: scenario.name, id: llmCall.id },
|
|
@@ -285,7 +308,7 @@ export const generateSystemMessage = (
|
|
|
285
308
|
? `## Default Scenario
|
|
286
309
|
Generate COMPLETE, robust data for the entire data structure.
|
|
287
310
|
- Fill ALL fields with realistic values (except error attributes and key attributes set to null or undefined)
|
|
288
|
-
- Arrays should have
|
|
311
|
+
- Arrays should have 3-5 items to provide realistic test data variety
|
|
289
312
|
- Don't skip nested attributes unless the key attributes specify a parent attribute should be null or undefined
|
|
290
313
|
- This provides the baseline data for all other scenarios`
|
|
291
314
|
: `## Non-Default Scenario
|
|
@@ -317,26 +340,19 @@ Use for relative dates. Code runs in Node (no browser APIs, no external librarie
|
|
|
317
340
|
\`\`\`
|
|
318
341
|
Use simple elements only (\`<div>\`, \`<span>\`). No custom components.
|
|
319
342
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
\`\`\`json
|
|
325
|
-
{
|
|
326
|
-
"mockData": {
|
|
327
|
-
"DashboardPage::useLoaderData::0": { "user": { "name": "John" } },
|
|
328
|
-
"DashboardPage::useFetcher::0": { "data": null, "state": "idle" },
|
|
329
|
-
"DashboardPage::useFetcher::1": { "data": { "reportId": "abc123" } }
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
\`\`\`
|
|
333
|
-
|
|
334
|
-
The format is deterministic:
|
|
335
|
-
- \`EntityName\` - the component name
|
|
336
|
-
- \`hookName\` - the function/hook being called
|
|
337
|
-
- \`index\` - distinguishes multiple calls to the same hook (0, 1, 2...)
|
|
343
|
+
### Arrays
|
|
344
|
+
- Arrays should have many items (at least 4) unless specified otherwise
|
|
345
|
+
- Each item must follow the exact structure provided
|
|
346
|
+
- In general we want robust data, not minimal data unless specified otherwise
|
|
338
347
|
|
|
339
|
-
|
|
348
|
+
## CRITICAL: Preserve Exact Structure
|
|
349
|
+
Your response MUST mirror the EXACT nested structure provided in mockData Structure.
|
|
350
|
+
- Do NOT reorganize, split, or create duplicate keys
|
|
351
|
+
- The hierarchy of nested objects must match exactly what was provided unless overridden by scenario rules
|
|
352
|
+
- Only change the leaf VALUES (replacing type descriptions like "string" with actual data like "hello")
|
|
353
|
+
- Copy the key strings EXACTLY from the structure
|
|
354
|
+
- Do NOT modify type parameters, arguments, or any part of the key
|
|
355
|
+
- The keys preserve the exact function call as written in the original code
|
|
340
356
|
|
|
341
357
|
## Response Format
|
|
342
358
|
\`\`\`json
|
|
@@ -354,7 +370,7 @@ The format is deterministic:
|
|
|
354
370
|
## Rules
|
|
355
371
|
- Valid JSON only—no raw code outside markers
|
|
356
372
|
- No \`undefined\`—use \`null\` or omit
|
|
357
|
-
- No data references (can't use \`posts[0]\` elsewhere—duplicate the value)
|
|
373
|
+
- No data references (can't use \`posts[0]\` elsewhere — duplicate the value)
|
|
358
374
|
- Scenario name must match exactly: "${scenarioName}"
|
|
359
375
|
- Empty mockData: \`{}\`, empty argumentsData: \`[]\`
|
|
360
376
|
`;
|
|
@@ -7,12 +7,18 @@ import {
|
|
|
7
7
|
} from '~codeyam/types';
|
|
8
8
|
import gatherRelevantDependentKeyAttributes from '../gatherRelevantDependentKeyAttributes';
|
|
9
9
|
|
|
10
|
+
interface ModifiedKeyAttribute {
|
|
11
|
+
keyAttribute: Analysis['metadata']['keyAttributes'][0];
|
|
12
|
+
newSourceLocations: Analysis['metadata']['keyAttributes'][0]['sourceLocations'];
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
interface GenerateChangesEntityScenariosGeneratorArgs {
|
|
11
16
|
entity: Pick<Entity, 'name' | 'code' | 'metadata'>;
|
|
12
17
|
mergedDataStructure: Omit<DataStructure, 'equivalentSignatureVariables'>;
|
|
13
18
|
keyAttributes: Analysis['metadata']['keyAttributes'];
|
|
14
19
|
addedKeyAttributes: Analysis['metadata']['keyAttributes'];
|
|
15
20
|
removedKeyAttributes: Analysis['metadata']['keyAttributes'];
|
|
21
|
+
modifiedKeyAttributes?: ModifiedKeyAttribute[];
|
|
16
22
|
dependentAnalyses: ReadonlyAnalysisMap;
|
|
17
23
|
existingScenarios: Scenario[];
|
|
18
24
|
commitDiff: string;
|
|
@@ -26,6 +32,7 @@ export default function generateChangesEntityScenariosGenerator({
|
|
|
26
32
|
keyAttributes,
|
|
27
33
|
addedKeyAttributes,
|
|
28
34
|
removedKeyAttributes,
|
|
35
|
+
modifiedKeyAttributes,
|
|
29
36
|
dependentAnalyses,
|
|
30
37
|
existingScenarios,
|
|
31
38
|
commitDiff,
|
|
@@ -98,6 +105,25 @@ export default function generateChangesEntityScenariosGenerator({
|
|
|
98
105
|
? JSON.stringify(removedKeyAttributes, null, 2)
|
|
99
106
|
: 'None';
|
|
100
107
|
|
|
108
|
+
// Format modified key attributes to highlight new usages
|
|
109
|
+
const modifiedSection =
|
|
110
|
+
modifiedKeyAttributes && modifiedKeyAttributes.length > 0
|
|
111
|
+
? JSON.stringify(
|
|
112
|
+
modifiedKeyAttributes.map((mod) => ({
|
|
113
|
+
localVariable: mod.keyAttribute.internalPath,
|
|
114
|
+
dataStructurePath: mod.keyAttribute.dataStructurePath,
|
|
115
|
+
description: mod.keyAttribute.description,
|
|
116
|
+
newCodeUsages: mod.newSourceLocations?.map((loc) => ({
|
|
117
|
+
line: loc.lineNumber,
|
|
118
|
+
code: loc.codeSnippet,
|
|
119
|
+
context: loc.description,
|
|
120
|
+
})),
|
|
121
|
+
})),
|
|
122
|
+
null,
|
|
123
|
+
2,
|
|
124
|
+
)
|
|
125
|
+
: 'None';
|
|
126
|
+
|
|
101
127
|
const changedFieldsSection =
|
|
102
128
|
changedDataStructureFields.length > 0
|
|
103
129
|
? `
|
|
@@ -197,6 +223,12 @@ ${addedSection}
|
|
|
197
223
|
\`\`\`json
|
|
198
224
|
${removedSection}
|
|
199
225
|
\`\`\`
|
|
226
|
+
|
|
227
|
+
## Key Attributes with New Usages
|
|
228
|
+
These existing key attributes have NEW code usages that may warrant new or updated scenarios:
|
|
229
|
+
\`\`\`json
|
|
230
|
+
${modifiedSection}
|
|
231
|
+
\`\`\`
|
|
200
232
|
${changedFieldsSection}
|
|
201
233
|
## Current Key Attributes
|
|
202
234
|
\`\`\`json
|
|
@@ -846,6 +846,20 @@ export class FileAnalyzer {
|
|
|
846
846
|
return getEntityType({ entityName, sourceFile: this.sourceFile });
|
|
847
847
|
}
|
|
848
848
|
|
|
849
|
+
/**
|
|
850
|
+
* Checks if the entity (function/component) is async.
|
|
851
|
+
* Async functions in Next.js are Server Components that need special handling.
|
|
852
|
+
*/
|
|
853
|
+
isEntityAsync(entityName: string): boolean {
|
|
854
|
+
if (!this.sourceFile) return false;
|
|
855
|
+
const entityNode = lib.asts.sourceFiles.getEntityNode({
|
|
856
|
+
entityName,
|
|
857
|
+
sourceFile: this.sourceFile,
|
|
858
|
+
});
|
|
859
|
+
if (!entityNode) return false;
|
|
860
|
+
return lib.asts.nodes.isAsyncFunction(entityNode);
|
|
861
|
+
}
|
|
862
|
+
|
|
849
863
|
getEntityStartAndEnd(entityName: string): { start: number; end: number } {
|
|
850
864
|
if (!this.sourceFile) return { start: 0, end: 0 };
|
|
851
865
|
const node = this.getAllEntityNodes()[entityName];
|
|
@@ -7,6 +7,7 @@ export { getCallExpressionNames } from './getCallExpressionNames';
|
|
|
7
7
|
export { getNodeType } from './getNodeType';
|
|
8
8
|
export { getFunctionNodeType } from './getFunctionNodeType';
|
|
9
9
|
export { isDefaultExport } from './isDefaultExport';
|
|
10
|
+
export { isAsyncFunction } from './isAsyncFunction';
|
|
10
11
|
|
|
11
12
|
interface ImportInfo {
|
|
12
13
|
packageName: string;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a node represents an async function or component.
|
|
5
|
+
* This includes:
|
|
6
|
+
* - Function declarations with async modifier
|
|
7
|
+
* - Arrow functions with async modifier
|
|
8
|
+
* - Variable declarations initialized with async functions
|
|
9
|
+
* - Method declarations with async modifier
|
|
10
|
+
*/
|
|
11
|
+
export function isAsyncFunction(node: ts.Node): boolean {
|
|
12
|
+
if (!node) return false;
|
|
13
|
+
|
|
14
|
+
// Direct function declaration: async function foo() {}
|
|
15
|
+
if (ts.isFunctionDeclaration(node)) {
|
|
16
|
+
return hasAsyncModifier(node);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Arrow function: const foo = async () => {}
|
|
20
|
+
if (ts.isArrowFunction(node)) {
|
|
21
|
+
return hasAsyncModifier(node);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Function expression: const foo = async function() {}
|
|
25
|
+
if (ts.isFunctionExpression(node)) {
|
|
26
|
+
return hasAsyncModifier(node);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Method declaration: async method() {}
|
|
30
|
+
if (ts.isMethodDeclaration(node)) {
|
|
31
|
+
return hasAsyncModifier(node);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Variable declaration: const foo = async () => {} or const foo = async function() {}
|
|
35
|
+
if (ts.isVariableDeclaration(node) && node.initializer) {
|
|
36
|
+
return isAsyncFunction(node.initializer);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Variable statement: export const foo = async () => {}
|
|
40
|
+
if (ts.isVariableStatement(node)) {
|
|
41
|
+
for (const decl of node.declarationList.declarations) {
|
|
42
|
+
if (decl.initializer && isAsyncFunction(decl.initializer)) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Export assignment: export default async function() {}
|
|
49
|
+
if (ts.isExportAssignment(node) && node.expression) {
|
|
50
|
+
return isAsyncFunction(node.expression);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function hasAsyncModifier(
|
|
57
|
+
node:
|
|
58
|
+
| ts.FunctionDeclaration
|
|
59
|
+
| ts.ArrowFunction
|
|
60
|
+
| ts.FunctionExpression
|
|
61
|
+
| ts.MethodDeclaration,
|
|
62
|
+
): boolean {
|
|
63
|
+
if (!node.modifiers) return false;
|
|
64
|
+
return node.modifiers.some(
|
|
65
|
+
(modifier) => modifier.kind === ts.SyntaxKind.AsyncKeyword,
|
|
66
|
+
);
|
|
67
|
+
}
|
|
@@ -104,6 +104,13 @@ export default async function prepareEntityDataStructures(
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
// LOGGING: Track dependencySchemas entity names for debugging :: format issues
|
|
108
|
+
const allEntityNames: string[] = [];
|
|
109
|
+
for (const filePath in clonedDependencySchemas) {
|
|
110
|
+
for (const entityName in clonedDependencySchemas[filePath]) {
|
|
111
|
+
allEntityNames.push(`${filePath}:${entityName}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
107
114
|
entity.metadata.isolatedDataStructure = {
|
|
108
115
|
signatureSchema: deduplicateFunctionSchemas(
|
|
109
116
|
isolatedDataStructure.signatureSchema,
|
|
@@ -185,17 +192,11 @@ export default async function prepareEntityDataStructures(
|
|
|
185
192
|
importedExport.isMocked === true ||
|
|
186
193
|
importedExport.isMocked === false
|
|
187
194
|
) {
|
|
188
|
-
console.log(
|
|
189
|
-
`CodeYam: [${entity.name}] SKIP ${importedExport.name} - already has isMocked=${importedExport.isMocked}`,
|
|
190
|
-
);
|
|
191
195
|
continue;
|
|
192
196
|
}
|
|
193
197
|
|
|
194
198
|
// Never mock visual components - they render UI and should use real implementation
|
|
195
199
|
if (importedExport.entityType === 'visual') {
|
|
196
|
-
console.log(
|
|
197
|
-
`CodeYam: [${entity.name}] SKIP ${importedExport.name} - visual component, setting isMocked=false`,
|
|
198
|
-
);
|
|
199
200
|
importedExport.isMocked = false;
|
|
200
201
|
continue;
|
|
201
202
|
}
|
|
@@ -213,23 +214,8 @@ export default async function prepareEntityDataStructures(
|
|
|
213
214
|
const isServerOnly = importedFileContent
|
|
214
215
|
? isServerOnlyFile(importedFileContent)
|
|
215
216
|
: 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
|
-
);
|
|
228
217
|
|
|
229
218
|
if (importedFileContent && isServerOnly) {
|
|
230
|
-
console.log(
|
|
231
|
-
`CodeYam: [${entity.name}] ✓ MARKING ${importedExport.name} as isMocked=true (server-only file detected)`,
|
|
232
|
-
);
|
|
233
219
|
importedExport.isMocked = true;
|
|
234
220
|
continue;
|
|
235
221
|
}
|
|
@@ -240,9 +226,6 @@ export default async function prepareEntityDataStructures(
|
|
|
240
226
|
dep.entityName === importedExport.name,
|
|
241
227
|
);
|
|
242
228
|
importedExport.isMocked = matchesMockedDep;
|
|
243
|
-
console.log(
|
|
244
|
-
`CodeYam: [${entity.name}] ${importedExport.name} isMocked=${matchesMockedDep} (from mockedDependencies)`,
|
|
245
|
-
);
|
|
246
229
|
}
|
|
247
230
|
|
|
248
231
|
// Browser globals that should always be mocked (they make network calls)
|
|
@@ -328,19 +311,21 @@ async function getEntityDataStructureAndFunctionCalls({
|
|
|
328
311
|
functionName: importedExport.name,
|
|
329
312
|
});
|
|
330
313
|
|
|
331
|
-
// If no signature found, this function doesn't exist in the analysis
|
|
332
|
-
if (!signatureSchema) {
|
|
333
|
-
return acc;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
314
|
const returnValueSchema = getReturnValue(dataStructure, {
|
|
337
315
|
functionName: importedExport.name,
|
|
338
316
|
});
|
|
339
317
|
|
|
318
|
+
// If neither signature nor return value found, this function doesn't exist in the analysis.
|
|
319
|
+
// We need to check BOTH because hooks like useParams() have no signature (no arguments)
|
|
320
|
+
// but DO have a return value that needs to be mocked.
|
|
321
|
+
if (!signatureSchema && !returnValueSchema) {
|
|
322
|
+
return acc;
|
|
323
|
+
}
|
|
324
|
+
|
|
340
325
|
// Clone schemas before deduplication to avoid mutating shared references
|
|
341
326
|
// getReturnValue() and getFunctionSignature() return direct references, so we need
|
|
342
327
|
// to clone them before passing to deduplicateFunctionSchemas (which may mutate)
|
|
343
|
-
const clonedSignatureSchema = { ...signatureSchema };
|
|
328
|
+
const clonedSignatureSchema = { ...(signatureSchema ?? {}) };
|
|
344
329
|
const clonedReturnValueSchema = { ...(returnValueSchema ?? {}) };
|
|
345
330
|
|
|
346
331
|
acc[importedExport.filePath] ||= {};
|
|
@@ -365,53 +350,57 @@ async function getEntityDataStructureAndFunctionCalls({
|
|
|
365
350
|
fc.name.startsWith(importedExport.name + '<'),
|
|
366
351
|
);
|
|
367
352
|
|
|
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
353
|
for (const efc of matchingCalls) {
|
|
374
354
|
// Check if this call has perVariableSchemas (multiple calls with same signature)
|
|
355
|
+
// This is the destructuring case: const { a, b, c } = useLoaderData()
|
|
356
|
+
// Instead of creating ::variable qualified keys, merge into a single entry
|
|
357
|
+
// with the call signature as key and named properties in the schema
|
|
375
358
|
if (efc?.perVariableSchemas) {
|
|
359
|
+
// Use the call signature as the key (e.g., "useLoaderData<typeof loader>()")
|
|
360
|
+
const callSignatureKey = efc.callSignature;
|
|
361
|
+
|
|
362
|
+
// Merge all variable schemas by prepending the call signature to each path.
|
|
363
|
+
// perVariableSchemas paths are like "functionCallReturnValue.entities.sha"
|
|
364
|
+
// We need to prefix them with the call signature to get:
|
|
365
|
+
// "useLoaderData<typeof loader>().functionCallReturnValue.entities.sha"
|
|
366
|
+
const mergedReturnValueSchema: Record<string, string> = {};
|
|
367
|
+
|
|
368
|
+
// Set the top-level return value as object since it contains named properties
|
|
369
|
+
mergedReturnValueSchema[
|
|
370
|
+
`${callSignatureKey}.functionCallReturnValue`
|
|
371
|
+
] = 'object';
|
|
372
|
+
|
|
376
373
|
for (const [varName, perVarSchema] of Object.entries(
|
|
377
374
|
efc.perVariableSchemas,
|
|
378
375
|
)) {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
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
|
-
};
|
|
376
|
+
for (const [path, type] of Object.entries(perVarSchema)) {
|
|
377
|
+
// Prepend the call signature to the path
|
|
378
|
+
// Input: "functionCallReturnValue.entities.sha"
|
|
379
|
+
// Output: "useLoaderData<typeof loader>().functionCallReturnValue.entities.sha"
|
|
380
|
+
const rewrittenPath = `${callSignatureKey}.${path}`;
|
|
381
|
+
mergedReturnValueSchema[rewrittenPath] = type;
|
|
382
|
+
}
|
|
400
383
|
}
|
|
384
|
+
|
|
385
|
+
acc[importedExport.filePath][callSignatureKey] = {
|
|
386
|
+
signatureSchema: deduplicateFunctionSchemas({
|
|
387
|
+
...signatureSchema,
|
|
388
|
+
}),
|
|
389
|
+
returnValueSchema: deduplicateFunctionSchemas(
|
|
390
|
+
mergedReturnValueSchema,
|
|
391
|
+
),
|
|
392
|
+
usageEquivalencies:
|
|
393
|
+
getUsageEquivalencies(dataStructure, importedExport.name) ?? {},
|
|
394
|
+
sourceEquivalencies:
|
|
395
|
+
getSourceEquivalencies(dataStructure, importedExport.name) ?? {},
|
|
396
|
+
};
|
|
401
397
|
} else if (efc?.receivingVariableNames?.length === 1) {
|
|
402
398
|
// For parameterized calls like useFetcher<UserData>(), each is a separate entry
|
|
403
|
-
// with a single receivingVariableName.
|
|
404
|
-
// the specific return value for this parameterized call.
|
|
399
|
+
// with a single receivingVariableName. Use the call signature as the key.
|
|
405
400
|
const varName = efc.receivingVariableNames[0];
|
|
406
401
|
|
|
407
|
-
//
|
|
408
|
-
const
|
|
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}`;
|
|
402
|
+
// Use the call signature as the key (e.g., "useFetcher<UserData>()")
|
|
403
|
+
const callSignatureKey = efc.callSignature;
|
|
415
404
|
|
|
416
405
|
// PREFER perVariableSchemas over getReturnValue() when available
|
|
417
406
|
// perVariableSchemas has the SPECIFIC schema for this parameterized call,
|
|
@@ -434,7 +423,7 @@ async function getEntityDataStructureAndFunctionCalls({
|
|
|
434
423
|
parameterizedReturnValue &&
|
|
435
424
|
Object.keys(parameterizedReturnValue).length > 0
|
|
436
425
|
) {
|
|
437
|
-
acc[importedExport.filePath][
|
|
426
|
+
acc[importedExport.filePath][callSignatureKey] = {
|
|
438
427
|
signatureSchema: deduplicateFunctionSchemas({
|
|
439
428
|
...signatureSchema,
|
|
440
429
|
}),
|
|
@@ -557,6 +546,7 @@ async function getEntityDataStructureAndFunctionCalls({
|
|
|
557
546
|
) {
|
|
558
547
|
variableNames.push(...aggregatedReceivingVariableNames);
|
|
559
548
|
}
|
|
549
|
+
|
|
560
550
|
if (variableNames.length > 0) {
|
|
561
551
|
callVariableNames[entityName] = variableNames;
|
|
562
552
|
}
|
|
@@ -776,14 +766,28 @@ export function determineMockedDependencies(entity: Entity) {
|
|
|
776
766
|
entityReturnValueSchema,
|
|
777
767
|
);
|
|
778
768
|
|
|
769
|
+
// Check if returnValueSchema is completely empty (no traced calls at all)
|
|
770
|
+
// This indicates a side-effect function that we couldn't trace
|
|
771
|
+
const returnValueSchemaEmpty =
|
|
772
|
+
Object.keys(entityReturnValueSchema ?? {}).length === 0;
|
|
773
|
+
|
|
779
774
|
const entityShouldBeMocked =
|
|
780
775
|
!onlyHasJsxComponents &&
|
|
781
776
|
(isValidationFn ||
|
|
782
777
|
hasChainedCallsWithNoReturn ||
|
|
778
|
+
// If entity takes no args AND has return value, it reads from external source
|
|
779
|
+
// Examples: useParams(), useAuth(), getConfig()
|
|
780
|
+
(emptySignature && hasReturnValue) ||
|
|
781
|
+
// If entity takes no args AND returnValueSchema is completely empty,
|
|
782
|
+
// it's a side-effect function calling external services
|
|
783
|
+
// Examples: logPageView(), initializeAnalytics(), trackEvent()
|
|
784
|
+
// NOTE: We don't mock entities that have function markers but no return value
|
|
785
|
+
// (like React components: FileProvider() has 'function' type but no return data)
|
|
786
|
+
(emptySignature && returnValueSchemaEmpty) ||
|
|
783
787
|
((signatureHasFunctions || returnValueHasFunctions) &&
|
|
784
788
|
hasReturnValue &&
|
|
785
|
-
|
|
786
|
-
|
|
789
|
+
!complexSignature &&
|
|
790
|
+
complexReturnValue));
|
|
787
791
|
|
|
788
792
|
if (entityShouldBeMocked) {
|
|
789
793
|
mockedEntities.push({
|
|
@@ -376,6 +376,12 @@ export default async function analyzeEntities({
|
|
|
376
376
|
// Circular dependency detected in path - skip
|
|
377
377
|
continue;
|
|
378
378
|
}
|
|
379
|
+
// If already visited via another traversal path, skip to avoid deadlock.
|
|
380
|
+
// Its subtree has been fully explored; any leaves are already in leafKeys.
|
|
381
|
+
// Blocking on it would just propagate the block and cause stuck analysis.
|
|
382
|
+
if (visited.has(dependentEntityKey)) {
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
379
385
|
isLeaf = false;
|
|
380
386
|
visitEntity(dependentEntity, [...path, dependentEntityKey]);
|
|
381
387
|
}
|
|
@@ -161,6 +161,9 @@ export default async function findOrCreateEntity({
|
|
|
161
161
|
const defaultExport = fileAnalyzer.isDefaultExport(entity.name);
|
|
162
162
|
entity.metadata.namedExport = !defaultExport;
|
|
163
163
|
|
|
164
|
+
// Detect if the entity is an async function/component (Server Component in Next.js)
|
|
165
|
+
entity.metadata.isAsync = fileAnalyzer.isEntityAsync(localEntityName);
|
|
166
|
+
|
|
164
167
|
if (defaultExport) {
|
|
165
168
|
const allEntityNodes = fileAnalyzer.getAllEntityNodes();
|
|
166
169
|
entity.metadata.exportAlias = Object.keys(allEntityNodes).find(
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
pushAnalysisError,
|
|
23
23
|
Semaphore,
|
|
24
24
|
} from '~codeyam/utils';
|
|
25
|
+
import deepEqual from '../utils/deepEqual';
|
|
25
26
|
|
|
26
27
|
export interface AnalyzeChangeArgs {
|
|
27
28
|
previousAnalysis: Analysis;
|
|
@@ -133,15 +134,30 @@ export default async function analyzeChange({
|
|
|
133
134
|
analysis.status.steps.push(keyAttributesStep);
|
|
134
135
|
}
|
|
135
136
|
|
|
136
|
-
|
|
137
|
-
analysis.metadata.scenariosDataStructure
|
|
138
|
-
previousAnalysis.metadata.scenariosDataStructure
|
|
139
|
-
)
|
|
137
|
+
const dataStructureUnchanged = deepEqual(
|
|
138
|
+
analysis.metadata.scenariosDataStructure,
|
|
139
|
+
previousAnalysis.metadata.scenariosDataStructure,
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
const keyAttributesUnchanged = deepEqual(
|
|
143
|
+
analysis.metadata.keyAttributes,
|
|
144
|
+
previousAnalysis.metadata.keyAttributes,
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
if (dataStructureUnchanged && keyAttributesUnchanged) {
|
|
140
148
|
awsLogDebugLevel(
|
|
141
149
|
1,
|
|
142
|
-
`Data structure unchanged, reusing previous scenarios for ${entity.name}...`,
|
|
150
|
+
`Data structure and key attributes unchanged, reusing previous scenarios for ${entity.name}...`,
|
|
143
151
|
);
|
|
144
|
-
|
|
152
|
+
// Reuse previous scenarios but mark them for recapture if entity code changed
|
|
153
|
+
analysis.scenarios = previousAnalysis.scenarios.map((scenario) => ({
|
|
154
|
+
...scenario,
|
|
155
|
+
metadata: {
|
|
156
|
+
...scenario.metadata,
|
|
157
|
+
// Only mark for recapture if entity code actually changed
|
|
158
|
+
needsRecapture: entityChanged,
|
|
159
|
+
},
|
|
160
|
+
}));
|
|
145
161
|
} else {
|
|
146
162
|
if (!steps || steps.includes(Step.Scenarios)) {
|
|
147
163
|
awsLogDebugLevel(1, `Generating scenarios for ${entity.name}...`);
|
|
@@ -271,13 +271,17 @@ export default async function analyzeEntity({
|
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
+
// Return early if analysis is already complete for its purpose:
|
|
275
|
+
// - Full analysis: has analyzedTreeSha
|
|
276
|
+
// - Dependency analysis: has keyAttributes (Structure + KeyAttributes already ran)
|
|
277
|
+
const isCompleteDependencyAnalysis =
|
|
278
|
+
analyzeAsDependency && !!existingAnalysis.metadata?.keyAttributes;
|
|
279
|
+
|
|
274
280
|
if (
|
|
275
281
|
!force &&
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
// existingAnalysis.status?.readyToBeCaptured ||
|
|
280
|
-
// branchCommitSha)
|
|
282
|
+
existingAnalysis.dependencyAnalyzedTreeSha ===
|
|
283
|
+
dependencyAnalyzedTreeSha &&
|
|
284
|
+
(!!existingAnalysis.analyzedTreeSha || isCompleteDependencyAnalysis)
|
|
281
285
|
) {
|
|
282
286
|
awsLogDebugLevel(1, `Using existing analysis for ${entity.name}...`);
|
|
283
287
|
awsLog('Returning existing analysis', {
|