@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
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@aws-sdk/client-codebuild": "^3.948.0",
|
|
15
|
-
"@aws-sdk/client-cloudwatch-logs": "^3.
|
|
15
|
+
"@aws-sdk/client-cloudwatch-logs": "^3.966.0",
|
|
16
16
|
"@aws-sdk/client-dynamodb": "^3.956.0",
|
|
17
17
|
"@aws-sdk/client-ecr": "^3.948.0",
|
|
18
18
|
"@aws-sdk/client-ecs": "^3.956.0",
|
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CodeBuildClient,
|
|
3
2
|
BatchGetBuildsCommand,
|
|
3
|
+
CodeBuildClient,
|
|
4
4
|
} from '@aws-sdk/client-codebuild';
|
|
5
5
|
|
|
6
|
+
export interface BuildResult {
|
|
7
|
+
status: 'SUCCEEDED' | 'FAILED' | 'TIMED_OUT';
|
|
8
|
+
buildId: string;
|
|
9
|
+
consoleUrl: string;
|
|
10
|
+
failedPhase?: {
|
|
11
|
+
phaseType: string;
|
|
12
|
+
statusCode?: string;
|
|
13
|
+
message?: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getConsoleUrl(buildId: string): string {
|
|
18
|
+
// buildId format: project-name:uuid
|
|
19
|
+
// ARN format: arn:aws:codebuild:region:account:build/project-name:uuid
|
|
20
|
+
const region = process.env.AWS_REGION || 'us-east-1';
|
|
21
|
+
const encodedBuildId = encodeURIComponent(buildId);
|
|
22
|
+
return `https://${region}.console.aws.amazon.com/codesuite/codebuild/projects/${buildId.split(':')[0]}/build/${encodedBuildId}/log`;
|
|
23
|
+
}
|
|
24
|
+
|
|
6
25
|
export default async function waitForBuild(
|
|
7
26
|
buildId: string,
|
|
8
|
-
): Promise<
|
|
27
|
+
): Promise<BuildResult> {
|
|
9
28
|
const codeBuildClient = new CodeBuildClient({});
|
|
10
29
|
|
|
11
30
|
let attempts = 0;
|
|
@@ -23,9 +42,11 @@ export default async function waitForBuild(
|
|
|
23
42
|
throw new Error(`Build ${buildId} not found`);
|
|
24
43
|
}
|
|
25
44
|
|
|
45
|
+
const consoleUrl = getConsoleUrl(buildId);
|
|
46
|
+
|
|
26
47
|
switch (build.buildStatus) {
|
|
27
48
|
case 'SUCCEEDED':
|
|
28
|
-
return 'SUCCEEDED';
|
|
49
|
+
return { status: 'SUCCEEDED', buildId, consoleUrl };
|
|
29
50
|
case 'FAILED':
|
|
30
51
|
case 'FAULT':
|
|
31
52
|
case 'STOPPED': {
|
|
@@ -33,23 +54,22 @@ export default async function waitForBuild(
|
|
|
33
54
|
const failedPhase = build.phases?.find(
|
|
34
55
|
(phase) => phase.phaseStatus === 'FAILED',
|
|
35
56
|
);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
return 'FAILED';
|
|
57
|
+
const context = failedPhase?.contexts?.[0];
|
|
58
|
+
return {
|
|
59
|
+
status: 'FAILED',
|
|
60
|
+
buildId,
|
|
61
|
+
consoleUrl,
|
|
62
|
+
failedPhase: failedPhase
|
|
63
|
+
? {
|
|
64
|
+
phaseType: failedPhase.phaseType ?? 'UNKNOWN',
|
|
65
|
+
statusCode: context?.statusCode,
|
|
66
|
+
message: context?.message,
|
|
67
|
+
}
|
|
68
|
+
: undefined,
|
|
69
|
+
};
|
|
50
70
|
}
|
|
51
71
|
case 'TIMED_OUT':
|
|
52
|
-
return 'TIMED_OUT';
|
|
72
|
+
return { status: 'TIMED_OUT', buildId, consoleUrl };
|
|
53
73
|
case 'IN_PROGRESS':
|
|
54
74
|
await new Promise((resolve) => setTimeout(resolve, 10000)); // Wait 10 seconds
|
|
55
75
|
attempts++;
|
|
@@ -59,5 +79,9 @@ export default async function waitForBuild(
|
|
|
59
79
|
}
|
|
60
80
|
}
|
|
61
81
|
|
|
62
|
-
return
|
|
82
|
+
return {
|
|
83
|
+
status: 'TIMED_OUT',
|
|
84
|
+
buildId,
|
|
85
|
+
consoleUrl: getConsoleUrl(buildId),
|
|
86
|
+
};
|
|
63
87
|
}
|
|
@@ -5,18 +5,19 @@ export default function ecsDefineContainer({
|
|
|
5
5
|
containerImage,
|
|
6
6
|
environmentVariables = {},
|
|
7
7
|
openPort,
|
|
8
|
-
|
|
8
|
+
command,
|
|
9
9
|
}: {
|
|
10
10
|
containerName: string;
|
|
11
11
|
containerImage: string;
|
|
12
12
|
environmentVariables?: { [key: string]: string };
|
|
13
13
|
openPort?: number;
|
|
14
|
-
|
|
14
|
+
command?: string[];
|
|
15
15
|
}): ContainerDefinition {
|
|
16
16
|
return {
|
|
17
17
|
name: containerName,
|
|
18
18
|
image: containerImage,
|
|
19
19
|
essential: true,
|
|
20
|
+
command,
|
|
20
21
|
environment: Object.entries(environmentVariables).map(([name, value]) => ({
|
|
21
22
|
name,
|
|
22
23
|
value,
|
|
@@ -38,6 +39,5 @@ export default function ecsDefineContainer({
|
|
|
38
39
|
'awslogs-stream-prefix': `${process.env.ECS_CLUSTER_NAME}`,
|
|
39
40
|
},
|
|
40
41
|
},
|
|
41
|
-
dependsOn,
|
|
42
42
|
};
|
|
43
43
|
}
|
|
@@ -5,51 +5,22 @@ export type EcsStartConfig = {
|
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Prepare to run an ECS task for
|
|
9
|
-
*
|
|
8
|
+
* Prepare to run an ECS task for analysis with distributed capture orchestration.
|
|
9
|
+
* Uses the unified 'combo' image which includes both analysis and capture capabilities.
|
|
10
10
|
*/
|
|
11
|
-
export function
|
|
12
|
-
projectEnvironmentVariables: Record<string, string>,
|
|
13
|
-
playwrightEnvironmentVariables: Record<string, string>,
|
|
14
|
-
): EcsStartConfig {
|
|
15
|
-
return {
|
|
16
|
-
taskDefinition: getEcsTaskDefinitionName(
|
|
17
|
-
EcsTaskDefinitionUse.AnalyzeThenCapture,
|
|
18
|
-
),
|
|
19
|
-
containerEnvironmentVariables: [
|
|
20
|
-
[
|
|
21
|
-
getEcsImageNameForType(EcsImageType.Project),
|
|
22
|
-
projectEnvironmentVariables,
|
|
23
|
-
],
|
|
24
|
-
[
|
|
25
|
-
getEcsImageNameForType(EcsImageType.Playwright),
|
|
26
|
-
playwrightEnvironmentVariables,
|
|
27
|
-
],
|
|
28
|
-
],
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Prepare to run an ECS task for the new analysis flow with distributed capture
|
|
34
|
-
* tasks orchestrated from only a 'project' image.
|
|
35
|
-
*/
|
|
36
|
-
export function getEcsStartConfigFoAnalysisWithOrchestration(
|
|
11
|
+
export function getEcsStartConfigForAnalysis(
|
|
37
12
|
environmentVariables: Record<string, string>,
|
|
38
13
|
): EcsStartConfig {
|
|
39
14
|
return {
|
|
40
|
-
taskDefinition: getEcsTaskDefinitionName(
|
|
41
|
-
|
|
42
|
-
),
|
|
43
|
-
containerEnvironmentVariables: [
|
|
44
|
-
[getEcsImageNameForType(EcsImageType.Project), environmentVariables],
|
|
45
|
-
],
|
|
15
|
+
taskDefinition: getEcsTaskDefinitionName(EcsTaskDefinitionUse.Analysis),
|
|
16
|
+
containerEnvironmentVariables: [[getEcsImageName(), environmentVariables]],
|
|
46
17
|
};
|
|
47
18
|
}
|
|
48
19
|
|
|
49
20
|
/**
|
|
50
21
|
* Prepare to run an ECS worker task that implements the capture portion of the
|
|
51
|
-
* distributed orchestration
|
|
52
|
-
* from a task created with `
|
|
22
|
+
* distributed orchestration. Uses the same unified 'combo' image.
|
|
23
|
+
* This task is launched from a task created with `getEcsStartConfigForAnalysis()`
|
|
53
24
|
*/
|
|
54
25
|
export function getEcsStartConfigForOrchestrationTask(
|
|
55
26
|
environmentVariables: Record<string, string>,
|
|
@@ -58,52 +29,29 @@ export function getEcsStartConfigForOrchestrationTask(
|
|
|
58
29
|
taskDefinition: getEcsTaskDefinitionName(
|
|
59
30
|
EcsTaskDefinitionUse.OrchestrationTask,
|
|
60
31
|
),
|
|
61
|
-
containerEnvironmentVariables: [
|
|
62
|
-
[getEcsImageNameForType(EcsImageType.Combo), environmentVariables],
|
|
63
|
-
],
|
|
32
|
+
containerEnvironmentVariables: [[getEcsImageName(), environmentVariables]],
|
|
64
33
|
};
|
|
65
34
|
}
|
|
66
35
|
|
|
67
36
|
export enum EcsTaskDefinitionUse {
|
|
68
|
-
/*
|
|
69
|
-
|
|
70
|
-
/* A
|
|
71
|
-
AnalyzeWithOrchestration = 'analyze-with-orchestration',
|
|
72
|
-
/* A worker task that combines 'project' and 'playwright' code, launched by orchestration. */
|
|
37
|
+
/* Main analysis task - runs analysis and fires up distributed capture orchestration. */
|
|
38
|
+
Analysis = 'analysis',
|
|
39
|
+
/* A worker task launched by orchestration to capture scenarios. */
|
|
73
40
|
OrchestrationTask = 'orchestration-task',
|
|
74
41
|
}
|
|
75
42
|
|
|
76
43
|
export function getEcsTaskDefinitionName(forUse: EcsTaskDefinitionUse): string {
|
|
77
44
|
switch (forUse) {
|
|
78
|
-
case EcsTaskDefinitionUse.
|
|
79
|
-
return `${process.env.ECR_REPOSITORY_NAME}-
|
|
80
|
-
case EcsTaskDefinitionUse.AnalyzeWithOrchestration:
|
|
81
|
-
return `${process.env.ECR_REPOSITORY_NAME}-project`;
|
|
45
|
+
case EcsTaskDefinitionUse.Analysis:
|
|
46
|
+
return `${process.env.ECR_REPOSITORY_NAME}-analysis`;
|
|
82
47
|
case EcsTaskDefinitionUse.OrchestrationTask:
|
|
83
|
-
return `${process.env.ECR_REPOSITORY_NAME}-
|
|
48
|
+
return `${process.env.ECR_REPOSITORY_NAME}-orchestration`;
|
|
84
49
|
default:
|
|
85
50
|
throw new Error(`Unknown task definition use: ${forUse}`);
|
|
86
51
|
}
|
|
87
52
|
}
|
|
88
53
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
/* The playwright capture process which waits for the project to be ready. */
|
|
93
|
-
Playwright = 'playwright',
|
|
94
|
-
/* A combo image that combines both project and playwright code, used by orchestration. */
|
|
95
|
-
Combo = 'combo',
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export function getEcsImageNameForType(type: EcsImageType): string {
|
|
99
|
-
switch (type) {
|
|
100
|
-
case EcsImageType.Project:
|
|
101
|
-
return `${process.env.ECR_REPOSITORY_NAME}-project`;
|
|
102
|
-
case EcsImageType.Playwright:
|
|
103
|
-
return `${process.env.ECR_REPOSITORY_NAME}-playwright`;
|
|
104
|
-
case EcsImageType.Combo:
|
|
105
|
-
return `${process.env.ECR_REPOSITORY_NAME}-combo`;
|
|
106
|
-
default:
|
|
107
|
-
throw new Error(`Unknown image type: ${type}`);
|
|
108
|
-
}
|
|
54
|
+
/** Returns the name of the unified Docker image used for all ECS tasks. */
|
|
55
|
+
export function getEcsImageName(): string {
|
|
56
|
+
return `${process.env.ECR_REPOSITORY_NAME}-combo`;
|
|
109
57
|
}
|
|
@@ -24,11 +24,18 @@ export default async function uploadFileToS3({
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
try {
|
|
27
|
+
let lastLoggedMB = 0;
|
|
27
28
|
upload.on('httpUploadProgress', (progress) => {
|
|
28
|
-
|
|
29
|
+
const loadedMB = Math.floor((progress.loaded ?? 0) / (1024 * 1024));
|
|
30
|
+
// Log every 10MB to avoid spam
|
|
31
|
+
if (loadedMB >= lastLoggedMB + 10) {
|
|
32
|
+
lastLoggedMB = loadedMB;
|
|
33
|
+
console.log(`Uploading ${key}... ${loadedMB}MB`);
|
|
34
|
+
}
|
|
29
35
|
});
|
|
30
36
|
|
|
31
37
|
await upload.done();
|
|
38
|
+
console.log(`Uploaded ${key}`);
|
|
32
39
|
} catch (error) {
|
|
33
40
|
console.log('Error. File not uploaded.', error);
|
|
34
41
|
throw error;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { default as getComponentImportStatements } from './src/lib/getComponentImportStatements';
|
|
2
2
|
export { default as componentScenarioPageRemix } from './src/lib/componentScenarioPage/componentScenarioPageRemix';
|
|
3
3
|
export { default as componentScenarioPageNext } from './src/lib/componentScenarioPage/componentScenarioPageNext';
|
|
4
|
+
export { default as generateScenarioServerComponent } from './src/lib/componentScenarioPage/generateScenarioServerComponent';
|
|
5
|
+
export { default as generateScenarioClientWrapper } from './src/lib/componentScenarioPage/generateScenarioClientWrapper';
|
|
4
6
|
export { default as getComponentScenarioPath } from './src/lib/getComponentScenarioPath';
|
|
5
7
|
export { default as libDemoComponent } from './src/lib/libDemoComponent';
|
|
6
8
|
export { default as directExecutionScript } from './src/lib/directExecutionScript';
|
|
@@ -9,4 +11,5 @@ export { default as safeFolder } from './src/lib/safeFolder';
|
|
|
9
11
|
export { default as deepMerge } from './src/lib/deepMerge';
|
|
10
12
|
export { default as simpleRootRemix } from './src/lib/simpleRootRemix';
|
|
11
13
|
export { default as mergeRootRemix } from './src/lib/mergeRootRemix';
|
|
14
|
+
export { default as scenarioComponentForServer } from './src/lib/scenarioComponentForServer';
|
|
12
15
|
export { PLACEHOLDER_IMAGE_SRC } from './src/lib/constants';
|
|
@@ -6,6 +6,7 @@ import escapeQuotes from '../escapeQuotes';
|
|
|
6
6
|
import getIFrameMessageListenerCode from './getIFrameMessageListenerCode';
|
|
7
7
|
import getImageReplacementCode from './getImageReplacementCode';
|
|
8
8
|
import getNextJsErrorClosingCode from './getNextJsErrorClosingCode';
|
|
9
|
+
import generateScenarioServerComponent from './generateScenarioServerComponent';
|
|
9
10
|
|
|
10
11
|
const VERSION = '0.5.1';
|
|
11
12
|
|
|
@@ -28,6 +29,21 @@ export default function componentScenarioPageNext({
|
|
|
28
29
|
}) {
|
|
29
30
|
const fileName = file.name.split('.')[0];
|
|
30
31
|
|
|
32
|
+
// For async components (Server Components), generate a Server Component page
|
|
33
|
+
// that uses a separate client wrapper for interactive features
|
|
34
|
+
if (entity.metadata?.isAsync) {
|
|
35
|
+
return generateScenarioServerComponent({
|
|
36
|
+
file,
|
|
37
|
+
entity,
|
|
38
|
+
analysis,
|
|
39
|
+
currentPath,
|
|
40
|
+
appPath,
|
|
41
|
+
scenario,
|
|
42
|
+
relativeMocksDir,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// For non-async components, use the existing client component approach
|
|
31
47
|
return `/* eslint-disable */
|
|
32
48
|
"use client";
|
|
33
49
|
import {
|
|
@@ -58,7 +74,7 @@ ${getComponentImportStatement({
|
|
|
58
74
|
${getImageReplacementCode()}
|
|
59
75
|
|
|
60
76
|
function Scenario({ name, width, height, children }: { name: string, width: string, height: string, children: ReactNode }) {
|
|
61
|
-
|
|
77
|
+
|
|
62
78
|
useEffect(() => {
|
|
63
79
|
if (typeof window === 'undefined') return;
|
|
64
80
|
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import type { Scenario } from '~codeyam/types';
|
|
2
|
+
import { safeFileName } from '~codeyam/utils';
|
|
3
|
+
import getImageReplacementCode from './getImageReplacementCode';
|
|
4
|
+
import getNextJsErrorClosingCode from './getNextJsErrorClosingCode';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Generates the ScenarioClientWrapper component code.
|
|
8
|
+
* This is a Client Component that handles all the interactive features
|
|
9
|
+
* (iframe messaging, console interception, error closing, etc.)
|
|
10
|
+
* while allowing the actual page to be a Server Component.
|
|
11
|
+
*/
|
|
12
|
+
export default function generateScenarioClientWrapper(
|
|
13
|
+
scenario: Scenario,
|
|
14
|
+
): string {
|
|
15
|
+
const safeScenarioName = safeFileName(scenario.name);
|
|
16
|
+
|
|
17
|
+
return `"use client";
|
|
18
|
+
/* eslint-disable */
|
|
19
|
+
// ScenarioClientWrapper - Client Component for interactive features
|
|
20
|
+
// This wraps Server Components to add client-side interactivity
|
|
21
|
+
|
|
22
|
+
import {
|
|
23
|
+
useCallback,
|
|
24
|
+
useEffect,
|
|
25
|
+
useState,
|
|
26
|
+
type ReactNode,
|
|
27
|
+
} from 'react';
|
|
28
|
+
import { scenarios } from "./MockData_${safeScenarioName}";
|
|
29
|
+
|
|
30
|
+
// Inject image interception code at module level
|
|
31
|
+
${getImageReplacementCode()}
|
|
32
|
+
|
|
33
|
+
interface ScenarioClientWrapperProps {
|
|
34
|
+
scenarioName: string;
|
|
35
|
+
fileName: string;
|
|
36
|
+
version: string;
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function ScenarioClientWrapper({
|
|
41
|
+
scenarioName,
|
|
42
|
+
fileName,
|
|
43
|
+
version,
|
|
44
|
+
children,
|
|
45
|
+
}: ScenarioClientWrapperProps) {
|
|
46
|
+
const [internalVersion, setInternalVersion] = useState(1);
|
|
47
|
+
const [searchParams] = useState(() =>
|
|
48
|
+
typeof window !== 'undefined'
|
|
49
|
+
? new URLSearchParams(window.location.search)
|
|
50
|
+
: new URLSearchParams()
|
|
51
|
+
);
|
|
52
|
+
const widthOverride = searchParams.get('width');
|
|
53
|
+
const heightOverride = searchParams.get('height') || 'auto';
|
|
54
|
+
|
|
55
|
+
// Set page metadata
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
document.title = \`\${fileName}: \${scenarioName} CodeYam Demo v\${version}\`;
|
|
58
|
+
let metaDesc = document.querySelector('meta[name="description"]');
|
|
59
|
+
if (!metaDesc) {
|
|
60
|
+
metaDesc = document.createElement('meta');
|
|
61
|
+
metaDesc.setAttribute('name', 'description');
|
|
62
|
+
document.head.appendChild(metaDesc);
|
|
63
|
+
}
|
|
64
|
+
metaDesc.setAttribute('content', \`This is a demo of the \${fileName} component\`);
|
|
65
|
+
}, [fileName, scenarioName, version]);
|
|
66
|
+
|
|
67
|
+
// Message posting helper
|
|
68
|
+
const respond = useCallback((message: any) => {
|
|
69
|
+
try {
|
|
70
|
+
window.parent.postMessage({
|
|
71
|
+
type: 'codeyam-update',
|
|
72
|
+
name: scenarioName,
|
|
73
|
+
message,
|
|
74
|
+
}, '*');
|
|
75
|
+
} catch (e) {
|
|
76
|
+
console.warn('Error posting message to parent', message, e);
|
|
77
|
+
}
|
|
78
|
+
}, [scenarioName]);
|
|
79
|
+
|
|
80
|
+
// Handle data override messages from parent
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
const eventListener = (event: MessageEvent) => {
|
|
83
|
+
if (event.data.type === 'codeyam-override-data') {
|
|
84
|
+
const parsedData = JSON.parse(event.data.data);
|
|
85
|
+
console.log("Override data received");
|
|
86
|
+
respond("Set override data to " + JSON.stringify(parsedData, null, 2));
|
|
87
|
+
scenarios().updateData(scenarioName, parsedData);
|
|
88
|
+
setInternalVersion(prev => prev + 1);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
window.addEventListener('message', eventListener);
|
|
92
|
+
return () => window.removeEventListener('message', eventListener);
|
|
93
|
+
}, [respond, scenarioName]);
|
|
94
|
+
|
|
95
|
+
// Console interception
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
const oldConsoleLog = console.log;
|
|
98
|
+
console.log = function(...args: any[]) {
|
|
99
|
+
oldConsoleLog(...args);
|
|
100
|
+
try {
|
|
101
|
+
window.parent.postMessage({
|
|
102
|
+
type: 'codeyam-log',
|
|
103
|
+
name: scenarioName,
|
|
104
|
+
data: {
|
|
105
|
+
log: {
|
|
106
|
+
name: "console.log",
|
|
107
|
+
args
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}, '*');
|
|
111
|
+
} catch (e) {
|
|
112
|
+
oldConsoleLog('Error posting message to parent', e);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const oldConsoleError = console.error;
|
|
117
|
+
console.error = function(...args: any[]) {
|
|
118
|
+
oldConsoleError(...args);
|
|
119
|
+
window.parent.postMessage({
|
|
120
|
+
type: 'codeyam-log',
|
|
121
|
+
name: scenarioName,
|
|
122
|
+
data: {
|
|
123
|
+
log: {
|
|
124
|
+
name: "console.error",
|
|
125
|
+
args
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}, '*');
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
return () => {
|
|
132
|
+
console.log = oldConsoleLog;
|
|
133
|
+
console.error = oldConsoleError;
|
|
134
|
+
};
|
|
135
|
+
}, [scenarioName]);
|
|
136
|
+
|
|
137
|
+
// Next.js error closing
|
|
138
|
+
${getNextJsErrorClosingCode()}
|
|
139
|
+
|
|
140
|
+
// Height calculation and resize messaging
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
if (typeof window === 'undefined') return;
|
|
143
|
+
|
|
144
|
+
const calculateHeight = () => {
|
|
145
|
+
const bodyHeight = document.body.offsetHeight;
|
|
146
|
+
const htmlHeight = document.documentElement.offsetHeight;
|
|
147
|
+
const scrollHeight = Math.max(
|
|
148
|
+
document.body.scrollHeight,
|
|
149
|
+
document.documentElement.scrollHeight,
|
|
150
|
+
document.body.offsetHeight,
|
|
151
|
+
document.documentElement.offsetHeight,
|
|
152
|
+
document.body.clientHeight,
|
|
153
|
+
document.documentElement.clientHeight
|
|
154
|
+
);
|
|
155
|
+
return Math.max(100, bodyHeight, htmlHeight, scrollHeight);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const calculatedHeight = calculateHeight();
|
|
159
|
+
parent.postMessage({ type: 'codeyam-resize', name: scenarioName, height: calculatedHeight }, '*');
|
|
160
|
+
|
|
161
|
+
const eventListener = (event: MessageEvent) => {
|
|
162
|
+
if (event.data.name === scenarioName) {
|
|
163
|
+
if (event.data.type === 'codeyam-respond') {
|
|
164
|
+
const calculatedHeight = calculateHeight();
|
|
165
|
+
parent.postMessage({ type: 'codeyam-resize', name: scenarioName, height: calculatedHeight }, '*');
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
window.addEventListener('message', eventListener);
|
|
171
|
+
return () => window.removeEventListener('message', eventListener);
|
|
172
|
+
}, [scenarioName]);
|
|
173
|
+
|
|
174
|
+
const width = widthOverride || 'auto';
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<div className='flex flex-col justify-center items-center h-screen' data-version={internalVersion}>
|
|
178
|
+
<div className='w-full flex items-center justify-center'>
|
|
179
|
+
<div id='component' style={{
|
|
180
|
+
minWidth: width !== 'auto' ? \`min(\${width}, 100vw)\` : undefined,
|
|
181
|
+
height: heightOverride !== 'auto' ? heightOverride : undefined,
|
|
182
|
+
minHeight: heightOverride !== 'auto' ? heightOverride : undefined,
|
|
183
|
+
display: 'block',
|
|
184
|
+
padding: '6px'
|
|
185
|
+
}}>
|
|
186
|
+
{children}
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
`;
|
|
193
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Entity, Analysis, type File, type Scenario } from '~codeyam/types';
|
|
2
|
+
import { safeFileName } from '~codeyam/utils';
|
|
3
|
+
import getComponentImportStatement from '../getComponentImportStatement';
|
|
4
|
+
import scenarioComponentForServer from '../scenarioComponentForServer';
|
|
5
|
+
|
|
6
|
+
const VERSION = '0.5.1';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generates a Server Component page for async components (Server Components in Next.js).
|
|
10
|
+
*
|
|
11
|
+
* This is needed because:
|
|
12
|
+
* 1. Async components use await, which only works in Server Components
|
|
13
|
+
* 2. Client Components ("use client") don't support async/await in the component body
|
|
14
|
+
* 3. We use Next.js composition pattern: Server Component page renders the async component,
|
|
15
|
+
* then wraps it in a Client Component (ScenarioClientWrapper) for interactive features
|
|
16
|
+
*/
|
|
17
|
+
export default function generateScenarioServerComponent({
|
|
18
|
+
file,
|
|
19
|
+
entity,
|
|
20
|
+
analysis,
|
|
21
|
+
currentPath,
|
|
22
|
+
appPath,
|
|
23
|
+
scenario,
|
|
24
|
+
relativeMocksDir,
|
|
25
|
+
}: {
|
|
26
|
+
file: File;
|
|
27
|
+
entity: Entity;
|
|
28
|
+
analysis: Analysis;
|
|
29
|
+
currentPath: string;
|
|
30
|
+
appPath: string;
|
|
31
|
+
scenario: Scenario;
|
|
32
|
+
relativeMocksDir: string;
|
|
33
|
+
}) {
|
|
34
|
+
const fileName = file.name.split('.')[0];
|
|
35
|
+
const safeScenarioName = safeFileName(scenario.name);
|
|
36
|
+
|
|
37
|
+
return `/* eslint-disable */
|
|
38
|
+
// Server Component page for async component: ${entity.name}
|
|
39
|
+
// This page does NOT have "use client" - it runs on the server
|
|
40
|
+
import { ScenarioClientWrapper } from "${relativeMocksDir}/ScenarioClientWrapper";
|
|
41
|
+
${analysis.scenarios?.length > 0 ? `import { scenarios } from "${relativeMocksDir}/MockData_${safeScenarioName}";` : ''}
|
|
42
|
+
${getComponentImportStatement({
|
|
43
|
+
file,
|
|
44
|
+
entity,
|
|
45
|
+
analysis,
|
|
46
|
+
currentPath,
|
|
47
|
+
appPath,
|
|
48
|
+
scenario,
|
|
49
|
+
primary: true,
|
|
50
|
+
namedExport:
|
|
51
|
+
entity.name !== 'default' &&
|
|
52
|
+
(entity.metadata?.notExported || entity.metadata?.namedExport) &&
|
|
53
|
+
entity.entityType !== 'library',
|
|
54
|
+
})}
|
|
55
|
+
|
|
56
|
+
function getScenarioProps({ argumentIndex, propName }: { argumentIndex: number, propName?: string }) {
|
|
57
|
+
const data = scenarios().data();
|
|
58
|
+
const argument = data['arguments'][argumentIndex];
|
|
59
|
+
return propName ? argument[propName] : argument;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default async function Index() {
|
|
63
|
+
return (
|
|
64
|
+
<ScenarioClientWrapper
|
|
65
|
+
scenarioName="${scenario.name}"
|
|
66
|
+
fileName="${fileName}"
|
|
67
|
+
version="${VERSION}"
|
|
68
|
+
>
|
|
69
|
+
${scenarioComponentForServer(entity, analysis, scenario)}
|
|
70
|
+
</ScenarioClientWrapper>
|
|
71
|
+
);
|
|
72
|
+
}`;
|
|
73
|
+
}
|