@codeyam/codeyam-cli 0.1.0-staging.b8a55ba → 0.1.0-staging.c90f8c9
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 +8 -8
- package/analyzer-template/common/execAsync.ts +1 -1
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +9 -6
- package/analyzer-template/packages/ai/index.ts +10 -3
- package/analyzer-template/packages/ai/package.json +1 -1
- package/analyzer-template/packages/ai/src/lib/__mocks__/completionCall.ts +122 -0
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +126 -6
- package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +116 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.ts +644 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +140 -6
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.ts +18 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.ts +15 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +181 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +849 -9
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +244 -0
- package/analyzer-template/packages/ai/src/lib/checkAllAttributes.ts +29 -10
- package/analyzer-template/packages/ai/src/lib/completionCall.ts +216 -36
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +892 -117
- 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 +296 -35
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +120 -76
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +80 -5
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.ts +98 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +8 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
- package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +156 -0
- package/analyzer-template/packages/ai/src/lib/deepEqual.ts +30 -0
- package/analyzer-template/packages/ai/src/lib/e2eDataTracking.ts +334 -0
- package/analyzer-template/packages/ai/src/lib/extractCriticalDataKeys.ts +120 -0
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +74 -7
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +86 -142
- package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +1 -0
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +1111 -87
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +191 -191
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +570 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +528 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +1977 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
- package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +5 -5
- package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +276 -3
- package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +33 -3
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +1 -1
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +32 -142
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChunkPrompt.ts +82 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateCriticalKeysPrompt.ts +103 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +90 -6
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +14 -89
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.ts +58 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +11 -11
- package/analyzer-template/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.ts +391 -0
- package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +812 -0
- package/analyzer-template/packages/ai/src/lib/splitOutsideParentheses.ts +5 -1
- package/analyzer-template/packages/ai/src/lib/validateExecutionFlowPaths.ts +531 -0
- package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +118 -0
- package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +14 -0
- package/analyzer-template/packages/analyze/src/lib/analysisContext.ts +44 -4
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/index.ts +1 -0
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/isAsyncFunction.ts +67 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +381 -265
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +18 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +3 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +33 -7
- package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +31 -15
- package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +11 -7
- package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +11 -12
- package/analyzer-template/packages/analyze/src/lib/files/enums/steps.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +148 -41
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.ts +102 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +506 -59
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.ts +28 -62
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +157 -74
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +156 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +35 -129
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +2 -3
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +420 -87
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +56 -11
- package/analyzer-template/packages/aws/codebuild/index.ts +1 -0
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts +11 -1
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js +29 -18
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts +2 -2
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js +2 -2
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts +8 -18
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js +17 -61
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js +8 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js.map +1 -1
- package/analyzer-template/packages/aws/package.json +3 -3
- package/analyzer-template/packages/aws/src/lib/codebuild/waitForBuild.ts +43 -19
- package/analyzer-template/packages/aws/src/lib/ecs/ecsDefineContainer.ts +3 -3
- package/analyzer-template/packages/aws/src/lib/ecs/ecsTaskFactory.ts +17 -69
- package/analyzer-template/packages/aws/src/lib/s3/uploadFileToS3.ts +8 -1
- package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +17 -1
- package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
- package/analyzer-template/packages/database/src/lib/loadCommits.ts +16 -0
- package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -3
- package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +7 -3
- package/analyzer-template/packages/generate/index.ts +3 -0
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.ts +17 -1
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +193 -0
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.ts +73 -0
- package/analyzer-template/packages/generate/src/lib/scenarioComponentForServer.ts +114 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +1 -18
- 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 +17 -1
- 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.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +2 -6
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts +2 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js +45 -2
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts +3 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +13 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts +3 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +23 -4
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +7 -4
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/index.d.ts +3 -0
- package/analyzer-template/packages/github/dist/generate/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/index.js +3 -0
- package/analyzer-template/packages/github/dist/generate/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts +9 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts +20 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts +8 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js +89 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js.map +1 -0
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js +10 -0
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js +3 -0
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.d.ts +3 -4
- package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.js +0 -1
- package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +71 -27
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +9 -54
- 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 +1 -21
- 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 +148 -0
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts +9 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js +29 -3
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js.map +1 -1
- package/analyzer-template/packages/github/src/lib/loadOrCreateCommit.ts +14 -0
- package/analyzer-template/packages/github/src/lib/syncPrimaryBranch.ts +2 -0
- package/analyzer-template/packages/process/index.ts +2 -0
- package/analyzer-template/packages/process/package.json +12 -0
- package/analyzer-template/packages/process/tsconfig.json +8 -0
- package/analyzer-template/packages/types/index.ts +3 -6
- package/analyzer-template/packages/types/src/types/Analysis.ts +87 -27
- package/analyzer-template/packages/types/src/types/Entity.ts +2 -0
- package/analyzer-template/packages/types/src/types/Scenario.ts +9 -77
- package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +175 -0
- package/analyzer-template/packages/types/src/types/StatementInfo.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/index.d.ts +3 -4
- package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/index.js +0 -1
- package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +71 -27
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +9 -54
- 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 +1 -21
- 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 +148 -0
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts +9 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js +29 -3
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js.map +1 -1
- package/analyzer-template/packages/utils/src/lib/safeFileName.ts +48 -3
- package/analyzer-template/playwright/capture.ts +37 -18
- package/analyzer-template/playwright/getCodeYamInfo.ts +12 -7
- package/analyzer-template/playwright/waitForServer.ts +21 -6
- package/analyzer-template/project/analyzeBaselineCommit.ts +4 -0
- package/analyzer-template/project/analyzeBranchCommit.ts +4 -0
- package/analyzer-template/project/analyzeFileEntities.ts +4 -0
- package/analyzer-template/project/analyzeRegularCommit.ts +4 -0
- package/analyzer-template/project/constructMockCode.ts +1112 -169
- package/analyzer-template/project/controller/startController.ts +16 -1
- package/analyzer-template/project/executeLibraryFunctionDirect.ts +7 -3
- package/analyzer-template/project/mocks/analyzeFileMock.ts +8 -7
- package/analyzer-template/project/orchestrateCapture/KyselyAnalysisLoader.ts +3 -6
- package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +7 -1
- package/analyzer-template/project/orchestrateCapture.ts +36 -3
- package/analyzer-template/project/reconcileMockDataKeys.ts +220 -78
- package/analyzer-template/project/runAnalysis.ts +11 -0
- package/analyzer-template/project/serverOnlyModules.ts +127 -2
- package/analyzer-template/project/start.ts +16 -4
- package/analyzer-template/project/startScenarioCapture.ts +6 -0
- package/analyzer-template/project/writeMockDataTsx.ts +164 -24
- package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
- package/analyzer-template/project/writeScenarioComponents.ts +304 -112
- package/analyzer-template/project/writeScenarioFiles.ts +26 -0
- package/analyzer-template/project/writeSimpleRoot.ts +11 -35
- package/analyzer-template/scripts/comboWorkerLoop.cjs +1 -0
- package/analyzer-template/scripts/defaultCmd.sh +9 -0
- package/analyzer-template/tsconfig.json +2 -1
- package/background/src/lib/local/createLocalAnalyzer.js +1 -29
- package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
- package/background/src/lib/local/execAsync.js +1 -1
- package/background/src/lib/local/execAsync.js.map +1 -1
- package/background/src/lib/virtualized/common/execAsync.js +1 -1
- package/background/src/lib/virtualized/common/execAsync.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +2 -1
- package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeBranchCommit.js +2 -1
- package/background/src/lib/virtualized/project/analyzeBranchCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeFileEntities.js +2 -1
- package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js +2 -1
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/constructMockCode.js +987 -130
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/controller/startController.js +11 -1
- package/background/src/lib/virtualized/project/controller/startController.js.map +1 -1
- package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js +6 -3
- package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js.map +1 -1
- package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js +7 -7
- package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js +3 -2
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +3 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js +27 -4
- package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +188 -47
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
- package/background/src/lib/virtualized/project/runAnalysis.js +9 -0
- package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
- package/background/src/lib/virtualized/project/serverOnlyModules.js +106 -3
- package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -1
- package/background/src/lib/virtualized/project/start.js +15 -4
- package/background/src/lib/virtualized/project/start.js.map +1 -1
- package/background/src/lib/virtualized/project/startScenarioCapture.js +7 -0
- package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +139 -23
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js +15 -0
- package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js.map +1 -0
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +228 -95
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioFiles.js +19 -0
- package/background/src/lib/virtualized/project/writeScenarioFiles.js.map +1 -1
- package/background/src/lib/virtualized/project/writeSimpleRoot.js +11 -34
- package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
- package/codeyam-cli/src/cli.js +5 -1
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/commands/analyze.js +1 -1
- package/codeyam-cli/src/commands/analyze.js.map +1 -1
- package/codeyam-cli/src/commands/baseline.js +174 -0
- package/codeyam-cli/src/commands/baseline.js.map +1 -0
- package/codeyam-cli/src/commands/debug.js +28 -18
- package/codeyam-cli/src/commands/debug.js.map +1 -1
- package/codeyam-cli/src/commands/default.js +0 -15
- package/codeyam-cli/src/commands/default.js.map +1 -1
- package/codeyam-cli/src/commands/recapture.js +29 -18
- package/codeyam-cli/src/commands/recapture.js.map +1 -1
- package/codeyam-cli/src/commands/report.js +46 -1
- package/codeyam-cli/src/commands/report.js.map +1 -1
- package/codeyam-cli/src/commands/start.js +8 -12
- package/codeyam-cli/src/commands/start.js.map +1 -1
- package/codeyam-cli/src/commands/status.js +23 -1
- package/codeyam-cli/src/commands/status.js.map +1 -1
- package/codeyam-cli/src/commands/test-startup.js +1 -1
- package/codeyam-cli/src/commands/test-startup.js.map +1 -1
- package/codeyam-cli/src/commands/wipe.js +108 -0
- package/codeyam-cli/src/commands/wipe.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js +81 -0
- package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +31 -27
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/analysisRunner.js +28 -14
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js +12 -2
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/database.js +91 -5
- package/codeyam-cli/src/utils/database.js.map +1 -1
- package/codeyam-cli/src/utils/generateReport.js +4 -3
- package/codeyam-cli/src/utils/generateReport.js.map +1 -1
- package/codeyam-cli/src/utils/git.js +79 -0
- package/codeyam-cli/src/utils/git.js.map +1 -0
- package/codeyam-cli/src/utils/install-skills.js +31 -17
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +105 -0
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/queue/manager.js +6 -0
- 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/utils/serverState.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +7 -5
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/utils/versionInfo.js +25 -19
- package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
- package/codeyam-cli/src/utils/wipe.js +128 -0
- package/codeyam-cli/src/utils/wipe.js.map +1 -0
- package/codeyam-cli/src/webserver/app/lib/database.js +73 -20
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/bootstrap.js +40 -0
- package/codeyam-cli/src/webserver/bootstrap.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-BXhEawa3.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-CzGX-miz.js → EntityTypeBadge-DLqD3qNt.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-Ba2JVPzP.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-C8lyxW9k.js +34 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-aht4aafF.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CBQPrpT0.js → LibraryFunctionPreview-CVtiBnY5.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-D1CdlbrV.js → LoadingDots-B0GLXMsr.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-wDPcZNKx.js → LogViewer-xgeCVgSM.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-D4TZhLuw.js +21 -0
- package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-BfmDgXxG.js → SafeScreenshot-DuDvi0jm.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-DEx02QDa.js +10 -0
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-6J7zDUD5.js → TruncatedFilePath-DyFZkK0l.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/_index-BwqWJOgH.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-DoLIqZX2.js +37 -0
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-BYimnrHg.js → chevron-down-Cx24_aWc.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-EPOLDU6W-CXRTFQ3F.js +51 -0
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-CaVsIRxt.js → circle-check-BOARzkeR.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-CgUsG7ib.js → createLucideIcon-BdhJEx6B.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-C1gnJVOL.svg → cy-logo-cli-CCKUIm0S.svg} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BRb-0kQl.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-zUEpfPsu.js → entity._sha._-C2N4Op8e.js} +12 -12
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-D1T4TGjf.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CfLCUi9S.js → entity._sha_.edit._scenarioId-CTBG2mmz.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DKJyZfAY.js → entry.client-CS2cb_eZ.js} +6 -6
- package/codeyam-cli/src/webserver/build/client/assets/executionFlowCoverage-BWhdfn70.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DAtOlaWE.js → fileTableUtils-DMJ7zii9.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-Cs4MdYtv.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{git-D62Lxxmv.js → git-B4RJRvYB.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/git-commit-horizontal-CysbcZxi.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-DMUaGAqV.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-CzNNiTkw.js → index-B1h680n5.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-BosqDOlH.js → index-lzqtyFU8.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-CNp9QFCX.js → loader-circle-B7B9V-bu.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-f874c610.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-Bz5TunQg.js +57 -0
- package/codeyam-cli/src/webserver/build/client/assets/rules-hEkvVw2-.js +97 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-DDGjYAMJ.js → search-CxXUmBSd.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-CS5f3WzT.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-DwFIBT09.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-CBc5dE1s.js → triangle-alert-B6LgvRJg.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-C1v1PQzo.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-BqPPNjAl.js → useLastLogLine-aSv48UbS.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DYxHZQuP.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-DWHcCcl1.js → useToast-mBRpZPiu.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-uNNbimct.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-B08qC4Y7.js +257 -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/server.js +35 -25
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/templates/codeyam-power-rules-hook.sh +200 -0
- package/codeyam-cli/templates/{codeyam-debug-skill.md → codeyam:debug.md} +48 -4
- package/codeyam-cli/templates/{debug-codeyam.md → codeyam:diagnose.md} +185 -23
- package/codeyam-cli/templates/codeyam:new-rule.md +13 -0
- package/codeyam-cli/templates/codeyam:power-rules.md +449 -0
- package/codeyam-cli/templates/{codeyam-setup-skill.md → codeyam:setup.md} +139 -4
- package/codeyam-cli/templates/{codeyam-sim-skill.md → codeyam:sim.md} +1 -1
- package/codeyam-cli/templates/{codeyam-test-skill.md → codeyam:test.md} +1 -1
- package/codeyam-cli/templates/{codeyam-verify-skill.md → codeyam:verify.md} +1 -1
- package/package.json +6 -5
- package/packages/ai/index.js +5 -4
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +97 -0
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js +150 -0
- package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js.map +1 -0
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +84 -1
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
- package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js +435 -0
- package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js.map +1 -0
- package/packages/ai/src/lib/astScopes/methodSemantics.js +97 -6
- package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js +8 -0
- package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js +7 -0
- package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +138 -1
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +654 -13
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/checkAllAttributes.js +24 -9
- package/packages/ai/src/lib/checkAllAttributes.js.map +1 -1
- package/packages/ai/src/lib/completionCall.js +178 -31
- package/packages/ai/src/lib/completionCall.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +715 -64
- 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 +230 -23
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +77 -55
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +67 -3
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js +86 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +6 -1
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js +107 -0
- package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructureChunking.js +111 -0
- package/packages/ai/src/lib/dataStructureChunking.js.map +1 -0
- package/packages/ai/src/lib/deepEqual.js +32 -0
- package/packages/ai/src/lib/deepEqual.js.map +1 -0
- package/packages/ai/src/lib/e2eDataTracking.js +241 -0
- package/packages/ai/src/lib/e2eDataTracking.js.map +1 -0
- package/packages/ai/src/lib/extractCriticalDataKeys.js +96 -0
- package/packages/ai/src/lib/extractCriticalDataKeys.js.map +1 -0
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js +62 -5
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarios.js +78 -120
- package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDataStructure.js +1 -0
- package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +906 -82
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +170 -162
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +392 -0
- package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js +380 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js.map +1 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +1440 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -2
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
- package/packages/ai/src/lib/isolateScopes.js +231 -4
- package/packages/ai/src/lib/isolateScopes.js.map +1 -1
- package/packages/ai/src/lib/mergeStatements.js +26 -3
- package/packages/ai/src/lib/mergeStatements.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +21 -100
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js +54 -0
- package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +68 -6
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +10 -70
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js +45 -0
- package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js +9 -9
- package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js +335 -0
- package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js.map +1 -0
- package/packages/ai/src/lib/resolvePathToControllable.js +667 -0
- package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -0
- package/packages/ai/src/lib/splitOutsideParentheses.js +3 -1
- package/packages/ai/src/lib/splitOutsideParentheses.js.map +1 -1
- package/packages/ai/src/lib/worker/SerializableDataStructure.js +29 -0
- package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/FileAnalyzer.js +15 -0
- package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/analysisContext.js +30 -5
- package/packages/analyze/src/lib/analysisContext.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/index.js +1 -0
- package/packages/analyze/src/lib/asts/nodes/index.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js +52 -0
- package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js.map +1 -0
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +151 -52
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +10 -0
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +2 -0
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +31 -7
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeChange.js +21 -11
- package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeEntity.js +9 -8
- package/packages/analyze/src/lib/files/analyzeEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeInitial.js +9 -10
- package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
- package/packages/analyze/src/lib/files/enums/steps.js +1 -1
- package/packages/analyze/src/lib/files/enums/steps.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +121 -37
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js +85 -0
- package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +410 -55
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js +29 -34
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +126 -57
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +96 -0
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +27 -98
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +2 -3
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +342 -83
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js +46 -9
- package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js.map +1 -1
- package/packages/aws/src/lib/ecs/ecsDefineContainer.js +2 -2
- package/packages/aws/src/lib/ecs/ecsDefineContainer.js.map +1 -1
- package/packages/aws/src/lib/ecs/ecsTaskFactory.js +17 -61
- package/packages/aws/src/lib/ecs/ecsTaskFactory.js.map +1 -1
- package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
- package/packages/database/src/lib/loadAnalyses.js +45 -2
- package/packages/database/src/lib/loadAnalyses.js.map +1 -1
- package/packages/database/src/lib/loadCommits.js +13 -1
- package/packages/database/src/lib/loadCommits.js.map +1 -1
- package/packages/database/src/lib/loadEntities.js +23 -4
- package/packages/database/src/lib/loadEntities.js.map +1 -1
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +7 -4
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
- package/packages/generate/index.js +3 -0
- package/packages/generate/index.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
- package/packages/generate/src/lib/scenarioComponentForServer.js +89 -0
- package/packages/generate/src/lib/scenarioComponentForServer.js.map +1 -0
- package/packages/github/src/lib/loadOrCreateCommit.js +10 -0
- package/packages/github/src/lib/loadOrCreateCommit.js.map +1 -1
- package/packages/github/src/lib/syncPrimaryBranch.js +3 -0
- package/packages/github/src/lib/syncPrimaryBranch.js.map +1 -1
- package/packages/process/index.js +3 -0
- package/packages/process/index.js.map +1 -0
- package/packages/process/src/GlobalProcessManager.js.map +1 -0
- package/{background/src/lib/process → packages/process/src}/ProcessManager.js +1 -1
- package/packages/process/src/ProcessManager.js.map +1 -0
- package/packages/process/src/index.js.map +1 -0
- package/packages/process/src/managedExecAsync.js.map +1 -0
- package/packages/types/index.js +0 -1
- package/packages/types/index.js.map +1 -1
- package/packages/types/src/types/Scenario.js +1 -21
- package/packages/types/src/types/Scenario.js.map +1 -1
- package/packages/utils/src/lib/safeFileName.js +29 -3
- package/packages/utils/src/lib/safeFileName.js.map +1 -1
- package/scripts/finalize-analyzer.cjs +3 -3
- package/analyzer-template/packages/ai/src/lib/findMatchingAttribute.ts +0 -102
- package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +0 -409
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +0 -288
- package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +0 -495
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.ts +0 -67
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +0 -120
- package/analyzer-template/process/INTEGRATION_COMPLETE.md +0 -333
- package/analyzer-template/process/INTEGRATION_EXAMPLE.md +0 -525
- package/analyzer-template/process/README.md +0 -507
- package/background/src/lib/process/GlobalProcessManager.js.map +0 -1
- package/background/src/lib/process/ProcessManager.js.map +0 -1
- package/background/src/lib/process/index.js.map +0 -1
- package/background/src/lib/process/managedExecAsync.js.map +0 -1
- package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +0 -238
- package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +0 -1
- package/codeyam-cli/scripts/fixtures/formbricks/universal-mocks/apps/web/lib/instance/service.js +0 -7
- package/codeyam-cli/scripts/fixtures/formbricks/universal-mocks/apps/web/lib/instance/service.js.map +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-wXL1Z2Aq.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-CXFKsCOD.js +0 -41
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-D-9pXIaY.js +0 -25
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-4lcOlid-.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CUxUNEEC.js +0 -15
- package/codeyam-cli/src/webserver/build/client/assets/_index-DHImXdXq.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-2mG6mjVb.js +0 -32
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JMJ3UQ3L-BambyYE_.js +0 -51
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-CKnwPCDr.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DW_hdGUc.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DyB90fWk.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-D_3ero5o.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-ClR0d32A.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-C6vQASxy.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/keyAttributeCoverage-CTlFMihX.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-09d684be.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-BxJUvKau.js +0 -56
- package/codeyam-cli/src/webserver/build/client/assets/settings-DgTyB-Wg.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-CoNWGt0K.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BMIGFP-m.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useInteractiveMode-Dk_FQqWJ.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DsJbgMY9.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-CV6i1S1A.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BDlyhfrv.js +0 -175
- package/packages/ai/src/lib/findMatchingAttribute.js +0 -77
- package/packages/ai/src/lib/findMatchingAttribute.js.map +0 -1
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +0 -298
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +0 -226
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/generateEntityKeyAttributes.js +0 -408
- package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/isFrontend.js +0 -5
- package/packages/ai/src/lib/isFrontend.js.map +0 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js +0 -40
- package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js.map +0 -1
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +0 -77
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +0 -1
- /package/analyzer-template/{process → packages/process/src}/GlobalProcessManager.ts +0 -0
- /package/analyzer-template/{process → packages/process/src}/ProcessManager.ts +0 -0
- /package/analyzer-template/{process → packages/process/src}/index.ts +0 -0
- /package/analyzer-template/{process → packages/process/src}/managedExecAsync.ts +0 -0
- /package/codeyam-cli/src/webserver/build/client/assets/{api.link-scenario-value-l0sNRNKZ.js → api.health-l0sNRNKZ.js} +0 -0
- /package/codeyam-cli/src/webserver/build/client/assets/{api.update-key-attributes-l0sNRNKZ.js → api.restart-server-l0sNRNKZ.js} +0 -0
- /package/codeyam-cli/src/webserver/build/client/assets/{api.update-valid-values-l0sNRNKZ.js → api.rules-l0sNRNKZ.js} +0 -0
- /package/{background/src/lib/process → packages/process/src}/GlobalProcessManager.js +0 -0
- /package/{background/src/lib/process → packages/process/src}/index.js +0 -0
- /package/{background/src/lib/process → packages/process/src}/managedExecAsync.js +0 -0
|
@@ -97,11 +97,15 @@ function resetDebugTiming(): void {
|
|
|
97
97
|
*/
|
|
98
98
|
function findEndOfImports(content: string): number {
|
|
99
99
|
try {
|
|
100
|
+
// Use temp.tsx to enable JSX parsing - otherwise TypeScript may misparse
|
|
101
|
+
// JSX content containing the word "import" (e.g., "Entities that import this")
|
|
102
|
+
// as an import statement, causing mock code to be inserted in the wrong location.
|
|
100
103
|
const sourceFile = ts.createSourceFile(
|
|
101
|
-
'temp.
|
|
104
|
+
'temp.tsx',
|
|
102
105
|
content,
|
|
103
106
|
ts.ScriptTarget.Latest,
|
|
104
107
|
true,
|
|
108
|
+
ts.ScriptKind.TSX,
|
|
105
109
|
);
|
|
106
110
|
|
|
107
111
|
let lastImportEnd = 0;
|
|
@@ -710,11 +714,13 @@ function extractInternalImportPathsAst(fileContent: string): string[] {
|
|
|
710
714
|
const importPaths: string[] = [];
|
|
711
715
|
|
|
712
716
|
try {
|
|
717
|
+
// Use temp.tsx to enable JSX parsing for consistent handling of JSX files
|
|
713
718
|
const sourceFile = ts.createSourceFile(
|
|
714
|
-
'temp.
|
|
719
|
+
'temp.tsx',
|
|
715
720
|
fileContent,
|
|
716
721
|
ts.ScriptTarget.Latest,
|
|
717
722
|
true,
|
|
723
|
+
ts.ScriptKind.TSX,
|
|
718
724
|
);
|
|
719
725
|
|
|
720
726
|
for (const statement of sourceFile.statements) {
|
|
@@ -864,11 +870,42 @@ function addMockToContent(
|
|
|
864
870
|
|
|
865
871
|
// Check if we have multiple calls with different variable names
|
|
866
872
|
// This requires generating separate mock functions for each call site
|
|
873
|
+
//
|
|
874
|
+
// IMPORTANT: calls array may contain BOTH base hook calls (e.g., "useFetcher<Type>()")
|
|
875
|
+
// AND method chain usages (e.g., "useFetcher().functionCallReturnValue.submit(...)").
|
|
876
|
+
// We only want to count base hook calls for the length comparison with callVariableNames.
|
|
877
|
+
// A "base call" is one that ends with "()" possibly preceded by a type annotation,
|
|
878
|
+
// without any subsequent method chains like ".functionCallReturnValue" or ".submit(...)".
|
|
879
|
+
const baseHookCalls = importedExport.calls?.filter((call) => {
|
|
880
|
+
// Base hook calls match patterns like:
|
|
881
|
+
// - "useFetcher()"
|
|
882
|
+
// - "useFetcher<Type>()"
|
|
883
|
+
// - "useFetcher<{ complex: Type }>()"
|
|
884
|
+
// They end with "()" and don't have method chains after the call.
|
|
885
|
+
// Method chains contain ".functionCallReturnValue" or have property access after "()".
|
|
886
|
+
return (
|
|
887
|
+
call.endsWith('()') &&
|
|
888
|
+
!call.includes('.functionCallReturnValue') &&
|
|
889
|
+
// Also exclude method chains like "hook().something" or "hook().method()"
|
|
890
|
+
!call.match(/\(\)\.[a-zA-Z]/)
|
|
891
|
+
);
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
// Determine if we can generate unique mock functions for multiple variables.
|
|
895
|
+
// We need:
|
|
896
|
+
// 1. Multiple variable names (callVariableNames.length > 1)
|
|
897
|
+
// 2. Base hook calls to match them (baseHookCalls.length > 0)
|
|
898
|
+
// Note: We use min(baseHookCalls.length, callVariableNames.length) for iteration
|
|
899
|
+
// to handle cases where data might be slightly out of sync (stale entries).
|
|
867
900
|
const hasMultipleCallsWithVariables =
|
|
868
|
-
|
|
869
|
-
|
|
901
|
+
baseHookCalls &&
|
|
902
|
+
baseHookCalls.length > 1 &&
|
|
870
903
|
importedExport.callVariableNames &&
|
|
871
|
-
importedExport.callVariableNames.length
|
|
904
|
+
importedExport.callVariableNames.length > 1 &&
|
|
905
|
+
// Only proceed if we have at least as many base calls as variable names,
|
|
906
|
+
// OR they're close enough (within 1) to handle minor sync issues
|
|
907
|
+
Math.abs(baseHookCalls.length - importedExport.callVariableNames.length) <=
|
|
908
|
+
1;
|
|
872
909
|
|
|
873
910
|
let mockCode: string | undefined;
|
|
874
911
|
const variableMockCodes: string[] = [];
|
|
@@ -877,27 +914,28 @@ function addMockToContent(
|
|
|
877
914
|
// Generate separate mock functions for each variable-qualified call
|
|
878
915
|
// Look up canonical keys from dataForMocks and track variable names for function naming
|
|
879
916
|
|
|
880
|
-
// Get all
|
|
917
|
+
// Get all call signature keys for this hook from dataForMocks
|
|
881
918
|
const dataForMocks =
|
|
882
919
|
rootAnalysis.metadata?.scenariosDataStructure?.dataForMocks;
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
// Sort by the index part (last ::N)
|
|
891
|
-
const indexA = parseInt(a.split('::').pop() || '0');
|
|
892
|
-
const indexB = parseInt(b.split('::').pop() || '0');
|
|
893
|
-
return indexA - indexB;
|
|
894
|
-
})
|
|
920
|
+
// Match keys that start with the hook name (e.g., "useFetcher" matches "useFetcher<User>()")
|
|
921
|
+
const callSignatureKeysForHook = dataForMocks
|
|
922
|
+
? Object.keys(dataForMocks).filter((key) => {
|
|
923
|
+
const hookBaseName = importedExport.name.split(/[<(]/)[0];
|
|
924
|
+
const keyBaseName = key.split(/[<(]/)[0];
|
|
925
|
+
return keyBaseName === hookBaseName;
|
|
926
|
+
})
|
|
895
927
|
: [];
|
|
896
928
|
|
|
897
929
|
// Track variable name occurrences for unique function naming
|
|
898
930
|
const variableNameCounts: Record<string, number> = {};
|
|
899
931
|
|
|
900
|
-
|
|
932
|
+
// Use the minimum of both array lengths to handle slight mismatches
|
|
933
|
+
// (e.g., stale data from previous analysis runs)
|
|
934
|
+
const iterationLimit = Math.min(
|
|
935
|
+
baseHookCalls!.length,
|
|
936
|
+
importedExport.callVariableNames!.length,
|
|
937
|
+
);
|
|
938
|
+
for (let i = 0; i < iterationLimit; i++) {
|
|
901
939
|
const variableName = importedExport.callVariableNames![i];
|
|
902
940
|
if (!variableName) continue;
|
|
903
941
|
|
|
@@ -916,21 +954,26 @@ function addMockToContent(
|
|
|
916
954
|
// e.g., useFetcher_entityDiffFetcher, useFetcher_reportFetcher
|
|
917
955
|
const mockFunctionName = `${importedExport.name}_${safeFunctionName}`;
|
|
918
956
|
|
|
919
|
-
// Use the
|
|
920
|
-
|
|
957
|
+
// Use the call signature from baseHookCalls[i] as the data key
|
|
958
|
+
// This matches what's stored in dataForMocks
|
|
959
|
+
const callSignature = baseHookCalls![i];
|
|
921
960
|
|
|
922
|
-
//
|
|
923
|
-
// e.g., "entityDiffFetcher <- useFetcher" for schema lookup
|
|
924
|
-
// This generates unique variable names like useFetcher_entityDiffFetcherReturnValue
|
|
925
|
-
const qualifiedMockName = `${indexedVariableName} <- ${importedExport.name}`;
|
|
926
|
-
|
|
927
|
-
// Generate mock code using the variable-qualified name and canonical key for data lookup
|
|
961
|
+
// Generate mock code using the call signature directly
|
|
928
962
|
// This prevents "symbol already declared" errors when multiple calls exist
|
|
963
|
+
// Check if this is a package import that won't have scenario copies
|
|
964
|
+
const isPackageImportForMock = importPath?.startsWith('@');
|
|
929
965
|
const variableMockCode = constructMockCode(
|
|
930
|
-
|
|
966
|
+
callSignature, // Use call signature format for data lookup
|
|
931
967
|
dependencySchemas,
|
|
932
968
|
importedExport.entityType,
|
|
933
|
-
|
|
969
|
+
undefined, // No need for separate canonical key
|
|
970
|
+
{
|
|
971
|
+
uniqueFunctionSuffix: safeFunctionName, // Use variable name for unique function naming
|
|
972
|
+
// For node_modules or package imports, skip spreading from __cyOriginal
|
|
973
|
+
// since those packages/files don't export *__cyOriginal variants
|
|
974
|
+
skipOriginalSpread:
|
|
975
|
+
importedExport.isNodeModule || isPackageImportForMock,
|
|
976
|
+
},
|
|
934
977
|
);
|
|
935
978
|
|
|
936
979
|
if (variableMockCode) {
|
|
@@ -939,7 +982,6 @@ function addMockToContent(
|
|
|
939
982
|
// Replace the call site with the variable-specific mock function
|
|
940
983
|
// e.g., useFetcher<BranchEntityDiffResult>() -> useFetcher_entityDiffFetcher()
|
|
941
984
|
// e.g., useFetcher() -> useFetcher_reportFetcher()
|
|
942
|
-
const callSignature = importedExport.calls![i];
|
|
943
985
|
// Escape special regex characters in the call signature
|
|
944
986
|
const escapedCallSignature = callSignature.replace(
|
|
945
987
|
/[.*+?^${}()|[\]\\]/g,
|
|
@@ -965,116 +1007,133 @@ function addMockToContent(
|
|
|
965
1007
|
: undefined;
|
|
966
1008
|
|
|
967
1009
|
if (singleCallVariableName) {
|
|
968
|
-
// For single variable assignments,
|
|
1010
|
+
// For single variable assignments, use the call signature directly from dataForMocks
|
|
969
1011
|
const dataForMocks =
|
|
970
1012
|
rootAnalysis.metadata?.scenariosDataStructure?.dataForMocks;
|
|
971
|
-
|
|
1013
|
+
|
|
1014
|
+
// Find matching call signature key in dataForMocks
|
|
1015
|
+
const hookBaseName = importedExport.name.split(/[<(]/)[0];
|
|
1016
|
+
const callSignatureKey = dataForMocks
|
|
972
1017
|
? Object.keys(dataForMocks).find((key) => {
|
|
973
|
-
//
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
}
|
|
978
|
-
// Fall back to legacy format
|
|
979
|
-
const legacyMatch = key.match(
|
|
980
|
-
/^([a-zA-Z_][a-zA-Z0-9_]*)\s*<-\s*(.+)$/,
|
|
981
|
-
);
|
|
982
|
-
return legacyMatch && legacyMatch[2] === importedExport.name;
|
|
1018
|
+
// Split on ., <, or ( to get the true base name
|
|
1019
|
+
// This handles both "useFlags()" -> "useFlags" and "trpc.useUtils()" -> "trpc"
|
|
1020
|
+
const keyBaseName = key.split(/[.<(]/)[0];
|
|
1021
|
+
return keyBaseName === hookBaseName;
|
|
983
1022
|
})
|
|
984
1023
|
: undefined;
|
|
985
1024
|
|
|
986
|
-
//
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
1025
|
+
// Use the call signature if found, otherwise construct it
|
|
1026
|
+
const dataKey =
|
|
1027
|
+
callSignatureKey ??
|
|
1028
|
+
importedExport.calls?.[0] ??
|
|
1029
|
+
`${importedExport.name}()`;
|
|
1030
|
+
|
|
1031
|
+
// IMPORTANT: If the dataKey is a method chain (e.g., "trpc.useUtils()"), we should
|
|
1032
|
+
// use the base name (e.g., "trpc") when calling constructMockCode. This ensures
|
|
1033
|
+
// constructMockCode generates a complete nested mock from the schema without
|
|
1034
|
+
// referencing __cyOriginal variables.
|
|
1035
|
+
const dataKeyBaseName = dataKey.split(/[.<(]/)[0];
|
|
1036
|
+
const isMethodChainDataKey =
|
|
1037
|
+
dataKeyBaseName === importedExport.name &&
|
|
1038
|
+
dataKey !== importedExport.name &&
|
|
1039
|
+
dataKey.includes('.');
|
|
1040
|
+
const mockNameToUse = isMethodChainDataKey
|
|
1041
|
+
? importedExport.name
|
|
1042
|
+
: dataKey;
|
|
991
1043
|
|
|
992
1044
|
// Keep the original function name since there's only one call
|
|
1045
|
+
// Check if this is a package import that won't have scenario copies
|
|
1046
|
+
const isPackageImportForSingleCall = importPath?.startsWith('@');
|
|
993
1047
|
mockCode = constructMockCode(
|
|
994
|
-
|
|
1048
|
+
mockNameToUse,
|
|
995
1049
|
dependencySchemas,
|
|
996
1050
|
importedExport.entityType,
|
|
997
|
-
|
|
998
|
-
{
|
|
1051
|
+
undefined,
|
|
1052
|
+
{
|
|
1053
|
+
keepOriginalFunctionName: true,
|
|
1054
|
+
// For node_modules or package imports, skip spreading from __cyOriginal
|
|
1055
|
+
// since those packages/files don't export *__cyOriginal variants
|
|
1056
|
+
skipOriginalSpread:
|
|
1057
|
+
importedExport.isNodeModule || isPackageImportForSingleCall,
|
|
1058
|
+
},
|
|
999
1059
|
);
|
|
1000
1060
|
// If constructMockCode didn't generate code, fall back to simple return
|
|
1061
|
+
// IMPORTANT: We inline scenarios().data() inside the function rather than
|
|
1062
|
+
// storing in a const - see comment in constructMockCode.ts for why.
|
|
1001
1063
|
if (!mockCode) {
|
|
1002
|
-
mockCode = `
|
|
1003
|
-
|
|
1004
|
-
function ${importedExport.name}() {
|
|
1005
|
-
return ${importedExport.name}ReturnValue;
|
|
1064
|
+
mockCode = `function ${importedExport.name}(...args) {
|
|
1065
|
+
return scenarios().data()?.["${dataKey}"];
|
|
1006
1066
|
}`;
|
|
1007
1067
|
}
|
|
1008
1068
|
} else {
|
|
1009
|
-
//
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
// Helper to find matching key from dataForMocks
|
|
1069
|
+
// Helper to find matching call signature key from dataForMocks
|
|
1070
|
+
const hookBaseName = importedExport.name.split(/[<(]/)[0];
|
|
1013
1071
|
const findMatchingKey = (
|
|
1014
1072
|
dataForMocks: Record<string, unknown> | undefined,
|
|
1015
1073
|
): string | undefined => {
|
|
1016
1074
|
if (!dataForMocks) return undefined;
|
|
1017
1075
|
return Object.keys(dataForMocks).find((key) => {
|
|
1018
|
-
//
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
}
|
|
1023
|
-
// Fall back to legacy variable-qualified format: variableName <- functionName
|
|
1024
|
-
const legacyMatch = key.match(
|
|
1025
|
-
/^([a-zA-Z_][a-zA-Z0-9_]*)\s*<-\s*(.+)$/,
|
|
1026
|
-
);
|
|
1027
|
-
return legacyMatch && legacyMatch[2] === importedExport.name;
|
|
1076
|
+
// Split on ., <, or ( to get the true base name
|
|
1077
|
+
// This handles both "useFlags()" -> "useFlags" and "trpc.useUtils()" -> "trpc"
|
|
1078
|
+
const keyBaseName = key.split(/[.<(]/)[0];
|
|
1079
|
+
return keyBaseName === hookBaseName;
|
|
1028
1080
|
});
|
|
1029
1081
|
};
|
|
1030
1082
|
|
|
1031
|
-
//
|
|
1032
|
-
// This ensures we use the same keys that will be in the mock DATA.
|
|
1083
|
+
// Check rootAnalysis FIRST for matching keys.
|
|
1033
1084
|
// The mock DATA is generated from rootAnalysis, so the mock CODE must
|
|
1034
1085
|
// also use rootAnalysis keys to ensure the lookup succeeds.
|
|
1035
|
-
|
|
1036
|
-
// - Child component's fileAnalysis has: "ChildComponent::hook::0"
|
|
1037
|
-
// - Root's dataForMocks has: "RootEntity::hook::0"
|
|
1038
|
-
// - Mock CODE uses child key, but mock DATA has root key → lookup fails
|
|
1039
|
-
canonicalKey = findMatchingKey(
|
|
1086
|
+
let dataKey = findMatchingKey(
|
|
1040
1087
|
rootAnalysis.metadata?.scenariosDataStructure?.dataForMocks,
|
|
1041
1088
|
);
|
|
1042
1089
|
|
|
1043
1090
|
// If not found in rootAnalysis, fall back to fileAnalyses
|
|
1044
|
-
if (!
|
|
1091
|
+
if (!dataKey) {
|
|
1045
1092
|
for (const analysis of fileAnalyses) {
|
|
1046
|
-
|
|
1093
|
+
dataKey = findMatchingKey(
|
|
1047
1094
|
analysis.metadata?.scenariosDataStructure?.dataForMocks,
|
|
1048
1095
|
);
|
|
1049
|
-
if (
|
|
1096
|
+
if (dataKey) break;
|
|
1050
1097
|
}
|
|
1051
1098
|
}
|
|
1052
1099
|
|
|
1053
|
-
if
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1100
|
+
// Use the data key if found, otherwise use call signature or function name.
|
|
1101
|
+
// IMPORTANT: If the dataKey is a method chain (e.g., "trpc.useUtils()"), we should
|
|
1102
|
+
// use the base name (e.g., "trpc") when calling constructMockCode. This ensures
|
|
1103
|
+
// constructMockCode generates a complete nested mock from the schema without
|
|
1104
|
+
// referencing __cyOriginal variables. The __cyOriginal pattern is only needed
|
|
1105
|
+
// for partial mocking where we preserve some original methods, not for complete
|
|
1106
|
+
// method-chain mocks where we provide all implementations.
|
|
1107
|
+
const dataKeyBaseName = dataKey?.split(/[.<(]/)[0];
|
|
1108
|
+
const isMethodChainDataKey =
|
|
1109
|
+
dataKey &&
|
|
1110
|
+
dataKeyBaseName === importedExport.name &&
|
|
1111
|
+
dataKey !== importedExport.name &&
|
|
1112
|
+
dataKey.includes('.');
|
|
1113
|
+
const mockNameToUse = isMethodChainDataKey
|
|
1114
|
+
? importedExport.name
|
|
1115
|
+
: (dataKey ?? importedExport.calls?.[0] ?? `${importedExport.name}()`);
|
|
1066
1116
|
|
|
1067
|
-
|
|
1068
|
-
|
|
1117
|
+
mockCode = constructMockCode(
|
|
1118
|
+
mockNameToUse,
|
|
1119
|
+
dependencySchemas,
|
|
1120
|
+
importedExport.entityType,
|
|
1121
|
+
undefined,
|
|
1122
|
+
{
|
|
1123
|
+
keepOriginalFunctionName: true,
|
|
1124
|
+
// For node_modules or package imports, skip spreading from __cyOriginal
|
|
1125
|
+
// since those packages/files don't export *__cyOriginal variants
|
|
1126
|
+
skipOriginalSpread:
|
|
1127
|
+
importedExport.isNodeModule || importPath?.startsWith('@'),
|
|
1128
|
+
},
|
|
1129
|
+
);
|
|
1130
|
+
// If constructMockCode didn't generate code, fall back to simple return
|
|
1131
|
+
// IMPORTANT: We inline scenarios().data() inside the function rather than
|
|
1132
|
+
// storing in a const - see comment in constructMockCode.ts for why.
|
|
1133
|
+
if (!mockCode && dataKey) {
|
|
1134
|
+
mockCode = `function ${importedExport.name}(...args) {
|
|
1135
|
+
return scenarios().data()?.["${dataKey}"];
|
|
1069
1136
|
}`;
|
|
1070
|
-
}
|
|
1071
|
-
} else {
|
|
1072
|
-
// Original behavior for calls without variable names
|
|
1073
|
-
mockCode = constructMockCode(
|
|
1074
|
-
importedExport.name,
|
|
1075
|
-
dependencySchemas,
|
|
1076
|
-
importedExport.entityType,
|
|
1077
|
-
);
|
|
1078
1137
|
}
|
|
1079
1138
|
}
|
|
1080
1139
|
}
|
|
@@ -1105,12 +1164,39 @@ function ${importedExport.name}() {
|
|
|
1105
1164
|
/[.*+?^${}()|[\]\\]/g,
|
|
1106
1165
|
'\\$&',
|
|
1107
1166
|
);
|
|
1167
|
+
// Use a simpler, more robust regex pattern that matches the fallback path.
|
|
1168
|
+
// Key improvements:
|
|
1169
|
+
// 1. Uses escapeRegExp(firstPart) to handle special characters in function names
|
|
1170
|
+
// 2. Uses word boundaries (\b) to prevent partial matches
|
|
1171
|
+
// 3. Handles comma BEFORE or AFTER the name: (?:,\s*|\s*,)?
|
|
1172
|
+
// 4. Matches specific import path (escapedImportPath)
|
|
1108
1173
|
const importRegExp = new RegExp(
|
|
1109
|
-
`(import
|
|
1174
|
+
`(import\\s*\\{[^}]*?)\\b${escapeRegExp(firstPart)}\\b(?:,\\s*|\\s*,)?((?:[^}]*\\}\\s*from\\s*['"]${escapedImportPath}['"];?))`,
|
|
1110
1175
|
'm',
|
|
1111
1176
|
);
|
|
1112
1177
|
|
|
1113
|
-
if (
|
|
1178
|
+
// Check if any call signature has multiple parts (e.g., "logger.error(error)")
|
|
1179
|
+
// If so, the mock code will spread from __cyOriginal, so we need to rename the import
|
|
1180
|
+
// EXCEPT:
|
|
1181
|
+
// 1. For node_module imports, the __cyOriginal pattern doesn't work because
|
|
1182
|
+
// the original package doesn't export *__cyOriginal variants.
|
|
1183
|
+
// 2. For package imports (starting with @), the __cyOriginal pattern doesn't work
|
|
1184
|
+
// because scenario copies aren't created for package files - they keep the
|
|
1185
|
+
// original import path which doesn't export *__cyOriginal.
|
|
1186
|
+
const anyCallHasMultipleParts = importedExport.calls?.some((call) => {
|
|
1187
|
+
const callParts = splitOutsideParenthesesAndArrays(call);
|
|
1188
|
+
return callParts.length > 1;
|
|
1189
|
+
});
|
|
1190
|
+
|
|
1191
|
+
// Package imports (starting with @) don't get scenario copies, so __cyOriginal won't exist
|
|
1192
|
+
const isPackageImport = importPath.startsWith('@');
|
|
1193
|
+
|
|
1194
|
+
const shouldRenameToOriginal =
|
|
1195
|
+
!importedExport.isNodeModule &&
|
|
1196
|
+
!isPackageImport &&
|
|
1197
|
+
(importedExportNameParts.length > 1 || anyCallHasMultipleParts);
|
|
1198
|
+
|
|
1199
|
+
if (shouldRenameToOriginal) {
|
|
1114
1200
|
fileContent = fileContent.replace(
|
|
1115
1201
|
importRegExp,
|
|
1116
1202
|
`$1${firstPart}__cyOriginal$2`,
|
|
@@ -1119,6 +1205,21 @@ function ${importedExport.name}() {
|
|
|
1119
1205
|
fileContent = fileContent.replace(importRegExp, '$1$2');
|
|
1120
1206
|
}
|
|
1121
1207
|
|
|
1208
|
+
// Also handle namespace imports (import * as foo from '...')
|
|
1209
|
+
// These need to be renamed to foo__cyOriginal when the mock code spreads from the original.
|
|
1210
|
+
// Note: We match any path (not just escapedImportPath) because the import path may have
|
|
1211
|
+
// been rewritten by transitive import handling before this code runs.
|
|
1212
|
+
if (shouldRenameToOriginal) {
|
|
1213
|
+
const namespaceImportRegExp = new RegExp(
|
|
1214
|
+
`(import\\s+\\*\\s+as\\s+)${escapeRegExp(firstPart)}(\\s+from\\s+['"][^'"]*['"])`,
|
|
1215
|
+
'm',
|
|
1216
|
+
);
|
|
1217
|
+
fileContent = fileContent.replace(
|
|
1218
|
+
namespaceImportRegExp,
|
|
1219
|
+
`$1${firstPart}__cyOriginal$2`,
|
|
1220
|
+
);
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1122
1223
|
// Remove empty imports entirely to avoid partial commenting issues with multiline imports
|
|
1123
1224
|
// This handles both single-line and multiline empty imports
|
|
1124
1225
|
fileContent = fileContent.replace(
|
|
@@ -1143,7 +1244,20 @@ function ${importedExport.name}() {
|
|
|
1143
1244
|
'm',
|
|
1144
1245
|
);
|
|
1145
1246
|
|
|
1146
|
-
if (
|
|
1247
|
+
// Check if any call signature has multiple parts (e.g., "logger.error(error)")
|
|
1248
|
+
// If so, the mock code will spread from __cyOriginal, so we need to rename the import
|
|
1249
|
+
// EXCEPT: For node_module imports, the __cyOriginal pattern doesn't work because
|
|
1250
|
+
// the original package doesn't export *__cyOriginal variants.
|
|
1251
|
+
const anyCallHasMultipleParts = importedExport.calls?.some((call) => {
|
|
1252
|
+
const callParts = splitOutsideParenthesesAndArrays(call);
|
|
1253
|
+
return callParts.length > 1;
|
|
1254
|
+
});
|
|
1255
|
+
|
|
1256
|
+
const shouldRenameToOriginal =
|
|
1257
|
+
!importedExport.isNodeModule &&
|
|
1258
|
+
(importedExportNameParts.length > 1 || anyCallHasMultipleParts);
|
|
1259
|
+
|
|
1260
|
+
if (shouldRenameToOriginal) {
|
|
1147
1261
|
// Rename the import instead of removing (for destructured access patterns)
|
|
1148
1262
|
fileContent = fileContent.replace(
|
|
1149
1263
|
namedImportRegExp,
|
|
@@ -1599,9 +1713,16 @@ export default async function writeScenarioComponents({
|
|
|
1599
1713
|
});
|
|
1600
1714
|
|
|
1601
1715
|
let importedExportIndex = 0;
|
|
1716
|
+
const loopStartTime = Date.now();
|
|
1717
|
+
console.log(
|
|
1718
|
+
`[WriteScenario] Starting import loop for ${entity.name}: ${sortedImportedExports.length} imports`,
|
|
1719
|
+
);
|
|
1602
1720
|
for (const importedExport of sortedImportedExports) {
|
|
1603
1721
|
importedExportIndex++;
|
|
1604
1722
|
if (importedExportIndex % 5 === 0 || importedExportIndex === 1) {
|
|
1723
|
+
console.log(
|
|
1724
|
+
`[WriteScenario] ${entity.name} import ${importedExportIndex}/${sortedImportedExports.length}: ${importedExport.name} elapsed=${Date.now() - loopStartTime}ms`,
|
|
1725
|
+
);
|
|
1605
1726
|
debugLog(
|
|
1606
1727
|
`Processing importedExport ${importedExportIndex}/${sortedImportedExports.length}`,
|
|
1607
1728
|
{
|
|
@@ -1789,6 +1910,10 @@ export default async function writeScenarioComponents({
|
|
|
1789
1910
|
importedExport.resolvedIsDefault === true &&
|
|
1790
1911
|
importedExport.isDefault === false;
|
|
1791
1912
|
|
|
1913
|
+
console.log(
|
|
1914
|
+
`[WriteScenario] RECURSE START: ${entity.name} -> ${importedExportEntity.name}`,
|
|
1915
|
+
);
|
|
1916
|
+
const recurseStartTime = Date.now();
|
|
1792
1917
|
debugLog(
|
|
1793
1918
|
`Recursing into writeScenarioComponents for ${importedExportEntity.name}`,
|
|
1794
1919
|
{
|
|
@@ -1820,7 +1945,10 @@ export default async function writeScenarioComponents({
|
|
|
1820
1945
|
? importedExport.name
|
|
1821
1946
|
: undefined,
|
|
1822
1947
|
}),
|
|
1823
|
-
|
|
1948
|
+
180000, // 3 minute timeout for recursive calls (complex components need more time)
|
|
1949
|
+
);
|
|
1950
|
+
console.log(
|
|
1951
|
+
`[WriteScenario] RECURSE END: ${entity.name} -> ${importedExportEntity.name} took ${Date.now() - recurseStartTime}ms`,
|
|
1824
1952
|
);
|
|
1825
1953
|
debugLog(
|
|
1826
1954
|
`Completed recursive writeScenarioComponents for ${importedExportEntity.name}`,
|
|
@@ -2162,6 +2290,10 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2162
2290
|
}
|
|
2163
2291
|
}
|
|
2164
2292
|
|
|
2293
|
+
// Track post-import-loop timing
|
|
2294
|
+
const postLoopStartTime = Date.now();
|
|
2295
|
+
console.log(`[WriteScenario] POST-LOOP START: ${entity.name}`);
|
|
2296
|
+
|
|
2165
2297
|
// Collect universal mocks BEFORE processing nodeModuleImports
|
|
2166
2298
|
// This is needed to check if a node module import is handled by a universal mock
|
|
2167
2299
|
const universalMocks = project.metadata?.universalMocks ?? [];
|
|
@@ -2221,6 +2353,10 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2221
2353
|
);
|
|
2222
2354
|
}
|
|
2223
2355
|
|
|
2356
|
+
console.log(
|
|
2357
|
+
`[WriteScenario] POST-LOOP ${entity.name}: node+universal mocks took ${Date.now() - postLoopStartTime}ms`,
|
|
2358
|
+
);
|
|
2359
|
+
|
|
2224
2360
|
if (
|
|
2225
2361
|
rootAnalysis.entitySha === entity.sha &&
|
|
2226
2362
|
entity.metadata?.notExported &&
|
|
@@ -2299,6 +2435,10 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2299
2435
|
);
|
|
2300
2436
|
debugLog('Completed rewriteRelativeModuleImports');
|
|
2301
2437
|
|
|
2438
|
+
console.log(
|
|
2439
|
+
`[WriteScenario] POST-LOOP ${entity.name}: transformations took ${Date.now() - postLoopStartTime}ms`,
|
|
2440
|
+
);
|
|
2441
|
+
|
|
2302
2442
|
/**
|
|
2303
2443
|
* Recursively process a file's imports to create transitive copies with server-only stripped.
|
|
2304
2444
|
* This handles chains of arbitrary depth: A -> B -> C -> D where each needs server-only removed.
|
|
@@ -2319,7 +2459,7 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2319
2459
|
startTime: number = Date.now(),
|
|
2320
2460
|
): Promise<string> {
|
|
2321
2461
|
// Global timeout for entire transitive processing
|
|
2322
|
-
const GLOBAL_TIMEOUT_MS =
|
|
2462
|
+
const GLOBAL_TIMEOUT_MS = 180000; // 3 minutes max for all transitive processing (complex components need more time)
|
|
2323
2463
|
const elapsed = Date.now() - startTime;
|
|
2324
2464
|
if (elapsed > GLOBAL_TIMEOUT_MS) {
|
|
2325
2465
|
throw new Error(
|
|
@@ -2328,6 +2468,10 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2328
2468
|
}
|
|
2329
2469
|
|
|
2330
2470
|
const importPaths = extractInternalImportPaths(content);
|
|
2471
|
+
// Always log to help debug timeout issues
|
|
2472
|
+
console.log(
|
|
2473
|
+
`[TransitiveImports] depth=${depth} file=${path.basename(sourceFilePath)} imports=${importPaths.length} visited=${visitedPaths.size} elapsed=${Date.now() - startTime}ms`,
|
|
2474
|
+
);
|
|
2331
2475
|
debugLog(`processTransitiveImportsRecursively depth=${depth}`, {
|
|
2332
2476
|
sourceFilePath,
|
|
2333
2477
|
importCount: importPaths.length,
|
|
@@ -2382,8 +2526,10 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2382
2526
|
);
|
|
2383
2527
|
const extension = importFile.name.split('.').pop();
|
|
2384
2528
|
const isIndex = isIndexPath(importFile.path);
|
|
2385
|
-
|
|
2386
|
-
const
|
|
2529
|
+
// Limit pathHash length to prevent ENAMETOOLONG errors on macOS (255 char limit)
|
|
2530
|
+
const pathHash = safeFileName(importFile.path, { maxLength: 80 });
|
|
2531
|
+
const scenarioSlug = safeFileName(scenario.name, { maxLength: 60 });
|
|
2532
|
+
const transitiveFilePath = `${PROJECT_RELATIVE_PATH}/${basePath}/${pathHash}_${isIndex ? 'index_' : ''}transitive_${scenarioSlug}.${extension}`;
|
|
2387
2533
|
|
|
2388
2534
|
// Check if this is a circular import (we're already processing this file)
|
|
2389
2535
|
const isCircularImport = visitedPaths.has(resolvedPath);
|
|
@@ -2507,6 +2653,10 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2507
2653
|
return modifiedContent;
|
|
2508
2654
|
}
|
|
2509
2655
|
|
|
2656
|
+
console.log(
|
|
2657
|
+
`[WriteScenario] POST-LOOP ${entity.name}: before remaining imports ${Date.now() - postLoopStartTime}ms`,
|
|
2658
|
+
);
|
|
2659
|
+
|
|
2510
2660
|
// Process remaining internal imports that weren't in importedExports
|
|
2511
2661
|
// This handles transitive dependencies: when the file content includes code (e.g., from
|
|
2512
2662
|
// other functions in the same file) that imports from files with "server-only"
|
|
@@ -2582,8 +2732,10 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2582
2732
|
);
|
|
2583
2733
|
const targetFileExtension = targetFile.name.split('.').pop();
|
|
2584
2734
|
const targetFileIsIndex = isIndexPath(targetFile.path);
|
|
2585
|
-
|
|
2586
|
-
const
|
|
2735
|
+
// Limit path hash length to prevent ENAMETOOLONG errors
|
|
2736
|
+
const filePathHash = safeFileName(targetFile.path, { maxLength: 80 });
|
|
2737
|
+
const targetScenarioSlug = safeFileName(scenario.name, { maxLength: 60 });
|
|
2738
|
+
const transformedFilePath = `${PROJECT_RELATIVE_PATH}/${targetFileBasePath}/${filePathHash}_${targetFileIsIndex ? 'index_' : ''}transitive_${targetScenarioSlug}.${targetFileExtension}`;
|
|
2587
2739
|
|
|
2588
2740
|
// Check if we've already processed this file as a transitive copy
|
|
2589
2741
|
// Note: __data_file_written__ is for entity-specific scenario files with different naming,
|
|
@@ -2638,8 +2790,12 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2638
2790
|
);
|
|
2639
2791
|
const nestedExtension = nestedFile.name.split('.').pop();
|
|
2640
2792
|
const nestedIsIndex = isIndexPath(nestedFile.path);
|
|
2641
|
-
|
|
2642
|
-
const
|
|
2793
|
+
// Limit path hash length to prevent ENAMETOOLONG errors
|
|
2794
|
+
const nestedPathHash = safeFileName(nestedFile.path, { maxLength: 80 });
|
|
2795
|
+
const nestedScenarioSlug = safeFileName(scenario.name, {
|
|
2796
|
+
maxLength: 60,
|
|
2797
|
+
});
|
|
2798
|
+
const nestedTransformedPath = `${PROJECT_RELATIVE_PATH}/${nestedBasePath}/${nestedPathHash}_${nestedIsIndex ? 'index_' : ''}transitive_${nestedScenarioSlug}.${nestedExtension}`;
|
|
2643
2799
|
|
|
2644
2800
|
// Check if already processed as a transitive file (we can rewrite to point to it)
|
|
2645
2801
|
// Note: __data_file_written__ is for entity-specific scenario files with different naming,
|
|
@@ -2760,6 +2916,10 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2760
2916
|
fileContent = fileContent.replace(importRegex, `$1${safeRelativePath}$2`);
|
|
2761
2917
|
}
|
|
2762
2918
|
|
|
2919
|
+
console.log(
|
|
2920
|
+
`[WriteScenario] POST-LOOP ${entity.name}: remaining imports loop took ${Date.now() - postLoopStartTime}ms`,
|
|
2921
|
+
);
|
|
2922
|
+
|
|
2763
2923
|
const scenarioComponentComment = `// This file is auto-generated by CodeYam. Do not edit this file manually.
|
|
2764
2924
|
// This file contains content for a scenario component:
|
|
2765
2925
|
// Analyses being written: ${JSON.stringify(fileAnalyses?.map((a) => ({ id: a.id, entityName: a.entityName })))}
|
|
@@ -2771,6 +2931,34 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2771
2931
|
// Scenario: ${scenario.id} - ${scenario.name}
|
|
2772
2932
|
`;
|
|
2773
2933
|
|
|
2934
|
+
// Final pass: Rename any namespace imports (import * as X from '...') that have
|
|
2935
|
+
// corresponding mock code using ...X__cyOriginal spread pattern.
|
|
2936
|
+
// This handles cases where:
|
|
2937
|
+
// 1. The import path was rewritten by transitive import handling
|
|
2938
|
+
// 2. The import wasn't caught by the earlier renaming logic
|
|
2939
|
+
// We scan for all __cyOriginal references in the mock code and ensure the imports are renamed.
|
|
2940
|
+
const cyOriginalReferences = fileContent.match(/\.\.\.(\w+)__cyOriginal/g);
|
|
2941
|
+
if (cyOriginalReferences) {
|
|
2942
|
+
const uniqueNames = [
|
|
2943
|
+
...new Set(
|
|
2944
|
+
cyOriginalReferences.map((ref) =>
|
|
2945
|
+
ref.replace('...', '').replace('__cyOriginal', ''),
|
|
2946
|
+
),
|
|
2947
|
+
),
|
|
2948
|
+
];
|
|
2949
|
+
for (const name of uniqueNames) {
|
|
2950
|
+
// Match namespace imports for this name that haven't been renamed yet
|
|
2951
|
+
const namespaceImportRegex = new RegExp(
|
|
2952
|
+
`(import\\s+\\*\\s+as\\s+)${escapeRegExp(name)}(\\s+from\\s+['"][^'"]*['"])`,
|
|
2953
|
+
'g',
|
|
2954
|
+
);
|
|
2955
|
+
fileContent = fileContent.replace(
|
|
2956
|
+
namespaceImportRegex,
|
|
2957
|
+
`$1${name}__cyOriginal$2`,
|
|
2958
|
+
);
|
|
2959
|
+
}
|
|
2960
|
+
}
|
|
2961
|
+
|
|
2774
2962
|
// Use the directive that was extracted at the beginning of processing
|
|
2775
2963
|
// This ensures it stays at the very top even after imports are prepended
|
|
2776
2964
|
// NOTE: We only preserve "use client" directives, NOT "use server" directives.
|
|
@@ -2792,5 +2980,9 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2792
2980
|
debugLog('Successfully wrote scenario file');
|
|
2793
2981
|
scenarioComponentPaths.push(scenarioComponentPath);
|
|
2794
2982
|
|
|
2983
|
+
console.log(
|
|
2984
|
+
`[WriteScenario] POST-LOOP ${entity.name}: COMPLETE total=${Date.now() - postLoopStartTime}ms`,
|
|
2985
|
+
);
|
|
2986
|
+
|
|
2795
2987
|
return { scenarioComponentPaths, writtenScenarioComponents };
|
|
2796
2988
|
}
|