@codeyam/codeyam-cli 0.1.0-staging.4c0c3c9 → 0.1.0-staging.5370992
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 +24 -24
- package/analyzer-template/packages/ai/package.json +3 -3
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +34 -3
- 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/completionCall.ts +114 -113
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +295 -14
- 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/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/dataStructureChunking.ts +15 -6
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +78 -2
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +96 -33
- package/analyzer-template/packages/analyze/index.ts +4 -1
- 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/prepareDataStructures.ts +28 -2
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +14 -37
- package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +0 -6
- package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +22 -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/TransformationTracer.ts +65 -28
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +322 -58
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +0 -98
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +1707 -1466
- 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 +4 -4
- package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -0
- package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +164 -0
- package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +25 -15
- package/analyzer-template/packages/database/src/lib/loadCommits.ts +31 -20
- package/analyzer-template/packages/database/src/lib/loadEntities.ts +0 -6
- package/analyzer-template/packages/database/src/lib/loadEntity.ts +19 -8
- package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +0 -5
- package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +94 -143
- 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 +29 -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 +149 -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/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/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/loadEntities.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +0 -6
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.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/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 +76 -90
- 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/enums/ProjectFramework.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.js +2 -0
- package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.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/enums/ProjectFramework.ts +2 -0
- 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/ui-components/package.json +1 -1
- package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.js +2 -0
- package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.js.map +1 -1
- 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 +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 +28 -3
- 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 +41 -2
- package/analyzer-template/playwright/captureFromUrl.ts +89 -82
- package/analyzer-template/project/analyzeFileEntities.ts +26 -0
- 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/runMultiScenarioServer.ts +26 -3
- 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 +110 -17
- package/analyzer-template/tsconfig.json +13 -1
- 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/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/runMultiScenarioServer.js +23 -3
- package/background/src/lib/virtualized/project/runMultiScenarioServer.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 +83 -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 +56 -25
- 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.stepDispatch.test.js +56 -0
- package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js +101 -47
- package/codeyam-cli/src/commands/__tests__/init.gitignore.test.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 +5900 -0
- package/codeyam-cli/src/commands/editor.js.map +1 -0
- 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 +109 -45
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/commands/memory.js +89 -75
- package/codeyam-cli/src/commands/memory.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 +77 -0
- package/codeyam-cli/src/data/techStacks.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js +173 -0
- package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js +46 -0
- package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js.map +1 -0
- 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 +181 -0
- package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +4014 -0
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
- 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__/editorCapture.test.js +93 -0
- package/codeyam-cli/src/utils/__tests__/editorCapture.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__/editorDevServer.test.js +304 -0
- package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +194 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -0
- 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__/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 +594 -0
- package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -0
- 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__/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 +361 -0
- package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +153 -0
- package/codeyam-cli/src/utils/__tests__/editorProxySession.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 +291 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +1768 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +329 -0
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -0
- 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 +2121 -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__/glossaryAdd.test.js +177 -0
- package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +122 -0
- package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -0
- 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__/npmVersionCheck.test.js +26 -20
- package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js +129 -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__/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 +284 -0
- package/codeyam-cli/src/utils/__tests__/scenarioCoverage.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 +672 -0
- package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -0
- 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 +51 -4
- 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__/templateConsistency.test.js +51 -0
- package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/testRunner.test.js +217 -0
- package/codeyam-cli/src/utils/__tests__/testRunner.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/webappDetection.test.js +148 -0
- package/codeyam-cli/src/utils/__tests__/webappDetection.test.js.map +1 -0
- 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 +19 -0
- package/codeyam-cli/src/utils/analyzer.js.map +1 -1
- package/codeyam-cli/src/utils/analyzerFinalization.js +100 -0
- package/codeyam-cli/src/utils/analyzerFinalization.js.map +1 -0
- package/codeyam-cli/src/utils/backgroundServer.js +105 -13
- 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/database.js +37 -2
- package/codeyam-cli/src/utils/database.js.map +1 -1
- 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 +95 -0
- package/codeyam-cli/src/utils/editorApi.js.map +1 -0
- package/codeyam-cli/src/utils/editorAudit.js +827 -0
- package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
- package/codeyam-cli/src/utils/editorBroadcastViewport.js +26 -0
- package/codeyam-cli/src/utils/editorBroadcastViewport.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/editorDeleteScenario.js +67 -0
- package/codeyam-cli/src/utils/editorDeleteScenario.js.map +1 -0
- package/codeyam-cli/src/utils/editorDevServer.js +197 -0
- package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
- package/codeyam-cli/src/utils/editorEntityChangeStatus.js +50 -0
- package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -0
- 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/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 +152 -0
- package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -0
- package/codeyam-cli/src/utils/editorMigration.js +224 -0
- package/codeyam-cli/src/utils/editorMigration.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 +139 -0
- package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
- package/codeyam-cli/src/utils/editorRecapture.js +109 -0
- package/codeyam-cli/src/utils/editorRecapture.js.map +1 -0
- package/codeyam-cli/src/utils/editorScenarioSwitch.js +134 -0
- package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -0
- package/codeyam-cli/src/utils/editorScenarios.js +677 -0
- package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
- package/codeyam-cli/src/utils/editorSeedAdapter.js +462 -0
- package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -0
- 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 +394 -0
- package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -0
- package/codeyam-cli/src/utils/entityChangeStatus.server.js +227 -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 +63 -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/glossaryAdd.js +74 -0
- package/codeyam-cli/src/utils/glossaryAdd.js.map +1 -0
- package/codeyam-cli/src/utils/install-skills.js +71 -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/manualEntityAnalysis.js +196 -0
- package/codeyam-cli/src/utils/manualEntityAnalysis.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/progress.js +2 -2
- package/codeyam-cli/src/utils/progress.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__/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/__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 +105 -7
- 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/registerScenarioResult.js +52 -0
- package/codeyam-cli/src/utils/registerScenarioResult.js.map +1 -0
- package/codeyam-cli/src/utils/requireSimulations.js +1 -1
- package/codeyam-cli/src/utils/requireSimulations.js.map +1 -1
- package/codeyam-cli/src/utils/routePatternMatching.js +129 -0
- package/codeyam-cli/src/utils/routePatternMatching.js.map +1 -0
- 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 +4 -6
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -1
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +1 -1
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.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/scenarioCoverage.js +77 -0
- package/codeyam-cli/src/utils/scenarioCoverage.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 +313 -0
- package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -0
- package/codeyam-cli/src/utils/screenshotHash.js +26 -0
- package/codeyam-cli/src/utils/screenshotHash.js.map +1 -0
- package/codeyam-cli/src/utils/serverState.js +57 -2
- package/codeyam-cli/src/utils/serverState.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +83 -11
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/utils/simulationGateMiddleware.js +175 -0
- package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
- package/codeyam-cli/src/utils/slugUtils.js +25 -0
- package/codeyam-cli/src/utils/slugUtils.js.map +1 -0
- package/codeyam-cli/src/utils/syncMocksMiddleware.js +7 -26
- package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
- 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 +356 -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 +46 -0
- package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
- package/codeyam-cli/src/utils/webappDetection.js +38 -3
- package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
- package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js +98 -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 +35 -0
- package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js +107 -0
- package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +647 -0
- package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js +315 -0
- package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js.map +1 -0
- 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 +86 -0
- package/codeyam-cli/src/webserver/app/lib/clientErrors.js.map +1 -0
- 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 +397 -0
- package/codeyam-cli/src/webserver/app/lib/git.js.map +1 -0
- 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 +141 -42
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CLe80MMu.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-bwuHPyTa.js → EntityItem-Crt_KN_U.js} +5 -5
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-CQgyEGV-.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-BH0XDim7.js → EntityTypeIcon-CD7lGABo.js} +9 -9
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-CgTNOhnu.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-DtYTSPL2.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-D3s1MFkb.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-BvMu2i-g.js → LoadingDots-By5zI316.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-kgBTLoJD.js → LogViewer-CM5zg40N.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/MiniClaudeChat-CQENLSrF.js +36 -0
- package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-BzPgx-xO.js → ReportIssueModal-C2PLkej3.js} +4 -4
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-DanvyBPb.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-BX2Ny2Qj.js → ScenarioViewer-CefgqbCr.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bc8BG-Lw.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-BA_Ry-rs.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{_index-BRx8ZGZo.js → _index-C1YkzTAV.js} +4 -4
- package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-4S4yPfFw.js → activity.(_tab)-yH46LLUz.js} +8 -8
- 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-CHx25PAe.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-Bg3e7q4S.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-recapture-stale-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-rename-scenario-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-coverage-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-scenario-prompt-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-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-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.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/api.rule-path-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{book-open-D4IPYH_y.js → book-open-CL-lMgHh.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-CG65viiV.js → chevron-down-GmAjGS9-.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-BAdwhyCx.js +43 -0
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-igfMr5DY.js → circle-check-DFcQkN5j.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{copy-Coc4o_8c.js → copy-C6iF61Xs.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-4ImjHTVC.js +41 -0
- 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-CRepiabR.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/editor._tab-Gbk_i5Js.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-DLM1-ZMt.js +96 -0
- package/codeyam-cli/src/webserver/build/client/assets/editorPreview-CluPkvXJ.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-B0h9AqE6.js → entity._sha._-DYJRGiDI.js} +14 -13
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-wdiwx5-Z.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-BrkN-40Y.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-DxfhekTZ.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-PePWg17F.js → entity._sha_.edit._scenarioId-CRXJWmpB.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-I-Wo99C_.js → entry.client-SuW9syRS.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-D-xGrg29.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-Bq_fbXP5.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-9EkC9j9I.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-_417gcQW.js → index-Bp1l4hSv.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-CUM5iXwc.js → index-CWV9XZiG.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/index-DE3jI_dv.js +15 -0
- package/codeyam-cli/src/webserver/build/client/assets/jsx-runtime-D_zvdyIk.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/labs-B_IX45ih.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-TzRHMVog.js → loader-circle-De-7qQ2u.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/manifest-7e749098.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/memory-Cx2xEx7s.js +101 -0
- package/codeyam-cli/src/webserver/build/client/assets/{pause-hjzB7t2z.js → pause-CFxEKL1u.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/root-DGtly3mb.js +80 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-DcAwD_Ln.js → search-BdBb5aqc.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/settings-DdE-Untf.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-DSCdE99u.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{terminal-DbEAHMbA.js → terminal-CrplD4b1.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-CAD5b1o_.js → triangle-alert-DqJ0j69l.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-DhXHbEjP.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-D9QZKaLJ.js +2 -0
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-Cy5Qg_UR.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/useToast-5HR2j9ZE.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
- package/codeyam-cli/src/webserver/build/client/sound-test.html +98 -0
- package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-CO8xocj3.js +16 -0
- package/codeyam-cli/src/webserver/build/server/assets/index-QKPqlUgg.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/init-DlspChIk.js +10 -0
- package/codeyam-cli/src/webserver/build/server/assets/progress-CHTtrxFG.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-ChzicV-B.js +689 -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 +1028 -0
- package/codeyam-cli/src/webserver/editorProxy.js.map +1 -0
- package/codeyam-cli/src/webserver/idleDetector.js +130 -0
- package/codeyam-cli/src/webserver/idleDetector.js.map +1 -0
- package/codeyam-cli/src/webserver/mockStateEvents.js +28 -0
- package/codeyam-cli/src/webserver/mockStateEvents.js.map +1 -0
- package/codeyam-cli/src/webserver/public/sound-test.html +98 -0
- package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +414 -0
- package/codeyam-cli/src/webserver/scripts/journalCapture.ts +283 -0
- package/codeyam-cli/src/webserver/server.js +379 -1
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/src/webserver/terminalServer.js +952 -0
- package/codeyam-cli/src/webserver/terminalServer.js.map +1 -0
- package/codeyam-cli/templates/__tests__/editor-step-hook.prompt-capture.test.ts +118 -0
- package/codeyam-cli/templates/chrome-extension-react/EXTENSION_SETUP.md +75 -0
- package/codeyam-cli/templates/chrome-extension-react/README.md +46 -0
- package/codeyam-cli/templates/chrome-extension-react/gitignore +15 -0
- package/codeyam-cli/templates/chrome-extension-react/index.html +12 -0
- package/codeyam-cli/templates/chrome-extension-react/package.json +27 -0
- package/codeyam-cli/templates/chrome-extension-react/popup.html +12 -0
- package/codeyam-cli/templates/chrome-extension-react/public/manifest.json +15 -0
- package/codeyam-cli/templates/chrome-extension-react/src/background/service-worker.ts +7 -0
- package/codeyam-cli/templates/chrome-extension-react/src/globals.css +6 -0
- package/codeyam-cli/templates/chrome-extension-react/src/lib/storage.ts +37 -0
- package/codeyam-cli/templates/chrome-extension-react/src/popup/App.tsx +12 -0
- package/codeyam-cli/templates/chrome-extension-react/src/popup/main.tsx +10 -0
- package/codeyam-cli/templates/chrome-extension-react/tsconfig.json +24 -0
- package/codeyam-cli/templates/chrome-extension-react/vite.config.ts +41 -0
- package/codeyam-cli/templates/codeyam-editor-claude.md +149 -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 +368 -0
- package/codeyam-cli/templates/expo-react-native/MOBILE_SETUP.md +204 -0
- package/codeyam-cli/templates/expo-react-native/README.md +41 -0
- package/codeyam-cli/templates/expo-react-native/__tests__/.gitkeep +0 -0
- package/codeyam-cli/templates/expo-react-native/app/(tabs)/_layout.tsx +33 -0
- package/codeyam-cli/templates/expo-react-native/app/(tabs)/index.tsx +12 -0
- package/codeyam-cli/templates/expo-react-native/app/(tabs)/settings.tsx +12 -0
- package/codeyam-cli/templates/expo-react-native/app/_layout.tsx +13 -0
- package/codeyam-cli/templates/expo-react-native/app.json +18 -0
- package/codeyam-cli/templates/expo-react-native/babel.config.js +9 -0
- package/codeyam-cli/templates/expo-react-native/gitignore +12 -0
- package/codeyam-cli/templates/expo-react-native/global.css +10 -0
- package/codeyam-cli/templates/expo-react-native/lib/storage.ts +32 -0
- package/codeyam-cli/templates/expo-react-native/lib/theme.ts +73 -0
- package/codeyam-cli/templates/expo-react-native/metro.config.js +6 -0
- package/codeyam-cli/templates/expo-react-native/nativewind-env.d.ts +1 -0
- package/codeyam-cli/templates/expo-react-native/package.json +48 -0
- package/codeyam-cli/templates/expo-react-native/tailwind.config.js +10 -0
- package/codeyam-cli/templates/expo-react-native/tsconfig.json +10 -0
- package/codeyam-cli/templates/hooks/staleness-check.sh +43 -0
- package/codeyam-cli/templates/isolation-route/expo-router.tsx.template +54 -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/AUTH_PATTERNS.md +308 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/AUTH_UPGRADE.md +304 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/DATABASE.md +126 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/FEATURE_PATTERNS.md +37 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/README.md +53 -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 +24 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/app/page.tsx +10 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/env +4 -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 +39 -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 +40 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma.config.ts +12 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +140 -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/nextjs-prisma-supabase/README.md +52 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/SUPABASE_SETUP.md +104 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/app/api/todos/route.ts +17 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/app/globals.css +26 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/app/layout.tsx +34 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/app/lib/prisma.ts +20 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/app/lib/supabase.ts +12 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/app/page.tsx +10 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/env +9 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/eslint.config.mjs +11 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/gitignore +40 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/next.config.ts +11 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/package.json +37 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/postcss.config.mjs +7 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/prisma/schema.prisma +27 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/prisma/seed.ts +39 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/prisma.config.ts +12 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/tsconfig.json +34 -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 +25 -5
- package/codeyam-cli/templates/rules-instructions.md +34 -88
- package/codeyam-cli/templates/seed-adapters/supabase.ts +291 -0
- package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +237 -0
- package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +244 -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 +22 -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/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/completionCall.js +10 -7
- package/packages/ai/src/lib/completionCall.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +261 -13
- 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/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/dataStructureChunking.js +9 -5
- package/packages/ai/src/lib/dataStructureChunking.js.map +1 -1
- 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 +81 -11
- package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
- package/packages/analyze/index.js +1 -1
- package/packages/analyze/index.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/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 +14 -27
- 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 +12 -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/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 +185 -28
- 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 +1386 -1197
- 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 +149 -0
- package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
- package/packages/database/src/lib/loadAnalysis.js +7 -1
- package/packages/database/src/lib/loadAnalysis.js.map +1 -1
- package/packages/database/src/lib/loadCommits.js +23 -13
- package/packages/database/src/lib/loadCommits.js.map +1 -1
- package/packages/database/src/lib/loadEntities.js +0 -6
- package/packages/database/src/lib/loadEntities.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/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
- package/packages/database/src/lib/updateCommitMetadata.js +76 -90
- 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/types/src/enums/ProjectFramework.js +2 -0
- package/packages/types/src/enums/ProjectFramework.js.map +1 -1
- package/packages/utils/src/lib/fs/rsyncCopy.js +28 -3
- 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/CopyButton-jNYXRRNI.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-CvzqMxcu.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-EhOseatT.js +0 -34
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-yjIHlOGa.js +0 -25
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-Cq5o8jL4.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-CwZrv-Ok.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-CDpEprKa.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DHKuQSmR.js +0 -17
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-DB3aFuEO.js +0 -51
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-D1zB-pYc.js +0 -21
- 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-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/fileTableUtils-9sMMAiWJ.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-Co65J0s3.js +0 -1
- 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/simulations-DVNJVQgD.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/client/assets/useReportContext-DZlYx2c4.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useToast-ihdMtlf6.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-CxaRxKVt.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-D4DT0nM_.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,952 @@
|
|
|
1
|
+
var _a, _b;
|
|
2
|
+
import { WebSocketServer, WebSocket } from 'ws';
|
|
3
|
+
import crypto from 'crypto';
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import * as pty from 'node-pty';
|
|
7
|
+
import { createMarkerTransformer } from "../utils/scenarioMarkers.js";
|
|
8
|
+
import { IdleDetector } from "./idleDetector.js";
|
|
9
|
+
import { mockStateEventEmitter } from "./mockStateEvents.js";
|
|
10
|
+
/**
|
|
11
|
+
* Strip the raw `claude ...` shell command from suppressed PTY output
|
|
12
|
+
* so it doesn't leak to the user in the fallback timeout path.
|
|
13
|
+
*/
|
|
14
|
+
export function stripClaudeCommand(output) {
|
|
15
|
+
// Find the line containing the claude command and strip everything before
|
|
16
|
+
// and including it (shell prompt, ANSI codes, command echo). Preserve any
|
|
17
|
+
// real output that follows.
|
|
18
|
+
const idx = output.indexOf('claude ');
|
|
19
|
+
if (idx === -1)
|
|
20
|
+
return output;
|
|
21
|
+
// Find the end of the command line (\r or \n after "claude")
|
|
22
|
+
let end = idx;
|
|
23
|
+
while (end < output.length && output[end] !== '\r' && output[end] !== '\n') {
|
|
24
|
+
end++;
|
|
25
|
+
}
|
|
26
|
+
// Skip past trailing \r\n
|
|
27
|
+
while (end < output.length &&
|
|
28
|
+
(output[end] === '\r' || output[end] === '\n')) {
|
|
29
|
+
end++;
|
|
30
|
+
}
|
|
31
|
+
// Strip leading ANSI escape sequences from the remainder
|
|
32
|
+
// (e.g. bracketed paste mode toggles like \x1b[?2004l)
|
|
33
|
+
let rest = output.slice(end);
|
|
34
|
+
rest = rest.replace(/^(\x1b\[[\x20-\x3f]*[\x40-\x7e]|\x1b[()][A-Z0-9])*/, '');
|
|
35
|
+
return rest;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Detect whether a PTY output chunk contains Claude Code's welcome banner.
|
|
39
|
+
* Supports both the old box-drawing format (`╭─── Claude Code ───╮`)
|
|
40
|
+
* and the new block-art format (`▐▛███▜▌ Claude Code`).
|
|
41
|
+
*/
|
|
42
|
+
export function isBannerChunk(data) {
|
|
43
|
+
// Strip ANSI escape sequences before checking — Claude Code's Ink renderer
|
|
44
|
+
// inserts SGR color codes between the banner characters (e.g. ▐\x1b[48;5;16m▛).
|
|
45
|
+
const plain = data.replace(/\x1b\[[0-9;?]*[A-Za-z]|\x1b\][^\x07]*\x07|\x1b[()][A-Z0-9]/g, '');
|
|
46
|
+
return plain.includes('╭') || plain.includes('▐▛');
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Determine whether the startup output filter should be active.
|
|
50
|
+
* The filter strips the raw `claude --session-id ...` command from the
|
|
51
|
+
* terminal so the user never sees it.
|
|
52
|
+
*/
|
|
53
|
+
export function shouldFilterStartup(opts) {
|
|
54
|
+
return opts.hasContext || opts.editorMode;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Manages PTY output suppression during Claude startup.
|
|
58
|
+
*
|
|
59
|
+
* Suppresses all output until the welcome banner arrives, then clears
|
|
60
|
+
* the screen. The claude command is stripped from any chunk that is forwarded
|
|
61
|
+
* (both the banner chunk on the normal path and the buffered output on the
|
|
62
|
+
* fallback timeout path).
|
|
63
|
+
*/
|
|
64
|
+
export class StartupOutputFilter {
|
|
65
|
+
constructor() {
|
|
66
|
+
this.hasClearedScreen = false;
|
|
67
|
+
this.suppressedOutput = '';
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Process a PTY data chunk. Returns an object describing what action to take:
|
|
71
|
+
* - `type: 'suppress'` — buffer the chunk, send nothing
|
|
72
|
+
* - `type: 'clear-and-send'` — clear screen, then send `data`
|
|
73
|
+
* - `type: 'send'` — send `data` as-is (post-startup)
|
|
74
|
+
*/
|
|
75
|
+
processChunk(data) {
|
|
76
|
+
if (!this.hasClearedScreen && isBannerChunk(data)) {
|
|
77
|
+
this.hasClearedScreen = true;
|
|
78
|
+
const cleaned = stripClaudeCommand(data);
|
|
79
|
+
return { type: 'clear-and-send', data: cleaned };
|
|
80
|
+
}
|
|
81
|
+
if (!this.hasClearedScreen) {
|
|
82
|
+
this.suppressedOutput += data;
|
|
83
|
+
return { type: 'suppress' };
|
|
84
|
+
}
|
|
85
|
+
return { type: 'send', data };
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Called when the fallback timeout fires (╭ never arrived).
|
|
89
|
+
* Returns the buffered output with the command stripped, or null if
|
|
90
|
+
* the screen was already cleared.
|
|
91
|
+
*/
|
|
92
|
+
getTimeoutOutput() {
|
|
93
|
+
if (this.hasClearedScreen)
|
|
94
|
+
return null;
|
|
95
|
+
this.hasClearedScreen = true;
|
|
96
|
+
if (this.suppressedOutput.length === 0)
|
|
97
|
+
return null;
|
|
98
|
+
const cleaned = stripClaudeCommand(this.suppressedOutput);
|
|
99
|
+
return cleaned.length > 0 ? cleaned : null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// Use globalThis so the sessions Set is shared across module instances.
|
|
103
|
+
// In Vite dev mode, this file is loaded twice: once by the Vite plugin (Node.js native)
|
|
104
|
+
// and once by the SSR context (ssrLoadModule). Without globalThis, each instance
|
|
105
|
+
// gets its own empty Set — so broadcastPreviewRefresh() called from the SSR instance
|
|
106
|
+
// (via the /api/dev-mode-preview endpoint) would broadcast to 0 sessions.
|
|
107
|
+
const sessions = ((_a = globalThis).__codeyamTerminalSessions ?? (_a.__codeyamTerminalSessions = new Set()));
|
|
108
|
+
// Detached PTYs waiting for reconnection (keyed by sessionId).
|
|
109
|
+
// When a WebSocket drops, the PTY is moved here with a grace timer
|
|
110
|
+
// instead of being killed immediately, allowing the client to reconnect.
|
|
111
|
+
const detachedPtys = ((_b = globalThis).__codeyamDetachedPtys ?? (_b.__codeyamDetachedPtys = new Map()));
|
|
112
|
+
const PING_INTERVAL_MS = 30000;
|
|
113
|
+
const DETACH_GRACE_MS = 60000;
|
|
114
|
+
const OUTPUT_BUFFER_MAX = 8 * 1024; // 8KB
|
|
115
|
+
// Ping interval reference — shared so cleanup can clear it
|
|
116
|
+
let pingInterval = globalThis.__codeyamPingInterval ?? null;
|
|
117
|
+
// Keys to forward from the server env into the PTY shell.
|
|
118
|
+
// Keeps the env clean (no giant CODEYAM_PROJECT JSON blobs) while
|
|
119
|
+
// preserving everything Claude Code and the user's shell need.
|
|
120
|
+
const ENV_PASSTHROUGH_KEYS = [
|
|
121
|
+
'PATH',
|
|
122
|
+
'HOME',
|
|
123
|
+
'USER',
|
|
124
|
+
'LOGNAME',
|
|
125
|
+
'SHELL',
|
|
126
|
+
'TERM',
|
|
127
|
+
'LANG',
|
|
128
|
+
'LC_ALL',
|
|
129
|
+
'LC_CTYPE',
|
|
130
|
+
'EDITOR',
|
|
131
|
+
'VISUAL',
|
|
132
|
+
'TMPDIR',
|
|
133
|
+
'XDG_CONFIG_HOME',
|
|
134
|
+
'XDG_DATA_HOME',
|
|
135
|
+
'XDG_CACHE_HOME',
|
|
136
|
+
// API keys Claude Code may need
|
|
137
|
+
'ANTHROPIC_API_KEY',
|
|
138
|
+
'OPENAI_API_KEY',
|
|
139
|
+
// nvm / fnm / volta node version managers
|
|
140
|
+
'NVM_DIR',
|
|
141
|
+
'NVM_BIN',
|
|
142
|
+
'FNM_DIR',
|
|
143
|
+
'VOLTA_HOME',
|
|
144
|
+
// Homebrew
|
|
145
|
+
'HOMEBREW_PREFIX',
|
|
146
|
+
'HOMEBREW_CELLAR',
|
|
147
|
+
'HOMEBREW_REPOSITORY',
|
|
148
|
+
];
|
|
149
|
+
export function buildPtyEnv(options) {
|
|
150
|
+
const env = {};
|
|
151
|
+
for (const key of ENV_PASSTHROUGH_KEYS) {
|
|
152
|
+
const val = process.env[key];
|
|
153
|
+
if (val != null)
|
|
154
|
+
env[key] = val;
|
|
155
|
+
}
|
|
156
|
+
// Always set TERM for proper terminal behavior
|
|
157
|
+
if (!env.TERM)
|
|
158
|
+
env.TERM = 'xterm-256color';
|
|
159
|
+
// Signal to hooks that this is an editor Build session.
|
|
160
|
+
// Without this, editor hooks fire in ALL Claude sessions in the project.
|
|
161
|
+
if (options?.editorMode) {
|
|
162
|
+
env.CODEYAM_EDITOR_ACTIVE = '1';
|
|
163
|
+
}
|
|
164
|
+
return env;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Convert a name to a safe file name matching CodeYam's convention.
|
|
168
|
+
* e.g. "Default Scenario" -> "Default_Scenario"
|
|
169
|
+
*/
|
|
170
|
+
function safeFileName(name) {
|
|
171
|
+
const safe = name.replace(/[^a-zA-Z0-9_]+/g, '_').replace(/^_+|_+$/g, '');
|
|
172
|
+
return safe.slice(0, 1).toUpperCase() + safe.slice(1);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Find the actual mock data file for a scenario in the tmp project.
|
|
176
|
+
* Tries a fast heuristic (extract app dir from entity file path) first,
|
|
177
|
+
* then falls back to a shallow directory search.
|
|
178
|
+
*/
|
|
179
|
+
function findMockDataFile(projectRoot, entityFilePath, scenarioName) {
|
|
180
|
+
const scenarioSlug = safeFileName(scenarioName);
|
|
181
|
+
const mockFile = `MockData_${scenarioSlug}.tsx`;
|
|
182
|
+
// Heuristic: the __codeyamMocks__ dir lives at the app directory level.
|
|
183
|
+
// Extract "app/" (or "src/", "pages/") from the entity's file path.
|
|
184
|
+
if (entityFilePath) {
|
|
185
|
+
const parts = entityFilePath.split('/');
|
|
186
|
+
for (let i = 0; i < parts.length; i++) {
|
|
187
|
+
if (['app', 'src', 'pages'].includes(parts[i])) {
|
|
188
|
+
const appDir = parts.slice(0, i + 1).join('/');
|
|
189
|
+
const candidate = path.join(projectRoot, appDir, '__codeyamMocks__', mockFile);
|
|
190
|
+
if (fs.existsSync(candidate))
|
|
191
|
+
return candidate;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// Fallback: search __codeyamMocks__ directories up to 5 levels deep
|
|
196
|
+
function searchDir(dir, depth) {
|
|
197
|
+
if (depth > 5)
|
|
198
|
+
return null;
|
|
199
|
+
try {
|
|
200
|
+
for (const entry of fs.readdirSync(dir)) {
|
|
201
|
+
if (entry === 'node_modules' ||
|
|
202
|
+
entry === '.git' ||
|
|
203
|
+
entry === 'coverage')
|
|
204
|
+
continue;
|
|
205
|
+
const full = path.join(dir, entry);
|
|
206
|
+
if (entry === '__codeyamMocks__') {
|
|
207
|
+
const candidate = path.join(full, mockFile);
|
|
208
|
+
if (fs.existsSync(candidate))
|
|
209
|
+
return candidate;
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
try {
|
|
213
|
+
if (fs.statSync(full).isDirectory()) {
|
|
214
|
+
const result = searchDir(full, depth + 1);
|
|
215
|
+
if (result)
|
|
216
|
+
return result;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
// Permission error or broken symlink
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
// Directory unreadable
|
|
226
|
+
}
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
return searchDir(projectRoot, 0);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Write a structured context file for the codeyam-dev-mode skill.
|
|
233
|
+
* The skill reads this file on startup instead of receiving a long CLI argument.
|
|
234
|
+
* Returns true if context was written successfully, false otherwise.
|
|
235
|
+
*/
|
|
236
|
+
function writeDevModeContext(ctx) {
|
|
237
|
+
if (!ctx.entityName)
|
|
238
|
+
return false;
|
|
239
|
+
const codeyamRoot = process.env.CODEYAM_ROOT_PATH || process.cwd();
|
|
240
|
+
const contextDir = path.join(codeyamRoot, '.codeyam');
|
|
241
|
+
const contextPath = path.join(contextDir, 'dev-mode-context.md');
|
|
242
|
+
try {
|
|
243
|
+
fs.mkdirSync(contextDir, { recursive: true });
|
|
244
|
+
const lines = ['# Dev Mode Context', ''];
|
|
245
|
+
// Entity section
|
|
246
|
+
lines.push('## Entity');
|
|
247
|
+
lines.push(`- **Name:** ${ctx.entityName}`);
|
|
248
|
+
if (ctx.entityType)
|
|
249
|
+
lines.push(`- **Type:** ${ctx.entityType}`);
|
|
250
|
+
if (ctx.entitySha)
|
|
251
|
+
lines.push(`- **SHA:** ${ctx.entitySha}`);
|
|
252
|
+
if (ctx.entityFilePath)
|
|
253
|
+
lines.push(`- **Source file:** ${ctx.entityFilePath}`);
|
|
254
|
+
lines.push('');
|
|
255
|
+
// Scenario section
|
|
256
|
+
if (ctx.scenarioName) {
|
|
257
|
+
lines.push('## Scenario');
|
|
258
|
+
lines.push(`- **Name:** ${ctx.scenarioName}`);
|
|
259
|
+
if (ctx.scenarioDescription)
|
|
260
|
+
lines.push(`- **Description:** ${ctx.scenarioDescription}`);
|
|
261
|
+
if (ctx.analysisId)
|
|
262
|
+
lines.push(`- **Analysis ID:** ${ctx.analysisId}`);
|
|
263
|
+
lines.push('');
|
|
264
|
+
}
|
|
265
|
+
// Files section
|
|
266
|
+
lines.push('## Files');
|
|
267
|
+
if (ctx.entityFilePath) {
|
|
268
|
+
lines.push(`- **Source file:** ${ctx.entityFilePath}`);
|
|
269
|
+
}
|
|
270
|
+
if (ctx.projectSlug && ctx.scenarioName) {
|
|
271
|
+
const tmpBase = `/tmp/codeyam/local-dev/${ctx.projectSlug}`;
|
|
272
|
+
const tmpProject = `${tmpBase}/project`;
|
|
273
|
+
const mockDataPath = findMockDataFile(tmpProject, ctx.entityFilePath, ctx.scenarioName);
|
|
274
|
+
if (mockDataPath) {
|
|
275
|
+
lines.push(`- **Mock data:** ${mockDataPath}`);
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
const scenarioSlug = safeFileName(ctx.scenarioName);
|
|
279
|
+
lines.push(`- **Mock data:** search for \`MockData_${scenarioSlug}.tsx\` in \`__codeyamMocks__\` under ${tmpProject}`);
|
|
280
|
+
}
|
|
281
|
+
lines.push(`- **Dev server project:** ${tmpProject}`);
|
|
282
|
+
lines.push(`- **Server log:** ${tmpBase}/codeyam/log.txt`);
|
|
283
|
+
}
|
|
284
|
+
lines.push('');
|
|
285
|
+
// Database
|
|
286
|
+
lines.push('## Database');
|
|
287
|
+
lines.push(`- **Path:** .codeyam/db.sqlite3`);
|
|
288
|
+
lines.push('');
|
|
289
|
+
// Server
|
|
290
|
+
const serverPort = process.env.CODEYAM_PORT || '3111';
|
|
291
|
+
lines.push('## Server');
|
|
292
|
+
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)`);
|
|
293
|
+
lines.push('');
|
|
294
|
+
fs.writeFileSync(contextPath, lines.join('\n'), 'utf8');
|
|
295
|
+
return true;
|
|
296
|
+
}
|
|
297
|
+
catch (error) {
|
|
298
|
+
console.error('[terminalServer] Failed to write dev-mode-context.md:', error);
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Write a structured context file for the codeyam-editor skill.
|
|
304
|
+
* Returns true if context was written successfully, false otherwise.
|
|
305
|
+
*/
|
|
306
|
+
function writeEditorModeContext(ctx) {
|
|
307
|
+
if (!ctx.projectSlug)
|
|
308
|
+
return false;
|
|
309
|
+
const codeyamRoot = process.env.CODEYAM_ROOT_PATH || process.cwd();
|
|
310
|
+
const contextDir = path.join(codeyamRoot, '.codeyam');
|
|
311
|
+
const contextPath = path.join(contextDir, 'editor-mode-context.md');
|
|
312
|
+
try {
|
|
313
|
+
fs.mkdirSync(contextDir, { recursive: true });
|
|
314
|
+
const serverPort = process.env.CODEYAM_PORT || '3111';
|
|
315
|
+
const proxyPort = parseInt(serverPort, 10) + 1;
|
|
316
|
+
const lines = [
|
|
317
|
+
'# Editor Mode Context',
|
|
318
|
+
'',
|
|
319
|
+
'## Project',
|
|
320
|
+
`- **Root:** ${codeyamRoot}`,
|
|
321
|
+
`- **Slug:** ${ctx.projectSlug}`,
|
|
322
|
+
'',
|
|
323
|
+
'## Server',
|
|
324
|
+
`- **Port:** ${serverPort}`,
|
|
325
|
+
`- **Dashboard:** http://localhost:${serverPort}/editor`,
|
|
326
|
+
`- **Proxy:** http://localhost:${proxyPort} (used by the browser iframe only — do NOT use for health checks)`,
|
|
327
|
+
'',
|
|
328
|
+
'## Workflow',
|
|
329
|
+
'- **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)',
|
|
330
|
+
'- Each feature follows 18 steps — run `codeyam editor steps` to see what to do next. Never expose `codeyam editor` commands to the user.',
|
|
331
|
+
'- **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.',
|
|
332
|
+
'- Steps 1, 5, 15, and 18 require user confirmation before proceeding',
|
|
333
|
+
'',
|
|
334
|
+
'## Preview Updates',
|
|
335
|
+
'- **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.',
|
|
336
|
+
`- **Refresh command:** \`curl -s -X POST http://localhost:${serverPort}/api/dev-mode-preview -H 'Content-Type: application/json' -d '{"dimension":"Desktop"}'\` (dimension is REQUIRED)`,
|
|
337
|
+
'- Aim for 4-8+ preview updates during a typical building session.',
|
|
338
|
+
'',
|
|
339
|
+
'## Verifying the Dev Server',
|
|
340
|
+
'- Get the dev server URL: `curl -s http://localhost:' +
|
|
341
|
+
serverPort +
|
|
342
|
+
'/api/editor-dev-server` → look at the `"url"` field (e.g., `http://localhost:3000`)',
|
|
343
|
+
'- Verify pages and API routes: `codeyam editor verify-routes \'{"paths":["/"],"apiRoutes":["/api/your-route"]}\'` (checks HTTP status and JSON validity)',
|
|
344
|
+
'- **NEVER check localhost:' +
|
|
345
|
+
proxyPort +
|
|
346
|
+
' for health** — the proxy returns 200 even when the app is broken',
|
|
347
|
+
'',
|
|
348
|
+
'## API Endpoints',
|
|
349
|
+
`- **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\``,
|
|
350
|
+
`- **Get active scenario data:** \`curl http://localhost:${serverPort}/api/editor-scenario-data\``,
|
|
351
|
+
`- **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.`,
|
|
352
|
+
`- **Refresh config:** \`curl -X POST http://localhost:${serverPort}/api/editor-refresh\` (also starts dev server if a webapp is detected)`,
|
|
353
|
+
`- **Dev server status:** \`curl http://localhost:${serverPort}/api/editor-dev-server\``,
|
|
354
|
+
`- **Start dev server:** \`curl -X POST http://localhost:${serverPort}/api/editor-dev-server -H 'Content-Type: application/json' -d '{"action":"start"}'\``,
|
|
355
|
+
`- **Restart dev server:** \`curl -X POST http://localhost:${serverPort}/api/editor-dev-server -H 'Content-Type: application/json' -d '{"action":"restart"}'\``,
|
|
356
|
+
`- **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)`,
|
|
357
|
+
`- **Journal screenshot:** \`curl -X POST http://localhost:${serverPort}/api/editor-journal-screenshot -H 'Content-Type: application/json' -d '{"url":"...","filename":"..."}'\``,
|
|
358
|
+
`- **Journal entry:** \`curl -X POST http://localhost:${serverPort}/api/editor-journal-entry -H 'Content-Type: application/json' -d '{"title":"...","type":"feature","description":"..."}'\``,
|
|
359
|
+
'',
|
|
360
|
+
'## Scenario Data Format',
|
|
361
|
+
'- Use **route-keyed** mock data: keys are the API paths your app fetches',
|
|
362
|
+
'- Example: `{ "routes": { "/api/tasks": { "body": [...] }, "/api/users": { "body": [...] } } }`',
|
|
363
|
+
'- Error scenarios: `{ "routes": { "/api/tasks": { "status": 500, "body": { "error": "..." } } } }`',
|
|
364
|
+
'- The proxy intercepts GET requests to matching routes and returns the mock data',
|
|
365
|
+
'- POST/PUT/DELETE always go through to the real dev server',
|
|
366
|
+
'',
|
|
367
|
+
'## Component Isolation Routes',
|
|
368
|
+
'- Create isolation route dirs: `codeyam editor isolate ComponentA ComponentB ...`',
|
|
369
|
+
' - This creates the layout guard and a directory per component under `app/isolated-components/`',
|
|
370
|
+
'- Create ONE isolation route page per component:',
|
|
371
|
+
' - **Remix:** `app/routes/isolated-components.ComponentName.tsx` → `/isolated-components/ComponentName`',
|
|
372
|
+
' - **Next.js:** `app/isolated-components/ComponentName/page.tsx` → `/isolated-components/ComponentName`',
|
|
373
|
+
' - **Expo:** `app/isolated-components/ComponentName.tsx` → `/isolated-components/ComponentName` (use `useLocalSearchParams` from expo-router)',
|
|
374
|
+
'- The route defines a `scenarios` object mapping scenario names to props, reads `?s=ScenarioName` from the URL, and renders the component',
|
|
375
|
+
'- 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)',
|
|
376
|
+
'- For Expo: Wrap with `<View nativeID="codeyam-capture">` (nativeID maps to id on web for screenshot capture)',
|
|
377
|
+
'- **Create multiple scenarios per component** (like tests): default/happy path, edge cases (empty data, long text, max items), different visual states (loading, error, disabled)',
|
|
378
|
+
'- 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":[...]}}}}\'`',
|
|
379
|
+
'- The url is a PATH, not a full URL — the proxy appends it and intercepts API calls the component makes',
|
|
380
|
+
'- `mockData.routes` provides data for any API calls the component makes internally (omit if none)',
|
|
381
|
+
'- Isolation routes stay in the project so the editor preview can display them',
|
|
382
|
+
'- Ensure `.gitignore` includes `**/isolated-components*` so they are not committed',
|
|
383
|
+
'',
|
|
384
|
+
'## Files',
|
|
385
|
+
'- **Scenario data:** .codeyam/editor-scenarios/{scenario-id}.json',
|
|
386
|
+
'- **Scenario screenshots:** .codeyam/editor-scenarios/screenshots/{scenario-id}.png',
|
|
387
|
+
'- **Active scenario:** .codeyam/active-scenario.json',
|
|
388
|
+
'- **Database:** .codeyam/db.sqlite3',
|
|
389
|
+
'- **Journal:** .codeyam/journal/ (daily .md files + index.json + screenshots/)',
|
|
390
|
+
'',
|
|
391
|
+
];
|
|
392
|
+
// Check if package.json exists to give context about project state
|
|
393
|
+
const hasPackageJson = fs.existsSync(path.join(codeyamRoot, 'package.json'));
|
|
394
|
+
if (!hasPackageJson) {
|
|
395
|
+
lines.push('## Status');
|
|
396
|
+
lines.push('- **Empty project** — no package.json found. Run `codeyam editor steps` to begin.');
|
|
397
|
+
lines.push('');
|
|
398
|
+
}
|
|
399
|
+
fs.writeFileSync(contextPath, lines.join('\n'), 'utf8');
|
|
400
|
+
return true;
|
|
401
|
+
}
|
|
402
|
+
catch (error) {
|
|
403
|
+
console.error('[terminalServer] Failed to write editor-mode-context.md:', error);
|
|
404
|
+
return false;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Attach a WebSocket server at /ws/terminal to an existing HTTP server.
|
|
409
|
+
* Each WS connection spawns a PTY running the user's shell, then auto-starts `claude`.
|
|
410
|
+
*
|
|
411
|
+
* Features:
|
|
412
|
+
* - Ping/pong keepalive (30s interval) to detect dead connections
|
|
413
|
+
* - PTY detach/reattach: on WS close the PTY survives for 60s, allowing the client
|
|
414
|
+
* to reconnect with ?reconnectId=<sessionId> and reattach to the same PTY
|
|
415
|
+
* - Session IDs sent to client on connection for reconnect tracking
|
|
416
|
+
*/
|
|
417
|
+
export function attachTerminalServer(httpServer) {
|
|
418
|
+
const wss = new WebSocketServer({ server: httpServer, path: '/ws/terminal' });
|
|
419
|
+
// --- Ping/pong keepalive ---
|
|
420
|
+
// The browser's native WebSocket automatically responds to ping frames with pong.
|
|
421
|
+
if (pingInterval)
|
|
422
|
+
clearInterval(pingInterval);
|
|
423
|
+
pingInterval = setInterval(() => {
|
|
424
|
+
for (const session of sessions) {
|
|
425
|
+
if (!session.isAlive) {
|
|
426
|
+
// Didn't respond to last ping — terminate
|
|
427
|
+
console.log(`[terminalServer] Session ${session.sessionId} ping timeout, terminating`);
|
|
428
|
+
session.ws.terminate();
|
|
429
|
+
continue;
|
|
430
|
+
}
|
|
431
|
+
session.isAlive = false;
|
|
432
|
+
session.ws.ping();
|
|
433
|
+
}
|
|
434
|
+
}, PING_INTERVAL_MS);
|
|
435
|
+
globalThis.__codeyamPingInterval = pingInterval;
|
|
436
|
+
// Subscribe to mock state events and broadcast to all terminal clients
|
|
437
|
+
mockStateEventEmitter.on('event', (event) => {
|
|
438
|
+
if (event.type === 'data-mutation-forwarded') {
|
|
439
|
+
broadcastDataMutationForwarded(event.method, event.pathname);
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
wss.on('connection', (ws, req) => {
|
|
443
|
+
// Parse entity context from query params
|
|
444
|
+
const url = new URL(req.url || '', `http://${req.headers.host}`);
|
|
445
|
+
const entityName = url.searchParams.get('entityName') || '';
|
|
446
|
+
const entityType = url.searchParams.get('entityType') || '';
|
|
447
|
+
const entitySha = url.searchParams.get('entitySha') || '';
|
|
448
|
+
const entityFilePath = url.searchParams.get('entityFilePath') || '';
|
|
449
|
+
const scenarioName = url.searchParams.get('scenarioName') || '';
|
|
450
|
+
const scenarioDescription = url.searchParams.get('scenarioDescription') || '';
|
|
451
|
+
const analysisId = url.searchParams.get('analysisId') || '';
|
|
452
|
+
const projectSlug = url.searchParams.get('projectSlug') || '';
|
|
453
|
+
const editorMode = url.searchParams.get('editorMode') === 'true';
|
|
454
|
+
const reconnectId = url.searchParams.get('reconnectId') || '';
|
|
455
|
+
const claudeStartMode = url.searchParams.get('claudeStartMode') || '';
|
|
456
|
+
const claudeSessionId = url.searchParams.get('claudeSessionId') || '';
|
|
457
|
+
const editorStepLabel = url.searchParams.get('editorStepLabel') || '';
|
|
458
|
+
// --- Reconnection: reattach to a detached PTY ---
|
|
459
|
+
if (reconnectId && detachedPtys.has(reconnectId)) {
|
|
460
|
+
const detached = detachedPtys.get(reconnectId);
|
|
461
|
+
clearTimeout(detached.graceTimer);
|
|
462
|
+
detachedPtys.delete(reconnectId);
|
|
463
|
+
console.log(`[terminalServer] Reattaching session ${reconnectId}`);
|
|
464
|
+
const session = {
|
|
465
|
+
ws,
|
|
466
|
+
ptyProcess: detached.ptyProcess,
|
|
467
|
+
sessionId: detached.sessionId,
|
|
468
|
+
isAlive: true,
|
|
469
|
+
};
|
|
470
|
+
sessions.add(session);
|
|
471
|
+
// Send session ID so client can track it
|
|
472
|
+
ws.send(JSON.stringify({ type: 'session-id', sessionId: session.sessionId }));
|
|
473
|
+
// Send buffered output so client catches up
|
|
474
|
+
if (detached.outputBuffer) {
|
|
475
|
+
ws.send(JSON.stringify({ type: 'output', data: detached.outputBuffer }));
|
|
476
|
+
}
|
|
477
|
+
// Re-wire PTY output -> new WebSocket
|
|
478
|
+
// node-pty's onData returns a disposable; the old listener was still attached
|
|
479
|
+
// and was buffering output into detached.outputBuffer. We need to replace it.
|
|
480
|
+
// Unfortunately node-pty doesn't expose removeListener, so we use a closure flag.
|
|
481
|
+
let detachedFlag = false;
|
|
482
|
+
const reconnectPort = process.env.CODEYAM_PORT || '3111';
|
|
483
|
+
const reconnectTransformMarkers = createMarkerTransformer(reconnectPort);
|
|
484
|
+
const reconnectIdleDetector = new IdleDetector({
|
|
485
|
+
onIdle: () => {
|
|
486
|
+
if (ws.readyState === WebSocket.OPEN) {
|
|
487
|
+
console.log('[terminalServer] Sending claude-idle (reconnected)');
|
|
488
|
+
ws.send(JSON.stringify({ type: 'claude-idle' }));
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
onActive: () => {
|
|
492
|
+
if (ws.readyState === WebSocket.OPEN) {
|
|
493
|
+
console.log('[terminalServer] Sending claude-active (reconnected)');
|
|
494
|
+
ws.send(JSON.stringify({ type: 'claude-active' }));
|
|
495
|
+
}
|
|
496
|
+
},
|
|
497
|
+
}, { activeOutputPattern: /[✶✢·◼]/ });
|
|
498
|
+
detached.ptyProcess.onData((data) => {
|
|
499
|
+
if (detachedFlag)
|
|
500
|
+
return; // Superseded by a newer listener
|
|
501
|
+
if (ws.readyState === WebSocket.OPEN) {
|
|
502
|
+
if (!detached.hasClearedScreen &&
|
|
503
|
+
detached.hasContext &&
|
|
504
|
+
isBannerChunk(data)) {
|
|
505
|
+
detached.hasClearedScreen = true;
|
|
506
|
+
ws.send(JSON.stringify({ type: 'output', data: '\x1b[2J\x1b[H' }));
|
|
507
|
+
}
|
|
508
|
+
const transformed = reconnectTransformMarkers(data);
|
|
509
|
+
if (transformed.length > 0) {
|
|
510
|
+
ws.send(JSON.stringify({ type: 'output', data: transformed }));
|
|
511
|
+
}
|
|
512
|
+
reconnectIdleDetector.onPtyOutput(data);
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
detached.ptyProcess.onExit(() => {
|
|
516
|
+
console.log('[terminalServer] PTY exited (reconnected), flushing idle state');
|
|
517
|
+
reconnectIdleDetector.disposeAndFlush();
|
|
518
|
+
sessions.delete(session);
|
|
519
|
+
if (ws.readyState === WebSocket.OPEN) {
|
|
520
|
+
ws.close();
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
// WebSocket messages -> PTY
|
|
524
|
+
ws.on('message', (raw) => {
|
|
525
|
+
try {
|
|
526
|
+
const msg = JSON.parse(raw.toString());
|
|
527
|
+
if (msg.type === 'input') {
|
|
528
|
+
reconnectIdleDetector.onUserInput();
|
|
529
|
+
detached.ptyProcess.write(msg.data);
|
|
530
|
+
}
|
|
531
|
+
else if (msg.type === 'resize' && msg.cols && msg.rows) {
|
|
532
|
+
detached.ptyProcess.resize(msg.cols, msg.rows);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
catch {
|
|
536
|
+
detached.ptyProcess.write(raw.toString());
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
ws.on('pong', () => {
|
|
540
|
+
session.isAlive = true;
|
|
541
|
+
});
|
|
542
|
+
ws.on('close', () => {
|
|
543
|
+
detachedFlag = true;
|
|
544
|
+
detachSession(session, detached.hasContext, detached.hasClearedScreen);
|
|
545
|
+
});
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
// --- New connection: spawn a fresh PTY ---
|
|
549
|
+
const shell = process.env.SHELL || '/bin/zsh';
|
|
550
|
+
const cwd = process.env.CODEYAM_ROOT_PATH || process.cwd();
|
|
551
|
+
// Verify cwd exists, fall back to HOME
|
|
552
|
+
const safeCwd = fs.existsSync(cwd) ? cwd : process.env.HOME || '/tmp';
|
|
553
|
+
// Spawn PTY with a clean env (no giant JSON blobs from CODEYAM_PROJECT etc.)
|
|
554
|
+
let ptyProcess;
|
|
555
|
+
try {
|
|
556
|
+
ptyProcess = pty.spawn(shell, ['-l'], {
|
|
557
|
+
name: 'xterm-256color',
|
|
558
|
+
cols: 120,
|
|
559
|
+
rows: 30,
|
|
560
|
+
cwd: safeCwd,
|
|
561
|
+
env: buildPtyEnv({ editorMode }),
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
catch (error) {
|
|
565
|
+
console.error('[terminalServer] Failed to spawn PTY:', {
|
|
566
|
+
shell,
|
|
567
|
+
cwd: safeCwd,
|
|
568
|
+
error,
|
|
569
|
+
});
|
|
570
|
+
ws.send(JSON.stringify({
|
|
571
|
+
type: 'output',
|
|
572
|
+
data: `\r\nFailed to start terminal: ${error.message}\r\n`,
|
|
573
|
+
}));
|
|
574
|
+
ws.close();
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
const sessionId = crypto.randomUUID();
|
|
578
|
+
const session = {
|
|
579
|
+
ws,
|
|
580
|
+
ptyProcess,
|
|
581
|
+
sessionId,
|
|
582
|
+
isAlive: true,
|
|
583
|
+
};
|
|
584
|
+
sessions.add(session);
|
|
585
|
+
// Send session ID so client can use it for reconnection
|
|
586
|
+
ws.send(JSON.stringify({ type: 'session-id', sessionId }));
|
|
587
|
+
// Write context file for the appropriate skill (dev-mode or editor)
|
|
588
|
+
const hasContext = editorMode
|
|
589
|
+
? writeEditorModeContext({ projectSlug })
|
|
590
|
+
: writeDevModeContext({
|
|
591
|
+
entityName,
|
|
592
|
+
entityType,
|
|
593
|
+
entitySha,
|
|
594
|
+
entityFilePath,
|
|
595
|
+
scenarioName,
|
|
596
|
+
scenarioDescription,
|
|
597
|
+
analysisId,
|
|
598
|
+
projectSlug,
|
|
599
|
+
});
|
|
600
|
+
let hasClearedScreen = false;
|
|
601
|
+
const filterStartup = shouldFilterStartup({ hasContext, editorMode });
|
|
602
|
+
const startupFilter = filterStartup ? new StartupOutputFilter() : null;
|
|
603
|
+
// Safety timeout: stop suppressing output after 5s even if ╭ never arrives.
|
|
604
|
+
// Prevents "Starting Claude..." hanging forever if the banner format changes.
|
|
605
|
+
if (filterStartup) {
|
|
606
|
+
setTimeout(() => {
|
|
607
|
+
const output = startupFilter.getTimeoutOutput();
|
|
608
|
+
if (output !== null) {
|
|
609
|
+
hasClearedScreen = true;
|
|
610
|
+
console.log('[terminalServer] Suppression timeout — showing output');
|
|
611
|
+
if (ws.readyState === WebSocket.OPEN) {
|
|
612
|
+
// Clear the "Starting Claude..." message
|
|
613
|
+
ws.send(JSON.stringify({ type: 'output', data: '\x1b[2J\x1b[H' }));
|
|
614
|
+
const transformed = transformMarkers(output);
|
|
615
|
+
if (transformed.length > 0) {
|
|
616
|
+
ws.send(JSON.stringify({ type: 'output', data: transformed }));
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}, 5000);
|
|
621
|
+
}
|
|
622
|
+
const idleDetector = new IdleDetector({
|
|
623
|
+
onIdle: () => {
|
|
624
|
+
if (ws.readyState === WebSocket.OPEN) {
|
|
625
|
+
console.log('[terminalServer] Sending claude-idle');
|
|
626
|
+
ws.send(JSON.stringify({ type: 'claude-idle' }));
|
|
627
|
+
}
|
|
628
|
+
},
|
|
629
|
+
onActive: () => {
|
|
630
|
+
if (ws.readyState === WebSocket.OPEN) {
|
|
631
|
+
console.log('[terminalServer] Sending claude-active');
|
|
632
|
+
ws.send(JSON.stringify({ type: 'claude-active' }));
|
|
633
|
+
}
|
|
634
|
+
},
|
|
635
|
+
}, { activeOutputPattern: /[✶✢·◼]/ });
|
|
636
|
+
// PTY output -> WebSocket
|
|
637
|
+
const serverPort = process.env.CODEYAM_PORT || '3111';
|
|
638
|
+
// Stateful transformer that buffers partial {{scenario:...}} markers
|
|
639
|
+
// across PTY chunks so they don't appear as raw text.
|
|
640
|
+
const transformMarkers = createMarkerTransformer(serverPort);
|
|
641
|
+
ptyProcess.onData((data) => {
|
|
642
|
+
if (ws.readyState === WebSocket.OPEN) {
|
|
643
|
+
// During startup, suppress output until Claude's welcome banner (╭)
|
|
644
|
+
// arrives, then clear screen and strip the raw command from the chunk.
|
|
645
|
+
if (startupFilter && !hasClearedScreen) {
|
|
646
|
+
const result = startupFilter.processChunk(data);
|
|
647
|
+
if (result.type === 'clear-and-send') {
|
|
648
|
+
hasClearedScreen = true;
|
|
649
|
+
ws.send(JSON.stringify({ type: 'output', data: '\x1b[2J\x1b[H' }));
|
|
650
|
+
if (result.data.length > 0) {
|
|
651
|
+
const transformed = transformMarkers(result.data);
|
|
652
|
+
if (transformed.length > 0) {
|
|
653
|
+
ws.send(JSON.stringify({ type: 'output', data: transformed }));
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
idleDetector.onPtyOutput(data);
|
|
657
|
+
}
|
|
658
|
+
// type === 'suppress': skip sending and idle detection
|
|
659
|
+
}
|
|
660
|
+
else {
|
|
661
|
+
// Transform {{scenario:Name:ID}} markers into OSC 8 clickable hyperlinks.
|
|
662
|
+
// Uses stateful buffering to handle markers split across PTY chunks.
|
|
663
|
+
const transformed = transformMarkers(data);
|
|
664
|
+
if (transformed.length > 0) {
|
|
665
|
+
ws.send(JSON.stringify({ type: 'output', data: transformed }));
|
|
666
|
+
}
|
|
667
|
+
idleDetector.onPtyOutput(data);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
ptyProcess.onExit(() => {
|
|
672
|
+
console.log('[terminalServer] PTY exited, flushing idle state');
|
|
673
|
+
idleDetector.disposeAndFlush();
|
|
674
|
+
sessions.delete(session);
|
|
675
|
+
// Also clean up from detachedPtys if it was detached
|
|
676
|
+
if (detachedPtys.has(sessionId)) {
|
|
677
|
+
clearTimeout(detachedPtys.get(sessionId).graceTimer);
|
|
678
|
+
detachedPtys.delete(sessionId);
|
|
679
|
+
}
|
|
680
|
+
if (ws.readyState === WebSocket.OPEN) {
|
|
681
|
+
ws.close();
|
|
682
|
+
}
|
|
683
|
+
});
|
|
684
|
+
// WebSocket messages -> PTY
|
|
685
|
+
ws.on('message', (raw) => {
|
|
686
|
+
try {
|
|
687
|
+
const msg = JSON.parse(raw.toString());
|
|
688
|
+
if (msg.type === 'input') {
|
|
689
|
+
idleDetector.onUserInput();
|
|
690
|
+
ptyProcess.write(msg.data);
|
|
691
|
+
}
|
|
692
|
+
else if (msg.type === 'resize' && msg.cols && msg.rows) {
|
|
693
|
+
ptyProcess.resize(msg.cols, msg.rows);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
catch {
|
|
697
|
+
// Non-JSON message, treat as raw input
|
|
698
|
+
ptyProcess.write(raw.toString());
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
ws.on('pong', () => {
|
|
702
|
+
session.isAlive = true;
|
|
703
|
+
});
|
|
704
|
+
ws.on('close', () => {
|
|
705
|
+
detachSession(session, hasContext, hasClearedScreen);
|
|
706
|
+
});
|
|
707
|
+
// Show a loading indicator while Claude Code starts up.
|
|
708
|
+
// PTY output is suppressed until Claude's welcome banner (╭) appears
|
|
709
|
+
// and triggers a screen clear, so the user never sees the raw command.
|
|
710
|
+
if (filterStartup) {
|
|
711
|
+
ws.send(JSON.stringify({
|
|
712
|
+
type: 'output',
|
|
713
|
+
data: '\x1b[2J\x1b[H\r\n\x1b[90m Starting Claude...\x1b[0m\r\n',
|
|
714
|
+
}));
|
|
715
|
+
}
|
|
716
|
+
// Start Claude Code with the appropriate skill.
|
|
717
|
+
// Using a skill avoids shell escaping issues and multi-line paste detection.
|
|
718
|
+
//
|
|
719
|
+
// Session recovery modes (editor only):
|
|
720
|
+
// resume + sessionId → claude --resume <uuid> (resumes exact conversation)
|
|
721
|
+
// resume, no sessionId → claude --continue (fallback for pre-existing sessions)
|
|
722
|
+
// fresh → generate UUID, write to .codeyam/claude-session-id.txt,
|
|
723
|
+
// launch claude --session-id <uuid> '/codeyam-editor'
|
|
724
|
+
//
|
|
725
|
+
// The UUID is generated HERE (not in printStep1) so it's available before
|
|
726
|
+
// Claude launches. printStep1 runs inside the session — too late.
|
|
727
|
+
setTimeout(() => {
|
|
728
|
+
if (editorMode && hasContext) {
|
|
729
|
+
if (claudeStartMode === 'resume' && claudeSessionId) {
|
|
730
|
+
const resumePrompt = editorStepLabel === 'Present'
|
|
731
|
+
? 'The session was interrupted. Please rerun show-results.'
|
|
732
|
+
: 'The session was interrupted. Please continue where you left off.';
|
|
733
|
+
ptyProcess.write(`claude --resume '${claudeSessionId}' '${resumePrompt}'\r`);
|
|
734
|
+
}
|
|
735
|
+
else if (claudeStartMode === 'resume') {
|
|
736
|
+
// No session ID available — fall back to most recent session
|
|
737
|
+
const resumePrompt = editorStepLabel === 'Present'
|
|
738
|
+
? 'The session was interrupted. Please rerun show-results.'
|
|
739
|
+
: 'The session was interrupted. Please continue where you left off.';
|
|
740
|
+
ptyProcess.write(`claude --continue '${resumePrompt}'\r`);
|
|
741
|
+
}
|
|
742
|
+
else {
|
|
743
|
+
// Fresh session: generate a trackable UUID
|
|
744
|
+
const newSessionId = crypto.randomUUID();
|
|
745
|
+
const sessionIdPath = path.join(cwd, '.codeyam', 'claude-session-id.txt');
|
|
746
|
+
try {
|
|
747
|
+
fs.mkdirSync(path.dirname(sessionIdPath), { recursive: true });
|
|
748
|
+
fs.writeFileSync(sessionIdPath, newSessionId, 'utf8');
|
|
749
|
+
}
|
|
750
|
+
catch (err) {
|
|
751
|
+
console.error('[terminalServer] Failed to write claude-session-id.txt:', err);
|
|
752
|
+
}
|
|
753
|
+
ptyProcess.write(`claude --session-id '${newSessionId}' '/codeyam-editor'\r`);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
else if (hasContext) {
|
|
757
|
+
ptyProcess.write("claude '/codeyam-dev-mode'\r");
|
|
758
|
+
}
|
|
759
|
+
else {
|
|
760
|
+
ptyProcess.write('claude\r');
|
|
761
|
+
}
|
|
762
|
+
}, 500);
|
|
763
|
+
});
|
|
764
|
+
console.log('[terminalServer] WebSocket terminal server attached at /ws/terminal');
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* Detach a session's PTY instead of killing it, giving the client time to reconnect.
|
|
768
|
+
* The PTY is moved to `detachedPtys` with a grace timer; if the client reconnects
|
|
769
|
+
* within DETACH_GRACE_MS, the PTY is reattached. Otherwise it's killed.
|
|
770
|
+
*/
|
|
771
|
+
function detachSession(session, hasContext = false, hasClearedScreen = false) {
|
|
772
|
+
sessions.delete(session);
|
|
773
|
+
const { sessionId, ptyProcess } = session;
|
|
774
|
+
// If already detached (shouldn't happen), skip
|
|
775
|
+
if (detachedPtys.has(sessionId))
|
|
776
|
+
return;
|
|
777
|
+
let outputBuffer = '';
|
|
778
|
+
// Buffer PTY output during detachment so the client can catch up on reconnect
|
|
779
|
+
ptyProcess.onData((data) => {
|
|
780
|
+
outputBuffer += data;
|
|
781
|
+
// Cap buffer size
|
|
782
|
+
if (outputBuffer.length > OUTPUT_BUFFER_MAX) {
|
|
783
|
+
outputBuffer = outputBuffer.slice(-OUTPUT_BUFFER_MAX);
|
|
784
|
+
}
|
|
785
|
+
});
|
|
786
|
+
const graceTimer = setTimeout(() => {
|
|
787
|
+
console.log(`[terminalServer] Grace period expired for session ${sessionId}, killing PTY`);
|
|
788
|
+
detachedPtys.delete(sessionId);
|
|
789
|
+
try {
|
|
790
|
+
ptyProcess.kill();
|
|
791
|
+
}
|
|
792
|
+
catch {
|
|
793
|
+
/* already dead */
|
|
794
|
+
}
|
|
795
|
+
}, DETACH_GRACE_MS);
|
|
796
|
+
detachedPtys.set(sessionId, {
|
|
797
|
+
ptyProcess,
|
|
798
|
+
sessionId,
|
|
799
|
+
graceTimer,
|
|
800
|
+
outputBuffer,
|
|
801
|
+
hasContext,
|
|
802
|
+
hasClearedScreen,
|
|
803
|
+
});
|
|
804
|
+
console.log(`[terminalServer] Session ${sessionId} detached, PTY kept alive for ${DETACH_GRACE_MS / 1000}s`);
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Send a refresh-preview message to all connected terminal WebSocket clients.
|
|
808
|
+
* The Terminal component relays this to the parent page to reload the iframe.
|
|
809
|
+
*/
|
|
810
|
+
export function broadcastPreviewRefresh(path, scenarioId) {
|
|
811
|
+
const msg = JSON.stringify({
|
|
812
|
+
type: 'refresh-preview',
|
|
813
|
+
...(path && { path }),
|
|
814
|
+
...(scenarioId && { scenarioId }),
|
|
815
|
+
});
|
|
816
|
+
let count = 0;
|
|
817
|
+
for (const session of sessions) {
|
|
818
|
+
try {
|
|
819
|
+
if (session.ws.readyState === WebSocket.OPEN) {
|
|
820
|
+
session.ws.send(msg);
|
|
821
|
+
count++;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
catch {
|
|
825
|
+
// Ignore send errors
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
return count;
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Notify all connected terminal WebSocket clients that a data mutation
|
|
832
|
+
* was forwarded to the real dev server (seed-based scenario).
|
|
833
|
+
* The Terminal component relays this to editor.tsx to show a save banner.
|
|
834
|
+
*/
|
|
835
|
+
export function broadcastDataMutationForwarded(method, pathname) {
|
|
836
|
+
const msg = JSON.stringify({
|
|
837
|
+
type: 'data-mutation-forwarded',
|
|
838
|
+
method,
|
|
839
|
+
pathname,
|
|
840
|
+
});
|
|
841
|
+
let count = 0;
|
|
842
|
+
for (const session of sessions) {
|
|
843
|
+
try {
|
|
844
|
+
if (session.ws.readyState === WebSocket.OPEN) {
|
|
845
|
+
session.ws.send(msg);
|
|
846
|
+
count++;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
catch {
|
|
850
|
+
// Ignore send errors
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
return count;
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* Show the results panel below the terminal in the Build tab.
|
|
857
|
+
* Triggered by Claude at end of step 12.
|
|
858
|
+
*/
|
|
859
|
+
export function broadcastShowResults() {
|
|
860
|
+
const msg = JSON.stringify({ type: 'show-results' });
|
|
861
|
+
let count = 0;
|
|
862
|
+
for (const session of sessions) {
|
|
863
|
+
try {
|
|
864
|
+
if (session.ws.readyState === WebSocket.OPEN) {
|
|
865
|
+
session.ws.send(msg);
|
|
866
|
+
count++;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
catch {
|
|
870
|
+
// Ignore send errors
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
return count;
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Hide the results panel (e.g. after Save & Commit).
|
|
877
|
+
*/
|
|
878
|
+
export function broadcastHideResults() {
|
|
879
|
+
const msg = JSON.stringify({ type: 'hide-results' });
|
|
880
|
+
let count = 0;
|
|
881
|
+
for (const session of sessions) {
|
|
882
|
+
try {
|
|
883
|
+
if (session.ws.readyState === WebSocket.OPEN) {
|
|
884
|
+
session.ws.send(msg);
|
|
885
|
+
count++;
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
catch {
|
|
889
|
+
// Ignore send errors
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
return count;
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Send a set-viewport message to all connected terminal WebSocket clients.
|
|
896
|
+
* The Terminal component relays this to the parent page to update the preview viewport.
|
|
897
|
+
*/
|
|
898
|
+
export function broadcastSetViewport(viewport) {
|
|
899
|
+
const msg = JSON.stringify({ type: 'set-viewport', ...viewport });
|
|
900
|
+
let count = 0;
|
|
901
|
+
for (const session of sessions) {
|
|
902
|
+
try {
|
|
903
|
+
if (session.ws.readyState === WebSocket.OPEN) {
|
|
904
|
+
session.ws.send(msg);
|
|
905
|
+
count++;
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
catch {
|
|
909
|
+
// Ignore send errors
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
return count;
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* Kill all active PTY sessions and detached PTYs. Call during shutdown.
|
|
916
|
+
*/
|
|
917
|
+
export function cleanupAllTerminalSessions() {
|
|
918
|
+
// Clear ping interval
|
|
919
|
+
if (pingInterval) {
|
|
920
|
+
clearInterval(pingInterval);
|
|
921
|
+
pingInterval = null;
|
|
922
|
+
globalThis.__codeyamPingInterval = null;
|
|
923
|
+
}
|
|
924
|
+
// Clean up active sessions
|
|
925
|
+
for (const session of Array.from(sessions)) {
|
|
926
|
+
try {
|
|
927
|
+
session.ptyProcess.kill();
|
|
928
|
+
}
|
|
929
|
+
catch {
|
|
930
|
+
// Already dead
|
|
931
|
+
}
|
|
932
|
+
try {
|
|
933
|
+
session.ws.close();
|
|
934
|
+
}
|
|
935
|
+
catch {
|
|
936
|
+
// Already closed
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
sessions.clear();
|
|
940
|
+
// Clean up detached PTYs
|
|
941
|
+
for (const [, detached] of detachedPtys) {
|
|
942
|
+
clearTimeout(detached.graceTimer);
|
|
943
|
+
try {
|
|
944
|
+
detached.ptyProcess.kill();
|
|
945
|
+
}
|
|
946
|
+
catch {
|
|
947
|
+
// Already dead
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
detachedPtys.clear();
|
|
951
|
+
}
|
|
952
|
+
//# sourceMappingURL=terminalServer.js.map
|