@codeyam/codeyam-cli 0.1.0-staging.596f0eb → 0.1.0-staging.76566f9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analyzer-template/.build-info.json +7 -7
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +2 -1
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +2 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +22 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.ts +23 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +401 -106
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +60 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +734 -45
- 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 +715 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +233 -75
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +19 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +34 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +23 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.ts +98 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +34 -1
- package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +236 -24
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +18 -1
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +41 -0
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +37 -4
- package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +5 -0
- package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +213 -12
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +36 -25
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +114 -11
- package/analyzer-template/packages/ai/src/lib/getConditionalUsagesFromCode.ts +143 -31
- package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +8 -2
- package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +7 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +42 -2
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +38 -2
- package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +28 -2
- package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +5 -0
- package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +8 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +127 -43
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +158 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +405 -45
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +260 -133
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +10 -5
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +77 -83
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +2 -5
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +196 -86
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts +15 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts.map +1 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js +31 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js.map +1 -0
- package/analyzer-template/packages/aws/package.json +1 -1
- package/analyzer-template/packages/aws/s3/index.ts +1 -0
- package/analyzer-template/packages/aws/src/lib/s3/checkS3ObjectExists.ts +47 -0
- package/analyzer-template/packages/database/src/lib/kysely/db.ts +4 -4
- package/analyzer-template/packages/database/src/lib/kysely/tableRelations.ts +2 -2
- package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +20 -9
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +9 -4
- package/analyzer-template/packages/generate/src/lib/deepMerge.ts +26 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tableRelations.d.ts +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +8 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +14 -7
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js +27 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.d.ts +4 -3
- package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.js +1 -0
- package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +31 -1
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +51 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.js +21 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +48 -0
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
- package/analyzer-template/packages/types/index.ts +8 -0
- package/analyzer-template/packages/types/src/types/Analysis.ts +32 -1
- package/analyzer-template/packages/types/src/types/Scenario.ts +75 -6
- package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +49 -0
- package/analyzer-template/packages/ui-components/src/components/ScenarioDetailInteractiveView.tsx +23 -7
- package/analyzer-template/packages/utils/dist/types/index.d.ts +4 -3
- package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/index.js +1 -0
- package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +31 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +51 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js +21 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +48 -0
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
- package/analyzer-template/packages/utils/src/lib/lightweightEntityExtractor.ts +27 -0
- package/analyzer-template/playwright/takeElementScreenshot.ts +26 -11
- package/analyzer-template/playwright/takeScreenshot.ts +9 -7
- package/analyzer-template/project/constructMockCode.ts +286 -84
- package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +77 -37
- package/analyzer-template/project/reconcileMockDataKeys.ts +5 -2
- package/analyzer-template/project/runMultiScenarioServer.ts +11 -10
- package/analyzer-template/project/serverOnlyModules.ts +71 -23
- package/analyzer-template/project/start.ts +10 -0
- package/analyzer-template/project/startScenarioCapture.ts +73 -41
- package/analyzer-template/project/writeMockDataTsx.ts +115 -54
- package/analyzer-template/project/writeScenarioComponents.ts +571 -162
- package/analyzer-template/project/writeSimpleRoot.ts +11 -13
- package/background/src/lib/virtualized/project/constructMockCode.js +265 -75
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +67 -32
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +5 -2
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
- package/background/src/lib/virtualized/project/runMultiScenarioServer.js +11 -9
- package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
- package/background/src/lib/virtualized/project/serverOnlyModules.js +62 -25
- package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -1
- package/background/src/lib/virtualized/project/start.js +6 -0
- package/background/src/lib/virtualized/project/start.js.map +1 -1
- package/background/src/lib/virtualized/project/startScenarioCapture.js +54 -31
- package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +106 -46
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +399 -106
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/background/src/lib/virtualized/project/writeSimpleRoot.js +11 -11
- package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
- package/codeyam-cli/src/cli.js +2 -0
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/commands/debug.js +14 -2
- package/codeyam-cli/src/commands/debug.js.map +1 -1
- package/codeyam-cli/src/commands/recapture.js +215 -0
- package/codeyam-cli/src/commands/recapture.js.map +1 -0
- package/codeyam-cli/src/commands/report.js +26 -23
- package/codeyam-cli/src/commands/report.js.map +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js +2 -2
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/generateReport.js +252 -106
- package/codeyam-cli/src/utils/generateReport.js.map +1 -1
- package/codeyam-cli/src/utils/install-skills.js +2 -2
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +38 -0
- package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +140 -16
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/queue/manager.js +19 -7
- package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
- package/codeyam-cli/src/utils/queue/persistence.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/database.js +47 -0
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
- package/codeyam-cli/src/webserver/backgroundServer.js +5 -10
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/bootstrap.js +9 -0
- package/codeyam-cli/src/webserver/bootstrap.js.map +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-wXL1Z2Aq.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-efWKDYMr.js → EntityTypeBadge-CzGX-miz.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-CXFKsCOD.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-D-9pXIaY.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-CBQPrpT0.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/LoadingDots-D1CdlbrV.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/LogViewer-wDPcZNKx.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-4lcOlid-.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BfmDgXxG.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CUxUNEEC.js +15 -0
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-COPstp9J.js → TruncatedFilePath-6J7zDUD5.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/_index-DHImXdXq.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CVP_WGQ3.js +32 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.link-scenario-value-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.update-key-attributes-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.update-valid-values-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/chevron-down-BYimnrHg.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JMJ3UQ3L-BambyYE_.js +51 -0
- package/codeyam-cli/src/webserver/build/client/assets/circle-check-CaVsIRxt.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CgUsG7ib.js +21 -0
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-CKnwPCDr.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DW_hdGUc.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-Dt-SjPsw.js +23 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DyB90fWk.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-D_3ero5o.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-CfLCUi9S.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-DKJyZfAY.js +29 -0
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-DAtOlaWE.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-ClR0d32A.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-D62Lxxmv.js +15 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-C9s7Lhdl.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-fmIEn3Bc.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-BosqDOlH.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-CzNNiTkw.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/keyAttributeCoverage-CTlFMihX.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-CNp9QFCX.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/manifest-0d27da29.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/preload-helper-ckwbz45p.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-B_wIKCIf.js +56 -0
- package/codeyam-cli/src/webserver/build/client/assets/scenarioStatus-B_8jpV3e.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/search-DDGjYAMJ.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/settings-DgTyB-Wg.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-CoNWGt0K.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-CBc5dE1s.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BMIGFP-m.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/useInteractiveMode-Dk_FQqWJ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-3pmpUQB-.js → useLastLogLine-BqPPNjAl.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DsJbgMY9.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-DEyawJ8r.js → useToast-DWHcCcl1.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-CU58-Ttc.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-D35o2uae.js +175 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/src/webserver/devServer.js +1 -3
- package/codeyam-cli/src/webserver/devServer.js.map +1 -1
- package/codeyam-cli/templates/codeyam-setup-skill.md +138 -3
- package/codeyam-cli/templates/debug-codeyam.md +625 -0
- package/package.json +14 -14
- package/packages/ai/src/lib/analyzeScope.js +2 -0
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +16 -0
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js +16 -0
- package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +305 -88
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +582 -41
- 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 +454 -0
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +173 -55
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +16 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +30 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +20 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js +86 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +28 -2
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +179 -17
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +6 -0
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js +41 -0
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarios.js +37 -4
- package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDataStructure.js +4 -0
- package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
- package/packages/ai/src/lib/generateEntityKeyAttributes.js +176 -9
- package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +29 -25
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +105 -9
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/getConditionalUsagesFromCode.js +84 -14
- package/packages/ai/src/lib/getConditionalUsagesFromCode.js.map +1 -1
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -1
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +6 -0
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +38 -2
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +38 -2
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js +16 -3
- package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
- package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js +4 -0
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +100 -23
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +125 -0
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +298 -45
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +201 -80
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +10 -5
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +55 -69
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +2 -5
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +171 -81
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/database/src/lib/kysely/db.js +2 -2
- package/packages/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
- package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
- package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
- package/packages/generate/src/lib/deepMerge.js +27 -1
- package/packages/generate/src/lib/deepMerge.js.map +1 -1
- package/packages/types/index.js +1 -0
- package/packages/types/index.js.map +1 -1
- package/packages/types/src/types/Scenario.js +21 -1
- package/packages/types/src/types/Scenario.js.map +1 -1
- package/packages/utils/src/lib/lightweightEntityExtractor.js +25 -0
- package/packages/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
- package/scripts/finalize-analyzer.cjs +3 -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/src/webserver/build/client/assets/EntityItem-CVbSvOjo.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-DcwcHyl5.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-WgwC1GfJ.js +0 -26
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-IEKom9O2.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/LogViewer-BYnfxbUG.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-_lBPJCzG.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-lHVhvsu_.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-d_TBk4GQ.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/_index-kGT7VUqj.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-DDGmhu7P.js +0 -7
- package/codeyam-cli/src/webserver/build/client/assets/chevron-down-n_HPRfM_.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-CbVoyx1U.js +0 -26
- package/codeyam-cli/src/webserver/build/client/assets/circle-check-D1VOYveA.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-YR8jjAlu.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-B8vP3V_s.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-CN6aLCT1.js +0 -16
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-DA5Jeu2P.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-BTeitalf.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-du6UEYD-.js +0 -13
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-BpjkhMoi.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-BQGvk4lJ.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-DVdYRT-I.js +0 -12
- package/codeyam-cli/src/webserver/build/client/assets/globals-CO-U8Bpo.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-XQCGvadH.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/index-DCG-vks0.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-GazdNeLl.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-0b694d28.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-D3tQP7hx.js +0 -16
- package/codeyam-cli/src/webserver/build/client/assets/search-CIY6XmtE.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/server-build-CMKNK2uU.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-CoMDgElu.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-agkniXp2.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-B2VUcygF.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-EvdK-zXP.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-DGVHQEXD.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-CghkTkIL.js +0 -166
- package/codeyam-cli/templates/debug-command.md +0 -303
- /package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-CMKNK2uU.css → styles-CMKNK2uU.css} +0 -0
|
@@ -1,9 +1,74 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
+
import * as crypto from 'crypto';
|
|
2
3
|
import { StructuredPath } from "./paths.js";
|
|
3
4
|
import { nodeToSource } from "./nodeToSource.js";
|
|
4
5
|
import { methodRegistry, ArrayPushSemantics } from "./methodSemantics.js";
|
|
5
6
|
import { isArithmeticOperator, isAssignmentOperator, isBitwiseCompoundOperator, isComparisonOperator, isDefinedType, isNumericCompoundOperator, leftOrRightType, unwrapExpression, } from "./sharedPatterns.js";
|
|
6
7
|
import { processBindingPattern } from "./processBindings.js";
|
|
8
|
+
/**
|
|
9
|
+
* Converts a call expression argument to a StructuredPath.
|
|
10
|
+
*
|
|
11
|
+
* IMPORTANT: We always use the original source text for callbacks, never cyScope names.
|
|
12
|
+
* cyScope names are internal identifiers for child scopes and should NEVER appear
|
|
13
|
+
* in schema paths or call signatures. Using cyScope names causes data merge conflicts
|
|
14
|
+
* because the same callback gets different identifiers in different contexts.
|
|
15
|
+
*/
|
|
16
|
+
function getArgPathForCallSignature(arg, context) {
|
|
17
|
+
// Always use the standard path conversion - never replace with cyScope names
|
|
18
|
+
return (StructuredPath.fromNode(arg, context.sourceFile) ||
|
|
19
|
+
nodeToSource(arg, context.sourceFile));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Builds a StructuredPath for a call expression using the original source text.
|
|
23
|
+
*
|
|
24
|
+
* IMPORTANT: This function ensures consistent call signatures by always using
|
|
25
|
+
* the original callback text, never cyScope names. This prevents schema path
|
|
26
|
+
* conflicts where the same call would have different paths.
|
|
27
|
+
*/
|
|
28
|
+
function buildCallPathFromSource(node, context) {
|
|
29
|
+
const expression = node.expression;
|
|
30
|
+
// Convert arguments using original source text
|
|
31
|
+
const argPaths = node.arguments.map((arg) => getArgPathForCallSignature(arg, context));
|
|
32
|
+
// Handle type arguments if present
|
|
33
|
+
let typeArgs = undefined;
|
|
34
|
+
if (node.typeArguments && node.typeArguments.length > 0) {
|
|
35
|
+
typeArgs = node.typeArguments.map((typeArg) => typeArg.getText(context.sourceFile));
|
|
36
|
+
}
|
|
37
|
+
if (ts.isIdentifier(expression)) {
|
|
38
|
+
// Simple function call: func(arg1, arg2)
|
|
39
|
+
return StructuredPath.fromFunction(expression.text, argPaths, typeArgs);
|
|
40
|
+
}
|
|
41
|
+
else if (ts.isPropertyAccessExpression(expression)) {
|
|
42
|
+
// Method call: obj.method(arg1, arg2)
|
|
43
|
+
const objPath = StructuredPath.fromNode(expression.expression, context.sourceFile);
|
|
44
|
+
if (!objPath)
|
|
45
|
+
return null;
|
|
46
|
+
return objPath
|
|
47
|
+
.withProperty(expression.name.text)
|
|
48
|
+
.withFunctionCall(argPaths, typeArgs);
|
|
49
|
+
}
|
|
50
|
+
else if (ts.isCallExpression(expression)) {
|
|
51
|
+
// Chained call: func(arg1)(arg2)
|
|
52
|
+
const funcPath = buildCallPathFromSource(expression, context);
|
|
53
|
+
if (!funcPath)
|
|
54
|
+
return null;
|
|
55
|
+
return funcPath.withFunctionCall(argPaths, typeArgs);
|
|
56
|
+
}
|
|
57
|
+
else if (ts.isElementAccessExpression(expression)) {
|
|
58
|
+
// Element access call: obj[key](args)
|
|
59
|
+
const basePath = StructuredPath.fromNode(expression, context.sourceFile);
|
|
60
|
+
if (!basePath)
|
|
61
|
+
return null;
|
|
62
|
+
return basePath.withFunctionCall(argPaths, typeArgs);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
// Complex call expression
|
|
66
|
+
const basePath = StructuredPath.fromNode(expression, context.sourceFile);
|
|
67
|
+
if (!basePath)
|
|
68
|
+
return null;
|
|
69
|
+
return basePath.withFunctionCall(argPaths, typeArgs);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
7
72
|
/**
|
|
8
73
|
* Checks if an expression is likely an array type.
|
|
9
74
|
* Uses TypeScript's type checker when available, falls back to heuristics.
|
|
@@ -81,102 +146,220 @@ export function markConditionVariablesAsNullable(condition, context) {
|
|
|
81
146
|
}
|
|
82
147
|
}
|
|
83
148
|
/**
|
|
84
|
-
*
|
|
85
|
-
* This function identifies which attributes are used in conditionals and how they're used.
|
|
86
|
-
*
|
|
87
|
-
* @param condition The condition expression to analyze
|
|
88
|
-
* @param context The analysis context
|
|
89
|
-
* @param location Where this condition appears (if, ternary, logical-and, switch)
|
|
149
|
+
* Helper to extract source location from an AST node
|
|
90
150
|
*/
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
151
|
+
function getSourceLocation(node, sourceFile) {
|
|
152
|
+
const start = node.getStart(sourceFile);
|
|
153
|
+
const { line, character } = sourceFile.getLineAndCharacterOfPosition(start);
|
|
154
|
+
const codeSnippet = node.getText(sourceFile);
|
|
155
|
+
return {
|
|
156
|
+
lineNumber: line + 1, // Convert to 1-based
|
|
157
|
+
column: character,
|
|
158
|
+
codeSnippet: codeSnippet.length > 100
|
|
159
|
+
? codeSnippet.slice(0, 100) + '...'
|
|
160
|
+
: codeSnippet,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Counts the number of conditions in an && chain (excluding JSX consequence)
|
|
165
|
+
*/
|
|
166
|
+
function countConditionsInAndChain(expr) {
|
|
167
|
+
const unwrapped = unwrapExpression(expr);
|
|
95
168
|
if (ts.isBinaryExpression(unwrapped) &&
|
|
96
169
|
unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
97
|
-
|
|
98
|
-
extractConditionalUsage(unwrapped.left, context, location);
|
|
99
|
-
// Process right side if it's not JSX (JSX is the consequence, not the condition)
|
|
170
|
+
const leftCount = countConditionsInAndChain(unwrapped.left);
|
|
100
171
|
const rightUnwrapped = unwrapExpression(unwrapped.right);
|
|
101
172
|
const isJsxConsequence = ts.isJsxElement(rightUnwrapped) ||
|
|
102
173
|
ts.isJsxSelfClosingElement(rightUnwrapped) ||
|
|
103
174
|
ts.isJsxFragment(rightUnwrapped);
|
|
104
|
-
if (
|
|
105
|
-
|
|
175
|
+
if (isJsxConsequence) {
|
|
176
|
+
return leftCount;
|
|
106
177
|
}
|
|
107
|
-
return;
|
|
178
|
+
return leftCount + countConditionsInAndChain(unwrapped.right);
|
|
108
179
|
}
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
180
|
+
// Single condition (not an && chain)
|
|
181
|
+
return 1;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Extracts conditional usages from a condition expression for key attribute detection.
|
|
185
|
+
* This function identifies which attributes are used in conditionals and how they're used.
|
|
186
|
+
* It also tracks compound conditionals (&&-chains) where all conditions must be true together.
|
|
187
|
+
*
|
|
188
|
+
* @param condition The condition expression to analyze
|
|
189
|
+
* @param context The analysis context
|
|
190
|
+
* @param location Where this condition appears (if, ternary, logical-and, switch)
|
|
191
|
+
*/
|
|
192
|
+
export function extractConditionalUsage(condition, context, location) {
|
|
193
|
+
// Internal recursive function with chain tracking
|
|
194
|
+
function extractWithChainTracking(expr, chainInfo, isNegated) {
|
|
195
|
+
const unwrapped = unwrapExpression(expr);
|
|
196
|
+
// Handle binary expressions with && (logical AND chains)
|
|
197
|
+
// Example: `a && b && <Component />` - both a and b are conditional checks
|
|
198
|
+
if (ts.isBinaryExpression(unwrapped) &&
|
|
199
|
+
unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
200
|
+
// Track if we're creating the chain at this level (root of the chain)
|
|
201
|
+
const isChainRoot = !chainInfo;
|
|
202
|
+
// If no chainInfo, this is the root of a new chain
|
|
203
|
+
if (isChainRoot) {
|
|
204
|
+
const chainLength = countConditionsInAndChain(unwrapped);
|
|
205
|
+
// Only create chain tracking for chains with 2+ conditions
|
|
206
|
+
if (chainLength >= 2) {
|
|
207
|
+
const chainId = `chain_${crypto.randomUUID().slice(0, 8)}`;
|
|
208
|
+
const chainExpression = unwrapped.getText(context.sourceFile);
|
|
209
|
+
const compound = {
|
|
210
|
+
chainId,
|
|
211
|
+
expression: chainExpression.length > 200
|
|
212
|
+
? chainExpression.slice(0, 200) + '...'
|
|
213
|
+
: chainExpression,
|
|
214
|
+
conditions: [],
|
|
215
|
+
location,
|
|
216
|
+
sourceLocation: getSourceLocation(unwrapped, context.sourceFile),
|
|
217
|
+
};
|
|
218
|
+
chainInfo = {
|
|
219
|
+
chainId,
|
|
220
|
+
chainLength,
|
|
221
|
+
chainExpression: compound.expression,
|
|
222
|
+
currentPosition: 0,
|
|
223
|
+
compound,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
// Recursively process left side
|
|
228
|
+
extractWithChainTracking(unwrapped.left, chainInfo, false);
|
|
229
|
+
// Process right side if it's not JSX (JSX is the consequence, not the condition)
|
|
230
|
+
const rightUnwrapped = unwrapExpression(unwrapped.right);
|
|
231
|
+
const isJsxConsequence = ts.isJsxElement(rightUnwrapped) ||
|
|
232
|
+
ts.isJsxSelfClosingElement(rightUnwrapped) ||
|
|
233
|
+
ts.isJsxFragment(rightUnwrapped);
|
|
234
|
+
if (!isJsxConsequence) {
|
|
235
|
+
extractWithChainTracking(unwrapped.right, chainInfo, false);
|
|
236
|
+
}
|
|
237
|
+
// If this is the root of the chain, register the compound conditional
|
|
238
|
+
if (isChainRoot && chainInfo) {
|
|
239
|
+
context.addCompoundConditional(chainInfo.compound);
|
|
240
|
+
}
|
|
133
241
|
return;
|
|
134
242
|
}
|
|
135
|
-
//
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
location,
|
|
143
|
-
});
|
|
243
|
+
// Handle binary expressions with || (logical OR)
|
|
244
|
+
// OR breaks the chain - each side is independent
|
|
245
|
+
if (ts.isBinaryExpression(unwrapped) &&
|
|
246
|
+
unwrapped.operatorToken.kind === ts.SyntaxKind.BarBarToken) {
|
|
247
|
+
// Both sides of || are independent conditional checks (no chain tracking)
|
|
248
|
+
extractWithChainTracking(unwrapped.left, null, false);
|
|
249
|
+
extractWithChainTracking(unwrapped.right, null, false);
|
|
144
250
|
return;
|
|
145
251
|
}
|
|
146
|
-
//
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
252
|
+
// Handle comparison operators (===, !==, <, >, <=, >=)
|
|
253
|
+
// Example: `if (status === 'active')` - status is compared against 'active'
|
|
254
|
+
if (ts.isBinaryExpression(unwrapped) &&
|
|
255
|
+
isComparisonOperator(unwrapped.operatorToken.kind)) {
|
|
256
|
+
// Try to extract the variable and the compared value
|
|
257
|
+
const leftPath = StructuredPath.fromNode(unwrapped.left, context.sourceFile);
|
|
258
|
+
const rightPath = StructuredPath.fromNode(unwrapped.right, context.sourceFile);
|
|
259
|
+
// Determine the compared value for computing requiredValue
|
|
260
|
+
const getRequiredValue = (literalValue, isNegatedComparison) => {
|
|
261
|
+
if (literalValue === undefined)
|
|
262
|
+
return undefined;
|
|
263
|
+
// For !== comparisons, the condition is true when NOT equal to the value
|
|
264
|
+
// For === comparisons, the condition is true when equal to the value
|
|
265
|
+
const isNotEqual = unwrapped.operatorToken.kind ===
|
|
266
|
+
ts.SyntaxKind.ExclamationEqualsEqualsToken ||
|
|
267
|
+
unwrapped.operatorToken.kind === ts.SyntaxKind.ExclamationEqualsToken;
|
|
268
|
+
if (isNotEqual) {
|
|
269
|
+
// !== 'value' means requiredValue is NOT 'value', but we express this as "not 'value'"
|
|
270
|
+
return `not ${literalValue}`;
|
|
271
|
+
}
|
|
272
|
+
return literalValue;
|
|
273
|
+
};
|
|
274
|
+
// Helper to add a condition
|
|
275
|
+
const addCondition = (path, conditionType, comparedValues, requiredValue) => {
|
|
276
|
+
const usage = {
|
|
277
|
+
path,
|
|
278
|
+
conditionType,
|
|
279
|
+
comparedValues,
|
|
280
|
+
location,
|
|
281
|
+
sourceLocation: getSourceLocation(unwrapped, context.sourceFile),
|
|
282
|
+
isNegated,
|
|
283
|
+
};
|
|
284
|
+
// Add chain info if part of a compound conditional
|
|
285
|
+
if (chainInfo) {
|
|
286
|
+
usage.chainId = chainInfo.chainId;
|
|
287
|
+
usage.chainPosition = chainInfo.currentPosition;
|
|
288
|
+
usage.chainLength = chainInfo.chainLength;
|
|
289
|
+
usage.chainExpression = chainInfo.chainExpression;
|
|
290
|
+
chainInfo.currentPosition++;
|
|
291
|
+
// Add to compound conditional conditions
|
|
292
|
+
chainInfo.compound.conditions.push({
|
|
293
|
+
path,
|
|
294
|
+
conditionType,
|
|
295
|
+
comparedValues,
|
|
296
|
+
isNegated,
|
|
297
|
+
requiredValue,
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
context.addConditionalUsage(usage);
|
|
301
|
+
};
|
|
302
|
+
// Check if left is a variable and right is a literal
|
|
303
|
+
if (leftPath && isLiteralExpression(unwrapped.right)) {
|
|
304
|
+
const literalValue = getLiteralValue(unwrapped.right, context);
|
|
305
|
+
addCondition(leftPath.toLeftHandSideString(), 'comparison', literalValue !== undefined ? [literalValue] : undefined, getRequiredValue(literalValue, isNegated));
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
// Check if right is a variable and left is a literal
|
|
309
|
+
if (rightPath && isLiteralExpression(unwrapped.left)) {
|
|
310
|
+
const literalValue = getLiteralValue(unwrapped.left, context);
|
|
311
|
+
addCondition(rightPath.toLeftHandSideString(), 'comparison', literalValue !== undefined ? [literalValue] : undefined, getRequiredValue(literalValue, isNegated));
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
// Both sides are variables - record both as comparisons without specific values
|
|
315
|
+
if (leftPath) {
|
|
316
|
+
addCondition(leftPath.toLeftHandSideString(), 'comparison');
|
|
317
|
+
}
|
|
318
|
+
if (rightPath) {
|
|
319
|
+
addCondition(rightPath.toLeftHandSideString(), 'comparison');
|
|
320
|
+
}
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
// Handle prefix unary NOT expression: !variable
|
|
324
|
+
// Example: `if (!isVisible)` - isVisible is a truthiness check (negated)
|
|
325
|
+
if (ts.isPrefixUnaryExpression(unwrapped) &&
|
|
326
|
+
unwrapped.operator === ts.SyntaxKind.ExclamationToken) {
|
|
327
|
+
extractWithChainTracking(unwrapped.operand, chainInfo, !isNegated);
|
|
328
|
+
return;
|
|
153
329
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
330
|
+
// Handle simple identifiers or property accesses (truthiness checks)
|
|
331
|
+
// Example: `if (x)` or `x && <JSX />` - x is checked for truthiness
|
|
332
|
+
const path = StructuredPath.fromNode(unwrapped, context.sourceFile);
|
|
333
|
+
if (path && !path.isLiteral()) {
|
|
334
|
+
const pathStr = path.toLeftHandSideString();
|
|
335
|
+
const usage = {
|
|
336
|
+
path: pathStr,
|
|
337
|
+
conditionType: 'truthiness',
|
|
158
338
|
location,
|
|
159
|
-
|
|
339
|
+
sourceLocation: getSourceLocation(unwrapped, context.sourceFile),
|
|
340
|
+
isNegated,
|
|
341
|
+
};
|
|
342
|
+
// Add chain info if part of a compound conditional
|
|
343
|
+
if (chainInfo) {
|
|
344
|
+
usage.chainId = chainInfo.chainId;
|
|
345
|
+
usage.chainPosition = chainInfo.currentPosition;
|
|
346
|
+
usage.chainLength = chainInfo.chainLength;
|
|
347
|
+
usage.chainExpression = chainInfo.chainExpression;
|
|
348
|
+
chainInfo.currentPosition++;
|
|
349
|
+
// Add to compound conditional conditions
|
|
350
|
+
// For truthiness, requiredValue is true if not negated, false if negated
|
|
351
|
+
chainInfo.compound.conditions.push({
|
|
352
|
+
path: pathStr,
|
|
353
|
+
conditionType: 'truthiness',
|
|
354
|
+
isNegated,
|
|
355
|
+
requiredValue: !isNegated,
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
context.addConditionalUsage(usage);
|
|
160
359
|
}
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
// Handle prefix unary NOT expression: !variable
|
|
164
|
-
// Example: `if (!isVisible)` - isVisible is a truthiness check
|
|
165
|
-
if (ts.isPrefixUnaryExpression(unwrapped) &&
|
|
166
|
-
unwrapped.operator === ts.SyntaxKind.ExclamationToken) {
|
|
167
|
-
extractConditionalUsage(unwrapped.operand, context, location);
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
// Handle simple identifiers or property accesses (truthiness checks)
|
|
171
|
-
// Example: `if (x)` or `x && <JSX />` - x is checked for truthiness
|
|
172
|
-
const path = StructuredPath.fromNode(unwrapped, context.sourceFile);
|
|
173
|
-
if (path && !path.isLiteral()) {
|
|
174
|
-
context.addConditionalUsage({
|
|
175
|
-
path: path.toLeftHandSideString(),
|
|
176
|
-
conditionType: 'truthiness',
|
|
177
|
-
location,
|
|
178
|
-
});
|
|
179
360
|
}
|
|
361
|
+
// Start extraction with no chain info
|
|
362
|
+
extractWithChainTracking(condition, null, false);
|
|
180
363
|
}
|
|
181
364
|
/**
|
|
182
365
|
* Helper to check if an expression is a literal value
|
|
@@ -254,7 +437,15 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
254
437
|
unwrappedNode.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
255
438
|
markConditionVariablesAsNullable(unwrappedNode, context);
|
|
256
439
|
// Extract conditional usages for key attribute detection
|
|
257
|
-
|
|
440
|
+
// Only call from the OUTERMOST && expression to avoid duplicates
|
|
441
|
+
// Check if parent is also a && (meaning we're nested)
|
|
442
|
+
const parent = unwrappedNode.parent;
|
|
443
|
+
const parentIsAndChain = parent &&
|
|
444
|
+
ts.isBinaryExpression(parent) &&
|
|
445
|
+
parent.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken;
|
|
446
|
+
if (!parentIsAndChain) {
|
|
447
|
+
extractConditionalUsage(unwrappedNode, context, 'logical-and');
|
|
448
|
+
}
|
|
258
449
|
}
|
|
259
450
|
// If the node falls within an excluded child scope, stop processing it.
|
|
260
451
|
if (context.isChildBoundary(node)) {
|
|
@@ -666,9 +857,10 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
666
857
|
context.markUnsupported(unwrappedNode.expression, `processExpression: Couldn't get path for called expression: ${ts.SyntaxKind[unwrappedNode.expression.kind]}`, false);
|
|
667
858
|
return false;
|
|
668
859
|
}
|
|
669
|
-
//
|
|
670
|
-
//
|
|
671
|
-
|
|
860
|
+
// Build call path using original source text for consistent schema paths.
|
|
861
|
+
// IMPORTANT: Never use cyScope names in call paths - they are internal identifiers
|
|
862
|
+
// that should not appear in schema paths or call signatures.
|
|
863
|
+
const callPath = buildCallPathFromSource(unwrappedNode, context);
|
|
672
864
|
// 2. Process all arguments recursively WITH targetPath for proper equivalence
|
|
673
865
|
for (let i = 0; i < unwrappedNode.arguments.length; i++) {
|
|
674
866
|
const arg = unwrappedNode.arguments[i];
|
|
@@ -798,6 +990,12 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
798
990
|
}
|
|
799
991
|
// Create a path for this property within the base
|
|
800
992
|
const propPath = targetPath.withProperty(propName);
|
|
993
|
+
// Handle child boundaries (callback functions) in object properties
|
|
994
|
+
// This establishes equivalency between the property path and the child scope
|
|
995
|
+
// e.g., columns[0].renderCell → cyScope1()
|
|
996
|
+
if (context.isChildBoundary(property.initializer)) {
|
|
997
|
+
context.addChildBoundaryEquivalence(propPath, property.initializer);
|
|
998
|
+
}
|
|
801
999
|
// Process the property value with propPath as targetPath
|
|
802
1000
|
// This allows nested object literals to work correctly
|
|
803
1001
|
processExpression({
|
|
@@ -1038,8 +1236,12 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
1038
1236
|
context,
|
|
1039
1237
|
typeHint: 'boolean | unknown',
|
|
1040
1238
|
}); //TODO: could we capture that this is evidence of a boolean type?
|
|
1041
|
-
|
|
1042
|
-
|
|
1239
|
+
// Process both branches WITH targetPath to establish equivalencies
|
|
1240
|
+
// This is critical for tracing nested properties through ternary assignments
|
|
1241
|
+
// e.g., const items = condition ? arr1 : arr2; items.map(i => i.prop)
|
|
1242
|
+
// We need items to be equivalent to both arr1 AND arr2 for proper tracing
|
|
1243
|
+
processExpression({ node: unwrappedNode.whenTrue, context, targetPath });
|
|
1244
|
+
processExpression({ node: unwrappedNode.whenFalse, context, targetPath });
|
|
1043
1245
|
// Create a path for the whole expression
|
|
1044
1246
|
const expressionSourcePath = nodeToSource(unwrappedNode, context.sourceFile);
|
|
1045
1247
|
// Infer type based on branches
|
|
@@ -1054,10 +1256,22 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
1054
1256
|
}
|
|
1055
1257
|
// Register type for the expression
|
|
1056
1258
|
context.addType(expressionSourcePath, resultType);
|
|
1057
|
-
// If targetPath is provided,
|
|
1259
|
+
// If targetPath is provided, only register type (don't overwrite branch equivalencies)
|
|
1260
|
+
// The equivalencies to individual branches (set above) are more useful for tracing
|
|
1261
|
+
// than an equivalency to the entire ternary expression text
|
|
1058
1262
|
if (targetPath) {
|
|
1059
|
-
|
|
1060
|
-
|
|
1263
|
+
// NOTE: We intentionally do NOT add equivalence here.
|
|
1264
|
+
// The branch processing above already added equivalencies:
|
|
1265
|
+
// targetPath -> whenTrue branch
|
|
1266
|
+
// targetPath -> whenFalse branch
|
|
1267
|
+
// Adding an equivalence to expressionSourcePath would overwrite those
|
|
1268
|
+
// with a useless equivalence to the ternary text itself.
|
|
1269
|
+
//
|
|
1270
|
+
// Use updateSchemaType instead of addType because:
|
|
1271
|
+
// 1. Branch processing may have already set a type on targetPath
|
|
1272
|
+
// 2. addType has a guard that prevents overwriting specific types with 'unknown'
|
|
1273
|
+
// 3. updateSchemaType bypasses this guard, ensuring the ternary's computed type is used
|
|
1274
|
+
context.updateSchemaType(targetPath, resultType);
|
|
1061
1275
|
}
|
|
1062
1276
|
return true;
|
|
1063
1277
|
}
|
|
@@ -1618,6 +1832,9 @@ function processJsxAttribute(attr, context, componentPath, targetPath) {
|
|
|
1618
1832
|
if (ts.isJsxExpression(attr.initializer) && attr.initializer.expression) {
|
|
1619
1833
|
const expression = attr.initializer.expression;
|
|
1620
1834
|
if (context.isChildBoundary(expression)) {
|
|
1835
|
+
// Create equivalency between attribute path and child scope
|
|
1836
|
+
// e.g., Grid().signature[0].renderRow → cyScope1()
|
|
1837
|
+
context.addChildBoundaryEquivalence(attributePath, expression);
|
|
1621
1838
|
return true;
|
|
1622
1839
|
}
|
|
1623
1840
|
// Process the expression with attributePath as targetPath
|