@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
|
@@ -46,13 +46,10 @@ export default class KyselyAnalysisLoader implements AnalysisLoader {
|
|
|
46
46
|
'status',
|
|
47
47
|
])
|
|
48
48
|
// Base condition: readyToBeCaptured = true
|
|
49
|
-
// Use
|
|
49
|
+
// Use -> operator which works in both PostgreSQL and SQLite
|
|
50
|
+
// Both return a value that compares equal to string 'true'
|
|
50
51
|
.where((eb) =>
|
|
51
|
-
eb(
|
|
52
|
-
sql`json_extract(${sql.ref('status')}, '$.readyToBeCaptured')`,
|
|
53
|
-
'=',
|
|
54
|
-
sql`1`,
|
|
55
|
-
),
|
|
52
|
+
eb(sql`${sql.ref('status')} -> 'readyToBeCaptured'`, '=', 'true'),
|
|
56
53
|
)
|
|
57
54
|
// Project filter (always required)
|
|
58
55
|
.where('project_id', '=', this.config.project.id);
|
|
@@ -50,6 +50,9 @@ interface OrchestrateCaptureArgs {
|
|
|
50
50
|
taskRunner: CaptureTaskRunner;
|
|
51
51
|
analysisLoader?: AnalysisLoader;
|
|
52
52
|
pollingInterval?: number;
|
|
53
|
+
// Optional commit for metadata/progress tracking only (not filtering).
|
|
54
|
+
// Use when full=true but you still want capture progress updates on a commit.
|
|
55
|
+
metadataCommit?: Commit | null;
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
export default async function orchestrateCapture({
|
|
@@ -62,6 +65,7 @@ export default async function orchestrateCapture({
|
|
|
62
65
|
taskRunner,
|
|
63
66
|
analysisLoader,
|
|
64
67
|
pollingInterval = POLLING_INTERVAL,
|
|
68
|
+
metadataCommit,
|
|
65
69
|
}: OrchestrateCaptureArgs) {
|
|
66
70
|
if (!full && !analysisIds && !commit && !entityShas) {
|
|
67
71
|
throw new Error(
|
|
@@ -318,9 +322,12 @@ export default async function orchestrateCapture({
|
|
|
318
322
|
// console.log(
|
|
319
323
|
// `Codeyam Debug: All known analyses: ${Array.from(knownAnalyses).join(', ')}`,
|
|
320
324
|
// );
|
|
321
|
-
if
|
|
322
|
-
|
|
323
|
-
|
|
325
|
+
// Use metadataCommit if provided, otherwise fall back to commit.
|
|
326
|
+
// This allows progress tracking even when commit is null (e.g., full=true mode).
|
|
327
|
+
const trackingCommit = metadataCommit ?? commit;
|
|
328
|
+
if (trackingCommit) {
|
|
329
|
+
trackingCommit.metadata = await updateCommitMetadata({
|
|
330
|
+
commitId: trackingCommit.id,
|
|
324
331
|
runStatusUpdate: {
|
|
325
332
|
readyToBeCaptured: knownAnalyses.size,
|
|
326
333
|
capturesAttempted: capturedAnalysisIds.length + abandoned.length,
|
|
@@ -5,55 +5,30 @@
|
|
|
5
5
|
* (e.g., "eq('user_id', 'user-12345')") when the mock code expects variable
|
|
6
6
|
* references (e.g., "eq('user_id', user.id)").
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* and remaps old variable-based keys (variableName <- functionName) to canonical keys.
|
|
8
|
+
* Keys are now original call signatures (e.g., "useFetcher<User>()", "db.select(query)").
|
|
10
9
|
*
|
|
11
10
|
* @param mockData The mock data object to reconcile
|
|
12
11
|
* @param expectedKeys The expected keys from the structure
|
|
13
|
-
* @param entityName Optional entity name for canonical key remapping
|
|
14
12
|
*/
|
|
15
13
|
export function reconcileMockDataKeys(
|
|
16
14
|
mockData: Record<string, unknown>,
|
|
17
15
|
expectedKeys: string[],
|
|
18
|
-
entityName?: string,
|
|
19
16
|
): Record<string, unknown> {
|
|
20
17
|
const result: Record<string, unknown> = {};
|
|
21
|
-
// Track which canonical keys have been used for multiple calls to same hook
|
|
22
|
-
const usedCanonicalKeys = new Set<string>();
|
|
23
18
|
|
|
24
19
|
for (const [key, value] of Object.entries(mockData)) {
|
|
25
20
|
// Recursively reconcile nested objects
|
|
26
21
|
const reconciledValue =
|
|
27
22
|
value && typeof value === 'object' && !Array.isArray(value)
|
|
28
|
-
? reconcileMockDataKeys(
|
|
29
|
-
value as Record<string, unknown>,
|
|
30
|
-
expectedKeys,
|
|
31
|
-
entityName,
|
|
32
|
-
)
|
|
23
|
+
? reconcileMockDataKeys(value as Record<string, unknown>, expectedKeys)
|
|
33
24
|
: value;
|
|
34
25
|
|
|
35
26
|
// Check if key matches an expected key exactly
|
|
36
27
|
if (expectedKeys.includes(key)) {
|
|
37
28
|
result[key] = reconciledValue;
|
|
38
|
-
usedCanonicalKeys.add(key);
|
|
39
29
|
continue;
|
|
40
30
|
}
|
|
41
31
|
|
|
42
|
-
// Try to remap variable-based key to canonical key
|
|
43
|
-
if (entityName) {
|
|
44
|
-
const canonicalKey = remapToCanonicalKey(
|
|
45
|
-
key,
|
|
46
|
-
expectedKeys,
|
|
47
|
-
entityName,
|
|
48
|
-
usedCanonicalKeys,
|
|
49
|
-
);
|
|
50
|
-
if (canonicalKey) {
|
|
51
|
-
result[canonicalKey] = reconciledValue;
|
|
52
|
-
usedCanonicalKeys.add(canonicalKey);
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
32
|
// Try to find closest match using existing logic
|
|
58
33
|
const closestKey = findClosestKey(key, expectedKeys);
|
|
59
34
|
if (closestKey) {
|
|
@@ -67,79 +42,6 @@ export function reconcileMockDataKeys(
|
|
|
67
42
|
return result;
|
|
68
43
|
}
|
|
69
44
|
|
|
70
|
-
/**
|
|
71
|
-
* Attempt to remap a variable-based key to a canonical key.
|
|
72
|
-
*
|
|
73
|
-
* Variable-based format: "variableName <- functionName"
|
|
74
|
-
* Canonical format: "EntityName::hookName::index"
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* remapToCanonicalKey("currentCommit <- useLoaderData", ["DashboardPage::useLoaderData::0"], "DashboardPage", new Set())
|
|
78
|
-
* // returns "DashboardPage::useLoaderData::0"
|
|
79
|
-
*/
|
|
80
|
-
function remapToCanonicalKey(
|
|
81
|
-
key: string,
|
|
82
|
-
expectedCanonicalKeys: string[],
|
|
83
|
-
entityName: string,
|
|
84
|
-
usedKeys: Set<string>,
|
|
85
|
-
): string | null {
|
|
86
|
-
// Check if key is in variable-based format: "varName <- functionName"
|
|
87
|
-
const arrowMatch = key.match(/<-\s*(\w+)/);
|
|
88
|
-
if (!arrowMatch) {
|
|
89
|
-
// Not a variable-based key, try other patterns
|
|
90
|
-
// Check if it's a simple function call like "useLoaderData()"
|
|
91
|
-
const funcCallMatch = key.match(/^(\w+)\(\)/);
|
|
92
|
-
if (funcCallMatch) {
|
|
93
|
-
const hookName = funcCallMatch[1];
|
|
94
|
-
return findMatchingCanonicalKey(
|
|
95
|
-
hookName,
|
|
96
|
-
entityName,
|
|
97
|
-
expectedCanonicalKeys,
|
|
98
|
-
usedKeys,
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const hookName = arrowMatch[1];
|
|
105
|
-
|
|
106
|
-
return findMatchingCanonicalKey(
|
|
107
|
-
hookName,
|
|
108
|
-
entityName,
|
|
109
|
-
expectedCanonicalKeys,
|
|
110
|
-
usedKeys,
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Find a matching canonical key for a hook name within an entity.
|
|
116
|
-
*/
|
|
117
|
-
function findMatchingCanonicalKey(
|
|
118
|
-
hookName: string,
|
|
119
|
-
entityName: string,
|
|
120
|
-
expectedCanonicalKeys: string[],
|
|
121
|
-
usedKeys: Set<string>,
|
|
122
|
-
): string | null {
|
|
123
|
-
// Find all canonical keys for this entity and hook
|
|
124
|
-
const candidatePrefix = `${entityName}::${hookName}::`;
|
|
125
|
-
const candidates = expectedCanonicalKeys.filter(
|
|
126
|
-
(k) => k.startsWith(candidatePrefix) && !usedKeys.has(k),
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
if (candidates.length === 0) {
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Sort by index to prefer lower indices
|
|
134
|
-
candidates.sort((a, b) => {
|
|
135
|
-
const aIndex = parseInt(a.split('::')[2], 10);
|
|
136
|
-
const bIndex = parseInt(b.split('::')[2], 10);
|
|
137
|
-
return aIndex - bIndex;
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
return candidates[0];
|
|
141
|
-
}
|
|
142
|
-
|
|
143
45
|
/**
|
|
144
46
|
* Find the closest matching key from expectedKeys for a given key.
|
|
145
47
|
*
|
|
@@ -148,9 +50,11 @@ function findMatchingCanonicalKey(
|
|
|
148
50
|
* - Ignore the last argument value (could be literal or variable)
|
|
149
51
|
* - Match based on the common prefix
|
|
150
52
|
* - If key has no parentheses, try matching with "()" appended
|
|
53
|
+
* - If key is "funcName()" (empty args), match expected key "funcName({...})" by function name
|
|
151
54
|
*
|
|
152
55
|
* e.g., "eq('user_id', 'user-12345')" matches "eq('user_id', user.id)"
|
|
153
56
|
* e.g., "getAll" matches "getAll()"
|
|
57
|
+
* e.g., "getSurveysAction()" matches "getSurveysAction({ environmentId, ... })"
|
|
154
58
|
*/
|
|
155
59
|
function findClosestKey(key: string, expectedKeys: string[]): string | null {
|
|
156
60
|
const keyBase = extractKeyBase(key);
|
|
@@ -174,9 +78,33 @@ function findClosestKey(key: string, expectedKeys: string[]): string | null {
|
|
|
174
78
|
}
|
|
175
79
|
}
|
|
176
80
|
|
|
81
|
+
// If key is "funcName()" (empty args), try matching expected key "funcName({...})"
|
|
82
|
+
// This handles the case where LLM generates "getSurveysAction()" but expected key
|
|
83
|
+
// is "getSurveysAction({ environmentId, limit, ... })" with an object argument
|
|
84
|
+
const emptyArgsMatch = key.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\(\)$/);
|
|
85
|
+
if (emptyArgsMatch) {
|
|
86
|
+
const funcName = emptyArgsMatch[1];
|
|
87
|
+
for (const expected of expectedKeys) {
|
|
88
|
+
// Match if expected key starts with the same function name and has args
|
|
89
|
+
const expectedMatch = expected.match(
|
|
90
|
+
new RegExp(`^${escapeRegExp(funcName)}\\([^)]+\\)$`),
|
|
91
|
+
);
|
|
92
|
+
if (expectedMatch) {
|
|
93
|
+
return expected;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
177
98
|
return null;
|
|
178
99
|
}
|
|
179
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Escape special regex characters in a string.
|
|
103
|
+
*/
|
|
104
|
+
function escapeRegExp(str: string): string {
|
|
105
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
106
|
+
}
|
|
107
|
+
|
|
180
108
|
/**
|
|
181
109
|
* Normalize quotes in a string: convert double quotes to single quotes.
|
|
182
110
|
* This handles cases where the LLM generates keys with double quotes
|
|
@@ -215,6 +215,11 @@ export default async function runAnalysis({
|
|
|
215
215
|
entityShas,
|
|
216
216
|
branchName: branch?.name,
|
|
217
217
|
});
|
|
218
|
+
|
|
219
|
+
// Propagate the fallback branch to branchCommit so downstream code can use it
|
|
220
|
+
if (branchCommit && branch) {
|
|
221
|
+
branchCommit.branch = branch;
|
|
222
|
+
}
|
|
218
223
|
}
|
|
219
224
|
|
|
220
225
|
// After this block, 'commit' is the union of a regular or baseline commit
|
|
@@ -213,6 +213,108 @@ export function applyServerOnlyMocks(fileContent: string): string {
|
|
|
213
213
|
return applyServerOnlyMocksAst(fileContent);
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Check if a file exports an "env" variable that's derived from a node module import.
|
|
218
|
+
* This is a generic pattern for env configuration packages (like @t3-oss/env-*, envalid, etc.)
|
|
219
|
+
* that create server-only environment objects.
|
|
220
|
+
*
|
|
221
|
+
* Pattern detected:
|
|
222
|
+
* import { someFunc } from "some-package";
|
|
223
|
+
* export const env = someFunc({...});
|
|
224
|
+
*
|
|
225
|
+
* Returns the name of the imported function if detected, null otherwise.
|
|
226
|
+
*/
|
|
227
|
+
function detectEnvStoreFromNodeModule(sourceFile: ts.SourceFile): {
|
|
228
|
+
importedFunctionName: string;
|
|
229
|
+
modulePath: string;
|
|
230
|
+
} | null {
|
|
231
|
+
// First, collect all imported function names from node modules
|
|
232
|
+
const nodeModuleImports = new Map<string, string>(); // functionName -> modulePath
|
|
233
|
+
|
|
234
|
+
for (const statement of sourceFile.statements) {
|
|
235
|
+
if (!ts.isImportDeclaration(statement)) continue;
|
|
236
|
+
|
|
237
|
+
const moduleSpecifier = statement.moduleSpecifier;
|
|
238
|
+
if (!ts.isStringLiteral(moduleSpecifier)) continue;
|
|
239
|
+
|
|
240
|
+
const modulePath = moduleSpecifier.text;
|
|
241
|
+
// Skip relative imports - only look at node modules
|
|
242
|
+
if (modulePath.startsWith('.') || modulePath.startsWith('/')) continue;
|
|
243
|
+
|
|
244
|
+
if (
|
|
245
|
+
statement.importClause?.namedBindings &&
|
|
246
|
+
ts.isNamedImports(statement.importClause.namedBindings)
|
|
247
|
+
) {
|
|
248
|
+
for (const element of statement.importClause.namedBindings.elements) {
|
|
249
|
+
nodeModuleImports.set(element.name.text, modulePath);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if (statement.importClause?.name) {
|
|
253
|
+
nodeModuleImports.set(statement.importClause.name.text, modulePath);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Now look for: export const env = importedFunc(...)
|
|
258
|
+
for (const statement of sourceFile.statements) {
|
|
259
|
+
if (!ts.isVariableStatement(statement)) continue;
|
|
260
|
+
|
|
261
|
+
// Check if it's exported
|
|
262
|
+
const isExported = statement.modifiers?.some(
|
|
263
|
+
(m) => m.kind === ts.SyntaxKind.ExportKeyword,
|
|
264
|
+
);
|
|
265
|
+
if (!isExported) continue;
|
|
266
|
+
|
|
267
|
+
for (const decl of statement.declarationList.declarations) {
|
|
268
|
+
// Check if variable is named "env"
|
|
269
|
+
if (!ts.isIdentifier(decl.name) || decl.name.text !== 'env') continue;
|
|
270
|
+
|
|
271
|
+
// Check if initializer is a call expression
|
|
272
|
+
if (!decl.initializer || !ts.isCallExpression(decl.initializer)) continue;
|
|
273
|
+
|
|
274
|
+
// Get the function being called
|
|
275
|
+
const callExpr = decl.initializer.expression;
|
|
276
|
+
let funcName: string | null = null;
|
|
277
|
+
|
|
278
|
+
if (ts.isIdentifier(callExpr)) {
|
|
279
|
+
funcName = callExpr.text;
|
|
280
|
+
} else if (
|
|
281
|
+
ts.isPropertyAccessExpression(callExpr) &&
|
|
282
|
+
ts.isIdentifier(callExpr.name)
|
|
283
|
+
) {
|
|
284
|
+
funcName = callExpr.name.text;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
if (funcName && nodeModuleImports.has(funcName)) {
|
|
288
|
+
return {
|
|
289
|
+
importedFunctionName: funcName,
|
|
290
|
+
modulePath: nodeModuleImports.get(funcName)!,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Generate mock code for env store patterns.
|
|
301
|
+
* Replaces the imported function with one that returns a proxy.
|
|
302
|
+
*/
|
|
303
|
+
function generateEnvStoreMock(functionName: string): string {
|
|
304
|
+
return `// Mock for env store function (server-only env vars)
|
|
305
|
+
const ${functionName} = (config: any) => {
|
|
306
|
+
// Return a proxy that returns undefined for any property access
|
|
307
|
+
// This allows the code to run on the client without throwing
|
|
308
|
+
return new Proxy({} as any, {
|
|
309
|
+
get: (target, prop) => {
|
|
310
|
+
if (prop === 'then' || prop === Symbol.toStringTag) return undefined;
|
|
311
|
+
return undefined;
|
|
312
|
+
},
|
|
313
|
+
});
|
|
314
|
+
};
|
|
315
|
+
`;
|
|
316
|
+
}
|
|
317
|
+
|
|
216
318
|
/**
|
|
217
319
|
* AST-based implementation of applyServerOnlyMocks for large files.
|
|
218
320
|
* Uses TypeScript parser instead of regex to avoid catastrophic backtracking.
|
|
@@ -229,6 +331,10 @@ function applyServerOnlyMocksAst(fileContent: string): string {
|
|
|
229
331
|
const replacements: { start: number; end: number; replacement: string }[] =
|
|
230
332
|
[];
|
|
231
333
|
|
|
334
|
+
// Check if this file exports an "env" variable from a node module function call
|
|
335
|
+
// This is a generic pattern for env configuration packages
|
|
336
|
+
const envStoreInfo = detectEnvStoreFromNodeModule(sourceFile);
|
|
337
|
+
|
|
232
338
|
for (const statement of sourceFile.statements) {
|
|
233
339
|
if (!ts.isImportDeclaration(statement)) continue;
|
|
234
340
|
|
|
@@ -236,8 +342,6 @@ function applyServerOnlyMocksAst(fileContent: string): string {
|
|
|
236
342
|
if (!ts.isStringLiteral(moduleSpecifier)) continue;
|
|
237
343
|
|
|
238
344
|
const modulePath = moduleSpecifier.text;
|
|
239
|
-
const config = findServerOnlyModule(modulePath);
|
|
240
|
-
if (!config) continue;
|
|
241
345
|
|
|
242
346
|
// Extract import names
|
|
243
347
|
const importNames: string[] = [];
|
|
@@ -265,6 +369,27 @@ function applyServerOnlyMocksAst(fileContent: string): string {
|
|
|
265
369
|
}
|
|
266
370
|
}
|
|
267
371
|
|
|
372
|
+
// Check if this import provides the function used to create the env store
|
|
373
|
+
if (
|
|
374
|
+
envStoreInfo &&
|
|
375
|
+
modulePath === envStoreInfo.modulePath &&
|
|
376
|
+
importNames.includes(envStoreInfo.importedFunctionName)
|
|
377
|
+
) {
|
|
378
|
+
const mockCode = generateEnvStoreMock(
|
|
379
|
+
envStoreInfo.importedFunctionName,
|
|
380
|
+
);
|
|
381
|
+
replacements.push({
|
|
382
|
+
start: statement.getStart(sourceFile),
|
|
383
|
+
end: statement.getEnd(),
|
|
384
|
+
replacement: mockCode,
|
|
385
|
+
});
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// Check for known server-only modules (from explicit list)
|
|
390
|
+
const config = findServerOnlyModule(modulePath);
|
|
391
|
+
if (!config) continue;
|
|
392
|
+
|
|
268
393
|
const mockCode = config.getMockCode(importNames, defaultImportName);
|
|
269
394
|
replacements.push({
|
|
270
395
|
start: statement.getStart(sourceFile),
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
syncHeadBranches,
|
|
24
24
|
syncPrimaryBranch,
|
|
25
25
|
} from '~codeyam/github';
|
|
26
|
-
import { installSignalHandlers } from '
|
|
26
|
+
import { installSignalHandlers } from '~codeyam/process';
|
|
27
27
|
|
|
28
28
|
// Set process title for Activity Monitor visibility
|
|
29
29
|
if (process.env.CODEYAM_PROCESS_NAME) {
|
|
@@ -260,8 +260,8 @@ async function main({
|
|
|
260
260
|
}
|
|
261
261
|
},
|
|
262
262
|
project: sharedContext.project,
|
|
263
|
-
// In local-sequential mode, don't filter by commit
|
|
264
|
-
//
|
|
263
|
+
// In local-sequential mode, don't filter by commit (full=true handles that).
|
|
264
|
+
// For AWS mode, filter by the specific commit being analyzed.
|
|
265
265
|
commit:
|
|
266
266
|
orchestrateCapture === 'local-sequential'
|
|
267
267
|
? null
|
|
@@ -279,6 +279,8 @@ async function main({
|
|
|
279
279
|
: envConfig.entityShas,
|
|
280
280
|
full: orchestrateCapture === 'local-sequential',
|
|
281
281
|
taskRunner,
|
|
282
|
+
// Always track capture progress on the commit, even when not filtering by it.
|
|
283
|
+
metadataCommit: sharedContext.commit ?? sharedContext.branchCommit,
|
|
282
284
|
});
|
|
283
285
|
awsLog('CodeYam Capture: runCaptureOrchestration() completed');
|
|
284
286
|
};
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
} from './utils/webappMapping';
|
|
37
37
|
import mergeEnvVarsIntoStartCommand from './utils/mergeEnvVarsIntoStartCommand';
|
|
38
38
|
import { LazyFileStore } from './LazyFileStore';
|
|
39
|
+
import { DEFAULT_SCENARIO_NAME } from '../common/constants';
|
|
39
40
|
|
|
40
41
|
export interface StartScenarioCaptureArgs {
|
|
41
42
|
readyToBeCaptured: Analysis[];
|
|
@@ -226,6 +227,11 @@ export async function startScenarioCapture({
|
|
|
226
227
|
}
|
|
227
228
|
|
|
228
229
|
const sortedScenarios = (analysis.scenarios ?? []).sort((a, b) => {
|
|
230
|
+
// Default Scenario always goes first
|
|
231
|
+
if (a.name === DEFAULT_SCENARIO_NAME) return -1;
|
|
232
|
+
if (b.name === DEFAULT_SCENARIO_NAME) return 1;
|
|
233
|
+
|
|
234
|
+
// Then prioritize new or revised scenarios
|
|
229
235
|
const newOrRevisedA =
|
|
230
236
|
!a.previousVersionId || a.metadata?.revisedFromPreviousVersion;
|
|
231
237
|
const newOrRevisedB =
|
|
@@ -81,12 +81,12 @@ const cleanOutTypes = (str: string) => {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
const safeString = (s: string, level: number) => {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
// NOTE: We no longer strip arguments from top-level function keys (level 2)
|
|
85
|
+
// because normalizeMockData now handles merging duplicate keys while preserving
|
|
86
|
+
// original keys when there's only one call site. This ensures constructMockCode
|
|
87
|
+
// can look up data with the full key (e.g., "useCustomSizes(projectSlug)").
|
|
88
|
+
//
|
|
89
|
+
// Only escape quotes and newlines for safe string output.
|
|
90
90
|
return s?.replace ? s.replace(/"/g, "'").replace(/\n/g, '\\n') : s;
|
|
91
91
|
};
|
|
92
92
|
|
|
@@ -135,12 +135,14 @@ const shouldBeMap = (mockKey: string, mergedDataStructure: any): boolean => {
|
|
|
135
135
|
};
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
|
-
* Normalize a function call key by stripping arguments
|
|
139
|
-
*
|
|
138
|
+
* Normalize a function call key by stripping arguments but PRESERVING type parameters.
|
|
139
|
+
* Type parameters like <typeof loader> are important for disambiguation.
|
|
140
|
+
* Variable qualifiers (::variableName suffix) are also preserved.
|
|
141
|
+
*
|
|
140
142
|
* e.g., "useLastLogLine(projectSlug, !!simulatingEntitySha)" -> "useLastLogLine()"
|
|
141
|
-
* e.g., "useLoaderData<typeof loader>()" -> "useLoaderData()"
|
|
143
|
+
* e.g., "useLoaderData<typeof loader>()" -> "useLoaderData<typeof loader>()" (PRESERVED)
|
|
142
144
|
* e.g., "useFetcher()::entityDiffFetcher" -> "useFetcher()::entityDiffFetcher" (preserved)
|
|
143
|
-
* e.g., "useFetcher<T>()::entityDiffFetcher" -> "useFetcher()::entityDiffFetcher"
|
|
145
|
+
* e.g., "useFetcher<T>()::entityDiffFetcher" -> "useFetcher<T>()::entityDiffFetcher" (PRESERVED)
|
|
144
146
|
*/
|
|
145
147
|
const normalizeKey = (key: string): string => {
|
|
146
148
|
// Check for variable qualifier (::variableName)
|
|
@@ -150,10 +152,34 @@ const normalizeKey = (key: string): string => {
|
|
|
150
152
|
|
|
151
153
|
// Check if key ends with ) - indicating a function call (after removing qualifier)
|
|
152
154
|
if (keyWithoutQualifier.endsWith(')') && keyWithoutQualifier.includes('(')) {
|
|
153
|
-
//
|
|
154
|
-
|
|
155
|
-
//
|
|
156
|
-
|
|
155
|
+
// Find the opening paren that matches the closing paren (accounting for nested parens and generics)
|
|
156
|
+
// We want to strip arguments but preserve type parameters
|
|
157
|
+
// e.g., "useLoaderData<typeof loader>(arg1, arg2)" -> "useLoaderData<typeof loader>()"
|
|
158
|
+
// e.g., "foo(a, b)" -> "foo()"
|
|
159
|
+
|
|
160
|
+
// Find where type parameters end (if any) by finding matching < >
|
|
161
|
+
let typeParamEnd = 0;
|
|
162
|
+
if (keyWithoutQualifier.includes('<')) {
|
|
163
|
+
let depth = 0;
|
|
164
|
+
for (let i = 0; i < keyWithoutQualifier.length; i++) {
|
|
165
|
+
if (keyWithoutQualifier[i] === '<') depth++;
|
|
166
|
+
if (keyWithoutQualifier[i] === '>') {
|
|
167
|
+
depth--;
|
|
168
|
+
if (depth === 0) {
|
|
169
|
+
typeParamEnd = i + 1;
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Find the opening paren for function arguments (after type params)
|
|
177
|
+
const argsStart = keyWithoutQualifier.indexOf('(', typeParamEnd);
|
|
178
|
+
if (argsStart !== -1) {
|
|
179
|
+
// Preserve everything up to and including the opening paren, then close it
|
|
180
|
+
const normalized = keyWithoutQualifier.slice(0, argsStart) + '()';
|
|
181
|
+
return normalized + qualifier;
|
|
182
|
+
}
|
|
157
183
|
}
|
|
158
184
|
return key;
|
|
159
185
|
};
|
|
@@ -245,7 +271,11 @@ const normalizeMockData = (
|
|
|
245
271
|
// Second pass: merge values for duplicate normalized keys
|
|
246
272
|
for (const [normKey, originalKeys] of keyMapping) {
|
|
247
273
|
if (originalKeys.length === 1) {
|
|
248
|
-
// No duplicates
|
|
274
|
+
// No duplicates - PRESERVE the original key with arguments
|
|
275
|
+
// This is critical because constructMockCode generates code that accesses
|
|
276
|
+
// data with the FULL key (e.g., scenarios().data()?.["useCustomSizes(projectSlug)"])
|
|
277
|
+
// If we normalize to "useCustomSizes()" but code looks for "useCustomSizes(projectSlug)",
|
|
278
|
+
// the lookup fails and returns undefined, causing runtime errors.
|
|
249
279
|
const value = mockData[originalKeys[0]];
|
|
250
280
|
// Skip bare type markers like "function" or "async-function"
|
|
251
281
|
if (isBareTypeMarker(value)) {
|
|
@@ -256,7 +286,7 @@ const normalizeMockData = (
|
|
|
256
286
|
if (isEmptyObject(value)) {
|
|
257
287
|
continue;
|
|
258
288
|
}
|
|
259
|
-
normalized[
|
|
289
|
+
normalized[originalKeys[0]] = value;
|
|
260
290
|
} else {
|
|
261
291
|
// Multiple keys normalize to the same value - merge them
|
|
262
292
|
let mergedValue: unknown = {};
|
|
@@ -284,10 +314,12 @@ const normalizeMockData = (
|
|
|
284
314
|
}
|
|
285
315
|
}
|
|
286
316
|
// Only add if we have actual data (not just filtered type markers)
|
|
317
|
+
// Note: typeof null === 'object' in JS, so we must check for null explicitly
|
|
287
318
|
if (
|
|
288
319
|
mergedValue !== undefined &&
|
|
289
320
|
!isBareTypeMarker(mergedValue) &&
|
|
290
321
|
!(
|
|
322
|
+
mergedValue !== null &&
|
|
291
323
|
typeof mergedValue === 'object' &&
|
|
292
324
|
Object.keys(mergedValue as object).length === 0
|
|
293
325
|
)
|
|
@@ -415,7 +447,7 @@ const jsonToCode = (
|
|
|
415
447
|
`${levelSpacing}"${safeString(key, level)}": ${arrayString}`,
|
|
416
448
|
);
|
|
417
449
|
}
|
|
418
|
-
} else if (typeof jsonObj[key] === 'object') {
|
|
450
|
+
} else if (jsonObj[key] !== null && typeof jsonObj[key] === 'object') {
|
|
419
451
|
const objKeys = Object.keys(jsonObj[key] as object);
|
|
420
452
|
|
|
421
453
|
// Check if this is a nested function signature (e.g., "postMessage(message, targetOrigin)": { signature: [...] })
|
|
@@ -716,12 +748,10 @@ export default async function writeMockDataTsx(
|
|
|
716
748
|
const expectedKeys = extractAllKeys(dataForMocks);
|
|
717
749
|
|
|
718
750
|
// Reconcile mock data keys to match expected keys from dataForMocks
|
|
719
|
-
// This handles cases where LLM generated literal values instead of variable references
|
|
720
|
-
// and remaps old variable-based keys to canonical keys
|
|
751
|
+
// This handles cases where LLM generated literal values instead of variable references
|
|
721
752
|
const defaultMockData = reconcileMockDataKeys(
|
|
722
753
|
rawDefaultMockData,
|
|
723
754
|
expectedKeys,
|
|
724
|
-
analysis.entityName,
|
|
725
755
|
);
|
|
726
756
|
|
|
727
757
|
const mockDataComment = `// This file is auto-generated by CodeYam. Do not edit this file manually.
|
|
@@ -761,11 +791,9 @@ import React from 'react';
|
|
|
761
791
|
};
|
|
762
792
|
|
|
763
793
|
// Reconcile scenario-specific mock data keys as well
|
|
764
|
-
// Pass entityName for canonical key remapping
|
|
765
794
|
const scenarioMockData = reconcileMockDataKeys(
|
|
766
795
|
rawScenarioMockData,
|
|
767
796
|
expectedKeys,
|
|
768
|
-
analysis.entityName,
|
|
769
797
|
);
|
|
770
798
|
|
|
771
799
|
const mergedArguments = defaultArguments.map((defaultArg, index) => {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { writeFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import type { Scenario } from '~codeyam/types';
|
|
4
|
+
import { generateScenarioClientWrapper } from '~codeyam/generate';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Writes the ScenarioClientWrapper component to the mocks directory.
|
|
8
|
+
* This client component is used by Server Component pages to handle
|
|
9
|
+
* interactive features (iframe messaging, console interception, etc.)
|
|
10
|
+
*/
|
|
11
|
+
export default async function writeScenarioClientWrapper(
|
|
12
|
+
scenario: Scenario,
|
|
13
|
+
mocksDir: string,
|
|
14
|
+
): Promise<string> {
|
|
15
|
+
const content = generateScenarioClientWrapper(scenario);
|
|
16
|
+
const filePath = join(mocksDir, 'ScenarioClientWrapper.tsx');
|
|
17
|
+
|
|
18
|
+
await writeFile(filePath, content);
|
|
19
|
+
|
|
20
|
+
return filePath;
|
|
21
|
+
}
|