@codeyam/codeyam-cli 0.1.0-staging.1 â 0.1.0-staging.28f73cf
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 +2 -1
- 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 +127 -4
- package/analyzer-template/packages/ai/src/lib/checkAllAttributes.ts +1 -3
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +1821 -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/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/generateChangesEntityKeyAttributes.ts +51 -107
- 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 +53 -176
- 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 +39 -0
- package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +52 -6
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/index.ts +2 -1
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +238 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getDeclaredEntityNode.ts +25 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/index.ts +2 -0
- 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/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/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/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/frameworks/getNextRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.js +5 -3
- 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/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/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/frameworks/getNextRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.js +5 -3
- 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/index.ts +2 -0
- package/analyzer-template/packages/utils/src/lib/Semaphore.ts +42 -0
- package/analyzer-template/packages/utils/src/lib/frameworks/getNextRoutePath.ts +8 -3
- 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/project/constructMockCode.ts +170 -6
- package/analyzer-template/project/reconcileMockDataKeys.ts +13 -0
- package/analyzer-template/project/start.ts +1 -11
- package/analyzer-template/project/startScenarioCapture.ts +24 -0
- package/analyzer-template/project/trackGeneratedFiles.ts +41 -0
- package/analyzer-template/project/writeMockDataTsx.ts +125 -4
- package/analyzer-template/project/writeScenarioComponents.ts +199 -45
- package/analyzer-template/project/writeUniversalMocks.ts +72 -10
- package/background/src/lib/virtualized/project/constructMockCode.js +158 -7
- 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/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/trackGeneratedFiles.js +30 -0
- package/background/src/lib/virtualized/project/trackGeneratedFiles.js.map +1 -0
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +95 -3
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +144 -28
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/background/src/lib/virtualized/project/writeUniversalMocks.js +59 -9
- package/background/src/lib/virtualized/project/writeUniversalMocks.js.map +1 -1
- package/codeyam-cli/scripts/apply-setup.js +288 -0
- package/codeyam-cli/scripts/apply-setup.js.map +1 -0
- package/codeyam-cli/scripts/extract-setup.js +130 -0
- package/codeyam-cli/scripts/extract-setup.js.map +1 -0
- package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +238 -0
- package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +1 -0
- 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 +221 -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 +164 -0
- package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -0
- 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 +4 -3
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/analyzer.js +30 -0
- package/codeyam-cli/src/utils/analyzer.js.map +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js +25 -5
- package/codeyam-cli/src/utils/backgroundServer.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/fileWatcher.js +75 -5
- package/codeyam-cli/src/utils/fileWatcher.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 +8 -3
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- 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 +63 -2
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/backgroundServer.js +15 -35
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-D5ZHFomX.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-Dh-FldQK.js â InteractivePreview-XDSzQLOY.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-BYVx9KFp.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-Dp6DC845.js â LogViewer-CRcT5fOZ.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-BORLgi0X.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-Bual6h18.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioPreview-Bi-YUMa-.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-4D2vLLJz.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/_index-BC200mfN.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CxvZPkCv.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-B2I7jQx2.js â chart-column-B8fb6wnw.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-De6i8FUT.js +26 -0
- package/codeyam-cli/src/webserver/build/client/assets/{circle-alert-GwwOAbhw.js â circle-alert-IdsgAK39.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/circle-check-BACUUf75.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/clock-vWeoCemX.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CS7XDrKv.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DIOEw_3i.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-1Z6D0fLM.js â entity._sha._-8Els_3Wb.js} +10 -10
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-C3FZJx1w.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-YJz_igar.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/entityStatus-BEqj2qBy.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entityVersioning-DO2gCvXv.js â entityVersioning-Bk_YB1jM.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-DiP0q291.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/file-text-LM0mgxXE.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-Dxh9CcaV.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-BXmqrWCH.js +12 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-BGS74ED-.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-D-zYbzFZ.js +8 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-DN7Vr40D.js â loader-circle-BXPKbHEb.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-1af162d4.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-DB7VgjCY.js +16 -0
- package/codeyam-cli/src/webserver/build/client/assets/{settings-MZc4XdmE.js â settings-5zF_GOcS.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-Dc4MlMpK.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-BQ-02-jB.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-D7k-ArFa.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-BBlyqxij.js â useLastLogLine-AlhS7g5F.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useToast-Ddo4UQv7.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{zap-B4gsLUZQ.js â zap-_jw-9DCp.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-D4JpXSIO.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-vwbN7n65.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 +85 -94
- package/codeyam-cli/templates/debug-command.md +125 -0
- package/package.json +9 -11
- package/packages/ai/index.js +1 -2
- 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 +111 -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 +1320 -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/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/generateChangesEntityKeyAttributes.js +51 -107
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.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 +53 -176
- 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 +45 -5
- package/packages/analyze/src/lib/FileAnalyzer.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/getAllDeclaredEntityNodes.js +191 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getDeclaredEntityNode.js +16 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getDeclaredEntityNode.js.map +1 -0
- package/packages/analyze/src/lib/asts/sourceFiles/index.js +2 -0
- package/packages/analyze/src/lib/asts/sourceFiles/index.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/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/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/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/frameworks/getNextRoutePath.js +5 -3
- 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/analyzer-template/packages/ai/src/lib/generateEntityDataMap.ts +0 -375
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-GqWwt5wG.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-p0fuyqGQ.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-xwuhwsZH.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioPreview-Bl2IRh55.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-M2QuSHKC.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/_index-CAVtep9Q.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CLmzsLsT.js +0 -10
- package/codeyam-cli/src/webserver/build/client/assets/components-CAx5ONX_.js +0 -40
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CgyOwWip.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DGy3zrli.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-ChAdTrrU.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-D9L7267w.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-C6FRgjPr.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-C3-cQjgv.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-Dp4EB9nv.js +0 -12
- package/codeyam-cli/src/webserver/build/client/assets/globals-Da3jt49-.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-172a4629.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-COyVTsPq.js +0 -16
- package/codeyam-cli/src/webserver/build/client/assets/search-CvyP_1Lo.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-Hbf8b7J_.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-BMBi0VzO.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useToast-C_VxoXTh.js +0 -1
- package/codeyam-cli/src/webserver/build/client/cy-logo-cli.svg +0 -13
- package/codeyam-cli/src/webserver/build/server/assets/index-eAULANMV.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-lutv16q5.js +0 -161
- package/codeyam-cli/src/webserver/public/cy-logo-cli.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
|
@@ -1,375 +0,0 @@
|
|
|
1
|
-
import { Entity } from '~codeyam/types';
|
|
2
|
-
import completionCall from './completionCall';
|
|
3
|
-
import { saveLlmCall } from '~codeyam/aws/dynamodb';
|
|
4
|
-
import generateEntityDataMapGenerator from './promptGenerators/generateEntityDataMapGenerator';
|
|
5
|
-
import { AI, DEFAULT_LARGER_MODEL } from '~codeyam/ai';
|
|
6
|
-
import { parseJsonSafe } from './parsers/parseJsonSafe';
|
|
7
|
-
|
|
8
|
-
interface GenerateEntityDataMapArgs {
|
|
9
|
-
entity: Entity;
|
|
10
|
-
importStatements: string;
|
|
11
|
-
localImports: string;
|
|
12
|
-
analysisId: string;
|
|
13
|
-
model?: AI.Model;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default async function generateEntityDataMap({
|
|
17
|
-
entity,
|
|
18
|
-
importStatements,
|
|
19
|
-
localImports,
|
|
20
|
-
analysisId,
|
|
21
|
-
model,
|
|
22
|
-
}: GenerateEntityDataMapArgs) {
|
|
23
|
-
localImports = localImports
|
|
24
|
-
.split('\n')
|
|
25
|
-
.map((line) => `cy_localDependency.${line.trim()}`)
|
|
26
|
-
.join('\n');
|
|
27
|
-
|
|
28
|
-
const prompt = generateEntityDataMapGenerator(
|
|
29
|
-
entity.code,
|
|
30
|
-
importStatements,
|
|
31
|
-
localImports,
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
console.log(
|
|
35
|
-
'CodeYam: Generating entity data map',
|
|
36
|
-
entity.filePath,
|
|
37
|
-
entity.name,
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
const response = await completionCall({
|
|
41
|
-
type: 'generateEntityDataMap',
|
|
42
|
-
systemMessage: SYSTEM_MESSAGE,
|
|
43
|
-
prompt,
|
|
44
|
-
model: model ?? DEFAULT_LARGER_MODEL,
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const llmCall = await saveLlmCall({
|
|
48
|
-
object_type: 'analysis',
|
|
49
|
-
object_id: analysisId,
|
|
50
|
-
propsJson: {
|
|
51
|
-
entity: {
|
|
52
|
-
name: entity.name,
|
|
53
|
-
filePath: entity.filePath,
|
|
54
|
-
code: entity.code,
|
|
55
|
-
},
|
|
56
|
-
importStatements,
|
|
57
|
-
localImports,
|
|
58
|
-
analysisId,
|
|
59
|
-
model,
|
|
60
|
-
},
|
|
61
|
-
...response.stats,
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const { completion: dataMapString } = response;
|
|
65
|
-
if (!dataMapString) {
|
|
66
|
-
console.log(
|
|
67
|
-
'CodeYam Error: Generating entity data map failed: No response from AI',
|
|
68
|
-
);
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
console.log(
|
|
73
|
-
`LLMCall ${llmCall ? llmCall.id : 'N/A'}: ${entity.filePath} dataMapString :>> `,
|
|
74
|
-
);
|
|
75
|
-
console.log(dataMapString);
|
|
76
|
-
|
|
77
|
-
const { dataMap } = parseJsonSafe(dataMapString) as {
|
|
78
|
-
dataMap: {
|
|
79
|
-
[key: string]: string[];
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
return { dataMap, llmCall };
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const SYSTEM_MESSAGE = `
|
|
87
|
-
## Overview
|
|
88
|
-
|
|
89
|
-
This is a tricky task. We need to identify what data this function passes into dependencies or returns from the function and where that data originated.
|
|
90
|
-
|
|
91
|
-
This lets us piece together the overall structure of the data used in the app.
|
|
92
|
-
|
|
93
|
-
So our goal is to map data coming into this function to the data that passes out of it either into a dependency or into the return value.
|
|
94
|
-
|
|
95
|
-
## Instructions
|
|
96
|
-
|
|
97
|
-
- Look at each dependency listed in the "Local Dependencies" and "Imported Dependencies" sections of the prompt (if they exist). Identify any dependencies that provide data to this function.
|
|
98
|
-
- Look at the arguments and named arguments that are passed into the function.
|
|
99
|
-
- List out the data that is passed into the function from each dependency in the "inData" section.
|
|
100
|
-
|
|
101
|
-
- Look at each dependency listed in the "Local Dependencies" and "Imported Dependencies" sections of the prompt (if they exist). Identify any dependencies that are passed data from this function.
|
|
102
|
-
- Look at the return value of the function if it exists and is not returning a react component.
|
|
103
|
-
- List out the data that is passed into each dependency or returned from the function in the "outData" section.
|
|
104
|
-
|
|
105
|
-
- We want to figure out if any of the "inData" (or any of the attributes or nested attributes of the "inData") are used for the "outData" or are used to create the "outData".
|
|
106
|
-
- List out any attributes or nested attributes from the "inData" that are used in the "outData" in the "attributes" section.
|
|
107
|
-
- Create a "dataMap" section that details how the "inData" maps to the "outData" capturing attributes and nested attributes as needed.
|
|
108
|
-
|
|
109
|
-
## Keywords
|
|
110
|
-
|
|
111
|
-
- \`cy_namedArg\` = data passed into the function as a named argument
|
|
112
|
-
- \`cy_arg[0]\` = data passed into the function as the first argument (not named) - Use [1], [2], etc. for subsequent arguments
|
|
113
|
-
- \`cy_returnValue\` = data returned from the function or data returned from a dependency
|
|
114
|
-
- \`cy_localDependency\` = a function that is in the same file as this function
|
|
115
|
-
- \`cy_manipulatedData\` = data that was manipulated in the function, dissasociating it from any original external data
|
|
116
|
-
- \`cy_spread\` = data that is passed into a dependency via a spread operator \`...variable\` (e.g. \`<Component {...data} />\`). Only use this when the spread operator is explicitly used in the code (e.g. the three dots are present in the code).
|
|
117
|
-
|
|
118
|
-
Here are a few examples:
|
|
119
|
-
----
|
|
120
|
-
|
|
121
|
-
To start a simple \`user\` object passed in as a named argument. The \`hobby\` attribute of the user object is then passed to the UserHobby component:
|
|
122
|
-
|
|
123
|
-
---- START EXAMPLE ----
|
|
124
|
-
|
|
125
|
-
Prompt:
|
|
126
|
-
|
|
127
|
-
\`\`\`
|
|
128
|
-
Imported Dependencies:
|
|
129
|
-
|
|
130
|
-
import UserHobby from '@/components/user/UserHobby';
|
|
131
|
-
|
|
132
|
-
Function
|
|
133
|
-
|
|
134
|
-
export UserProfile({ user, options }) {
|
|
135
|
-
return (
|
|
136
|
-
<div className='user-profile' style={{ fontSize: options.large ? '24px' : '16px' }}>
|
|
137
|
-
<div>{user.name}</div>
|
|
138
|
-
{user.hobbies.map(
|
|
139
|
-
(hobby, index) => (
|
|
140
|
-
<UserHobby key={index} hobby={hobby} options={options} />
|
|
141
|
-
)
|
|
142
|
-
)}
|
|
143
|
-
</div>
|
|
144
|
-
)
|
|
145
|
-
}
|
|
146
|
-
\`\`\`
|
|
147
|
-
|
|
148
|
-
Response:
|
|
149
|
-
|
|
150
|
-
\`\`\`
|
|
151
|
-
{
|
|
152
|
-
"inData": [
|
|
153
|
-
"cy_namedArg.user",
|
|
154
|
-
"cy_namedArg.options"
|
|
155
|
-
],
|
|
156
|
-
"outData": [
|
|
157
|
-
"@/components/user/UserHobby.UserHobby.hobby",
|
|
158
|
-
"@/components/user/UserHobby.UserHobb.options"
|
|
159
|
-
],
|
|
160
|
-
"attributes": [
|
|
161
|
-
"cy_namedArg.user.hobbies[] -> @/components/user/UserHobby.UserHobby.hobby"
|
|
162
|
-
],
|
|
163
|
-
"dataMap": {
|
|
164
|
-
"cy_namedArg.user.hobbies[]": ["@/components/user/UserHobby.UserHobby.hobby"],
|
|
165
|
-
"cy_namedArg.options": ["@/components/user/UserHobby.UserHobby.options"]
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
\`\`\`
|
|
169
|
-
|
|
170
|
-
---- END EXAMPLE ----
|
|
171
|
-
|
|
172
|
-
Note: The \`[]\` syntax is used to indicate that the \`user.hobbies\` attribute is an array which is being iterated over.
|
|
173
|
-
|
|
174
|
-
---- START EXAMPLE ----
|
|
175
|
-
|
|
176
|
-
Prompt:
|
|
177
|
-
|
|
178
|
-
\`\`\`
|
|
179
|
-
Imported Dependencies:
|
|
180
|
-
|
|
181
|
-
import { useParams } from '@remix-run/react';
|
|
182
|
-
import { useFile } from './providers/FileProvider';
|
|
183
|
-
import FilesDownloader from '~/home/download/FilesDownloader';
|
|
184
|
-
|
|
185
|
-
Function
|
|
186
|
-
|
|
187
|
-
export FilePreview({ className }) {
|
|
188
|
-
const { folderId } = useParams();
|
|
189
|
-
const { folder } = useFile(folderId);
|
|
190
|
-
|
|
191
|
-
return (
|
|
192
|
-
<div className={\`flex flex-col gap-3 \${className}\`>
|
|
193
|
-
<div>Download: {folder.name}</div>
|
|
194
|
-
<FilesDownloader files={folder.files} />
|
|
195
|
-
</div>
|
|
196
|
-
)
|
|
197
|
-
}
|
|
198
|
-
\`\`\`
|
|
199
|
-
|
|
200
|
-
Response:
|
|
201
|
-
|
|
202
|
-
\`\`\`
|
|
203
|
-
{
|
|
204
|
-
"inData": [
|
|
205
|
-
"cy_namedArg.className",
|
|
206
|
-
"@remix-run/react.useParams.cy_returnValue.folderId",
|
|
207
|
-
"./providers/FileProvider.useFile.cy_returnValue.folder",
|
|
208
|
-
],
|
|
209
|
-
"outData": [
|
|
210
|
-
"./providers/FileProvider.useFile.cy_arg[0]",
|
|
211
|
-
"~/home/download/FilesDownloader.FilesDownloader.files"
|
|
212
|
-
],
|
|
213
|
-
"attributes": [
|
|
214
|
-
"./providers/FileProvider.useFile.cy_returnValue.folder.files -> ~/home/download/FilesDownloader.FilesDownloader.files"
|
|
215
|
-
],
|
|
216
|
-
"dataMap": {
|
|
217
|
-
"@remix-run/react.useParams.cy_returnValue.folderId": ["./providers/FileProvider.useFile.cy_arg[0]"],
|
|
218
|
-
"./providers/FileProvider.useFile.cy_returnValue.folder.files": ["~/home/download/FilesDownloader.FilesDownloader.files"]
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
\`\`\`
|
|
222
|
-
|
|
223
|
-
---- END EXAMPLE ----
|
|
224
|
-
|
|
225
|
-
Note the use of \`cy_returnValue\` to capture that \`useFile\` is a function returning the data.
|
|
226
|
-
|
|
227
|
-
---- START EXAMPLE ----
|
|
228
|
-
|
|
229
|
-
Prompt:
|
|
230
|
-
|
|
231
|
-
\`\`\`
|
|
232
|
-
Function
|
|
233
|
-
|
|
234
|
-
const incrementUserStats = (views, user) => {
|
|
235
|
-
user.stats.views += views.length;
|
|
236
|
-
user.lastViewed = views[views.length - 1].date;
|
|
237
|
-
|
|
238
|
-
return user
|
|
239
|
-
};
|
|
240
|
-
\`\`\`
|
|
241
|
-
|
|
242
|
-
Response:
|
|
243
|
-
|
|
244
|
-
\`\`\`
|
|
245
|
-
{
|
|
246
|
-
"inData": [
|
|
247
|
-
"cy_arg[0]",
|
|
248
|
-
"cy_arg[1]"
|
|
249
|
-
],
|
|
250
|
-
"outData": [
|
|
251
|
-
"cy_returnValue"
|
|
252
|
-
],
|
|
253
|
-
"attributes": [
|
|
254
|
-
"cy_arg[0].length -> cy_returnValue.stats.views",
|
|
255
|
-
"cy_arg[0][].date -> cy_returnValue.lastViewed"
|
|
256
|
-
],
|
|
257
|
-
"dataMap": {
|
|
258
|
-
"cy_arg[0].length": ["cy_returnValue.stats.views"],
|
|
259
|
-
"cy_arg[0][].date": ["cy_returnValue.lastViewed"],
|
|
260
|
-
"cy_arg[1]": ["cy_returnValue"]
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
\`\`\`
|
|
264
|
-
|
|
265
|
-
---- END EXAMPLE ----
|
|
266
|
-
|
|
267
|
-
Note how we capture any available details of the cy_returnValue.
|
|
268
|
-
|
|
269
|
-
---- START EXAMPLE ----
|
|
270
|
-
|
|
271
|
-
Prompt:
|
|
272
|
-
|
|
273
|
-
\`\`\`
|
|
274
|
-
Imported Dependencies:
|
|
275
|
-
|
|
276
|
-
import { useMemo } from 'react';
|
|
277
|
-
import { useFile } from '~/providers/FileProvider';
|
|
278
|
-
import FilePreview from '../components/files/FilePreview';
|
|
279
|
-
|
|
280
|
-
Local Dependencies:
|
|
281
|
-
|
|
282
|
-
cy_localDependency.calculateStats
|
|
283
|
-
cy_localDependency.Emojis
|
|
284
|
-
|
|
285
|
-
Function
|
|
286
|
-
|
|
287
|
-
export FilePreview({ user }) {
|
|
288
|
-
const { folder } = useFile();
|
|
289
|
-
|
|
290
|
-
const filesWithFolderAndStats = useMemo(() => {
|
|
291
|
-
return folder.files.map((file) => ({
|
|
292
|
-
...file,
|
|
293
|
-
user,
|
|
294
|
-
folder,
|
|
295
|
-
}));
|
|
296
|
-
}, []);
|
|
297
|
-
|
|
298
|
-
return (
|
|
299
|
-
<div className='flex items-center gap-3'>
|
|
300
|
-
<div>Download: {folder.name}</div>
|
|
301
|
-
{filesWithFolderAndStats.map(
|
|
302
|
-
(file) => (
|
|
303
|
-
<div>
|
|
304
|
-
<FilePreview key={file.id} {...file} />
|
|
305
|
-
<Emojis awards={file.stats?.awards ?? calculateStats(file, user).awards} />
|
|
306
|
-
</div>
|
|
307
|
-
)
|
|
308
|
-
)}
|
|
309
|
-
</div>
|
|
310
|
-
)
|
|
311
|
-
}
|
|
312
|
-
\`\`\`
|
|
313
|
-
|
|
314
|
-
Response:
|
|
315
|
-
|
|
316
|
-
\`\`\`
|
|
317
|
-
{
|
|
318
|
-
"inData": [
|
|
319
|
-
"cy_namedArg.user",
|
|
320
|
-
"~/providers/FileProvider.useFile.cy_returnValue.folder",
|
|
321
|
-
],
|
|
322
|
-
"outData": [
|
|
323
|
-
"cy_localDependency.calculateStats.arg[0]",
|
|
324
|
-
"cy_localDependency.calculateStats.arg[1]",
|
|
325
|
-
"../components/files/FilePreview.FilePreview.cy_spread",
|
|
326
|
-
"cy_localDependency.Emojis.awards"
|
|
327
|
-
],
|
|
328
|
-
"attributes": [
|
|
329
|
-
"cy_namedArg.user -> ../components/files/FilePreview.FilePreview.cy_spread.file.user",
|
|
330
|
-
"~/providers/FileProvider.useFile.cy_returnValue.folder -> ../components/files/FilePreview.FilePreview.cy_spread.file.folder",
|
|
331
|
-
"~/providers/FileProvider.useFile.cy_returnValue.folder.files[].stats.awards -> cy_localDependency.Emojis.awards",
|
|
332
|
-
"cy_localDependency.calculateStats.cy_returnValue.awards -> cy_localDependency.Emojis.awards"
|
|
333
|
-
],
|
|
334
|
-
"dataMap": {
|
|
335
|
-
"cy_namedArg.user": [
|
|
336
|
-
"../components/files/FilePreview.FilePreview.cy_spread.file.user"],
|
|
337
|
-
"cy_localDependency.calculateStats.arg[1]"
|
|
338
|
-
],
|
|
339
|
-
"~/providers/FileProvider.useFile.cy_returnValue.folder": [
|
|
340
|
-
"../components/files/FilePreview.FilePreview.cy_spread.file.folder"
|
|
341
|
-
],
|
|
342
|
-
"~/providers/FileProvider.useFile.cy_returnValue.folder.files[]": [
|
|
343
|
-
"../components/files/FilePreview.FilePreview.cy_spread.file",
|
|
344
|
-
"cy_localDependency.calculateStats.arg[0]"
|
|
345
|
-
],
|
|
346
|
-
"~/providers/FileProvider.useFile.cy_returnValue.folder.files[].stats.awards": [
|
|
347
|
-
"cy_localDependency.Emojis.awards"
|
|
348
|
-
],
|
|
349
|
-
"cy_localDependency.calculateStats.functionCallReturnValue.awards": [
|
|
350
|
-
"cy_localDependency.Emojis.awards"
|
|
351
|
-
]
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
\`\`\`
|
|
355
|
-
|
|
356
|
-
---- END EXAMPLE ----
|
|
357
|
-
|
|
358
|
-
Note how the attributes contained in the \`FilePreview.cy_spread.file\` are captured as in the code it is clear that \`user\` and \`folder\` are added to the \`file\` before being passed to the \`FilePreview\` component. Also note how the value for some mappings contain two entries to reflect the data beind used in multiple places.
|
|
359
|
-
|
|
360
|
-
## Rules
|
|
361
|
-
|
|
362
|
-
Be sure to capture any data that is passed into a dependency or returned from the function as outData. There is frequently data passed into a dependency that creates both an "outData" and an "inData" entry. Capture both.
|
|
363
|
-
|
|
364
|
-
If data (or a nested attribute) is passed to multiple dependencies, create an entry for each dependency. Similarly, if a dependency takes in different data in different situations then map each situation separately.
|
|
365
|
-
|
|
366
|
-
Look out for data that is reorganized in the function. For example if the function takes an array of "books" but then gathers all the "chapters" of all the books into a new array then if that data is passed to a dependency we can map the "chapters" back to the original "books".
|
|
367
|
-
|
|
368
|
-
You do not need to map the return value of a react component.
|
|
369
|
-
|
|
370
|
-
Do not create duplicate entries. They are not necessary.
|
|
371
|
-
|
|
372
|
-
Be sure to capture the exact path, with proper capitalization, for each dependency as it is listed in either the "Imported Dependencies" or "Local Dependencies". Capture all relative aspects (e.g. "cy_localDependency", "@", "~", "../", "~/", etc.) and the rest of the path to the dependency file or node module. Do not make up any dependency paths as this will cause the data mapping to break.
|
|
373
|
-
|
|
374
|
-
Just provide the json with the map and nothing else (no comments or text around the json).
|
|
375
|
-
`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./components-CAx5ONX_.js";import{c as r}from"./createLucideIcon-CgyOwWip.js";import{C as s}from"./chart-column-B2I7jQx2.js";const i=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],d=r("box",i);const h=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],g=r("code-xml",h);const b=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],a=r("code",b);const C=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],n=r("file-text",C);const f=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],p=r("image",f);const y=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],x=r("list",y);const m=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],u=r("tag",m);function M({type:c}){const t={visual:{iconColor:"#7c3aed",bgColor:"bg-purple-100",bgHex:"#f3e8ff"},library:{iconColor:"#0DBFE9",bgColor:"bg-cyan-100",bgHex:"#cffafe"},type:{iconColor:"#dc2626",bgColor:"bg-red-100",bgHex:"#fee2e2"},data:{iconColor:"#2563eb",bgColor:"bg-blue-100",bgHex:"#dbeafe"},index:{iconColor:"#ea580c",bgColor:"bg-orange-100",bgHex:"#ffedd5"},functionCall:{iconColor:"#7c3aed",bgColor:"bg-purple-100",bgHex:"#f3e8ff"},class:{iconColor:"#059669",bgColor:"bg-emerald-100",bgHex:"#d1fae5"},method:{iconColor:"#0891b2",bgColor:"bg-cyan-100",bgHex:"#cffafe"},other:{iconColor:"#6b7280",bgColor:"bg-gray-100",bgHex:"#f3f4f6"}},o=t[c]||t.other,l=()=>{switch(c){case"library":return e.jsx(g,{size:16,color:o.iconColor});case"visual":return e.jsx(p,{size:16,color:o.iconColor});case"type":return e.jsx(u,{size:16,color:o.iconColor});case"data":return e.jsx(s,{size:16,color:o.iconColor});case"index":return e.jsx(x,{size:16,color:o.iconColor});case"functionCall":return e.jsx(a,{size:16,color:o.iconColor});case"class":return e.jsx(d,{size:16,color:o.iconColor});case"method":return e.jsx(a,{size:16,color:o.iconColor});case"other":return e.jsx(n,{size:16,color:o.iconColor});default:return e.jsx(n,{size:16,color:o.iconColor})}};return e.jsx("span",{className:`flex items-center justify-center w-8 h-8 rounded ${o.bgColor}`,children:l()})}export{g as C,M as E,p as I};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as d,L as D}from"./components-CAx5ONX_.js";function F(r,l,x,$,E){const e=l?.scenarios?.find(t=>t.name===r.name),u=!!e?.startedAt,o=!!e?.screenshotStartedAt,k=!!e?.screenshotFinishedAt,p=!!e?.finishedAt,v=1800*1e3,g=o&&!k&&e?.screenshotStartedAt&&Date.now()-new Date(e.screenshotStartedAt).getTime()>v,a=!!r.metadata?.screenshotPaths?.[0]||!!r.metadata?.executionResult,s=o&&!k,c=e?.error,S=r.metadata?.executionResult?.error,i=[];if(l?.errors&&l.errors.length>0)for(const t of l.errors)i.push({source:`${t.phase} phase`,message:t.message});if(l?.steps)for(const t of l.steps)t.error&&i.push({source:t.name,message:t.error});const w=!a&&!c&&!S&&i.length>0,n=!!(c||S||g||w),j=g?"Capture timed out after 30 minutes":(typeof c=="string"?c:null)||S?.message||(w?`Analysis error: ${i[0].message}`:null),L=g?"The capture process has been running for more than 30 minutes and likely got stuck. Consider re-running the analysis.":e?.errorStack||S?.stack||null,A=($&&E?E.jobs.some(t=>t.entityShas?.includes($)||t.type==="analysis"&&t.entityShas&&t.entityShas.length===0)||E.currentlyExecuting?.entityShas?.includes($):!1)&&!u&&!n||!!e?.analyzing&&!u&&!n,C=u&&!o&&!p&&!n,M=(A||C||s)&&!n,h=(A||C)&&x===!1&&!a;let m;h?m="crashed":n?m="error":a||p?m="completed":s?m="capturing":C?m="starting":A?m="queued":m="pending";let b="đˇ",f="pending",T=!1,y=`Not captured: ${r.name}`;const R=n||h?"border-red-300":"border-gray-300",z=n||h?"bg-red-50":"bg-gray-50";return n||h?(b="â ī¸",f="error",y=`Error: ${h?"Analysis process crashed":j||"Unknown error"}`):A?(b="âąī¸",f="queued",y=`Queued: ${r.name}`):C?(b="âī¸",f="starting",T=!0,y=`Starting server for ${r.name}...`):s&&!n?(b="đ",f="capturing",T=!0,y=`Capturing ${r.name}...`):a&&(b="â",f="completed",y=r.name),{hasError:n||h,errorMessage:h?"Analysis process crashed":j,errorStack:h?"Process terminated unexpectedly before completing analysis":L,isCapturing:s,isCaptured:a,hasCrashed:h,isAnalyzing:M,isQueued:A,isServerStarting:C,status:m,icon:b,iconType:f,shouldSpin:T,title:y,borderColor:R,bgColor:z}}function P({scenario:r,entitySha:l,size:x="medium",showBorder:$=!0,isOutdated:E=!1}){const e=F(r,void 0,void 0,l,void 0),u=r.metadata?.executionResult,o=!!u,p=(r.metadata?.data?.argumentsData||[]).length,v=u?.returnValue!==void 0&&u?.returnValue!==null,g=u?.sideEffects?.consoleOutput?.length||0,a=u?.timing?.duration||0;let s=0;p>0&&s++,p>2&&s++,v&&s++,g>0&&s++,s=Math.min(3,s);const c=x==="small"?{width:"w-[50px]",height:"h-[38px]",iconSize:"text-base",textSize:"text-[8px]"}:{width:"w-20",height:"h-15",iconSize:"text-xl",textSize:"text-[10px]"},i=e.hasError?{border:"border-red-400",bg:"bg-red-50",icon:"text-red-600",badge:"bg-red-100 text-red-700"}:o?E?{border:"border-amber-500",bg:"bg-amber-50",icon:"text-amber-700",badge:"bg-amber-100 text-amber-700"}:{border:"border-blue-400",bg:"bg-blue-50",icon:"text-blue-600",badge:"bg-blue-100 text-blue-700"}:{border:"border-gray-300 border-dashed",bg:"bg-gray-50",icon:"text-gray-400",badge:"bg-gray-100 text-gray-600"},w=$?`border-2 ${i.border}`:"",n=Array.from({length:3},(L,N)=>d.jsx("div",{className:`w-1 h-1 rounded-full ${N<s?i.icon.replace("text-","bg-"):"bg-gray-300"}`},N)),j=e.hasError?`Error: ${e.errorMessage||"Unknown error"}`:o?`${r.name}
|
|
2
|
-
${p} args â ${v?"value":"void"}${g>0?` (${g} logs)`:""}
|
|
3
|
-
${a}ms`:`Not executed: ${r.name}`;return d.jsxs(D,{to:`/entity/${l}/scenarios/${r.id}`,className:`relative ${c.width} ${c.height} ${w} rounded ${i.bg} flex flex-col items-center justify-center gap-0.5 cursor-pointer transition-all hover:scale-105 hover:shadow-md`,title:j,children:[d.jsx("div",{className:`${i.icon} ${c.iconSize} font-mono font-bold`,children:e.hasError?"â ":o?"Æ":"â"}),o&&!e.hasError&&d.jsxs("div",{className:`flex items-center gap-0.5 ${c.textSize} ${i.badge} px-1 rounded`,children:[d.jsx("span",{children:p}),d.jsx("span",{children:"â"}),d.jsx("span",{children:v?"â":"â
"})]}),o&&!e.hasError&&x==="medium"&&d.jsx("div",{className:"flex gap-0.5 mt-0.5",children:n}),o&&!e.hasError&&a>100&&x==="medium"&&d.jsx("div",{className:`absolute top-0.5 right-0.5 ${c.textSize} ${i.badge} px-1 rounded`,children:a>1e3?`${Math.round(a/1e3)}s`:`${a}ms`}),o&&!e.hasError&&g>0&&x==="medium"&&d.jsxs("div",{className:"absolute bottom-0.5 left-0.5 text-[8px] text-gray-500",children:["đ",g]})]})}export{P as L,F as g};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,j as e}from"./components-CAx5ONX_.js";function j({screenshotPath:a,cacheBuster:l,alt:x,className:f="",title:o}){const[n,s]=t.useState("loading"),[i,r]=t.useState(!1),c=t.useRef(null),d=l?`/api/screenshot/${a}?cb=${l}`:`/api/screenshot/${a}`,m=()=>{s("success"),r(!0)},g=()=>{s("error"),r(!1)};return t.useEffect(()=>{s("loading"),r(!1);const u=c.current;u?.complete&&(u.naturalHeight!==0?(s("success"),r(!0)):(s("error"),r(!1)))},[d]),a?e.jsxs("div",{className:"relative w-full h-full flex items-center justify-center",title:o,children:[e.jsx("img",{ref:c,src:d,alt:x,onLoad:m,onError:g,className:f||"max-w-full max-h-full object-contain",style:{visibility:i?"visible":"hidden",position:i?"relative":"absolute"}}),n==="loading"&&e.jsx("div",{className:"absolute inset-0 bg-gray-100 animate-pulse rounded flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),n==="error"&&e.jsxs("div",{className:"absolute inset-0 border-2 border-dashed border-gray-300 bg-gray-50 rounded flex flex-col items-center justify-center text-xs gap-1",children:[e.jsx("span",{className:"text-2xl text-gray-400",children:"đˇ"}),e.jsx("span",{className:"text-gray-400 whitespace-nowrap",children:"No Screenshot"})]})]}):e.jsx("div",{className:"w-full h-full border-2 border-dashed border-gray-300 bg-gray-50 rounded flex flex-col items-center justify-center text-xs gap-1",title:o,children:e.jsx("span",{className:"text-2xl text-gray-400",children:"đˇ"})})}export{j as S};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,L as m}from"./components-CAx5ONX_.js";import{S}from"./SafeScreenshot-xwuhwsZH.js";import{L as b,g as C}from"./LibraryFunctionPreview-p0fuyqGQ.js";import{c as h}from"./createLucideIcon-CgyOwWip.js";import{C as v}from"./circle-alert-GwwOAbhw.js";const N=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],d=h("camera",N);const $=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],w=h("circle-check-big",$);function D({scenario:t,entity:n,analysisStatus:u,queueState:x,processIsRunning:p,size:s="medium",cacheBuster:f,className:y="",viewMode:l}){if(n.entityType==="library")return e.jsx(b,{scenario:t,entitySha:n.sha,size:s==="small"?"small":"medium"});const r=C(t,u,p,n.sha,x),i=s==="small"?{containerClass:"w-16 h-12",iconSize:"text-xl"}:s==="large"?{containerClass:"w-full h-[67px]",iconSize:"text-2xl"}:{containerClass:"w-20 h-15",iconSize:"text-2xl"},c=`relative ${i.containerClass} ${y}`,o=()=>{const a=`/entity/${n.sha}/scenarios/${t.id}`;return l?`${a}/${l}`:a};if(r.isCaptured){const a=t.metadata?.screenshotPaths?.[0];return e.jsx(m,{to:o(),className:`${c} rounded overflow-hidden bg-gray-50 cursor-pointer transition-all flex items-center justify-center hover:scale-105 hover:shadow-md`,children:e.jsx(S,{screenshotPath:a,cacheBuster:f,alt:t.name,title:t.name,className:"max-w-full max-h-full object-contain object-center"})})}const j=()=>{const a={size:s==="small"?16:s==="large"?24:20,strokeWidth:2};if(r.shouldSpin){const g=s==="small"?"text-base":s==="large"?"text-2xl":"text-xl";return e.jsxs("div",{className:`${g} font-bold tracking-widest`,children:[e.jsx("span",{className:"animate-pulse",children:"."}),e.jsx("span",{className:"animate-pulse",style:{animationDelay:"0.2s"},children:"."}),e.jsx("span",{className:"animate-pulse",style:{animationDelay:"0.4s"},children:"."})]})}switch(r.iconType){case"queued":case"starting":case"capturing":return e.jsx(d,{...a});case"error":return e.jsx(v,{...a});case"completed":return e.jsx(w,{...a});case"pending":default:return e.jsx(d,{...a})}};return e.jsx(m,{to:o(),className:`${c} rounded ${r.bgColor} flex flex-col items-center justify-center cursor-pointer transition-all hover:scale-105 hover:shadow-md`,title:r.title,children:e.jsx("div",{className:i.iconSize,children:j()})})}export{w as C,D as S};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{r as o,j as e,b as Z,L as ee}from"./components-CAx5ONX_.js";import{a as se,I as te}from"./InteractivePreview-Dh-FldQK.js";import{L as re}from"./LogViewer-Dp6DC845.js";import{S as ae}from"./SafeScreenshot-xwuhwsZH.js";import{u as ne}from"./useLastLogLine-BBlyqxij.js";function ie({presets:r,customSizes:x,currentWidth:l,currentHeight:n,scale:b,onSizeChange:v,onSaveCustomSize:u,onRemoveCustomSize:t,className:c=""}){const[a,d]=o.useState(!1),[m,I]=o.useState(String(l)),[k,N]=o.useState(String(n)),[h,p]=o.useState(!1),[f,y]=o.useState(!1),S=o.useRef(null);o.useEffect(()=>{h||I(String(l))},[l,h]),o.useEffect(()=>{f||N(String(n))},[n,f]),o.useEffect(()=>{const s=w=>{S.current&&!S.current.contains(w.target)&&d(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]);const P=o.useMemo(()=>{const s=r.find(g=>g.width===l&&g.height===n);if(s)return s.name;const w=x.find(g=>g.width===l&&g.height===n);return w?w.name:"Custom"},[r,x,l,n]),A=P==="Custom",M=s=>{v(s.width,s.height),d(!1)},E=s=>{const w=s.target.value;I(w);const g=parseInt(w,10);!isNaN(g)&&g>0&&v(g,n)},D=s=>{const w=s.target.value;N(w);const g=parseInt(w,10);!isNaN(g)&&g>0&&v(l,g)},B=()=>{p(!1);const s=parseInt(m,10);(isNaN(s)||s<=0)&&I(String(l))},C=()=>{y(!1);const s=parseInt(k,10);(isNaN(s)||s<=0)&&N(String(n))},$=s=>{(s.key==="Enter"||s.key==="Escape")&&s.target.blur()};return e.jsxs("div",{className:`flex items-center gap-3 ${c}`,children:[e.jsxs("div",{className:"relative",ref:S,children:[e.jsxs("button",{onClick:()=>d(!a),className:"flex items-center gap-2 px-3 py-1.5 bg-white border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-[#005c75] focus:ring-offset-1 min-w-[120px] justify-between",children:[e.jsx("span",{children:P}),e.jsx("svg",{className:`w-4 h-4 transition-transform ${a?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&e.jsx("div",{className:"absolute top-full left-0 mt-1 min-w-full bg-white border border-gray-200 rounded-md shadow-lg z-50",children:e.jsxs("div",{className:"py-1",children:[r.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 py-1 text-xs font-semibold text-gray-500 uppercase tracking-wider whitespace-nowrap",children:"Presets"}),r.map(s=>e.jsxs("button",{onClick:()=>M(s),className:`w-full text-left px-3 py-2 text-sm hover:bg-gray-100 flex justify-between items-center gap-4 whitespace-nowrap ${P===s.name?"bg-[#f0f7f9] text-[#005c75]":"text-gray-700"}`,children:[e.jsx("span",{children:s.name}),e.jsxs("span",{className:"text-xs text-gray-500",children:[s.width," x ",s.height]})]},s.name))]}),x.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t border-gray-100 my-1"}),e.jsx("div",{className:"px-3 py-1 text-xs font-semibold text-gray-500 uppercase tracking-wider whitespace-nowrap",children:"Custom"}),[...x].sort((s,w)=>s.width-w.width).map(s=>e.jsxs("div",{className:`flex items-center gap-1 hover:bg-gray-100 ${P===s.name?"bg-[#f0f7f9] text-[#005c75]":"text-gray-700"}`,children:[e.jsxs("button",{onClick:()=>M(s),className:"flex-1 text-left px-3 py-2 text-sm flex justify-between items-center gap-4 whitespace-nowrap cursor-pointer",children:[e.jsx("span",{children:s.name}),e.jsxs("span",{className:"text-xs text-gray-500",children:[s.width," x ",s.height]})]}),t&&e.jsx("button",{onClick:w=>{w.stopPropagation(),P===s.name&&r.length>0&&v(r[0].width,r[0].height),t(s.name)},className:"p-1.5 mr-1 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded cursor-pointer transition-colors",title:"Remove custom size",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},s.name))]})]})})]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("input",{type:"text",value:m,onChange:E,onFocus:()=>p(!0),onBlur:B,onKeyDown:$,className:"w-16 px-2 py-1 text-right border border-gray-300 rounded-l-md text-sm focus:outline-none focus:ring-2 focus:ring-[#005c75] focus:border-[#005c75]"}),e.jsx("span",{className:"px-2 py-1 bg-gray-100 border border-l-0 border-gray-300 rounded-r-md text-gray-500 text-sm",children:"px"})]}),e.jsx("span",{className:"text-gray-400 mx-1",children:"Ã"}),e.jsxs("div",{className:"flex items-center",children:[e.jsx("input",{type:"text",value:k,onChange:D,onFocus:()=>y(!0),onBlur:C,onKeyDown:$,className:"w-16 px-2 py-1 text-right border border-gray-300 rounded-l-md text-sm focus:outline-none focus:ring-2 focus:ring-[#005c75] focus:border-[#005c75]"}),e.jsx("span",{className:"px-2 py-1 bg-gray-100 border border-l-0 border-gray-300 rounded-r-md text-gray-500 text-sm",children:"px"})]}),b!==void 0&&b<1&&e.jsxs("span",{className:"text-xs text-gray-500 ml-1",children:["(",Math.round(b*100),"%)"]})]}),A&&e.jsx("button",{onClick:u,className:"px-3 py-1.5 bg-[#005c75] text-white text-sm font-medium rounded-md hover:bg-[#004a5c] focus:outline-none focus:ring-2 focus:ring-[#005c75] focus:ring-offset-1 transition-colors",children:"Save Custom Size"})]})}function oe({scenario:r,analysis:x,entity:l}){const n=r.metadata?.executionResult||null,b=r.metadata?.data?.argumentsData||[],v=u=>{if(!u)return"No execution results available yet. Run the function to capture side effects including console output, file operations, and API calls.";const t=[],c=u.sideEffects?.consoleOutput||[];c.length>0&&(t.push(`Console Output: ${c.length} log ${c.length===1?"entry":"entries"} captured`),c.forEach(m=>{t.push(` [${m.level.toUpperCase()}] ${m.args.join(" ")}`)}));const a=u.sideEffects?.fileWrites||[];a.length>0&&(t.push(`
|
|
2
|
-
File System Operations: ${a.length} ${a.length===1?"operation":"operations"} detected`),a.forEach(m=>{t.push(` ${m.operation}: ${m.path}${m.size?` (${m.size} bytes)`:""}`)}));const d=u.sideEffects?.apiCalls||[];return d.length>0&&(t.push(`
|
|
3
|
-
API Calls: ${d.length} ${d.length===1?"call":"calls"} made`),d.forEach(m=>{t.push(` ${m.method} ${m.url}${m.status?` â ${m.status}`:""}${m.duration?` (${m.duration}ms)`:""}`)})),u.error&&t.push(`
|
|
4
|
-
Error: ${u.error.name||"Error"}: ${u.error.message}`),t.length===0?"No side effects detected. The function executed without console output, file operations, or API calls.":t.join(`
|
|
5
|
-
`)};return e.jsxs("div",{className:"flex w-full h-full gap-0",children:[e.jsxs("div",{className:"flex-1 border border-gray-200 bg-white rounded flex flex-col",children:[e.jsx("div",{className:"px-4 pt-3.5 pb-2.5",children:e.jsx("h3",{className:"text-[9px] font-semibold text-[#005c75] uppercase tracking-wide text-center m-0",children:"Input Data"})}),e.jsx("div",{className:"flex-1 overflow-auto px-4 pb-0",children:e.jsx("pre",{className:"text-xs font-mono text-gray-800 whitespace-pre-wrap break-words m-0",children:JSON.stringify(b,null,2)})})]}),e.jsxs("div",{className:"flex-1 border border-gray-200 bg-white rounded flex flex-col ml-[-1px]",children:[e.jsx("div",{className:"px-4 pt-3.5 pb-2.5",children:e.jsx("h3",{className:"text-[9px] font-semibold text-[#005c75] uppercase tracking-wide text-center m-0",children:"Returned Data"})}),e.jsx("div",{className:"flex-1 overflow-auto px-4 pb-0",children:n?e.jsx("pre",{className:"text-xs font-mono text-gray-800 whitespace-pre-wrap break-words m-0",children:n.returnValue!==void 0?JSON.stringify(n.returnValue,null,2):"undefined"}):e.jsx("div",{className:"text-sm text-gray-500 italic",children:"No execution results yet"})})]}),e.jsxs("div",{className:"flex-1 border border-gray-200 bg-white rounded flex flex-col ml-[-1px]",children:[e.jsx("div",{className:"px-4 pt-3.5 pb-2.5",children:e.jsx("h3",{className:"text-[9px] font-semibold text-[#005c75] uppercase tracking-wide text-center m-0",children:"Side Effects"})}),e.jsx("div",{className:"flex-1 overflow-auto px-4 pb-4",children:e.jsx("p",{className:"text-sm text-gray-700 leading-[22px] m-0 whitespace-pre-wrap",children:v(n)})})]})]})}const W=10,le=1024;function ce({currentViewportWidth:r,currentPresetName:x,onDevicePresetClick:l,devicePresets:n}){const[b,v]=o.useState(null),u=o.useRef(null),t=o.useMemo(()=>[...n].sort((h,p)=>h.width-p.width),[n]),{fittingPresets:c,overflowPresets:a}=o.useMemo(()=>{const h=[],p=[];for(const f of t)f.width<=le?h.push(f):p.push(f);return p.sort((f,y)=>y.width-f.width),{fittingPresets:h,overflowPresets:p}},[t]),d=o.useCallback(h=>{if(!u.current)return null;const p=u.current.getBoundingClientRect(),f=h-p.left,y=p.width,S=y/2,A=(c.length>0?c[c.length-1].width:0)/2,M=S-A,E=S+A,D=a.length>0?(a.length-1)*W:0;if(a.length>0){if(f<M){if(f<=D){const C=Math.min(Math.floor(f/W),a.length-1);return a[C]}return a[a.length-1]}if(f>E){const C=y-f;if(C<=D){const $=Math.min(Math.floor(C/W),a.length-1);return a[$]}return a[a.length-1]}}const B=Math.abs(f-S);for(let C=c.length-1;C>=0;C--){const $=c[C],s=c[C-1],w=$.width/2,g=s?s.width/2:0;if(B<=w&&B>=g)return $}return c[0]||a[a.length-1]||null},[c,a]),m=o.useCallback(h=>{const p=d(h.clientX);v(p)},[d]),I=o.useCallback(()=>{v(null)},[]),k=o.useCallback(h=>{const p=d(h.clientX);p&&l(p)},[d,l]),N=b||{name:x,width:r};return e.jsxs("div",{ref:u,className:"relative h-6 bg-[#f6f9fc] shrink-0 overflow-hidden cursor-pointer",onMouseMove:m,onMouseLeave:I,onClick:k,children:[e.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:e.jsx("div",{className:"h-full transition-all duration-100 bg-[rgba(0,92,117,0.15)]",style:{width:`${r}px`}})}),e.jsx("div",{className:"absolute inset-0 pointer-events-none",children:c.map(h=>{const p=h.width===r,f=b?.name===h.name,y=h.width/2;return e.jsxs("div",{children:[e.jsx("div",{className:"absolute top-0 bottom-0",style:{left:`calc(50% - ${y}px)`},children:e.jsx("div",{className:`w-0.5 h-full transition-colors duration-75 ${p||f?"bg-[#005c75]":"bg-[rgba(0,92,117,0.25)]"}`})}),e.jsx("div",{className:"absolute top-0 bottom-0",style:{left:`calc(50% + ${y}px)`},children:e.jsx("div",{className:`w-0.5 h-full transition-colors duration-75 ${p||f?"bg-[#005c75]":"bg-[rgba(0,92,117,0.25)]"}`})})]},h.name)})}),e.jsx("div",{className:"absolute inset-0 pointer-events-none",children:a.map((h,p)=>{const f=p*W,y=h.width===r,S=b?.name===h.name;return e.jsxs("div",{children:[e.jsx("div",{className:"absolute top-0 bottom-0",style:{left:`${f}px`},children:e.jsx("div",{className:`w-0.5 h-full transition-colors duration-75 ${y||S?"bg-[#005c75]":"bg-[rgba(0,92,117,0.25)]"}`})}),e.jsx("div",{className:"absolute top-0 bottom-0",style:{right:`${f}px`},children:e.jsx("div",{className:`w-0.5 h-full transition-colors duration-75 ${y||S?"bg-[#005c75]":"bg-[rgba(0,92,117,0.25)]"}`})})]},h.name)})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:e.jsxs("div",{className:`text-[10px] px-2 py-0.5 rounded shadow-sm whitespace-nowrap transition-colors ${b?"bg-[#005c75] text-white":"bg-white/90 text-[#005c75] border border-[rgba(0,92,117,0.25)]"}`,children:[N.name," - ",N.width,"px"]})})]})}function de({width:r,height:x,onSave:l,onCancel:n}){const[b,v]=o.useState(""),[u,t]=o.useState(""),c=()=>{const d=b.trim();if(!d){t("Please enter a name for this custom size");return}l(d)},a=d=>{d.key==="Enter"&&b.trim()&&c(),d.key==="Escape"&&n()};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center p-4 z-50",children:e.jsxs("div",{className:"bg-white rounded-lg max-w-md w-full p-6 shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Save Custom Size"}),e.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600 transition-colors","aria-label":"Close",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"mb-6 p-4 bg-gray-50 rounded-lg border border-gray-200",children:[e.jsx("div",{className:"text-sm text-gray-500 mb-1",children:"Dimensions"}),e.jsxs("div",{className:"text-lg font-medium text-gray-900",children:[r,"px à ",x,"px"]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{htmlFor:"custom-size-name",className:"block text-sm font-medium text-gray-700 mb-2",children:"Name"}),e.jsx("input",{id:"custom-size-name",type:"text",value:b,onChange:d=>{v(d.target.value),t("")},onKeyDown:a,placeholder:"e.g., iPhone 15 Pro",className:`w-full px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-[#005c75] focus:border-[#005c75] ${u?"border-red-300":"border-gray-300"}`,autoFocus:!0}),u&&e.jsx("p",{className:"mt-1 text-sm text-red-600",children:u})]}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx("button",{onClick:n,className:"px-4 py-2 bg-gray-100 text-gray-700 text-sm font-medium rounded-md hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-gray-300 transition-colors",children:"Cancel"}),e.jsx("button",{onClick:c,disabled:!b.trim(),className:"px-4 py-2 bg-[#005c75] text-white text-sm font-medium rounded-md hover:bg-[#004a5c] focus:outline-none focus:ring-2 focus:ring-[#005c75] focus:ring-offset-1 transition-colors disabled:bg-gray-300 disabled:cursor-not-allowed",children:"Save"})]})]})})}function xe(r){const[x,l]=o.useState([]),n=r?`codeyam-custom-sizes-${r}`:null;o.useEffect(()=>{if(!n||typeof window>"u"){l([]);return}try{const t=localStorage.getItem(n);if(t){const c=JSON.parse(t);Array.isArray(c)&&l(c)}}catch(t){console.error("[useCustomSizes] Failed to load custom sizes:",t),l([])}},[n]);const b=o.useCallback(t=>{if(!(!n||typeof window>"u"))try{localStorage.setItem(n,JSON.stringify(t))}catch(c){console.error("[useCustomSizes] Failed to save custom sizes:",c)}},[n]),v=o.useCallback((t,c,a)=>{l(d=>{const m=d.findIndex(N=>N.name===t),I={name:t,width:c,height:a};let k;return m>=0?(k=[...d],k[m]=I):k=[...d,I],b(k),k})},[b]),u=o.useCallback(t=>{l(c=>{const a=c.filter(d=>d.name!==t);return b(a),a})},[b]);return{customSizes:x,addCustomSize:v,removeCustomSize:u}}const X=1440,_=[{name:"Mobile",width:375,height:667},{name:"Tablet",width:768,height:1024},{name:"Laptop",width:1024,height:768},{name:"Desktop",width:1440,height:900}];function ge({selectedScenario:r,analysis:x,entity:l,viewMode:n,cacheBuster:b,hasScenarios:v,isAnalyzing:u=!1,projectSlug:t,hasAnApiKey:c=!0}){const a=Z(),[d,m]=o.useState(!1),[I,k]=o.useState(!1),[N,h]=o.useState({name:"Desktop",width:X,height:900}),[p,f]=o.useState(X),[y,S]=o.useState(1),{customSizes:P,addCustomSize:A,removeCustomSize:M}=xe(t),E=o.useMemo(()=>[..._,...P],[P]),D=(i,j)=>{f(i);const O=E.find(z=>z.width===i&&z.height===j);h({name:O?.name||"Custom",width:i,height:j})},B=i=>{f(i.width),h({name:i.name,width:i.width,height:i.height})},C=i=>{A(i,N.width,N.height??900),k(!1),h(j=>({...j,name:i}))},$=(i,j)=>{f(i);const O=E.find(z=>z.width===i&&z.height===j);h(z=>({name:O?.name||"Custom",width:i,height:z.height}))},s=r?.metadata?.screenshotPaths?.[0],w=o.useMemo(()=>!r||!x?.status?.scenarios?null:x.status.scenarios.find(i=>i.name===r.name),[r,x?.status?.scenarios]),g=o.useMemo(()=>{const i=[];if(x?.status?.errors&&x.status.errors.length>0)for(const j of x.status.errors)i.push({source:`${j.phase} phase`,message:j.message,stack:j.stack});if(x?.status?.steps)for(const j of x.status.steps)j.error&&i.push({source:j.name,message:j.error,stack:j.errorStack});return i},[x?.status?.errors,x?.status?.steps]),L=w?.error||(r?.metadata?.error?"Error during capture":null),V=w?.errorStack,{interactiveServerUrl:K,isStarting:H,isLoading:J,showIframe:U,iframeKey:G,onIframeLoad:q}=se({analysisId:x?.id,scenarioId:r?.id,scenarioName:r?.name,projectSlug:t,enabled:n==="interactive"}),T=o.useMemo(()=>K||null,[K]),R=!u&&v&&r&&!r.metadata?.screenshotPaths?.[0]&&x?.status?.scenarios?.some(i=>i.name===r.name&&i.screenshotStartedAt&&!i.screenshotFinishedAt),{lastLine:F}=ne(t,u||n==="interactive"||R||!1);if(!r)return!v&&l?u?e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-12 text-center bg-[#f6f9fc]",children:e.jsxs("div",{className:"flex flex-col items-center gap-6 max-w-2xl",children:[e.jsx("div",{className:"w-12 h-12 mb-2",children:e.jsx("svg",{className:"animate-spin",viewBox:"0 0 50 50",children:e.jsx("circle",{cx:"25",cy:"25",r:"20",fill:"none",stroke:"#005c75",strokeWidth:"4",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})})}),e.jsx("h2",{className:"text-2xl font-semibold text-[#005c75] leading-[30px] m-0 font-['IBM_Plex_Sans']",children:R?"Capturing screenshots...":"Analyzing..."}),e.jsx("p",{className:"text-xs text-[#8e8e8e] text-center leading-5 m-0 font-['IBM_Plex_Mono']",children:"This may take a few minutes."}),F&&e.jsx("p",{className:"text-xs font-mono text-[#005c75] text-center leading-5 m-0 max-w-xl",children:F}),t&&e.jsx("button",{onClick:()=>m(!0),className:"w-[148px] px-2.5 py-[5px] bg-[#005c75] text-white border-none rounded-sm text-xs font-medium cursor-pointer transition-colors hover:bg-[#004a5c] font-['IBM_Plex_Sans']",children:"View full logs"})]})}):g.length>0?e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-6 bg-[#f6f9fc] overflow-auto",children:e.jsxs("div",{className:"bg-red-50 border-2 border-red-300 rounded-lg p-8 w-full max-w-4xl",children:[e.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[e.jsx("span",{className:"text-red-500 text-4xl shrink-0",children:"â ī¸"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-xl font-semibold text-red-800 m-0 mb-3",children:"Analysis Failed"}),e.jsx("p",{className:"text-sm text-red-700 m-0 mb-4",children:g.length===1?"An error occurred during analysis. No scenarios were generated.":`${g.length} errors occurred during analysis. No scenarios were generated.`}),g.map((i,j)=>e.jsxs("div",{className:"bg-white border border-red-200 rounded p-4 mb-4 last:mb-0",children:[e.jsx("h4",{className:"text-xs font-semibold text-red-800 m-0 mb-2 uppercase tracking-wide",children:i.source}),e.jsx("div",{className:"max-h-[200px] overflow-auto",children:e.jsx("p",{className:"text-sm text-red-900 m-0 font-mono whitespace-pre-wrap wrap-break-word",children:i.message})}),i.stack&&e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{className:"text-xs text-red-700 cursor-pointer hover:text-red-900 font-semibold",children:"View stack trace"}),e.jsx("div",{className:"mt-2 bg-red-50 border border-red-200 rounded p-3 max-h-[200px] overflow-auto",children:e.jsx("pre",{className:"text-xs text-red-900 font-mono whitespace-pre-wrap wrap-break-word m-0",children:i.stack})})]})]},j))]})]}),l.filePath&&e.jsx("div",{className:"flex justify-center mt-4",children:e.jsx("button",{onClick:()=>{a.submit({entitySha:l.sha,filePath:l.filePath},{method:"post",action:"/api/analyze"})},disabled:a.state!=="idle",className:"h-[42px] px-6 py-2 bg-[#005c75] text-white border-none rounded-lg text-sm font-medium cursor-pointer transition-all hover:bg-[#004a5e] disabled:bg-gray-400 disabled:cursor-not-allowed",children:a.state!=="idle"?"Retrying...":"Retry Analysis"})})]})}):e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center bg-[#f6f9fc]",children:e.jsxs("div",{className:"max-w-[600px]",children:[e.jsx("h2",{className:"text-[28px] font-semibold text-[#343434] mb-4 m-0 leading-10",children:"No simulations yet"}),e.jsx("p",{className:"text-base font-normal text-[#3e3e3e] mb-8 leading-6 m-0",children:"Analyze the code to create simulations and create test scenarios automatically."}),l.filePath&&e.jsx("button",{onClick:()=>{a.submit({entitySha:l.sha,filePath:l.filePath},{method:"post",action:"/api/analyze"})},disabled:a.state!=="idle",className:"h-[54px] w-[183px] px-2.5 py-[5px] bg-[#005c75] text-white border-none rounded-lg text-base font-medium cursor-pointer transition-all hover:bg-[#004a5e] disabled:bg-gray-400 disabled:cursor-not-allowed",children:a.state!=="idle"?"Analyzing...":"Analyze"})]})}):e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center",children:e.jsx("p",{className:"text-base text-gray-500 m-0",children:"Select a scenario to view its screenshot"})});const Y=n==="screenshot"&&(s||L)||n==="interactive"&&(T||H)||n==="data",Q=(u||R)&&!s&&!L&&n==="screenshot";return e.jsxs(e.Fragment,{children:[e.jsx("main",{className:"flex-1 bg-[#f9f9f9] overflow-auto flex flex-col min-w-0",children:Q?e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center bg-linear-to-br from-blue-50 to-indigo-50",children:e.jsxs("div",{className:"max-w-2xl w-full bg-white rounded-2xl shadow-xl p-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-24 h-24 bg-blue-100 rounded-full mb-6",children:e.jsx("span",{className:"text-5xl animate-spin",children:"âī¸"})}),e.jsx("h2",{className:"text-3xl font-bold text-gray-900 mb-4 m-0",children:R?`Capturing ${l?.name}`:`Analyzing ${l?.name}`}),e.jsx("p",{className:"text-base text-gray-600 leading-relaxed m-0 mb-2",children:R?`Taking screenshots for ${x?.scenarios?.length||0} scenario${x?.scenarios?.length!==1?"s":""}...`:`Generating simulations and scenarios for this ${l?.entityType} entity...`}),r&&e.jsxs("p",{className:"text-sm text-blue-600 font-semibold m-0",children:["Currently processing: ",r.name]})]}),F&&e.jsx("div",{className:"bg-[#f6f9fc] border-2 border-[#e1e1e1] rounded-lg p-6 mb-6",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-xl shrink-0",children:"đ"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-xs font-semibold text-gray-700 uppercase tracking-wide mb-2 m-0",children:"Current Progress"}),e.jsx("p",{className:"text-sm text-gray-900 font-mono wrap-break-word m-0",title:F,children:F})]})]})}),t&&e.jsx("button",{onClick:()=>m(!0),className:"px-6 py-3 bg-[#005c75] text-white border-none rounded-lg text-base font-semibold cursor-pointer transition-all hover:bg-[#004a5e] hover:shadow-lg",children:"đ View Full Logs"}),e.jsx("p",{className:"text-xs text-gray-500 mt-8 m-0",children:"Screenshots will appear here as they are captured. This may take a few minutes."})]})}):Y?e.jsxs(e.Fragment,{children:[L&&!s&&e.jsx("div",{className:"bg-red-50 border-l-4 border-red-500 mx-5 mt-4 p-4 rounded-r max-h-[400px] overflow-auto",role:"alert",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-red-500 text-xl shrink-0","aria-hidden":"true",children:"â ī¸"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-sm font-semibold text-red-800 m-0 mb-2",children:"Capture Error"}),e.jsx("div",{className:"max-h-[200px] overflow-auto",children:e.jsx("p",{className:"text-sm text-red-700 m-0 mb-2 font-mono whitespace-pre-wrap wrap-break-word",children:L})}),V&&e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{className:"text-xs text-red-600 cursor-pointer hover:text-red-800 font-medium",children:"View stack trace"}),e.jsx("div",{className:"mt-2 p-3 bg-red-100 rounded max-h-[300px] overflow-auto",children:e.jsx("pre",{className:"text-xs text-red-900 font-mono whitespace-pre-wrap wrap-break-word m-0",children:V})})]})]})]})}),n==="interactive"?e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[T&&e.jsx("div",{className:"bg-gray-50 border-b border-gray-200 px-6 py-3 shrink-0 flex justify-center",children:e.jsx(ie,{presets:[..._],customSizes:P,currentWidth:N.width,currentHeight:N.height??900,scale:y,onSizeChange:D,onSaveCustomSize:()=>k(!0),onRemoveCustomSize:M})}),T&&e.jsx("div",{className:"bg-[#f6f9fc] border-b border-[rgba(0,92,117,0.25)] flex justify-center",children:e.jsx("div",{style:{maxWidth:`${_[_.length-1].width}px`,width:"100%"},children:e.jsx(ce,{currentViewportWidth:p,currentPresetName:N.name,onDevicePresetClick:B,devicePresets:E})})}),e.jsx(te,{scenarioId:r.id,scenarioName:r.name,iframeUrl:T,isStarting:H,isLoading:J,showIframe:U,iframeKey:G,onIframeLoad:q,onScaleChange:S,onDimensionChange:$,projectSlug:t,defaultWidth:N.width,defaultHeight:N.height})]}):n==="data"?e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(oe,{scenario:r,analysis:x,entity:l})}):e.jsx("div",{className:"flex-1 flex flex-col",children:e.jsx("div",{className:"flex-1 p-6 flex items-center justify-center",children:e.jsx("div",{className:"transition-all duration-300",style:{maxWidth:`${p}px`},children:(s||!L)&&e.jsx(ae,{screenshotPath:s,cacheBuster:b,alt:r.name,className:"w-full rounded-lg shadow-[0_10px_25px_rgba(0,0,0,0.1)] bg-white"})})})})]}):e.jsx("div",{className:"flex-1 flex flex-col",children:e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-6 overflow-auto w-full",children:u&&!s?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("div",{className:"bg-blue-50 border-2 border-blue-200 rounded-lg p-8",children:e.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[e.jsx("span",{className:"animate-spin text-4xl shrink-0",children:"âī¸"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-xl font-semibold text-blue-900 m-0 mb-3",children:"Capturing Screenshot"}),e.jsxs("p",{className:"text-sm text-blue-800 m-0 mb-4",children:["Analysis is in progress for"," ",e.jsx("strong",{children:r.name}),". The screenshot will appear here once capture is complete."]}),F&&e.jsxs("div",{className:"bg-white border border-blue-200 rounded p-4 mt-4",children:[e.jsx("h4",{className:"text-xs font-semibold text-blue-800 m-0 mb-2 uppercase tracking-wide",children:"Current Progress"}),e.jsx("p",{className:"text-sm text-blue-900 m-0 font-mono wrap-break-word",children:F})]}),t&&e.jsx("button",{onClick:()=>m(!0),className:"mt-4 px-4 py-2 bg-[#005c75] text-white border-none rounded-md text-sm font-semibold cursor-pointer transition-colors hover:bg-[#004a5e]",children:"đ View Full Logs"})]})]})})}):L?e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center overflow-auto gap-6",children:[!c&&e.jsx("div",{className:"bg-blue-50 border-2 border-blue-300 rounded-lg p-8",children:e.jsxs("div",{className:"flex-1 flex flex-col gap-4 items-center justify-center",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("span",{className:"text-blue-600 text-2xl shrink-0",children:"đ"}),e.jsx("h3",{className:"text-xl font-semibold text-blue-900 m-0 mb-3",children:"Improve Analysis Quality with an API Key"})]}),e.jsxs("div",{className:"bg-white border border-blue-200 rounded p-4",children:[e.jsx("h4",{className:"text-xs font-semibold text-blue-900 m-0 mb-2 uppercase tracking-wide",children:"CodeYam requires an AI API key for reliable analysis."}),e.jsxs("ul",{className:"text-sm text-blue-800 m-0 space-y-1 pl-5 list-disc",children:[e.jsx("li",{children:"You can use API keys for a variety of models"}),e.jsx("li",{children:"Faster analysis processing"}),e.jsx("li",{children:"Better handling of complex code structures"}),e.jsx("li",{children:"Improved scenario generation quality"})]})]}),e.jsx(ee,{to:"/settings",className:"inline-block px-4 py-2 bg-blue-600 text-white border-none rounded-md text-sm font-semibold cursor-pointer transition-colors hover:bg-blue-700",children:"đ Configure API Keys"})]})}),e.jsx("div",{className:"bg-red-50 border-2 border-red-300 rounded-lg p-8 w-full max-w-4xl my-auto",children:e.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[e.jsx("span",{className:"text-red-500 text-4xl shrink-0",children:"â ī¸"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-xl font-semibold text-red-800 m-0 mb-3",children:"Capture Failed"}),e.jsx("p",{className:"text-sm text-red-700 m-0 mb-4",children:"An error occurred while capturing this scenario. No screenshot is available."}),e.jsxs("div",{className:"bg-white border border-red-200 rounded p-4",children:[e.jsx("h4",{className:"text-xs font-semibold text-red-800 m-0 mb-2 uppercase tracking-wide",children:"Error Message"}),e.jsx("div",{className:"max-h-[300px] overflow-auto",children:e.jsx("p",{className:"text-sm text-red-900 m-0 font-mono whitespace-pre-wrap wrap-break-word",children:L})})]}),V&&e.jsxs("details",{className:"mt-4",children:[e.jsx("summary",{className:"text-sm text-red-700 cursor-pointer hover:text-red-900 font-semibold",children:"đ View full stack trace"}),e.jsx("div",{className:"mt-3 bg-white border border-red-200 rounded p-4 max-h-[400px] overflow-auto",children:e.jsx("pre",{className:"text-xs text-red-900 font-mono whitespace-pre-wrap wrap-break-word m-0",children:V})})]})]})]})})]}):g.length>0?e.jsx("div",{className:"w-full h-full flex items-center justify-center overflow-auto",children:e.jsx("div",{className:"bg-red-50 border-2 border-red-300 rounded-lg p-8 w-full max-w-4xl my-auto",children:e.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[e.jsx("span",{className:"text-red-500 text-4xl shrink-0",children:"â ī¸"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-xl font-semibold text-red-800 m-0 mb-3",children:"Analysis Error"}),e.jsx("p",{className:"text-sm text-red-700 m-0 mb-4",children:g.length===1?"An error occurred during analysis. Screenshot capture was not completed.":`${g.length} errors occurred during analysis. Screenshot capture was not completed.`}),g.map((i,j)=>e.jsxs("div",{className:"bg-white border border-red-200 rounded p-4 mb-4 last:mb-0",children:[e.jsx("h4",{className:"text-xs font-semibold text-red-800 m-0 mb-2 uppercase tracking-wide",children:i.source}),e.jsx("div",{className:"max-h-[200px] overflow-auto",children:e.jsx("p",{className:"text-sm text-red-900 m-0 font-mono whitespace-pre-wrap wrap-break-word",children:i.message})}),i.stack&&e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{className:"text-xs text-red-700 cursor-pointer hover:text-red-900 font-semibold",children:"View stack trace"}),e.jsx("div",{className:"mt-2 bg-red-50 border border-red-200 rounded p-3 max-h-[200px] overflow-auto",children:e.jsx("pre",{className:"text-xs text-red-900 font-mono whitespace-pre-wrap wrap-break-word m-0",children:i.stack})})]})]},j))]})]})})}):e.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[e.jsx("span",{className:"text-6xl text-gray-300",children:"đˇ"}),e.jsx("p",{className:"text-lg text-gray-500 m-0",children:"No screenshot available for this scenario"}),e.jsx("p",{className:"text-sm text-gray-400 m-0",children:"Try recapturing or debugging this scenario"})]})})})}),d&&t&&e.jsx(re,{projectSlug:t,onClose:()=>m(!1)}),I&&e.jsx(de,{width:N.width,height:N.height??900,onSave:C,onCancel:()=>k(!1)})]})}export{ge as S};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as J,b as K,d as ee,r as d,j as e,L as m}from"./components-CAx5ONX_.js";import{u as se}from"./useLastLogLine-BBlyqxij.js";import{u as te,C as le}from"./useToast-C_VxoXTh.js";import{L as ne}from"./LogViewer-Dp6DC845.js";import{I as b,C as V,E as ae}from"./EntityTypeIcon-GqWwt5wG.js";import{S as H}from"./SafeScreenshot-xwuhwsZH.js";import{c as re}from"./createLucideIcon-CgyOwWip.js";import{S as ie}from"./settings-MZc4XdmE.js";import{Z as oe}from"./zap-B4gsLUZQ.js";import{L as w}from"./loader-circle-DN7Vr40D.js";import"./chart-column-B2I7jQx2.js";const ce=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],de=re("folder-open",ce),Ne=()=>[{title:"Dashboard - CodeYam"},{name:"description",content:"CodeYam project dashboard"}];function we(){const{stats:j,uncommittedFiles:g,uncommittedEntitiesList:C,recentSimulations:h,visualEntitiesForSimulation:y,projectSlug:v,queueState:F,currentCommit:_}=J(),i=K(),W=ee(),{showToast:x}=te(),[I,P]=d.useState(new Set),[o,T]=d.useState(null),[R,A]=d.useState(!1),[L,k]=d.useState(!1),{lastLine:S,isCompleted:z,resetLogs:Z}=se(v,!!o),{simulatingEntity:f,scenarios:N,scenarioStatuses:U,allScenariosCaptured:E}=d.useMemo(()=>{const s={simulatingEntity:null,scenarios:[],scenarioStatuses:[],allScenariosCaptured:!1};if(!o)return s;const t=y?.find(r=>r.sha===o);if(!t)return s;const l=t.analyses?.[0],a=l?.scenarios||[],n=l?.status?.scenarios||[],u=n.filter(r=>r.screenshotFinishedAt).length,p=a.length>0&&u===a.length;return{simulatingEntity:t,scenarios:a,scenarioStatuses:n,allScenariosCaptured:p}},[o,y]);d.useEffect(()=>{(z||E)&&T(null)},[z,E]);const q=_?.metadata?.currentRun,$=new Set(q?.currentEntityShas||[]),M=new Set(F.jobs.flatMap(s=>s.entityShas||[])),B=new Set(F.currentlyExecuting?.entityShas||[]),D=C.filter(s=>s.entityType==="visual"||s.entityType==="library"),c=D.filter(s=>!$.has(s.sha)&&!M.has(s.sha)&&!B.has(s.sha)),Q=()=>{if(c.length===0){x("All entities are already queued or analyzing","info",3e3);return}console.log("Analyzing uncommitted entities not yet queued:",c.length),console.log("Entity SHAs:",c.map(s=>s.sha)),k(!0),x(`Starting analysis for ${c.length} entities...`,"info",3e3),i.submit({entityShas:c.map(s=>s.sha).join(",")},{method:"post",action:"/api/analyze"})};d.useEffect(()=>{if(i.state==="idle"&&i.data){const s=i.data;s.success?(console.log("[Analyze All] Success:",s.message),x(`Analysis started for ${s.entityCount} entities in ${s.fileCount} files. Watch the logs for progress.`,"success",6e3),k(!1)):s.error&&(console.error("[Analyze All] Error:",s.error),x(`Error: ${s.error}`,"error",8e3),k(!1))}},[i.state,i.data,x]);const Y=(s,t)=>{console.log("Simulating entity:",s);const l=y?.find(a=>a.sha===s);T(s),Z(),x(`Starting analysis for ${l?.name||"entity"}...`,"info",3e3),i.submit({entitySha:s,filePath:t},{method:"post",action:"/api/analyze"})},O=s=>{P(t=>{const l=new Set(t);return l.has(s)?l.delete(s):l.add(s),l})},G=d.useMemo(()=>{const s=new Map;return h.forEach(t=>{const l=t.entitySha;s.has(l)||s.set(l,[]),s.get(l).push(t)}),Array.from(s.entries()).map(([t,l])=>({entitySha:t,entityName:l[0].entityName,scenarios:l}))},[h]),X=[{label:"Total Entities",value:j.totalEntities,iconType:"folder",link:"/files",color:"#F59E0B"},{label:"Analyzed Entities",value:j.entitiesWithAnalyses,iconType:"check",link:"/recent",color:"#10B981"},{label:"Visual Components",value:j.visualEntities,iconType:"image",link:"/files?entityType=visual",color:"#8B5CF6"},{label:"Library Functions",value:j.libraryEntities,iconType:"code-xml",link:"/files?entityType=library",color:"#0DBFE9"}];return e.jsx("div",{className:"bg-cygray-10 min-h-screen",children:e.jsxs("div",{className:"py-6 px-12",children:[e.jsxs("header",{className:"mb-8 flex justify-between items-center",children:[e.jsx("div",{children:e.jsx("h1",{className:"text-3xl font-bold text-gray-900 m-0 mb-2",children:"CodeYam"})}),W.state==="loading"&&e.jsx("div",{className:"text-blue-600 text-sm font-medium animate-pulse",children:"đ Updating..."})]}),e.jsx("div",{className:"flex items-center justify-between gap-3",children:X.map((s,t)=>e.jsx(m,{to:s.link,className:"flex-1 bg-white rounded-xl border border-gray-200 overflow-hidden flex transition-all hover:shadow-lg hover:-translate-y-0.5 no-underline",style:{borderLeft:`4px solid ${s.color}`},children:e.jsxs("div",{className:"px-6 py-4 flex flex-col gap-3 flex-1",children:[e.jsxs("div",{className:"flex md:justify-between md:items-start md:flex-row flex-col",children:[e.jsx("div",{className:"text-xs text-gray-700 font-medium",children:s.label}),e.jsx("div",{className:"text-xs font-medium transition-colors flex items-center gap-1 hidden md:flex",style:{color:s.color},children:"View All â"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"rounded-lg p-2 leading-none flex-shrink-0",style:{backgroundColor:`${s.color}15`},children:[s.iconType==="folder"&&e.jsx(de,{size:20,style:{color:s.color}}),s.iconType==="check"&&e.jsx(le,{size:20,style:{color:s.color}}),s.iconType==="image"&&e.jsx(b,{size:20,style:{color:s.color}}),s.iconType==="gear"&&e.jsx(ie,{size:20,style:{color:s.color}}),s.iconType==="code-xml"&&e.jsx(V,{size:20,style:{color:s.color}})]}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 leading-none",children:s.value})]}),e.jsx("div",{className:"text-xs font-medium transition-colors flex items-center gap-1 md:hidden",style:{color:s.color},children:"View All â"})]})]})},t))}),e.jsxs("div",{className:"mt-12 grid gap-8 items-start",style:{gridTemplateColumns:"repeat(auto-fit, minmax(500px, 1fr))"},children:[e.jsxs("section",{id:"uncommitted",className:"bg-white border border-gray-200 rounded-xl p-6",children:[e.jsxs("div",{className:"flex justify-between items-start mb-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-semibold text-gray-900 m-0 mb-1",children:"Uncommitted Changes"}),e.jsx("p",{className:"text-sm text-gray-500 m-0",children:g.length>0?`${g.length} file${g.length!==1?"s":""} with ${C.length} uncommitted entit${C.length!==1?"ies":"y"}`:"No uncommitted changes detected"})]}),D.length>0&&e.jsx("button",{onClick:Q,disabled:i.state!=="idle"||L||c.length===0,className:"px-5 py-2.5 text-white border-none rounded-lg text-sm font-semibold cursor-pointer transition-all hover:-translate-y-px disabled:bg-gray-400 disabled:cursor-not-allowed disabled:translate-y-0",style:{backgroundColor:"#005C75"},onMouseEnter:s=>s.currentTarget.style.backgroundColor="#004560",onMouseLeave:s=>s.currentTarget.style.backgroundColor="#005C75",children:i.state!=="idle"||L?"Starting analysis...":c.length===0?"All Queued":`Analyze All (${c.length})`})]}),g.length>0?e.jsx("div",{className:"flex flex-col gap-3",children:g.map(([s,t])=>{const l=I.has(s),a=t.editedEntities||[];return e.jsxs("div",{className:"bg-white border border-gray-200 border-l-4 rounded-lg overflow-hidden",style:{borderLeftColor:"#306AFF"},children:[e.jsx("div",{className:"p-4 cursor-pointer select-none transition-colors hover:bg-gray-50",onClick:()=>O(s),role:"button",tabIndex:0,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-gray-500 text-xs w-4 shrink-0",children:l?"âŧ":"âļ"}),e.jsxs("svg",{width:"16",height:"20",viewBox:"0 0 12 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"shrink-0",children:[e.jsxs("g",{clipPath:"url(#clip0_784_10666)",children:[e.jsx("path",{d:"M0 2.55857C0 1.14551 1.14551 0 2.55857 0H8.73194L12 3.3616V13.4414C12 14.8545 10.8545 16 9.44143 16H2.55857C1.14551 16 0 14.8545 0 13.4414V2.55857Z",fill:"#DDDDFE"}),e.jsx("path",{d:"M8.72656 3.3307H11.9906L8.72656 0V3.3307Z",fill:"#306AFF"}),e.jsx("line",{x1:"1.8125",y1:"5.94825",x2:"10.0235",y2:"5.94825",stroke:"#306AFF",strokeWidth:"1.27929"}),e.jsx("line",{x1:"1.8125",y1:"8.82715",x2:"6.01207",y2:"8.82715",stroke:"#306AFF",strokeWidth:"1.27929"}),e.jsx("line",{x1:"1.8125",y1:"11.7061",x2:"10.0235",y2:"11.7061",stroke:"#306AFF",strokeWidth:"1.27929"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_784_10666",children:e.jsx("rect",{width:"12",height:"16",fill:"white"})})})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"font-normal text-gray-900 text-sm block truncate",children:s}),e.jsxs("span",{className:"text-xs text-gray-500",children:[a.length," entit",a.length!==1?"ies":"y"]})]})]})}),l&&e.jsx("div",{className:"border-t border-gray-200 bg-gray-50 p-3 flex flex-col gap-2",children:a.length>0?a.map(n=>{const u=$.has(n.sha),p=M.has(n.sha)||B.has(n.sha);return e.jsxs(m,{to:`/entity/${n.sha}`,className:"flex items-center gap-4 p-4 bg-white border border-gray-200 rounded-lg no-underline transition-all hover:shadow-md hover:-translate-y-0.5",style:{borderColor:"inherit"},onMouseEnter:r=>r.currentTarget.style.borderColor="#005C75",onMouseLeave:r=>r.currentTarget.style.borderColor="inherit",children:[e.jsxs("div",{className:"shrink-0 rounded-lg p-1.5 flex items-center justify-center",style:{backgroundColor:n.entityType==="visual"?"#8B5CF615":n.entityType==="library"?"#6366F1":"#EC4899"},children:[n.entityType==="visual"&&e.jsx(b,{size:16,style:{color:"#8B5CF6"}}),n.entityType==="library"&&e.jsx(V,{size:16,className:"text-white"}),n.entityType==="other"&&e.jsx(oe,{size:16,className:"text-white"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[e.jsx("div",{className:"font-semibold text-gray-900 text-sm",children:n.name}),n.entityType==="visual"&&e.jsx("div",{className:"px-2 py-0.5 rounded-sm text-[10px] uppercase font-bold",style:{backgroundColor:"#8B5CF60D",color:"#8B5CF6"},children:"Visual"}),n.entityType==="library"&&e.jsx("div",{className:"px-2 py-0.5 rounded-sm text-[10px] uppercase font-bold",style:{backgroundColor:"#6366F10D",color:"#6366F1"},children:"Library"}),n.entityType==="other"&&e.jsx("div",{className:"px-2 py-0.5 rounded-sm text-[10px] uppercase font-bold",style:{backgroundColor:"#EC48990D",color:"#EC4899"},children:"Other"})]}),n.description&&e.jsx("div",{className:"text-sm text-gray-500 mt-1 overflow-hidden text-ellipsis whitespace-nowrap",children:n.description})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[u&&e.jsxs("div",{className:"px-2 py-1 bg-pink-100 rounded text-xs text-pink-700 font-semibold flex items-center gap-1.5",children:[e.jsx(w,{size:14,className:"animate-spin"}),"Analyzing..."]}),!u&&p&&e.jsx("div",{className:"px-2 py-1 bg-purple-50 border border-purple-300 rounded text-xs text-purple-700 font-semibold",children:"âŗ Queued"}),!u&&!p&&e.jsx("button",{onClick:r=>{r.preventDefault(),r.stopPropagation(),x(`Starting analysis for ${n.name}...`,"info",3e3),i.submit({entityShas:n.sha},{method:"post",action:"/api/analyze"})},disabled:i.state!=="idle",className:"px-3 py-1.5 text-white border-none rounded text-xs font-medium cursor-pointer transition-all disabled:bg-gray-400 disabled:cursor-not-allowed",style:{backgroundColor:"#005C75"},onMouseEnter:r=>r.currentTarget.style.backgroundColor="#004560",onMouseLeave:r=>r.currentTarget.style.backgroundColor="#005C75",children:"Analyze"})]})]},n.sha)}):e.jsx("div",{className:"text-sm text-gray-500 italic p-2",children:"No entity changes detected in this file"})})]},s)})}):e.jsxs("div",{className:"py-12 px-6 text-center flex flex-col items-center bg-gray-50 rounded-lg min-h-[200px] justify-center",children:[e.jsxs("svg",{width:"52",height:"68",viewBox:"0 0 26 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"mb-4 opacity-40",children:[e.jsxs("g",{clipPath:"url(#clip0_784_10631)",children:[e.jsx("path",{d:"M0 2.55857C0 1.14551 1.14551 0 2.55857 0H18.9423L26.0318 7.14651V31.4562C26.0318 32.8693 24.8863 34.0148 23.4732 34.0148H2.55857C1.14551 34.0148 0 32.8693 0 31.4562V2.55857Z",fill:"#D9D9D9"}),e.jsx("path",{d:"M18.9453 7.08081H26.0261L18.9453 0V7.08081Z",fill:"#646464"}),e.jsx("line",{x1:"3.92188",y1:"13.3633",x2:"21.7341",y2:"13.3633",stroke:"#646464",strokeWidth:"1.27929"}),e.jsx("line",{x1:"3.92188",y1:"19.4863",x2:"13.0321",y2:"19.4863",stroke:"#646464",strokeWidth:"1.27929"}),e.jsx("line",{x1:"3.92188",y1:"25.6016",x2:"21.7341",y2:"25.6016",stroke:"#646464",strokeWidth:"1.27929"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_784_10631",children:e.jsx("rect",{width:"26",height:"34",fill:"white"})})})]}),e.jsx("p",{className:"text-sm font-medium text-gray-400 m-0 mb-2",children:"No Uncommitted Changes."})]})]}),e.jsxs("section",{className:"bg-white border border-gray-200 rounded-xl p-6",children:[e.jsx("div",{className:"flex justify-between items-start mb-5",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-semibold text-gray-900 m-0 mb-1",children:"Recent Simulations"}),e.jsx("p",{className:"text-sm text-gray-500 m-0",children:h.length>0?`Latest ${h.length} captured screenshot${h.length!==1?"s":""}`:"No simulations captured yet"})]})}),h.length>0&&!o?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-6 mb-5",children:G.map(s=>e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("div",{className:"shrink-0 rounded-lg p-1.5 flex items-center justify-center bg-purple-100",children:e.jsx(b,{size:16,style:{color:"#8B5CF6"}})}),e.jsx(m,{to:`/entity/${s.entitySha}`,className:"text-sm font-semibold text-gray-900 no-underline hover:text-gray-700 transition-colors",children:s.entityName})]}),e.jsx("div",{className:"grid grid-cols-4 gap-3",children:s.scenarios.map((t,l)=>e.jsx(m,{to:t.scenarioId?`/entity/${t.entitySha}/scenarios/${t.scenarioId}`:`/entity/${t.entitySha}`,className:"aspect-4/3 border border-gray-200 rounded-lg overflow-hidden bg-gray-50 transition-all flex items-center justify-center hover:scale-105",onMouseEnter:a=>{a.currentTarget.style.borderColor="#005C75",a.currentTarget.style.boxShadow="0 4px 12px rgba(0, 92, 117, 0.2)"},onMouseLeave:a=>{a.currentTarget.style.borderColor="#E5E7EB",a.currentTarget.style.boxShadow="none"},title:`${t.scenarioName}`,children:e.jsx(H,{screenshotPath:t.screenshotPath,alt:t.scenarioName,className:"max-w-full max-h-full object-contain object-center"})},l))})]},s.entitySha))}),e.jsx(m,{to:"/recent",className:"block text-center p-3 rounded-lg no-underline font-semibold text-sm transition-all",style:{color:"#005C75",backgroundColor:"#F6F9FC"},onMouseEnter:s=>s.currentTarget.style.backgroundColor="#EEF4F8",onMouseLeave:s=>s.currentTarget.style.backgroundColor="#F6F9FC",children:"View All Recent Simulations â"})]}):o?e.jsxs("div",{className:"p-0 bg-white rounded-lg flex flex-col gap-0",children:[f&&e.jsx("div",{className:"p-4 rounded-t-lg",style:{backgroundColor:"#F0F5F8",borderBottom:"2px solid #005C75"},children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[32px] leading-none",children:e.jsx(ae,{type:"visual"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"text-base font-bold mb-1",style:{color:"#005C75"},children:["Generating Simulations for ",f.name]}),e.jsx("div",{className:"text-[13px] text-gray-500 font-mono overflow-hidden text-ellipsis whitespace-nowrap",children:f.filePath})]})]})}),E?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-emerald-600 font-medium p-4 bg-emerald-50",children:[e.jsx("span",{className:"text-lg",children:"â
"}),e.jsxs("span",{children:["Complete (",N.length," scenario",N.length!==1?"s":"",")"]})]}):S?e.jsxs("div",{className:"flex items-center justify-between gap-1.5 text-sm font-medium p-4 bg-gray-50",style:{color:"#005C75"},children:[e.jsx(w,{size:18,className:"animate-spin shrink-0"}),e.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-xs",title:S,children:S}),v&&e.jsx("button",{onClick:()=>A(!0),className:"px-2 py-1.5 bg-gray-500 text-white border-none rounded-md text-[13px] font-medium cursor-pointer transition-all whitespace-nowrap self-start hover:bg-gray-600 hover:-translate-y-px",title:"View analysis logs",children:"đ Logs"})]}):i.state!=="idle"?e.jsxs("div",{className:"flex items-center justify-between gap-1.5 text-sm font-medium p-4 bg-gray-50",style:{color:"#005C75"},children:[e.jsx(w,{size:18,className:"animate-spin shrink-0"}),e.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap",children:"Initializing analysis..."})]}):e.jsxs("div",{className:"flex items-center justify-between gap-1.5 text-sm font-medium p-4 bg-gray-50",style:{color:"#005C75"},children:[e.jsx(w,{size:18,className:"animate-spin shrink-0"}),e.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap",children:"Starting analysis..."})]}),N.length>0&&e.jsx("div",{className:"flex gap-2 flex-wrap p-4 bg-white border-t border-gray-200",children:N.slice(0,8).map((s,t)=>{const l=s.metadata?.screenshotPaths?.[0],a=U.find(p=>p.name===s.name),n=a?.screenshotStartedAt&&!a?.screenshotFinishedAt;return l?e.jsx(m,{to:`/entity/${o}`,className:"w-20 h-15 border-2 border-gray-200 rounded overflow-hidden bg-gray-50 cursor-pointer transition-all flex items-center justify-center no-underline hover:border-blue-600 hover:scale-105 hover:shadow-md",children:e.jsx(H,{screenshotPath:l,alt:s.name,title:s.name,className:"max-w-full max-h-full object-contain object-center"})},t):e.jsx("div",{className:"w-20 h-15 border-2 border-dashed border-gray-300 rounded bg-gray-50 flex items-center justify-center text-2xl",title:`Capturing ${s.name}...`,children:e.jsx("span",{className:n?"animate-spin":"text-gray-400",children:n?"âŗ":"âšī¸"})},t)})})]}):e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("div",{className:"py-12 px-6 text-center bg-gray-50 rounded-lg w-full flex flex-col items-center justify-center min-h-[200px]",children:[e.jsx("div",{className:"mb-4 bg-[#efefef] rounded-lg p-3",children:e.jsx(b,{size:28,style:{color:"#999999"},strokeWidth:1.5})}),e.jsx("p",{className:"text-gray-700 m-0 font-semibold",children:"Start by analyzing your first component below."})]}),(y?.length??0)>0?e.jsx(e.Fragment,{children:e.jsx("div",{className:"flex flex-col gap-3 mt-6 w-full",children:(o&&f?[f]:y||[]).map(s=>e.jsx("div",{className:"flex flex-col gap-3",children:e.jsxs("div",{className:"flex items-center gap-4 p-4 bg-white border border-gray-200 rounded-lg transition-colors",style:{borderLeft:"4px solid #8B5CF6"},onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#F9FAFB"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="white"},children:[e.jsxs(m,{to:`/entity/${s.sha}`,className:"flex items-center gap-4 flex-1 min-w-0 no-underline",children:[e.jsx("div",{className:"shrink-0 rounded-lg p-1.5 flex items-center justify-center bg-purple-100",children:e.jsx(b,{size:16,style:{color:"#8B5CF6"}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-semibold text-gray-900 text-sm mb-1",children:s.name}),e.jsx("div",{className:"text-xs text-gray-500 font-mono overflow-hidden text-ellipsis whitespace-nowrap",children:s.filePath})]})]}),e.jsx("button",{onClick:()=>Y(s.sha,s.filePath||""),disabled:i.state!=="idle"||o!==null,className:"px-4 py-2 text-white border-none rounded text-sm font-medium cursor-pointer transition-all whitespace-nowrap shrink-0 disabled:bg-gray-400 disabled:cursor-not-allowed disabled:translate-y-0",style:{backgroundColor:"#005C75"},onMouseEnter:t=>t.currentTarget.style.backgroundColor="#004560",onMouseLeave:t=>t.currentTarget.style.backgroundColor="#005C75",title:o?"Please wait for current analysis to complete":"Analyze this entity",children:"Analyze"})]})},s.sha))})}):e.jsx("p",{className:"text-base text-gray-600 m-0 mb-6 leading-relaxed mt-6",children:"Run analysis on your visual components to create simulations and capture screenshots"})]})]})]}),R&&v&&e.jsx(ne,{projectSlug:v,onClose:()=>A(!1)})]})})}export{we as default,Ne as meta};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{b as E,j as e,L as g,u as M,e as z,r as k,d as L}from"./components-CAx5ONX_.js";import{L as q}from"./LogViewer-Dp6DC845.js";import{u as D}from"./useLastLogLine-BBlyqxij.js";import{S,C as K}from"./ScenarioPreview-Bl2IRh55.js";import{c as T}from"./createLucideIcon-CgyOwWip.js";import{C as F}from"./chart-column-B2I7jQx2.js";import{C as I}from"./circle-alert-GwwOAbhw.js";import"./SafeScreenshot-xwuhwsZH.js";import"./LibraryFunctionPreview-p0fuyqGQ.js";const B=[["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}]],H=T("cog",B);const _=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],Q=T("list-todo",_);const J=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],$=T("pause",J);function V(s){const t=Date.now(),o=new Date(s).getTime(),i=t-o,r=Math.floor(i/6e4),a=Math.floor(r/60);return r<1?"just now":r<60?`${r}m ago`:a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function O({state:s,currentRun:t}){E();const o=t?.currentEntityShas&&t.currentEntityShas.length>0;return!s.currentlyExecuting&&(!s.jobs||s.jobs.length===0)?null:e.jsxs("div",{className:"bg-white border-2 border-blue-500 rounded-xl shadow-lg p-5 mb-6",children:[s.currentlyExecuting&&!o&&e.jsxs("div",{className:"mb-4 bg-blue-50 border-2 border-blue-400 rounded-lg p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-xl animate-spin",children:"âī¸"}),e.jsx("span",{className:"text-sm font-bold text-blue-900",children:"Starting analysis..."})]}),e.jsxs("p",{className:"text-xs text-blue-700 mb-2",children:["Booting analyzer for ",s.currentlyExecuting.entities?.length||s.currentlyExecuting.entityShas?.length||1," ",(s.currentlyExecuting.entities?.length||s.currentlyExecuting.entityShas?.length)===1?"entity":"entities"]}),s.currentlyExecuting.entities&&s.currentlyExecuting.entities.length>0&&e.jsxs("div",{className:"space-y-1 mt-2 max-h-[100px] overflow-y-auto bg-white rounded-md p-2 border border-blue-200",children:[s.currentlyExecuting.entities.slice(0,3).map(i=>e.jsxs(g,{to:`/entity/${i.sha}`,className:"block text-xs text-blue-600 hover:text-blue-800 hover:underline font-medium truncate",title:`${i.name} - ${i.filePath}`,children:["đ ",i.name,e.jsxs("span",{className:"text-gray-400 ml-1",children:["(",i.filePath,")"]})]},i.sha)),s.currentlyExecuting.entities.length>3&&e.jsxs("div",{className:"text-xs text-blue-600 italic",children:["+",s.currentlyExecuting.entities.length-3," more entities"]})]}),e.jsx("p",{className:"text-xs text-blue-600 mt-2",children:"This may take 2-3 minutes for environment setup"})]}),s.jobs.length>0&&e.jsxs("div",{className:"space-y-2",children:[s.jobs.slice(0,5).map((i,r)=>{i.entities?.length||i.entityShas?.length,i.filePaths?.length,i.entityNames?.[0];const a=i.entities&&i.entities.length>0;return e.jsx("div",{className:"flex items-start gap-3",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsxs("span",{className:"text-sm font-semibold text-gray-700",children:["Job ",r+1]}),e.jsx("span",{className:"text-xs text-gray-400",children:"âĸ"}),e.jsx("span",{className:"text-xs text-gray-500",children:V(i.queuedAt)})]}),a&&e.jsxs("div",{className:"space-y-1 mt-2 max-h-[120px] overflow-y-auto bg-white rounded-md p-2 border border-gray-200",children:[i.entities.slice(0,5).map(n=>e.jsxs(g,{to:`/entity/${n.sha}`,className:"block text-xs text-blue-600 hover:text-blue-800 hover:underline font-medium truncate",title:`${n.name} - ${n.filePath}`,children:["đ ",n.name,e.jsxs("span",{className:"text-gray-400 ml-1",children:["(",n.filePath,")"]})]},n.sha)),i.entities.length>5&&e.jsxs("div",{className:"text-xs text-gray-500 italic",children:["+",i.entities.length-5," more entities"]})]}),i.type==="recapture"&&i.scenarioId&&e.jsxs("div",{className:"text-xs text-gray-500 mt-1 font-mono",children:["Scenario: ",i.scenarioId]})]})},i.id)}),s.jobs.length>5&&e.jsxs("div",{className:"text-xs text-gray-500 text-center py-2",children:["+",s.jobs.length-5," more jobs in queue"]})]})]})}function R({activeTab:s,hasCurrentActivity:t,queuedCount:o,historicCount:i}){const r=[{id:"current",label:"Current Activity",hasContent:t,count:null},{id:"queued",label:"Queued Activity",hasContent:o>0,count:o},{id:"historic",label:"Historic Activity",hasContent:i>0,count:i}];return e.jsx("div",{className:"border-b border-gray-200 mb-6",children:e.jsx("nav",{className:"flex gap-8",children:r.map(a=>{const n=s===a.id;return e.jsx(g,{to:a.id==="current"?"/activity":`/activity/${a.id}`,className:`
|
|
2
|
-
relative pb-4 px-2 text-sm font-medium transition-colors
|
|
3
|
-
${n?"border-b-2":"text-gray-500 hover:text-gray-700"}
|
|
4
|
-
`,style:n?{color:"#005C75",borderColor:"#005C75"}:{},children:e.jsxs("span",{className:"flex items-center gap-2",children:[a.label,a.count!==null&&a.count>0&&e.jsx("span",{className:`
|
|
5
|
-
inline-flex items-center justify-center px-2 py-0.5 text-xs font-semibold rounded-full
|
|
6
|
-
${n?"":"bg-gray-200 text-gray-700"}
|
|
7
|
-
`,style:n?{backgroundColor:"#e8f1f5",color:"#005C75"}:{},children:a.count}),a.count===null&&a.hasContent&&e.jsx("span",{className:`
|
|
8
|
-
inline-block w-2 h-2 rounded-full
|
|
9
|
-
${n?"":"bg-gray-400"}
|
|
10
|
-
`,style:n?{backgroundColor:"#005C75"}:{}})]})},a.id)})})})}function U(s){const t=new Date(s),i=Math.floor((new Date().getTime()-t.getTime())/1e3);if(i<60)return"just now";const r=Math.floor(i/60);if(r<60)return`${r}m ago`;const a=Math.floor(r/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function W({currentlyExecuting:s,currentRun:t,state:o,projectSlug:i,commitSha:r,onShowLogs:a,recentCompletedRuns:n,totalCompletedRuns:N}){const[h,A]=k.useState({}),[u,f]=k.useState({isKilling:!1,current:0,total:0}),C=L(),w=!!s,p=s?.entities||[],x=!!t?.analysisCompletedAt,j=w,{lastLine:v}=D(i,j);return k.useEffect(()=>{if(!t)return;const l=[t.analyzerPid,t.capturePid].filter(c=>!!c);if(l.length===0)return;const m=async()=>{try{const d=await(await fetch(`/api/process-status?pids=${l.join(",")}`)).json();if(d.processes){const b={};d.processes.forEach(P=>{b[P.pid]={isRunning:P.isRunning,processName:P.processName}}),A(b)}}catch(c){console.error("Failed to fetch process statuses:",c)}};m();const y=setInterval(()=>void m(),5e3);return()=>clearInterval(y)},[t?.analyzerPid,t?.capturePid]),j?e.jsxs("div",{className:"bg-white rounded-xl shadow-lg p-6",style:{borderWidth:"2px",borderColor:"#005C75"},children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 bg-gray-100 rounded-full animate-spin",children:e.jsx(H,{size:24,className:"text-gray-700"})}),e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:x?"Capture in Progress":"Analysis in Progress"})]}),e.jsx("button",{onClick:a,className:"px-4 py-2 text-white rounded-md text-sm font-semibold transition-colors",style:{backgroundColor:"#005C75"},onMouseEnter:l=>l.currentTarget.style.backgroundColor="#003d52",onMouseLeave:l=>l.currentTarget.style.backgroundColor="#005C75",children:"View Logs"})]}),x&&(t?.readyToBeCaptured??0)>0&&e.jsxs("div",{className:"rounded-md p-4 mb-4",style:{backgroundColor:"#f0f5f8",borderColor:"#b3d9e8",borderWidth:"1px"},children:[e.jsx("p",{className:"text-sm font-semibold mb-1",style:{color:"#00263d"},children:"Capture Progress:"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("p",{className:"text-sm",style:{color:"#004560"},children:[t?.capturesCompleted??0," of"," ",t?.readyToBeCaptured??0," entities captured"]}),e.jsx("div",{className:"flex-1 rounded-full h-2",style:{backgroundColor:"#b3d9e8"},children:e.jsx("div",{className:"h-2 rounded-full transition-all duration-300",style:{backgroundColor:"#005C75",width:`${(t?.capturesCompleted??0)/(t?.readyToBeCaptured??1)*100}%`}})})]})]}),p&&p.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("p",{className:"text-sm font-semibold text-gray-700 mb-2",children:[x?"Capturing":"Analyzing"," ",p.length," ",p.length===1?"Entity":"Entities",":"]}),e.jsx("div",{className:"space-y-3",children:p.map(l=>{const m=l.analyses?.[0],y=m?.scenarios||[],c=m?.status;return e.jsxs("div",{className:"bg-gray-50 rounded-md p-3",children:[e.jsxs(g,{to:`/entity/${l.sha}`,className:"block text-sm hover:underline font-medium truncate mb-2",title:`${l.name} - ${l.filePath}`,style:{color:"#005C75"},onMouseEnter:d=>d.currentTarget.style.color="#003d52",onMouseLeave:d=>d.currentTarget.style.color="#005C75",children:["đ ",l.name,e.jsxs("span",{className:"text-gray-500 ml-2 text-xs",children:["(",l.filePath,")"]})]}),y.length>0&&e.jsx("div",{className:"flex gap-2 flex-wrap",children:y.slice(0,5).map((d,b)=>d.id?e.jsx(S,{scenario:d,entity:{sha:l.sha,entityType:l.entityType},analysisStatus:c,queueState:o,processIsRunning:j,size:"small"},b):null)})]},l.sha)})})]}),v&&e.jsxs("div",{className:"flex flex-col gap-2 mb-4",children:[e.jsx("p",{className:"text-sm font-semibold text-gray-700",children:"Current Step:"}),e.jsx("p",{className:"text-sm text-gray-600 font-mono",children:v})]}),(t?.analyzerPid||t?.capturePid)&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("p",{className:"text-sm font-semibold text-gray-700",children:"Running Processes:"}),e.jsxs("div",{className:"flex items-center justify-between bg-gray-50 rounded-md p-3",children:[e.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[t.analyzerPid&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs font-mono bg-gray-200 px-2 py-1 rounded",children:["Analyzer: ",t.analyzerPid]}),h[t.analyzerPid]&&e.jsx("span",{className:`text-xs px-2 py-1 rounded ${h[t.analyzerPid].isRunning?"bg-green-100 text-green-700":"bg-red-100 text-red-700"}`,children:h[t.analyzerPid].isRunning?"Running":"Stopped"})]}),t.capturePid&&e.jsxs(e.Fragment,{children:[t.analyzerPid&&e.jsx("span",{className:"text-gray-400",children:"|"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs font-mono bg-gray-200 px-2 py-1 rounded",children:["Capture: ",t.capturePid]}),h[t.capturePid]&&e.jsx("span",{className:`text-xs px-2 py-1 rounded ${h[t.capturePid].isRunning?"bg-green-100 text-green-700":"bg-red-100 text-red-700"}`,children:h[t.capturePid].isRunning?"Running":"Stopped"})]})]})]}),(h[t.analyzerPid]?.isRunning||h[t.capturePid]?.isRunning)&&e.jsxs("div",{className:"flex items-center gap-3",children:[u.isKilling&&e.jsxs("span",{className:"text-xs text-gray-600 font-medium",children:["Killing process ",u.current," of"," ",u.total,"..."]}),e.jsx("button",{onClick:()=>{const l=[t.analyzerPid,t.capturePid].filter(c=>!!c&&h[c]?.isRunning);if(l.length===0)return;const m=l.join(", ");if(!confirm(`Are you sure you want to kill all running processes (${m})?`))return;f({isKilling:!0,current:1,total:l.length}),(async()=>{for(let c=0;c<l.length;c++){const d=l[c];try{await fetch("/api/kill-process",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pid:d,commitSha:r||""})})}catch(b){console.error(`Failed to kill process ${d}:`,b)}c<l.length-1&&f({isKilling:!0,current:c+2,total:l.length})}f({isKilling:!1,current:0,total:0}),C.revalidate()})()},disabled:u.isKilling,className:"px-3 py-1 bg-red-600 text-white rounded-md text-xs font-semibold hover:bg-red-700 transition-colors whitespace-nowrap disabled:opacity-50 disabled:cursor-not-allowed",children:u.isKilling?"Killing...":"Kill All Processes"})]})]})]})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-gray-50 rounded-xl p-12 text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("div",{className:"p-2 bg-gray-200 rounded-lg",children:e.jsx($,{size:24,className:"text-gray-600",fill:"currentColor"})})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-700 mb-2",children:"No Current Activity"}),e.jsxs("p",{className:"text-gray-500",children:["There are no analyses currently running. Trigger an analysis from the"," ",e.jsx(g,{to:"/git",className:"text-[#005C75] underline hover:text-[#004a5e]",children:"Git"})," ","or"," ",e.jsx(g,{to:"/files",className:"text-[#005C75] underline hover:text-[#004a5e]",children:"Files"})," ","page."]})]}),n&&n.length>0&&e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Recent Completed Analyses"}),e.jsx("div",{className:"space-y-3",children:n.map(l=>{const m=l.analysisCompletedAt||l.archivedAt||l.createdAt,y=l.entities&&l.entities.length>0;return e.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-xl",children:"â
"}),e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:"Completed"}),e.jsx("span",{className:"text-xs text-gray-400",children:"âĸ"}),e.jsx("span",{className:"text-xs text-gray-500",children:m?U(m):"Unknown"})]}),y&&e.jsxs("div",{className:"ml-7 space-y-1",children:[l.entities.slice(0,3).map(c=>e.jsxs(g,{to:`/entity/${c.sha}`,className:"block text-sm hover:underline truncate",title:`${c.name} - ${c.filePath}`,style:{color:"#005C75"},onMouseEnter:d=>d.currentTarget.style.color="#003d52",onMouseLeave:d=>d.currentTarget.style.color="#005C75",children:["đ ",c.name,e.jsxs("span",{className:"text-gray-400 ml-1 text-xs",children:["(",c.filePath,")"]})]},c.sha)),l.entities.length>3&&e.jsxs("div",{className:"text-xs text-gray-500 italic",children:["+",l.entities.length-3," more entities"]})]})]},l.id)})}),N>3&&e.jsx("div",{className:"mt-4 text-center",children:e.jsx(g,{to:"/activity/historic",className:"text-sm font-medium",style:{color:"#005C75"},onMouseEnter:l=>l.currentTarget.style.color="#003d52",onMouseLeave:l=>l.currentTarget.style.color="#005C75",children:"View All Historic Activity â"})})]})]})}function G({queueJobs:s,state:t,currentRun:o}){return!s||s.length===0?e.jsxs("div",{className:"bg-gray-50 rounded-xl p-12 text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("div",{className:"p-3 bg-gray-200 rounded-lg",children:e.jsx(Q,{size:32,className:"text-gray-600",fill:"currentColor"})})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-700 mb-2",children:"No Queued Jobs"}),e.jsx("p",{className:"text-gray-500",children:"Analysis jobs will appear here when they are queued but not yet started."})]}):e.jsx("div",{children:e.jsx(O,{state:t,currentRun:o})})}function X({historicalRuns:s,totalHistoricalRuns:t,currentPage:o,totalPages:i,tab:r}){return t===0?e.jsxs("div",{className:"bg-gray-50 rounded-xl p-12 text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("div",{className:"p-3 bg-gray-200 rounded-lg",children:e.jsx(F,{size:32,className:"text-gray-600",fill:"currentColor"})})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-700 mb-2",children:"No Historic Activity"}),e.jsx("p",{className:"text-gray-500",children:"Completed analyses will appear here for historical reference."})]}):e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-6",children:[e.jsx("div",{className:"space-y-3",children:s.map(a=>{const n=!!a.failedAt,N=a.readyToBeCaptured,h=a.capturesCompleted??0,A=N===void 0?!0:N===0||h>=N,u=!n&&!!a.analysisCompletedAt&&A,f=a.createdAt?new Date(a.createdAt):null,C=a.failedAt?new Date(a.failedAt):a.analysisCompletedAt?new Date(a.analysisCompletedAt):null,w=f&&C?(C.getTime()-f.getTime())/1e3:null,p=a.entities&&a.entities.length>0;return e.jsx("div",{className:`border rounded-lg p-4 ${n?"bg-red-50 border-red-200":u?"bg-green-50 border-green-200":"bg-gray-50 border-gray-200"}`,children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n?e.jsx(I,{size:20,className:"text-red-500"}):u?e.jsx(K,{size:20,className:"text-green-500"}):e.jsx($,{size:20,className:"text-gray-400"}),e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:n?"Failed":u?"Completed":"Incomplete"}),e.jsx("span",{className:"text-xs text-gray-400",children:"âĸ"}),e.jsx("span",{className:"text-xs text-gray-500",children:a.archivedAt?new Date(a.archivedAt).toLocaleString():a.createdAt?new Date(a.createdAt).toLocaleString():"Unknown"})]}),p&&e.jsxs("div",{className:"ml-7 mt-2 space-y-2 max-h-[300px] overflow-y-auto bg-white rounded-md p-2 border border-gray-200",children:[a.entities.slice(0,5).map(x=>{const j=x.analyses?.[0],v=j?.scenarios||[];return e.jsxs("div",{className:"pb-2 border-b last:border-b-0 border-gray-100",children:[e.jsxs(g,{to:`/entity/${x.sha}`,className:"block text-xs hover:underline font-medium truncate mb-1",title:`${x.name} - ${x.filePath}`,style:{color:"#005C75"},onMouseEnter:l=>l.currentTarget.style.color="#003d52",onMouseLeave:l=>l.currentTarget.style.color="#005C75",children:["đ ",x.name,e.jsxs("span",{className:"text-gray-400 ml-1",children:["(",x.filePath,")"]})]}),v.length>0&&e.jsx("div",{className:"flex gap-1.5 flex-wrap mt-1.5",children:v.slice(0,5).map((l,m)=>l.id?e.jsx(S,{scenario:l,entity:{sha:x.sha,entityType:x.entityType},analysisStatus:j?.status,queueState:void 0,processIsRunning:!1,size:"small"},m):null)})]},x.sha)}),a.entities.length>5&&e.jsxs("div",{className:"text-xs text-gray-500 italic pt-1",children:["+",a.entities.length-5," more entities"]})]}),a.failureReason&&e.jsx("p",{className:"text-xs text-red-600 mt-2 font-mono ml-7",children:a.failureReason})]}),w!==null&&e.jsxs("div",{className:"text-xs text-gray-500",children:[w.toFixed(1),"s"]})]})},a.id)})}),i>1&&e.jsxs("div",{className:"mt-6 flex items-center justify-between border-t border-gray-200 pt-4",children:[e.jsxs("div",{className:"text-sm text-gray-600",children:["Showing ",(o-1)*20+1," -"," ",Math.min(o*20,t)," of"," ",t," runs"]}),e.jsxs("div",{className:"flex gap-2",children:[o>1&&e.jsx(g,{to:`/activity/${r}?page=${o-1}`,className:"px-3 py-1 bg-gray-100 text-gray-700 rounded-md text-sm font-medium hover:bg-gray-200 transition-colors",children:"Previous"}),o<i&&e.jsx(g,{to:`/activity/${r}?page=${o+1}`,className:"px-3 py-1 bg-gray-100 text-gray-700 rounded-md text-sm font-medium hover:bg-gray-200 transition-colors",children:"Next"})]})]})]})}function ne(){const s=M(),t=z(),[o,i]=k.useState(!1),r=t.tab||"current";return e.jsxs("div",{className:"px-36 py-12",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:"Activity"}),e.jsx("p",{className:"text-gray-600",children:"View queued, current, and historical analysis activity"})]}),e.jsx(R,{activeTab:r,hasCurrentActivity:s.hasCurrentActivity,queuedCount:s.queuedCount,historicCount:s.totalHistoricalRuns}),r==="current"&&e.jsx(W,{currentlyExecuting:s.currentlyExecuting,currentRun:s.currentRun,state:s.state,projectSlug:s.projectSlug,commitSha:s.commitSha,onShowLogs:()=>i(!0),recentCompletedRuns:s.recentCompletedRuns,totalCompletedRuns:s.totalCompletedRuns}),r==="queued"&&e.jsx(G,{queueJobs:s.queueJobs,state:s.state,currentRun:s.currentRun}),r==="historic"&&e.jsx(X,{historicalRuns:s.historicalRuns,totalHistoricalRuns:s.totalHistoricalRuns,currentPage:s.currentPage,totalPages:s.totalPages,tab:r}),o&&s.projectSlug&&e.jsx(q,{projectSlug:s.projectSlug,onClose:()=>i(!1)})]})}export{ne as default};
|