@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
|
@@ -302,14 +302,14 @@ export async function runMultiScenarioServer({
|
|
|
302
302
|
message: message.slice(0, 1000),
|
|
303
303
|
});
|
|
304
304
|
|
|
305
|
-
//
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
} as Error);
|
|
309
|
-
|
|
310
|
-
// Only signal scenario failed for RELEVANT crash errors
|
|
311
|
-
// Non-crash errors (like SSR warnings) should be recorded but not stop capture
|
|
305
|
+
// Only save error and signal scenario failed for RELEVANT crash errors
|
|
306
|
+
// Non-crash errors (like SSR warnings) should be logged but not stop capture
|
|
307
|
+
// or mark the scenario as finished (which would prevent screenshot capture)
|
|
312
308
|
if (relevantError) {
|
|
309
|
+
// Save crash error to database (sets finishedAt on scenario)
|
|
310
|
+
await recordErrorMessageForScenario(analysis, currentScenario, {
|
|
311
|
+
message: messageToSave,
|
|
312
|
+
} as Error);
|
|
313
313
|
awsLog(
|
|
314
314
|
'CodeYam SERVER DEBUG: Calling handleServerError for crash error',
|
|
315
315
|
{
|
|
@@ -320,8 +320,9 @@ export async function runMultiScenarioServer({
|
|
|
320
320
|
);
|
|
321
321
|
iterator.handleServerError(currentScenario.name);
|
|
322
322
|
} else {
|
|
323
|
+
// Non-crash errors are logged but don't affect scenario status
|
|
323
324
|
awsLog(
|
|
324
|
-
'CodeYam SERVER DEBUG: Non-crash error
|
|
325
|
+
'CodeYam SERVER DEBUG: Non-crash error logged, NOT stopping scenario',
|
|
325
326
|
{
|
|
326
327
|
analysisId: analysis.id,
|
|
327
328
|
scenarioName: currentScenario.name,
|
|
@@ -501,13 +502,13 @@ export async function runMultiScenarioServer({
|
|
|
501
502
|
|
|
502
503
|
if (!iterator.hasScenarioFailed(scenario.name)) {
|
|
503
504
|
completedScenarios.push(scenario.name);
|
|
504
|
-
awsLog('CodeYam
|
|
505
|
+
awsLog('CodeYam: Scenario marked as completed', {
|
|
505
506
|
analysisId: analysis.id,
|
|
506
507
|
scenarioName: scenario.name,
|
|
507
508
|
scenarioId: scenario.id,
|
|
508
509
|
});
|
|
509
510
|
} else {
|
|
510
|
-
awsLog('CodeYam
|
|
511
|
+
awsLog('CodeYam: Scenario marked as FAILED', {
|
|
511
512
|
analysisId: analysis.id,
|
|
512
513
|
scenarioName: scenario.name,
|
|
513
514
|
scenarioId: scenario.id,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Configuration for modules that require client-side mocking.
|
|
3
5
|
*
|
|
@@ -206,35 +208,81 @@ export function parseImportStatement(importStatement: string): {
|
|
|
206
208
|
* Replaces imports from known server-only modules with mock implementations.
|
|
207
209
|
*/
|
|
208
210
|
export function applyServerOnlyMocks(fileContent: string): string {
|
|
209
|
-
|
|
211
|
+
// Always use AST parsing - regex with nested quantifiers can cause catastrophic
|
|
212
|
+
// backtracking that hangs on a single .exec() call (before iteration limits kick in)
|
|
213
|
+
return applyServerOnlyMocksAst(fileContent);
|
|
214
|
+
}
|
|
210
215
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
216
|
+
/**
|
|
217
|
+
* AST-based implementation of applyServerOnlyMocks for large files.
|
|
218
|
+
* Uses TypeScript parser instead of regex to avoid catastrophic backtracking.
|
|
219
|
+
*/
|
|
220
|
+
function applyServerOnlyMocksAst(fileContent: string): string {
|
|
221
|
+
try {
|
|
222
|
+
const sourceFile = ts.createSourceFile(
|
|
223
|
+
'temp.ts',
|
|
224
|
+
fileContent,
|
|
225
|
+
ts.ScriptTarget.Latest,
|
|
226
|
+
true,
|
|
227
|
+
);
|
|
214
228
|
|
|
215
|
-
|
|
216
|
-
|
|
229
|
+
const replacements: { start: number; end: number; replacement: string }[] =
|
|
230
|
+
[];
|
|
217
231
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const parsed = parseImportStatement(fullImport);
|
|
232
|
+
for (const statement of sourceFile.statements) {
|
|
233
|
+
if (!ts.isImportDeclaration(statement)) continue;
|
|
221
234
|
|
|
222
|
-
|
|
235
|
+
const moduleSpecifier = statement.moduleSpecifier;
|
|
236
|
+
if (!ts.isStringLiteral(moduleSpecifier)) continue;
|
|
223
237
|
|
|
224
|
-
|
|
225
|
-
|
|
238
|
+
const modulePath = moduleSpecifier.text;
|
|
239
|
+
const config = findServerOnlyModule(modulePath);
|
|
240
|
+
if (!config) continue;
|
|
226
241
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
);
|
|
231
|
-
replacements.push({ original: fullImport, replacement: mockCode });
|
|
232
|
-
}
|
|
242
|
+
// Extract import names
|
|
243
|
+
const importNames: string[] = [];
|
|
244
|
+
let defaultImportName: string | undefined;
|
|
233
245
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
246
|
+
if (statement.importClause) {
|
|
247
|
+
// Default import
|
|
248
|
+
if (statement.importClause.name) {
|
|
249
|
+
defaultImportName = statement.importClause.name.text;
|
|
250
|
+
}
|
|
238
251
|
|
|
239
|
-
|
|
252
|
+
// Named imports
|
|
253
|
+
if (statement.importClause.namedBindings) {
|
|
254
|
+
if (ts.isNamedImports(statement.importClause.namedBindings)) {
|
|
255
|
+
for (const element of statement.importClause.namedBindings
|
|
256
|
+
.elements) {
|
|
257
|
+
importNames.push(element.name.text);
|
|
258
|
+
}
|
|
259
|
+
} else if (
|
|
260
|
+
ts.isNamespaceImport(statement.importClause.namedBindings)
|
|
261
|
+
) {
|
|
262
|
+
// Namespace import like: import * as foo from 'module'
|
|
263
|
+
importNames.push(statement.importClause.namedBindings.name.text);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const mockCode = config.getMockCode(importNames, defaultImportName);
|
|
269
|
+
replacements.push({
|
|
270
|
+
start: statement.getStart(sourceFile),
|
|
271
|
+
end: statement.getEnd(),
|
|
272
|
+
replacement: mockCode,
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// Apply replacements in reverse order to preserve positions
|
|
277
|
+
let result = fileContent;
|
|
278
|
+
replacements.sort((a, b) => b.start - a.start);
|
|
279
|
+
for (const { start, end, replacement } of replacements) {
|
|
280
|
+
result = result.slice(0, start) + replacement + result.slice(end);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return result;
|
|
284
|
+
} catch (error) {
|
|
285
|
+
console.warn('[applyServerOnlyMocksAst] Failed to parse file:', error);
|
|
286
|
+
return fileContent; // Return original content on error
|
|
287
|
+
}
|
|
240
288
|
}
|
|
@@ -440,6 +440,16 @@ async function main({
|
|
|
440
440
|
`CodeYam: Exiting start.js process with ${hadError ? 'ERROR' : 'SUCCESS'}`,
|
|
441
441
|
);
|
|
442
442
|
process.exit(hadError ? 1 : 0);
|
|
443
|
+
} else if (process.env.CAPTURE_ONLY === 'true') {
|
|
444
|
+
awsLog(
|
|
445
|
+
'CodeYam: CAPTURE_ONLY mode - keeping files and exiting cleanly',
|
|
446
|
+
`Preserved ${generatedFiles.length} files`,
|
|
447
|
+
);
|
|
448
|
+
// Don't cleanup files in capture-only mode to preserve manual edits
|
|
449
|
+
awsLog(
|
|
450
|
+
`CodeYam: Exiting start.js process with ${hadError ? 'ERROR' : 'SUCCESS'}`,
|
|
451
|
+
);
|
|
452
|
+
process.exit(hadError ? 1 : 0);
|
|
443
453
|
} else {
|
|
444
454
|
awsLog(`CodeYam: Removing ${generatedFiles.length} generated files...`);
|
|
445
455
|
removeScenario(generatedFiles);
|
|
@@ -85,8 +85,9 @@ export async function startScenarioCapture({
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
// Clean up any leftover generated files from previous debug sessions
|
|
88
|
+
// Skip in CAPTURE_ONLY mode - we want to preserve the files that were edited
|
|
88
89
|
const previouslyTracked = readTrackingFile();
|
|
89
|
-
if (previouslyTracked) {
|
|
90
|
+
if (previouslyTracked && process.env.CAPTURE_ONLY !== 'true') {
|
|
90
91
|
awsLog('CodeYam: Cleaning up files from previous session', {
|
|
91
92
|
generatedCount: previouslyTracked.generatedFiles.length,
|
|
92
93
|
backupCount: previouslyTracked.backupFiles.length,
|
|
@@ -97,6 +98,13 @@ export async function startScenarioCapture({
|
|
|
97
98
|
restoreFromBackup(backupPath);
|
|
98
99
|
}
|
|
99
100
|
clearTrackingFile();
|
|
101
|
+
} else if (previouslyTracked && process.env.CAPTURE_ONLY === 'true') {
|
|
102
|
+
awsLog(
|
|
103
|
+
'CodeYam: CAPTURE_ONLY mode - preserving files from previous session',
|
|
104
|
+
{
|
|
105
|
+
generatedCount: previouslyTracked.generatedFiles.length,
|
|
106
|
+
},
|
|
107
|
+
);
|
|
100
108
|
}
|
|
101
109
|
|
|
102
110
|
const sortedReadyToBeCaptured = readyToBeCaptured.sort((a, b) => {
|
|
@@ -352,7 +360,12 @@ export async function startScenarioCapture({
|
|
|
352
360
|
const mocksDir = `${appPath}/${CODEYAM_MOCKS_DIRNAME}/`;
|
|
353
361
|
|
|
354
362
|
for (const scenario of sortedScenarios) {
|
|
355
|
-
|
|
363
|
+
// Check both id and name since scenarioIds may contain either (recapture uses names)
|
|
364
|
+
if (
|
|
365
|
+
scenarioIds &&
|
|
366
|
+
!scenarioIds.includes(scenario.id) &&
|
|
367
|
+
!scenarioIds.includes(scenario.name)
|
|
368
|
+
) {
|
|
356
369
|
awsLog('CodeYam: Skipping scenario', {
|
|
357
370
|
thisScenarioId: scenario.id,
|
|
358
371
|
thisScenarioName: scenario.name,
|
|
@@ -379,6 +392,7 @@ export async function startScenarioCapture({
|
|
|
379
392
|
if (
|
|
380
393
|
!process.env['CODEYAM_LOCAL_PROJECT_PATH'] &&
|
|
381
394
|
!scenarioIds?.includes(scenario.id) &&
|
|
395
|
+
!scenarioIds?.includes(scenario.name) &&
|
|
382
396
|
!analysisIds?.includes(analysis.id) &&
|
|
383
397
|
(scenarioStatus?.finishedAt ||
|
|
384
398
|
scenarioStatus?.error ||
|
|
@@ -389,40 +403,50 @@ export async function startScenarioCapture({
|
|
|
389
403
|
|
|
390
404
|
awsLogDebugLevel(1, `Preparing ${analysis.entityName}: ${scenario.name}`);
|
|
391
405
|
|
|
392
|
-
//
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
fileStore,
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
// For non-routes: write root.tsx now (all scenarios can share it)
|
|
403
|
-
// For routes: defer writeSimpleRoot to per-scenario execution (each needs different mocks)
|
|
404
|
-
// EXCEPTION: In PREP_ONLY mode (debug), routes also need root.tsx written here since we exit early
|
|
405
|
-
if (!isRoute || process.env.PREP_ONLY === 'true') {
|
|
406
|
-
const simpleRootResult = await writeSimpleRoot(
|
|
407
|
-
project,
|
|
408
|
-
framework,
|
|
406
|
+
// In CAPTURE_ONLY mode, skip file generation and use existing files
|
|
407
|
+
// This preserves manual fixes made during debugging
|
|
408
|
+
let scenarioGeneratedFiles: string[] = [];
|
|
409
|
+
if (process.env.CAPTURE_ONLY !== 'true') {
|
|
410
|
+
// Write scenario files upfront
|
|
411
|
+
scenarioGeneratedFiles = await writeScenario({
|
|
412
|
+
analysis,
|
|
409
413
|
scenario,
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
)
|
|
419
|
-
if (
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
414
|
+
context,
|
|
415
|
+
projectAnalyzer,
|
|
416
|
+
framework,
|
|
417
|
+
fileStore,
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
// For non-routes: write root.tsx now (all scenarios can share it)
|
|
421
|
+
// For routes: defer writeSimpleRoot to per-scenario execution (each needs different mocks)
|
|
422
|
+
// EXCEPTION: In PREP_ONLY mode (debug), routes also need root.tsx written here since we exit early
|
|
423
|
+
if (!isRoute || process.env.PREP_ONLY === 'true') {
|
|
424
|
+
const simpleRootResult = await writeSimpleRoot(
|
|
425
|
+
project,
|
|
426
|
+
framework,
|
|
427
|
+
scenario,
|
|
428
|
+
analysis.filePath,
|
|
429
|
+
{
|
|
430
|
+
file: analysis.file,
|
|
431
|
+
entity: analysis.entity,
|
|
432
|
+
routeAnalysis: analysis,
|
|
433
|
+
mocksDir,
|
|
434
|
+
scenarioComponentPaths: scenarioGeneratedFiles,
|
|
435
|
+
},
|
|
436
|
+
);
|
|
437
|
+
if (simpleRootResult.filePath) {
|
|
438
|
+
if (simpleRootResult.backupPath) {
|
|
439
|
+
backupFiles.push(simpleRootResult.backupPath);
|
|
440
|
+
} else {
|
|
441
|
+
scenarioGeneratedFiles.push(simpleRootResult.filePath);
|
|
442
|
+
}
|
|
424
443
|
}
|
|
425
444
|
}
|
|
445
|
+
} else {
|
|
446
|
+
awsLogDebugLevel(
|
|
447
|
+
1,
|
|
448
|
+
`CAPTURE_ONLY mode: skipping file generation for ${scenario.name}`,
|
|
449
|
+
);
|
|
426
450
|
}
|
|
427
451
|
|
|
428
452
|
// Mark scenario as initializing
|
|
@@ -678,14 +702,22 @@ export async function startScenarioCapture({
|
|
|
678
702
|
allGeneratedFiles,
|
|
679
703
|
);
|
|
680
704
|
|
|
681
|
-
// Clean up all generated files
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
705
|
+
// Clean up all generated files (skip in CAPTURE_ONLY mode to preserve edits)
|
|
706
|
+
if (process.env.CAPTURE_ONLY !== 'true') {
|
|
707
|
+
console.log(
|
|
708
|
+
'CodeYam: Removing all scenario files for analysis',
|
|
709
|
+
analysis.id,
|
|
710
|
+
analysis.entityName,
|
|
711
|
+
);
|
|
712
|
+
cleanupFiles(allGeneratedFiles, backupFiles);
|
|
713
|
+
backupFiles = [];
|
|
714
|
+
} else {
|
|
715
|
+
console.log(
|
|
716
|
+
'CodeYam: CAPTURE_ONLY mode - preserving scenario files for analysis',
|
|
717
|
+
analysis.id,
|
|
718
|
+
analysis.entityName,
|
|
719
|
+
);
|
|
720
|
+
}
|
|
689
721
|
|
|
690
722
|
forceStop = result.forceStop;
|
|
691
723
|
}
|
|
@@ -9,6 +9,40 @@ import { safeFileName } from '~codeyam/utils';
|
|
|
9
9
|
import { cleanOutBoundary } from '~codeyam/ai';
|
|
10
10
|
import { reconcileMockDataKeys } from './reconcileMockDataKeys';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Normalize useParams mock data by fixing the React Router splat param (*).
|
|
14
|
+
* The LLM often generates random string values for `*` (the splat param),
|
|
15
|
+
* but this param represents the URL path suffix after the matched route
|
|
16
|
+
* and should typically be empty string for default scenarios.
|
|
17
|
+
*
|
|
18
|
+
* Example: For route `/entity/:sha/*`, the `*` param contains everything
|
|
19
|
+
* after `/entity/:sha/`. An empty string means the default tab/view.
|
|
20
|
+
*/
|
|
21
|
+
function normalizeParamsMockData(
|
|
22
|
+
mockData: Record<string, unknown>,
|
|
23
|
+
): Record<string, unknown> {
|
|
24
|
+
const result: Record<string, unknown> = {};
|
|
25
|
+
|
|
26
|
+
for (const [key, value] of Object.entries(mockData)) {
|
|
27
|
+
// Check if this is a useParams mock data entry
|
|
28
|
+
if (key.includes('useParams') && value && typeof value === 'object') {
|
|
29
|
+
const paramsObj = value as Record<string, unknown>;
|
|
30
|
+
// If there's a `*` key (splat param), default it to empty string
|
|
31
|
+
// The splat param represents URL path suffix and is typically empty for default views
|
|
32
|
+
if ('*' in paramsObj) {
|
|
33
|
+
result[key] = {
|
|
34
|
+
...paramsObj,
|
|
35
|
+
'*': '', // Default splat to empty string for default tab/view
|
|
36
|
+
};
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
result[key] = value;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
|
|
12
46
|
/**
|
|
13
47
|
* Return true when `markup` contains 0 or >1 meaningful
|
|
14
48
|
* top-level nodes (element *or* non-blank text), so React
|
|
@@ -47,12 +81,12 @@ const cleanOutTypes = (str: string) => {
|
|
|
47
81
|
};
|
|
48
82
|
|
|
49
83
|
const safeString = (s: string, level: number) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
84
|
+
// NOTE: We no longer strip arguments from top-level function keys (level 2)
|
|
85
|
+
// because normalizeMockData now handles merging duplicate keys while preserving
|
|
86
|
+
// original keys when there's only one call site. This ensures constructMockCode
|
|
87
|
+
// can look up data with the full key (e.g., "useCustomSizes(projectSlug)").
|
|
88
|
+
//
|
|
89
|
+
// Only escape quotes and newlines for safe string output.
|
|
56
90
|
return s?.replace ? s.replace(/"/g, "'").replace(/\n/g, '\\n') : s;
|
|
57
91
|
};
|
|
58
92
|
|
|
@@ -101,12 +135,14 @@ const shouldBeMap = (mockKey: string, mergedDataStructure: any): boolean => {
|
|
|
101
135
|
};
|
|
102
136
|
|
|
103
137
|
/**
|
|
104
|
-
* Normalize a function call key by stripping arguments
|
|
105
|
-
*
|
|
138
|
+
* Normalize a function call key by stripping arguments but PRESERVING type parameters.
|
|
139
|
+
* Type parameters like <typeof loader> are important for disambiguation.
|
|
140
|
+
* Variable qualifiers (::variableName suffix) are also preserved.
|
|
141
|
+
*
|
|
106
142
|
* e.g., "useLastLogLine(projectSlug, !!simulatingEntitySha)" -> "useLastLogLine()"
|
|
107
|
-
* e.g., "useLoaderData<typeof loader>()" -> "useLoaderData()"
|
|
143
|
+
* e.g., "useLoaderData<typeof loader>()" -> "useLoaderData<typeof loader>()" (PRESERVED)
|
|
108
144
|
* e.g., "useFetcher()::entityDiffFetcher" -> "useFetcher()::entityDiffFetcher" (preserved)
|
|
109
|
-
* e.g., "useFetcher<T>()::entityDiffFetcher" -> "useFetcher()::entityDiffFetcher"
|
|
145
|
+
* e.g., "useFetcher<T>()::entityDiffFetcher" -> "useFetcher<T>()::entityDiffFetcher" (PRESERVED)
|
|
110
146
|
*/
|
|
111
147
|
const normalizeKey = (key: string): string => {
|
|
112
148
|
// Check for variable qualifier (::variableName)
|
|
@@ -116,41 +152,36 @@ const normalizeKey = (key: string): string => {
|
|
|
116
152
|
|
|
117
153
|
// Check if key ends with ) - indicating a function call (after removing qualifier)
|
|
118
154
|
if (keyWithoutQualifier.endsWith(')') && keyWithoutQualifier.includes('(')) {
|
|
119
|
-
//
|
|
120
|
-
|
|
121
|
-
//
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
155
|
+
// Find the opening paren that matches the closing paren (accounting for nested parens and generics)
|
|
156
|
+
// We want to strip arguments but preserve type parameters
|
|
157
|
+
// e.g., "useLoaderData<typeof loader>(arg1, arg2)" -> "useLoaderData<typeof loader>()"
|
|
158
|
+
// e.g., "foo(a, b)" -> "foo()"
|
|
159
|
+
|
|
160
|
+
// Find where type parameters end (if any) by finding matching < >
|
|
161
|
+
let typeParamEnd = 0;
|
|
162
|
+
if (keyWithoutQualifier.includes('<')) {
|
|
163
|
+
let depth = 0;
|
|
164
|
+
for (let i = 0; i < keyWithoutQualifier.length; i++) {
|
|
165
|
+
if (keyWithoutQualifier[i] === '<') depth++;
|
|
166
|
+
if (keyWithoutQualifier[i] === '>') {
|
|
167
|
+
depth--;
|
|
168
|
+
if (depth === 0) {
|
|
169
|
+
typeParamEnd = i + 1;
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
126
175
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
source: Record<string, unknown>,
|
|
134
|
-
): Record<string, unknown> => {
|
|
135
|
-
const result = { ...target };
|
|
136
|
-
for (const key of Object.keys(source)) {
|
|
137
|
-
if (
|
|
138
|
-
source[key] &&
|
|
139
|
-
typeof source[key] === 'object' &&
|
|
140
|
-
!Array.isArray(source[key]) &&
|
|
141
|
-
target[key] &&
|
|
142
|
-
typeof target[key] === 'object' &&
|
|
143
|
-
!Array.isArray(target[key])
|
|
144
|
-
) {
|
|
145
|
-
result[key] = deepMergeObjects(
|
|
146
|
-
target[key] as Record<string, unknown>,
|
|
147
|
-
source[key] as Record<string, unknown>,
|
|
148
|
-
);
|
|
149
|
-
} else {
|
|
150
|
-
result[key] = source[key];
|
|
176
|
+
// Find the opening paren for function arguments (after type params)
|
|
177
|
+
const argsStart = keyWithoutQualifier.indexOf('(', typeParamEnd);
|
|
178
|
+
if (argsStart !== -1) {
|
|
179
|
+
// Preserve everything up to and including the opening paren, then close it
|
|
180
|
+
const normalized = keyWithoutQualifier.slice(0, argsStart) + '()';
|
|
181
|
+
return normalized + qualifier;
|
|
151
182
|
}
|
|
152
183
|
}
|
|
153
|
-
return
|
|
184
|
+
return key;
|
|
154
185
|
};
|
|
155
186
|
|
|
156
187
|
/**
|
|
@@ -240,7 +271,11 @@ const normalizeMockData = (
|
|
|
240
271
|
// Second pass: merge values for duplicate normalized keys
|
|
241
272
|
for (const [normKey, originalKeys] of keyMapping) {
|
|
242
273
|
if (originalKeys.length === 1) {
|
|
243
|
-
// No duplicates
|
|
274
|
+
// No duplicates - PRESERVE the original key with arguments
|
|
275
|
+
// This is critical because constructMockCode generates code that accesses
|
|
276
|
+
// data with the FULL key (e.g., scenarios().data()?.["useCustomSizes(projectSlug)"])
|
|
277
|
+
// If we normalize to "useCustomSizes()" but code looks for "useCustomSizes(projectSlug)",
|
|
278
|
+
// the lookup fails and returns undefined, causing runtime errors.
|
|
244
279
|
const value = mockData[originalKeys[0]];
|
|
245
280
|
// Skip bare type markers like "function" or "async-function"
|
|
246
281
|
if (isBareTypeMarker(value)) {
|
|
@@ -251,7 +286,7 @@ const normalizeMockData = (
|
|
|
251
286
|
if (isEmptyObject(value)) {
|
|
252
287
|
continue;
|
|
253
288
|
}
|
|
254
|
-
normalized[
|
|
289
|
+
normalized[originalKeys[0]] = value;
|
|
255
290
|
} else {
|
|
256
291
|
// Multiple keys normalize to the same value - merge them
|
|
257
292
|
let mergedValue: unknown = {};
|
|
@@ -269,7 +304,7 @@ const normalizeMockData = (
|
|
|
269
304
|
typeof mergedValue === 'object' &&
|
|
270
305
|
!Array.isArray(mergedValue)
|
|
271
306
|
) {
|
|
272
|
-
mergedValue =
|
|
307
|
+
mergedValue = deepMerge(
|
|
273
308
|
mergedValue as Record<string, unknown>,
|
|
274
309
|
value as Record<string, unknown>,
|
|
275
310
|
);
|
|
@@ -310,8 +345,11 @@ const jsonToCode = (
|
|
|
310
345
|
if (Array.isArray(json)) {
|
|
311
346
|
const arrayStrings: string[] = [];
|
|
312
347
|
for (const item of json) {
|
|
313
|
-
|
|
314
|
-
if (
|
|
348
|
+
// Skip undefined but preserve null (important for ref props)
|
|
349
|
+
if (item === undefined) continue;
|
|
350
|
+
if (item === null) {
|
|
351
|
+
arrayStrings.push('null');
|
|
352
|
+
} else if (typeof item === 'object') {
|
|
315
353
|
arrayStrings.push(jsonToCode(item, level + 1, mergedDataStructure));
|
|
316
354
|
} else {
|
|
317
355
|
arrayStrings.push(`"${safeString(item, level)}"`);
|
|
@@ -465,25 +503,39 @@ const jsonToCode = (
|
|
|
465
503
|
objKeys[0].endsWith(')')
|
|
466
504
|
) {
|
|
467
505
|
const signatureKey = objKeys[0];
|
|
468
|
-
// Extract arguments without parentheses for the
|
|
506
|
+
// Extract arguments without parentheses for the function name
|
|
469
507
|
const args = signatureKey.slice(1, -1);
|
|
470
|
-
const flattenedKey = `${key}(${args})`;
|
|
471
508
|
const unwrappedValue = (jsonObj[key] as Record<string, unknown>)[
|
|
472
509
|
signatureKey
|
|
473
510
|
];
|
|
474
|
-
|
|
511
|
+
|
|
512
|
+
// Handle null values - generate arrow function stubs for function signatures with null
|
|
513
|
+
if (unwrappedValue === null) {
|
|
514
|
+
const funcName = key;
|
|
515
|
+
const argsString = args
|
|
516
|
+
.split(',')
|
|
517
|
+
.map((arg, i) => `${arg.trim()}: any`)
|
|
518
|
+
.join(', ');
|
|
519
|
+
keyStrings.push(
|
|
520
|
+
`${levelSpacing}"${safeString(funcName, level)}": (${argsString}) => {}`,
|
|
521
|
+
);
|
|
522
|
+
} else if (typeof unwrappedValue === 'string') {
|
|
523
|
+
const flattenedKey = `${key}(${args})`;
|
|
475
524
|
keyStrings.push(
|
|
476
525
|
`${levelSpacing}"${safeString(flattenedKey, level)}": "${safeString(unwrappedValue, level)}"`,
|
|
477
526
|
);
|
|
478
527
|
} else if (typeof unwrappedValue === 'object') {
|
|
528
|
+
const flattenedKey = `${key}(${args})`;
|
|
479
529
|
keyStrings.push(
|
|
480
530
|
`${levelSpacing}"${safeString(flattenedKey, level)}": ${jsonToCode(unwrappedValue, level + 1, mergedDataStructure)}`,
|
|
481
531
|
);
|
|
482
532
|
} else if (typeof unwrappedValue === 'boolean') {
|
|
533
|
+
const flattenedKey = `${key}(${args})`;
|
|
483
534
|
keyStrings.push(
|
|
484
535
|
`${levelSpacing}"${safeString(flattenedKey, level)}": ${unwrappedValue}`,
|
|
485
536
|
);
|
|
486
537
|
} else {
|
|
538
|
+
const flattenedKey = `${key}(${args})`;
|
|
487
539
|
keyStrings.push(
|
|
488
540
|
`${levelSpacing}"${safeString(flattenedKey, level)}": ${safeString(String(unwrappedValue), level)}`,
|
|
489
541
|
);
|
|
@@ -564,10 +616,13 @@ const jsonToCode = (
|
|
|
564
616
|
seenNormalizedFuncNames.add(funcName);
|
|
565
617
|
|
|
566
618
|
// Check if the string value looks like a function expression
|
|
619
|
+
// Be careful not to match descriptive strings like "function listening" -
|
|
620
|
+
// a valid function expression must have parentheses like function(), function name(), or function (
|
|
567
621
|
const looksLikeFunction =
|
|
568
622
|
stringValue.includes('=>') ||
|
|
569
|
-
stringValue
|
|
570
|
-
stringValue
|
|
623
|
+
/^function\s*[\w]*\s*\(/.test(stringValue) ||
|
|
624
|
+
/^async\s+function\s*[\w]*\s*\(/.test(stringValue) ||
|
|
625
|
+
/^async\s*\(/.test(stringValue);
|
|
571
626
|
|
|
572
627
|
// Check if the string value looks like a Promise expression
|
|
573
628
|
// e.g., "Promise.resolve()", "new Promise(...)", etc.
|
|
@@ -714,10 +769,13 @@ import React from 'react';
|
|
|
714
769
|
if (mockScenario.name === DEFAULT_SCENARIO_NAME) {
|
|
715
770
|
// Normalize mock data to merge entries with same normalized function name
|
|
716
771
|
const normalizedMockData = normalizeMockData(defaultMockData);
|
|
772
|
+
// Fix useParams splat param (*) to default to empty string
|
|
773
|
+
const paramsNormalizedMockData =
|
|
774
|
+
normalizeParamsMockData(normalizedMockData);
|
|
717
775
|
dataCode = jsonToCode(
|
|
718
776
|
{
|
|
719
777
|
arguments: defaultArguments,
|
|
720
|
-
...
|
|
778
|
+
...paramsNormalizedMockData,
|
|
721
779
|
},
|
|
722
780
|
2,
|
|
723
781
|
mergedDataStructure,
|
|
@@ -746,10 +804,13 @@ import React from 'react';
|
|
|
746
804
|
const normalizedMockData = normalizeMockData(
|
|
747
805
|
mergedMockData as Record<string, unknown>,
|
|
748
806
|
);
|
|
807
|
+
// Fix useParams splat param (*) to default to empty string
|
|
808
|
+
const paramsNormalizedMockData =
|
|
809
|
+
normalizeParamsMockData(normalizedMockData);
|
|
749
810
|
|
|
750
811
|
const mergedData = {
|
|
751
812
|
arguments: mergedArguments,
|
|
752
|
-
...
|
|
813
|
+
...paramsNormalizedMockData,
|
|
753
814
|
};
|
|
754
815
|
// Use level=2 (same as default scenario) for consistent key formatting.
|
|
755
816
|
// This ensures nested function arguments are kept (e.g., "from('workouts')")
|