@codeyam/codeyam-cli 0.1.0-staging.8aea589 → 0.1.0-staging.bbe4da9
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 +8 -7
- package/analyzer-template/packages/ai/index.ts +6 -2
- package/analyzer-template/packages/ai/package.json +2 -2
- package/analyzer-template/packages/ai/scripts/ai-test-matrix.mjs +424 -0
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +24 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +6 -16
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +197 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/paths.ts +28 -2
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +145 -4
- package/analyzer-template/packages/ai/src/lib/checkAllAttributes.ts +1 -3
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +1877 -542
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/FunctionCallManager.ts +138 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +1 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.ts +139 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/DebugTracer.ts +224 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/PathManager.ts +203 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/README.md +294 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.ts +161 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/VisitedTracker.ts +235 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +64 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +14 -6
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/selectBestValue.ts +70 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/uniqueIdUtils.ts +113 -0
- package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +36 -0
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityDocumentation.ts +20 -2
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +56 -160
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +79 -265
- package/analyzer-template/packages/ai/src/lib/generateEntityDocumentation.ts +16 -2
- package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +32 -8
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +53 -154
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +84 -254
- package/analyzer-template/packages/ai/src/lib/generateStatementAnalysis.ts +48 -71
- package/analyzer-template/packages/ai/src/lib/getConditionalUsagesFromCode.ts +27 -6
- package/analyzer-template/packages/ai/src/lib/getLLMCallStats.ts +0 -14
- package/analyzer-template/packages/ai/src/lib/modelInfo.ts +15 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +42 -4
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityDocumentationGenerator.ts +8 -33
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +54 -62
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +93 -109
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityDocumentationGenerator.ts +8 -27
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +33 -38
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +30 -30
- package/analyzer-template/packages/ai/src/lib/types/index.ts +2 -0
- package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +41 -0
- package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +47 -8
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/getNodeType.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/index.ts +2 -1
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExportedNodes.ts +4 -2
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExports.ts +5 -3
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +8 -10
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +6 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +8 -6
- package/analyzer-template/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.ts +5 -13
- package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +34 -15
- package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +17 -3
- package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +35 -16
- package/analyzer-template/packages/analyze/src/lib/files/analyzeRemixRoute.ts +21 -33
- package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +75 -10
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +26 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +7 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +9 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +6 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +9 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +15 -7
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +12 -2
- package/analyzer-template/packages/aws/dist/src/lib/s3/getPresignedUrl.d.ts +23 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/getPresignedUrl.d.ts.map +1 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/getPresignedUrl.js +30 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/getPresignedUrl.js.map +1 -0
- package/analyzer-template/packages/aws/package.json +5 -4
- package/analyzer-template/packages/aws/s3/index.ts +4 -0
- package/analyzer-template/packages/aws/src/lib/s3/getPresignedUrl.ts +62 -0
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.ts +28 -21
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.ts +18 -11
- package/analyzer-template/packages/generate/src/lib/scenarioComponent.ts +6 -3
- 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 +28 -21
- 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/componentScenarioPageRemix.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js +18 -11
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponent.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponent.js +5 -3
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponent.js.map +1 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/db.d.ts +2 -0
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/db.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/db.js +3 -0
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/db.js.map +1 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tableRelations.d.ts +2 -0
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tableRelations.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/debugReportsTable.d.ts +37 -0
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/debugReportsTable.js +27 -0
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/debugReportsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/supabase/src/lib/scenarioToDb.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/scenarioToDb.js +1 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/scenarioToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/index.d.ts +2 -0
- package/analyzer-template/packages/github/dist/utils/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/index.js +2 -0
- package/analyzer-template/packages/github/dist/utils/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/Semaphore.d.ts +25 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/Semaphore.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/Semaphore.js +40 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/Semaphore.js.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.js +39 -5
- package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.js +2 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getRemixRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getRemixRoutePath.js +2 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getRemixRoutePath.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js +2 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.js +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts +12 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js +32 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js.map +1 -0
- 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 +17 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
- package/analyzer-template/packages/supabase/src/lib/kysely/db.ts +6 -0
- package/analyzer-template/packages/supabase/src/lib/kysely/tableRelations.ts +3 -0
- package/analyzer-template/packages/supabase/src/lib/kysely/tables/debugReportsTable.ts +61 -0
- package/analyzer-template/packages/supabase/src/lib/scenarioToDb.ts +1 -0
- package/analyzer-template/packages/ui-components/src/scenario-editor/components/DataItemEditor.tsx +1 -1
- package/analyzer-template/packages/utils/dist/utils/index.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/utils/index.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/index.js +2 -0
- package/analyzer-template/packages/utils/dist/utils/index.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/Semaphore.d.ts +25 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/Semaphore.d.ts.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/Semaphore.js +40 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/Semaphore.js.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.js +39 -5
- package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.js +2 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getRemixRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getRemixRoutePath.js +2 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getRemixRoutePath.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js +2 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.js +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts +12 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js +32 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js.map +1 -0
- 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 +17 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
- package/analyzer-template/packages/utils/index.ts +2 -0
- package/analyzer-template/packages/utils/src/lib/Semaphore.ts +42 -0
- package/analyzer-template/packages/utils/src/lib/applyUniversalMocks.ts +46 -7
- package/analyzer-template/packages/utils/src/lib/frameworks/getNextRoutePath.ts +2 -1
- package/analyzer-template/packages/utils/src/lib/frameworks/getRemixRoutePath.ts +2 -1
- package/analyzer-template/packages/utils/src/lib/frameworks/nextRouteFileNameToRoute.ts +2 -1
- package/analyzer-template/packages/utils/src/lib/frameworks/remixRouteFileNameToRoute.ts +1 -0
- package/analyzer-template/packages/utils/src/lib/frameworks/sanitizeNextRouteSegments.ts +33 -0
- package/analyzer-template/packages/utils/src/lib/lightweightEntityExtractor.ts +16 -0
- package/analyzer-template/project/constructMockCode.ts +199 -9
- package/analyzer-template/project/reconcileMockDataKeys.ts +13 -0
- package/analyzer-template/project/runMultiScenarioServer.ts +0 -4
- package/analyzer-template/project/runScenarioServer.ts +0 -4
- package/analyzer-template/project/start.ts +1 -11
- package/analyzer-template/project/startScenarioCapture.ts +24 -0
- package/analyzer-template/project/startServer.ts +50 -70
- package/analyzer-template/project/trackGeneratedFiles.ts +41 -0
- package/analyzer-template/project/writeMockDataTsx.ts +191 -7
- package/analyzer-template/project/writeScenarioComponents.ts +643 -63
- package/analyzer-template/project/writeUniversalMocks.ts +66 -8
- package/analyzer-template/scripts/postbuild.cjs +12 -1
- package/background/src/lib/virtualized/project/constructMockCode.js +183 -11
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +12 -0
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
- package/background/src/lib/virtualized/project/runMultiScenarioServer.js +0 -3
- package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
- package/background/src/lib/virtualized/project/start.js +1 -8
- package/background/src/lib/virtualized/project/start.js.map +1 -1
- package/background/src/lib/virtualized/project/startScenarioCapture.js +18 -0
- package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/startServer.js +40 -68
- package/background/src/lib/virtualized/project/startServer.js.map +1 -1
- package/background/src/lib/virtualized/project/trackGeneratedFiles.js +30 -0
- package/background/src/lib/virtualized/project/trackGeneratedFiles.js.map +1 -0
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +156 -6
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +433 -41
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/background/src/lib/virtualized/project/writeUniversalMocks.js +56 -7
- package/background/src/lib/virtualized/project/writeUniversalMocks.js.map +1 -1
- package/codeyam-cli/src/cli.js +6 -0
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/codeyam-cli.js +0 -0
- package/codeyam-cli/src/commands/debug.js +222 -0
- package/codeyam-cli/src/commands/debug.js.map +1 -0
- package/codeyam-cli/src/commands/init.js +4 -23
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/commands/report.js +102 -0
- package/codeyam-cli/src/commands/report.js.map +1 -0
- package/codeyam-cli/src/commands/setup-sandbox.js +165 -0
- package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -0
- package/codeyam-cli/src/commands/test-startup.js +14 -5
- package/codeyam-cli/src/commands/test-startup.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/cleanupAnalysisFiles.test.js +6 -6
- package/codeyam-cli/src/utils/__tests__/cleanupAnalysisFiles.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +8 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/analysisRunner.js +2 -1
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/analyzer.js +24 -2
- package/codeyam-cli/src/utils/analyzer.js.map +1 -1
- package/codeyam-cli/src/utils/cleanupAnalysisFiles.js +2 -2
- package/codeyam-cli/src/utils/cleanupAnalysisFiles.js.map +1 -1
- package/codeyam-cli/src/utils/generateReport.js +219 -0
- package/codeyam-cli/src/utils/generateReport.js.map +1 -0
- package/codeyam-cli/src/utils/install-skills.js +7 -0
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/queue/__tests__/job.pidTracking.test.js +1 -0
- package/codeyam-cli/src/utils/queue/__tests__/job.pidTracking.test.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +10 -5
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/sandbox.js +190 -0
- package/codeyam-cli/src/utils/sandbox.js.map +1 -0
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +4 -0
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/utils/webappDetection.js +2 -1
- package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/database.js +50 -2
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-Dp_FTAs1.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-TlHocYno.js +26 -0
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-CVMmGuIc.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-BKKG1s2B.js → LogViewer-JkfQ-VaI.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-Cqce0_KG.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BrMAP1nP.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioPreview-Bi-__7HT.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-XmIpHcLJ.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/_index-BmfhU6CA.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-Dm8lM73z.js +10 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.generate-report-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/chart-column-kA4jn9if.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-CgXbbZRx.js +26 -0
- package/codeyam-cli/src/webserver/build/client/assets/circle-check-B2oHQ-zo.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/clock-BAfbP_iK.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/codeyam-name-logo-CvKwUgHo.svg +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-BBYuR56H.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BgPXZbm0.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-BHiWkb_W.js → entity._sha._-BkoAXaOa.js} +10 -10
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-Bj5GHkhb.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-eW5z9AyZ.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/entityStatus-C5Okl18j.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entityVersioning-Bk_YB1jM.js → entityVersioning-CU_Lchhc.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-B9tSboXM.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/file-text-18aYHZGd.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-Df79EyEb.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-CDEwTVH_.js +12 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-DXRB6jBc.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-XQCGvadH.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-_LjBsTxX.js +8 -0
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-D_EGChhq.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/manifest-3e0ffbcc.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-CGyT4J4b.js +16 -0
- package/codeyam-cli/src/webserver/build/client/assets/settings-CEPbAsom.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/settings-R8QF_mHX.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-B_PXvFom.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-BthANBVv.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-Lumm1t01.js → useLastLogLine-Blr5oZDE.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-CANr3QJ5.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/useToast-Bbf4Hokd.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/index-vf1FETCO.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-B5s58TvB.js +169 -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 +1 -1
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/templates/codeyam-setup-skill.md +70 -85
- package/codeyam-cli/templates/debug-command.md +125 -0
- package/package.json +9 -11
- package/packages/ai/index.js +2 -3
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +13 -0
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +6 -15
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
- package/packages/ai/src/lib/astScopes/methodSemantics.js +134 -0
- package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
- package/packages/ai/src/lib/astScopes/paths.js +28 -3
- package/packages/ai/src/lib/astScopes/paths.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +123 -3
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/checkAllAttributes.js +1 -3
- package/packages/ai/src/lib/checkAllAttributes.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +1358 -396
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/FunctionCallManager.js +137 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/FunctionCallManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js +112 -0
- package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/DebugTracer.js +176 -0
- package/packages/ai/src/lib/dataStructure/helpers/DebugTracer.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/PathManager.js +178 -0
- package/packages/ai/src/lib/dataStructure/helpers/PathManager.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +138 -0
- package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/VisitedTracker.js +199 -0
- package/packages/ai/src/lib/dataStructure/helpers/VisitedTracker.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +55 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +14 -6
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/selectBestValue.js +62 -0
- package/packages/ai/src/lib/dataStructure/helpers/selectBestValue.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/uniqueIdUtils.js +90 -0
- package/packages/ai/src/lib/dataStructure/helpers/uniqueIdUtils.js.map +1 -0
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +22 -0
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityDocumentation.js +19 -1
- package/packages/ai/src/lib/generateChangesEntityDocumentation.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js +55 -156
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarios.js +79 -262
- package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDocumentation.js +15 -1
- package/packages/ai/src/lib/generateEntityDocumentation.js.map +1 -1
- package/packages/ai/src/lib/generateEntityKeyAttributes.js +32 -8
- package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +52 -152
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +88 -258
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateStatementAnalysis.js +46 -71
- package/packages/ai/src/lib/generateStatementAnalysis.js.map +1 -1
- package/packages/ai/src/lib/getConditionalUsagesFromCode.js +13 -8
- package/packages/ai/src/lib/getConditionalUsagesFromCode.js.map +1 -1
- package/packages/ai/src/lib/getLLMCallStats.js +0 -14
- package/packages/ai/src/lib/getLLMCallStats.js.map +1 -1
- package/packages/ai/src/lib/modelInfo.js +15 -0
- package/packages/ai/src/lib/modelInfo.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +36 -3
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityDocumentationGenerator.js +8 -33
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityDocumentationGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +35 -41
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +59 -72
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityDocumentationGenerator.js +8 -27
- package/packages/ai/src/lib/promptGenerators/generateEntityDocumentationGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +24 -27
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +21 -22
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/types/index.js +2 -0
- package/packages/ai/src/lib/types/index.js.map +1 -1
- package/packages/ai/src/lib/worker/SerializableDataStructure.js +7 -0
- package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/FileAnalyzer.js +39 -7
- package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/getNodeType.js +1 -1
- package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/index.js +2 -1
- package/packages/analyze/src/lib/asts/nodes/index.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllExportedNodes.js +3 -2
- package/packages/analyze/src/lib/asts/sourceFiles/getAllExportedNodes.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js +4 -3
- package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +6 -8
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +5 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +8 -2
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js +5 -8
- package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeChange.js +21 -9
- package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeEntity.js +10 -4
- package/packages/analyze/src/lib/files/analyzeEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeInitial.js +21 -9
- package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeRemixRoute.js +18 -23
- package/packages/analyze/src/lib/files/analyzeRemixRoute.js.map +1 -1
- package/packages/analyze/src/lib/files/getImportedExports.js +56 -4
- package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +24 -0
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +6 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +9 -1
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +5 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +9 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +16 -7
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js +8 -2
- package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +28 -21
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js +18 -11
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js.map +1 -1
- package/packages/generate/src/lib/scenarioComponent.js +5 -3
- package/packages/generate/src/lib/scenarioComponent.js.map +1 -1
- package/packages/supabase/src/lib/kysely/db.js +3 -0
- package/packages/supabase/src/lib/kysely/db.js.map +1 -1
- package/packages/supabase/src/lib/kysely/tables/debugReportsTable.js +27 -0
- package/packages/supabase/src/lib/kysely/tables/debugReportsTable.js.map +1 -0
- package/packages/supabase/src/lib/scenarioToDb.js +1 -1
- package/packages/supabase/src/lib/scenarioToDb.js.map +1 -1
- package/packages/utils/index.js +2 -0
- package/packages/utils/index.js.map +1 -1
- package/packages/utils/src/lib/Semaphore.js +40 -0
- package/packages/utils/src/lib/Semaphore.js.map +1 -0
- package/packages/utils/src/lib/applyUniversalMocks.js +39 -5
- package/packages/utils/src/lib/applyUniversalMocks.js.map +1 -1
- package/packages/utils/src/lib/frameworks/getNextRoutePath.js +2 -1
- package/packages/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
- package/packages/utils/src/lib/frameworks/getRemixRoutePath.js +2 -1
- package/packages/utils/src/lib/frameworks/getRemixRoutePath.js.map +1 -1
- package/packages/utils/src/lib/frameworks/nextRouteFileNameToRoute.js +2 -1
- package/packages/utils/src/lib/frameworks/nextRouteFileNameToRoute.js.map +1 -1
- package/packages/utils/src/lib/frameworks/remixRouteFileNameToRoute.js +1 -0
- package/packages/utils/src/lib/frameworks/remixRouteFileNameToRoute.js.map +1 -1
- package/packages/utils/src/lib/frameworks/sanitizeNextRouteSegments.js +32 -0
- package/packages/utils/src/lib/frameworks/sanitizeNextRouteSegments.js.map +1 -0
- package/packages/utils/src/lib/lightweightEntityExtractor.js +17 -0
- package/packages/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
- package/analyzer-template/packages/ai/src/lib/generateEntityDataMap.ts +0 -375
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-rqv54FUY.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-B0oiPem-.js +0 -26
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DqXXjAJ7.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-DU_jxCPD.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioPreview-5DY-YIxu.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-DmjXUj6m.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/_index-DvSrcxsk.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CsaMd9mb.js +0 -10
- package/codeyam-cli/src/webserver/build/client/assets/chart-column-VXBS6qOn.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/circle-alert-n5GUC2AS.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/clock-DKqtX8js.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/components-Dj-Ggnl2.js +0 -40
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BbR3FwNc.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-L7M9Vr5z.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-C9w-q7P3.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-CdGoUs8A.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/file-text-B6Er7j5k.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-KcDVw1FY.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-B9uZ8eSJ.js +0 -12
- package/codeyam-cli/src/webserver/build/client/assets/globals-B0f88RTV.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-v3c6DFp4.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-fca08d7e.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-Cf8VBqIb.js +0 -16
- package/codeyam-cli/src/webserver/build/client/assets/search-DA14wXpu.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-COJUrwGu.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-NU_ZquhK.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-CNaMJ-nR.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useToast-BRShB17p.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/zap-BvukH0eN.js +0 -1
- package/codeyam-cli/src/webserver/build/client/cy-logo-cli.svg +0 -13
- package/codeyam-cli/src/webserver/build/client/favicon.svg +0 -13
- package/codeyam-cli/src/webserver/build/server/assets/index-DHr4rT4u.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-Bi1mj14J.js +0 -166
- package/codeyam-cli/src/webserver/public/cy-logo-cli.svg +0 -13
- package/codeyam-cli/src/webserver/public/favicon.svg +0 -13
- package/packages/ai/src/lib/generateEntityDataMap.js +0 -335
- package/packages/ai/src/lib/generateEntityDataMap.js.map +0 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityDataMapGenerator.js +0 -17
- package/packages/ai/src/lib/promptGenerators/generateEntityDataMapGenerator.js.map +0 -1
|
@@ -280,176 +280,75 @@ export default async function generateEntityScenarioData({
|
|
|
280
280
|
export const generateSystemMessage = (
|
|
281
281
|
scenarioName: string,
|
|
282
282
|
defaultScenario: boolean,
|
|
283
|
-
) =>
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
- The data generated will be merged into the Default Scenario Data in order to create the full data for this scenario.
|
|
314
|
-
`
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
## Example Response
|
|
318
|
-
|
|
319
|
-
{
|
|
320
|
-
"scenarioData": {
|
|
321
|
-
"scenarioName": ${scenarioName},
|
|
322
|
-
"data': {
|
|
323
|
-
"mockData": {
|
|
324
|
-
"useUser()": {
|
|
325
|
-
"user": {
|
|
326
|
-
"name": "John Doe",
|
|
327
|
-
"metadata": {
|
|
328
|
-
"hobbies": ["fishing", "hiking", "camping"]
|
|
329
|
-
"favoriteColor": "blue",
|
|
330
|
-
},
|
|
331
|
-
"joinedAt": {
|
|
332
|
-
"~~codeyam-code~~": "new Date(Date.now() - 3 * 24 * 60 * 60 * 1000)"
|
|
333
|
-
}
|
|
334
|
-
},
|
|
335
|
-
},
|
|
336
|
-
"loadProject()": {
|
|
337
|
-
"project": {
|
|
338
|
-
"name": "New Project",
|
|
339
|
-
"slug": "new-project",
|
|
340
|
-
"files": [
|
|
341
|
-
{
|
|
342
|
-
"name": "File 1",
|
|
343
|
-
"slug": "file-1",
|
|
344
|
-
"content": "This is the content of file 1"
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
"name": "File 2",
|
|
348
|
-
"slug": "file-2",
|
|
349
|
-
"content": "This is the content of file 2"
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
"name": "File 3",
|
|
353
|
-
"slug": "file-3",
|
|
354
|
-
"content": "This is the content of file 3"
|
|
355
|
-
}
|
|
356
|
-
]
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
},
|
|
360
|
-
"argumentsData": [
|
|
361
|
-
{
|
|
362
|
-
"open": "true",
|
|
363
|
-
"children: {
|
|
364
|
-
"~~codeyam-jsx~~": "<div>Hi!</div>"
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
]
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
## scenarioData
|
|
373
|
-
|
|
374
|
-
You will return a JSON object called scenarioData containing the name and data for this scenario.
|
|
375
|
-
|
|
376
|
-
If you encounter a "date" then you should use "~~codeyam-code~~" along with code in string format. That string will be evaled to create the date or timestamp needed.
|
|
377
|
-
|
|
378
|
-
For example the "timestamp" above should probably not be a hard-coded timestamp but should be a function that returns a timestamp. If you want to return a timestamp that is 24 hours in the future, you would return this object:
|
|
283
|
+
) => {
|
|
284
|
+
const scenarioType = defaultScenario
|
|
285
|
+
? `## Default Scenario
|
|
286
|
+
Generate COMPLETE, robust data for the entire data structure.
|
|
287
|
+
- Fill ALL fields with realistic values (except error attributes)
|
|
288
|
+
- Arrays should have 2-3 items
|
|
289
|
+
- Don't skip nested attributes
|
|
290
|
+
- This provides the baseline data for all other scenarios`
|
|
291
|
+
: `## Non-Default Scenario
|
|
292
|
+
Generate ONLY the differences from the default scenario.
|
|
293
|
+
- Include only fields that need to change
|
|
294
|
+
- Set to \`null\` to remove data
|
|
295
|
+
- Omit unchanged fields—they merge from default`;
|
|
296
|
+
|
|
297
|
+
return `You are a test data generator. Create mock data matching a data structure and scenario requirements.
|
|
298
|
+
|
|
299
|
+
${scenarioType}
|
|
300
|
+
|
|
301
|
+
## CRITICAL: NO ERROR DATA
|
|
302
|
+
NEVER include "error" fields in responses. Skip them entirely.
|
|
303
|
+
- If structure has \`{ data: {...}, error: {...} }\`, only fill \`data\`
|
|
304
|
+
- Leave out any attribute named "error"—do not set to null, omit entirely
|
|
305
|
+
|
|
306
|
+
## Special Markers
|
|
307
|
+
|
|
308
|
+
### Dynamic Dates (\`~~codeyam-code~~\`)
|
|
309
|
+
\`\`\`json
|
|
310
|
+
{ "createdAt": { "~~codeyam-code~~": "new Date(Date.now() - 24*60*60*1000)" } }
|
|
311
|
+
\`\`\`
|
|
312
|
+
Use for relative dates. Code runs in Node (no browser APIs, no external libraries).
|
|
379
313
|
|
|
314
|
+
### JSX Children (\`~~codeyam-jsx~~\`)
|
|
315
|
+
\`\`\`json
|
|
316
|
+
{ "children": { "~~codeyam-jsx~~": "<div>Hello</div>" } }
|
|
380
317
|
\`\`\`
|
|
318
|
+
Use simple elements only (\`<div>\`, \`<span>\`). No custom components.
|
|
319
|
+
|
|
320
|
+
## Function Keys
|
|
321
|
+
Preserve function call syntax exactly as written in the structure:
|
|
322
|
+
\`\`\`json
|
|
381
323
|
{
|
|
382
|
-
"
|
|
383
|
-
"
|
|
384
|
-
"
|
|
385
|
-
"mockData": {
|
|
386
|
-
"dataLoaders": {
|
|
387
|
-
"fetchUser()": {
|
|
388
|
-
"user": {
|
|
389
|
-
"name": "John Doe",
|
|
390
|
-
"metadata": {
|
|
391
|
-
"hobbies": ["fishing", "hiking", "camping"],
|
|
392
|
-
"favoriteColor": "blue"
|
|
393
|
-
},
|
|
394
|
-
"joinedAt": {
|
|
395
|
-
"~~codeyam-code~~": "new Date(Date.now() - 3 * 24 * 60 * 60 * 1000).toISOString()"
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
324
|
+
"mockData": {
|
|
325
|
+
"useUser()": { "user": { "name": "John" } },
|
|
326
|
+
"from().select()": [{ "id": "1" }]
|
|
402
327
|
}
|
|
403
328
|
}
|
|
404
329
|
\`\`\`
|
|
405
330
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
All code should be written in JavaScript. It will run in a node environment (not the browser) with no reference to external libraries. It will essentially be run in a sandboxed environment. Do not reference any external libraries in the code.
|
|
409
|
-
|
|
410
|
-
With argumentsData you may also need to return a "children" argument. "children" can either be a string or a jsx element.
|
|
411
|
-
|
|
412
|
-
If you want to return a jsx element you would return something like this:
|
|
413
|
-
|
|
414
|
-
\`\`\`
|
|
331
|
+
## Response Format
|
|
332
|
+
\`\`\`json
|
|
415
333
|
{
|
|
416
334
|
"scenarioData": {
|
|
417
|
-
"scenarioName": ${scenarioName},
|
|
335
|
+
"scenarioName": "${scenarioName}",
|
|
418
336
|
"data": {
|
|
419
|
-
"
|
|
420
|
-
|
|
421
|
-
"children": {
|
|
422
|
-
"~~codeyam-jsx~~": "<div>Click Me!</div>"
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
]
|
|
337
|
+
"mockData": { ... },
|
|
338
|
+
"argumentsData": [ ... ]
|
|
426
339
|
}
|
|
427
340
|
}
|
|
428
341
|
}
|
|
429
342
|
\`\`\`
|
|
430
343
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
If an object inside of mockData or argumentsData is intended to not exist you can set it to null.
|
|
438
|
-
|
|
439
|
-
Never use "~~codeyam-code~~" or "~~codeyam-jsx~~" as a partial key in the response. Even if the key looks like it should have a relative date or code. "~~codeyam-code~~" and "~~codeyam-jsx~~" are only used as independent keys used to mark values that are code.
|
|
440
|
-
|
|
441
|
-
## Common Mistakes
|
|
442
|
-
|
|
443
|
-
- Do not use the term undefined in the response. If something is missing leave it out or use null.
|
|
444
|
-
- Leave out error data (e.g. a data attribute labeled as "error"), especially when it is in a data structure that has success data as well. Only include the success data and simply leave out the error data. Error data is usually labeled as "error" in the structure. Leave it out entirely.
|
|
445
|
-
- Please double check this. Ensure no error data is included in the response unless specifically requested. ${defaultScenario ? `This includes the ${`DEFAULT_SCENARIO_NAME`}.` : ''} Leave out any error attributes from the response completely!
|
|
446
|
-
- Do not reference data in the response (e.g. if there was a "posts" field you can not say "posts[0]" elsewhere in the response - you need to duplicate the data). Unfortunately all data must be written out directly in the response.
|
|
447
|
-
- Ensure each scenario in the response matches the full scenario name, commas and all, in the scenarios provided.
|
|
448
|
-
- Do not throw errors from this data in any manner. Simple leave out any error data.
|
|
449
|
-
- If the data structure contains a type that is a "date" then use ~~codeyam-code~~ to generate a dynamic timestamp or date. Do not hard-code dates unless it needs to be a very specific date. Otherwise it should be a relative, dynamic date.
|
|
450
|
-
- The response must be valid JSON. Do not include raw code in the response.
|
|
451
|
-
${defaultScenario ? `- As the ${DEFAULT_SCENARIO_NAME} be very robust in generating data that reflects common real-world usage. All arrays and attributes, except error attributes, should be filled in with high quality data so that default simulation provides a good default of how the function behaves` : ''}
|
|
344
|
+
## Rules
|
|
345
|
+
- Valid JSON only—no raw code outside markers
|
|
346
|
+
- No \`undefined\`—use \`null\` or omit
|
|
347
|
+
- No data references (can't use \`posts[0]\` elsewhere—duplicate the value)
|
|
348
|
+
- Scenario name must match exactly: "${scenarioName}"
|
|
349
|
+
- Empty mockData: \`{}\`, empty argumentsData: \`[]\`
|
|
452
350
|
`;
|
|
351
|
+
};
|
|
453
352
|
|
|
454
353
|
export const generateIncompleteSystemMessage = (
|
|
455
354
|
scenarioName: string,
|
|
@@ -127,7 +127,7 @@ export default async function generateEntityScenarios({
|
|
|
127
127
|
if (!result) {
|
|
128
128
|
console.log(
|
|
129
129
|
`CodeYam Error: Error Generating entity ${error ? 'error ' : ''}scenarios failed: Invalid JSON response from AI`,
|
|
130
|
-
response
|
|
130
|
+
JSON.stringify(response, null, 2),
|
|
131
131
|
);
|
|
132
132
|
throw new Error(
|
|
133
133
|
`CodeYam Error: Error Generating entity ${error ? 'error ' : ''}scenarios failed: Invalid JSON response from AI`,
|
|
@@ -195,316 +195,146 @@ function generateSystemMessage(
|
|
|
195
195
|
context?: string,
|
|
196
196
|
scenarioCount?: number,
|
|
197
197
|
): string {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
context
|
|
202
|
-
? `## Business Logic Context
|
|
198
|
+
const scenarioCountText = scenarioCount
|
|
199
|
+
? `Generate exactly ${scenarioCount} scenario${scenarioCount > 1 ? 's' : ''}.`
|
|
200
|
+
: 'Generate 1-4 scenarios.';
|
|
203
201
|
|
|
202
|
+
const contextSection = context
|
|
203
|
+
? `## Business Context
|
|
204
204
|
${context}
|
|
205
205
|
|
|
206
|
-
Focus
|
|
206
|
+
Focus scenarios on demonstrating this specific behavior change.
|
|
207
207
|
|
|
208
208
|
`
|
|
209
|
-
: ''
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
${scenarioCount ? `Generate ${scenarioCount} scenario${scenarioCount > 1 ? 's' : ''}.` : 'Generate a few (between one and four) scenarios.'}
|
|
213
|
-
|
|
214
|
-
## The ${DEFAULT_SCENARIO_NAME}:
|
|
215
|
-
|
|
216
|
-
- Start with the "${DEFAULT_SCENARIO_NAME}" - Call this exactly that, "${DEFAULT_SCENARIO_NAME}" and just that (case sensitive, no other text).
|
|
217
|
-
- The "${DEFAULT_SCENARIO_NAME}" should provide a robust demonstration of the function with instructions for all key attributes provided.
|
|
218
|
-
- Fill in all key attributes in the "keyAttributes" list with valid values from the "validValueOptions" list.
|
|
219
|
-
- All values provided must be from the "validValueOptions" list in the "keyAttributes" list. Do not make up values that are not in the "validValueOptions" list.
|
|
220
|
-
- Ignore any error attributes (e.g. an attribute called "error"). These should not be included or set to null.
|
|
221
|
-
- If a front-end (visual) function accepts "children" as an argument this must be populated with a valid value or the output may be blank.
|
|
222
|
-
- Do not include any "playwrightInstructions" in the "${DEFAULT_SCENARIO_NAME}" as we want a screenshot of the function before any user interactions take place.
|
|
223
|
-
|
|
224
|
-
## Other scenarios:
|
|
209
|
+
: '';
|
|
225
210
|
|
|
226
|
-
|
|
227
|
-
- You do not need to specify key attributes that are the same as the ${DEFAULT_SCENARIO_NAME}.
|
|
228
|
-
- Again ignore any error attributes. These should not be included or set to null.
|
|
229
|
-
- If the function is a front-end (visual) function that accepts user actions and will change it's appearance based on those user actions, then create a non-default scenario that includes "playwrightInstructions" to trigger those user actions.
|
|
211
|
+
return `You are a test scenario designer. Generate data scenarios that demonstrate a function's behavior.
|
|
230
212
|
|
|
231
|
-
|
|
213
|
+
${contextSection}${scenarioCountText}
|
|
232
214
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
-
|
|
240
|
-
|
|
241
|
-
## Dependencies
|
|
242
|
-
|
|
243
|
-
This function may dependend on other functions that have key attributes as well. You can leverage those to generate data scenarios also by creating key attribute instructions for those key attributes in the same manner. Generally speaking key attributes for dependencies are necessary for robust scenarios.
|
|
244
|
-
|
|
245
|
-
## Relative Dates
|
|
246
|
-
|
|
247
|
-
If a relative date is required you can describe it in the "keyAttributeInstructions", e.g. 'today', 'tomorrow', 'next week', 'last month'.
|
|
248
|
-
|
|
249
|
-
## Rules
|
|
215
|
+
## Default Scenario Rules
|
|
216
|
+
The FIRST scenario MUST be named exactly "${DEFAULT_SCENARIO_NAME}" (case-sensitive).
|
|
217
|
+
- Fill ALL key attributes using values from their \`validValueOptions\` list
|
|
218
|
+
- If "children" is an argument, populate it (otherwise output may be blank)
|
|
219
|
+
- Ignore error-related attributes (set to null)
|
|
220
|
+
- NEVER include \`playwrightInstructions\` - we need a screenshot BEFORE any user interaction
|
|
221
|
+
- Do NOT add playwrightInstructions even if the component has forms/buttons - default shows initial state only
|
|
250
222
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
-
|
|
254
|
-
|
|
255
|
-
## Response Structure
|
|
256
|
-
|
|
257
|
-
Respond with the data scenarios in a JSON object format, without additional information or delimiters. Ensure clarity and specificity in each data scenario to facilitate accurate data generation for testing or demonstration purposes.
|
|
258
|
-
|
|
259
|
-
IMPORTANT: For keyAttributeInstructions, use the "dataStructurePath" from the Key Attributes as the key (e.g., "useDiffModal().diffView"), and include both the "localVariable" name and the "instruction" in the value object:
|
|
223
|
+
## Other Scenarios
|
|
224
|
+
- Each produces DISTINCT output (visual: different screenshot; backend: different return/side-effect)
|
|
225
|
+
- Only specify attributes that DIFFER from default
|
|
226
|
+
- May include \`playwrightInstructions\` for user interactions (clicks, form fills)
|
|
260
227
|
|
|
228
|
+
## keyAttributeInstructions Format
|
|
229
|
+
Use \`dataStructurePath\` as key, include both variable name and instruction:
|
|
230
|
+
\`\`\`json
|
|
261
231
|
{
|
|
262
|
-
"
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
"description": string;
|
|
267
|
-
"keyAttributeInstructions": {
|
|
268
|
-
["dataStructurePath"]: {
|
|
269
|
-
"localVariable": string; // The local variable name (e.g., "diffView")
|
|
270
|
-
"instruction": string; // How to set this attribute for the scenario
|
|
271
|
-
}
|
|
272
|
-
},
|
|
273
|
-
"playwrightInstructions?": {
|
|
274
|
-
"selectorFn": string;
|
|
275
|
-
"selectorArgs": string[];
|
|
276
|
-
"actionFn": string;
|
|
277
|
-
"actionArgs": string[];
|
|
278
|
-
}[]
|
|
279
|
-
}
|
|
280
|
-
]
|
|
232
|
+
"useDiffModal().diffView": {
|
|
233
|
+
"localVariable": "diffView",
|
|
234
|
+
"instruction": "Set to 'split' mode"
|
|
235
|
+
}
|
|
281
236
|
}
|
|
237
|
+
\`\`\`
|
|
282
238
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
Usually playwright instructions should not be included in the ${DEFAULT_SCENARIO_NAME}. If playwright instructions will cause the front-end function's results to look different than create a non-default scenario that includes those instructions.
|
|
286
|
-
|
|
287
|
-
This is often the case if the key attributes are only used through a button click or form submission or if the data required for this scenario is not listed as a key attribute and must be provided directly by the user.
|
|
288
|
-
|
|
289
|
-
If the data won't exist or be used without user actions then use the "playwrightInstructions" to trigger execution of that code through the user actions.
|
|
290
|
-
|
|
291
|
-
For \`playwrightInstructions\`, provide an array of strings representing the necessary code to run.
|
|
239
|
+
## playwrightInstructions (optional, non-default only)
|
|
292
240
|
\`\`\`json
|
|
293
241
|
{
|
|
294
242
|
"playwrightInstructions": [
|
|
295
|
-
{
|
|
296
|
-
|
|
297
|
-
"selectorArgs": ["email"],
|
|
298
|
-
"actionFn": "fill",
|
|
299
|
-
"actionArgs": ["test@example.com"]
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
"selectorFn": "getByText",
|
|
303
|
-
"selectorArgs": ["Submit"],
|
|
304
|
-
"actionFn": "click",
|
|
305
|
-
"actionArgs": []
|
|
306
|
-
}
|
|
243
|
+
{ "selectorFn": "getByLabel", "selectorArgs": ["Email"], "actionFn": "fill", "actionArgs": ["test@example.com"] },
|
|
244
|
+
{ "selectorFn": "getByRole", "selectorArgs": ["button", { "name": "Submit" }], "actionFn": "click", "actionArgs": [] }
|
|
307
245
|
]
|
|
308
246
|
}
|
|
309
247
|
\`\`\`
|
|
248
|
+
Note: selectorArgs values must be JSON strings, not JavaScript regex literals.
|
|
310
249
|
|
|
311
|
-
|
|
250
|
+
Use when: data only appears after user action (button click, form submit), or key attribute isn't in data structure.
|
|
312
251
|
|
|
252
|
+
## Rules
|
|
253
|
+
- Relative dates OK in instructions: "today", "tomorrow", "last month"
|
|
254
|
+
- React elements: use simple elements (\`<div>\`, \`<span>\`) - no custom JSX
|
|
255
|
+
- No external library references - plain JS/TS values only
|
|
256
|
+
- Scenario names: letters, numbers, spaces only (no special characters)
|
|
257
|
+
- testName: Jest style with specific expectations, e.g. \`it("displays error when email invalid")\`
|
|
258
|
+
- All values must be valid JSON (strings, numbers, booleans, arrays, objects) - no JavaScript literals like regex
|
|
259
|
+
|
|
260
|
+
## Response Format
|
|
313
261
|
\`\`\`json
|
|
314
262
|
{
|
|
315
263
|
"dataScenarios": [
|
|
316
264
|
{
|
|
317
|
-
"name": ${DEFAULT_SCENARIO_NAME},
|
|
318
|
-
"
|
|
319
|
-
"
|
|
265
|
+
"name": "${DEFAULT_SCENARIO_NAME}",
|
|
266
|
+
"testName": "it(\"displays notifications with unread indicator\")",
|
|
267
|
+
"description": "Default state with 3 unread and 2 read notifications",
|
|
320
268
|
"keyAttributeInstructions": {
|
|
321
|
-
"useNotifications().notifications[]": {
|
|
322
|
-
|
|
323
|
-
"instruction": "Create 5 notifications"
|
|
324
|
-
},
|
|
325
|
-
"useNotifications().notifications[].read": {
|
|
326
|
-
"localVariable": "notifications[].read",
|
|
327
|
-
"instruction": "Set to false for 3 notifications and true for 2 notifications"
|
|
328
|
-
},
|
|
329
|
-
"useNotifications().notifications[].message": {
|
|
330
|
-
"localVariable": "notifications[].message",
|
|
331
|
-
"instruction": "Messages should be no longer than 200 characters"
|
|
332
|
-
}
|
|
269
|
+
"useNotifications().notifications[]": { "localVariable": "notifications[]", "instruction": "Create 5 notifications" },
|
|
270
|
+
"useNotifications().notifications[].read": { "localVariable": "notifications[].read", "instruction": "false for 3, true for 2" }
|
|
333
271
|
}
|
|
334
272
|
},
|
|
335
273
|
{
|
|
336
|
-
"name": "
|
|
337
|
-
"testName": "it(\"
|
|
338
|
-
"description": "
|
|
274
|
+
"name": "Empty state",
|
|
275
|
+
"testName": "it(\"shows placeholder when no notifications\")",
|
|
276
|
+
"description": "User has no notifications",
|
|
339
277
|
"keyAttributeInstructions": {
|
|
340
|
-
"useNotifications().notifications[]": {
|
|
341
|
-
"localVariable": "notifications[]",
|
|
342
|
-
"instruction": "Should be an empty array"
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
"name": "Many notifications, all unread, one long message",
|
|
348
|
-
"testName": "it(\"properly truncates long messages with the title containing the full message\")",
|
|
349
|
-
"description": "A user has many notifications, all unread, with one notification featuring a long message.",
|
|
350
|
-
"keyAttributeInstructions": {
|
|
351
|
-
"useNotifications().notifications[]": {
|
|
352
|
-
"localVariable": "notifications[]",
|
|
353
|
-
"instruction": "Create 10 notifications"
|
|
354
|
-
},
|
|
355
|
-
"useNotifications().notifications[].read": {
|
|
356
|
-
"localVariable": "notifications[].read",
|
|
357
|
-
"instruction": "Set to false for all notifications"
|
|
358
|
-
},
|
|
359
|
-
"useNotifications().notifications[].message": {
|
|
360
|
-
"localVariable": "notifications[].message",
|
|
361
|
-
"instruction": "Ensure at least one message is longer than 500 characters"
|
|
362
|
-
}
|
|
278
|
+
"useNotifications().notifications[]": { "localVariable": "notifications[]", "instruction": "Empty array" }
|
|
363
279
|
}
|
|
364
280
|
}
|
|
365
281
|
]
|
|
366
282
|
}
|
|
367
283
|
\`\`\`
|
|
368
|
-
|
|
369
|
-
Remember:
|
|
370
|
-
|
|
371
|
-
- Name the first scenario exactly "${DEFAULT_SCENARIO_NAME}".
|
|
372
|
-
- For the ${DEFAULT_SCENARIO_NAME} scenario fill in all key attributes with valid values from the "validValueOptions" list in the "keyAttributes" list. Do not leave any key attributes out of the "keyAttributeInstructions" unless they are error attributes.
|
|
373
|
-
- For other scenarios, find ways to create distinctly different outputs using other valid values for key attributes or providing playwright instructions to trigger user interactions.
|
|
374
|
-
- Do not use any special characters in the scenario names. Keep them short and concise and only use letters, numbers, and spaces.
|
|
375
|
-
- Do not use playwright instructions in the ${DEFAULT_SCENARIO_NAME} as we want a screenshot of the function before any user interactions.
|
|
376
284
|
`;
|
|
377
285
|
}
|
|
378
286
|
|
|
379
287
|
const SYSTEM_MESSAGE = generateSystemMessage();
|
|
380
288
|
|
|
381
|
-
const ERROR_SYSTEM_MESSAGE = `
|
|
382
|
-
|
|
383
|
-
In "errorDataScenarios", give each scenario a description that explains what the predicted error is, a code snippet (or multiple) showing where it will occur, a description of how it can be fixed along with example code, and provide detailed "keyAttributeInstructions" on how to generate the necessary data to cause the error.
|
|
384
|
-
|
|
385
|
-
For each error scenario also provide two evaluation dynamics:
|
|
289
|
+
const ERROR_SYSTEM_MESSAGE = `You are a security/reliability analyst. Identify data inputs that will cause UNCAUGHT ERRORS in this function.
|
|
386
290
|
|
|
387
|
-
|
|
388
|
-
-
|
|
389
|
-
-
|
|
291
|
+
## What Qualifies as an Error Scenario
|
|
292
|
+
- MUST cause an actual thrown error (not awkward behavior)
|
|
293
|
+
- MUST be fixable by changing THIS function's code
|
|
294
|
+
- MUST NOT rely on type errors caught by static analysis
|
|
295
|
+
- MUST NOT assume dependent functions will fail
|
|
390
296
|
|
|
391
|
-
|
|
392
|
-
- 1
|
|
393
|
-
-
|
|
297
|
+
## Likelihood Scale (1-10)
|
|
298
|
+
- 1-3: Requires clearly wrong/unusual data
|
|
299
|
+
- 4-6: Plausible edge case
|
|
300
|
+
- 7-9: Common real-world scenario
|
|
301
|
+
- 10: ONLY if guaranteed bug regardless of input
|
|
394
302
|
|
|
395
|
-
|
|
303
|
+
Be conservative with high scores—they should surface truly likely errors.
|
|
396
304
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
All data must be plain that can be run in a node environment (not in the browser). Do not reference any external libraries in the "keyAttributeInstructions". If an external library is required by the function, then provide instructructions on how to fake or mock that data.
|
|
402
|
-
|
|
403
|
-
Focus on "Major" errors. Only include "Minor" errors is they are very likely to occur.
|
|
404
|
-
|
|
405
|
-
## Response
|
|
406
|
-
|
|
407
|
-
For each error scenario, start with a data mapping between the phrase you want to use in the "keyAttributeInstructions" and the exact variable in the data strucure. Then provide a name and a description that predicts how the function will error out and a suggested way to fix the error. The name should be unique and short (no more than 30 characters), and the description should provide context for the error scenario.
|
|
305
|
+
## Severity Scale (1-2)
|
|
306
|
+
- 1 = Minor: Unexpected behavior, no crash
|
|
307
|
+
- 2 = Major: Function fails completely (focus here)
|
|
408
308
|
|
|
409
309
|
## Rules
|
|
310
|
+
- Only reference data in the provided data structure
|
|
311
|
+
- React elements: simple only (\`<div>\`, \`<span>\`)
|
|
312
|
+
- No external library references—mock with plain JS
|
|
313
|
+
- Each scenario must cause a DISTINCT error type
|
|
314
|
+
- If no errors possible: \`{ "errorDataScenarios": "No errors found" }\`
|
|
410
315
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
- If the data structure calls for react elements, keep them simple (e.g. <div> or <span>). Do not reference custom jsx elements as they will not exist.
|
|
414
|
-
|
|
415
|
-
- Do not reference any external libraries, such as React, in the "keyAttributeInstructions". Assume no external libraries are available. Do not reference custom jsx elements. If needed describe how to mock the enternal library data using plain javascript that can be run in a node environment.
|
|
416
|
-
|
|
417
|
-
- Only create new error scenarios if the scenario will literally cause an error. We are not looking for awkward or unintended results, only literal errors. Do not create an error scenario if you are not confident it will cause an error.
|
|
418
|
-
|
|
419
|
-
- Do not assume that another function might cause an error. We are looking for errors that are a direct result of the code in this function.
|
|
420
|
-
|
|
421
|
-
- Do not create errors that can be caught through normal type detection. We only want errors that are reasonably likely to happen and won't be caught by basic static code analysis.
|
|
422
|
-
|
|
423
|
-
- Only create error scenarios that can be fixed by changing the code in this function. Do not create error scenarios that require changes to other functions or external libraries.
|
|
424
|
-
|
|
425
|
-
- Look to create a few error scenarios, but if you can not identify any way to cause an error then do not generate any error scenarios. Each error scenario should represent a distinctly different way to cause an error. If there are no errors you can respond with:
|
|
316
|
+
Note: In JS/TS, any non-zero value satisfies a boolean check—this won't error.
|
|
426
317
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
"errorDataScenarios": "No errors found"
|
|
430
|
-
}
|
|
431
|
-
\`\`\`
|
|
432
|
-
|
|
433
|
-
- Make sure each error scenario has a unique name.
|
|
434
|
-
|
|
435
|
-
## Response Structure
|
|
436
|
-
|
|
437
|
-
Respond with the data scenarios in a JSON object format, without additional information or delimiters. Ensure clarity and specificity in each data scenario to facilitate accurate data generation for testing or demonstration purposes.
|
|
438
|
-
|
|
439
|
-
{
|
|
440
|
-
"errorDataScenarios": [
|
|
441
|
-
{
|
|
442
|
-
"dataMapping": { [key: string]: string };
|
|
443
|
-
"name": string;
|
|
444
|
-
"codeSnippet": string;
|
|
445
|
-
"description": string;
|
|
446
|
-
"fix": string;
|
|
447
|
-
"fixSnippet": string;
|
|
448
|
-
"likelihood": number;
|
|
449
|
-
"likelihoodDescription": string;
|
|
450
|
-
"severity": number;
|
|
451
|
-
"severityDescription": string;
|
|
452
|
-
"instructions": string[];
|
|
453
|
-
}
|
|
454
|
-
]
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
## Example
|
|
458
|
-
Given the following data structure:
|
|
459
|
-
|
|
460
|
-
\`\`\`
|
|
461
|
-
{
|
|
462
|
-
"arguments": [
|
|
463
|
-
{
|
|
464
|
-
"notifications": {
|
|
465
|
-
"message": "string",
|
|
466
|
-
"read": "boolean"
|
|
467
|
-
}[]
|
|
468
|
-
}
|
|
469
|
-
]
|
|
470
|
-
}
|
|
471
|
-
\`\`\`
|
|
472
|
-
|
|
473
|
-
The full response might be:
|
|
474
|
-
|
|
475
|
-
\`\`\`
|
|
318
|
+
## Response Format
|
|
319
|
+
\`\`\`json
|
|
476
320
|
{
|
|
477
321
|
"errorDataScenarios": [
|
|
478
322
|
{
|
|
479
|
-
"dataMapping": {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
"
|
|
483
|
-
"
|
|
484
|
-
"
|
|
485
|
-
"fix": "Wrap the \`encodeURIComponent\` call in a try/catch block.",
|
|
486
|
-
"fixSnippet: "...\nlet encodedMessage: string | undefined;\ntry {\n encodedMessage = encodeURIComponent(message)\n} catch (e) {\n console.error('Error encoding message:', e)\n..."
|
|
323
|
+
"dataMapping": { "notifications array": "arguments - notifications" },
|
|
324
|
+
"name": "Non-utf8 message encoding",
|
|
325
|
+
"codeSnippet": "const encoded = encodeURIComponent(message);",
|
|
326
|
+
"description": "encodeURIComponent throws on non-utf8 characters",
|
|
327
|
+
"fix": "Wrap in try/catch",
|
|
328
|
+
"fixSnippet": "try {\\n encoded = encodeURIComponent(message);\\n} catch (e) {\\n // handle\\n}",
|
|
487
329
|
"likelihood": 7,
|
|
488
|
-
"likelihoodDescription": "
|
|
330
|
+
"likelihoodDescription": "International users may input non-utf8 characters",
|
|
489
331
|
"severity": 2,
|
|
490
|
-
"severityDescription": "
|
|
332
|
+
"severityDescription": "Function throws uncaught error",
|
|
491
333
|
"keyAttributeInstructions": {
|
|
492
|
-
"notifications[]": "
|
|
334
|
+
"notifications[]": "Array with message containing non-utf8 characters"
|
|
493
335
|
}
|
|
494
336
|
}
|
|
495
337
|
]
|
|
496
338
|
}
|
|
497
339
|
\`\`\`
|
|
498
|
-
|
|
499
|
-
Please write both the \`codeSnippet\` and \`fixSnippet\` with appropriate line breaks to increase readability.
|
|
500
|
-
|
|
501
|
-
Assume that all functions this function depends on exist even if they are not provided in the prompt. We have isolated this function for analysis but those dependencies do exist.
|
|
502
|
-
|
|
503
|
-
Only create error scenarios based on the code that is in the function provided.
|
|
504
|
-
|
|
505
|
-
Common Errors In Your Analysis:
|
|
506
|
-
- Typescript/javascript:
|
|
507
|
-
- Any object or primitive other than 0 can be used to satisfy a boolean. This will not cause an error.
|
|
508
|
-
|
|
509
|
-
Do not mark anything as a "10" for likelihood unless the error will literally happen every time the function is called. In general be cautious about high likelihood scores so that errors that are truly most likely to happen show up as higher priority.
|
|
510
340
|
`;
|