@codeyam/codeyam-cli 0.1.0-staging.3ef993e → 0.1.0-staging.40645bb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analyzer-template/.build-info.json +8 -8
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +6 -6
- package/analyzer-template/packages/ai/package.json +1 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +135 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/nodeToSource.ts +19 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/paths.ts +11 -4
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +36 -9
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.ts +10 -3
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +16 -6
- package/analyzer-template/packages/analyze/index.ts +4 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +28 -2
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +5 -36
- package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +10 -6
- package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +9 -12
- package/analyzer-template/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.ts +21 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +82 -10
- package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +4 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +4 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyzeNextRoute.ts +8 -3
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +239 -58
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +1684 -1462
- package/analyzer-template/packages/aws/package.json +7 -7
- package/analyzer-template/packages/database/package.json +3 -3
- package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +42 -16
- package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +25 -15
- package/analyzer-template/packages/database/src/lib/loadEntity.ts +19 -8
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +3 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +44 -16
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +7 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts +4 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js +5 -5
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts +3 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +22 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +27 -0
- package/analyzer-template/project/analyzeFileEntities.ts +26 -0
- package/analyzer-template/project/runMultiScenarioServer.ts +26 -3
- package/background/src/lib/virtualized/project/analyzeFileEntities.js +22 -0
- package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
- package/background/src/lib/virtualized/project/runMultiScenarioServer.js +23 -3
- package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
- package/codeyam-cli/src/cli.js +24 -0
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/commands/__tests__/editor.analyzeImportsArgs.test.js +47 -0
- package/codeyam-cli/src/commands/__tests__/editor.analyzeImportsArgs.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.auditNoAutoAnalysis.test.js +71 -0
- package/codeyam-cli/src/commands/__tests__/editor.auditNoAutoAnalysis.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.designSystem.test.js +30 -0
- package/codeyam-cli/src/commands/__tests__/editor.designSystem.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js +51 -0
- package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.statePersistence.test.js +55 -0
- package/codeyam-cli/src/commands/__tests__/editor.statePersistence.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js +20 -9
- package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js.map +1 -1
- package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js +39 -3
- package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js.map +1 -1
- package/codeyam-cli/src/commands/editor.js +3491 -552
- package/codeyam-cli/src/commands/editor.js.map +1 -1
- package/codeyam-cli/src/commands/editorAnalyzeImportsArgs.js +23 -0
- package/codeyam-cli/src/commands/editorAnalyzeImportsArgs.js.map +1 -0
- package/codeyam-cli/src/commands/editorIsolateArgs.js +25 -0
- package/codeyam-cli/src/commands/editorIsolateArgs.js.map +1 -0
- package/codeyam-cli/src/commands/init.js +22 -0
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/commands/telemetry.js +37 -0
- package/codeyam-cli/src/commands/telemetry.js.map +1 -0
- package/codeyam-cli/src/data/designSystems.js +27 -0
- package/codeyam-cli/src/data/designSystems.js.map +1 -0
- package/codeyam-cli/src/data/techStacks.js +1 -1
- package/codeyam-cli/src/utils/__tests__/editorApi.test.js +62 -8
- package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +3174 -1
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js +76 -0
- package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorCaptureScenarioSeeding.test.js +137 -0
- package/codeyam-cli/src/utils/__tests__/editorCaptureScenarioSeeding.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js +100 -0
- package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +76 -3
- package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js +381 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorGuardMiddleware.test.js +67 -0
- package/codeyam-cli/src/utils/__tests__/editorGuardMiddleware.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +75 -1
- package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorMigration.test.js +435 -0
- package/codeyam-cli/src/utils/__tests__/editorMigration.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +11 -3
- package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +98 -1
- package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorRoadmap.test.js +1108 -0
- package/codeyam-cli/src/utils/__tests__/editorRoadmap.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +190 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +726 -17
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +201 -1
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js +143 -0
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js +66 -0
- package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js +53 -0
- package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +390 -11
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/envFile.test.js +125 -0
- package/codeyam-cli/src/utils/__tests__/envFile.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js +177 -0
- package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/handoffContext.test.js +500 -0
- package/codeyam-cli/src/utils/__tests__/handoffContext.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +16 -1
- package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/manualEntityAnalysis.test.js +302 -0
- package/codeyam-cli/src/utils/__tests__/manualEntityAnalysis.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/registerScenarioResult.test.js +127 -0
- package/codeyam-cli/src/utils/__tests__/registerScenarioResult.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js +118 -0
- package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js +57 -0
- package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +220 -2
- package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/screenshotHash.test.js +84 -0
- package/codeyam-cli/src/utils/__tests__/screenshotHash.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +1 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/telemetry.test.js +159 -0
- package/codeyam-cli/src/utils/__tests__/telemetry.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/testRunner.test.js +216 -0
- package/codeyam-cli/src/utils/__tests__/testRunner.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/webappDetection.test.js +6 -0
- package/codeyam-cli/src/utils/__tests__/webappDetection.test.js.map +1 -1
- package/codeyam-cli/src/utils/analysisRunner.js +39 -8
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/analyzer.js +11 -1
- package/codeyam-cli/src/utils/analyzer.js.map +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/designSystemShowcase.js +810 -0
- package/codeyam-cli/src/utils/designSystemShowcase.js.map +1 -0
- package/codeyam-cli/src/utils/editorApi.js +27 -5
- package/codeyam-cli/src/utils/editorApi.js.map +1 -1
- package/codeyam-cli/src/utils/editorAudit.js +649 -10
- package/codeyam-cli/src/utils/editorAudit.js.map +1 -1
- package/codeyam-cli/src/utils/editorBroadcastViewport.js +26 -0
- package/codeyam-cli/src/utils/editorBroadcastViewport.js.map +1 -0
- package/codeyam-cli/src/utils/editorDeleteScenario.js +67 -0
- package/codeyam-cli/src/utils/editorDeleteScenario.js.map +1 -0
- package/codeyam-cli/src/utils/editorEntityChangeStatus.js +13 -7
- package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -1
- package/codeyam-cli/src/utils/editorEntityHelpers.js +144 -0
- package/codeyam-cli/src/utils/editorEntityHelpers.js.map +1 -0
- package/codeyam-cli/src/utils/editorGuard.js +36 -0
- package/codeyam-cli/src/utils/editorGuard.js.map +1 -0
- package/codeyam-cli/src/utils/editorLoaderHelpers.js +40 -1
- package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -1
- package/codeyam-cli/src/utils/editorMigration.js +224 -0
- package/codeyam-cli/src/utils/editorMigration.js.map +1 -0
- package/codeyam-cli/src/utils/editorPreview.js +5 -3
- package/codeyam-cli/src/utils/editorPreview.js.map +1 -1
- package/codeyam-cli/src/utils/editorRecapture.js +109 -0
- package/codeyam-cli/src/utils/editorRecapture.js.map +1 -0
- package/codeyam-cli/src/utils/editorRoadmap.js +574 -0
- package/codeyam-cli/src/utils/editorRoadmap.js.map +1 -0
- package/codeyam-cli/src/utils/editorScenarioSwitch.js +39 -2
- package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -1
- package/codeyam-cli/src/utils/editorScenarios.js +307 -7
- package/codeyam-cli/src/utils/editorScenarios.js.map +1 -1
- package/codeyam-cli/src/utils/editorSeedAdapter.js +308 -6
- package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -1
- package/codeyam-cli/src/utils/editorShouldRevalidate.js +21 -0
- package/codeyam-cli/src/utils/editorShouldRevalidate.js.map +1 -0
- package/codeyam-cli/src/utils/entityChangeStatus.js +50 -5
- package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -1
- package/codeyam-cli/src/utils/entityChangeStatus.server.js +72 -3
- package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -1
- package/codeyam-cli/src/utils/envFile.js +90 -0
- package/codeyam-cli/src/utils/envFile.js.map +1 -0
- package/codeyam-cli/src/utils/fileWatcher.js +38 -0
- package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
- package/codeyam-cli/src/utils/glossaryAdd.js +74 -0
- package/codeyam-cli/src/utils/glossaryAdd.js.map +1 -0
- package/codeyam-cli/src/utils/handoffContext.js +257 -0
- package/codeyam-cli/src/utils/handoffContext.js.map +1 -0
- package/codeyam-cli/src/utils/install-skills.js +50 -6
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/manualEntityAnalysis.js +196 -0
- package/codeyam-cli/src/utils/manualEntityAnalysis.js.map +1 -0
- package/codeyam-cli/src/utils/queue/__tests__/job.interactiveStart.test.js +159 -0
- package/codeyam-cli/src/utils/queue/__tests__/job.interactiveStart.test.js.map +1 -0
- package/codeyam-cli/src/utils/queue/job.js +35 -6
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/registerScenarioResult.js +52 -0
- package/codeyam-cli/src/utils/registerScenarioResult.js.map +1 -0
- package/codeyam-cli/src/utils/routePatternMatching.js +129 -0
- package/codeyam-cli/src/utils/routePatternMatching.js.map +1 -0
- package/codeyam-cli/src/utils/scenarioCoverage.js +12 -10
- package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -1
- package/codeyam-cli/src/utils/scenariosManifest.js +84 -12
- package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -1
- package/codeyam-cli/src/utils/screenshotHash.js +26 -0
- package/codeyam-cli/src/utils/screenshotHash.js.map +1 -0
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +1 -0
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/utils/simulationGateMiddleware.js +9 -0
- package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -1
- package/codeyam-cli/src/utils/techStackConfig.js +38 -0
- package/codeyam-cli/src/utils/techStackConfig.js.map +1 -0
- package/codeyam-cli/src/utils/techStackConfig.test.js +85 -0
- package/codeyam-cli/src/utils/techStackConfig.test.js.map +1 -0
- package/codeyam-cli/src/utils/telemetry.js +106 -0
- package/codeyam-cli/src/utils/telemetry.js.map +1 -0
- package/codeyam-cli/src/utils/telemetryMiddleware.js +22 -0
- package/codeyam-cli/src/utils/telemetryMiddleware.js.map +1 -0
- package/codeyam-cli/src/utils/testResultCache.js +53 -0
- package/codeyam-cli/src/utils/testResultCache.js.map +1 -0
- package/codeyam-cli/src/utils/testResultCache.server.js +81 -0
- package/codeyam-cli/src/utils/testResultCache.server.js.map +1 -0
- package/codeyam-cli/src/utils/testResultCache.server.test.js +187 -0
- package/codeyam-cli/src/utils/testResultCache.server.test.js.map +1 -0
- package/codeyam-cli/src/utils/testResultCache.test.js +230 -0
- package/codeyam-cli/src/utils/testResultCache.test.js.map +1 -0
- package/codeyam-cli/src/utils/testRunner.js +193 -1
- package/codeyam-cli/src/utils/testRunner.js.map +1 -1
- package/codeyam-cli/src/utils/webappDetection.js +4 -2
- package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
- package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js +99 -0
- package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js +153 -0
- package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js +68 -1
- package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js.map +1 -1
- package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +203 -8
- package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -1
- package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js +190 -21
- package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js.map +1 -1
- package/codeyam-cli/src/webserver/__tests__/stripClaudeCommand.test.js +135 -0
- package/codeyam-cli/src/webserver/__tests__/stripClaudeCommand.test.js.map +1 -0
- package/codeyam-cli/src/webserver/app/lib/clientErrors.js +22 -1
- package/codeyam-cli/src/webserver/app/lib/clientErrors.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/app/routes/api.interactive-switch-scenario.js +34 -0
- package/codeyam-cli/src/webserver/app/routes/api.interactive-switch-scenario.js.map +1 -0
- package/codeyam-cli/src/webserver/app/types/editor.js +8 -0
- package/codeyam-cli/src/webserver/app/types/editor.js.map +1 -0
- package/codeyam-cli/src/webserver/backgroundServer.js +60 -61
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-DTBZZfSk.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-BcgbViKV.js → EntityItem-BxclONWq.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-CQgyEGV-.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-CQIG2qda.js → EntityTypeIcon-BsnEOJZ_.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-ByaELMbv.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-6WjVfhxX.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-ChX-Hp7W.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-BU_OAEMP.js → LoadingDots-By5zI316.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-ceAyBX-H.js → LogViewer-C-9zQdXg.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/MiniClaudeChat-Bs2_Oua4.js +36 -0
- package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-BzHcG7SE.js → ReportIssueModal-DQsceHVv.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-DThcm_9M.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-TSD3C211.js → ScenarioViewer-Cl4oOA3A.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/Spinner-CIil5-gb.js +34 -0
- package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-CK7-NaPZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-BqkA9zyZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{_index-DLxKhri3.js → _index-DnOgyseQ.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BcY3q6nt.js → activity.(_tab)-DqM9hbNE.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/{addon-web-links-Duc5hnl7.js → addon-web-links-C58dYPwR.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-Bni3iiUj.js → agent-transcripts-B8NCeOrm.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-database-verify-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-github-verify-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-handoff-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-hosting-verify-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-recapture-stale-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-rename-scenario-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-roadmap-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-scenario-data-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-seed-state-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-prompt-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-schema-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-session-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-verify-routes-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.interactive-switch-scenario-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{book-open-BYOypzCa.js → book-open-BFSIqZgO.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-C_Pmso5S.js → chevron-down-B9fDzFVh.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-UVKPFVEO-Bmq2apuh.js +43 -0
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BVMi9VA5.js → circle-check-DLPObLUx.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{copy-n2FB0_Sw.js → copy-DXEmO0TD.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-CC6AbExI.js → createLucideIcon-BwyFiRot.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-Coe5NhbS.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-CCKUIm0S.svg → cy-logo-cli-DoA97ML3.svg} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-iRhRIFlp.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/editor._tab-BZPBzV73.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-DOXe0Qx7.js +161 -0
- package/codeyam-cli/src/webserver/build/client/assets/editorPreview-C6fEYHrh.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-DwCV5__E.js → entity._sha._-pc-vc6wO.js} +13 -12
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-C8AyYgYT.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DziaVQX1.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-BTcpgIpC.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BMvVHNXU.js → entity._sha_.edit._scenarioId-D_O_ajfZ.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DTvKq3TY.js → entry.client-j1Vi0bco.js} +6 -6
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-Daa96Fr1.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-kuny2Q_s.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-DgCZPMie.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-L-aUIeux.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-BcvgDzbZ.js → index-BliGSSpl.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-yHOVb4rc.js → index-SqjQKTdH.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-10oVnAAH.js → index-vyrZD2g4.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/jsx-runtime-D_zvdyIk.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/labs-c3yLxSEp.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-DaAZ_H2w.js → loader-circle-D-q28GLF.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-30c44d84.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{memory-9gnxSZlb.js → memory-CEWIUC4t.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{pause-f5-1lKBt.js → pause-BP6fitdh.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-CLedrjXQ.js +80 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-Di64LWVb.js → search-BooqacKS.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-BM0nbryO.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-ovy6FjRY.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{terminal-Br7MOqts.js → terminal-DHemCJIs.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BLdiCuG-.js → triangle-alert-D87ekDl8.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-Dk0Tciqg.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C8QvIe05.js +2 -0
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-jkCytuYz.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/useToast-BgqkixU9.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-CuR5TvUx.js +16 -0
- package/codeyam-cli/src/webserver/build/server/assets/{index-ChX0hPcu.js → index-D4MWAsqb.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/init-JObA4lXD.js +14 -0
- package/codeyam-cli/src/webserver/build/server/assets/progress-CHTtrxFG.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-i8OXK4oL.js +765 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/src/webserver/editorProxy.js +244 -20
- package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
- package/codeyam-cli/src/webserver/idleDetector.js +65 -8
- package/codeyam-cli/src/webserver/idleDetector.js.map +1 -1
- package/codeyam-cli/src/webserver/mockStateEvents.js +28 -0
- package/codeyam-cli/src/webserver/mockStateEvents.js.map +1 -0
- package/codeyam-cli/src/webserver/scripts/journalCapture.ts +53 -0
- package/codeyam-cli/src/webserver/server.js +189 -43
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/src/webserver/terminalServer.js +342 -37
- package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
- package/codeyam-cli/templates/__tests__/editor-step-hook.prompt-capture.test.ts +118 -0
- package/codeyam-cli/templates/codeyam-editor-claude.md +2 -0
- package/codeyam-cli/templates/codeyam-editor-codex.md +61 -0
- package/codeyam-cli/templates/codeyam-editor-gemini.md +59 -0
- package/codeyam-cli/templates/codeyam-editor-reference.md +216 -0
- package/codeyam-cli/templates/design-systems/clean-dashboard-design-system.md +255 -0
- package/codeyam-cli/templates/design-systems/editorial-design-system.md +267 -0
- package/codeyam-cli/templates/design-systems/mono-brutalist-design-system.md +256 -0
- package/codeyam-cli/templates/design-systems/neo-brutalist-design-system.md +294 -0
- package/codeyam-cli/templates/editor-step-hook.py +191 -60
- package/codeyam-cli/templates/expo-react-native/MOBILE_SETUP.md +204 -5
- package/codeyam-cli/templates/expo-react-native/__tests__/.gitkeep +0 -0
- package/codeyam-cli/templates/expo-react-native/app/_layout.tsx +6 -3
- package/codeyam-cli/templates/expo-react-native/app/index.tsx +36 -0
- package/codeyam-cli/templates/expo-react-native/app.json +11 -0
- package/codeyam-cli/templates/expo-react-native/babel.config.js +1 -0
- package/codeyam-cli/templates/expo-react-native/gitignore +2 -0
- package/codeyam-cli/templates/expo-react-native/global.css +7 -0
- package/codeyam-cli/templates/expo-react-native/lib/theme.ts +73 -0
- package/codeyam-cli/templates/expo-react-native/package.json +32 -16
- package/codeyam-cli/templates/expo-react-native/patches/expo-modules-autolinking+3.0.24.patch +29 -0
- package/codeyam-cli/templates/isolation-route/expo-router.tsx.template +54 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +1 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +1 -1
- package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +88 -40
- package/codeyam-cli/templates/nextjs-prisma-supabase/package.json +1 -1
- package/codeyam-cli/templates/seed-adapters/supabase.ts +475 -0
- package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +96 -1
- package/package.json +2 -1
- package/packages/ai/src/lib/astScopes/methodSemantics.js +99 -0
- package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
- package/packages/ai/src/lib/astScopes/nodeToSource.js +16 -0
- package/packages/ai/src/lib/astScopes/nodeToSource.js.map +1 -1
- package/packages/ai/src/lib/astScopes/paths.js +12 -3
- package/packages/ai/src/lib/astScopes/paths.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +27 -10
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.js +9 -2
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +14 -4
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/analyze/index.js +1 -1
- package/packages/analyze/index.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +16 -2
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +6 -26
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +3 -2
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +9 -7
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js +14 -0
- package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +44 -11
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeChange.js +1 -0
- package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeInitial.js +1 -0
- package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeNextRoute.js +5 -1
- package/packages/analyze/src/lib/files/analyzeNextRoute.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +120 -28
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +1368 -1193
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +44 -16
- package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
- package/packages/database/src/lib/loadAnalysis.js +7 -1
- package/packages/database/src/lib/loadAnalysis.js.map +1 -1
- package/packages/database/src/lib/loadEntity.js +5 -5
- package/packages/database/src/lib/loadEntity.js.map +1 -1
- package/packages/utils/src/lib/fs/rsyncCopy.js +22 -1
- package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-BPXZwM4t.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-g3saevPb.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-DYFW3lDD.js +0 -25
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DLeucoVX.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BED4B6sP.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +0 -34
- package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-C8OKAR5x.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-oAf2Kqsf.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-C4pqxYJB.js +0 -51
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Ii3inc0_.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/editor-COWCNVyV.js +0 -10
- package/codeyam-cli/src/webserver/build/client/assets/editorPreview-CNB06EIa.js +0 -41
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-CXSi2aeZ.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CHMiAog3.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-cPo8LiG3.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-BZrlFE1F.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-DdZcvjGh.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-phvmGvat.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-6134dc40.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-BWAyuj0r.js +0 -67
- package/codeyam-cli/src/webserver/build/client/assets/settings-0OrEMU6J.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-DWT-CvLy.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-C-_hOl_g.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C14nCb1q.js +0 -2
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-O-jkvSPx.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useToast-9FIWuYfK.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/init-kSNsMjj8.js +0 -10
- package/codeyam-cli/src/webserver/build/server/assets/server-build-Bm2xIhmh.js +0 -439
- package/codeyam-cli/templates/expo-react-native/app/(tabs)/_layout.tsx +0 -33
- package/codeyam-cli/templates/expo-react-native/app/(tabs)/index.tsx +0 -12
- package/codeyam-cli/templates/expo-react-native/app/(tabs)/settings.tsx +0 -12
|
@@ -2,10 +2,104 @@ var _a, _b;
|
|
|
2
2
|
import { WebSocketServer, WebSocket } from 'ws';
|
|
3
3
|
import crypto from 'crypto';
|
|
4
4
|
import fs from 'fs';
|
|
5
|
+
import os from 'os';
|
|
5
6
|
import path from 'path';
|
|
6
7
|
import * as pty from 'node-pty';
|
|
7
8
|
import { createMarkerTransformer } from "../utils/scenarioMarkers.js";
|
|
8
9
|
import { IdleDetector } from "./idleDetector.js";
|
|
10
|
+
import { mockStateEventEmitter } from "./mockStateEvents.js";
|
|
11
|
+
/**
|
|
12
|
+
* Strip the raw `claude ...` shell command from suppressed PTY output
|
|
13
|
+
* so it doesn't leak to the user in the fallback timeout path.
|
|
14
|
+
*/
|
|
15
|
+
export function stripClaudeCommand(output) {
|
|
16
|
+
// Find the line containing the claude command and strip everything before
|
|
17
|
+
// and including it (shell prompt, ANSI codes, command echo). Preserve any
|
|
18
|
+
// real output that follows.
|
|
19
|
+
const idx = output.indexOf('claude ');
|
|
20
|
+
if (idx === -1)
|
|
21
|
+
return output;
|
|
22
|
+
// Find the end of the command line (\r or \n after "claude")
|
|
23
|
+
let end = idx;
|
|
24
|
+
while (end < output.length && output[end] !== '\r' && output[end] !== '\n') {
|
|
25
|
+
end++;
|
|
26
|
+
}
|
|
27
|
+
// Skip past trailing \r\n
|
|
28
|
+
while (end < output.length &&
|
|
29
|
+
(output[end] === '\r' || output[end] === '\n')) {
|
|
30
|
+
end++;
|
|
31
|
+
}
|
|
32
|
+
// Strip leading ANSI escape sequences from the remainder
|
|
33
|
+
// (e.g. bracketed paste mode toggles like \x1b[?2004l)
|
|
34
|
+
let rest = output.slice(end);
|
|
35
|
+
rest = rest.replace(/^(\x1b\[[\x20-\x3f]*[\x40-\x7e]|\x1b[()][A-Z0-9])*/, '');
|
|
36
|
+
return rest;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Detect whether a PTY output chunk contains Claude Code's welcome banner.
|
|
40
|
+
* Supports both the old box-drawing format (`╭─── Claude Code ───╮`)
|
|
41
|
+
* and the new block-art format (`▐▛███▜▌ Claude Code`).
|
|
42
|
+
*/
|
|
43
|
+
export function isBannerChunk(data) {
|
|
44
|
+
// Strip ANSI escape sequences before checking — Claude Code's Ink renderer
|
|
45
|
+
// inserts SGR color codes between the banner characters (e.g. ▐\x1b[48;5;16m▛).
|
|
46
|
+
const plain = data.replace(/\x1b\[[0-9;?]*[A-Za-z]|\x1b\][^\x07]*\x07|\x1b[()][A-Z0-9]/g, '');
|
|
47
|
+
return plain.includes('╭') || plain.includes('▐▛');
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Determine whether the startup output filter should be active.
|
|
51
|
+
* The filter strips the raw `claude --session-id ...` command from the
|
|
52
|
+
* terminal so the user never sees it.
|
|
53
|
+
*/
|
|
54
|
+
export function shouldFilterStartup(opts) {
|
|
55
|
+
return opts.hasContext || opts.editorMode;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Manages PTY output suppression during Claude startup.
|
|
59
|
+
*
|
|
60
|
+
* Suppresses all output until the welcome banner arrives, then clears
|
|
61
|
+
* the screen. The claude command is stripped from any chunk that is forwarded
|
|
62
|
+
* (both the banner chunk on the normal path and the buffered output on the
|
|
63
|
+
* fallback timeout path).
|
|
64
|
+
*/
|
|
65
|
+
export class StartupOutputFilter {
|
|
66
|
+
constructor() {
|
|
67
|
+
this.hasClearedScreen = false;
|
|
68
|
+
this.suppressedOutput = '';
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Process a PTY data chunk. Returns an object describing what action to take:
|
|
72
|
+
* - `type: 'suppress'` — buffer the chunk, send nothing
|
|
73
|
+
* - `type: 'clear-and-send'` — clear screen, then send `data`
|
|
74
|
+
* - `type: 'send'` — send `data` as-is (post-startup)
|
|
75
|
+
*/
|
|
76
|
+
processChunk(data) {
|
|
77
|
+
if (!this.hasClearedScreen && isBannerChunk(data)) {
|
|
78
|
+
this.hasClearedScreen = true;
|
|
79
|
+
const cleaned = stripClaudeCommand(data);
|
|
80
|
+
return { type: 'clear-and-send', data: cleaned };
|
|
81
|
+
}
|
|
82
|
+
if (!this.hasClearedScreen) {
|
|
83
|
+
this.suppressedOutput += data;
|
|
84
|
+
return { type: 'suppress' };
|
|
85
|
+
}
|
|
86
|
+
return { type: 'send', data };
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Called when the fallback timeout fires (╭ never arrived).
|
|
90
|
+
* Returns the buffered output with the command stripped, or null if
|
|
91
|
+
* the screen was already cleared.
|
|
92
|
+
*/
|
|
93
|
+
getTimeoutOutput() {
|
|
94
|
+
if (this.hasClearedScreen)
|
|
95
|
+
return null;
|
|
96
|
+
this.hasClearedScreen = true;
|
|
97
|
+
if (this.suppressedOutput.length === 0)
|
|
98
|
+
return null;
|
|
99
|
+
const cleaned = stripClaudeCommand(this.suppressedOutput);
|
|
100
|
+
return cleaned.length > 0 ? cleaned : null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
9
103
|
// Use globalThis so the sessions Set is shared across module instances.
|
|
10
104
|
// In Vite dev mode, this file is loaded twice: once by the Vite plugin (Node.js native)
|
|
11
105
|
// and once by the SSR context (ssrLoadModule). Without globalThis, each instance
|
|
@@ -53,9 +147,22 @@ const ENV_PASSTHROUGH_KEYS = [
|
|
|
53
147
|
'HOMEBREW_CELLAR',
|
|
54
148
|
'HOMEBREW_REPOSITORY',
|
|
55
149
|
];
|
|
56
|
-
|
|
150
|
+
// Additional env vars needed on Windows
|
|
151
|
+
const WINDOWS_ENV_PASSTHROUGH_KEYS = [
|
|
152
|
+
'USERPROFILE',
|
|
153
|
+
'APPDATA',
|
|
154
|
+
'LOCALAPPDATA',
|
|
155
|
+
'COMSPEC',
|
|
156
|
+
'SystemRoot',
|
|
157
|
+
'TEMP',
|
|
158
|
+
'TMP',
|
|
159
|
+
];
|
|
160
|
+
export function buildPtyEnv(options) {
|
|
57
161
|
const env = {};
|
|
58
|
-
|
|
162
|
+
const keys = process.platform === 'win32'
|
|
163
|
+
? [...ENV_PASSTHROUGH_KEYS, ...WINDOWS_ENV_PASSTHROUGH_KEYS]
|
|
164
|
+
: ENV_PASSTHROUGH_KEYS;
|
|
165
|
+
for (const key of keys) {
|
|
59
166
|
const val = process.env[key];
|
|
60
167
|
if (val != null)
|
|
61
168
|
env[key] = val;
|
|
@@ -63,8 +170,56 @@ function buildPtyEnv() {
|
|
|
63
170
|
// Always set TERM for proper terminal behavior
|
|
64
171
|
if (!env.TERM)
|
|
65
172
|
env.TERM = 'xterm-256color';
|
|
173
|
+
// Signal to hooks that this is an editor Build session.
|
|
174
|
+
// Without this, editor hooks fire in ALL Claude sessions in the project.
|
|
175
|
+
if (options?.editorMode) {
|
|
176
|
+
env.CODEYAM_EDITOR_ACTIVE = '1';
|
|
177
|
+
}
|
|
66
178
|
return env;
|
|
67
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* Returns the shell executable and arguments for PTY spawning,
|
|
182
|
+
* handling platform differences (Windows uses cmd.exe, Unix uses $SHELL).
|
|
183
|
+
* cmd.exe is preferred over PowerShell on Windows because:
|
|
184
|
+
* - .cmd shims run in-process (no window flash from subprocess spawning)
|
|
185
|
+
* - No execution policy restrictions blocking .ps1 scripts
|
|
186
|
+
* - Faster startup (no profile loading)
|
|
187
|
+
*/
|
|
188
|
+
export function getShellConfig() {
|
|
189
|
+
if (process.platform === 'win32') {
|
|
190
|
+
return { shell: 'cmd.exe', args: [] };
|
|
191
|
+
}
|
|
192
|
+
const defaultShell = process.platform === 'darwin' ? '/bin/zsh' : '/bin/sh';
|
|
193
|
+
return {
|
|
194
|
+
shell: process.env.SHELL || defaultShell,
|
|
195
|
+
args: ['-l'],
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Quote a shell argument for the current platform.
|
|
200
|
+
* Unix shells use single quotes; cmd.exe uses double quotes.
|
|
201
|
+
*/
|
|
202
|
+
export function shellQuote(arg) {
|
|
203
|
+
if (process.platform === 'win32') {
|
|
204
|
+
return `"${arg.replace(/"/g, '""')}"`;
|
|
205
|
+
}
|
|
206
|
+
return `'${arg}'`;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Returns a safe working directory for the PTY, falling back through
|
|
210
|
+
* CODEYAM_ROOT_PATH → cwd → HOME/USERPROFILE → os.tmpdir().
|
|
211
|
+
*/
|
|
212
|
+
export function getSafeCwd() {
|
|
213
|
+
const cwd = process.env.CODEYAM_ROOT_PATH || process.cwd();
|
|
214
|
+
if (fs.existsSync(cwd))
|
|
215
|
+
return cwd;
|
|
216
|
+
const home = process.platform === 'win32'
|
|
217
|
+
? process.env.USERPROFILE || process.env.HOME
|
|
218
|
+
: process.env.HOME;
|
|
219
|
+
if (home && fs.existsSync(home))
|
|
220
|
+
return home;
|
|
221
|
+
return os.tmpdir();
|
|
222
|
+
}
|
|
68
223
|
/**
|
|
69
224
|
* Convert a name to a safe file name matching CodeYam's convention.
|
|
70
225
|
* e.g. "Default Scenario" -> "Default_Scenario"
|
|
@@ -191,7 +346,7 @@ function writeDevModeContext(ctx) {
|
|
|
191
346
|
// Server
|
|
192
347
|
const serverPort = process.env.CODEYAM_PORT || '3111';
|
|
193
348
|
lines.push('## Server');
|
|
194
|
-
lines.push(`- **Refresh preview:** \`curl -X POST http://localhost:${serverPort}/api/dev-mode-preview
|
|
349
|
+
lines.push(`- **Refresh preview:** \`curl -X POST http://localhost:${serverPort}/api/dev-mode-preview -H 'Content-Type: application/json' -d '{"dimension":"Desktop"}'\` (dimension is REQUIRED)`);
|
|
195
350
|
lines.push('');
|
|
196
351
|
fs.writeFileSync(contextPath, lines.join('\n'), 'utf8');
|
|
197
352
|
return true;
|
|
@@ -228,21 +383,21 @@ function writeEditorModeContext(ctx) {
|
|
|
228
383
|
`- **Proxy:** http://localhost:${proxyPort} (used by the browser iframe only — do NOT use for health checks)`,
|
|
229
384
|
'',
|
|
230
385
|
'## Workflow',
|
|
231
|
-
'- **Guided steps:** Run `codeyam editor steps` for the next step (plan → prototype → confirm → deconstruct → extract → glossary → analyze → app scenarios → user scenarios → verify → journal → review → present → commit → finalize → push)',
|
|
232
|
-
'- Each feature follows
|
|
233
|
-
'-
|
|
386
|
+
'- **Guided steps:** Run `codeyam editor steps` for the next step (plan → prepare → prototype → verify prototype → confirm → deconstruct → extract → glossary → analyze → app scenarios → user scenarios → verify → journal → review → present → commit → finalize → push)',
|
|
387
|
+
'- Each feature follows 18 steps — run `codeyam editor steps` to see what to do next. Never expose `codeyam editor` commands to the user.',
|
|
388
|
+
'- **Run ONE step at a time.** Read the FULL output, complete every checklist item, then advance. NEVER batch-run steps in a loop or delegate them to a subagent.',
|
|
389
|
+
'- Steps 1, 5, 15, and 18 require user confirmation before proceeding',
|
|
234
390
|
'',
|
|
235
391
|
'## Preview Updates',
|
|
236
392
|
'- **Refresh the preview frequently** — the user watches the preview as you work. Refresh after every meaningful change (new page, UI section, data seeding, styling), not just at the end.',
|
|
237
|
-
`- **Refresh command:** \`curl -s -X POST http://localhost:${serverPort}/api/dev-mode-preview
|
|
393
|
+
`- **Refresh command:** \`curl -s -X POST http://localhost:${serverPort}/api/dev-mode-preview -H 'Content-Type: application/json' -d '{"dimension":"Desktop"}'\` (dimension is REQUIRED)`,
|
|
238
394
|
'- Aim for 4-8+ preview updates during a typical building session.',
|
|
239
395
|
'',
|
|
240
396
|
'## Verifying the Dev Server',
|
|
241
397
|
'- Get the dev server URL: `curl -s http://localhost:' +
|
|
242
398
|
serverPort +
|
|
243
399
|
'/api/editor-dev-server` → look at the `"url"` field (e.g., `http://localhost:3000`)',
|
|
244
|
-
'-
|
|
245
|
-
'- Check API routes work: `curl -s http://localhost:3000/api/your-route` (should return JSON, not "Internal Server Error")',
|
|
400
|
+
'- Verify pages and API routes: `codeyam editor verify-routes \'{"paths":["/"],"apiRoutes":["/api/your-route"]}\'` (checks HTTP status and JSON validity)',
|
|
246
401
|
'- **NEVER check localhost:' +
|
|
247
402
|
proxyPort +
|
|
248
403
|
' for health** — the proxy returns 200 even when the app is broken',
|
|
@@ -250,11 +405,12 @@ function writeEditorModeContext(ctx) {
|
|
|
250
405
|
'## API Endpoints',
|
|
251
406
|
`- **Register scenario (auto-captures screenshot):** \`codeyam editor register '{"name":"...","url":"/page-to-screenshot","type":"application","seed":{...}}'\` — ALWAYS include "url" for the page to screenshot. For large payloads, write JSON to a file and use @ prefix: \`codeyam editor register @/tmp/scenario.json\``,
|
|
252
407
|
`- **Get active scenario data:** \`curl http://localhost:${serverPort}/api/editor-scenario-data\``,
|
|
253
|
-
`- **Refresh/navigate/switch preview:** \`curl -X POST http://localhost:${serverPort}/api/dev-mode-preview\` (
|
|
408
|
+
`- **Refresh/navigate/switch preview:** \`curl -X POST http://localhost:${serverPort}/api/dev-mode-preview -H 'Content-Type: application/json' -d '{"dimension":"Desktop"}'\` (dimension is REQUIRED in every call; add \`"path":"/route"\` to navigate; add \`"scenarioId":"..."\` to switch scenario). Clears logs, waits for HMR, checks SSR health.`,
|
|
254
409
|
`- **Refresh config:** \`curl -X POST http://localhost:${serverPort}/api/editor-refresh\` (also starts dev server if a webapp is detected)`,
|
|
255
410
|
`- **Dev server status:** \`curl http://localhost:${serverPort}/api/editor-dev-server\``,
|
|
256
411
|
`- **Start dev server:** \`curl -X POST http://localhost:${serverPort}/api/editor-dev-server -H 'Content-Type: application/json' -d '{"action":"start"}'\``,
|
|
257
412
|
`- **Restart dev server:** \`curl -X POST http://localhost:${serverPort}/api/editor-dev-server -H 'Content-Type: application/json' -d '{"action":"restart"}'\``,
|
|
413
|
+
`- **Feature complete (after push):** \`curl -s -X POST http://localhost:${serverPort}/api/editor-feature-complete\` — signals the UI that the feature is done. Call this after step 18 push/skip, then STOP.`,
|
|
258
414
|
`- **Re-capture scenario screenshot:** \`curl -X POST http://localhost:${serverPort}/api/editor-capture-scenario -H 'Content-Type: application/json' -d '{"scenarioId":"...","url":"..."}'\` (for manual re-capture; register auto-captures)`,
|
|
259
415
|
`- **Journal screenshot:** \`curl -X POST http://localhost:${serverPort}/api/editor-journal-screenshot -H 'Content-Type: application/json' -d '{"url":"...","filename":"..."}'\``,
|
|
260
416
|
`- **Journal entry:** \`curl -X POST http://localhost:${serverPort}/api/editor-journal-entry -H 'Content-Type: application/json' -d '{"title":"...","type":"feature","description":"..."}'\``,
|
|
@@ -272,8 +428,10 @@ function writeEditorModeContext(ctx) {
|
|
|
272
428
|
'- Create ONE isolation route page per component:',
|
|
273
429
|
' - **Remix:** `app/routes/isolated-components.ComponentName.tsx` → `/isolated-components/ComponentName`',
|
|
274
430
|
' - **Next.js:** `app/isolated-components/ComponentName/page.tsx` → `/isolated-components/ComponentName`',
|
|
431
|
+
' - **Expo:** `app/isolated-components/ComponentName.tsx` → `/isolated-components/ComponentName` (use `useLocalSearchParams` from expo-router)',
|
|
275
432
|
'- The route defines a `scenarios` object mapping scenario names to props, reads `?s=ScenarioName` from the URL, and renders the component',
|
|
276
|
-
'- Wrap the component in a centered container: `<div style="display:flex;justify-content:center;align-items:center;min-height:100vh
|
|
433
|
+
'- For web apps: Wrap the component in a centered container: `<div style="display:flex;justify-content:center;align-items:center;min-height:100vh"><div style="width:100%;max-width:...">` — set max-width to match the component\'s real container (e.g. card in 3-col grid → 24rem)',
|
|
434
|
+
'- For Expo: Wrap with `<View nativeID="codeyam-capture">` (nativeID maps to id on web for screenshot capture)',
|
|
277
435
|
'- **Create multiple scenarios per component** (like tests): default/happy path, edge cases (empty data, long text, max items), different visual states (loading, error, disabled)',
|
|
278
436
|
'- Register each scenario: `codeyam editor register \'{"name":"ComponentName - Scenario","componentName":"ComponentName","componentPath":"path/to/file.tsx","url":"/isolated-components/ComponentName?s=Scenario","mockData":{"routes":{"/api/...":{"body":[...]}}}}\'`',
|
|
279
437
|
'- The url is a PATH, not a full URL — the proxy appends it and intercepts API calls the component makes',
|
|
@@ -293,9 +451,21 @@ function writeEditorModeContext(ctx) {
|
|
|
293
451
|
const hasPackageJson = fs.existsSync(path.join(codeyamRoot, 'package.json'));
|
|
294
452
|
if (!hasPackageJson) {
|
|
295
453
|
lines.push('## Status');
|
|
296
|
-
lines.push('- **Empty project** — no package.json found.
|
|
454
|
+
lines.push('- **Empty project** — no package.json found. Run `codeyam editor steps` to begin.');
|
|
297
455
|
lines.push('');
|
|
298
456
|
}
|
|
457
|
+
// Include handoff context if a provider switch generated one
|
|
458
|
+
try {
|
|
459
|
+
const handoffContextPath = path.join(codeyamRoot, '.codeyam', 'handoff-context.md');
|
|
460
|
+
if (fs.existsSync(handoffContextPath)) {
|
|
461
|
+
lines.push('');
|
|
462
|
+
lines.push(fs.readFileSync(handoffContextPath, 'utf8'));
|
|
463
|
+
lines.push('');
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
catch {
|
|
467
|
+
// Non-fatal
|
|
468
|
+
}
|
|
299
469
|
fs.writeFileSync(contextPath, lines.join('\n'), 'utf8');
|
|
300
470
|
return true;
|
|
301
471
|
}
|
|
@@ -333,6 +503,12 @@ export function attachTerminalServer(httpServer) {
|
|
|
333
503
|
}
|
|
334
504
|
}, PING_INTERVAL_MS);
|
|
335
505
|
globalThis.__codeyamPingInterval = pingInterval;
|
|
506
|
+
// Subscribe to mock state events and broadcast to all terminal clients
|
|
507
|
+
mockStateEventEmitter.on('event', (event) => {
|
|
508
|
+
if (event.type === 'data-mutation-forwarded') {
|
|
509
|
+
broadcastDataMutationForwarded(event.method, event.pathname);
|
|
510
|
+
}
|
|
511
|
+
});
|
|
336
512
|
wss.on('connection', (ws, req) => {
|
|
337
513
|
// Parse entity context from query params
|
|
338
514
|
const url = new URL(req.url || '', `http://${req.headers.host}`);
|
|
@@ -346,6 +522,9 @@ export function attachTerminalServer(httpServer) {
|
|
|
346
522
|
const projectSlug = url.searchParams.get('projectSlug') || '';
|
|
347
523
|
const editorMode = url.searchParams.get('editorMode') === 'true';
|
|
348
524
|
const reconnectId = url.searchParams.get('reconnectId') || '';
|
|
525
|
+
const claudeStartMode = url.searchParams.get('claudeStartMode') || '';
|
|
526
|
+
const claudeSessionId = url.searchParams.get('claudeSessionId') || '';
|
|
527
|
+
const editorStepLabel = url.searchParams.get('editorStepLabel') || '';
|
|
349
528
|
// --- Reconnection: reattach to a detached PTY ---
|
|
350
529
|
if (reconnectId && detachedPtys.has(reconnectId)) {
|
|
351
530
|
const detached = detachedPtys.get(reconnectId);
|
|
@@ -375,22 +554,24 @@ export function attachTerminalServer(httpServer) {
|
|
|
375
554
|
const reconnectIdleDetector = new IdleDetector({
|
|
376
555
|
onIdle: () => {
|
|
377
556
|
if (ws.readyState === WebSocket.OPEN) {
|
|
557
|
+
console.log('[terminalServer] Sending claude-idle (reconnected)');
|
|
378
558
|
ws.send(JSON.stringify({ type: 'claude-idle' }));
|
|
379
559
|
}
|
|
380
560
|
},
|
|
381
561
|
onActive: () => {
|
|
382
562
|
if (ws.readyState === WebSocket.OPEN) {
|
|
563
|
+
console.log('[terminalServer] Sending claude-active (reconnected)');
|
|
383
564
|
ws.send(JSON.stringify({ type: 'claude-active' }));
|
|
384
565
|
}
|
|
385
566
|
},
|
|
386
|
-
});
|
|
567
|
+
}, { activeOutputPattern: /[✶✢·◼]/ });
|
|
387
568
|
detached.ptyProcess.onData((data) => {
|
|
388
569
|
if (detachedFlag)
|
|
389
570
|
return; // Superseded by a newer listener
|
|
390
571
|
if (ws.readyState === WebSocket.OPEN) {
|
|
391
572
|
if (!detached.hasClearedScreen &&
|
|
392
573
|
detached.hasContext &&
|
|
393
|
-
data
|
|
574
|
+
isBannerChunk(data)) {
|
|
394
575
|
detached.hasClearedScreen = true;
|
|
395
576
|
ws.send(JSON.stringify({ type: 'output', data: '\x1b[2J\x1b[H' }));
|
|
396
577
|
}
|
|
@@ -398,11 +579,12 @@ export function attachTerminalServer(httpServer) {
|
|
|
398
579
|
if (transformed.length > 0) {
|
|
399
580
|
ws.send(JSON.stringify({ type: 'output', data: transformed }));
|
|
400
581
|
}
|
|
401
|
-
reconnectIdleDetector.onPtyOutput(data
|
|
582
|
+
reconnectIdleDetector.onPtyOutput(data);
|
|
402
583
|
}
|
|
403
584
|
});
|
|
404
585
|
detached.ptyProcess.onExit(() => {
|
|
405
|
-
|
|
586
|
+
console.log('[terminalServer] PTY exited (reconnected), flushing idle state');
|
|
587
|
+
reconnectIdleDetector.disposeAndFlush();
|
|
406
588
|
sessions.delete(session);
|
|
407
589
|
if (ws.readyState === WebSocket.OPEN) {
|
|
408
590
|
ws.close();
|
|
@@ -434,19 +616,17 @@ export function attachTerminalServer(httpServer) {
|
|
|
434
616
|
return;
|
|
435
617
|
}
|
|
436
618
|
// --- New connection: spawn a fresh PTY ---
|
|
437
|
-
const shell
|
|
438
|
-
const
|
|
439
|
-
// Verify cwd exists, fall back to HOME
|
|
440
|
-
const safeCwd = fs.existsSync(cwd) ? cwd : process.env.HOME || '/tmp';
|
|
619
|
+
const { shell, args: shellArgs } = getShellConfig();
|
|
620
|
+
const safeCwd = getSafeCwd();
|
|
441
621
|
// Spawn PTY with a clean env (no giant JSON blobs from CODEYAM_PROJECT etc.)
|
|
442
622
|
let ptyProcess;
|
|
443
623
|
try {
|
|
444
|
-
ptyProcess = pty.spawn(shell,
|
|
624
|
+
ptyProcess = pty.spawn(shell, shellArgs, {
|
|
445
625
|
name: 'xterm-256color',
|
|
446
626
|
cols: 120,
|
|
447
627
|
rows: 30,
|
|
448
628
|
cwd: safeCwd,
|
|
449
|
-
env: buildPtyEnv(),
|
|
629
|
+
env: buildPtyEnv({ editorMode }),
|
|
450
630
|
});
|
|
451
631
|
}
|
|
452
632
|
catch (error) {
|
|
@@ -486,18 +666,41 @@ export function attachTerminalServer(httpServer) {
|
|
|
486
666
|
projectSlug,
|
|
487
667
|
});
|
|
488
668
|
let hasClearedScreen = false;
|
|
669
|
+
const filterStartup = shouldFilterStartup({ hasContext, editorMode });
|
|
670
|
+
const startupFilter = filterStartup ? new StartupOutputFilter() : null;
|
|
671
|
+
// Safety timeout: stop suppressing output after 5s even if ╭ never arrives.
|
|
672
|
+
// Prevents "Starting Claude..." hanging forever if the banner format changes.
|
|
673
|
+
if (filterStartup) {
|
|
674
|
+
setTimeout(() => {
|
|
675
|
+
const output = startupFilter.getTimeoutOutput();
|
|
676
|
+
if (output !== null) {
|
|
677
|
+
hasClearedScreen = true;
|
|
678
|
+
console.log('[terminalServer] Suppression timeout — showing output');
|
|
679
|
+
if (ws.readyState === WebSocket.OPEN) {
|
|
680
|
+
// Clear the "Starting Claude..." message
|
|
681
|
+
ws.send(JSON.stringify({ type: 'output', data: '\x1b[2J\x1b[H' }));
|
|
682
|
+
const transformed = transformMarkers(output);
|
|
683
|
+
if (transformed.length > 0) {
|
|
684
|
+
ws.send(JSON.stringify({ type: 'output', data: transformed }));
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
}, 5000);
|
|
689
|
+
}
|
|
489
690
|
const idleDetector = new IdleDetector({
|
|
490
691
|
onIdle: () => {
|
|
491
692
|
if (ws.readyState === WebSocket.OPEN) {
|
|
693
|
+
console.log('[terminalServer] Sending claude-idle');
|
|
492
694
|
ws.send(JSON.stringify({ type: 'claude-idle' }));
|
|
493
695
|
}
|
|
494
696
|
},
|
|
495
697
|
onActive: () => {
|
|
496
698
|
if (ws.readyState === WebSocket.OPEN) {
|
|
699
|
+
console.log('[terminalServer] Sending claude-active');
|
|
497
700
|
ws.send(JSON.stringify({ type: 'claude-active' }));
|
|
498
701
|
}
|
|
499
702
|
},
|
|
500
|
-
});
|
|
703
|
+
}, { activeOutputPattern: /[✶✢·◼]/ });
|
|
501
704
|
// PTY output -> WebSocket
|
|
502
705
|
const serverPort = process.env.CODEYAM_PORT || '3111';
|
|
503
706
|
// Stateful transformer that buffers partial {{scenario:...}} markers
|
|
@@ -505,23 +708,37 @@ export function attachTerminalServer(httpServer) {
|
|
|
505
708
|
const transformMarkers = createMarkerTransformer(serverPort);
|
|
506
709
|
ptyProcess.onData((data) => {
|
|
507
710
|
if (ws.readyState === WebSocket.OPEN) {
|
|
508
|
-
//
|
|
509
|
-
// clear
|
|
510
|
-
if (
|
|
511
|
-
|
|
512
|
-
|
|
711
|
+
// During startup, suppress output until Claude's welcome banner (╭)
|
|
712
|
+
// arrives, then clear screen and strip the raw command from the chunk.
|
|
713
|
+
if (startupFilter && !hasClearedScreen) {
|
|
714
|
+
const result = startupFilter.processChunk(data);
|
|
715
|
+
if (result.type === 'clear-and-send') {
|
|
716
|
+
hasClearedScreen = true;
|
|
717
|
+
ws.send(JSON.stringify({ type: 'output', data: '\x1b[2J\x1b[H' }));
|
|
718
|
+
if (result.data.length > 0) {
|
|
719
|
+
const transformed = transformMarkers(result.data);
|
|
720
|
+
if (transformed.length > 0) {
|
|
721
|
+
ws.send(JSON.stringify({ type: 'output', data: transformed }));
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
idleDetector.onPtyOutput(data);
|
|
725
|
+
}
|
|
726
|
+
// type === 'suppress': skip sending and idle detection
|
|
513
727
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
728
|
+
else {
|
|
729
|
+
// Transform {{scenario:Name:ID}} markers into OSC 8 clickable hyperlinks.
|
|
730
|
+
// Uses stateful buffering to handle markers split across PTY chunks.
|
|
731
|
+
const transformed = transformMarkers(data);
|
|
732
|
+
if (transformed.length > 0) {
|
|
733
|
+
ws.send(JSON.stringify({ type: 'output', data: transformed }));
|
|
734
|
+
}
|
|
735
|
+
idleDetector.onPtyOutput(data);
|
|
519
736
|
}
|
|
520
|
-
idleDetector.onPtyOutput(data.length);
|
|
521
737
|
}
|
|
522
738
|
});
|
|
523
739
|
ptyProcess.onExit(() => {
|
|
524
|
-
|
|
740
|
+
console.log('[terminalServer] PTY exited, flushing idle state');
|
|
741
|
+
idleDetector.disposeAndFlush();
|
|
525
742
|
sessions.delete(session);
|
|
526
743
|
// Also clean up from detachedPtys if it was detached
|
|
527
744
|
if (detachedPtys.has(sessionId)) {
|
|
@@ -555,14 +772,57 @@ export function attachTerminalServer(httpServer) {
|
|
|
555
772
|
ws.on('close', () => {
|
|
556
773
|
detachSession(session, hasContext, hasClearedScreen);
|
|
557
774
|
});
|
|
775
|
+
// Show a loading indicator while Claude Code starts up.
|
|
776
|
+
// PTY output is suppressed until Claude's welcome banner (╭) appears
|
|
777
|
+
// and triggers a screen clear, so the user never sees the raw command.
|
|
778
|
+
if (filterStartup) {
|
|
779
|
+
ws.send(JSON.stringify({
|
|
780
|
+
type: 'output',
|
|
781
|
+
data: '\x1b[2J\x1b[H\r\n\x1b[90m Starting Claude...\x1b[0m\r\n',
|
|
782
|
+
}));
|
|
783
|
+
}
|
|
558
784
|
// Start Claude Code with the appropriate skill.
|
|
559
785
|
// Using a skill avoids shell escaping issues and multi-line paste detection.
|
|
786
|
+
//
|
|
787
|
+
// Session recovery modes (editor only):
|
|
788
|
+
// resume + sessionId → claude --resume <uuid> (resumes exact conversation)
|
|
789
|
+
// resume, no sessionId → claude --continue (fallback for pre-existing sessions)
|
|
790
|
+
// fresh → generate UUID, write to .codeyam/claude-session-id.txt,
|
|
791
|
+
// launch claude --session-id <uuid> '/codeyam-editor'
|
|
792
|
+
//
|
|
793
|
+
// The UUID is generated HERE (not in printStep1) so it's available before
|
|
794
|
+
// Claude launches. printStep1 runs inside the session — too late.
|
|
560
795
|
setTimeout(() => {
|
|
561
796
|
if (editorMode && hasContext) {
|
|
562
|
-
|
|
797
|
+
if (claudeStartMode === 'resume' && claudeSessionId) {
|
|
798
|
+
const resumePrompt = editorStepLabel === 'Present'
|
|
799
|
+
? 'The session was interrupted. Please rerun show-results.'
|
|
800
|
+
: 'The session was interrupted. Please continue where you left off.';
|
|
801
|
+
ptyProcess.write(`claude --resume ${shellQuote(claudeSessionId)} ${shellQuote(resumePrompt)}\r`);
|
|
802
|
+
}
|
|
803
|
+
else if (claudeStartMode === 'resume') {
|
|
804
|
+
// No session ID available — fall back to most recent session
|
|
805
|
+
const resumePrompt = editorStepLabel === 'Present'
|
|
806
|
+
? 'The session was interrupted. Please rerun show-results.'
|
|
807
|
+
: 'The session was interrupted. Please continue where you left off.';
|
|
808
|
+
ptyProcess.write(`claude --continue ${shellQuote(resumePrompt)}\r`);
|
|
809
|
+
}
|
|
810
|
+
else {
|
|
811
|
+
// Fresh session: generate a trackable UUID
|
|
812
|
+
const newSessionId = crypto.randomUUID();
|
|
813
|
+
const sessionIdPath = path.join(safeCwd, '.codeyam', 'claude-session-id.txt');
|
|
814
|
+
try {
|
|
815
|
+
fs.mkdirSync(path.dirname(sessionIdPath), { recursive: true });
|
|
816
|
+
fs.writeFileSync(sessionIdPath, newSessionId, 'utf8');
|
|
817
|
+
}
|
|
818
|
+
catch (err) {
|
|
819
|
+
console.error('[terminalServer] Failed to write claude-session-id.txt:', err);
|
|
820
|
+
}
|
|
821
|
+
ptyProcess.write(`claude --session-id ${shellQuote(newSessionId)} ${shellQuote('/codeyam-editor')}\r`);
|
|
822
|
+
}
|
|
563
823
|
}
|
|
564
824
|
else if (hasContext) {
|
|
565
|
-
ptyProcess.write(
|
|
825
|
+
ptyProcess.write(`claude ${shellQuote('/codeyam-dev-mode')}\r`);
|
|
566
826
|
}
|
|
567
827
|
else {
|
|
568
828
|
ptyProcess.write('claude\r');
|
|
@@ -635,6 +895,31 @@ export function broadcastPreviewRefresh(path, scenarioId) {
|
|
|
635
895
|
}
|
|
636
896
|
return count;
|
|
637
897
|
}
|
|
898
|
+
/**
|
|
899
|
+
* Notify all connected terminal WebSocket clients that a data mutation
|
|
900
|
+
* was forwarded to the real dev server (seed-based scenario).
|
|
901
|
+
* The Terminal component relays this to editor.tsx to show a save banner.
|
|
902
|
+
*/
|
|
903
|
+
export function broadcastDataMutationForwarded(method, pathname) {
|
|
904
|
+
const msg = JSON.stringify({
|
|
905
|
+
type: 'data-mutation-forwarded',
|
|
906
|
+
method,
|
|
907
|
+
pathname,
|
|
908
|
+
});
|
|
909
|
+
let count = 0;
|
|
910
|
+
for (const session of sessions) {
|
|
911
|
+
try {
|
|
912
|
+
if (session.ws.readyState === WebSocket.OPEN) {
|
|
913
|
+
session.ws.send(msg);
|
|
914
|
+
count++;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
catch {
|
|
918
|
+
// Ignore send errors
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
return count;
|
|
922
|
+
}
|
|
638
923
|
/**
|
|
639
924
|
* Show the results panel below the terminal in the Build tab.
|
|
640
925
|
* Triggered by Claude at end of step 12.
|
|
@@ -674,6 +959,26 @@ export function broadcastHideResults() {
|
|
|
674
959
|
}
|
|
675
960
|
return count;
|
|
676
961
|
}
|
|
962
|
+
/**
|
|
963
|
+
* Notify the editor UI that the current feature is complete (after push/skip).
|
|
964
|
+
* The UI shows a transition overlay letting the user start fresh or continue.
|
|
965
|
+
*/
|
|
966
|
+
export function broadcastFeatureComplete() {
|
|
967
|
+
const msg = JSON.stringify({ type: 'feature-complete' });
|
|
968
|
+
let count = 0;
|
|
969
|
+
for (const session of sessions) {
|
|
970
|
+
try {
|
|
971
|
+
if (session.ws.readyState === WebSocket.OPEN) {
|
|
972
|
+
session.ws.send(msg);
|
|
973
|
+
count++;
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
catch {
|
|
977
|
+
// Ignore send errors
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
return count;
|
|
981
|
+
}
|
|
677
982
|
/**
|
|
678
983
|
* Send a set-viewport message to all connected terminal WebSocket clients.
|
|
679
984
|
* The Terminal component relays this to the parent page to update the preview viewport.
|