@codeyam/codeyam-cli 0.1.0-staging.eb21b2f → 0.1.0-staging.f777668
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 +21 -21
- package/analyzer-template/packages/ai/package.json +2 -2
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +34 -3
- package/analyzer-template/packages/ai/src/lib/completionCall.ts +114 -113
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +259 -5
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.ts +62 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.ts +35 -0
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +78 -2
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +0 -33
- package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +19 -7
- package/analyzer-template/packages/analyze/src/lib/asts/index.ts +7 -2
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/getNodeType.ts +1 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +9 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +0 -6
- package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +12 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +65 -28
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +83 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +0 -98
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +23 -4
- package/analyzer-template/packages/aws/package.json +10 -10
- package/analyzer-template/packages/database/index.ts +1 -0
- package/analyzer-template/packages/database/package.json +3 -3
- package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -0
- package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +68 -0
- package/analyzer-template/packages/database/src/lib/loadCommits.ts +31 -20
- package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +0 -5
- package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +151 -135
- package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatus.ts +58 -42
- package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.ts +81 -65
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +29 -1
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +33 -5
- package/analyzer-template/packages/github/dist/database/index.d.ts +1 -0
- package/analyzer-template/packages/github/dist/database/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/index.js +1 -0
- package/analyzer-template/packages/github/dist/database/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +5 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +22 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +51 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +5 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +23 -13
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +100 -89
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js +41 -30
- package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
- package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +1 -0
- package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +10 -0
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/github/package.json +1 -1
- package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +1 -0
- package/analyzer-template/packages/types/src/types/Scenario.ts +10 -0
- package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +1 -0
- package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +10 -0
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -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 +6 -2
- 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 +14 -2
- package/analyzer-template/playwright/captureFromUrl.ts +89 -82
- package/analyzer-template/project/constructMockCode.ts +168 -48
- package/analyzer-template/project/orchestrateCapture.ts +4 -1
- package/analyzer-template/project/reconcileMockDataKeys.ts +19 -14
- package/analyzer-template/project/start.ts +3 -0
- package/analyzer-template/project/startScenarioCapture.ts +9 -0
- package/analyzer-template/project/writeClientLogRoute.ts +125 -0
- package/analyzer-template/project/writeMockDataTsx.ts +17 -0
- package/analyzer-template/project/writeScenarioComponents.ts +96 -17
- package/analyzer-template/tsconfig.json +13 -1
- package/background/src/lib/virtualized/project/constructMockCode.js +143 -39
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js +4 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +17 -11
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
- package/background/src/lib/virtualized/project/start.js +2 -0
- package/background/src/lib/virtualized/project/start.js.map +1 -1
- package/background/src/lib/virtualized/project/startScenarioCapture.js +5 -0
- package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/writeClientLogRoute.js +110 -0
- package/background/src/lib/virtualized/project/writeClientLogRoute.js.map +1 -0
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +12 -0
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +73 -12
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/codeyam-cli/scripts/apply-setup.js +208 -11
- package/codeyam-cli/scripts/apply-setup.js.map +1 -1
- package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js +196 -0
- package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js.map +1 -0
- package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js +114 -0
- package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js.map +1 -0
- package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js +149 -0
- package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js.map +1 -0
- package/codeyam-cli/src/cli.js +32 -25
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/commands/analyze.js +17 -7
- package/codeyam-cli/src/commands/analyze.js.map +1 -1
- package/codeyam-cli/src/commands/default.js +14 -2
- package/codeyam-cli/src/commands/default.js.map +1 -1
- package/codeyam-cli/src/commands/editor.js +2607 -0
- package/codeyam-cli/src/commands/editor.js.map +1 -0
- package/codeyam-cli/src/commands/init.js +40 -11
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/commands/memory.js +29 -58
- package/codeyam-cli/src/commands/memory.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/devServerState.test.js +134 -0
- package/codeyam-cli/src/utils/__tests__/devServerState.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorApi.test.js +127 -0
- package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +635 -0
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorCapture.test.js +93 -0
- package/codeyam-cli/src/utils/__tests__/editorCapture.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +155 -0
- package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +121 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js +294 -0
- package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +542 -0
- package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +393 -0
- package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorMockState.test.js +270 -0
- package/codeyam-cli/src/utils/__tests__/editorMockState.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +217 -0
- package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +266 -0
- package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js +139 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +221 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +221 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +213 -0
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +1686 -0
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/git.editor.test.js +134 -0
- package/codeyam-cli/src/utils/__tests__/git.editor.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +107 -0
- package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js +6 -0
- package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js +101 -0
- package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js +9 -0
- package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/project.test.js +65 -0
- package/codeyam-cli/src/utils/__tests__/project.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js +121 -0
- package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +246 -0
- package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +50 -4
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js +50 -0
- package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js.map +1 -0
- package/codeyam-cli/src/utils/backgroundServer.js +21 -5
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/buildFlags.js +4 -0
- package/codeyam-cli/src/utils/buildFlags.js.map +1 -0
- package/codeyam-cli/src/utils/devModeEvents.js +40 -0
- package/codeyam-cli/src/utils/devModeEvents.js.map +1 -0
- package/codeyam-cli/src/utils/devServerState.js +71 -0
- package/codeyam-cli/src/utils/devServerState.js.map +1 -0
- package/codeyam-cli/src/utils/editorApi.js +73 -0
- package/codeyam-cli/src/utils/editorApi.js.map +1 -0
- package/codeyam-cli/src/utils/editorAudit.js +159 -0
- package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
- package/codeyam-cli/src/utils/editorCapture.js +102 -0
- package/codeyam-cli/src/utils/editorCapture.js.map +1 -0
- package/codeyam-cli/src/utils/editorDevServer.js +109 -0
- package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
- package/codeyam-cli/src/utils/editorEntityChangeStatus.js +44 -0
- package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -0
- package/codeyam-cli/src/utils/editorImageVerifier.js +155 -0
- package/codeyam-cli/src/utils/editorImageVerifier.js.map +1 -0
- package/codeyam-cli/src/utils/editorJournal.js +225 -0
- package/codeyam-cli/src/utils/editorJournal.js.map +1 -0
- package/codeyam-cli/src/utils/editorLoaderHelpers.js +81 -0
- package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -0
- package/codeyam-cli/src/utils/editorMockState.js +248 -0
- package/codeyam-cli/src/utils/editorMockState.js.map +1 -0
- package/codeyam-cli/src/utils/editorPreloadHelpers.js +135 -0
- package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -0
- package/codeyam-cli/src/utils/editorPreview.js +106 -0
- package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
- package/codeyam-cli/src/utils/editorScenarioSwitch.js +112 -0
- package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -0
- package/codeyam-cli/src/utils/editorScenarios.js +96 -0
- package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
- package/codeyam-cli/src/utils/editorSeedAdapter.js +173 -0
- package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -0
- package/codeyam-cli/src/utils/entityChangeStatus.js +337 -0
- package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -0
- package/codeyam-cli/src/utils/entityChangeStatus.server.js +107 -0
- package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -0
- package/codeyam-cli/src/utils/fileMetadata.js +5 -0
- package/codeyam-cli/src/utils/fileMetadata.js.map +1 -1
- package/codeyam-cli/src/utils/fileWatcher.js +25 -9
- package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
- package/codeyam-cli/src/utils/git.js +103 -0
- package/codeyam-cli/src/utils/git.js.map +1 -1
- package/codeyam-cli/src/utils/install-skills.js +57 -15
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/interactiveSyncWatcher.js +126 -0
- package/codeyam-cli/src/utils/interactiveSyncWatcher.js.map +1 -0
- package/codeyam-cli/src/utils/npmVersionCheck.js +2 -2
- package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -1
- package/codeyam-cli/src/utils/parseRegisterArg.js +31 -0
- package/codeyam-cli/src/utils/parseRegisterArg.js.map +1 -0
- package/codeyam-cli/src/utils/pathIgnoring.js +19 -7
- package/codeyam-cli/src/utils/pathIgnoring.js.map +1 -1
- package/codeyam-cli/src/utils/project.js +15 -5
- package/codeyam-cli/src/utils/project.js.map +1 -1
- package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js +11 -11
- package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js.map +1 -1
- package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +22 -0
- package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
- package/codeyam-cli/src/utils/queue/heartbeat.js +13 -5
- package/codeyam-cli/src/utils/queue/heartbeat.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +70 -1
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/queue/manager.js +7 -6
- package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
- package/codeyam-cli/src/utils/requireSimulations.js +1 -1
- package/codeyam-cli/src/utils/requireSimulations.js.map +1 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +5 -6
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +1 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +0 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +2 -4
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +2 -5
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -1
- package/codeyam-cli/src/utils/rules/__tests__/parser.test.js +83 -0
- package/codeyam-cli/src/utils/rules/__tests__/parser.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js +118 -0
- package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js +72 -0
- package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js +76 -0
- package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/index.js +1 -0
- package/codeyam-cli/src/utils/rules/index.js.map +1 -1
- package/codeyam-cli/src/utils/rules/parser.js +14 -4
- package/codeyam-cli/src/utils/rules/parser.js.map +1 -1
- package/codeyam-cli/src/utils/rules/pathMatcher.js +34 -3
- package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -1
- package/codeyam-cli/src/utils/rules/rulePlacement.js +65 -0
- package/codeyam-cli/src/utils/rules/rulePlacement.js.map +1 -0
- package/codeyam-cli/src/utils/rules/sourceFiles.js +43 -0
- package/codeyam-cli/src/utils/rules/sourceFiles.js.map +1 -0
- package/codeyam-cli/src/utils/scenarioMarkers.js +134 -0
- package/codeyam-cli/src/utils/scenarioMarkers.js.map +1 -0
- package/codeyam-cli/src/utils/scenariosManifest.js +112 -0
- package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -0
- package/codeyam-cli/src/utils/serverState.js +27 -2
- package/codeyam-cli/src/utils/serverState.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +82 -11
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/utils/simulationGateMiddleware.js +159 -0
- package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
- package/codeyam-cli/src/utils/syncMocksMiddleware.js +5 -24
- package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
- package/codeyam-cli/src/utils/testRunner.js +158 -0
- package/codeyam-cli/src/utils/testRunner.js.map +1 -0
- package/codeyam-cli/src/utils/transcriptPruning.js +67 -0
- package/codeyam-cli/src/utils/transcriptPruning.js.map +1 -0
- package/codeyam-cli/src/utils/versionInfo.js +21 -0
- package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
- package/codeyam-cli/src/utils/webappDetection.js +14 -2
- package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/database.js +41 -27
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/git.js +396 -0
- package/codeyam-cli/src/webserver/app/lib/git.js.map +1 -0
- package/codeyam-cli/src/webserver/backgroundServer.js +118 -18
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{CopyButton-jNYXRRNI.js → CopyButton-DmJveP3T.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-bwuHPyTa.js → EntityItem-C76mRRiF.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-CvzqMxcu.js → EntityTypeBadge-g3saevPb.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-BH0XDim7.js → EntityTypeIcon-CobE682z.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-yjIHlOGa.js → InteractivePreview-DYFW3lDD.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-Cq5o8jL4.js → LibraryFunctionPreview-DLeucoVX.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-BvMu2i-g.js → LoadingDots-BU_OAEMP.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-kgBTLoJD.js → LogViewer-ceAyBX-H.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-BzPgx-xO.js → ReportIssueModal-djPLI-WV.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-CwZrv-Ok.js → SafeScreenshot-BED4B6sP.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-BX2Ny2Qj.js → ScenarioViewer-ZlRKbhrq.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +34 -0
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-CDpEprKa.js → TruncatedFilePath-C8OKAR5x.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-oAf2Kqsf.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{_index-BRx8ZGZo.js → _index-C96V0n15.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-4S4yPfFw.js → activity.(_tab)-BpKzcsJz.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/addon-canvas-DpzMmAy5.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/addon-fit-YJmn1quW.js +12 -0
- package/codeyam-cli/src/webserver/build/client/assets/addon-web-links-Duc5hnl7.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/addon-webgl-DI8QOUvO.js +58 -0
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-D9hemwl6.js +22 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.dev-mode-events-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-audit-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-capture-scenario-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-client-errors-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-commit-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-dev-server-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-entity-status-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-diff-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-entry-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-image._-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-screenshot-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-update-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-load-commit-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-project-info-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-refresh-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-register-scenario-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-data-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-image._-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenarios-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-switch-scenario-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-test-results-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.rule-path-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{book-open-D4IPYH_y.js → book-open-D_nMCFmP.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-CG65viiV.js → chevron-down-BH2h1Ea2.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chunk-JZWAC4HX-DB3aFuEO.js → chunk-JZWAC4HX-C4pqxYJB.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-igfMr5DY.js → circle-check-DyIKORY6.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{copy-Coc4o_8c.js → copy-NDbZjXao.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-D1zB-pYc.js → createLucideIcon-CMT1jU2q.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CltMNppm.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/editor-DTEBHY7Z.js +10 -0
- package/codeyam-cli/src/webserver/build/client/assets/editorPreview-B7ztwLut.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-B0h9AqE6.js → entity._sha._-DItJnD8s.js} +10 -10
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-D5rYBT5x.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CF164ouH.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-PePWg17F.js → entity._sha_.edit._scenarioId-BMvVHNXU.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-I-Wo99C_.js → entry.client-DTvKq3TY.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-9sMMAiWJ.js → fileTableUtils-cPo8LiG3.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{files-Co65J0s3.js → files-DO4CZ16O.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-CdN8sCqs.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-JMY99HpD.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-CUM5iXwc.js → index-10oVnAAH.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-_417gcQW.js → index-BcvgDzbZ.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/index-yHOVb4rc.js +15 -0
- package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-TzRHMVog.js → loader-circle-BAXYRVEO.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-7aab51c4.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/memory-Dg0mvYrI.js +96 -0
- package/codeyam-cli/src/webserver/build/client/assets/{pause-hjzB7t2z.js → pause-DTAcYxBt.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-FRztnN-P.js +67 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-DcAwD_Ln.js → search-fKo7v0Zo.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-DfuTtcJP.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{simulations-DVNJVQgD.js → simulations-B3aOzpCZ.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{terminal-DbEAHMbA.js → terminal-BG4heKCG.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-CAD5b1o_.js → triangle-alert-DtSmdtM4.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-CrAK28Bc.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C14nCb1q.js +2 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-DZlYx2c4.js → useReportContext-O-jkvSPx.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-ihdMtlf6.js → useToast-9FIWuYfK.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
- package/codeyam-cli/src/webserver/build/server/assets/index-Cz751Dm2.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-DSylnYVM.js +367 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/src/webserver/devServer.js +39 -5
- package/codeyam-cli/src/webserver/devServer.js.map +1 -1
- package/codeyam-cli/src/webserver/editorProxy.js +431 -0
- package/codeyam-cli/src/webserver/editorProxy.js.map +1 -0
- package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +414 -0
- package/codeyam-cli/src/webserver/scripts/journalCapture.ts +230 -0
- package/codeyam-cli/src/webserver/server.js +258 -1
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/src/webserver/terminalServer.js +706 -0
- package/codeyam-cli/src/webserver/terminalServer.js.map +1 -0
- package/codeyam-cli/templates/codeyam-editor-claude.md +68 -0
- package/codeyam-cli/templates/editor-step-hook.py +208 -0
- package/codeyam-cli/templates/hooks/staleness-check.sh +43 -0
- package/codeyam-cli/templates/isolation-route/next-app.tsx.template +80 -0
- package/codeyam-cli/templates/isolation-route/next-pages.tsx.template +79 -0
- package/codeyam-cli/templates/isolation-route/vite-react.tsx.template +78 -0
- package/codeyam-cli/templates/msw/browser-setup.ts.template +47 -0
- package/codeyam-cli/templates/msw/handler-router.ts.template +47 -0
- package/codeyam-cli/templates/msw/server-setup.ts.template +52 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/PRISMA_SETUP.md +84 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/app/api/todos/route.ts +17 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/app/codeyam-isolate/layout.tsx +12 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/app/globals.css +26 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/app/layout.tsx +34 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/app/lib/prisma.ts +19 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/app/page.tsx +10 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/eslint.config.mjs +11 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +64 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/next.config.ts +14 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +38 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/postcss.config.mjs +7 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/schema.prisma +27 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/seed.ts +37 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma.config.ts +12 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +89 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/tsconfig.json +34 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/vitest.config.ts +13 -0
- package/codeyam-cli/templates/prompts/conversation-guidance.txt +44 -0
- package/codeyam-cli/templates/prompts/conversation-prompt.txt +28 -0
- package/codeyam-cli/templates/prompts/interruption-prompt.txt +31 -0
- package/codeyam-cli/templates/prompts/stale-rules-prompt.txt +24 -0
- package/codeyam-cli/templates/rule-notification-hook.py +44 -17
- package/codeyam-cli/templates/rule-reflection-hook.py +24 -4
- package/codeyam-cli/templates/rules-instructions.md +34 -88
- package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +237 -0
- package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +136 -0
- package/codeyam-cli/templates/{codeyam-memory.md → skills/codeyam-memory/SKILL.md} +215 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md +100 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.mjs +139 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.mjs +52 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/misleading-api-prompt.md +117 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/read-json-field.mjs +61 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/ripgrep-fallback.mjs +155 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/analyze-prompt.md +46 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.mjs +13 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter-session.mjs +95 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.mjs +160 -0
- package/codeyam-cli/templates/{codeyam-new-rule.md → skills/codeyam-new-rule/SKILL.md} +0 -2
- package/package.json +21 -14
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +22 -4
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
- package/packages/ai/src/lib/completionCall.js +10 -7
- package/packages/ai/src/lib/completionCall.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +234 -3
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js +54 -0
- package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js +34 -0
- package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js.map +1 -0
- package/packages/ai/src/lib/generateEntityScenarioData.js +57 -2
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +0 -11
- package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
- package/packages/analyze/src/lib/ProjectAnalyzer.js +13 -4
- package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/asts/index.js +4 -2
- package/packages/analyze/src/lib/asts/index.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/getNodeType.js +1 -0
- package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +8 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +0 -5
- package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +9 -0
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +54 -27
- package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +65 -0
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +0 -40
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +18 -4
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/database/index.js +1 -0
- package/packages/database/index.js.map +1 -1
- package/packages/database/src/lib/kysely/db.js +5 -0
- package/packages/database/src/lib/kysely/db.js.map +1 -1
- package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +51 -0
- package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
- package/packages/database/src/lib/loadCommits.js +23 -13
- package/packages/database/src/lib/loadCommits.js.map +1 -1
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
- package/packages/database/src/lib/updateCommitMetadata.js +100 -89
- package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
- package/packages/database/src/lib/updateFreshAnalysisStatus.js +41 -30
- package/packages/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
- package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
- package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
- package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
- package/packages/utils/src/lib/fs/rsyncCopy.js +6 -2
- package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/scripts/npm-post-install.cjs +34 -0
- package/codeyam-cli/src/commands/detect-universal-mocks.js +0 -120
- package/codeyam-cli/src/commands/detect-universal-mocks.js.map +0 -1
- package/codeyam-cli/src/commands/list.js +0 -31
- package/codeyam-cli/src/commands/list.js.map +0 -1
- package/codeyam-cli/src/commands/webapp-info.js +0 -146
- package/codeyam-cli/src/commands/webapp-info.js.map +0 -1
- package/codeyam-cli/src/utils/universal-mocks.js +0 -152
- package/codeyam-cli/src/utils/universal-mocks.js.map +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-EhOseatT.js +0 -34
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DHKuQSmR.js +0 -17
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-JTAjQ54M.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DjLxr2JB.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-CtYowLOt.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/git-BdHOxVfg.js +0 -15
- package/codeyam-cli/src/webserver/build/client/assets/globals-CCgBKWy4.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/labs-BK0C1H1T.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-390cb8fa.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/memory-CzZySbBE.js +0 -78
- package/codeyam-cli/src/webserver/build/client/assets/root-DnbDhvTU.js +0 -62
- package/codeyam-cli/src/webserver/build/client/assets/settings-CclxrcPK.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BqgrAzs3.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-DAFqfEDH.js +0 -2
- package/codeyam-cli/src/webserver/build/server/assets/index-CXfuiwt3.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BSvme_Ao.js +0 -259
- package/codeyam-cli/templates/codeyam-stop-hook.sh +0 -284
- package/scripts/finalize-analyzer.cjs +0 -13
- /package/codeyam-cli/templates/{codeyam-diagnose.md → commands/codeyam-diagnose.md} +0 -0
- /package/codeyam-cli/templates/{codeyam-debug.md → skills/codeyam-debug/SKILL.md} +0 -0
- /package/codeyam-cli/templates/{codeyam-setup.md → skills/codeyam-setup/SKILL.md} +0 -0
- /package/codeyam-cli/templates/{codeyam-sim.md → skills/codeyam-sim/SKILL.md} +0 -0
- /package/codeyam-cli/templates/{codeyam-test.md → skills/codeyam-test/SKILL.md} +0 -0
- /package/codeyam-cli/templates/{codeyam-verify.md → skills/codeyam-verify/SKILL.md} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-yHOVb4rc.js","assets/chunk-JZWAC4HX-C4pqxYJB.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var dt=Object.defineProperty;var xt=(t,s,a)=>s in t?dt(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a;var Te=(t,s,a)=>xt(t,typeof s!="symbol"?s+"":s,a);import{r as n,j as e,w as mt,u as pt,f as ht,b as ut}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as ft,S as gt}from"./useCustomSizes-CrAK28Bc.js";import{s as jt,g as ne,c as bt,b as vt,a as Nt,T as yt,D as wt}from"./editorPreview-B7ztwLut.js";import{C as ge}from"./CopyButton-DmJveP3T.js";import{_ as St}from"./preload-helper-ckwbz45p.js";import{c as kt}from"./cy-logo-cli-DcX-ZS3p.js";import{u as Ct,S as Ie}from"./Spinner-Bb5uFQ5V.js";import"./copy-NDbZjXao.js";import"./createLucideIcon-CMT1jU2q.js";import"./useLastLogLine-C14nCb1q.js";function je(t){const[s,a]=n.useState(null),[c,h]=n.useState(!1),d=n.useCallback(()=>{t&&(h(!0),fetch(`/api/editor-test-results?testFile=${encodeURIComponent(t)}`).then(o=>o.json()).then(o=>{a(o),h(!1)}).catch(()=>{a({testFilePath:t,status:"error",testCases:[],errorMessage:"Failed to fetch test results"}),h(!1)}))},[t]);return n.useEffect(()=>{t&&d()},[t,d]),{results:s,isRunning:c,runTests:d}}function se(t){if(!t||t==="/")return"Home";const a=t.split("?")[0].replace(/^\//,"").split("/")[0];return a.charAt(0).toUpperCase()+a.slice(1)}function Pt(t,s){return!s||Object.keys(s).length===0?t:t.filter(a=>s[a.name])}function ee({imgSrc:t,name:s,isActive:a,onSelect:c}){return e.jsxs("button",{onClick:c,className:"flex flex-col items-center gap-1 cursor-pointer group",title:s,children:[e.jsx("div",{className:`w-32 h-32 rounded overflow-hidden border-2 transition-all bg-[#1a1a1a] ${a?"border-[#005c75] ring-1 ring-[#005c75]":"border-transparent hover:border-[#4d4d4d]"}`,children:t?e.jsx("img",{src:t,alt:s,className:"w-full h-full object-contain",loading:"lazy"}):e.jsx("div",{className:"w-full h-full bg-[#1a1a1a] flex items-center justify-center",children:e.jsx("span",{className:"text-[8px] text-gray-600",children:"No img"})})}),e.jsx("span",{className:`text-[10px] leading-tight text-center truncate w-32 ${a?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:s})]})}function fe({testFile:t,entityName:s}){const{results:a,isRunning:c,runTests:h}=je(t);if(c&&!a)return e.jsxs("div",{className:"px-2 pt-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),e.jsx("span",{className:"text-[10px] text-gray-400",children:"Running tests..."})]});if(!a)return null;if(a.status==="error")return e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-red-400",children:a.errorMessage})});const d=s?a.testCases.filter(m=>m.fullName.startsWith(s)):a.testCases,o=d.length>0?d:a.testCases;if(o.length===0)return null;const p=s?`${s} > `:"";return e.jsxs("div",{className:"px-2 pt-1 space-y-0.5",children:[o.map(m=>{var y;const S=p&&m.fullName.startsWith(p)?m.fullName.slice(p.length):m.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[m.status==="passed"?e.jsx("span",{className:"text-green-400 text-[10px]",children:"✓"}):m.status==="failed"?e.jsx("span",{className:"text-red-400 text-[10px]",children:"✗"}):e.jsx("span",{className:"text-gray-500 text-[10px]",children:"—"}),e.jsx("span",{className:`text-[10px] ${m.status==="passed"?"text-green-400":m.status==="failed"?"text-red-400":"text-gray-500"}`,children:S})]}),m.status==="failed"&&((y=m.failureMessages)==null?void 0:y.map((w,N)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-300/70 truncate max-w-full",title:w,children:w.split(`
|
|
3
|
+
`)[0]},N)))]},m.fullName)}),e.jsx("button",{onClick:h,disabled:c,className:"mt-1 text-[10px] text-[#00a0c4] hover:text-[#00c4ee] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:c?"Running...":"Re-run"})]})}function V({filePath:t}){return t?e.jsxs("div",{className:"flex items-center gap-1 px-2 mt-0.5",children:[e.jsxs("a",{href:`/api/editor-file?path=${encodeURIComponent(t)}`,target:"_blank",rel:"noopener noreferrer",title:"Open file",className:"flex items-center gap-1 text-gray-500 hover:text-gray-300 transition-colors min-w-0",children:[e.jsx("span",{className:"text-[9px] truncate",children:t}),e.jsx("svg",{className:"shrink-0",width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsx(ge,{content:t,icon:!0,iconSize:10,className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors"})]}):null}function Mt({scenarios:t,projectRoot:s,activeScenarioId:a,onScenarioSelect:c,zoomComponent:h,onZoomChange:d,analyzedEntities:o=[],glossaryFunctions:p=[],activeAnalyzedScenarioId:m,onAnalyzedScenarioSelect:S,entityImports:y,pageFilePaths:w={}}){const{pageGroups:N,componentGroups:P}=n.useMemo(()=>{const r=new Map,i=new Map;for(const f of t)if(f.componentName){const u=i.get(f.componentName)||[];u.push(f),i.set(f.componentName,u)}else{const u=se(f.url),g=r.get(u)||[];g.push(f),r.set(u,g)}const l=new Map([...i.entries()].sort(([f],[u])=>f.localeCompare(u)));return{pageGroups:r,componentGroups:l}},[t]),j=n.useMemo(()=>{const r=new Set((o||[]).filter(l=>l.entityType==="visual").map(l=>l.name)),i=new Map;for(const[l,f]of P)r.has(l)||i.set(l,f);return i},[P,o]),{visualEntities:B,libraryEntities:M}=n.useMemo(()=>{const r=o.filter(l=>l.entityType==="visual").sort((l,f)=>l.name.localeCompare(f.name)),i=o.filter(l=>l.entityType==="library"||l.entityType==="functionCall").sort((l,f)=>l.name.localeCompare(f.name));return{visualEntities:r,libraryEntities:i}},[o]),T=n.useMemo(()=>{const r=new Set(M.map(i=>i.name));return p.filter(i=>!r.has(i.name)).sort((i,l)=>i.name.localeCompare(l.name))},[p,M]),A=o.some(r=>r.isAnalyzing),E=n.useRef(null),I=n.useRef(0),R=n.useCallback(()=>{E.current&&(I.current=E.current.scrollTop)},[]);if(n.useEffect(()=>{E.current&&I.current>0&&(E.current.scrollTop=I.current)}),t.length===0&&o.length===0&&T.length===0)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 px-8",children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"No scenarios yet"}),e.jsx("p",{className:"text-xs",children:"Scenarios will appear here as Claude creates them alongside your code. Each scenario represents a different state of your app's data."})]})});if(h){const r=P.get(h)||[],i=new Set((y==null?void 0:y[h])||[]),l=i.size>0,f=l?B.filter(g=>i.has(g.name)):[],u=l?M.filter(g=>i.has(g.name)):[];return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-1",children:[e.jsxs("button",{onClick:()=>d(void 0),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-gray-400 hover:text-white transition-colors cursor-pointer",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M7.5 9L4.5 6L7.5 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),"All scenarios"]}),e.jsx("div",{className:"px-3 py-1.5",children:e.jsx("span",{className:"text-xs font-semibold text-white uppercase tracking-wider",children:h})}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2",children:r.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-gray-500",children:"No scenarios for this component"}):r.map(g=>e.jsx(ee,{imgSrc:g.screenshotPath?`/api/editor-scenario-image/${g.id}.png`:null,name:g.name,isActive:g.id===a,onSelect:()=>c(g)},g.id))}),f.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),f.map(g=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"flex items-center gap-2 px-2 py-1",children:e.jsx("button",{onClick:()=>d(g.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:g.name})}),e.jsx(V,{filePath:g.filePath,projectRoot:s}),(g.scenarios.length>0||g.pendingScenarios.length>0)&&e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:g.scenarios.map(C=>e.jsx(ee,{imgSrc:C.screenshotPath?`/api/screenshot/${C.screenshotPath}`:null,name:C.name,isActive:C.id===m,onSelect:()=>S==null?void 0:S({analysisId:g.analysisId,scenarioId:C.id,scenarioName:C.name,entitySha:g.sha,entityName:g.name})},C.id))})]},g.sha))]}),u.length>0&&e.jsxs("div",{className:"pt-2 mt-1",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),u.map(g=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:g.name})}),e.jsx(V,{filePath:g.filePath,projectRoot:s}),g.testFile&&e.jsx(fe,{testFile:g.testFile,entityName:g.name})]},g.sha))]})]})})}return e.jsx("div",{ref:E,onScroll:R,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-3",children:[N.size>0&&e.jsxs("div",{children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"})}),[...N.entries()].sort(([r],[i])=>r==="Home"?-1:i==="Home"?1:r.localeCompare(i)).map(([r,i])=>e.jsxs("div",{className:"px-2 pt-1",children:[e.jsx("div",{className:"py-0.5",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-400",children:r})}),w[r]&&e.jsx(V,{filePath:w[r],projectRoot:s}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:i.map(l=>e.jsx(ee,{imgSrc:l.screenshotPath?`/api/editor-scenario-image/${l.id}.png`:null,name:l.name,isActive:l.id===a&&!m,onSelect:()=>c(l)},l.id))})]},r))]}),j.size>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),[...j.entries()].map(([r,i])=>{var l;return e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"flex items-center justify-between px-2 py-1",children:e.jsx("button",{onClick:()=>d(r),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:r})}),((l=i[0])==null?void 0:l.componentPath)&&e.jsx(V,{filePath:i[0].componentPath,projectRoot:s}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:i.map(f=>e.jsx(ee,{imgSrc:f.screenshotPath?`/api/editor-scenario-image/${f.id}.png`:null,name:f.name,isActive:f.id===a&&!m,onSelect:()=>c(f)},f.id))})]},r)})]}),B.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsxs("div",{className:"px-2 py-1",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),A&&t.length===0&&o.every(r=>r.scenarioCount===0)&&e.jsx("span",{className:"ml-2 text-[10px] text-gray-500",children:"— Entities are being analyzed..."})]}),B.map(r=>e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[e.jsx("button",{onClick:()=>d(r.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:r.name}),r.isAnalyzing&&r.scenarioCount===0&&e.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),"Analyzing..."]})]}),e.jsx(V,{filePath:r.filePath,projectRoot:s}),(r.scenarios.length>0||r.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:[r.scenarios.map(i=>e.jsx(ee,{imgSrc:i.screenshotPath?`/api/screenshot/${i.screenshotPath}`:null,name:i.name,isActive:i.id===m,onSelect:()=>S==null?void 0:S({analysisId:r.analysisId,scenarioId:i.id,scenarioName:i.name,entitySha:r.sha,entityName:r.name})},i.id)),r.pendingScenarios.map(i=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:i,children:i},i))]})]},r.sha))]}),(M.length>0||T.length>0)&&e.jsxs("div",{className:`pt-2 mt-1 ${B.length>0?"":"border-t border-[#3d3d3d]"}`,children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),M.map(r=>e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"px-2 py-1",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:r.name}),r.isAnalyzing&&r.scenarioCount===0&&e.jsxs("span",{className:"ml-2 inline-flex items-center gap-1.5 text-[10px] text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),"Analyzing..."]})]}),e.jsx(V,{filePath:r.filePath,projectRoot:s}),r.testFile?e.jsx(fe,{testFile:r.testFile,entityName:r.name}):e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},r.sha)),T.map(r=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:r.name})}),e.jsx(V,{filePath:r.filePath,projectRoot:s}),e.jsx(fe,{testFile:r.testFile,entityName:r.name})]},r.name))]})]})})}function Et(t,s,a=new Date){const c={"1d":1,"3d":3,"7d":7,"30d":30}[s],h=new Date(a);h.setDate(h.getDate()-c);const d=h.toISOString().split("T")[0],o=t.filter(w=>w.date>=d),p=new Set(o.map(w=>w.commitSha).filter(Boolean)),m=new Map;for(const w of o)if(w.scenarioScreenshots)for(const N of w.scenarioScreenshots){m.has(N.name)||m.set(N.name,[]);const P=m.get(N.name);P.some(j=>j.path===N.path)||P.push({path:N.path,time:w.time})}for(const w of m.values())w.sort((N,P)=>N.time.localeCompare(P.time));const S=[],y=new Map;for(const[w,N]of m){const P=w.indexOf(" - ");if(P!==-1){const j=w.slice(0,P);y.has(j)||y.set(j,[]),y.get(j).push({name:w,screenshots:N})}else S.push({name:w,screenshots:N})}return{commitCount:p.size,entryCount:o.length,appScenarios:S,componentGroups:y,totalScenarios:m.size}}function Tt(t){const s=new Map;for(const a of[...t].reverse()){const c=s.get(a.date)||[];c.push(a),s.set(a.date,c)}return s}function It(t){const s=new Map;for(const a of t){let c;if("componentName"in a&&a.componentName)c=a.componentName;else if("componentName"in a&&a.componentName===null)c="App";else{const d=a.name.indexOf(" - ");c=d!==-1?a.name.slice(0,d):"App"}const h=s.get(c)||[];h.push(a),s.set(c,h)}return[...s.entries()].sort(([a],[c])=>a==="App"?-1:c==="App"?1:a.localeCompare(c))}const Le=120;function Ge({text:t,theme:s}){const[a,c]=n.useState(!1),h=t.length>Le,d=h&&!a?t.slice(0,Le)+"…":t,o=s==="light";return e.jsxs("div",{className:`px-4 py-2 ${o?"border-b border-gray-200 bg-gray-50":"border-b border-[#3d3d3d] bg-[#252525]"}`,children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-wider text-gray-500",children:"User Prompt"}),e.jsxs("p",{className:`text-[11px] mt-0.5 mb-0 leading-relaxed ${o?"text-gray-600":"text-gray-400"}`,children:[d,h&&e.jsx("button",{onClick:()=>c(!a),className:`ml-1 text-[11px] font-medium bg-transparent border-none p-0 cursor-pointer ${o?"text-blue-500 hover:text-blue-700":"text-[#00a0c4] hover:text-[#00c0e8]"}`,children:a?"Show less":"Read more…"})]})]})}function $e({status:t}){const s={new:{label:"New",bg:"bg-green-900/40",text:"text-green-400",border:"border-green-700/50"},edited:{label:"Edited",bg:"bg-blue-900/40",text:"text-blue-400",border:"border-blue-700/50"},impacted:{label:"Impacted",bg:"bg-amber-900/40",text:"text-amber-400",border:"border-amber-700/50"}}[t.status];return e.jsx("span",{className:`${s.bg} ${s.text} ${s.border} border text-[8px] font-bold px-1 py-0 rounded-full uppercase tracking-wider`,children:s.label})}function Lt({testFile:t,entityName:s}){const{results:a,isRunning:c,runTests:h}=je(t);if(c&&!a)return e.jsxs("div",{className:"pt-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#00a0c4] animate-pulse"}),e.jsx("span",{className:"text-[10px] text-gray-500",children:"Running tests..."})]});if(!a)return null;if(a.status==="error")return e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-red-400",children:a.errorMessage})});const d=s?a.testCases.filter(m=>m.fullName.startsWith(s)):a.testCases,o=d.length>0?d:a.testCases;if(o.length===0)return null;const p=s?`${s} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[o.map(m=>{var y;const S=p&&m.fullName.startsWith(p)?m.fullName.slice(p.length):m.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[m.status==="passed"?e.jsx("span",{className:"text-green-400 text-[10px]",children:"✓"}):m.status==="failed"?e.jsx("span",{className:"text-red-400 text-[10px]",children:"✗"}):e.jsx("span",{className:"text-gray-500 text-[10px]",children:"—"}),e.jsx("span",{className:`text-[10px] ${m.status==="passed"?"text-green-400":m.status==="failed"?"text-red-400":"text-gray-500"}`,children:S})]}),m.status==="failed"&&((y=m.failureMessages)==null?void 0:y.map((w,N)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400/70 truncate max-w-full",title:w,children:w.split(`
|
|
4
|
+
`)[0]},N)))]},m.fullName)}),e.jsx("button",{onClick:h,disabled:c,className:"mt-1 text-[10px] text-[#00a0c4] hover:text-[#38bdf8] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:c?"Running...":"Re-run"})]})}const $t={feature:{label:"Feature",color:"bg-[#005c75]"},fix:{label:"Fix",color:"bg-amber-700"},refactor:{label:"Refactor",color:"bg-purple-700"},scaffold:{label:"Scaffold",color:"bg-green-700"},data:{label:"Data",color:"bg-blue-700"},milestone:{label:"Milestone",color:"bg-yellow-600"}};function Rt(t){try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function Bt(t){try{return new Date(t+"T00:00:00").toLocaleDateString([],{weekday:"long",month:"long",day:"numeric"})}catch{return t}}const _t=[{value:"1d",label:"1 Day"},{value:"3d",label:"3 Days"},{value:"7d",label:"1 Week"},{value:"30d",label:"1 Month"}];function Dt({entries:t,onScreenshotClick:s}){const[a,c]=n.useState(!1),[h,d]=n.useState("7d"),o=n.useMemo(()=>Et(t,h),[t,h]);return e.jsxs("div",{className:"bg-[#2d2d2d] rounded-lg overflow-hidden",children:[e.jsxs("button",{onClick:()=>c(!a),className:"w-full flex items-center justify-between px-3 py-2.5 cursor-pointer bg-transparent border-none text-left hover:bg-[#333] transition-colors",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wider",children:"Timeframe Summary"}),e.jsx("span",{className:`text-gray-500 text-[10px] transition-transform ${a?"rotate-180":""}`,children:"▼"})]}),a&&e.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"flex gap-1 pt-2.5",children:_t.map(p=>e.jsx("button",{onClick:()=>d(p.value),className:`px-2.5 py-1 text-[10px] font-medium rounded transition-colors cursor-pointer border ${h===p.value?"bg-[#005c75] text-white border-[#005c75]":"bg-transparent text-gray-400 border-[#4d4d4d] hover:text-white hover:border-[#005c75]"}`,children:p.label},p.value))}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-400",children:[e.jsxs("span",{children:[e.jsx("span",{className:"text-white font-medium",children:o.commitCount})," ",o.commitCount===1?"commit":"commits"]}),e.jsx("span",{className:"text-[#3d3d3d]",children:"|"}),e.jsxs("span",{children:[e.jsx("span",{className:"text-white font-medium",children:o.totalScenarios})," ",o.totalScenarios===1?"scenario changed":"scenarios changed"]}),e.jsx("span",{className:"text-[#3d3d3d]",children:"|"}),e.jsxs("span",{children:[e.jsx("span",{className:"text-white font-medium",children:o.entryCount})," ",o.entryCount===1?"entry":"entries"]})]}),o.totalScenarios===0?e.jsx("p",{className:"text-[11px] text-gray-500 italic m-0",children:"No scenario changes in this period."}):e.jsxs("div",{className:"space-y-3",children:[o.appScenarios.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),o.appScenarios.map(p=>e.jsx(Re,{scenario:p,onScreenshotClick:s},p.name))]}),o.componentGroups.size>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),[...o.componentGroups.entries()].sort(([p],[m])=>p.localeCompare(m)).map(([p,m])=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:p}),m.map(S=>e.jsx(Re,{scenario:S,onScreenshotClick:s},S.name))]},p))]})]})]})]})}function Re({scenario:t,onScreenshotClick:s}){const a=t.name.indexOf(" - "),c=a!==-1?t.name.slice(a+3):t.name;return e.jsxs("div",{className:"pl-2",children:[e.jsx("span",{className:"text-[10px] text-gray-500 block mb-1",children:c}),e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto",children:t.screenshots.map((h,d)=>e.jsxs("div",{className:"flex items-center shrink-0",children:[d>0&&e.jsx("span",{className:"text-[8px] text-gray-600 mx-0.5",children:"→"}),e.jsx("button",{type:"button",className:"w-16 h-16 rounded overflow-hidden border border-[#3d3d3d] hover:border-[#00a0c4] bg-[#1e1e1e] shrink-0 flex items-center justify-center cursor-pointer transition-colors",title:`${t.name} (${new Date(h.time).toLocaleDateString()})`,onClick:()=>s==null?void 0:s({screenshotUrl:`/api/editor-journal-image/${h.path.replace("screenshots/","")}`,commitSha:null,commitMessage:null,scenarioName:t.name}),children:e.jsx("img",{src:`/api/editor-journal-image/${h.path.replace("screenshots/","")}`,alt:t.name,className:"max-w-full max-h-full object-contain",loading:"lazy"})})]},h.path))})]})}function At({isActive:t,onScreenshotClick:s,glossaryFunctions:a=[]}){const[c,h]=n.useState([]),[d,o]=n.useState(!0),[p,m]=n.useState(new Set),S=n.useCallback(N=>{m(P=>{const j=new Set(P);return j.has(N)?j.delete(N):j.add(N),j})},[]),y=n.useCallback(async()=>{try{const N=await fetch("/api/editor-journal");if(N.ok){const P=await N.json();h(P.entries||[])}}catch{}finally{o(!1)}},[]);if(n.useEffect(()=>{y()},[y]),n.useEffect(()=>{t&&y()},[t,y]),n.useEffect(()=>{const N=new EventSource("/api/events");return N.addEventListener("message",P=>{try{const j=JSON.parse(P.data);j.type==="db-change"&&j.changeType==="journal"&&y()}catch{}}),()=>N.close()},[y]),d)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("span",{className:"text-gray-500 text-sm",children:"Loading journal..."})});if(c.length===0)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 px-8",children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"No journal entries yet"}),e.jsx("p",{className:"text-xs",children:"Journal entries will appear as you build. Claude records features, screenshots, and commits as the project evolves."})]})});const w=Tt(c);return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-4",children:[e.jsx(Dt,{entries:c,onScreenshotClick:s}),[...w.entries()].map(([N,P])=>e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-1.5 sticky top-0 bg-[#1e1e1e] z-10",children:e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:Bt(N)})}),e.jsx("div",{className:"space-y-2",children:P.map((j,B)=>{const M=$t[j.type]||{label:j.type,color:"bg-gray-600"},T=`${j.time}-${B}`,A=p.has(T);return e.jsxs("div",{className:"bg-[#2d2d2d] rounded-lg overflow-hidden",children:[e.jsxs("div",{className:`p-3 space-y-2 ${A?"":"max-h-[300px] overflow-y-auto"}`,children:[e.jsx("div",{className:"flex items-start gap-2",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-white truncate",children:j.title}),e.jsx("span",{className:`${M.color} text-white text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider shrink-0`,children:M.label})]}),e.jsx("span",{className:"text-[10px] text-gray-500",children:Rt(j.time)}),j.featureName&&e.jsx("span",{className:"text-[10px] text-gray-500 italic truncate",title:j.featureName,children:j.featureName})]})}),j.userPrompt&&e.jsx(Ge,{text:j.userPrompt,theme:"dark"}),e.jsx("p",{className:"text-xs text-gray-400 leading-relaxed",children:j.description}),j.screenshot&&e.jsx("button",{type:"button",className:"rounded overflow-hidden border border-[#3d3d3d] hover:border-[#00a0c4] bg-[#1e1e1e] flex items-center justify-center p-1 cursor-pointer transition-colors w-full",onClick:()=>s==null?void 0:s({screenshotUrl:`/api/editor-journal-image/${j.screenshot.replace("screenshots/","")}`,commitSha:j.commitSha,commitMessage:j.commitMessage,scenarioName:j.title}),children:e.jsx("img",{src:`/api/editor-journal-image/${j.screenshot.replace("screenshots/","")}`,alt:j.title,className:"max-w-full max-h-full object-contain",loading:"lazy"})}),j.scenarioScreenshots&&j.scenarioScreenshots.length>0&&(()=>{const E=It(j.scenarioScreenshots),I=j.entityChangeStatus,R=E.filter(([u])=>u==="App").flatMap(([,u])=>u),r=E.filter(([u])=>u!=="App"),i=new Map;for(const u of R){const g=se(u.url??null),C=i.get(g)||[];C.push(u),i.set(g,C)}const l=[...i.entries()],f=u=>e.jsx("button",{type:"button",className:"w-[4.5rem] h-[4.5rem] rounded overflow-hidden border border-[#3d3d3d] hover:border-[#00a0c4] bg-[#1e1e1e] shrink-0 flex items-center justify-center cursor-pointer transition-colors",onClick:()=>s==null?void 0:s({screenshotUrl:`/api/editor-journal-image/${u.path.replace("screenshots/","")}`,commitSha:j.commitSha,commitMessage:j.commitMessage,scenarioName:u.name}),children:e.jsx("img",{src:`/api/editor-journal-image/${u.path.replace("screenshots/","")}`,alt:u.name,title:u.name,className:"max-w-full max-h-full object-contain",loading:"lazy"})},u.path);return e.jsxs("div",{className:"space-y-2",children:[l.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),l.map(([u,g])=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:u}),(I==null?void 0:I[u])&&e.jsx($e,{status:I[u]})]}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:g.map(f)})]},u))]}),r.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),r.map(([u,g])=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:u}),(I==null?void 0:I[u])&&e.jsx($e,{status:I[u]})]}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:g.map(f)})]},u))]})]})})(),a.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"}),e.jsx("div",{className:"space-y-2",children:a.map(E=>e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-200",children:E.name}),e.jsx("span",{className:"text-[9px] text-gray-500 truncate block",children:E.filePath}),E.testFile?e.jsx(Lt,{testFile:E.testFile,entityName:E.name}):e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},E.name))})]}),j.commitSha&&e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[e.jsx("span",{className:"font-mono text-[#00a0c4] bg-[#00a0c4]/10 px-1.5 py-0.5 rounded",children:j.commitSha.slice(0,7)}),e.jsx("span",{className:"text-gray-500 truncate",children:j.commitMessage})]})]}),e.jsxs("button",{onClick:()=>S(T),className:"w-full py-1.5 text-[10px] text-gray-500 hover:text-gray-300 border-t border-[#3d3d3d] transition-colors cursor-pointer",children:["——— ",A?"Collapse":"Expand"," ———"]})]},T)})})]},N))]})})}function te({imgSrc:t,name:s,isActive:a,onSelect:c}){return e.jsxs("button",{onClick:c,className:"flex flex-col items-center gap-1 cursor-pointer group w-full",title:s,children:[e.jsx("div",{className:`w-full aspect-square rounded overflow-hidden border-2 transition-all bg-[#1a1a1a] ${a?"border-[#005c75] ring-1 ring-[#005c75]":"border-transparent hover:border-[#4d4d4d]"}`,children:t?e.jsx("img",{src:t,alt:s,className:"w-full h-full object-contain",loading:"lazy"}):e.jsx("div",{className:"w-full h-full bg-[#1a1a1a] flex items-center justify-center",children:e.jsx("span",{className:"text-[8px] text-gray-600",children:"No img"})})}),e.jsx("span",{className:`text-[10px] leading-tight text-center truncate w-full ${a?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:s})]})}function ie({filePath:t}){return t?e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsxs("a",{href:`/api/editor-file?path=${encodeURIComponent(t)}`,target:"_blank",rel:"noopener noreferrer",title:"Open file",className:"flex items-center gap-1 text-gray-500 hover:text-gray-300 transition-colors min-w-0",children:[e.jsx("span",{className:"text-[9px] truncate",children:t}),e.jsx("svg",{className:"shrink-0",width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsx(ge,{content:t,icon:!0,iconSize:10,className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors"})]}):null}function Ot({hasProject:t,scenarios:s,analyzedEntities:a,glossaryFunctions:c=[],projectRoot:h,activeScenarioId:d,onScenarioSelect:o,onAnalyzedScenarioSelect:p,onSwitchToBuild:m,zoomComponent:S,onZoomChange:y,entityImports:w,pageFilePaths:N={},projectTitle:P,projectDescription:j}){const{pageGroups:B,componentGroups:M}=n.useMemo(()=>{const i=new Map,l=new Map;for(const u of s)if(u.componentName){const g=l.get(u.componentName)||[];g.push(u),l.set(u.componentName,g)}else{const g=se(u.url),C=i.get(g)||[];C.push(u),i.set(g,C)}const f=new Map([...l.entries()].sort(([u],[g])=>u.localeCompare(g)));return{pageGroups:i,componentGroups:f}},[s]),T=n.useMemo(()=>a.filter(i=>i.entityType==="visual").sort((i,l)=>i.name.localeCompare(l.name)),[a]),A=n.useMemo(()=>{const i=new Map;for(const l of c)i.set(l.name,l);return i},[c]),E=n.useRef(null),I=n.useRef(0),R=n.useCallback(()=>{E.current&&(I.current=E.current.scrollTop)},[]);if(n.useEffect(()=>{E.current&&I.current>0&&(E.current.scrollTop=I.current)}),!t)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:"Ready to build something?"}),e.jsx("button",{onClick:m,className:"px-6 py-3 bg-[#005c75] text-white text-sm font-medium rounded-lg hover:bg-[#004d63] transition-colors cursor-pointer",children:"Start Building"})]})});if(!(s.length>0||T.length>0))return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 px-8 text-center",children:[P?e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:P}),j&&e.jsx("p",{className:"text-sm text-gray-400 m-0 font-['IBM_Plex_Sans'] leading-relaxed",children:j})]}):e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:"Your project is ready"}),e.jsx("p",{className:"text-sm text-gray-400 m-0 font-['IBM_Plex_Sans'] leading-relaxed",children:"Describe what you want to build in the Chat and your pages and components will appear here."}),e.jsx("button",{onClick:m,className:"px-6 py-3 bg-[#005c75] text-white text-sm font-medium rounded-lg hover:bg-[#004d63] transition-colors cursor-pointer",children:"Start Building"})]})});if(S){const i=B.get(S)||[],l=M.get(S)||[],f=T.find(b=>b.name===S),u=A.get(S),g=[...i,...l],C=new Set((w==null?void 0:w[S])||[]),Y=C.size>0,K=Y?[...M.entries()].filter(([b])=>C.has(b)):[],q=Y?T.filter(b=>C.has(b.name)&&!K.some(([L])=>L===b.name)):[],z=Y?c.filter(b=>C.has(b.name)):[],D=K.length>0||q.length>0,H=z.length>0,ae=D||H;return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("button",{onClick:()=>y(void 0),className:"flex items-center gap-2 text-xs text-gray-400 hover:text-white transition-colors cursor-pointer bg-transparent border-none p-0",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M7.5 9L4.5 6L7.5 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),"All"]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold text-white m-0 font-['IBM_Plex_Sans'] uppercase tracking-wider",children:S}),u&&e.jsx(ie,{filePath:u.filePath,projectRoot:h})]}),g.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:g.map(b=>e.jsx(te,{imgSrc:b.screenshotPath?`/api/editor-scenario-image/${b.id}.png`:null,name:b.name,isActive:b.id===d,onSelect:()=>o(b)},b.id))}),f&&(f.scenarios.length>0||f.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.scenarios.map(b=>e.jsx(te,{imgSrc:b.screenshotPath?`/api/screenshot/${b.screenshotPath}`:null,name:b.name,isActive:!1,onSelect:()=>p({analysisId:f.analysisId,scenarioId:b.id,scenarioName:b.name,entitySha:f.sha,entityName:f.name})},b.id)),f.pendingScenarios.map(b=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:b,children:b},b))]}),u&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] text-gray-500",children:"Tests:"}),e.jsx(ie,{filePath:u.testFile,projectRoot:h})]}),g.length===0&&!f&&!u&&e.jsx("div",{className:"text-xs text-gray-500",children:"No scenarios for this entity"}),ae&&e.jsxs("div",{className:"pt-3 mt-2 border-t border-[#3d3d3d] space-y-3",children:[D&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),K.map(([b,L])=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>y(b),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:b})}),L.length>0&&e.jsx("div",{className:"grid grid-cols-3 gap-2 pt-1",children:L.map(O=>e.jsx(te,{imgSrc:O.screenshotPath?`/api/editor-scenario-image/${O.id}.png`:null,name:O.name,isActive:O.id===d,onSelect:()=>o(O)},O.id))})]},b)),q.map(b=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>y(b.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:b.name})}),(b.scenarios.length>0||b.pendingScenarios.length>0)&&e.jsxs("div",{className:"grid grid-cols-3 gap-2 pt-1",children:[b.scenarios.map(L=>e.jsx(te,{imgSrc:L.screenshotPath?`/api/screenshot/${L.screenshotPath}`:null,name:L.name,isActive:!1,onSelect:()=>p({analysisId:b.analysisId,scenarioId:L.id,scenarioName:L.name,entitySha:b.sha,entityName:b.name})},L.id)),b.pendingScenarios.map(L=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:L,children:L},L))]})]},b.sha))]}),H&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"}),z.map(b=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>y(b.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:b.name})}),e.jsx(ie,{filePath:b.filePath,projectRoot:h}),b.testFile&&e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx("span",{className:"text-[9px] text-gray-600",children:"test:"}),e.jsx("span",{className:"text-[9px] text-gray-500 truncate",children:b.testFile})]})]},b.name))]})]})]})})}return e.jsx("div",{ref:E,onScroll:R,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-4",children:[P&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-white m-0 font-['IBM_Plex_Sans']",children:P}),j&&e.jsx("p",{className:"text-xs text-gray-400 m-0 mt-1 font-['IBM_Plex_Sans'] leading-relaxed",children:j})]}),B.size>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),e.jsx("button",{onClick:m,className:"px-2.5 py-1 text-[10px] font-medium text-gray-400 bg-[#2a2a2a] border border-[#4d4d4d] rounded hover:bg-[#333] hover:text-white hover:border-[#005c75] transition-colors cursor-pointer",children:"+ New Page"})]}),e.jsxs("p",{className:"text-[11px] text-gray-500 m-0 mt-1.5 font-['IBM_Plex_Sans'] leading-relaxed",children:["Select a page scenario below and switch to"," ",e.jsx("button",{onClick:m,className:"text-[#00a0c4] hover:text-[#00c4eb] bg-transparent border-none p-0 cursor-pointer underline font-inherit text-inherit",children:"Build"})," ","to change or enhance an existing page or"," ",e.jsx("button",{onClick:m,className:"text-[#00a0c4] hover:text-[#00c4eb] bg-transparent border-none p-0 cursor-pointer underline font-inherit text-inherit",children:"create a new page"})]}),[...B.entries()].sort(([i],[l])=>i==="Home"?-1:l==="Home"?1:i.localeCompare(l)).map(([i,l])=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>y(i),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:i})}),N[i]&&e.jsx(ie,{filePath:N[i],projectRoot:h}),e.jsx("div",{className:"grid grid-cols-3 gap-2 pt-1",children:l.map(f=>e.jsx(te,{imgSrc:f.screenshotPath?`/api/editor-scenario-image/${f.id}.png`:null,name:f.name,isActive:f.id===d,onSelect:()=>o(f)},f.id))})]},i))]})]})})}const Be={new:0,edited:1,impacted:2};function _e({status:t,onClick:s}){const a={new:{label:"New",bg:"bg-green-100",text:"text-green-700",border:"border-green-200"},edited:{label:"Edited",bg:"bg-blue-100",text:"text-blue-700",border:"border-blue-200"},impacted:{label:"Impacted",bg:"bg-amber-100",text:"text-amber-700",border:"border-amber-200"}}[t.status],c=s&&(t.status==="edited"||t.status==="impacted");return e.jsx("button",{onClick:c?s:void 0,className:`${a.bg} ${a.text} ${a.border} border text-[9px] font-bold px-1.5 py-0.5 rounded-full uppercase tracking-wider shrink-0 ${c?"cursor-pointer hover:opacity-80 transition-opacity":"cursor-default"}`,children:a.label})}function De({filePath:t}){const[s,a]=n.useState(null),[c,h]=n.useState(!0),[d,o]=n.useState(null);return n.useEffect(()=>{St(()=>import("./index-yHOVb4rc.js"),__vite__mapDeps([0,1])).then(p=>{o(()=>p.default)})},[]),n.useEffect(()=>{h(!0),fetch(`/api/editor-file-diff?path=${encodeURIComponent(t)}`).then(p=>p.json()).then(p=>{a({oldContent:p.oldContent,newContent:p.newContent})}).catch(()=>{a(null)}).finally(()=>h(!1))},[t]),c?e.jsx("div",{className:"p-2 text-[10px] text-gray-400",children:"Loading diff..."}):!s||!d?e.jsx("div",{className:"p-2 text-[10px] text-gray-400",children:"Could not load diff"}):e.jsx("div",{className:"mt-2 border border-gray-200 rounded-lg overflow-hidden max-h-[300px] overflow-auto text-xs",children:e.jsx(d,{oldValue:s.oldContent,newValue:s.newContent,splitView:!1,useDarkTheme:!1,showDiffOnly:!0,styles:{contentText:{fontSize:"11px",lineHeight:"1.4"},line:{padding:"1px 8px",fontSize:"11px"}}})})}function Ae({impactedBy:t,changedEntities:s}){return e.jsx("div",{className:"mt-2 bg-amber-50 border border-amber-200 rounded-lg p-2.5",children:t&&t.length>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[10px] font-semibold text-amber-700 uppercase tracking-wider",children:"Re-captured because these dependencies changed"}),e.jsx("ul",{className:"mt-1.5 space-y-1",children:t.map(a=>e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold px-1 py-0 rounded-full uppercase tracking-wider border ${a.changeType==="new"?"bg-green-100 text-green-700 border-green-200":"bg-blue-100 text-blue-700 border-blue-200"}`,children:a.changeType==="new"?"New":"Edited"}),e.jsx("span",{className:"text-[11px] font-medium text-amber-800",children:a.name}),e.jsx("span",{className:"text-[9px] text-amber-500 truncate",children:a.filePath})]},a.filePath))})]}):s&&s.length>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[10px] font-semibold text-amber-700 uppercase tracking-wider",children:"Unchanged — these entities were modified in this session"}),e.jsx("ul",{className:"mt-1.5 space-y-1",children:s.map(a=>e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold px-1 py-0 rounded-full uppercase tracking-wider border ${a.status==="new"?"bg-green-100 text-green-700 border-green-200":"bg-blue-100 text-blue-700 border-blue-200"}`,children:a.status==="new"?"New":"Edited"}),e.jsx("span",{className:"text-[11px] font-medium text-amber-800",children:a.name})]},a.name))})]}):e.jsx("span",{className:"text-[10px] text-amber-600",children:"This component was re-captured because a dependency changed"})})}function Oe({scenarioId:t,name:s,isActive:a,onSelect:c}){const[h,d]=n.useState(!1);return n.useEffect(()=>{d(!1)},[t]),e.jsxs("button",{onClick:c,className:"flex flex-col items-center gap-1.5 cursor-pointer group",title:s,children:[e.jsx("div",{className:`w-32 h-32 rounded-lg overflow-hidden border-2 transition-all ${a?"border-[#0ea5e9] ring-2 ring-[#0ea5e9]/40 shadow-lg shadow-[#0ea5e9]/20":"border-gray-200 hover:border-gray-400 shadow-sm"}`,children:h?e.jsx("div",{className:"w-full h-full bg-gray-100 flex items-center justify-center",children:e.jsx("span",{className:"text-[9px] text-gray-400",children:"No preview"})}):e.jsx("img",{src:`/api/editor-scenario-image/${t}.png`,alt:s,className:"w-full h-full object-contain bg-white",loading:"lazy",onError:()=>d(!0)})}),e.jsx("span",{className:`text-[11px] leading-tight text-center truncate w-32 font-medium ${a?"text-gray-900":"text-gray-600 group-hover:text-gray-900"}`,children:s})]})}function zt({filePath:t}){return t?e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsxs("a",{href:`/api/editor-file?path=${encodeURIComponent(t)}`,target:"_blank",rel:"noopener noreferrer",title:"Open file",className:"flex items-center gap-1 text-gray-400 hover:text-gray-600 transition-colors min-w-0",children:[e.jsx("span",{className:"text-[9px] truncate",children:t}),e.jsx("svg",{className:"shrink-0",width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsx(ge,{content:t,icon:!0,iconSize:10,className:"shrink-0 text-gray-400 hover:text-gray-600 transition-colors"})]}):null}function Ft({testFile:t,entityName:s}){const{results:a,isRunning:c,runTests:h}=je(t);if(c&&!a)return e.jsxs("div",{className:"pt-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#0ea5e9] animate-pulse"}),e.jsx("span",{className:"text-[10px] text-gray-400",children:"Running tests..."})]});if(!a)return null;if(a.status==="error")return e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-red-500",children:a.errorMessage})});const d=s?a.testCases.filter(m=>m.fullName.startsWith(s)):a.testCases,o=d.length>0?d:a.testCases;if(o.length===0)return null;const p=s?`${s} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[o.map(m=>{var y;const S=p&&m.fullName.startsWith(p)?m.fullName.slice(p.length):m.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[m.status==="passed"?e.jsx("span",{className:"text-green-600 text-[10px]",children:"✓"}):m.status==="failed"?e.jsx("span",{className:"text-red-500 text-[10px]",children:"✗"}):e.jsx("span",{className:"text-gray-400 text-[10px]",children:"—"}),e.jsx("span",{className:`text-[10px] ${m.status==="passed"?"text-green-600":m.status==="failed"?"text-red-500":"text-gray-400"}`,children:S})]}),m.status==="failed"&&((y=m.failureMessages)==null?void 0:y.map((w,N)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400 truncate max-w-full",title:w,children:w.split(`
|
|
5
|
+
`)[0]},N)))]},m.fullName)}),e.jsx("button",{onClick:h,disabled:c,className:"mt-1 text-[10px] text-[#0ea5e9] hover:text-[#38bdf8] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:c?"Running...":"Re-run"})]})}function ze(t){const s=t.indexOf(" - ");return s!==-1?t.slice(s+3):t}function Fe(t,s){return!s||Object.keys(s).length===0?t:[...t].sort(([a],[c])=>{var p,m;const h=((p=s[a])==null?void 0:p.status)||"impacted",d=((m=s[c])==null?void 0:m.status)||"impacted",o=(Be[h]??2)-(Be[d]??2);return o!==0?o:a.localeCompare(c)})}function Ut({scenarios:t,allScenarios:s=[],glossaryFunctions:a=[],projectRoot:c,activeScenarioId:h,onScenarioSelect:d,onClose:o,entityChangeStatus:p={},featureName:m,userPrompt:S}){const y=n.useMemo(()=>{if(s.length===0||Object.keys(p).length===0)return t;const r=new Set(t.map(l=>l.id)),i=s.filter(l=>{var u;if(r.has(l.id))return!1;const f=l.componentName||se(l.url);return((u=p[f])==null?void 0:u.status)==="impacted"});return i.length===0?t:[...t,...i]},[t,s,p]),w=n.useMemo(()=>Object.entries(p).filter(([,r])=>r.status==="new"||r.status==="edited").map(([r,i])=>({name:r,status:i.status})),[p]),[N,P]=n.useState(null),j=n.useCallback(r=>{P(i=>i===r?null:r)},[]),{pageGroups:B,componentGroups:M}=n.useMemo(()=>{const r=new Map,i=new Map;for(const l of y)if(l.componentName){const f=i.get(l.componentName)||[];f.push(l),i.set(l.componentName,f)}else{const f=se(l.url),u=r.get(f)||[];u.push(l),r.set(f,u)}return{pageGroups:r,componentGroups:i}},[y]),T=n.useMemo(()=>Fe([...B.entries()],p),[B,p]),A=n.useMemo(()=>Fe([...M.entries()],p),[M,p]),E=T,I=A,R=n.useMemo(()=>Pt(a,p),[a,p]);return y.length===0&&a.length===0?e.jsxs("div",{className:"h-full bg-white flex items-center justify-center relative",children:[e.jsx("button",{onClick:o,className:"absolute top-2 right-3 text-gray-400 hover:text-gray-700 text-lg leading-none cursor-pointer bg-transparent border-none",title:"Close results",children:"×"}),e.jsx("span",{className:"text-sm text-gray-400",children:"No scenarios registered yet"})]}):e.jsxs("div",{className:"h-full bg-white flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-gray-200 shrink-0",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Working Session Results"}),m&&e.jsx("div",{className:"text-[11px] text-gray-400 truncate",title:m,children:m})]}),e.jsx("button",{onClick:o,className:"text-gray-400 hover:text-gray-700 text-lg leading-none cursor-pointer bg-transparent border-none shrink-0",title:"Close results",children:"×"})]}),S&&e.jsx(Ge,{text:S,theme:"light"}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:e.jsxs("div",{className:"space-y-5",children:[E.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"})}),e.jsx("div",{className:"space-y-3 pl-1",children:E.map(([r,i])=>{var g;const l=p[r],f=N===r,u=(g=i[0])==null?void 0:g.componentPath;return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-600",children:r}),l&&e.jsx(_e,{status:l,onClick:()=>j(r)})]}),f&&(l==null?void 0:l.status)==="edited"&&u&&e.jsx(De,{filePath:u}),f&&(l==null?void 0:l.status)==="impacted"&&e.jsx(Ae,{impactedBy:l.impactedBy,changedEntities:w}),e.jsx("div",{className:"flex flex-wrap gap-3",children:i.map(C=>e.jsx(Oe,{scenarioId:C.id,name:ze(C.name),isActive:C.id===h,onSelect:()=>d(C)},C.id))})]},r)})})]}),I.length>0&&e.jsxs("div",{className:E.length>0?"pt-3 border-t border-gray-200":"",children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),e.jsx("div",{className:"space-y-3 pl-1",children:I.map(([r,i])=>{var g;const l=p[r],f=N===r,u=(g=i[0])==null?void 0:g.componentPath;return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-600",children:r}),l&&e.jsx(_e,{status:l,onClick:()=>j(r)})]}),f&&(l==null?void 0:l.status)==="edited"&&u&&e.jsx(De,{filePath:u}),f&&(l==null?void 0:l.status)==="impacted"&&e.jsx(Ae,{impactedBy:l.impactedBy,changedEntities:w}),e.jsx("div",{className:"flex flex-wrap gap-3",children:i.map(C=>e.jsx(Oe,{scenarioId:C.id,name:ze(C.name),isActive:C.id===h,onSelect:()=>d(C)},C.id))})]},r)})})]}),R.length>0&&e.jsxs("div",{className:E.length>0||I.length>0?"pt-3 border-t border-gray-200":"",children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),e.jsx("div",{className:"space-y-2 pl-1",children:R.map(r=>e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-700",children:r.name})}),e.jsx(zt,{filePath:r.filePath,projectRoot:c}),r.testFile?e.jsx(Ft,{testFile:r.testFile,entityName:r.name}):e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-400",children:"No test file"})})]},r.name))})]})]})})]})}function Gt({items:t,onNavigate:s}){return t.length===0?null:e.jsx("nav",{className:"flex items-center gap-1 text-xs",children:t.map((a,c)=>{const h=c===t.length-1;return e.jsxs("span",{className:"flex items-center gap-1",children:[c>0&&e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-gray-500",children:e.jsx("path",{d:"M4.5 3L7.5 6L4.5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),h?e.jsx("span",{className:"text-white font-medium",children:a.name}):e.jsx("button",{onClick:()=>s(a.componentName),className:"text-gray-400 hover:text-white transition-colors cursor-pointer",children:a.name})]},a.componentName||"app")})})}const Wt=[{key:"app",label:"App"},{key:"build",label:"Build"},{key:"data",label:"Structure"},{key:"journal",label:"Journal"}];function Vt({activeTab:t,onTabChange:s,buildIdle:a,zoomComponent:c,breadcrumbItems:h,onBreadcrumbNavigate:d}){return e.jsxs("div",{className:"bg-[#3d3d3d] h-10 flex items-center px-3 gap-3 shrink-0 z-20 border-b border-[#2d2d2d]",children:[e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("img",{src:kt,alt:"CodeYam",className:"h-5 brightness-0 invert"}),e.jsx("span",{className:"text-white font-medium text-xs whitespace-nowrap",children:"Codeyam Editor"}),c&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-3.5 bg-gray-600"}),e.jsx(Gt,{items:h,onNavigate:d})]})]}),e.jsx("div",{className:"flex-1"}),e.jsx("div",{className:"flex items-center gap-0.5 bg-[#4a3232] rounded-lg p-0.5 shrink-0",children:Wt.map(o=>e.jsxs("button",{onClick:()=>s(o.key),className:`px-2.5 py-1 text-xs font-medium rounded-md transition-colors cursor-pointer ${t===o.key?"bg-[#7a4444] text-white":"text-gray-300 hover:text-white"}`,children:[o.label,o.key==="build"&&a&&t!=="build"&&e.jsx("span",{className:"ml-1 inline-block w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"})]},o.key))})]})}function Ht({preview:t,onDismiss:s,onLoadCommit:a}){return e.jsxs("div",{className:"flex flex-col items-center gap-6 max-w-[700px] w-full",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-lg font-semibold text-[#333] m-0 font-['IBM_Plex_Sans']",children:"Journal Screenshot"}),e.jsx("p",{className:"text-sm text-[#888] mt-1 m-0 font-['IBM_Plex_Sans']",children:"This is a snapshot from a previous version — not a live preview"})]}),e.jsx("div",{className:"rounded-lg overflow-hidden border-2 border-[#ccc] shadow-md max-w-full w-fit",children:e.jsx("img",{src:t.screenshotUrl,alt:t.scenarioName,className:"max-w-full h-auto block"})}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[#666]",children:[t.commitSha&&e.jsx("span",{className:"font-mono text-xs text-[#00a0c4] bg-[#00a0c4]/15 px-2 py-0.5 rounded",children:t.commitSha.slice(0,7)}),e.jsxs("span",{className:"truncate",children:[t.scenarioName,t.commitMessage&&` — ${t.commitMessage}`]})]}),e.jsx("div",{className:"flex items-center gap-3",children:t.commitSha&&a&&e.jsx(Jt,{commitSha:t.commitSha,onLoadCommit:a})})]})}function Jt({commitSha:t,onLoadCommit:s}){const[a,c]=n.useState(!1),[h,d]=n.useState(null);return e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>{c(!0),d(null),s(t).then(o=>{o.success||d(o.error||"Failed to load commit")}).catch(o=>{d(o instanceof Error?o.message:"Network error")}).finally(()=>c(!1))},disabled:a,className:"bg-[#005c75] hover:bg-[#004d63] disabled:opacity-50 text-white text-sm font-medium px-4 py-1.5 rounded transition-colors cursor-pointer",children:a?"Reverting...":"Revert to this code and load this version"}),h&&e.jsx("div",{className:"bg-red-50 border border-red-200 rounded px-4 py-2 text-sm text-red-600 w-full text-center",children:h})]})}function Yt({analysisId:t,scenarioId:s,scenarioName:a,entityName:c,projectSlug:h,onStateChange:d}){const{interactiveServerUrl:o,isStarting:p,isLoading:m}=Ct({analysisId:t,scenarioId:s,scenarioName:a,entityName:c,projectSlug:h,enabled:!0});return n.useEffect(()=>{d(o,p||m)},[o,p,m,d]),null}function Kt(t,s){return s.status==="error"?{url:null,proxyUrl:null,isStarting:!1,error:s.errorMessage||"Dev server crashed",canStartServer:t.canStartServer,autoStartAttempted:t.autoStartAttempted,shouldAutoStart:!1}:s.url?{url:s.url,proxyUrl:s.proxyUrl||null,isStarting:!1,error:null,canStartServer:!0,autoStartAttempted:t.autoStartAttempted,shouldAutoStart:!1}:s.status==="starting"?{...t,isStarting:!0,error:null,canStartServer:!0,shouldAutoStart:!1}:s.status==="stopped"?t.url?{...t,url:null,isStarting:!1,shouldAutoStart:!1}:t.autoStartAttempted?{...t,isStarting:!1,shouldAutoStart:!1}:{...t,autoStartAttempted:!0,shouldAutoStart:!0}:{...t,shouldAutoStart:!1}}function qt(){const[t,s]=n.useState({url:null,proxyUrl:null,isStarting:!1,error:null,canStartServer:!0,autoStartAttempted:!1}),a=n.useRef(t);a.current=t,n.useEffect(()=>{let d=!1,o=null;const p=async()=>{try{const m=await fetch("/api/editor-dev-server");if(d)return;const S=await m.json(),y=Kt(a.current,S),{shouldAutoStart:w,...N}=y;if(s(N),w)try{const P=await fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})});if(d)return;P.ok?s(j=>({...j,isStarting:!0})):s(j=>({...j,canStartServer:!1}))}catch{}}catch{}};return p(),o=setInterval(()=>void p(),2e3),()=>{d=!0,o&&clearInterval(o)}},[t.url]);const c=n.useCallback(()=>{s(d=>({...d,error:null,isStarting:!0})),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restart"})}).catch(()=>{})},[]),h=n.useCallback(()=>{s(d=>({...d,error:null,isStarting:!0})),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})}).catch(()=>{})},[]);return{devServerUrl:t.url,proxyUrl:t.proxyUrl,isStarting:t.isStarting,error:t.error,canStartServer:t.canStartServer,retryServer:c,startServer:h}}const cs=()=>[{title:"Editor - CodeYam"},{name:"description",content:"CodeYam Code + Data Editor"}];class Qt extends n.Component{constructor(){super(...arguments);Te(this,"state",{error:null,errorInfo:null})}static getDerivedStateFromError(a){return{error:a,errorInfo:null}}componentDidCatch(a,c){console.error("[EditorErrorBoundary] Error:",a.message),console.error("[EditorErrorBoundary] Component stack:",c.componentStack),console.error("[EditorErrorBoundary] Loader snapshot:",JSON.stringify(this.props.loaderSnapshot,null,2)),this.setState({errorInfo:c})}render(){var a;return this.state.error?e.jsx("div",{className:"fixed inset-0 bg-[#1e1e1e] flex items-center justify-center p-8",children:e.jsxs("div",{className:"max-w-[600px] w-full space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-red-400 font-['IBM_Plex_Sans'] m-0",children:"Something went wrong"}),e.jsx("pre",{className:"text-xs text-gray-300 bg-[#2d2d2d] p-3 rounded overflow-auto max-h-[120px]",children:this.state.error.message}),((a=this.state.errorInfo)==null?void 0:a.componentStack)&&e.jsxs("details",{className:"text-xs text-gray-500",children:[e.jsx("summary",{className:"cursor-pointer hover:text-gray-300 transition-colors",children:"Component stack"}),e.jsx("pre",{className:"mt-2 bg-[#2d2d2d] p-3 rounded overflow-auto max-h-[200px] text-yellow-300",children:this.state.errorInfo.componentStack})]}),e.jsx("p",{className:"text-xs text-gray-500 m-0",children:"Full diagnostics are in the browser console."}),e.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-[#005c75] text-white text-sm rounded hover:bg-[#004d63] transition-colors cursor-pointer",children:"Reload"})]})}):this.props.children}}const Ue=[{name:"Desktop",width:1440,height:900},{name:"Laptop",width:1024,height:768},{name:"Tablet",width:768,height:1024},{name:"Mobile",width:375,height:667}],ds=mt(function(){const{projectSlug:s,projectRoot:a,hasProject:c,scenarios:h,allScenarios:d,analyzedEntities:o,glossaryFunctions:p,entityImports:m,pageFilePaths:S,entityChangeStatus:y,featureName:w,userPrompt:N,projectTitle:P,projectDescription:j}=pt(),B=ht(),[M,T]=ut(),A=n.useRef(null),E=n.useRef(null),I=n.useRef(null),R=M.get("zoom")||void 0,r=M.get("scenario")||void 0,i=n.useRef(null);n.useEffect(()=>{if(!jt(r,i.current))return;const x=d.find(k=>k.id===r);if(!x)return;i.current=r;const v=ne(x.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:v,scenarioId:x.id,scenarioName:x.name,scenarioType:x.type})}).catch(()=>{})},[r,d]),n.useEffect(()=>{const x=new BroadcastChannel("codeyam-editor");return x.onmessage=v=>{var k;if(((k=v.data)==null?void 0:k.type)==="switch-scenario"&&v.data.scenarioId){const $=v.data.scenarioId,W=d.find(ue=>ue.id===$);if(!W)return;i.current=$;const he=new URLSearchParams(M);he.set("scenario",$),he.delete("zoom"),T(he),H(null),b(null),U(null),G(!0);const ct=ne(W.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:ct,scenarioId:$,scenarioType:W.type})}).then(()=>{Q(ue=>ue+1)}).catch(()=>{G(!1)})}},()=>x.close()},[M,T,d]),n.useEffect(()=>{if(M.get("ref")!=="link"||!r)return;const x=new BroadcastChannel("codeyam-editor");x.postMessage({type:"switch-scenario",scenarioId:r}),x.close(),window.close()},[]);const{devServerUrl:l,proxyUrl:f,isStarting:u,error:g,canStartServer:C,retryServer:Y,startServer:K}=qt(),[q,z]=n.useState(!1),[D,H]=n.useState(null),[ae,b]=n.useState(null),[L,O]=n.useState(!1),[be,U]=n.useState(null),We=n.useCallback(async x=>{const k=await(await fetch("/api/editor-load-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitSha:x})})).json();return k.success&&(U(null),z(!1)),k},[]),Ve=n.useCallback((x,v)=>{b(k=>(x&&x!==k&&z(!1),x)),!v&&x&&z(!0),O(v)},[]),ve=n.useCallback(x=>{U(null),H(k=>(k&&k.analysisId===x.analysisId||(b(null),Q(W=>W+1)),x)),O(!0),z(!1);const v=new URLSearchParams(M);v.delete("scenario"),v.delete("zoom"),T(v)},[M,T]),[_,Ne]=n.useState({name:"Desktop",width:1440,height:900}),[He,le]=n.useState(!1),[F,oe]=n.useState("app"),Je=n.useCallback(()=>{oe("build"),ce(!0)},[]),[Ye,ce]=n.useState(!1),[Ke,ye]=n.useState(!1),qe=n.useCallback(x=>{ye(x)},[]),[de,we]=n.useState(!1),Qe=n.useCallback(()=>{we(!0),oe("build"),ce(!0)},[]),Se=n.useCallback(()=>{we(!1)},[]),[re,xe]=n.useState(!1),Xe=n.useCallback(()=>{if(re){xe(!1);return}typeof Notification<"u"&&Notification.permission==="default"?Notification.requestPermission().then(x=>{x==="granted"&&xe(!0)}):xe(!0)},[re]);n.useEffect(()=>{if(F==="build"){ye(!1);const x=setTimeout(()=>{var v,k;(v=A.current)==null||v.scrollToBottom(),(k=A.current)==null||k.focus()},50);return()=>clearTimeout(x)}},[F]);const[me,Ze]=n.useState(null);n.useEffect(()=>{const x=I.current;if(!x)return;const v=new ResizeObserver(k=>{const $=k[0];$&&Ze({width:$.contentRect.width,height:$.contentRect.height})});return v.observe(x),()=>v.disconnect()},[]);const J=n.useMemo(()=>me?bt(me,_):1,[me,_]),[et,Q]=n.useState(0),[ke,Ce]=n.useState(null),[Pe,G]=n.useState(!1),tt=n.useCallback((x,v)=>{if(Ce(x||null),v){const k=new URLSearchParams(M);k.set("scenario",v),i.current=v,T(k)}U(null),Q(k=>k+1)},[M,T]),{customSizes:Me,addCustomSize:st}=ft(s);n.useMemo(()=>[...Ue,...Me],[Me]),n.useEffect(()=>{const x=new EventSource("/api/events");let v=null;return x.addEventListener("message",k=>{try{const $=JSON.parse(k.data);($.type==="db-change"||$.type==="unknown")&&(v&&clearTimeout(v),v=setTimeout(()=>{B.revalidate()},2e3))}catch{}}),()=>{v&&clearTimeout(v),x.close()}},[B]);const at=n.useMemo(()=>{const x=[{name:"App"}];return R&&x.push({name:R,componentName:R}),x},[R]),pe=n.useCallback(x=>{const v=new URLSearchParams(M);if(x){v.set("zoom",x);const k=d.find($=>$.componentName===x||$.componentName===null&&x==="Home");if(k){v.set("scenario",k.id),i.current=k.id,G(!0);const $=ne(k.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:$,scenarioId:k.id,scenarioType:k.type})}).then(()=>{Q(W=>W+1)}).catch(()=>{G(!1)})}else v.delete("scenario")}else v.delete("zoom"),v.delete("scenario");T(v)},[M,T,d]),X=n.useCallback(x=>{H(null),b(null),U(null),i.current=x.id;const v=new URLSearchParams(M);v.set("scenario",x.id),T(v),G(!0);const k=ne(x.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:k,scenarioId:x.id,scenarioType:x.type})}).then(()=>{Q($=>$+1)}).catch(()=>{G(!1)})},[M,T]),rt=n.useCallback(x=>{if(!x.commitSha){const v=d.find(k=>k.name===x.scenarioName);if(v){X(v);return}}U(x)},[d,X]),nt=x=>{Ne({name:x.name,width:x.width,height:x.height})},it=x=>{st(x,_.width,_.height??900),le(!1),Ne(v=>({...v,name:x}))},lt=()=>{D||z(!0),G(!1)},Z=n.useMemo(()=>vt({activeAnalyzedScenario:!!D,analyzedPreviewUrl:ae,activeScenarioId:r||null,scenarios:d,proxyUrl:f,devServerUrl:l,zoomComponent:R||null}),[f,l,R,r,d,D,ae]),Ee=n.useMemo(()=>Nt(Z,ke),[Z,ke]),ot=n.useMemo(()=>({projectSlug:s,hasProject:c,scenarioCount:h==null?void 0:h.length,allScenarioCount:d==null?void 0:d.length,analyzedEntityCount:o==null?void 0:o.length,glossaryFunctionCount:p==null?void 0:p.length,entityChangeStatusKeys:y?Object.keys(y):[],featureName:w}),[s,c,h,d,o,p,y,w]);return e.jsx(Qt,{loaderSnapshot:ot,children:e.jsxs("div",{className:"fixed inset-0 bg-[#2d2d2d] flex flex-col",children:[D&&e.jsx(Yt,{analysisId:D.analysisId,scenarioId:D.scenarioId,scenarioName:D.scenarioName,entityName:D.entityName,projectSlug:s,onStateChange:Ve},D.analysisId),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[e.jsx("div",{className:"bg-[#2d2d2d] border-b border-[#3d3d3d] shrink-0 z-10 h-10 flex items-center px-4 gap-1",children:e.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1",children:[Ue.map(x=>e.jsxs("button",{onClick:()=>nt(x),className:`p-1.5 rounded transition-colors cursor-pointer ${_.name===x.name?"text-white bg-[#555]":"text-gray-500 hover:text-gray-300"}`,title:`${x.name} (${x.width}×${x.height})`,children:[x.name==="Desktop"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("path",{d:"M8 21h8M12 17v4"})]}),x.name==="Laptop"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8H4V6z"}),e.jsx("path",{d:"M2 18h20"})]}),x.name==="Tablet"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2"}),e.jsx("path",{d:"M12 18h.01"})]}),x.name==="Mobile"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"7",y:"2",width:"10",height:"20",rx:"2"}),e.jsx("path",{d:"M12 18h.01"})]})]},x.name)),e.jsx("button",{onClick:()=>le(!0),className:`p-1.5 rounded transition-colors cursor-pointer ${_.name==="Custom"?"text-white bg-[#555]":"text-gray-500 hover:text-gray-300"}`,title:"Custom dimensions",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M17 3a2.83 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),e.jsx("div",{className:"w-px h-4 bg-[#3d3d3d] mx-1"}),e.jsxs("span",{className:"text-gray-400 text-xs font-mono",children:[_.width," × ",_.height??900]}),e.jsx("div",{className:"w-px h-4 bg-[#3d3d3d] mx-1"}),e.jsx("button",{onClick:()=>{const x=Ee||Z;x&&window.open(x,"_blank")},className:"p-1.5 rounded text-gray-500 hover:text-gray-300 transition-colors cursor-pointer",title:"Open preview in new window",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})})]})}),e.jsx("div",{ref:I,className:"flex-1 flex items-center justify-center overflow-hidden p-8",style:{backgroundImage:`
|
|
6
|
+
linear-gradient(45deg, #333 25%, transparent 25%),
|
|
7
|
+
linear-gradient(-45deg, #333 25%, transparent 25%),
|
|
8
|
+
linear-gradient(45deg, transparent 75%, #333 75%),
|
|
9
|
+
linear-gradient(-45deg, transparent 75%, #333 75%)
|
|
10
|
+
`,backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px",backgroundColor:"#2d2d2d"},children:be?e.jsx(Ht,{preview:be,onDismiss:()=>U(null),onLoadCommit:We}):Z?e.jsx("div",{style:{width:`${_.width*J}px`,height:`${(_.height??900)*J}px`},children:e.jsxs("div",{className:"relative bg-white origin-top-left",style:{width:`${_.width}px`,height:`${_.height??900}px`,transform:J<1?`scale(${J})`:void 0},children:[!q&&!Pe&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 bg-[#2a2a2a] rounded-lg p-8 w-[500px] h-[300px]",children:[e.jsx("div",{className:"mb-4",children:e.jsx(Ie,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-gray-200 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Loading Preview"}),e.jsx("p",{className:"text-sm text-gray-400 leading-5 m-0 font-['IBM_Plex_Sans']",children:"Waiting for the app to render"})]})]})}),Pe&&e.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center",style:{backgroundColor:"rgba(0, 0, 0, 0.25)",backdropFilter:"blur(1px)",transition:"opacity 200ms ease-out"},children:e.jsxs("div",{className:"flex flex-col items-center gap-3 animate-pulse",children:[e.jsx("svg",{className:"w-6 h-6 text-white/80 animate-spin",viewBox:"0 0 24 24",fill:"none",children:e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"50 100"})}),e.jsx("span",{className:"text-white/70 text-xs font-['IBM_Plex_Sans']",children:"Switching scenario"})]})}),e.jsx("iframe",{ref:E,src:Ee||Z,className:"w-full h-full border-none",title:"Editor preview",onLoad:lt,style:{opacity:q?1:0}},et)]})}):e.jsx("div",{className:"bg-[#2a2a2a] rounded-lg flex flex-col items-center justify-center",style:{width:`${_.width*J}px`,height:`${(_.height??900)*J}px`},children:g?e.jsxs("div",{className:"flex flex-col gap-4 text-center px-8 max-w-[600px]",children:[e.jsx("h2",{className:"text-xl font-medium text-red-400 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Dev Server Failed"}),e.jsx("pre",{className:"text-xs text-left bg-[#1e1e1e] text-gray-300 p-4 rounded overflow-auto max-h-[300px] w-full font-mono whitespace-pre-wrap",children:g}),e.jsx("button",{onClick:Y,className:"mx-auto px-4 py-2 bg-[#005c75] text-white text-sm font-medium rounded hover:bg-[#004d63] transition-colors cursor-pointer",children:"Retry"})]}):u||L?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4",children:e.jsx(Ie,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-gray-200 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:L?"Starting Interactive Mode":"Starting Dev Server"}),e.jsx("p",{className:"text-sm text-gray-400 leading-5 m-0 font-['IBM_Plex_Sans']",children:L?"Loading component preview...":"Your dev server is starting up..."})]})]}):e.jsxs("div",{className:"flex flex-col gap-3 text-center px-8",children:[e.jsx("h2",{className:"text-xl font-medium text-gray-200 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Live Preview"}),e.jsx("p",{className:"text-sm text-gray-500 leading-5 m-0 font-['IBM_Plex_Sans']",children:"Describe what you want to build in the Build tab"})]})})})]}),e.jsxs("aside",{className:"w-[50%] min-w-[400px] max-w-[800px] bg-[#1e1e1e] border-r border-[#3d3d3d] shrink-0 flex flex-col overflow-hidden order-first",children:[e.jsx(Vt,{activeTab:F,onTabChange:x=>{oe(x),x==="build"&&ce(!0)},buildIdle:Ke,zoomComponent:R,breadcrumbItems:at,onBreadcrumbNavigate:pe}),e.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[Ye&&e.jsxs("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:F==="build"?"visible":"hidden"},children:[e.jsx("div",{className:de?"flex-1 min-h-0":"flex-1",style:de?{flex:"1 1 50%"}:void 0,children:e.jsx(yt,{ref:A,entityName:"Editor",projectSlug:s,entityFilePath:null,scenarioName:null,onRefreshPreview:tt,onShowResults:Qe,onHideResults:Se,editorMode:!0,onIdleChange:qe,notificationsEnabled:re})}),de&&e.jsx("div",{style:{flex:"1 1 50%"},className:"min-h-0 border-t-2 border-gray-300",children:e.jsx(Ut,{scenarios:h,allScenarios:d,glossaryFunctions:p,projectRoot:a,activeScenarioId:r,onScenarioSelect:X,onClose:Se,entityChangeStatus:y,featureName:w,userPrompt:N})})]}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:F==="app"?"visible":"hidden"},children:e.jsx(Ot,{hasProject:c,scenarios:d,analyzedEntities:o,glossaryFunctions:p,projectRoot:a,activeScenarioId:r,onScenarioSelect:X,onAnalyzedScenarioSelect:ve,onSwitchToBuild:Je,zoomComponent:R,onZoomChange:pe,entityImports:m,pageFilePaths:S,projectTitle:P,projectDescription:j})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:F==="data"?"visible":"hidden"},children:e.jsx(Mt,{scenarios:d,projectRoot:a,activeScenarioId:r,onScenarioSelect:X,zoomComponent:R,onZoomChange:pe,analyzedEntities:[],glossaryFunctions:p,activeAnalyzedScenarioId:D==null?void 0:D.scenarioId,onAnalyzedScenarioSelect:ve,entityImports:m,pageFilePaths:S})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:F==="journal"?"visible":"hidden"},children:e.jsx(At,{isActive:F==="journal",onScreenshotClick:rt,glossaryFunctions:p})})]}),e.jsx(wt,{serverUrl:l,isStarting:u,projectSlug:s,devServerError:g,onStartServer:C?K:void 0,notificationsEnabled:re,onToggleNotifications:Xe})]})]}),He&&e.jsx(gt,{width:_.width,height:_.height??900,onSave:it,onCancel:()=>le(!1)})]})})});export{ds as default,cs as meta};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/addon-web-links-Duc5hnl7.js","assets/chunk-JZWAC4HX-C4pqxYJB.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as d,j as u}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{_ as O}from"./preload-helper-ckwbz45p.js";function se({serverUrl:r,isStarting:e,projectSlug:n,devServerError:o,onStartServer:l,notificationsEnabled:m,onToggleNotifications:y}){const[b,v]=d.useState(null),c=d.useRef(null);d.useEffect(()=>{if(!n)return;const E=new EventSource("/api/dev-mode-events");return E.onmessage=C=>{try{const j=JSON.parse(C.data);j.type==="file-synced"&&(v(j.fileName),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{v(null)},5e3))}catch{}},()=>{E.close(),c.current&&clearTimeout(c.current)}},[n]);let a;o?a="error":e?a="starting":r?a="running":a="stopped";const S={starting:"bg-yellow-400",running:"bg-green-400",stopped:"bg-gray-400",error:"bg-red-400"},k={starting:"Starting...",running:r||"Running",stopped:"Stopped",error:"Error"};return u.jsxs("div",{className:"bg-[#1e1e1e] border-t border-[#3d3d3d] h-7 flex items-center px-4 gap-4 shrink-0 text-xs font-mono",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("div",{className:`w-2 h-2 rounded-full ${S[a]}`}),u.jsxs("span",{className:"text-gray-400",children:["Server:"," ",u.jsx("span",{className:"text-gray-300",children:k[a]})]}),(a==="stopped"||a==="error")&&l&&u.jsx("button",{onClick:l,className:"ml-1 px-2.5 py-0.5 bg-[#005c75] hover:bg-[#007a9a] text-white text-[11px] font-medium rounded transition-colors cursor-pointer border-none leading-tight",children:"Start Server"})]}),u.jsx("div",{className:"w-px h-3 bg-[#3d3d3d]"}),b&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4ade80",strokeWidth:"2",children:u.jsx("path",{d:"M20 6L9 17l-5-5"})}),u.jsxs("span",{className:"text-green-400",children:["Synced: ",b]})]}),u.jsx("div",{className:"w-px h-3 bg-[#3d3d3d]"})]}),u.jsx("div",{className:"flex-1"}),y&&u.jsx("button",{onClick:y,className:`text-[11px] rounded transition-colors cursor-pointer ${m?"text-green-400 hover:text-green-300":"text-gray-500 hover:text-gray-300"}`,title:m?"Click to turn off notifications":"Click to get notified when Claude finishes",children:m?"Notifications On":"Notifications Off"})]})}async function F(r,e){try{const{WebglAddon:o}=await O(async()=>{const{WebglAddon:m}=await import("./addon-webgl-DI8QOUvO.js").then(y=>y.a);return{WebglAddon:m}},[]),l=new o;return l.onContextLoss(()=>{e==null||e("webgl","canvas",new Error("WebGL context lost")),l.dispose(),q(r).then(m=>{m||e==null||e("canvas","dom",new Error("Canvas fallback failed after context loss"))})}),r.loadAddon(l),{type:"webgl",dispose:()=>l.dispose()}}catch(o){e==null||e("webgl","canvas",o)}const n=await q(r);return n||(e==null||e("canvas","dom",new Error("Canvas addon failed")),{type:"dom",dispose:()=>{}})}async function q(r){try{const{CanvasAddon:e}=await O(async()=>{const{CanvasAddon:o}=await import("./addon-canvas-DpzMmAy5.js").then(l=>l.a);return{CanvasAddon:o}},[]),n=new e;return r.loadAddon(n),{type:"canvas",dispose:()=>n.dispose()}}catch{return null}}const ee=`
|
|
3
|
+
.xterm { cursor: text; position: relative; user-select: none; -ms-user-select: none; -webkit-user-select: none; }
|
|
4
|
+
.xterm.focus, .xterm:focus { outline: none; }
|
|
5
|
+
.xterm .xterm-helpers { position: absolute; top: 0; z-index: 5; }
|
|
6
|
+
.xterm .xterm-helper-textarea { padding: 0; border: 0; margin: 0; position: absolute; opacity: 0; left: -9999em; top: 0; width: 0; height: 0; z-index: -5; white-space: nowrap; overflow: hidden; resize: none; }
|
|
7
|
+
.xterm .composition-view { background: #000; color: #FFF; display: none; position: absolute; white-space: nowrap; z-index: 1; }
|
|
8
|
+
.xterm .composition-view.active { display: block; }
|
|
9
|
+
.xterm .xterm-viewport { background-color: #000; overflow-y: scroll; cursor: default; position: absolute; right: 0; left: 0; top: 0; bottom: 0; }
|
|
10
|
+
.xterm .xterm-screen { position: relative; }
|
|
11
|
+
.xterm .xterm-screen canvas { position: absolute; left: 0; top: 0; }
|
|
12
|
+
.xterm .xterm-scroll-area { visibility: hidden; }
|
|
13
|
+
.xterm-char-measure-element { display: inline-block; visibility: hidden; position: absolute; top: 0; left: -9999em; line-height: normal; }
|
|
14
|
+
.xterm.enable-mouse-events { cursor: default; }
|
|
15
|
+
.xterm.xterm-cursor-pointer, .xterm .xterm-cursor-pointer { cursor: pointer; }
|
|
16
|
+
.xterm.column-select.focus { cursor: crosshair; }
|
|
17
|
+
.xterm .xterm-accessibility:not(.debug), .xterm .xterm-message { position: absolute; left: 0; top: 0; bottom: 0; right: 0; z-index: 10; color: transparent; pointer-events: none; }
|
|
18
|
+
.xterm .xterm-accessibility-tree:not(.debug) *::selection { color: transparent; }
|
|
19
|
+
.xterm .xterm-accessibility-tree { user-select: text; white-space: pre; }
|
|
20
|
+
.xterm .live-region { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
|
|
21
|
+
.xterm-dim { opacity: 1 !important; }
|
|
22
|
+
.xterm-underline-1 { text-decoration: underline; }
|
|
23
|
+
.xterm-underline-2 { text-decoration: double underline; }
|
|
24
|
+
.xterm-underline-3 { text-decoration: wavy underline; }
|
|
25
|
+
.xterm-underline-4 { text-decoration: dotted underline; }
|
|
26
|
+
.xterm-underline-5 { text-decoration: dashed underline; }
|
|
27
|
+
.xterm-overline { text-decoration: overline; }
|
|
28
|
+
.xterm-strikethrough { text-decoration: line-through; }
|
|
29
|
+
.xterm-screen .xterm-decoration-container .xterm-decoration { z-index: 6; position: absolute; }
|
|
30
|
+
.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer { z-index: 7; }
|
|
31
|
+
.xterm-decoration-overview-ruler { z-index: 8; position: absolute; top: 0; right: 0; pointer-events: none; }
|
|
32
|
+
.xterm-decoration-top { z-index: 2; position: relative; }
|
|
33
|
+
`;function te(){if(document.getElementById("xterm-css"))return;const r=document.createElement("style");r.id="xterm-css",r.textContent=ee,document.head.appendChild(r)}const ie=d.forwardRef(function({entityName:e,entityType:n,entitySha:o,entityFilePath:l,scenarioName:m,scenarioDescription:y,analysisId:b,projectSlug:v,onRefreshPreview:c,onShowResults:a,onHideResults:S,editorMode:k,onIdleChange:E,notificationsEnabled:C},j){const M=d.useRef(null),A=d.useRef(null),z=d.useRef(null),N=d.useRef(null),B=d.useRef(null),P=d.useRef(!1),W=d.useRef(0),I=d.useRef(!1),_=d.useRef(E);_.current=E;const D=d.useRef(C);D.current=C;const X=d.useCallback(()=>{var f;(f=z.current)==null||f.focus()},[]);return d.useImperativeHandle(j,()=>({sendInput(f){const x=N.current;x&&x.readyState===WebSocket.OPEN&&(x.send(JSON.stringify({type:"input",data:f})),setTimeout(()=>{x.readyState===WebSocket.OPEN&&x.send(JSON.stringify({type:"input",data:"\r"}))},100))},focus(){var f;(f=z.current)==null||f.focus()},scrollToBottom(){var x;const f=(x=M.current)==null?void 0:x.querySelector(".xterm-viewport");f&&(f.scrollTop=f.scrollHeight)}})),d.useEffect(()=>{const f=M.current;if(!f)return;let x=!1;return te(),Promise.all([O(()=>import("./xterm-BqvuqXEL.js"),[]),O(()=>import("./addon-fit-YJmn1quW.js"),[]),O(()=>import("./addon-web-links-Duc5hnl7.js").then(T=>T.a),__vite__mapDeps([0,1]))]).then(([T,G,Z])=>{if(x)return;const s=new T.Terminal({cursorBlink:!0,scrollback:5e3,fontSize:13,fontFamily:"'IBM Plex Mono', 'Menlo', 'Monaco', monospace",theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:"#264f78"},linkHandler:{activate(i,t){try{const p=new URL(t),h=p.searchParams.get("scenario");if(h&&p.pathname==="/editor"){const w=new BroadcastChannel("codeyam-editor");w.postMessage({type:"switch-scenario",scenarioId:h}),w.close();return}}catch{}window.open(t,"_blank")}}}),L=new G.FitAddon;s.loadAddon(L),s.loadAddon(new Z.WebLinksAddon),s.open(f);let $=null;F(s,(i,t,p)=>{console.warn(`[Terminal] Renderer fallback: ${i} → ${t}`,p)}).then(i=>{if(x){i.dispose();return}console.log(`[Terminal] Using ${i.type} renderer`),$=i.dispose}),requestAnimationFrame(()=>{try{L.fit()}catch{}}),z.current=s,s.focus(),setTimeout(()=>s.focus(),100),setTimeout(()=>s.focus(),500);const K=window.location.protocol==="https:"?"wss:":"ws:",Q=window.location.host;function Y(i){const t=new URLSearchParams;return t.set("entityName",e),n&&t.set("entityType",n),o&&t.set("entitySha",o),l&&t.set("entityFilePath",l),m&&t.set("scenarioName",m),y&&t.set("scenarioDescription",y),b&&t.set("analysisId",b),v&&t.set("projectSlug",v),k&&t.set("editorMode","true"),i&&t.set("reconnectId",i),`${K}//${Q}/ws/terminal?${t.toString()}`}function J(i){const t=Y(i),p=new WebSocket(t);N.current=p,p.onopen=()=>{W.current=0,I.current=!1,p.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows}))},p.onmessage=h=>{var w,H;try{const g=JSON.parse(h.data);if(g.type==="session-id"){B.current=g.sessionId;return}if(g.type==="refresh-preview"){c==null||c(g.path,g.scenarioId);return}if(g.type==="show-results"){a==null||a();return}if(g.type==="hide-results"){S==null||S();return}if(g.type==="claude-idle"){if(console.log("[Terminal] Received claude-idle, notifications:",D.current,"permission:",typeof Notification<"u"?Notification.permission:"N/A"),(w=_.current)==null||w.call(_,!0),D.current&&typeof Notification<"u"&&Notification.permission==="granted"){const V=new Notification("Claude is ready for you",{body:"Claude has finished and is waiting for your input.",tag:"claude-idle"});V.onclick=()=>{window.focus(),V.close()}}return}g.type==="output"&&(s.write(g.data),(H=_.current)==null||H.call(_,!1))}catch{s.write(h.data)}},p.onclose=()=>{if(P.current){s.write(`\r
|
|
34
|
+
\x1B[90m[Terminal session ended]\x1B[0m\r
|
|
35
|
+
`);return}const h=W.current;if(h<5&&B.current){const w=1e3*Math.pow(2,Math.min(h,3));W.current=h+1,s.write(`\r
|
|
36
|
+
\x1B[33m[Reconnecting...]\x1B[0m\r
|
|
37
|
+
`),setTimeout(()=>{P.current||J(B.current)},w)}else I.current?s.write(`\r
|
|
38
|
+
\x1B[90m[Terminal session ended]\x1B[0m\r
|
|
39
|
+
`):(I.current=!0,s.write(`\r
|
|
40
|
+
\x1B[33m[Starting new session...]\x1B[0m\r
|
|
41
|
+
`),B.current=null,W.current=0,J())},p.onerror=()=>{}}J(),s.onData(i=>{const t=N.current;t&&t.readyState===WebSocket.OPEN&&t.send(JSON.stringify({type:"input",data:i}))});let R=null;const U=new ResizeObserver(()=>{R&&clearTimeout(R),R=setTimeout(()=>{let i;try{i=L.proposeDimensions()}catch{return}if(!i||i.cols===s.cols&&i.rows===s.rows)return;const t=f.querySelector(".xterm-viewport");let p,h=!0;t&&(p=t.scrollTop,h=t.scrollTop+t.clientHeight>=t.scrollHeight-10),L.fit(),t&&p!==void 0&&(h?t.scrollTop=t.scrollHeight:t.scrollTop=p);const w=N.current;w&&w.readyState===WebSocket.OPEN&&w.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows}))},150)});U.observe(f),A.current=()=>{var i;R&&clearTimeout(R),U.disconnect(),P.current=!0,(i=N.current)==null||i.close(),N.current=null,$==null||$(),s.dispose(),z.current=null}}),()=>{var T;x=!0,(T=A.current)==null||T.call(A),A.current=null}},[]),u.jsx("div",{ref:M,onClick:X,className:"w-full h-full",style:{padding:"4px 0 0 8px"}})});function re(r){return r.replace(/[^a-zA-Z0-9_]+/g,"_")}function ce(r){const{activeAnalyzedScenario:e,analyzedPreviewUrl:n,activeScenarioId:o,scenarios:l,proxyUrl:m,devServerUrl:y,zoomComponent:b}=r;if(e&&n)return n;if(e&&!n)return null;if(o){const c=l.find(a=>a.id===o);if(c!=null&&c.url){const a=m||y;return a?c.url.startsWith("/")?`${a}${c.url}`:c.url:null}}const v=m||y;if(!v)return null;if(b&&o){const c=l.find(S=>S.id===o),a=c?re(c.name):"Default";return`${v}/__codeyam__/${b}/${a}`}return v}function ae(r,e){if(!r||!e)return r;try{const n=new URL(r),o=e.indexOf("?");return o>=0?(n.pathname=e.slice(0,o),n.search=e.slice(o)):(n.pathname=e,n.search=""),n.href}catch{return r}}function le(r,e){return r?r!==e:!1}function ue(r,e){const n=e.width,o=e.height??900,l=r.width,m=r.height;return n<=l&&o<=m?1:Math.min(l/n,m/o)}export{se as D,ie as T,ae as a,ce as b,ue as c,re as g,le as s};
|