@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
|
@@ -25,13 +25,102 @@ interface ReturnValuePart {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Converts a
|
|
29
|
-
*
|
|
28
|
+
* Converts a call signature to a valid JavaScript identifier (function name).
|
|
29
|
+
* The original signature is preserved for data access - this only creates the function name.
|
|
30
|
+
*
|
|
31
|
+
* Examples:
|
|
32
|
+
* - "useAuth()" → "useAuth"
|
|
33
|
+
* - "db.select(usersQuery)" → "db_select_usersQuery"
|
|
34
|
+
* - "db.select(postsQuery)" → "db_select_postsQuery"
|
|
35
|
+
* - "useFetcher<User>()" → "useFetcher_User"
|
|
36
|
+
* - "useFetcher<{ data: UserData | null }>()" → "useFetcher_data_UserData_null"
|
|
37
|
+
* - "eq('user_id', value)" → "eq_user_id_value"
|
|
38
|
+
* - "from('workouts')" → "from_workouts"
|
|
30
39
|
*/
|
|
31
|
-
function
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
function callSignatureToFunctionName(signature: string): string {
|
|
41
|
+
// Extract components from the signature
|
|
42
|
+
const components: string[] = [];
|
|
43
|
+
|
|
44
|
+
// 1. Extract function path (parts separated by dots outside parens/brackets)
|
|
45
|
+
const pathMatch = signature.match(/^([^<(]+)/);
|
|
46
|
+
if (pathMatch) {
|
|
47
|
+
const path = pathMatch[1];
|
|
48
|
+
// Split on dots but preserve the parts
|
|
49
|
+
components.push(...path.split('.').filter(Boolean));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// 2. Extract generic type parameters (content between < and >)
|
|
53
|
+
const genericMatch = signature.match(/<([^>]+)>/);
|
|
54
|
+
if (genericMatch) {
|
|
55
|
+
const genericContent = genericMatch[1];
|
|
56
|
+
// Extract meaningful identifiers from generic type
|
|
57
|
+
// Handle complex types like "{ data: UserData | null }"
|
|
58
|
+
const typeIdentifiers = genericContent
|
|
59
|
+
.replace(/[{}:;,]/g, ' ') // Remove structural chars
|
|
60
|
+
.replace(/\|/g, ' ') // Handle union types
|
|
61
|
+
.split(/\s+/)
|
|
62
|
+
.filter(Boolean)
|
|
63
|
+
.filter((s) => /^[A-Za-z_][A-Za-z0-9_]*$/.test(s)) // Only valid identifiers
|
|
64
|
+
.filter(
|
|
65
|
+
(s) =>
|
|
66
|
+
![
|
|
67
|
+
'null',
|
|
68
|
+
'undefined',
|
|
69
|
+
'void',
|
|
70
|
+
'never',
|
|
71
|
+
'any',
|
|
72
|
+
'unknown',
|
|
73
|
+
'data',
|
|
74
|
+
'typeof',
|
|
75
|
+
].includes(s),
|
|
76
|
+
); // Skip common non-meaningful keywords
|
|
77
|
+
|
|
78
|
+
if (typeIdentifiers.length > 0) {
|
|
79
|
+
components.push(...typeIdentifiers.slice(0, 2)); // Limit to first 2 for reasonable length
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 3. Extract function arguments (first 2 for disambiguation)
|
|
84
|
+
const argsMatch = signature.match(/\(([^)]*)\)/);
|
|
85
|
+
if (argsMatch && argsMatch[1]) {
|
|
86
|
+
const argsContent = argsMatch[1].trim();
|
|
87
|
+
if (argsContent) {
|
|
88
|
+
const args = argsContent.split(',').map((arg) => arg.trim());
|
|
89
|
+
for (const arg of args.slice(0, 2)) {
|
|
90
|
+
// For quoted strings, extract the content
|
|
91
|
+
const stringMatch = arg.match(/^['"`](.+)['"`]$/);
|
|
92
|
+
if (stringMatch) {
|
|
93
|
+
// Split on dots for string paths like 'users.id'
|
|
94
|
+
const parts = stringMatch[1].split('.').filter(Boolean);
|
|
95
|
+
components.push(...parts);
|
|
96
|
+
} else if (/^[A-Za-z_][A-Za-z0-9_]*$/.test(arg)) {
|
|
97
|
+
// Valid identifier - use as-is
|
|
98
|
+
components.push(arg);
|
|
99
|
+
} else if (/^\d+$/.test(arg)) {
|
|
100
|
+
// Number - use as-is
|
|
101
|
+
components.push(arg);
|
|
102
|
+
}
|
|
103
|
+
// Skip complex expressions
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Build the function name from components
|
|
109
|
+
const functionName = components
|
|
110
|
+
.join('_')
|
|
111
|
+
.replace(/[^a-zA-Z0-9_]/g, '_') // Sanitize special chars
|
|
112
|
+
.replace(/_+/g, '_') // Collapse multiple underscores
|
|
113
|
+
.replace(/^_|_$/g, ''); // Trim underscores
|
|
114
|
+
|
|
115
|
+
return functionName || 'mock';
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Check if a mock name is a call signature (e.g., "useFetcher<User>()", "db.select(query)")
|
|
120
|
+
*/
|
|
121
|
+
function isCallSignature(mockName: string): boolean {
|
|
122
|
+
// Call signatures contain parentheses (function calls)
|
|
123
|
+
return mockName.includes('(');
|
|
35
124
|
}
|
|
36
125
|
|
|
37
126
|
/**
|
|
@@ -206,20 +295,27 @@ export default function constructMockCode(
|
|
|
206
295
|
mockName: string,
|
|
207
296
|
dependencySchemas: DeepReadonly<DataStructure['dependencySchemas']>,
|
|
208
297
|
entityType?: EntityType,
|
|
209
|
-
|
|
298
|
+
_canonicalKey?: string, // DEPRECATED: No longer used, kept for API compatibility
|
|
299
|
+
options?: {
|
|
300
|
+
keepOriginalFunctionName?: boolean;
|
|
301
|
+
uniqueFunctionSuffix?: string;
|
|
302
|
+
},
|
|
210
303
|
) {
|
|
211
|
-
// Check
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
? variableQualifierMatch[1]
|
|
304
|
+
// Check if mockName is a call signature (e.g., "useFetcher<User>()", "db.select(query)")
|
|
305
|
+
const mockNameIsCallSignature = isCallSignature(mockName);
|
|
306
|
+
|
|
307
|
+
// For call signatures, use the original signature for data access but generate
|
|
308
|
+
// a valid JS function name from it
|
|
309
|
+
const derivedFunctionName = mockNameIsCallSignature
|
|
310
|
+
? callSignatureToFunctionName(mockName)
|
|
219
311
|
: null;
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
312
|
+
|
|
313
|
+
// The baseMockName is the function name without type params and args
|
|
314
|
+
// e.g., "useFetcher<User>()" -> "useFetcher", "db.select(query)" -> "db"
|
|
315
|
+
const baseMockName = mockName.split(/[<(]/)[0];
|
|
316
|
+
|
|
317
|
+
// The data key is the mockName (call signature) for data access
|
|
318
|
+
let dataKey: string;
|
|
223
319
|
|
|
224
320
|
const mockNameParts = splitOutsideParenthesesAndArrays(baseMockName);
|
|
225
321
|
|
|
@@ -231,31 +327,10 @@ export default function constructMockCode(
|
|
|
231
327
|
|
|
232
328
|
for (const filePath in dependencySchemas) {
|
|
233
329
|
for (const entityName in dependencySchemas[filePath]) {
|
|
234
|
-
//
|
|
235
|
-
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
: mockNameParts[0];
|
|
239
|
-
|
|
240
|
-
// Check for direct match
|
|
241
|
-
let matches =
|
|
242
|
-
entityName === targetEntityName || entityName === mockNameParts[0];
|
|
243
|
-
|
|
244
|
-
// If no direct match and no qualifier was provided, check if the entity
|
|
245
|
-
// is stored under a variable-qualified key (e.g., "stateBadge <- getStateBadge")
|
|
246
|
-
// This handles the case where gatherDataForMocks stored the entity with a variable
|
|
247
|
-
// qualifier but writeScenarioComponents called constructMockCode without one.
|
|
248
|
-
if (!matches && !variableQualifier) {
|
|
249
|
-
const qualifiedKeyMatch = entityName.match(
|
|
250
|
-
new RegExp(`^([a-zA-Z_][a-zA-Z0-9_]*)\\s*<-\\s*${mockNameParts[0]}$`),
|
|
251
|
-
);
|
|
252
|
-
if (qualifiedKeyMatch) {
|
|
253
|
-
matches = true;
|
|
254
|
-
// Extract the variable qualifier from the entity name so we can use
|
|
255
|
-
// it for the data lookup key later
|
|
256
|
-
variableQualifier = qualifiedKeyMatch[1];
|
|
257
|
-
}
|
|
258
|
-
}
|
|
330
|
+
// Match entity by base name (without generics/args)
|
|
331
|
+
const entityBaseName = entityName.split(/[<(]/)[0];
|
|
332
|
+
const matches =
|
|
333
|
+
entityBaseName === baseMockName || entityName === mockNameParts[0];
|
|
259
334
|
|
|
260
335
|
if (!matches) continue;
|
|
261
336
|
|
|
@@ -299,6 +374,45 @@ export default function constructMockCode(
|
|
|
299
374
|
}
|
|
300
375
|
}
|
|
301
376
|
|
|
377
|
+
// Check if the entity is used as a function (called with ()) vs an object/namespace.
|
|
378
|
+
// Look for paths in the schema that start with "baseMockName(" or "baseMockName<" indicating function calls.
|
|
379
|
+
// The "<" handles generic type parameters like useLoaderData<T>().
|
|
380
|
+
// Also check dataStructurePath === 'returnValue' which indicates a function return value.
|
|
381
|
+
const entityIsFunction =
|
|
382
|
+
foundEntityWithSignature ||
|
|
383
|
+
dataStructurePath === 'returnValue' ||
|
|
384
|
+
Object.keys(relevantReturnValueSchema ?? {}).some(
|
|
385
|
+
(key) =>
|
|
386
|
+
key.startsWith(`${baseMockName}(`) ||
|
|
387
|
+
key.startsWith(`${baseMockName}<`),
|
|
388
|
+
);
|
|
389
|
+
|
|
390
|
+
// Calculate the data key - use the call signature (mockName) for data access
|
|
391
|
+
// For simple names without parentheses:
|
|
392
|
+
// - Append () ONLY if the entity is a function/hook (detected above)
|
|
393
|
+
// - Don't append () for object/namespace mocks like "supabase"
|
|
394
|
+
if (mockNameIsCallSignature || mockName.includes('(')) {
|
|
395
|
+
dataKey = mockName;
|
|
396
|
+
} else if (entityIsFunction) {
|
|
397
|
+
// Entity is a function/hook - append () to match call signature format
|
|
398
|
+
dataKey = `${mockName}()`;
|
|
399
|
+
} else {
|
|
400
|
+
// Entity is an object/namespace - use bare name as key
|
|
401
|
+
dataKey = mockName;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// LOGGING: Track data key generation for debugging key mismatch issues
|
|
405
|
+
console.log(
|
|
406
|
+
'CODEYAM DEBUG [constructMockCode]: Generated dataKey:',
|
|
407
|
+
JSON.stringify({
|
|
408
|
+
mockName,
|
|
409
|
+
dataKey,
|
|
410
|
+
mockNameIsCallSignature,
|
|
411
|
+
entityIsFunction,
|
|
412
|
+
baseMockName,
|
|
413
|
+
}),
|
|
414
|
+
);
|
|
415
|
+
|
|
302
416
|
// Check if the return value schema only contains function type markers
|
|
303
417
|
// (e.g., "validateInputs()": "function") without actual return data
|
|
304
418
|
// (no functionCallReturnValue entries)
|
|
@@ -413,18 +527,17 @@ export default function constructMockCode(
|
|
|
413
527
|
// so "useLoaderData<typeof loader>()" becomes "useLoaderData()"
|
|
414
528
|
name = cleanOutTypes(name);
|
|
415
529
|
|
|
416
|
-
// For
|
|
417
|
-
// This
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
//
|
|
421
|
-
|
|
422
|
-
|
|
530
|
+
// For root data access, use the dataKey (original call signature or canonical key)
|
|
531
|
+
// This preserves the original call signature for LLM clarity
|
|
532
|
+
if (isRootAccess) {
|
|
533
|
+
// For call signature format, use the original mockName as the data key
|
|
534
|
+
// e.g., scenarios().data()?.["useFetcher<User>()"]
|
|
535
|
+
// e.g., scenarios().data()?.["db.select(usersQuery)"]
|
|
536
|
+
return `?.["${dataKey.replace(/\n/g, '\\n')}"]`;
|
|
423
537
|
}
|
|
424
538
|
|
|
425
539
|
// Only use unquoted array access syntax for pure array indices like [0], [1]
|
|
426
|
-
|
|
427
|
-
if (name.match(/^\[\d+\]$/) && !name.includes(' <- ')) {
|
|
540
|
+
if (name.match(/^\[\d+\]$/)) {
|
|
428
541
|
return `?.${name}`;
|
|
429
542
|
}
|
|
430
543
|
|
|
@@ -663,10 +776,19 @@ export default function constructMockCode(
|
|
|
663
776
|
// When GENERIC array (using []) has nested content (like functions that need wrapping),
|
|
664
777
|
// use .map() to transform ALL elements instead of just creating [0]
|
|
665
778
|
// For DIFFERENTIATED arrays (using [0], [1], etc.), keep the static array structure
|
|
779
|
+
//
|
|
780
|
+
// IMPORTANT: If the nested content contains differentiated indices like [0], [1],
|
|
781
|
+
// we MUST use static array pattern, not .map(). The presence of differentiated
|
|
782
|
+
// indices means the array elements have different types/structures, so .map()
|
|
783
|
+
// would generate invalid code trying to treat them uniformly.
|
|
784
|
+
const hasDifferentiatedIndices =
|
|
785
|
+
nested &&
|
|
786
|
+
nested.some((n) => n.name.match(/^\[\d+\]$/) && n.name !== '[0]');
|
|
666
787
|
if (
|
|
667
788
|
isGenericArray &&
|
|
668
789
|
nestedContent.length > 0 &&
|
|
669
|
-
dataPaths.length > 0
|
|
790
|
+
dataPaths.length > 0 &&
|
|
791
|
+
!hasDifferentiatedIndices
|
|
670
792
|
) {
|
|
671
793
|
// Get the array base path (without the [0])
|
|
672
794
|
const arrayBasePath = dataPaths[0].replace(/\?\.\[0\]$/, '');
|
|
@@ -699,6 +821,13 @@ export default function constructMockCode(
|
|
|
699
821
|
if (args && args.length > 0) {
|
|
700
822
|
if (!isValidKey(name)) return;
|
|
701
823
|
|
|
824
|
+
// Skip array index patterns like [], [0], [1] when they have args
|
|
825
|
+
// These represent function calls on array elements, not property keys
|
|
826
|
+
// e.g., customSizes[].(args) means each array element is callable, not a property named "[]"
|
|
827
|
+
if (name.match(/^\[\d*\]$/)) {
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
|
|
702
831
|
const mostArgs = args.sort(
|
|
703
832
|
(a: string[], b: string[]) => b.length - a.length,
|
|
704
833
|
)[0];
|
|
@@ -758,8 +887,18 @@ export default function constructMockCode(
|
|
|
758
887
|
// Use all paths for fallback (existing behavior)
|
|
759
888
|
fallbackContent = `return ${returnValueContents}`;
|
|
760
889
|
} else {
|
|
761
|
-
//
|
|
762
|
-
|
|
890
|
+
// No explicit fallback paths - return the first literal's value as default
|
|
891
|
+
// Returning spread of all values is dangerous because if values are primitives (strings),
|
|
892
|
+
// spreading them creates objects with numeric keys like {0:'a', 1:'b', ...}
|
|
893
|
+
// which causes "Objects are not valid as React child" errors
|
|
894
|
+
const firstLiteralValue = literalKeys[0];
|
|
895
|
+
const firstGroupPaths = argGroups.get(firstLiteralValue);
|
|
896
|
+
if (firstGroupPaths && firstGroupPaths.length === 1) {
|
|
897
|
+
fallbackContent = `return ${firstGroupPaths[0]}`;
|
|
898
|
+
} else {
|
|
899
|
+
// Multiple paths for first literal - return undefined as safe fallback
|
|
900
|
+
fallbackContent = `return undefined`;
|
|
901
|
+
}
|
|
763
902
|
}
|
|
764
903
|
|
|
765
904
|
const funcContents =
|
|
@@ -853,8 +992,8 @@ export default function constructMockCode(
|
|
|
853
992
|
}
|
|
854
993
|
}
|
|
855
994
|
|
|
856
|
-
//
|
|
857
|
-
//
|
|
995
|
+
// Compare against baseMockName (without generics/args), not the full mockName
|
|
996
|
+
// e.g., for "useFetcher<User>()", baseMockName is "useFetcher"
|
|
858
997
|
if (parts[0].split('(')[0] !== baseMockName) continue;
|
|
859
998
|
|
|
860
999
|
// Include paths with functionCallReturnValue OR function-typed paths that need mocking
|
|
@@ -1324,16 +1463,17 @@ export default function constructMockCode(
|
|
|
1324
1463
|
// These are needed when the mock is passed to functions that use .entries(), .keys(), etc.
|
|
1325
1464
|
// (e.g., Object.fromEntries(headers.entries()) in buildLegacyHeaders)
|
|
1326
1465
|
const needsIteratorMethods =
|
|
1327
|
-
|
|
1466
|
+
baseMockName === 'headers' || baseMockName === 'cookies';
|
|
1328
1467
|
let enhancedContents = contents;
|
|
1329
1468
|
if (needsIteratorMethods && contents.trim().startsWith('{')) {
|
|
1330
1469
|
// Add iterator methods that operate on the scenario data
|
|
1470
|
+
// Use the dataKey (original call signature or canonical key)
|
|
1331
1471
|
const iteratorMethods = `,
|
|
1332
|
-
entries: () => Object.entries(scenarios().data()?.["${
|
|
1333
|
-
keys: () => Object.keys(scenarios().data()?.["${
|
|
1334
|
-
values: () => Object.values(scenarios().data()?.["${
|
|
1335
|
-
forEach: (fn) => Object.entries(scenarios().data()?.["${
|
|
1336
|
-
has: (key) => Object.prototype.hasOwnProperty.call(scenarios().data()?.["${
|
|
1472
|
+
entries: () => Object.entries(scenarios().data()?.["${dataKey}"] || {}),
|
|
1473
|
+
keys: () => Object.keys(scenarios().data()?.["${dataKey}"] || {}),
|
|
1474
|
+
values: () => Object.values(scenarios().data()?.["${dataKey}"] || {}),
|
|
1475
|
+
forEach: (fn) => Object.entries(scenarios().data()?.["${dataKey}"] || {}).forEach(([k, v]) => fn(v, k)),
|
|
1476
|
+
has: (key) => Object.prototype.hasOwnProperty.call(scenarios().data()?.["${dataKey}"] || {}, key)`;
|
|
1337
1477
|
// Insert before the closing brace (handle trailing whitespace)
|
|
1338
1478
|
enhancedContents = contents.replace(/\}\s*$/, iteratorMethods + '\n}');
|
|
1339
1479
|
}
|
|
@@ -1344,40 +1484,102 @@ export default function constructMockCode(
|
|
|
1344
1484
|
// `new ClassName("arg")` wouldn't create the expected instance.
|
|
1345
1485
|
// For Error subclasses (detected by name ending in "Error"), extend Error for proper error handling.
|
|
1346
1486
|
if (entityType === 'class') {
|
|
1347
|
-
const isErrorSubclass =
|
|
1348
|
-
const baseClass = isErrorSubclass ? 'Error' : 'Object';
|
|
1487
|
+
const isErrorSubclass = baseMockName.endsWith('Error');
|
|
1349
1488
|
const superCall = isErrorSubclass ? 'super(message);' : '';
|
|
1350
1489
|
const nameAssignment = isErrorSubclass
|
|
1351
|
-
? `this.name = '${
|
|
1490
|
+
? `this.name = '${baseMockName}';`
|
|
1352
1491
|
: '';
|
|
1492
|
+
// Use the safe function name for the class definition
|
|
1493
|
+
const className = mockNameIsCallSignature
|
|
1494
|
+
? derivedFunctionName
|
|
1495
|
+
: baseMockName;
|
|
1353
1496
|
|
|
1354
|
-
return `class ${
|
|
1497
|
+
return `class ${className}${isErrorSubclass ? ' extends Error' : ''} {
|
|
1355
1498
|
constructor(message) {
|
|
1356
1499
|
${superCall}
|
|
1357
1500
|
${nameAssignment}
|
|
1358
|
-
Object.assign(this, scenarios().data()?.["${
|
|
1501
|
+
Object.assign(this, scenarios().data()?.["${dataKey}"] || {});
|
|
1359
1502
|
}
|
|
1360
1503
|
}`;
|
|
1361
1504
|
}
|
|
1362
1505
|
|
|
1363
|
-
//
|
|
1364
|
-
//
|
|
1365
|
-
//
|
|
1366
|
-
//
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1506
|
+
// Generate safe function name:
|
|
1507
|
+
// 1. For call signatures: use derivedFunctionName
|
|
1508
|
+
// e.g., "useFetcher<User>()" becomes "useFetcher_User"
|
|
1509
|
+
// e.g., "db.select(usersQuery)" becomes "db_select_usersQuery"
|
|
1510
|
+
// 2. With uniqueFunctionSuffix option: append suffix for unique naming
|
|
1511
|
+
// e.g., baseMockName = "useFetcher", suffix = "entityDiffFetcher" -> "useFetcher_entityDiffFetcher"
|
|
1512
|
+
// 3. EXCEPTION: When keepOriginalFunctionName is true (for single-call cases), use the base name
|
|
1513
|
+
let safeFunctionName: string;
|
|
1514
|
+
if (options?.keepOriginalFunctionName) {
|
|
1515
|
+
safeFunctionName = baseMockName;
|
|
1516
|
+
} else if (options?.uniqueFunctionSuffix) {
|
|
1517
|
+
safeFunctionName = `${baseMockName}_${options.uniqueFunctionSuffix}`;
|
|
1518
|
+
} else if (mockNameIsCallSignature && derivedFunctionName) {
|
|
1519
|
+
safeFunctionName = derivedFunctionName;
|
|
1520
|
+
} else {
|
|
1521
|
+
safeFunctionName = baseMockName;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
// Check if this function returns a function (detected by double-call pattern: mockName(args)())
|
|
1525
|
+
// This happens when the schema has keys like "wrapThrows(() => JSON.parse(savedFilters))()"
|
|
1526
|
+
// where the function call is immediately followed by another call.
|
|
1527
|
+
// Example usage: const result = wrapThrows(() => JSON.parse(x))(); // double call
|
|
1528
|
+
const isHigherOrderFunction = Object.keys(
|
|
1529
|
+
relevantReturnValueSchema ?? {},
|
|
1530
|
+
).some((key) => {
|
|
1531
|
+
if (!key.startsWith(baseMockName)) return false;
|
|
1532
|
+
|
|
1533
|
+
// Find the first ( after baseMockName (the start of the function call)
|
|
1534
|
+
const firstOpenParen = key.indexOf('(', baseMockName.length);
|
|
1535
|
+
if (firstOpenParen === -1) return false;
|
|
1536
|
+
|
|
1537
|
+
// Skip if the ( is not immediately after the mock name
|
|
1538
|
+
// (there might be type params like func<T>() - handle by checking for < or ()
|
|
1539
|
+
const between = key.slice(baseMockName.length, firstOpenParen);
|
|
1540
|
+
if (between.length > 0 && !between.startsWith('<')) return false;
|
|
1541
|
+
|
|
1542
|
+
// Find the matching ) for the first ( using depth counting
|
|
1543
|
+
let depth = 1;
|
|
1544
|
+
let i = firstOpenParen + 1;
|
|
1545
|
+
while (i < key.length && depth > 0) {
|
|
1546
|
+
if (key[i] === '(') depth++;
|
|
1547
|
+
if (key[i] === ')') depth--;
|
|
1548
|
+
i++;
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
if (depth !== 0) return false; // Unbalanced parentheses
|
|
1371
1552
|
|
|
1372
|
-
|
|
1553
|
+
// Now i points just after the matching )
|
|
1554
|
+
// Check if there's another ( immediately (indicating double call)
|
|
1555
|
+
const remaining = key.slice(i);
|
|
1556
|
+
if (remaining.startsWith('(')) return true;
|
|
1557
|
+
|
|
1558
|
+
return false;
|
|
1559
|
+
});
|
|
1560
|
+
|
|
1561
|
+
// For higher-order functions, wrap the return in an arrow function
|
|
1562
|
+
// so that mockFunc(arg)() works correctly (outer call returns a function, inner call gets the data)
|
|
1563
|
+
const returnValue = isHigherOrderFunction
|
|
1564
|
+
? `() => ${safeFunctionName}ReturnValue`
|
|
1565
|
+
: `${safeFunctionName}ReturnValue`;
|
|
1566
|
+
|
|
1567
|
+
return `const ${safeFunctionName}ReturnValue = ${enhancedContents};\n\n${isRootAsyncFunction ? 'async ' : ''}function ${safeFunctionName}() {\n${indent(`return ${returnValue};`)}\n}`;
|
|
1373
1568
|
} else {
|
|
1374
|
-
//
|
|
1375
|
-
//
|
|
1376
|
-
//
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1569
|
+
// Generate safe const name:
|
|
1570
|
+
// 1. For call signatures: use derivedFunctionName
|
|
1571
|
+
// 2. With uniqueFunctionSuffix option: append suffix for unique naming
|
|
1572
|
+
// 3. EXCEPTION: When keepOriginalFunctionName is true (for single-call cases), use the base name
|
|
1573
|
+
let safeName: string;
|
|
1574
|
+
if (options?.keepOriginalFunctionName) {
|
|
1575
|
+
safeName = baseMockName;
|
|
1576
|
+
} else if (options?.uniqueFunctionSuffix) {
|
|
1577
|
+
safeName = `${baseMockName}_${options.uniqueFunctionSuffix}`;
|
|
1578
|
+
} else if (mockNameIsCallSignature && derivedFunctionName) {
|
|
1579
|
+
safeName = derivedFunctionName;
|
|
1580
|
+
} else {
|
|
1581
|
+
safeName = baseMockName;
|
|
1582
|
+
}
|
|
1381
1583
|
|
|
1382
1584
|
// Get any jsx-component properties that need to be preserved from the original
|
|
1383
1585
|
const jsxProperties = getJsxComponentProperties(
|
|
@@ -91,47 +91,59 @@ export default class SequentialCaptureTaskRunner implements CaptureTaskRunner {
|
|
|
91
91
|
|
|
92
92
|
// Derive paths
|
|
93
93
|
const parentDir = parentOfCodeyam;
|
|
94
|
-
const capturerPath = path.normalize(path.join(parentDir, 'capturer-1'));
|
|
95
94
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
// In CAPTURE_ONLY mode, run directly from the main project folder (skip rsync)
|
|
96
|
+
// This preserves any manual edits made to generated files
|
|
97
|
+
const captureOnly = process.env.CAPTURE_ONLY === 'true';
|
|
98
|
+
const capturerPath = captureOnly
|
|
99
|
+
? parentDir
|
|
100
|
+
: path.normalize(path.join(parentDir, 'capturer-1'));
|
|
102
101
|
|
|
103
|
-
|
|
104
|
-
// start.ts waits for repo checkout to complete before creating this runner
|
|
105
|
-
console.log('CodeYam: Copying codeyam/ and project/ to capturer-1/...');
|
|
106
|
-
await rsyncCopy({
|
|
107
|
-
sourcePath: parentDir,
|
|
108
|
-
destinationPath: capturerPath,
|
|
109
|
-
excludes: ['codeyam/log.txt', 'capturer-*'],
|
|
110
|
-
silent: false,
|
|
111
|
-
});
|
|
102
|
+
console.log(`CodeYam: Sequential runner using capturer at ${capturerPath}`);
|
|
112
103
|
|
|
113
|
-
|
|
114
|
-
const capturerProjectPath = path.join(capturerPath, 'project');
|
|
115
|
-
console.log('CodeYam: Sanitizing env files in capturer project...');
|
|
116
|
-
const sanitizeResult = sanitizeEnvFiles({
|
|
117
|
-
projectPath: capturerProjectPath,
|
|
118
|
-
log: (msg) => console.log(`CodeYam Sanitize: ${msg}`),
|
|
119
|
-
});
|
|
120
|
-
if (sanitizeResult.sanitizedFiles.length > 0) {
|
|
104
|
+
if (captureOnly) {
|
|
121
105
|
console.log(
|
|
122
|
-
|
|
106
|
+
'CodeYam: CAPTURE_ONLY mode - running from main project folder, skipping rsync',
|
|
123
107
|
);
|
|
124
|
-
}
|
|
108
|
+
} else {
|
|
109
|
+
// Create capturer base directory
|
|
110
|
+
if (!fs.existsSync(capturerPath)) {
|
|
111
|
+
fs.mkdirSync(capturerPath, { recursive: true });
|
|
112
|
+
}
|
|
125
113
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
console.log(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
114
|
+
// Copy both codeyam/ and project/ into capturer-1/
|
|
115
|
+
// start.ts waits for repo checkout to complete before creating this runner
|
|
116
|
+
console.log('CodeYam: Copying codeyam/ and project/ to capturer-1/...');
|
|
117
|
+
await rsyncCopy({
|
|
118
|
+
sourcePath: parentDir,
|
|
119
|
+
destinationPath: capturerPath,
|
|
120
|
+
excludes: ['codeyam/log.txt', 'capturer-*'],
|
|
121
|
+
silent: false,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// Sanitize env files in capturer project (replaces real values with mock placeholders)
|
|
125
|
+
const capturerProjectPath = path.join(capturerPath, 'project');
|
|
126
|
+
console.log('CodeYam: Sanitizing env files in capturer project...');
|
|
127
|
+
const sanitizeResult = sanitizeEnvFiles({
|
|
133
128
|
projectPath: capturerProjectPath,
|
|
129
|
+
log: (msg) => console.log(`CodeYam Sanitize: ${msg}`),
|
|
134
130
|
});
|
|
131
|
+
if (sanitizeResult.sanitizedFiles.length > 0) {
|
|
132
|
+
console.log(
|
|
133
|
+
`CodeYam: Env files sanitized: ${sanitizeResult.sanitizedFiles.join(', ')}`,
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Apply universal mocks to capturer project
|
|
138
|
+
if (context.universalMocks && context.universalMocks.length > 0) {
|
|
139
|
+
console.log(
|
|
140
|
+
`CodeYam: Applying ${context.universalMocks.length} universal mock(s) to capturer project...`,
|
|
141
|
+
);
|
|
142
|
+
await applyUniversalMocks({
|
|
143
|
+
mocks: context.universalMocks,
|
|
144
|
+
projectPath: capturerProjectPath,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
135
147
|
}
|
|
136
148
|
|
|
137
149
|
const runner = new SequentialCaptureTaskRunner(
|
|
@@ -247,6 +259,10 @@ export default class SequentialCaptureTaskRunner implements CaptureTaskRunner {
|
|
|
247
259
|
READY_TO_BE_CAPTURED: 'true',
|
|
248
260
|
PROJECT_SLUG: this.config.projectSlug,
|
|
249
261
|
CODEYAM_LOG_PATH: capturerLogPath,
|
|
262
|
+
// Pass CAPTURE_ONLY through from parent process to skip file regeneration
|
|
263
|
+
...(process.env.CAPTURE_ONLY && {
|
|
264
|
+
CAPTURE_ONLY: process.env.CAPTURE_ONLY,
|
|
265
|
+
}),
|
|
250
266
|
},
|
|
251
267
|
workingDir: capturerCodeyamPath,
|
|
252
268
|
processName: 'project',
|
|
@@ -280,14 +296,38 @@ export default class SequentialCaptureTaskRunner implements CaptureTaskRunner {
|
|
|
280
296
|
}, timeoutMs);
|
|
281
297
|
});
|
|
282
298
|
|
|
299
|
+
// Track which process exits first and when
|
|
300
|
+
const batchStartTime = Date.now();
|
|
301
|
+
let startExitCode: number | null = null;
|
|
302
|
+
let captureExitCode: number | null = null;
|
|
303
|
+
let firstToExit: 'start' | 'capture' | 'timeout' | null = null;
|
|
304
|
+
|
|
305
|
+
const startPromiseWithLogging = startResult.promise.then((code) => {
|
|
306
|
+
startExitCode = code;
|
|
307
|
+
if (!firstToExit) {
|
|
308
|
+
firstToExit = 'start';
|
|
309
|
+
}
|
|
310
|
+
return code;
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
const capturePromiseWithLogging = captureResult.promise.then((code) => {
|
|
314
|
+
captureExitCode = code;
|
|
315
|
+
if (!firstToExit) {
|
|
316
|
+
firstToExit = 'capture';
|
|
317
|
+
}
|
|
318
|
+
return code;
|
|
319
|
+
});
|
|
320
|
+
|
|
283
321
|
try {
|
|
284
|
-
//
|
|
322
|
+
// Wait for EITHER process to complete (or timeout)
|
|
323
|
+
// If start.js exits, we should investigate why - it shouldn't exit before capture is done
|
|
285
324
|
await Promise.race([
|
|
286
|
-
|
|
287
|
-
|
|
325
|
+
capturePromiseWithLogging,
|
|
326
|
+
startPromiseWithLogging,
|
|
288
327
|
timeoutPromise,
|
|
289
328
|
]);
|
|
290
|
-
|
|
329
|
+
const elapsed = ((Date.now() - batchStartTime) / 1000).toFixed(1);
|
|
330
|
+
console.log(`CodeYam: Batch processing completed after ${elapsed}s`);
|
|
291
331
|
} finally {
|
|
292
332
|
// Clean up timeout handle
|
|
293
333
|
if (timeoutHandle) {
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
* (e.g., "eq('user_id', 'user-12345')") when the mock code expects variable
|
|
6
6
|
* references (e.g., "eq('user_id', user.id)").
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* Keys are now original call signatures (e.g., "useFetcher<User>()", "db.select(query)").
|
|
9
|
+
*
|
|
10
|
+
* @param mockData The mock data object to reconcile
|
|
11
|
+
* @param expectedKeys The expected keys from the structure
|
|
9
12
|
*/
|
|
10
13
|
export function reconcileMockDataKeys(
|
|
11
14
|
mockData: Record<string, unknown>,
|
|
@@ -26,7 +29,7 @@ export function reconcileMockDataKeys(
|
|
|
26
29
|
continue;
|
|
27
30
|
}
|
|
28
31
|
|
|
29
|
-
// Try to find closest match
|
|
32
|
+
// Try to find closest match using existing logic
|
|
30
33
|
const closestKey = findClosestKey(key, expectedKeys);
|
|
31
34
|
if (closestKey) {
|
|
32
35
|
result[closestKey] = reconciledValue;
|