@codeyam/codeyam-cli 0.1.0-staging.b8b17a5 → 0.1.0-staging.b8ee127
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 +4 -4
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +135 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/nodeToSource.ts +19 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/paths.ts +11 -4
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +36 -9
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.ts +10 -3
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +16 -6
- package/analyzer-template/packages/analyze/index.ts +4 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +28 -2
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +5 -36
- package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +10 -6
- package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +9 -12
- package/analyzer-template/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.ts +21 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +82 -10
- package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +4 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +4 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyzeNextRoute.ts +8 -3
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +239 -58
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +1684 -1462
- package/analyzer-template/packages/aws/package.json +6 -6
- package/analyzer-template/packages/database/package.json +2 -2
- package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +25 -15
- package/analyzer-template/packages/database/src/lib/loadEntity.ts +19 -8
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +7 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts +4 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js +5 -5
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts +3 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +22 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +27 -0
- package/analyzer-template/project/analyzeFileEntities.ts +26 -0
- package/analyzer-template/project/runMultiScenarioServer.ts +26 -3
- package/background/src/lib/virtualized/project/analyzeFileEntities.js +22 -0
- package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
- package/background/src/lib/virtualized/project/runMultiScenarioServer.js +23 -3
- package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
- package/codeyam-cli/src/cli.js +15 -0
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/commands/__tests__/editor.analyzeImportsArgs.test.js +47 -0
- package/codeyam-cli/src/commands/__tests__/editor.analyzeImportsArgs.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.auditNoAutoAnalysis.test.js +71 -0
- package/codeyam-cli/src/commands/__tests__/editor.auditNoAutoAnalysis.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.designSystem.test.js +30 -0
- package/codeyam-cli/src/commands/__tests__/editor.designSystem.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.statePersistence.test.js +55 -0
- package/codeyam-cli/src/commands/__tests__/editor.statePersistence.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js +9 -9
- package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js +38 -3
- package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js.map +1 -1
- package/codeyam-cli/src/commands/editor.js +2207 -467
- package/codeyam-cli/src/commands/editor.js.map +1 -1
- package/codeyam-cli/src/commands/editorAnalyzeImportsArgs.js +23 -0
- package/codeyam-cli/src/commands/editorAnalyzeImportsArgs.js.map +1 -0
- package/codeyam-cli/src/commands/init.js +20 -0
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/data/designSystems.js +27 -0
- package/codeyam-cli/src/data/designSystems.js.map +1 -0
- package/codeyam-cli/src/data/techStacks.js +1 -1
- package/codeyam-cli/src/utils/__tests__/editorApi.test.js +44 -0
- package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +2232 -52
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorCaptureScenarioSeeding.test.js +137 -0
- package/codeyam-cli/src/utils/__tests__/editorCaptureScenarioSeeding.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js +66 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorGuardMiddleware.test.js +67 -0
- package/codeyam-cli/src/utils/__tests__/editorGuardMiddleware.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +11 -3
- package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +98 -1
- package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorRoadmap.test.js +398 -0
- package/codeyam-cli/src/utils/__tests__/editorRoadmap.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +190 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +249 -1
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +134 -1
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +266 -2
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js +177 -0
- package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +16 -1
- package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/manualEntityAnalysis.test.js +302 -0
- package/codeyam-cli/src/utils/__tests__/manualEntityAnalysis.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/registerScenarioResult.test.js +127 -0
- package/codeyam-cli/src/utils/__tests__/registerScenarioResult.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js +57 -0
- package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +180 -1
- package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/screenshotHash.test.js +84 -0
- package/codeyam-cli/src/utils/__tests__/screenshotHash.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/testRunner.test.js +216 -0
- package/codeyam-cli/src/utils/__tests__/testRunner.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/webappDetection.test.js +6 -0
- package/codeyam-cli/src/utils/__tests__/webappDetection.test.js.map +1 -1
- package/codeyam-cli/src/utils/analysisRunner.js +36 -7
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/analyzer.js +11 -1
- package/codeyam-cli/src/utils/analyzer.js.map +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/designSystemShowcase.js +810 -0
- package/codeyam-cli/src/utils/designSystemShowcase.js.map +1 -0
- package/codeyam-cli/src/utils/editorApi.js +16 -0
- package/codeyam-cli/src/utils/editorApi.js.map +1 -1
- package/codeyam-cli/src/utils/editorAudit.js +504 -43
- package/codeyam-cli/src/utils/editorAudit.js.map +1 -1
- package/codeyam-cli/src/utils/editorGuard.js +36 -0
- package/codeyam-cli/src/utils/editorGuard.js.map +1 -0
- package/codeyam-cli/src/utils/editorPreview.js +5 -3
- package/codeyam-cli/src/utils/editorPreview.js.map +1 -1
- package/codeyam-cli/src/utils/editorRecapture.js +109 -0
- package/codeyam-cli/src/utils/editorRecapture.js.map +1 -0
- package/codeyam-cli/src/utils/editorRoadmap.js +301 -0
- package/codeyam-cli/src/utils/editorRoadmap.js.map +1 -0
- package/codeyam-cli/src/utils/editorScenarioSwitch.js +39 -2
- package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -1
- package/codeyam-cli/src/utils/editorScenarios.js +141 -7
- package/codeyam-cli/src/utils/editorScenarios.js.map +1 -1
- package/codeyam-cli/src/utils/editorSeedAdapter.js +69 -16
- package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -1
- package/codeyam-cli/src/utils/entityChangeStatus.js +31 -3
- package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -1
- package/codeyam-cli/src/utils/entityChangeStatus.server.js +31 -0
- package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -1
- package/codeyam-cli/src/utils/glossaryAdd.js +74 -0
- package/codeyam-cli/src/utils/glossaryAdd.js.map +1 -0
- package/codeyam-cli/src/utils/install-skills.js +32 -6
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/manualEntityAnalysis.js +196 -0
- package/codeyam-cli/src/utils/manualEntityAnalysis.js.map +1 -0
- package/codeyam-cli/src/utils/queue/__tests__/job.interactiveStart.test.js +159 -0
- package/codeyam-cli/src/utils/queue/__tests__/job.interactiveStart.test.js.map +1 -0
- package/codeyam-cli/src/utils/queue/job.js +35 -6
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/registerScenarioResult.js +52 -0
- package/codeyam-cli/src/utils/registerScenarioResult.js.map +1 -0
- package/codeyam-cli/src/utils/scenarioCoverage.js +4 -1
- package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -1
- package/codeyam-cli/src/utils/scenariosManifest.js +66 -2
- package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -1
- package/codeyam-cli/src/utils/screenshotHash.js +26 -0
- package/codeyam-cli/src/utils/screenshotHash.js.map +1 -0
- package/codeyam-cli/src/utils/simulationGateMiddleware.js +9 -0
- package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -1
- package/codeyam-cli/src/utils/testResultCache.js +53 -0
- package/codeyam-cli/src/utils/testResultCache.js.map +1 -0
- package/codeyam-cli/src/utils/testResultCache.server.js +81 -0
- package/codeyam-cli/src/utils/testResultCache.server.js.map +1 -0
- package/codeyam-cli/src/utils/testResultCache.server.test.js +187 -0
- package/codeyam-cli/src/utils/testResultCache.server.test.js.map +1 -0
- package/codeyam-cli/src/utils/testResultCache.test.js +230 -0
- package/codeyam-cli/src/utils/testResultCache.test.js.map +1 -0
- package/codeyam-cli/src/utils/testRunner.js +193 -1
- package/codeyam-cli/src/utils/testRunner.js.map +1 -1
- package/codeyam-cli/src/utils/webappDetection.js +4 -2
- package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
- package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js +99 -0
- package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js +68 -1
- package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js.map +1 -1
- package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +145 -11
- package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -1
- package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js +190 -21
- package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js.map +1 -1
- package/codeyam-cli/src/webserver/__tests__/stripClaudeCommand.test.js +135 -0
- package/codeyam-cli/src/webserver/__tests__/stripClaudeCommand.test.js.map +1 -0
- package/codeyam-cli/src/webserver/app/lib/clientErrors.js +22 -1
- package/codeyam-cli/src/webserver/app/lib/clientErrors.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/app/routes/api.interactive-switch-scenario.js +34 -0
- package/codeyam-cli/src/webserver/app/routes/api.interactive-switch-scenario.js.map +1 -0
- package/codeyam-cli/src/webserver/backgroundServer.js +42 -57
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{CopyButton-CzTDWkF2.js → CopyButton-DTBZZfSk.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-BFbq6iFk.js → EntityItem-BxclONWq.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-B6OMi58N.js → EntityTypeIcon-BsnEOJZ_.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-DuYodzo1.js → InlineSpinner-ByaELMbv.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-CXo9EeCl.js → InteractivePreview-6WjVfhxX.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-DYCNb2It.js → LibraryFunctionPreview-ChX-Hp7W.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-CZgY3sxX.js → LogViewer-C-9zQdXg.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/MiniClaudeChat-BusrvT2F.js +36 -0
- package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-CnYYwRDw.js → ReportIssueModal-DQsceHVv.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-CDoF7ZpU.js → SafeScreenshot-DThcm_9M.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-DrnfvaLL.js → ScenarioViewer-Cl4oOA3A.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/Spinner-CIil5-gb.js +34 -0
- package/codeyam-cli/src/webserver/build/client/assets/{ViewportInspectBar-DRKR9T0U.js → ViewportInspectBar-BqkA9zyZ.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{_index-ClR-g3tY.js → _index-DnOgyseQ.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-DTH6ydEA.js → activity.(_tab)-DqM9hbNE.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{addon-web-links-74hnHF59.js → addon-web-links-C58dYPwR.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-B8CYhCO9.js → agent-transcripts-B8NCeOrm.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-recapture-stale-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-roadmap-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-scenario-data-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-schema-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-verify-routes-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.interactive-switch-scenario-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{book-open-CLaoh4ac.js → book-open-BFSIqZgO.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-BZ2DZxbW.js → chevron-down-B9fDzFVh.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-UVKPFVEO-Bmq2apuh.js +43 -0
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-CT4unAk-.js → circle-check-DLPObLUx.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{copy-zK0B6Nu-.js → copy-DXEmO0TD.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-DJB0YQJL.js → createLucideIcon-BwyFiRot.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-Coe5NhbS.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-CCKUIm0S.svg → cy-logo-cli-DoA97ML3.svg} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{dev.empty-CkXFP_i-.js → dev.empty-iRhRIFlp.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/editor._tab-BZPBzV73.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-CsYVRiNH.js +147 -0
- package/codeyam-cli/src/webserver/build/client/assets/editorPreview-C6fEYHrh.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-BqAN7hyG.js → entity._sha._-Ce1s4OQ1.js} +13 -12
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.dev-D1eikpe1.js → entity._sha.scenarios._scenarioId.dev-C8AyYgYT.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-Dg1NhIms.js → entity._sha.scenarios._scenarioId.fullscreen-DziaVQX1.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-CJX6kkkV.js → entity._sha_.create-scenario-BTcpgIpC.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BhVjZhKg.js → entity._sha_.edit._scenarioId-D_O_ajfZ.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-_gzKltPN.js → entry.client-j1Vi0bco.js} +6 -6
- package/codeyam-cli/src/webserver/build/client/assets/{files-CV_17tZS.js → files-kuny2Q_s.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{git-D-YXmMbR.js → git-DgCZPMie.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-Gp2o-NMc.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-CCrgCshv.js → index-BliGSSpl.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-Blo6EK8G.js → index-SqjQKTdH.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-BsX0F-9C.js → index-vyrZD2g4.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{labs-Byazq8Pv.js → labs-c3yLxSEp.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-DVQ0oHR7.js → loader-circle-D-q28GLF.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-ef0f624d.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{memory-b-VmA2Vj.js → memory-CEWIUC4t.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{pause-DGcndCAa.js → pause-BP6fitdh.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-Didv9PLi.js +80 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-C0Uw0bcK.js → search-BooqacKS.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{settings-OoNgHIfW.js → settings-BM0nbryO.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{simulations-Bcemfu8a.js → simulations-ovy6FjRY.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{terminal-BgMmG7R9.js → terminal-DHemCJIs.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-Cs87hJYK.js → triangle-alert-D87ekDl8.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-BR3Rs7JY.js → useCustomSizes-Dk0Tciqg.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C8QvIe05.js +2 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-BermyNU5.js → useReportContext-jkCytuYz.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-a_QN_W9_.js → useToast-BgqkixU9.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-BKMsxwqe.js +16 -0
- package/codeyam-cli/src/webserver/build/server/assets/{index-CHymws6l.js → index-CvuvIPEn.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/init-B3gVLAAJ.js +14 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-B4LxStYP.js +741 -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/editorProxy.js +132 -7
- package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
- package/codeyam-cli/src/webserver/idleDetector.js +65 -8
- package/codeyam-cli/src/webserver/idleDetector.js.map +1 -1
- package/codeyam-cli/src/webserver/scripts/journalCapture.ts +53 -0
- package/codeyam-cli/src/webserver/server.js +119 -14
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/src/webserver/terminalServer.js +174 -32
- package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
- package/codeyam-cli/templates/__tests__/editor-step-hook.prompt-capture.test.ts +118 -0
- package/codeyam-cli/templates/codeyam-editor-claude.md +2 -0
- package/codeyam-cli/templates/codeyam-editor-gemini.md +59 -0
- package/codeyam-cli/templates/codeyam-editor-reference.md +216 -0
- package/codeyam-cli/templates/design-systems/clean-dashboard-design-system.md +255 -0
- package/codeyam-cli/templates/design-systems/editorial-design-system.md +267 -0
- package/codeyam-cli/templates/design-systems/mono-brutalist-design-system.md +256 -0
- package/codeyam-cli/templates/design-systems/neo-brutalist-design-system.md +294 -0
- package/codeyam-cli/templates/editor-step-hook.py +93 -46
- package/codeyam-cli/templates/expo-react-native/MOBILE_SETUP.md +204 -5
- package/codeyam-cli/templates/expo-react-native/__tests__/.gitkeep +0 -0
- package/codeyam-cli/templates/expo-react-native/app/_layout.tsx +6 -3
- package/codeyam-cli/templates/expo-react-native/app/index.tsx +36 -0
- package/codeyam-cli/templates/expo-react-native/app.json +11 -0
- package/codeyam-cli/templates/expo-react-native/babel.config.js +1 -0
- package/codeyam-cli/templates/expo-react-native/gitignore +2 -0
- package/codeyam-cli/templates/expo-react-native/global.css +7 -0
- package/codeyam-cli/templates/expo-react-native/lib/theme.ts +73 -0
- package/codeyam-cli/templates/expo-react-native/package.json +32 -16
- package/codeyam-cli/templates/expo-react-native/patches/expo-modules-autolinking+3.0.24.patch +29 -0
- package/codeyam-cli/templates/isolation-route/expo-router.tsx.template +54 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +47 -34
- package/codeyam-cli/templates/seed-adapters/supabase.ts +133 -52
- package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +34 -1
- package/package.json +1 -1
- package/packages/ai/src/lib/astScopes/methodSemantics.js +99 -0
- package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
- package/packages/ai/src/lib/astScopes/nodeToSource.js +16 -0
- package/packages/ai/src/lib/astScopes/nodeToSource.js.map +1 -1
- package/packages/ai/src/lib/astScopes/paths.js +12 -3
- package/packages/ai/src/lib/astScopes/paths.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +27 -10
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.js +9 -2
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +14 -4
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/analyze/index.js +1 -1
- package/packages/analyze/index.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +16 -2
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +6 -26
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +3 -2
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +9 -7
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js +14 -0
- package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +44 -11
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeChange.js +1 -0
- package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeInitial.js +1 -0
- package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeNextRoute.js +5 -1
- package/packages/analyze/src/lib/files/analyzeNextRoute.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +120 -28
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +1368 -1193
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/database/src/lib/loadAnalysis.js +7 -1
- package/packages/database/src/lib/loadAnalysis.js.map +1 -1
- package/packages/database/src/lib/loadEntity.js +5 -5
- package/packages/database/src/lib/loadEntity.js.map +1 -1
- package/packages/utils/src/lib/fs/rsyncCopy.js +22 -1
- package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/Spinner-Df3UCi8k.js +0 -34
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-BBXArFPl.js +0 -43
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/editor._tab-DPw7NZHc.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-DYqG1D_d.js +0 -58
- package/codeyam-cli/src/webserver/build/client/assets/editorPreview-DggyRwOr.js +0 -41
- package/codeyam-cli/src/webserver/build/client/assets/globals-DRvOjyO3.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-f4212c17.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-F-k2uYj5.js +0 -67
- package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-BxxP_XF9.js +0 -2
- package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-if8kM_1Q.js +0 -13
- package/codeyam-cli/src/webserver/build/server/assets/init-D3HkMDbI.js +0 -10
- package/codeyam-cli/src/webserver/build/server/assets/server-build-DTCzJQiH.js +0 -551
- package/codeyam-cli/templates/expo-react-native/app/(tabs)/_layout.tsx +0 -33
- package/codeyam-cli/templates/expo-react-native/app/(tabs)/index.tsx +0 -12
- package/codeyam-cli/templates/expo-react-native/app/(tabs)/settings.tsx +0 -12
|
@@ -4,16 +4,34 @@
|
|
|
4
4
|
* Cross-references glossary entries against registered scenarios (components)
|
|
5
5
|
* and test files (functions) to detect gaps Claude may have missed.
|
|
6
6
|
*/
|
|
7
|
+
import { isIsolationUrl, scenarioEntityName, } from "./entityChangeStatus.js";
|
|
7
8
|
// ─── Logic ───────────────────────────────────────────────────────────
|
|
8
9
|
const COMPONENT_RETURN_PATTERNS = ['JSX', 'React', 'Element', 'ReactNode'];
|
|
10
|
+
/** File names that indicate page/route files — these are visual components
|
|
11
|
+
* verified via screenshots, not functions that need unit tests. */
|
|
12
|
+
const PAGE_FILE_NAMES = new Set([
|
|
13
|
+
'page.tsx',
|
|
14
|
+
'page.ts',
|
|
15
|
+
'index.tsx',
|
|
16
|
+
'index.ts',
|
|
17
|
+
]);
|
|
9
18
|
/**
|
|
10
|
-
* Returns true when the entry
|
|
11
|
-
*
|
|
19
|
+
* Returns true when the entry represents a visual component (needs scenarios,
|
|
20
|
+
* not unit tests). Matches on returnType containing JSX/React patterns, OR
|
|
21
|
+
* on file path patterns for page/route files.
|
|
12
22
|
*/
|
|
13
23
|
export function isComponent(entry) {
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
if (entry.returnType &&
|
|
25
|
+
COMPONENT_RETURN_PATTERNS.some((pat) => entry.returnType.includes(pat))) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
// Page/route files are visual components — verified via app scenarios, not tests
|
|
29
|
+
if (entry.filePath) {
|
|
30
|
+
const fileName = entry.filePath.split('/').pop() || '';
|
|
31
|
+
if (PAGE_FILE_NAMES.has(fileName))
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
17
35
|
}
|
|
18
36
|
/**
|
|
19
37
|
* Split glossary entries into components (JSX-returning) and functions (everything else).
|
|
@@ -39,14 +57,28 @@ export function classifyGlossaryEntries(entries) {
|
|
|
39
57
|
* @param scenarioCounts - Map of component_name → number of registered scenarios
|
|
40
58
|
* @param testFileExistence - Map of testFile path → whether the file exists on disk
|
|
41
59
|
*/
|
|
42
|
-
export function computeAudit({ components, functions, scenarioCounts, testFileExistence, testResults, clientErrors, }) {
|
|
60
|
+
export function computeAudit({ components, functions, scenarioCounts, testFileExistence, testResults, clientErrors, totalScenarioCounts, entityChangeStatus, analysisFailedEntities, testCaseCounts, }) {
|
|
43
61
|
const componentResults = components.map((c) => {
|
|
44
62
|
const count = scenarioCounts[c.name] || 0;
|
|
63
|
+
const totalCount = totalScenarioCounts?.[c.name] || 0;
|
|
64
|
+
const changeStatus = entityChangeStatus?.[c.name];
|
|
45
65
|
const errors = clientErrors?.[c.name];
|
|
46
66
|
const hasErrors = count > 0 && errors && errors.length > 0;
|
|
47
67
|
let status;
|
|
48
|
-
if (
|
|
49
|
-
status = '
|
|
68
|
+
if (analysisFailedEntities?.has(c.name)) {
|
|
69
|
+
status = 'analysis_failed';
|
|
70
|
+
}
|
|
71
|
+
else if (count === 0) {
|
|
72
|
+
// Entities with existing scenarios from prior sessions don't need
|
|
73
|
+
// new scenarios — they need recapture. This applies to both "edited"
|
|
74
|
+
// and "impacted" entities: an edited page may not have been re-registered
|
|
75
|
+
// this session, and an impacted page's dependency changed.
|
|
76
|
+
if (changeStatus && totalCount > 0) {
|
|
77
|
+
status = 'needs_recapture';
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
status = 'missing';
|
|
81
|
+
}
|
|
50
82
|
}
|
|
51
83
|
else if (hasErrors) {
|
|
52
84
|
status = 'has_errors';
|
|
@@ -54,12 +86,33 @@ export function computeAudit({ components, functions, scenarioCounts, testFileEx
|
|
|
54
86
|
else {
|
|
55
87
|
status = 'ok';
|
|
56
88
|
}
|
|
89
|
+
// Generate actionable hint for missing or needs_recapture components
|
|
90
|
+
let hint;
|
|
91
|
+
if (status === 'missing') {
|
|
92
|
+
const fileName = c.filePath.split('/').pop() || '';
|
|
93
|
+
if (fileName === 'layout.tsx' || fileName === 'layout.ts') {
|
|
94
|
+
hint = `This is a layout file — register an app-level scenario with pageFilePath instead of componentName: codeyam editor register '{"name":"${c.name} - Default","pageFilePath":"${c.filePath}","url":"/<route>","dimensions":["Desktop"]}'`;
|
|
95
|
+
}
|
|
96
|
+
else if (fileName === 'page.tsx' || fileName === 'page.ts') {
|
|
97
|
+
hint = `This is a page file — register an app-level scenario with pageFilePath: codeyam editor register '{"name":"${c.name} - Default","pageFilePath":"${c.filePath}","url":"/<route>","dimensions":["Desktop"]}'`;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
hint = `Register a component scenario via an isolation route: codeyam editor isolate ${c.name} then codeyam editor register '{"name":"${c.name} - Default","componentName":"${c.name}","url":"/isolated-components/${c.name}?s=Default","dimensions":["Desktop"]}'`;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else if (status === 'needs_recapture') {
|
|
104
|
+
hint = `This component's code or dependencies changed — recapture existing scenarios to update screenshots: codeyam editor recapture ${c.name}`;
|
|
105
|
+
}
|
|
106
|
+
else if (status === 'analysis_failed') {
|
|
107
|
+
hint = `Analysis failed for this component (likely timed out due to complex dependencies). The component has partial data but may be missing some dependency schemas. Try re-analyzing: codeyam editor analyze-imports`;
|
|
108
|
+
}
|
|
57
109
|
return {
|
|
58
110
|
name: c.name,
|
|
59
111
|
filePath: c.filePath,
|
|
60
|
-
scenarioCount: count,
|
|
112
|
+
scenarioCount: status === 'needs_recapture' ? totalCount : count,
|
|
61
113
|
status,
|
|
62
114
|
...(hasErrors ? { clientErrors: errors } : {}),
|
|
115
|
+
...(hint ? { hint } : {}),
|
|
63
116
|
};
|
|
64
117
|
});
|
|
65
118
|
const functionResults = functions.map((f) => {
|
|
@@ -67,12 +120,17 @@ export function computeAudit({ components, functions, scenarioCounts, testFileEx
|
|
|
67
120
|
? (testFileExistence[f.testFile] ?? false)
|
|
68
121
|
: false;
|
|
69
122
|
if (!exists) {
|
|
123
|
+
// Suggest conventional test file path when testFile isn't in the glossary
|
|
124
|
+
const suggestedTestFile = !f.testFile
|
|
125
|
+
? f.filePath.replace(/\.tsx?$/, '.test.ts')
|
|
126
|
+
: undefined;
|
|
70
127
|
return {
|
|
71
128
|
name: f.name,
|
|
72
129
|
filePath: f.filePath,
|
|
73
130
|
testFile: f.testFile,
|
|
74
131
|
testFileExists: false,
|
|
75
132
|
status: 'missing',
|
|
133
|
+
...(suggestedTestFile ? { suggestedTestFile } : {}),
|
|
76
134
|
};
|
|
77
135
|
}
|
|
78
136
|
// If we have test results for this file, use them for deeper status
|
|
@@ -100,6 +158,14 @@ export function computeAudit({ components, functions, scenarioCounts, testFileEx
|
|
|
100
158
|
else {
|
|
101
159
|
status = 'ok';
|
|
102
160
|
}
|
|
161
|
+
// Generate actionable hint for non-ok functions
|
|
162
|
+
let hint;
|
|
163
|
+
if (status === 'name_mismatch') {
|
|
164
|
+
hint = `Tests pass but won't show in the CodeYam UI. Add a top-level describe("${f.name}", ...) block in ${f.testFile}`;
|
|
165
|
+
}
|
|
166
|
+
else if (status === 'runner_error' && tr.errorMessage) {
|
|
167
|
+
hint = `Test runner crashed (not a test failure): ${tr.errorMessage}`;
|
|
168
|
+
}
|
|
103
169
|
return {
|
|
104
170
|
name: f.name,
|
|
105
171
|
filePath: f.filePath,
|
|
@@ -109,16 +175,23 @@ export function computeAudit({ components, functions, scenarioCounts, testFileEx
|
|
|
109
175
|
testsVisibleInUi: tr.hasEntityNameDescribe,
|
|
110
176
|
status,
|
|
111
177
|
...(tr.errorMessage ? { errorMessage: tr.errorMessage } : {}),
|
|
178
|
+
...(hint ? { hint } : {}),
|
|
179
|
+
...(testCaseCounts?.[f.name] !== undefined
|
|
180
|
+
? { testCaseCount: testCaseCounts[f.name] }
|
|
181
|
+
: {}),
|
|
112
182
|
};
|
|
113
183
|
});
|
|
114
184
|
const componentsOk = componentResults.filter((c) => c.status === 'ok').length;
|
|
115
185
|
const componentsWithErrors = componentResults.filter((c) => c.status === 'has_errors').length;
|
|
116
186
|
const componentsMissing = componentResults.filter((c) => c.status === 'missing').length;
|
|
187
|
+
const componentsNeedingRecapture = componentResults.filter((c) => c.status === 'needs_recapture').length;
|
|
188
|
+
const componentsAnalysisFailed = componentResults.filter((c) => c.status === 'analysis_failed').length;
|
|
117
189
|
const functionsOk = functionResults.filter((f) => f.status === 'ok').length;
|
|
118
190
|
const functionsFailing = functionResults.filter((f) => f.status === 'failing').length;
|
|
119
191
|
const functionsRunnerError = functionResults.filter((f) => f.status === 'runner_error').length;
|
|
120
192
|
const functionsNameMismatch = functionResults.filter((f) => f.status === 'name_mismatch').length;
|
|
121
193
|
const functionsMissing = functionResults.filter((f) => f.status === 'missing').length;
|
|
194
|
+
const functionsThinCoverage = functionResults.filter((f) => f.status === 'ok' && f.testCaseCount !== undefined && f.testCaseCount < 3).length;
|
|
122
195
|
return {
|
|
123
196
|
components: componentResults,
|
|
124
197
|
functions: functionResults,
|
|
@@ -127,14 +200,18 @@ export function computeAudit({ components, functions, scenarioCounts, testFileEx
|
|
|
127
200
|
componentsOk,
|
|
128
201
|
componentsMissing,
|
|
129
202
|
componentsWithErrors,
|
|
203
|
+
componentsNeedingRecapture,
|
|
204
|
+
componentsAnalysisFailed,
|
|
130
205
|
totalFunctions: functionResults.length,
|
|
131
206
|
functionsOk,
|
|
132
207
|
functionsMissing,
|
|
133
208
|
functionsFailing,
|
|
134
209
|
functionsRunnerError,
|
|
135
210
|
functionsNameMismatch,
|
|
211
|
+
functionsThinCoverage,
|
|
136
212
|
allPassing: componentsMissing === 0 &&
|
|
137
213
|
componentsWithErrors === 0 &&
|
|
214
|
+
componentsAnalysisFailed === 0 &&
|
|
138
215
|
functionsFailing === 0 &&
|
|
139
216
|
functionsRunnerError === 0 &&
|
|
140
217
|
functionsNameMismatch === 0 &&
|
|
@@ -143,30 +220,166 @@ export function computeAudit({ components, functions, scenarioCounts, testFileEx
|
|
|
143
220
|
};
|
|
144
221
|
}
|
|
145
222
|
/**
|
|
146
|
-
* Returns true when the audit failure can be auto-fixed
|
|
147
|
-
*
|
|
148
|
-
*
|
|
223
|
+
* Returns true when the audit failure can be auto-fixed inline.
|
|
224
|
+
*
|
|
225
|
+
* Always returns false — full analyze-imports takes minutes on large projects
|
|
226
|
+
* and must never run as part of the audit. The audit only does lightweight
|
|
227
|
+
* entity SHA backfill. Users should run `codeyam editor analyze-imports`
|
|
228
|
+
* separately if incomplete entities persist.
|
|
149
229
|
*/
|
|
150
|
-
export function isAutoRemediable(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
230
|
+
export function isAutoRemediable(_summary, _alreadyAttempted) {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Determine whether the audit should auto-recapture stale scenarios.
|
|
235
|
+
* Returns true when the `--fix` flag is set AND there are stale scenarios.
|
|
236
|
+
*/
|
|
237
|
+
export function shouldAutoRecapture(params) {
|
|
238
|
+
return params.fix && params.scenariosNeedingRecapture.length > 0;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Extract unique file paths that need targeted analysis from audit results.
|
|
242
|
+
*
|
|
243
|
+
* After a DB-only backfill attempt fails, these are the files that need
|
|
244
|
+
* `analyze-imports` to create entity records. Unlike full analyze-imports
|
|
245
|
+
* (which scans ALL glossary + page files), this returns only the specific
|
|
246
|
+
* files that have unresolved associations — typically 1-3 files.
|
|
247
|
+
*/
|
|
248
|
+
export function determineTargetedAnalysisPaths(auditData) {
|
|
249
|
+
const paths = new Set();
|
|
250
|
+
for (const u of auditData.unassociatedScenarios) {
|
|
251
|
+
if (u.filePath)
|
|
252
|
+
paths.add(u.filePath);
|
|
253
|
+
}
|
|
254
|
+
for (const e of auditData.incompleteEntities) {
|
|
255
|
+
if (e.filePath)
|
|
256
|
+
paths.add(e.filePath);
|
|
257
|
+
}
|
|
258
|
+
return [...paths];
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Generate clear, actionable guidance for an incomplete entity.
|
|
262
|
+
*
|
|
263
|
+
* Tells Claude exactly what's wrong, whether it's pre-existing, and
|
|
264
|
+
* the exact command to fix it — no guessing required.
|
|
265
|
+
*/
|
|
266
|
+
export function formatIncompleteEntityGuidance(entity) {
|
|
267
|
+
const parts = [];
|
|
268
|
+
if (entity.preExisting) {
|
|
269
|
+
parts.push(`${entity.name}: ${entity.scenarioCount} scenario(s) without import graph (pre-existing issue, not from this session).`);
|
|
270
|
+
parts.push(`This is non-blocking — the entity had scenarios before this session but analyze-imports was never run for it.`);
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
parts.push(`${entity.name}: ${entity.scenarioCount} scenario(s) without import graph — analyze-imports has not been run for this entity.`);
|
|
274
|
+
parts.push(`The entity has scenarios registered but its import graph is not built, so the editor cannot track its dependencies.`);
|
|
275
|
+
}
|
|
276
|
+
parts.push(`Fix: Run \`codeyam editor analyze-imports\` to build the import graph for all entities.`);
|
|
277
|
+
return parts.join(' ');
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Generate step-by-step manual analysis instructions for an entity
|
|
281
|
+
* whose automated analysis has persistently failed.
|
|
282
|
+
*
|
|
283
|
+
* Used by the audit when analysis-failures.json contains the entity.
|
|
284
|
+
* Tells Claude exactly how to read the source, gather imports/types,
|
|
285
|
+
* and run `codeyam editor manual-entity` to unblock the audit.
|
|
286
|
+
*/
|
|
287
|
+
export function formatManualAnalysisGuidance(entity) {
|
|
288
|
+
const lines = [];
|
|
289
|
+
lines.push(`${entity.name}: ${entity.scenarioCount} scenario(s) — automated analysis failed`);
|
|
290
|
+
lines.push(`Error: ${entity.error}`);
|
|
291
|
+
lines.push('');
|
|
292
|
+
lines.push('MANUAL ANALYSIS REQUIRED — follow these steps:');
|
|
293
|
+
lines.push(`1. Read ${entity.filePath}`);
|
|
294
|
+
lines.push('2. Identify which glossary entities it imports (check .codeyam/glossary.json)');
|
|
295
|
+
lines.push('3. Determine entity type: "visual" if it returns JSX, "library" otherwise');
|
|
296
|
+
lines.push('4. Identify the type structure:');
|
|
297
|
+
lines.push(' - For components: props interface and hook return types');
|
|
298
|
+
lines.push(' - For functions: parameter types and return type');
|
|
299
|
+
lines.push(`5. Write the JSON to .codeyam/tmp/manual-entity.json then run: codeyam editor manual-entity @.codeyam/tmp/manual-entity.json`);
|
|
300
|
+
return lines.join('\n');
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Resolve incomplete entity SHAs to their source file paths.
|
|
304
|
+
*
|
|
305
|
+
* Used by the audit to run targeted analysis on just the files that need it,
|
|
306
|
+
* instead of scanning all 117+ project files. Returns deduplicated file paths.
|
|
307
|
+
*/
|
|
308
|
+
export async function getIncompleteEntityFilePaths(db, incompleteEntities) {
|
|
309
|
+
if (incompleteEntities.length === 0)
|
|
310
|
+
return [];
|
|
311
|
+
const shas = incompleteEntities.map((e) => e.entitySha);
|
|
312
|
+
const rows = await db
|
|
313
|
+
.selectFrom('entities')
|
|
314
|
+
.select('file_path')
|
|
315
|
+
.where('sha', 'in', shas)
|
|
316
|
+
.execute();
|
|
317
|
+
const paths = new Set();
|
|
318
|
+
for (const row of rows) {
|
|
319
|
+
if (row.file_path)
|
|
320
|
+
paths.add(row.file_path);
|
|
321
|
+
}
|
|
322
|
+
return [...paths];
|
|
156
323
|
}
|
|
157
324
|
/**
|
|
158
|
-
* Returns true when
|
|
159
|
-
*
|
|
160
|
-
*
|
|
325
|
+
* Returns true when the only audit failures are auto-fixable entity issues
|
|
326
|
+
* (incompleteEntities and/or unassociatedScenarios) — all other failure
|
|
327
|
+
* counts are zero. Used to decide whether auto-running analyze-imports +
|
|
328
|
+
* entity SHA sync can fix the audit without manual intervention.
|
|
161
329
|
*/
|
|
162
330
|
export function isOnlyIncompleteEntities(summary) {
|
|
163
331
|
return ((summary.componentsMissing ?? 0) === 0 &&
|
|
164
332
|
(summary.componentsWithErrors ?? 0) === 0 &&
|
|
165
333
|
(summary.functionsFailing ?? 0) === 0 &&
|
|
334
|
+
(summary.functionsRunnerError ?? 0) === 0 &&
|
|
166
335
|
(summary.functionsNameMismatch ?? 0) === 0 &&
|
|
167
336
|
(summary.functionsMissing ?? 0) === 0 &&
|
|
168
337
|
(summary.missingFromGlossary ?? 0) === 0 &&
|
|
169
|
-
(summary.miscategorizedScenarios ?? 0) === 0
|
|
338
|
+
(summary.miscategorizedScenarios ?? 0) === 0 &&
|
|
339
|
+
(summary.scenariosNeedingRecapture ?? 0) === 0);
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Returns true when the only audit failures are incomplete entities that ALL
|
|
343
|
+
* existed before the current session. Used by the step gate to avoid blocking
|
|
344
|
+
* progress on pre-existing issues the user didn't cause.
|
|
345
|
+
*
|
|
346
|
+
* Requires both the summary (to confirm no other failure types) and the
|
|
347
|
+
* incompleteEntities array (to verify every entry is pre-existing).
|
|
348
|
+
*/
|
|
349
|
+
export function isOnlyPreExistingIncomplete(summary, incompleteEntities) {
|
|
350
|
+
// Must have at least one incomplete entity to be relevant
|
|
351
|
+
if (!incompleteEntities || incompleteEntities.length === 0)
|
|
352
|
+
return false;
|
|
353
|
+
// All other failure types must be zero
|
|
354
|
+
if (!isOnlyIncompleteEntities(summary))
|
|
355
|
+
return false;
|
|
356
|
+
// Every incomplete entity must be pre-existing
|
|
357
|
+
return incompleteEntities.every((e) => e.preExisting);
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Filter a list of file paths to only those that need analysis.
|
|
361
|
+
*
|
|
362
|
+
* A file is excluded if ANY entity at that file path has an analysis
|
|
363
|
+
* record (direct or inherited from a sibling version with the same
|
|
364
|
+
* name+filePath). Everything else passes through.
|
|
365
|
+
*
|
|
366
|
+
* Used by handleAnalyzeImports to avoid re-analyzing ~120 files when
|
|
367
|
+
* only a few need it.
|
|
368
|
+
*/
|
|
369
|
+
export async function filterToIncompleteFilePaths(db, _projectId, allFilePaths) {
|
|
370
|
+
if (allFilePaths.length === 0)
|
|
371
|
+
return [];
|
|
372
|
+
// Single query: find all file paths that have at least one entity
|
|
373
|
+
// with an analysis record. These are already analyzed and can be skipped.
|
|
374
|
+
const analyzedRows = await db
|
|
375
|
+
.selectFrom('entities')
|
|
376
|
+
.innerJoin('analyses', 'analyses.entity_sha', 'entities.sha')
|
|
377
|
+
.select('entities.file_path')
|
|
378
|
+
.where('entities.file_path', 'in', allFilePaths)
|
|
379
|
+
.groupBy('entities.file_path')
|
|
380
|
+
.execute();
|
|
381
|
+
const analyzedFilePaths = new Set(analyzedRows.map((r) => r.file_path));
|
|
382
|
+
return allFilePaths.filter((fp) => !analyzedFilePaths.has(fp));
|
|
170
383
|
}
|
|
171
384
|
/**
|
|
172
385
|
* Ensures the two audit filters — glossary scoping and scenario-count scoping —
|
|
@@ -214,22 +427,15 @@ export function filterGlossaryByChangeStatus(entries, entityChangeStatus) {
|
|
|
214
427
|
*/
|
|
215
428
|
export async function queryIncompleteEntities(db, projectId, featureStartedAt) {
|
|
216
429
|
// Step 1: Get distinct entity SHAs from scenarios (with counts)
|
|
217
|
-
|
|
430
|
+
// No time filter — we check ALL scenarios to catch entities whose
|
|
431
|
+
// scenario SHAs were updated mid-session without touching updated_at.
|
|
432
|
+
const scenarioQuery = db
|
|
218
433
|
.selectFrom('editor_scenarios')
|
|
219
434
|
.select(['entity_sha'])
|
|
220
435
|
.select(db.fn.count('id').as('count'))
|
|
221
436
|
.where('project_id', '=', projectId)
|
|
222
437
|
.where('entity_sha', 'is not', null)
|
|
223
438
|
.groupBy('entity_sha');
|
|
224
|
-
if (featureStartedAt) {
|
|
225
|
-
const sqliteTimestamp = featureStartedAt
|
|
226
|
-
.replace('T', ' ')
|
|
227
|
-
.replace(/\.\d{3}Z$/, '');
|
|
228
|
-
scenarioQuery = scenarioQuery.where((eb) => eb.or([
|
|
229
|
-
eb('created_at', '>=', sqliteTimestamp),
|
|
230
|
-
eb('updated_at', '>=', sqliteTimestamp),
|
|
231
|
-
]));
|
|
232
|
-
}
|
|
233
439
|
const scenarioRows = await scenarioQuery.execute();
|
|
234
440
|
if (scenarioRows.length === 0)
|
|
235
441
|
return [];
|
|
@@ -258,24 +464,41 @@ export async function queryIncompleteEntities(db, projectId, featureStartedAt) {
|
|
|
258
464
|
// A new entity version (created by the file watcher) may not have direct
|
|
259
465
|
// analyses, but an older version (same name+filePath) might. This matches
|
|
260
466
|
// getAllEntities() behavior which inherits analyses across versions.
|
|
261
|
-
|
|
262
|
-
|
|
467
|
+
// IMPORTANT: Must match by name+filePath, not name alone. When a component
|
|
468
|
+
// is extracted to a new file, the old version (different filePath) may have
|
|
469
|
+
// analyses but getAllEntities() won't inherit across different file paths.
|
|
470
|
+
const entityFilePathMap = new Map(entityRows.map((r) => [r.sha, r.file_path]));
|
|
471
|
+
const entityKeys = [
|
|
472
|
+
...new Set(entityRows
|
|
473
|
+
.map((r) => `${r.name}::${r.file_path}`)
|
|
474
|
+
.filter((k) => !k.startsWith('::') && !k.endsWith('::'))),
|
|
263
475
|
];
|
|
264
|
-
let
|
|
265
|
-
if (
|
|
476
|
+
let keysWithInheritedAnalyses = new Set();
|
|
477
|
+
if (entityKeys.length > 0) {
|
|
478
|
+
// We need to find entities that share name+filePath AND have analyses.
|
|
479
|
+
// Since Kysely doesn't support WHERE (name || '::' || file_path) IN (...),
|
|
480
|
+
// query by the entity names and filter by filePath in JS.
|
|
481
|
+
const entityNames = [
|
|
482
|
+
...new Set(entityRows.map((r) => r.name).filter(Boolean)),
|
|
483
|
+
];
|
|
266
484
|
const siblingRows = await db
|
|
267
485
|
.selectFrom('entities')
|
|
268
486
|
.innerJoin('analyses', 'analyses.entity_sha', 'entities.sha')
|
|
269
|
-
.select('entities.name')
|
|
487
|
+
.select(['entities.name', 'entities.file_path'])
|
|
270
488
|
.where('entities.name', 'in', entityNames)
|
|
271
|
-
.groupBy('entities.name')
|
|
489
|
+
.groupBy(['entities.name', 'entities.file_path'])
|
|
272
490
|
.execute();
|
|
273
|
-
|
|
491
|
+
keysWithInheritedAnalyses = new Set(siblingRows.map((r) => `${r.name}::${r.file_path}`));
|
|
274
492
|
}
|
|
275
|
-
// Filter out entities that have inherited analyses
|
|
493
|
+
// Filter out entities that have inherited analyses (same name+filePath)
|
|
276
494
|
const trulyIncompleteShas = incompleteShas.filter((r) => {
|
|
277
|
-
const
|
|
278
|
-
|
|
495
|
+
const sha = r.entity_sha;
|
|
496
|
+
const name = entityNameMap.get(sha);
|
|
497
|
+
const filePath = entityFilePathMap.get(sha);
|
|
498
|
+
if (!name)
|
|
499
|
+
return false; // No entity record (phantom SHA) — skip, not fixable by analysis
|
|
500
|
+
const key = `${name}::${filePath}`;
|
|
501
|
+
return !keysWithInheritedAnalyses.has(key);
|
|
279
502
|
});
|
|
280
503
|
if (trulyIncompleteShas.length === 0)
|
|
281
504
|
return [];
|
|
@@ -293,12 +516,34 @@ export async function queryIncompleteEntities(db, projectId, featureStartedAt) {
|
|
|
293
516
|
r.entity_sha,
|
|
294
517
|
r.component_name,
|
|
295
518
|
]));
|
|
519
|
+
// Step 6: Determine preExisting flag — if featureStartedAt is provided,
|
|
520
|
+
// check which entity SHAs have at least one scenario created/updated
|
|
521
|
+
// during the session. Those without any are pre-existing issues.
|
|
522
|
+
let sessionShas = new Set();
|
|
523
|
+
if (featureStartedAt) {
|
|
524
|
+
const sqliteTimestamp = featureStartedAt
|
|
525
|
+
.replace('T', ' ')
|
|
526
|
+
.replace(/\.\d{3}Z$/, '');
|
|
527
|
+
const sessionRows = await db
|
|
528
|
+
.selectFrom('editor_scenarios')
|
|
529
|
+
.select('entity_sha')
|
|
530
|
+
.where('project_id', '=', projectId)
|
|
531
|
+
.where('entity_sha', 'in', trulyIncompleteShalist)
|
|
532
|
+
.where((eb) => eb.or([
|
|
533
|
+
eb('created_at', '>=', sqliteTimestamp),
|
|
534
|
+
eb('updated_at', '>=', sqliteTimestamp),
|
|
535
|
+
]))
|
|
536
|
+
.groupBy('entity_sha')
|
|
537
|
+
.execute();
|
|
538
|
+
sessionShas = new Set(sessionRows.map((r) => r.entity_sha));
|
|
539
|
+
}
|
|
296
540
|
return trulyIncompleteShas.map((r) => {
|
|
297
541
|
const sha = r.entity_sha;
|
|
298
542
|
return {
|
|
299
543
|
entitySha: sha,
|
|
300
544
|
name: entityNameMap.get(sha) || scenarioNameMap.get(sha) || 'Unknown',
|
|
301
545
|
scenarioCount: Number(r.count),
|
|
546
|
+
preExisting: featureStartedAt ? !sessionShas.has(sha) : false,
|
|
302
547
|
};
|
|
303
548
|
});
|
|
304
549
|
}
|
|
@@ -330,7 +575,7 @@ export async function queryMiscategorizedScenarios(db, projectId, featureStarted
|
|
|
330
575
|
}
|
|
331
576
|
const rows = await query.execute();
|
|
332
577
|
// Filter to only rows where URL is NOT an isolation route
|
|
333
|
-
const miscategorized = rows.filter((r) => r.url && !r.url
|
|
578
|
+
const miscategorized = rows.filter((r) => r.url && !isIsolationUrl(r.url));
|
|
334
579
|
if (miscategorized.length === 0)
|
|
335
580
|
return [];
|
|
336
581
|
// Group by (component_name, url)
|
|
@@ -385,4 +630,220 @@ export async function queryScenarioCounts(db, projectId, featureStartedAt) {
|
|
|
385
630
|
}
|
|
386
631
|
return counts;
|
|
387
632
|
}
|
|
633
|
+
/**
|
|
634
|
+
* Query scenario counts per page file path for app-level scenarios.
|
|
635
|
+
*
|
|
636
|
+
* App-level scenarios have `component_name = null` and are linked to pages
|
|
637
|
+
* via `page_file_path`. This mirrors `queryScenarioCounts` but groups by
|
|
638
|
+
* `page_file_path` instead of `component_name`.
|
|
639
|
+
*/
|
|
640
|
+
export async function queryPageScenarioCounts(db, projectId, featureStartedAt) {
|
|
641
|
+
let query = db
|
|
642
|
+
.selectFrom('editor_scenarios')
|
|
643
|
+
.select(['page_file_path'])
|
|
644
|
+
.select(db.fn.count('id').as('count'))
|
|
645
|
+
.where('project_id', '=', projectId)
|
|
646
|
+
.where('component_name', 'is', null)
|
|
647
|
+
.where('page_file_path', 'is not', null)
|
|
648
|
+
.groupBy('page_file_path');
|
|
649
|
+
if (featureStartedAt) {
|
|
650
|
+
const sqliteTimestamp = featureStartedAt
|
|
651
|
+
.replace('T', ' ')
|
|
652
|
+
.replace(/\.\d{3}Z$/, '');
|
|
653
|
+
query = query.where((eb) => eb.or([
|
|
654
|
+
eb('created_at', '>=', sqliteTimestamp),
|
|
655
|
+
eb('updated_at', '>=', sqliteTimestamp),
|
|
656
|
+
]));
|
|
657
|
+
}
|
|
658
|
+
const rows = await query.execute();
|
|
659
|
+
const counts = {};
|
|
660
|
+
for (const row of rows) {
|
|
661
|
+
if (row.page_file_path) {
|
|
662
|
+
counts[row.page_file_path] = Number(row.count);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
return counts;
|
|
666
|
+
}
|
|
667
|
+
// ─── Unassociated Scenarios ───────────────────────────────────────────
|
|
668
|
+
/**
|
|
669
|
+
* Find scenarios with NULL entity_sha that have a file path
|
|
670
|
+
* (component_path or page_file_path). These scenarios were registered
|
|
671
|
+
* before entity records existed in the DB — typically because a subagent
|
|
672
|
+
* registered scenarios without running analyze-imports first.
|
|
673
|
+
*
|
|
674
|
+
* Fix: run `codeyam editor analyze-imports` to create entity records,
|
|
675
|
+
* then entity_sha backfill will associate them automatically.
|
|
676
|
+
*
|
|
677
|
+
* Optionally scoped to the current feature session via featureStartedAt.
|
|
678
|
+
*/
|
|
679
|
+
export async function queryUnassociatedScenarios(db, projectId, featureStartedAt) {
|
|
680
|
+
let query = db
|
|
681
|
+
.selectFrom('editor_scenarios')
|
|
682
|
+
.select(['component_name', 'component_path', 'page_file_path', 'name'])
|
|
683
|
+
.where('project_id', '=', projectId)
|
|
684
|
+
.where('entity_sha', 'is', null)
|
|
685
|
+
.where((eb) => eb.or([
|
|
686
|
+
eb('component_path', 'is not', null),
|
|
687
|
+
eb('page_file_path', 'is not', null),
|
|
688
|
+
]));
|
|
689
|
+
if (featureStartedAt) {
|
|
690
|
+
const sqliteTimestamp = featureStartedAt
|
|
691
|
+
.replace('T', ' ')
|
|
692
|
+
.replace(/\.\d{3}Z$/, '');
|
|
693
|
+
query = query.where((eb) => eb.or([
|
|
694
|
+
eb('created_at', '>=', sqliteTimestamp),
|
|
695
|
+
eb('updated_at', '>=', sqliteTimestamp),
|
|
696
|
+
]));
|
|
697
|
+
}
|
|
698
|
+
const rows = await query.execute();
|
|
699
|
+
if (rows.length === 0)
|
|
700
|
+
return [];
|
|
701
|
+
// Group by file path (component_path or page_file_path)
|
|
702
|
+
const groups = new Map();
|
|
703
|
+
for (const row of rows) {
|
|
704
|
+
const r = row;
|
|
705
|
+
const filePath = r.component_path || r.page_file_path;
|
|
706
|
+
const existing = groups.get(filePath);
|
|
707
|
+
if (existing) {
|
|
708
|
+
existing.scenarioNames.push(r.name);
|
|
709
|
+
}
|
|
710
|
+
else {
|
|
711
|
+
// Derive a display name: use component_name if available,
|
|
712
|
+
// otherwise extract from file path (e.g., "src/lib/LibraryApp.tsx" → "LibraryApp")
|
|
713
|
+
const displayName = r.component_name ||
|
|
714
|
+
filePath
|
|
715
|
+
.split('/')
|
|
716
|
+
.pop()
|
|
717
|
+
?.replace(/\.\w+$/, '') ||
|
|
718
|
+
filePath;
|
|
719
|
+
groups.set(filePath, {
|
|
720
|
+
name: displayName,
|
|
721
|
+
filePath,
|
|
722
|
+
scenarioNames: [r.name],
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
return [...groups.values()].map((g) => ({
|
|
727
|
+
name: g.name,
|
|
728
|
+
filePath: g.filePath,
|
|
729
|
+
scenarioCount: g.scenarioNames.length,
|
|
730
|
+
scenarioNames: g.scenarioNames,
|
|
731
|
+
}));
|
|
732
|
+
}
|
|
733
|
+
// ─── Duplicate Name Detection ─────────────────────────────────────────
|
|
734
|
+
/**
|
|
735
|
+
* Detect glossary entries that share the same `name`.
|
|
736
|
+
*
|
|
737
|
+
* Returns a Map of name → entries[] for names that appear more than once.
|
|
738
|
+
* Single-occurrence names are excluded. Used to warn Claude that ambiguous
|
|
739
|
+
* names will make audit output confusing (e.g., three entries all named "Page").
|
|
740
|
+
*/
|
|
741
|
+
export function detectDuplicateNames(entries) {
|
|
742
|
+
const groups = new Map();
|
|
743
|
+
for (const entry of entries) {
|
|
744
|
+
const existing = groups.get(entry.name);
|
|
745
|
+
if (existing)
|
|
746
|
+
existing.push(entry);
|
|
747
|
+
else
|
|
748
|
+
groups.set(entry.name, [entry]);
|
|
749
|
+
}
|
|
750
|
+
// Only return groups with duplicates
|
|
751
|
+
for (const [name, group] of groups) {
|
|
752
|
+
if (group.length <= 1)
|
|
753
|
+
groups.delete(name);
|
|
754
|
+
}
|
|
755
|
+
return groups;
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Identify scenarios that need recapture because their entity (or an entity
|
|
759
|
+
* in their dependency tree) has changed.
|
|
760
|
+
*
|
|
761
|
+
* Each scenario's entity name is resolved from its entity_sha (which points
|
|
762
|
+
* to the default export for app-level scenarios). The caller joins
|
|
763
|
+
* editor_scenarios.entity_sha → entities.name before calling this function.
|
|
764
|
+
*
|
|
765
|
+
* A scenario needs recapture when its entity has status 'edited' or 'impacted'
|
|
766
|
+
* AND the scenario was NOT re-registered in the current feature session.
|
|
767
|
+
*/
|
|
768
|
+
export function identifyScenariosNeedingRecapture(params) {
|
|
769
|
+
const { scenarios, entityChangeStatus } = params;
|
|
770
|
+
if (!entityChangeStatus || Object.keys(entityChangeStatus).length === 0) {
|
|
771
|
+
return [];
|
|
772
|
+
}
|
|
773
|
+
const result = [];
|
|
774
|
+
for (const scenario of scenarios) {
|
|
775
|
+
if (scenario.updatedInSession)
|
|
776
|
+
continue;
|
|
777
|
+
if (!scenario.entityName)
|
|
778
|
+
continue;
|
|
779
|
+
const changeStatus = entityChangeStatus[scenario.entityName];
|
|
780
|
+
if (!changeStatus)
|
|
781
|
+
continue;
|
|
782
|
+
// "new" entities need initial scenario creation, not recapture.
|
|
783
|
+
// Only "edited" and "impacted" entities have stale screenshots.
|
|
784
|
+
if (changeStatus.status === 'new')
|
|
785
|
+
continue;
|
|
786
|
+
result.push({
|
|
787
|
+
scenarioName: scenario.name,
|
|
788
|
+
entityName: scenario.entityName,
|
|
789
|
+
status: changeStatus,
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
return result;
|
|
793
|
+
}
|
|
794
|
+
// ─── Client Error Aggregation ─────────────────────────────────────────
|
|
795
|
+
/**
|
|
796
|
+
* Aggregate client errors by component name using scenario metadata.
|
|
797
|
+
*
|
|
798
|
+
* Given a map of scenario ID → { scenarioName, errors } and a list of
|
|
799
|
+
* scenario metadata (with componentName from the DB), group errors by
|
|
800
|
+
* the component they belong to.
|
|
801
|
+
*
|
|
802
|
+
* For component scenarios: use the `componentName` field directly.
|
|
803
|
+
* For app-level scenarios (no componentName): derive the entity name
|
|
804
|
+
* using `scenarioEntityName()` — the same canonical function used by
|
|
805
|
+
* recapture detection and entity change status. This ensures the keys
|
|
806
|
+
* match what `computeAudit` checks against glossary entry names.
|
|
807
|
+
*
|
|
808
|
+
* This replaces the fragile "parse component name from scenario name"
|
|
809
|
+
* approach which fails for app-level scenarios like "Full Page with Library".
|
|
810
|
+
*/
|
|
811
|
+
export function aggregateClientErrorsByComponent(clientErrors, scenarioMetadata) {
|
|
812
|
+
const result = {};
|
|
813
|
+
// Build a lookup from scenario name → component/entity name.
|
|
814
|
+
// Uses scenarioEntityName() for consistency with the rest of the system
|
|
815
|
+
// (recapture detection, entity change status, journal filtering).
|
|
816
|
+
const scenarioToComponent = new Map();
|
|
817
|
+
for (const meta of scenarioMetadata) {
|
|
818
|
+
const entityName = scenarioEntityName({
|
|
819
|
+
componentName: meta.componentName,
|
|
820
|
+
pageFilePath: meta.pageFilePath,
|
|
821
|
+
url: meta.url,
|
|
822
|
+
});
|
|
823
|
+
if (entityName) {
|
|
824
|
+
scenarioToComponent.set(meta.name, entityName);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
for (const [, data] of Object.entries(clientErrors)) {
|
|
828
|
+
if (data.errors.length === 0)
|
|
829
|
+
continue;
|
|
830
|
+
// First try: look up via scenario metadata (authoritative)
|
|
831
|
+
let componentName = scenarioToComponent.get(data.scenarioName);
|
|
832
|
+
// Fallback: parse from scenario name convention "ComponentName - Variant"
|
|
833
|
+
if (!componentName) {
|
|
834
|
+
const dashIndex = data.scenarioName.indexOf(' - ');
|
|
835
|
+
componentName =
|
|
836
|
+
dashIndex >= 0
|
|
837
|
+
? data.scenarioName.slice(0, dashIndex)
|
|
838
|
+
: data.scenarioName;
|
|
839
|
+
}
|
|
840
|
+
if (componentName) {
|
|
841
|
+
if (!result[componentName]) {
|
|
842
|
+
result[componentName] = [];
|
|
843
|
+
}
|
|
844
|
+
result[componentName].push(...data.errors);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
return result;
|
|
848
|
+
}
|
|
388
849
|
//# sourceMappingURL=editorAudit.js.map
|