@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
|
@@ -408,90 +408,126 @@ export class ReactFrameworkManager implements EquivalencyManager {
|
|
|
408
408
|
let propagated = false;
|
|
409
409
|
const functionCallSignature = getFunctionCallSignature(subPathParts);
|
|
410
410
|
|
|
411
|
-
|
|
411
|
+
let relevantUseStateInfo = this.findUseStateInfo(functionCallSignature);
|
|
412
|
+
|
|
413
|
+
// If we didn't find a useState call directly, check if the function being called
|
|
414
|
+
// is a setter variable (e.g., setWorkouts from useState)
|
|
415
|
+
if (!relevantUseStateInfo && functionCallSignature) {
|
|
416
|
+
// Extract the function name from the call (e.g., "setWorkouts" from "setWorkouts(data || [])")
|
|
417
|
+
const fnName = functionCallSignature.split('(')[0];
|
|
418
|
+
relevantUseStateInfo = this.useStateInfos.find(
|
|
419
|
+
(info) => info.setter === fnName,
|
|
420
|
+
);
|
|
421
|
+
}
|
|
412
422
|
|
|
413
423
|
if (relevantUseStateInfo) {
|
|
414
424
|
const pathParts = scopeDataStructure.splitPath(path);
|
|
415
|
-
if (pathParts.length < 3) return false;
|
|
416
425
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
426
|
+
// Check if this is a direct setter variable call (e.g., setWorkouts(data).signature[0])
|
|
427
|
+
// rather than a useState path (e.g., useState<X>().functionCallReturnValue[1].signature[0])
|
|
428
|
+
const fnName = functionCallSignature?.split('(')[0];
|
|
429
|
+
const isDirectSetterCall = fnName === relevantUseStateInfo.setter;
|
|
430
|
+
|
|
431
|
+
if (isDirectSetterCall && pathParts.length === 2) {
|
|
432
|
+
// Handle direct setter calls like setWorkouts(data || []).signature[0] = data
|
|
433
|
+
const lastPart = pathParts[1];
|
|
434
|
+
if (lastPart === 'signature[0]') {
|
|
435
|
+
// Get the value being passed to the setter from the equivalency
|
|
436
|
+
const originScopeInfoName =
|
|
437
|
+
equivalencyValueChain[0]?.currentPath?.scopeNodeName;
|
|
438
|
+
if (!originScopeInfoName) return propagated;
|
|
439
|
+
|
|
440
|
+
const originScope =
|
|
441
|
+
scopeDataStructure.getScopeOrFunctionCallInfo(originScopeInfoName);
|
|
442
|
+
const setterCallEquiv = originScope?.equivalencies?.[path];
|
|
443
|
+
if (!setterCallEquiv || setterCallEquiv.length === 0)
|
|
444
|
+
return propagated;
|
|
445
|
+
|
|
446
|
+
const argumentPath = setterCallEquiv[0].schemaPath;
|
|
447
|
+
const argumentScopeName = setterCallEquiv[0].scopeNodeName;
|
|
448
|
+
|
|
449
|
+
// Create equivalency: useState<X>().functionCallReturnValue[0] = argumentPath
|
|
450
|
+
propagated = true;
|
|
451
|
+
const valuePath = `${relevantUseStateInfo.useStateCall}.functionCallReturnValue[0]`;
|
|
452
|
+
const useStateScopeInfo =
|
|
453
|
+
scopeDataStructure.getScopeOrFunctionCallInfo(
|
|
454
|
+
relevantUseStateInfo.scopeNodeName,
|
|
455
|
+
) as ScopeNode;
|
|
421
456
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
457
|
+
scopeDataStructure.addEquivalency(
|
|
458
|
+
valuePath,
|
|
459
|
+
argumentPath,
|
|
460
|
+
argumentScopeName,
|
|
461
|
+
useStateScopeInfo,
|
|
462
|
+
'useState setter call equivalency (direct)',
|
|
463
|
+
equivalencyValueChain,
|
|
464
|
+
traceId,
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
} else if (pathParts.length >= 3) {
|
|
468
|
+
// Original logic for useState path patterns
|
|
469
|
+
const basePath = scopeDataStructure.joinPathParts([
|
|
470
|
+
...pathParts.slice(0, 2),
|
|
471
|
+
pathParts[2],
|
|
472
|
+
]);
|
|
426
473
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
// {
|
|
432
|
-
// traceId,
|
|
433
|
-
// basePath,
|
|
434
|
-
// expectedValueBasePath,
|
|
435
|
-
// expectedSetterBasePath,
|
|
436
|
-
// },
|
|
437
|
-
// null,
|
|
438
|
-
// 2,
|
|
439
|
-
// ),
|
|
440
|
-
// );
|
|
441
|
-
// }
|
|
442
|
-
|
|
443
|
-
if (basePath === expectedSetterBasePath) {
|
|
444
|
-
const originScopeInfoName =
|
|
445
|
-
equivalencyValueChain[0].currentPath?.scopeNodeName;
|
|
446
|
-
const setterScope =
|
|
447
|
-
scopeDataStructure.getScopeOrFunctionCallInfo(originScopeInfoName);
|
|
448
|
-
const setterEquivalencyPath = Object.keys(
|
|
449
|
-
setterScope.equivalencies,
|
|
450
|
-
).find((p) => {
|
|
451
|
-
if (!p.startsWith(relevantUseStateInfo.setter)) return false;
|
|
452
|
-
const pParts = scopeDataStructure.splitPath(p);
|
|
453
|
-
|
|
454
|
-
const valid = pathParts
|
|
455
|
-
.slice(3)
|
|
456
|
-
.reverse()
|
|
457
|
-
.every((part, index) => [...pParts].reverse()[index] === part);
|
|
458
|
-
|
|
459
|
-
// if (p.includes('.title') && valid)
|
|
460
|
-
// console.info({ p, pParts, pathParts: pathParts.slice(3) });
|
|
461
|
-
|
|
462
|
-
return valid;
|
|
463
|
-
});
|
|
464
|
-
|
|
465
|
-
if (!setterEquivalencyPath) return;
|
|
466
|
-
|
|
467
|
-
const setterEquivalencyPathParts = scopeDataStructure.splitPath(
|
|
468
|
-
setterEquivalencyPath,
|
|
469
|
-
);
|
|
470
|
-
const setterEquivalentVariable =
|
|
471
|
-
setterScope.equivalencies[setterEquivalencyPath][0].schemaPath;
|
|
474
|
+
const expectedSetterBasePath = scopeDataStructure.joinPathParts([
|
|
475
|
+
functionCallSignature,
|
|
476
|
+
'functionCallReturnValue[1]',
|
|
477
|
+
]);
|
|
472
478
|
|
|
473
|
-
if (
|
|
479
|
+
if (basePath === expectedSetterBasePath) {
|
|
480
|
+
const originScopeInfoName =
|
|
481
|
+
equivalencyValueChain[0].currentPath?.scopeNodeName;
|
|
482
|
+
const setterScope =
|
|
483
|
+
scopeDataStructure.getScopeOrFunctionCallInfo(originScopeInfoName);
|
|
484
|
+
const setterEquivalencyPath = Object.keys(
|
|
485
|
+
setterScope.equivalencies,
|
|
486
|
+
).find((p) => {
|
|
487
|
+
if (!p.startsWith(relevantUseStateInfo.setter)) return false;
|
|
488
|
+
const pParts = scopeDataStructure.splitPath(p);
|
|
489
|
+
|
|
490
|
+
const valid = pathParts
|
|
491
|
+
.slice(3)
|
|
492
|
+
.reverse()
|
|
493
|
+
.every((part, index) => [...pParts].reverse()[index] === part);
|
|
494
|
+
|
|
495
|
+
return valid;
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
if (!setterEquivalencyPath) return propagated;
|
|
499
|
+
|
|
500
|
+
const setterEquivalencyPathParts = scopeDataStructure.splitPath(
|
|
501
|
+
setterEquivalencyPath,
|
|
502
|
+
);
|
|
503
|
+
const setterEquivalentVariable =
|
|
504
|
+
setterScope.equivalencies[setterEquivalencyPath][0].schemaPath;
|
|
474
505
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
const useStateScopeInfo = scopeDataStructure.getScopeOrFunctionCallInfo(
|
|
478
|
-
relevantUseStateInfo.scopeNodeName,
|
|
479
|
-
) as ScopeNode;
|
|
506
|
+
if (setterEquivalentVariable === expectedSetterBasePath)
|
|
507
|
+
return propagated;
|
|
480
508
|
|
|
481
|
-
|
|
482
|
-
valuePath
|
|
483
|
-
|
|
484
|
-
|
|
509
|
+
propagated = true;
|
|
510
|
+
const valuePath = `${functionCallSignature}.functionCallReturnValue[0]`;
|
|
511
|
+
const useStateScopeInfo =
|
|
512
|
+
scopeDataStructure.getScopeOrFunctionCallInfo(
|
|
513
|
+
relevantUseStateInfo.scopeNodeName,
|
|
514
|
+
) as ScopeNode;
|
|
515
|
+
|
|
516
|
+
const fullValuePath = scopeDataStructure.joinPathParts([
|
|
517
|
+
valuePath,
|
|
518
|
+
...setterEquivalencyPathParts.slice(2),
|
|
519
|
+
]);
|
|
485
520
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
521
|
+
scopeDataStructure.addEquivalency(
|
|
522
|
+
fullValuePath,
|
|
523
|
+
setterEquivalentVariable,
|
|
524
|
+
originScopeInfoName,
|
|
525
|
+
useStateScopeInfo,
|
|
526
|
+
'useState setter call equivalency',
|
|
527
|
+
equivalencyValueChain,
|
|
528
|
+
traceId,
|
|
529
|
+
);
|
|
530
|
+
}
|
|
495
531
|
}
|
|
496
532
|
}
|
|
497
533
|
|
package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts
CHANGED
|
@@ -983,6 +983,17 @@ function clearAttributes(
|
|
|
983
983
|
for (const key in mapping) {
|
|
984
984
|
const value = mapping[key];
|
|
985
985
|
if (knownTypes.has(value)) {
|
|
986
|
+
// Don't add string-typed array element paths (ending with []) to knownBasePaths.
|
|
987
|
+
// When an array element is typed as 'string' but has child paths (like data[].id),
|
|
988
|
+
// it's actually an object - the 'string' type is incorrect. The child paths
|
|
989
|
+
// describe the array element structure and should not be deleted.
|
|
990
|
+
//
|
|
991
|
+
// However, array-typed [] paths (like matrix[] where matrix is array of arrays)
|
|
992
|
+
// should still be in knownBasePaths so their method calls (filter, map, etc.)
|
|
993
|
+
// get cleaned up properly.
|
|
994
|
+
if (key.endsWith('[]') && value === 'string') {
|
|
995
|
+
continue;
|
|
996
|
+
}
|
|
986
997
|
knownBasePaths.add(key);
|
|
987
998
|
}
|
|
988
999
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts null values to undefined (removes them) based on schema type constraints.
|
|
3
|
+
*
|
|
4
|
+
* When the LLM generates mock data, it uses `null` to represent "no value" because
|
|
5
|
+
* JSON doesn't support `undefined`. However, TypeScript types like `string | undefined`
|
|
6
|
+
* don't accept `null`.
|
|
7
|
+
*
|
|
8
|
+
* This function traverses data and schema together:
|
|
9
|
+
* - If schema type is "T | undefined" (but NOT "T | null"), convert null → undefined (delete key)
|
|
10
|
+
* - If schema type includes "null" (e.g., "T | null" or "T | null | undefined"), preserve null
|
|
11
|
+
* - If field not in schema, preserve as-is
|
|
12
|
+
*
|
|
13
|
+
* @param data The data object with potential null values
|
|
14
|
+
* @param schema The schema describing expected types
|
|
15
|
+
* @returns The data with null→undefined conversions applied (mutates original)
|
|
16
|
+
*/
|
|
17
|
+
export default function convertNullToUndefinedBySchema<T>(
|
|
18
|
+
data: T,
|
|
19
|
+
schema: unknown,
|
|
20
|
+
): T {
|
|
21
|
+
// Handle null/undefined data
|
|
22
|
+
if (data === null || data === undefined) {
|
|
23
|
+
return data;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Only process objects
|
|
27
|
+
if (typeof data !== 'object') {
|
|
28
|
+
return data;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Handle arrays
|
|
32
|
+
if (Array.isArray(data)) {
|
|
33
|
+
// For arrays, the schema should be an array with one element describing the item type
|
|
34
|
+
const itemSchema = Array.isArray(schema) ? schema[0] : undefined;
|
|
35
|
+
for (let i = 0; i < data.length; i++) {
|
|
36
|
+
data[i] = convertNullToUndefinedBySchema(data[i], itemSchema);
|
|
37
|
+
}
|
|
38
|
+
return data;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Handle objects
|
|
42
|
+
const dataObj = data as Record<string, unknown>;
|
|
43
|
+
const schemaObj = schema as Record<string, unknown> | undefined;
|
|
44
|
+
|
|
45
|
+
for (const key of Object.keys(dataObj)) {
|
|
46
|
+
const value = dataObj[key];
|
|
47
|
+
const fieldSchema = schemaObj?.[key];
|
|
48
|
+
|
|
49
|
+
if (value === null) {
|
|
50
|
+
// Check if schema allows null
|
|
51
|
+
if (shouldConvertNullToUndefined(fieldSchema)) {
|
|
52
|
+
// Delete the key (converts null to undefined)
|
|
53
|
+
delete dataObj[key];
|
|
54
|
+
}
|
|
55
|
+
// If schema allows null, preserve it
|
|
56
|
+
} else if (typeof value === 'object' && value !== null) {
|
|
57
|
+
// Recursively process nested objects/arrays
|
|
58
|
+
convertNullToUndefinedBySchema(value, fieldSchema);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return data;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Determines if a null value should be converted to undefined based on schema type.
|
|
67
|
+
*
|
|
68
|
+
* @param fieldSchema The schema type string or object for the field
|
|
69
|
+
* @returns true if null should be converted to undefined, false if null should be preserved
|
|
70
|
+
*/
|
|
71
|
+
function shouldConvertNullToUndefined(fieldSchema: unknown): boolean {
|
|
72
|
+
// If no schema for this field, preserve null (be conservative)
|
|
73
|
+
if (fieldSchema === undefined || fieldSchema === null) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// If schema is a string type definition, check if it allows null
|
|
78
|
+
if (typeof fieldSchema === 'string') {
|
|
79
|
+
// Schema types that include "null" should preserve null values
|
|
80
|
+
// e.g., "string | null", "number | null | undefined", "null"
|
|
81
|
+
const allowsNull = fieldSchema.includes('null');
|
|
82
|
+
const allowsUndefined = fieldSchema.includes('undefined');
|
|
83
|
+
|
|
84
|
+
// If type allows undefined but NOT null, convert null to undefined
|
|
85
|
+
// e.g., "string | undefined" → convert null to undefined
|
|
86
|
+
// e.g., "string | null" → preserve null
|
|
87
|
+
// e.g., "string | null | undefined" → preserve null
|
|
88
|
+
if (allowsUndefined && !allowsNull) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// If schema is an object or array, it's a nested structure
|
|
96
|
+
// Don't convert the container itself, just recurse into it
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export default function deepEqual(obj1: unknown, obj2: unknown): boolean {
|
|
2
|
+
// Handle primitive types and null/undefined
|
|
3
|
+
if (obj1 === obj2) return true;
|
|
4
|
+
if (obj1 == null || obj2 == null) return false;
|
|
5
|
+
if (typeof obj1 !== 'object' || typeof obj2 !== 'object') return false;
|
|
6
|
+
|
|
7
|
+
// Handle Date objects
|
|
8
|
+
if (obj1 instanceof Date && obj2 instanceof Date) {
|
|
9
|
+
return obj1.getTime() === obj2.getTime();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Handle Array objects
|
|
13
|
+
if (Array.isArray(obj1) && Array.isArray(obj2)) {
|
|
14
|
+
if (obj1.length !== obj2.length) return false;
|
|
15
|
+
return obj1.every((item, index) => deepEqual(item, obj2[index]));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Handle regular objects
|
|
19
|
+
const keys1 = Object.keys(obj1);
|
|
20
|
+
const keys2 = Object.keys(obj2);
|
|
21
|
+
|
|
22
|
+
if (keys1.length !== keys2.length) return false;
|
|
23
|
+
|
|
24
|
+
return keys1.every((key) => {
|
|
25
|
+
if (!Object.prototype.hasOwnProperty.call(obj2, key)) return false;
|
|
26
|
+
const obj1AsAny = obj1 as any;
|
|
27
|
+
const obj2AsAny = obj2 as any;
|
|
28
|
+
return deepEqual(obj1AsAny[key], obj2AsAny[key]);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
@@ -74,29 +74,36 @@ export default function findMatchingAttribute(
|
|
|
74
74
|
return equivalent;
|
|
75
75
|
} else {
|
|
76
76
|
const normalizedPath = normalizeKey(attributePath);
|
|
77
|
-
|
|
77
|
+
// Filter out undefined values to prevent normalizeKey from crashing
|
|
78
|
+
// This can happen when key attributes have undefined internalPath
|
|
79
|
+
const validAttributes = attributesList.filter(
|
|
80
|
+
(attr): attr is string => attr !== undefined && attr !== null,
|
|
81
|
+
);
|
|
82
|
+
const matchingAttribute = validAttributes.find(
|
|
78
83
|
(attr) => normalizeKey(attr) === normalizedPath,
|
|
79
84
|
);
|
|
80
85
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
if (matchingAttribute) return matchingAttribute;
|
|
87
|
+
|
|
88
|
+
// Fallback: LLM may return dataStructurePath format (e.g., "useLoaderData<typeof loader>().currentBranch")
|
|
89
|
+
// when we expect localVariable format (e.g., "currentBranch").
|
|
90
|
+
// Try matching suffix parts of the path against the attributes list.
|
|
91
|
+
const pathParts = splitOutsideParenthesesAndArrays(attributePath);
|
|
92
|
+
for (let i = 1; i < pathParts.length; i++) {
|
|
93
|
+
const suffixPath = joinParenthesesAndArrays(pathParts.slice(i));
|
|
94
|
+
if (validAttributes.includes(suffixPath)) {
|
|
95
|
+
return suffixPath;
|
|
96
|
+
}
|
|
97
|
+
// Also try normalized comparison for the suffix
|
|
98
|
+
const normalizedSuffix = normalizeKey(suffixPath);
|
|
99
|
+
const suffixMatch = validAttributes.find(
|
|
100
|
+
(attr) => normalizeKey(attr) === normalizedSuffix,
|
|
101
|
+
);
|
|
102
|
+
if (suffixMatch) {
|
|
103
|
+
return suffixMatch;
|
|
96
104
|
}
|
|
97
105
|
}
|
|
98
106
|
|
|
99
|
-
if (matchingAttribute) return matchingAttribute;
|
|
100
107
|
return null;
|
|
101
108
|
}
|
|
102
109
|
}
|