@codeyam/codeyam-cli 0.1.0-staging.dbc742d → 0.1.0-staging.df25827
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analyzer-template/.build-info.json +8 -8
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +6 -6
- package/analyzer-template/packages/ai/package.json +1 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +135 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/nodeToSource.ts +19 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/paths.ts +11 -4
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +36 -9
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.ts +10 -3
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +16 -6
- package/analyzer-template/packages/analyze/index.ts +4 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +28 -2
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +5 -36
- package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +10 -6
- package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +9 -12
- package/analyzer-template/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.ts +21 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +82 -10
- package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +4 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +4 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyzeNextRoute.ts +8 -3
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +239 -58
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +1684 -1462
- package/analyzer-template/packages/aws/package.json +7 -7
- package/analyzer-template/packages/database/package.json +3 -3
- package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +77 -6
- package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +25 -15
- package/analyzer-template/packages/database/src/lib/loadEntity.ts +19 -8
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +5 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +79 -6
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +7 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts +4 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js +5 -5
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts +3 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +22 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +27 -0
- package/analyzer-template/project/analyzeFileEntities.ts +26 -0
- package/analyzer-template/project/runMultiScenarioServer.ts +26 -3
- package/background/src/lib/virtualized/project/analyzeFileEntities.js +22 -0
- package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
- package/background/src/lib/virtualized/project/runMultiScenarioServer.js +23 -3
- package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
- package/codeyam-cli/src/cli.js +24 -0
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/commands/__tests__/editor.analyzeImportsArgs.test.js +47 -0
- package/codeyam-cli/src/commands/__tests__/editor.analyzeImportsArgs.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.auditNoAutoAnalysis.test.js +71 -0
- package/codeyam-cli/src/commands/__tests__/editor.auditNoAutoAnalysis.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.designSystem.test.js +30 -0
- package/codeyam-cli/src/commands/__tests__/editor.designSystem.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js +51 -0
- package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.statePersistence.test.js +55 -0
- package/codeyam-cli/src/commands/__tests__/editor.statePersistence.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js +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 +39 -3
- package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js.map +1 -1
- package/codeyam-cli/src/commands/editor.js +3819 -624
- package/codeyam-cli/src/commands/editor.js.map +1 -1
- package/codeyam-cli/src/commands/editorAnalyzeImportsArgs.js +23 -0
- package/codeyam-cli/src/commands/editorAnalyzeImportsArgs.js.map +1 -0
- package/codeyam-cli/src/commands/editorIsolateArgs.js +25 -0
- package/codeyam-cli/src/commands/editorIsolateArgs.js.map +1 -0
- package/codeyam-cli/src/commands/init.js +22 -0
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/commands/telemetry.js +37 -0
- package/codeyam-cli/src/commands/telemetry.js.map +1 -0
- package/codeyam-cli/src/data/designSystems.js +27 -0
- package/codeyam-cli/src/data/designSystems.js.map +1 -0
- package/codeyam-cli/src/data/techStacks.js +1 -1
- package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js +173 -0
- package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/devServerState.test.js +93 -1
- package/codeyam-cli/src/utils/__tests__/devServerState.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorApi.test.js +62 -8
- package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +3526 -1
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js +76 -0
- package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorCaptureScenarioSeeding.test.js +137 -0
- package/codeyam-cli/src/utils/__tests__/editorCaptureScenarioSeeding.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js +100 -0
- package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +76 -3
- package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js +381 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorGuardMiddleware.test.js +67 -0
- package/codeyam-cli/src/utils/__tests__/editorGuardMiddleware.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +75 -1
- package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorMigration.test.js +435 -0
- package/codeyam-cli/src/utils/__tests__/editorMigration.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +73 -1
- package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +98 -1
- package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorRoadmap.test.js +1108 -0
- package/codeyam-cli/src/utils/__tests__/editorRoadmap.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +190 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +936 -9
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +201 -1
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js +143 -0
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js +66 -0
- package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js +53 -0
- package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +390 -11
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/envFile.test.js +125 -0
- package/codeyam-cli/src/utils/__tests__/envFile.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js +177 -0
- package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/handoffContext.test.js +500 -0
- package/codeyam-cli/src/utils/__tests__/handoffContext.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +16 -1
- package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/manualEntityAnalysis.test.js +302 -0
- package/codeyam-cli/src/utils/__tests__/manualEntityAnalysis.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js +30 -2
- package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/registerScenarioResult.test.js +127 -0
- package/codeyam-cli/src/utils/__tests__/registerScenarioResult.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js +118 -0
- package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js +57 -0
- package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +373 -1
- package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/screenshotHash.test.js +84 -0
- package/codeyam-cli/src/utils/__tests__/screenshotHash.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +1 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/telemetry.test.js +159 -0
- package/codeyam-cli/src/utils/__tests__/telemetry.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/testRunner.test.js +216 -0
- package/codeyam-cli/src/utils/__tests__/testRunner.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/webappDetection.test.js +6 -0
- package/codeyam-cli/src/utils/__tests__/webappDetection.test.js.map +1 -1
- package/codeyam-cli/src/utils/analysisRunner.js +39 -8
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/analyzer.js +11 -1
- package/codeyam-cli/src/utils/analyzer.js.map +1 -1
- package/codeyam-cli/src/utils/analyzerFinalization.js +100 -0
- package/codeyam-cli/src/utils/analyzerFinalization.js.map +1 -0
- package/codeyam-cli/src/utils/backgroundServer.js +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/designSystemShowcase.js +810 -0
- package/codeyam-cli/src/utils/designSystemShowcase.js.map +1 -0
- package/codeyam-cli/src/utils/devServerState.js +32 -0
- package/codeyam-cli/src/utils/devServerState.js.map +1 -1
- package/codeyam-cli/src/utils/editorApi.js +27 -5
- package/codeyam-cli/src/utils/editorApi.js.map +1 -1
- package/codeyam-cli/src/utils/editorAudit.js +700 -10
- package/codeyam-cli/src/utils/editorAudit.js.map +1 -1
- package/codeyam-cli/src/utils/editorBroadcastViewport.js +26 -0
- package/codeyam-cli/src/utils/editorBroadcastViewport.js.map +1 -0
- package/codeyam-cli/src/utils/editorDeleteScenario.js +67 -0
- package/codeyam-cli/src/utils/editorDeleteScenario.js.map +1 -0
- package/codeyam-cli/src/utils/editorEntityChangeStatus.js +13 -7
- package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -1
- package/codeyam-cli/src/utils/editorEntityHelpers.js +144 -0
- package/codeyam-cli/src/utils/editorEntityHelpers.js.map +1 -0
- package/codeyam-cli/src/utils/editorGuard.js +36 -0
- package/codeyam-cli/src/utils/editorGuard.js.map +1 -0
- package/codeyam-cli/src/utils/editorLoaderHelpers.js +40 -1
- package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -1
- package/codeyam-cli/src/utils/editorMigration.js +224 -0
- package/codeyam-cli/src/utils/editorMigration.js.map +1 -0
- package/codeyam-cli/src/utils/editorPreview.js +33 -0
- package/codeyam-cli/src/utils/editorPreview.js.map +1 -1
- package/codeyam-cli/src/utils/editorRecapture.js +109 -0
- package/codeyam-cli/src/utils/editorRecapture.js.map +1 -0
- package/codeyam-cli/src/utils/editorRoadmap.js +574 -0
- package/codeyam-cli/src/utils/editorRoadmap.js.map +1 -0
- package/codeyam-cli/src/utils/editorScenarioSwitch.js +39 -2
- package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -1
- package/codeyam-cli/src/utils/editorScenarios.js +375 -16
- package/codeyam-cli/src/utils/editorScenarios.js.map +1 -1
- package/codeyam-cli/src/utils/editorSeedAdapter.js +308 -6
- package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -1
- package/codeyam-cli/src/utils/editorShouldRevalidate.js +21 -0
- package/codeyam-cli/src/utils/editorShouldRevalidate.js.map +1 -0
- package/codeyam-cli/src/utils/entityChangeStatus.js +50 -5
- package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -1
- package/codeyam-cli/src/utils/entityChangeStatus.server.js +72 -3
- package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -1
- package/codeyam-cli/src/utils/envFile.js +90 -0
- package/codeyam-cli/src/utils/envFile.js.map +1 -0
- package/codeyam-cli/src/utils/fileWatcher.js +38 -0
- package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
- package/codeyam-cli/src/utils/glossaryAdd.js +74 -0
- package/codeyam-cli/src/utils/glossaryAdd.js.map +1 -0
- package/codeyam-cli/src/utils/handoffContext.js +257 -0
- package/codeyam-cli/src/utils/handoffContext.js.map +1 -0
- package/codeyam-cli/src/utils/install-skills.js +50 -6
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/manualEntityAnalysis.js +196 -0
- package/codeyam-cli/src/utils/manualEntityAnalysis.js.map +1 -0
- package/codeyam-cli/src/utils/parseRegisterArg.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/queue/__tests__/job.interactiveStart.test.js +159 -0
- package/codeyam-cli/src/utils/queue/__tests__/job.interactiveStart.test.js.map +1 -0
- package/codeyam-cli/src/utils/queue/job.js +35 -6
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/registerScenarioResult.js +52 -0
- package/codeyam-cli/src/utils/registerScenarioResult.js.map +1 -0
- package/codeyam-cli/src/utils/routePatternMatching.js +129 -0
- package/codeyam-cli/src/utils/routePatternMatching.js.map +1 -0
- package/codeyam-cli/src/utils/scenarioCoverage.js +12 -10
- package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -1
- package/codeyam-cli/src/utils/scenariosManifest.js +154 -0
- package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -1
- package/codeyam-cli/src/utils/screenshotHash.js +26 -0
- package/codeyam-cli/src/utils/screenshotHash.js.map +1 -0
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +1 -0
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/utils/simulationGateMiddleware.js +9 -0
- package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -1
- package/codeyam-cli/src/utils/techStackConfig.js +38 -0
- package/codeyam-cli/src/utils/techStackConfig.js.map +1 -0
- package/codeyam-cli/src/utils/techStackConfig.test.js +85 -0
- package/codeyam-cli/src/utils/techStackConfig.test.js.map +1 -0
- package/codeyam-cli/src/utils/telemetry.js +106 -0
- package/codeyam-cli/src/utils/telemetry.js.map +1 -0
- package/codeyam-cli/src/utils/telemetryMiddleware.js +22 -0
- package/codeyam-cli/src/utils/telemetryMiddleware.js.map +1 -0
- package/codeyam-cli/src/utils/testResultCache.js +53 -0
- package/codeyam-cli/src/utils/testResultCache.js.map +1 -0
- package/codeyam-cli/src/utils/testResultCache.server.js +81 -0
- package/codeyam-cli/src/utils/testResultCache.server.js.map +1 -0
- package/codeyam-cli/src/utils/testResultCache.server.test.js +187 -0
- package/codeyam-cli/src/utils/testResultCache.server.test.js.map +1 -0
- package/codeyam-cli/src/utils/testResultCache.test.js +230 -0
- package/codeyam-cli/src/utils/testResultCache.test.js.map +1 -0
- package/codeyam-cli/src/utils/testRunner.js +193 -1
- package/codeyam-cli/src/utils/testRunner.js.map +1 -1
- package/codeyam-cli/src/utils/webappDetection.js +4 -2
- package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
- package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js +99 -0
- package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js +153 -0
- package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js +68 -1
- package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js.map +1 -1
- package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +454 -4
- package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -1
- 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 +22 -1
- package/codeyam-cli/src/webserver/app/lib/clientErrors.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/git.js +3 -2
- package/codeyam-cli/src/webserver/app/lib/git.js.map +1 -1
- package/codeyam-cli/src/webserver/app/routes/api.interactive-switch-scenario.js +34 -0
- package/codeyam-cli/src/webserver/app/routes/api.interactive-switch-scenario.js.map +1 -0
- package/codeyam-cli/src/webserver/app/types/editor.js +8 -0
- package/codeyam-cli/src/webserver/app/types/editor.js.map +1 -0
- package/codeyam-cli/src/webserver/backgroundServer.js +60 -61
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-DTBZZfSk.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-BcgbViKV.js → EntityItem-BxclONWq.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-CQgyEGV-.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-CQIG2qda.js → EntityTypeIcon-BsnEOJZ_.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-ByaELMbv.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-6WjVfhxX.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-ChX-Hp7W.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-BU_OAEMP.js → LoadingDots-By5zI316.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-ceAyBX-H.js → LogViewer-C-9zQdXg.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/MiniClaudeChat-Bs2_Oua4.js +36 -0
- package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-BzHcG7SE.js → ReportIssueModal-DQsceHVv.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-DThcm_9M.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-0DY_NKil.js → ScenarioViewer-Cl4oOA3A.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/Spinner-CIil5-gb.js +34 -0
- package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-CK7-NaPZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-BqkA9zyZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{_index-DLxKhri3.js → _index-DnOgyseQ.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BcY3q6nt.js → activity.(_tab)-DqM9hbNE.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/{addon-web-links-Duc5hnl7.js → addon-web-links-C58dYPwR.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-Bni3iiUj.js → agent-transcripts-B8NCeOrm.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-database-verify-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-github-verify-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-handoff-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-hosting-verify-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-recapture-stale-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-rename-scenario-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-roadmap-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-scenario-data-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-seed-state-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-prompt-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-schema-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-session-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-verify-routes-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.interactive-switch-scenario-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{book-open-BYOypzCa.js → book-open-BFSIqZgO.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-C_Pmso5S.js → chevron-down-B9fDzFVh.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-UVKPFVEO-Bmq2apuh.js +43 -0
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BVMi9VA5.js → circle-check-DLPObLUx.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{copy-n2FB0_Sw.js → copy-DXEmO0TD.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-CC6AbExI.js → createLucideIcon-BwyFiRot.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-Coe5NhbS.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-CCKUIm0S.svg → cy-logo-cli-DoA97ML3.svg} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-iRhRIFlp.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/editor._tab-BZPBzV73.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-DhtVC4aI.js +161 -0
- package/codeyam-cli/src/webserver/build/client/assets/editorPreview-C6fEYHrh.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-BF4oLwaE.js → entity._sha._-pc-vc6wO.js} +13 -12
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-C8AyYgYT.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DziaVQX1.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-BTcpgIpC.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BMvVHNXU.js → entity._sha_.edit._scenarioId-D_O_ajfZ.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DTvKq3TY.js → entry.client-j1Vi0bco.js} +6 -6
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-Daa96Fr1.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-kuny2Q_s.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-DgCZPMie.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-L-aUIeux.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-BcvgDzbZ.js → index-BliGSSpl.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-yHOVb4rc.js → index-SqjQKTdH.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-10oVnAAH.js → index-vyrZD2g4.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/jsx-runtime-D_zvdyIk.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/labs-c3yLxSEp.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-DaAZ_H2w.js → loader-circle-D-q28GLF.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-b0d69c06.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{memory-9gnxSZlb.js → memory-CEWIUC4t.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{pause-f5-1lKBt.js → pause-BP6fitdh.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-CLedrjXQ.js +80 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-Di64LWVb.js → search-BooqacKS.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-BM0nbryO.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-ovy6FjRY.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{terminal-Br7MOqts.js → terminal-DHemCJIs.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BLdiCuG-.js → triangle-alert-D87ekDl8.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-Dk0Tciqg.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C8QvIe05.js +2 -0
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-jkCytuYz.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/useToast-BgqkixU9.js +1 -0
- package/codeyam-cli/src/webserver/build/client/sound-test.html +98 -0
- package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-DPUEhrWo.js +16 -0
- package/codeyam-cli/src/webserver/build/server/assets/{index-BWoRb5RY.js → index-oF2amaGI.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/init-C42BvUGp.js +14 -0
- package/codeyam-cli/src/webserver/build/server/assets/progress-CHTtrxFG.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-DiCdDL5d.js +853 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/src/webserver/editorProxy.js +443 -35
- package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
- 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/journalCapture.ts +53 -0
- package/codeyam-cli/src/webserver/server.js +192 -4
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/src/webserver/terminalServer.js +369 -52
- package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
- package/codeyam-cli/templates/__tests__/editor-step-hook.prompt-capture.test.ts +118 -0
- package/codeyam-cli/templates/codeyam-editor-claude.md +3 -1
- package/codeyam-cli/templates/codeyam-editor-codex.md +61 -0
- package/codeyam-cli/templates/codeyam-editor-gemini.md +59 -0
- package/codeyam-cli/templates/codeyam-editor-reference.md +216 -0
- package/codeyam-cli/templates/design-systems/clean-dashboard-design-system.md +255 -0
- package/codeyam-cli/templates/design-systems/editorial-design-system.md +267 -0
- package/codeyam-cli/templates/design-systems/mono-brutalist-design-system.md +256 -0
- package/codeyam-cli/templates/design-systems/neo-brutalist-design-system.md +294 -0
- package/codeyam-cli/templates/editor-step-hook.py +193 -56
- package/codeyam-cli/templates/expo-react-native/MOBILE_SETUP.md +204 -5
- package/codeyam-cli/templates/expo-react-native/__tests__/.gitkeep +0 -0
- package/codeyam-cli/templates/expo-react-native/app/_layout.tsx +6 -3
- package/codeyam-cli/templates/expo-react-native/app/index.tsx +36 -0
- package/codeyam-cli/templates/expo-react-native/app.json +11 -0
- package/codeyam-cli/templates/expo-react-native/babel.config.js +1 -0
- package/codeyam-cli/templates/expo-react-native/gitignore +2 -0
- package/codeyam-cli/templates/expo-react-native/global.css +7 -0
- package/codeyam-cli/templates/expo-react-native/lib/theme.ts +73 -0
- package/codeyam-cli/templates/expo-react-native/package.json +32 -16
- package/codeyam-cli/templates/expo-react-native/patches/expo-modules-autolinking+3.0.24.patch +29 -0
- package/codeyam-cli/templates/isolation-route/expo-router.tsx.template +54 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +1 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +1 -1
- package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +88 -40
- package/codeyam-cli/templates/nextjs-prisma-supabase/package.json +1 -1
- package/codeyam-cli/templates/seed-adapters/supabase.ts +475 -0
- package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +106 -10
- package/package.json +2 -1
- package/packages/ai/src/lib/astScopes/methodSemantics.js +99 -0
- package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
- package/packages/ai/src/lib/astScopes/nodeToSource.js +16 -0
- package/packages/ai/src/lib/astScopes/nodeToSource.js.map +1 -1
- package/packages/ai/src/lib/astScopes/paths.js +12 -3
- package/packages/ai/src/lib/astScopes/paths.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +27 -10
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.js +9 -2
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +14 -4
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/analyze/index.js +1 -1
- package/packages/analyze/index.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +16 -2
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +6 -26
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +3 -2
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +9 -7
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js +14 -0
- package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +44 -11
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeChange.js +1 -0
- package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeInitial.js +1 -0
- package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeNextRoute.js +5 -1
- package/packages/analyze/src/lib/files/analyzeNextRoute.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +120 -28
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +1368 -1193
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +79 -6
- package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
- package/packages/database/src/lib/loadAnalysis.js +7 -1
- package/packages/database/src/lib/loadAnalysis.js.map +1 -1
- package/packages/database/src/lib/loadEntity.js +5 -5
- package/packages/database/src/lib/loadEntity.js.map +1 -1
- package/packages/utils/src/lib/fs/rsyncCopy.js +22 -1
- package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-BPXZwM4t.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-g3saevPb.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-DYFW3lDD.js +0 -25
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DLeucoVX.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BED4B6sP.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +0 -34
- package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-C8OKAR5x.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-oAf2Kqsf.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-C4pqxYJB.js +0 -51
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Csi0_PMl.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/editor-BBAGP_mE.js +0 -10
- package/codeyam-cli/src/webserver/build/client/assets/editorPreview-BLQMSKZa.js +0 -41
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-C7YX6r3H.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CF164ouH.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-cPo8LiG3.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-BZrlFE1F.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-DdZcvjGh.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-COUSHTyZ.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-9c70d1f3.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-CHOdrM6Y.js +0 -67
- package/codeyam-cli/src/webserver/build/client/assets/settings-0OrEMU6J.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-DWT-CvLy.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-CrAK28Bc.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C14nCb1q.js +0 -2
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-O-jkvSPx.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useToast-9FIWuYfK.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/init-DbChSUQP.js +0 -10
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BtbLQkKd.js +0 -433
- package/codeyam-cli/templates/expo-react-native/app/(tabs)/_layout.tsx +0 -33
- package/codeyam-cli/templates/expo-react-native/app/(tabs)/index.tsx +0 -12
- package/codeyam-cli/templates/expo-react-native/app/(tabs)/settings.tsx +0 -12
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CodeYam Seed Adapter for Supabase.
|
|
3
|
+
*
|
|
4
|
+
* Seeds the database and optionally signs in a user for authenticated scenarios.
|
|
5
|
+
*
|
|
6
|
+
* Usage: npx tsx .codeyam/seed-adapter.ts <path-to-seed-data.json>
|
|
7
|
+
*
|
|
8
|
+
* Input JSON format:
|
|
9
|
+
* {
|
|
10
|
+
* "tableName": [{ "column": "value", ... }, ...],
|
|
11
|
+
* "_auth": { // optional
|
|
12
|
+
* "email": "alice@example.com",
|
|
13
|
+
* "password": "test123" // optional — default used if omitted
|
|
14
|
+
* }
|
|
15
|
+
* }
|
|
16
|
+
*
|
|
17
|
+
* When _auth is present, the adapter:
|
|
18
|
+
* 1. Creates the user if they don't exist (auto-confirms email)
|
|
19
|
+
* 2. Builds a synthetic JWT with far-future expiry (no real sign-in needed)
|
|
20
|
+
* 3. Writes session cookies + auth mocks to .codeyam/tmp/seed-session.json
|
|
21
|
+
* so the CodeYam proxy can inject them into the browser
|
|
22
|
+
*
|
|
23
|
+
* The password field is optional — if omitted, a default dev password is used.
|
|
24
|
+
* No real JWTs are stored; the preload module intercepts all auth API calls.
|
|
25
|
+
*
|
|
26
|
+
* Data operations use direct PostgreSQL (pg) for speed — TRUNCATE CASCADE
|
|
27
|
+
* and batched INSERT are ~2x faster than individual PostgREST HTTP calls.
|
|
28
|
+
*
|
|
29
|
+
* Requirements:
|
|
30
|
+
* - DATABASE_URL env var with a PostgreSQL connection string (session pooler recommended)
|
|
31
|
+
* - A Supabase project URL (https://<ref>.supabase.co) in any env var
|
|
32
|
+
* - A secret key (sb_secret_... or legacy eyJ... service_role JWT) in any env var
|
|
33
|
+
*
|
|
34
|
+
* The adapter scans ALL env vars by value pattern for Supabase URL and secret key —
|
|
35
|
+
* no specific naming required. DATABASE_URL must be set explicitly.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
import { createClient } from '@supabase/supabase-js';
|
|
39
|
+
import { Prisma } from '@prisma/client';
|
|
40
|
+
import pg from 'pg';
|
|
41
|
+
import * as fs from 'fs';
|
|
42
|
+
import * as path from 'path';
|
|
43
|
+
|
|
44
|
+
const { Client } = pg;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Scan all env vars for values matching a pattern.
|
|
48
|
+
* Returns ALL unique matches (not just the first) so callers can disambiguate.
|
|
49
|
+
*/
|
|
50
|
+
function findAllEnvByPattern(pattern: RegExp): string[] {
|
|
51
|
+
const matches = new Set<string>();
|
|
52
|
+
for (const value of Object.values(process.env)) {
|
|
53
|
+
if (value && pattern.test(value)) matches.add(value);
|
|
54
|
+
}
|
|
55
|
+
return [...matches];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* For legacy Supabase JWTs, decode the payload to check the `role` claim.
|
|
60
|
+
* Returns the role string ("service_role", "anon", etc.) or undefined.
|
|
61
|
+
*/
|
|
62
|
+
function getJwtRole(jwt: string): string | undefined {
|
|
63
|
+
try {
|
|
64
|
+
const payload = jwt.split('.')[1];
|
|
65
|
+
const decoded = JSON.parse(Buffer.from(payload, 'base64url').toString());
|
|
66
|
+
return decoded.role;
|
|
67
|
+
} catch {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Detect Supabase credentials by value pattern, not env var name.
|
|
73
|
+
// This works regardless of what the user named their env vars.
|
|
74
|
+
const supabaseUrl = findAllEnvByPattern(
|
|
75
|
+
/^https:\/\/[a-z0-9]+\.supabase\.co\b/,
|
|
76
|
+
)[0];
|
|
77
|
+
|
|
78
|
+
// New-format keys are unambiguous by prefix
|
|
79
|
+
const newSecretKey = findAllEnvByPattern(/^sb_secret_/)[0];
|
|
80
|
+
|
|
81
|
+
// Legacy JWT keys — disambiguate by decoding the role claim
|
|
82
|
+
const legacyJwts = findAllEnvByPattern(
|
|
83
|
+
/^eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/,
|
|
84
|
+
);
|
|
85
|
+
const legacyServiceRole = legacyJwts.find(
|
|
86
|
+
(jwt) => getJwtRole(jwt) === 'service_role',
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const secretKey = newSecretKey || legacyServiceRole;
|
|
90
|
+
|
|
91
|
+
if (!supabaseUrl || !secretKey) {
|
|
92
|
+
console.error(
|
|
93
|
+
'Could not find Supabase credentials in environment variables.',
|
|
94
|
+
);
|
|
95
|
+
console.error(
|
|
96
|
+
'Looking for: a URL matching https://<ref>.supabase.co and a key starting with sb_secret_ (or a service_role JWT)',
|
|
97
|
+
);
|
|
98
|
+
console.error(
|
|
99
|
+
'Add them to .env.local — the seed adapter scans all env vars by value pattern.',
|
|
100
|
+
);
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// DATABASE_URL for direct PostgreSQL access (session pooler recommended for speed)
|
|
105
|
+
const databaseUrl = process.env.DATABASE_URL;
|
|
106
|
+
if (!databaseUrl || !databaseUrl.startsWith('postgresql://')) {
|
|
107
|
+
console.error('DATABASE_URL must be set to a PostgreSQL connection string.');
|
|
108
|
+
console.error(
|
|
109
|
+
'Use the session pooler connection string (port 5432) from your Supabase dashboard.',
|
|
110
|
+
);
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Admin client for user management only (uses secret key to bypass RLS)
|
|
115
|
+
const supabase = createClient(supabaseUrl, secretKey, {
|
|
116
|
+
auth: { autoRefreshToken: false, persistSession: false },
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// Derive the project ref from the URL for cookie naming
|
|
120
|
+
// e.g. "https://abcdefgh.supabase.co" → "abcdefgh"
|
|
121
|
+
function getProjectRef(): string {
|
|
122
|
+
try {
|
|
123
|
+
const hostname = new URL(supabaseUrl!).hostname;
|
|
124
|
+
return hostname.split('.')[0];
|
|
125
|
+
} catch {
|
|
126
|
+
return 'unknown';
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Build a mapping from lowercased seed-data keys to actual PostgreSQL table names.
|
|
132
|
+
* Prisma creates tables with the model name (PascalCase) unless @@map is used.
|
|
133
|
+
* PostgreSQL requires the exact table name, so we need this translation.
|
|
134
|
+
*/
|
|
135
|
+
function buildTableNameMap(): Record<string, string> {
|
|
136
|
+
const map: Record<string, string> = {};
|
|
137
|
+
for (const model of Prisma.dmmf.datamodel.models) {
|
|
138
|
+
// dbName is set when @@map is used, otherwise null → use model name
|
|
139
|
+
const dbName = (model as any).dbName || model.name;
|
|
140
|
+
// Map lowercased model name → actual table name
|
|
141
|
+
const lowered = model.name.charAt(0).toLowerCase() + model.name.slice(1);
|
|
142
|
+
map[lowered] = dbName;
|
|
143
|
+
map[model.name] = dbName; // Also map PascalCase for safety
|
|
144
|
+
}
|
|
145
|
+
return map;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Build column name mapping from Prisma field names to database column names.
|
|
150
|
+
* Prisma uses camelCase field names but generates snake_case columns unless @map is used.
|
|
151
|
+
*/
|
|
152
|
+
function buildColumnMap(tableName: string): Record<string, string> {
|
|
153
|
+
const map: Record<string, string> = {};
|
|
154
|
+
for (const model of Prisma.dmmf.datamodel.models) {
|
|
155
|
+
const dbName = (model as any).dbName || model.name;
|
|
156
|
+
if (dbName !== tableName) continue;
|
|
157
|
+
for (const field of model.fields) {
|
|
158
|
+
if (field.kind === 'object') continue; // Skip relation fields
|
|
159
|
+
const colName = (field as any).dbName || field.name;
|
|
160
|
+
map[field.name] = colName;
|
|
161
|
+
}
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
return map;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async function seedTables(seed: Record<string, unknown[]>) {
|
|
168
|
+
if (Object.keys(seed).length === 0) return;
|
|
169
|
+
|
|
170
|
+
const tableMap = buildTableNameMap();
|
|
171
|
+
|
|
172
|
+
// Discover ALL models from the Prisma schema — not just the tables in the seed data.
|
|
173
|
+
// This ensures FK-dependent tables are cleared even when the seed only contains
|
|
174
|
+
// the parent table's data.
|
|
175
|
+
const allTables = Prisma.dmmf.datamodel.models.map(
|
|
176
|
+
(m) => (m as any).dbName || m.name,
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
console.log(
|
|
180
|
+
`Clearing ${allTables.length} tables, seeding: ${Object.keys(seed).join(', ')}`,
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
const client = new Client({
|
|
184
|
+
connectionString: databaseUrl,
|
|
185
|
+
ssl: { rejectUnauthorized: false },
|
|
186
|
+
});
|
|
187
|
+
await client.connect();
|
|
188
|
+
|
|
189
|
+
try {
|
|
190
|
+
// TRUNCATE all tables in one statement — CASCADE handles FK dependencies
|
|
191
|
+
// automatically, so table order doesn't matter. Much faster than
|
|
192
|
+
// individual DELETE FROM queries via PostgREST.
|
|
193
|
+
const quoted = allTables.map((t) => `"${t}"`).join(', ');
|
|
194
|
+
await client.query(`TRUNCATE ${quoted} CASCADE`);
|
|
195
|
+
console.log(` Cleared ${allTables.length} tables`);
|
|
196
|
+
|
|
197
|
+
// Reset auto-increment sequences so IDs start from 1 on each scenario switch.
|
|
198
|
+
// Without this, IDs keep climbing and hardcoded URLs like /drinks/1 break.
|
|
199
|
+
for (const table of allTables) {
|
|
200
|
+
try {
|
|
201
|
+
await client.query(
|
|
202
|
+
`SELECT setval(pg_get_serial_sequence('"${table}"', 'id'), 1, false)`,
|
|
203
|
+
);
|
|
204
|
+
} catch {
|
|
205
|
+
// Table may not have an 'id' serial column — skip
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Insert seed data using batched INSERT for speed
|
|
210
|
+
for (const [seedKey, rows] of Object.entries(seed)) {
|
|
211
|
+
if (!Array.isArray(rows) || rows.length === 0) continue;
|
|
212
|
+
const table = tableMap[seedKey] || seedKey;
|
|
213
|
+
const columnMap = buildColumnMap(table);
|
|
214
|
+
|
|
215
|
+
// Get column names from the first row's keys, mapped to DB column names
|
|
216
|
+
const fieldNames = Object.keys(rows[0] as Record<string, unknown>);
|
|
217
|
+
const dbColumns = fieldNames.map((f) => columnMap[f] || f);
|
|
218
|
+
const quotedCols = dbColumns.map((c) => `"${c}"`).join(', ');
|
|
219
|
+
|
|
220
|
+
// Build parameterized VALUES clause for all rows at once
|
|
221
|
+
const params: unknown[] = [];
|
|
222
|
+
const valueClauses: string[] = [];
|
|
223
|
+
for (let i = 0; i < rows.length; i++) {
|
|
224
|
+
const row = rows[i] as Record<string, unknown>;
|
|
225
|
+
const placeholders: string[] = [];
|
|
226
|
+
for (const field of fieldNames) {
|
|
227
|
+
params.push(row[field]);
|
|
228
|
+
placeholders.push(`$${params.length}`);
|
|
229
|
+
}
|
|
230
|
+
valueClauses.push(`(${placeholders.join(', ')})`);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
await client.query(
|
|
234
|
+
`INSERT INTO "${table}" (${quotedCols}) VALUES ${valueClauses.join(', ')}`,
|
|
235
|
+
params,
|
|
236
|
+
);
|
|
237
|
+
console.log(` Seeded ${rows.length} rows into ${table}`);
|
|
238
|
+
}
|
|
239
|
+
} finally {
|
|
240
|
+
await client.end();
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Export mode: dump current database state to a JSON file.
|
|
246
|
+
* Used by CodeYam to save interactive changes back to scenario seed data.
|
|
247
|
+
*
|
|
248
|
+
* Usage: npx tsx .codeyam/seed-adapter.ts --export <output-path.json>
|
|
249
|
+
*/
|
|
250
|
+
async function exportData(outputPath: string) {
|
|
251
|
+
const tableMap = buildTableNameMap();
|
|
252
|
+
const modelNames = Prisma.dmmf.datamodel.models.map((m) => m.name);
|
|
253
|
+
|
|
254
|
+
const client = new Client({
|
|
255
|
+
connectionString: databaseUrl,
|
|
256
|
+
ssl: { rejectUnauthorized: false },
|
|
257
|
+
});
|
|
258
|
+
await client.connect();
|
|
259
|
+
|
|
260
|
+
try {
|
|
261
|
+
const seed: Record<string, unknown[]> = {};
|
|
262
|
+
for (const model of modelNames) {
|
|
263
|
+
const camelCase = model.charAt(0).toLowerCase() + model.slice(1);
|
|
264
|
+
const table = tableMap[camelCase] || model;
|
|
265
|
+
try {
|
|
266
|
+
const result = await client.query(`SELECT * FROM "${table}"`);
|
|
267
|
+
if (result.rows.length > 0) {
|
|
268
|
+
seed[camelCase] = result.rows;
|
|
269
|
+
}
|
|
270
|
+
} catch {
|
|
271
|
+
// Skip tables that can't be queried
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
fs.writeFileSync(outputPath, JSON.stringify(seed, null, 2));
|
|
276
|
+
console.log(`Exported ${Object.keys(seed).length} tables`);
|
|
277
|
+
} finally {
|
|
278
|
+
await client.end();
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Build a minimal JWT with a far-future expiry.
|
|
284
|
+
* The signature is fake — it doesn't matter because the CodeYam preload module
|
|
285
|
+
* intercepts the Supabase auth validation endpoint and returns mock data.
|
|
286
|
+
*/
|
|
287
|
+
function buildFakeJwt(userId: string, email: string): string {
|
|
288
|
+
const header = { alg: 'HS256', typ: 'JWT' };
|
|
289
|
+
const payload = {
|
|
290
|
+
sub: userId,
|
|
291
|
+
email,
|
|
292
|
+
role: 'authenticated',
|
|
293
|
+
aud: 'authenticated',
|
|
294
|
+
exp: 9999999999,
|
|
295
|
+
iat: Math.floor(Date.now() / 1000),
|
|
296
|
+
};
|
|
297
|
+
const encode = (obj: object) =>
|
|
298
|
+
Buffer.from(JSON.stringify(obj)).toString('base64url');
|
|
299
|
+
return `${encode(header)}.${encode(payload)}.codeyam-mock-signature`;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Build a Supabase user response object matching the /auth/v1/user endpoint format.
|
|
304
|
+
*/
|
|
305
|
+
function buildUserResponse(user: { id: string; email?: string }) {
|
|
306
|
+
return {
|
|
307
|
+
id: user.id,
|
|
308
|
+
aud: 'authenticated',
|
|
309
|
+
role: 'authenticated',
|
|
310
|
+
email: user.email || '',
|
|
311
|
+
email_confirmed_at: new Date().toISOString(),
|
|
312
|
+
app_metadata: { provider: 'email', providers: ['email'] },
|
|
313
|
+
user_metadata: {},
|
|
314
|
+
created_at: new Date().toISOString(),
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
const DEFAULT_AUTH_PASSWORD = 'codeyam-dev-password-123!';
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Handle auth: create user, build synthetic session, write session cookies.
|
|
322
|
+
* Returns the user ID so callers can replace __AUTH_USER_ID__ placeholders in seed data.
|
|
323
|
+
*
|
|
324
|
+
* No real sign-in is performed — the session cookie uses a synthetic JWT with
|
|
325
|
+
* far-future expiry, and externalApis mocks intercept all Supabase auth API calls.
|
|
326
|
+
* This avoids storing real tokens (security risk + expiration) in scenario files.
|
|
327
|
+
*/
|
|
328
|
+
async function handleAuth(auth: {
|
|
329
|
+
email: string;
|
|
330
|
+
password?: string;
|
|
331
|
+
}): Promise<string> {
|
|
332
|
+
const email = auth.email;
|
|
333
|
+
const password = auth.password || DEFAULT_AUTH_PASSWORD;
|
|
334
|
+
|
|
335
|
+
// Create user if they don't exist (auto-confirm email)
|
|
336
|
+
// We still need the auth.users row for PostgREST FK relationships.
|
|
337
|
+
const { data: createData, error: createError } =
|
|
338
|
+
await supabase.auth.admin.createUser({
|
|
339
|
+
email,
|
|
340
|
+
password,
|
|
341
|
+
email_confirm: true,
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
let userId: string;
|
|
345
|
+
|
|
346
|
+
if (createError) {
|
|
347
|
+
if (createError.message.includes('already been registered')) {
|
|
348
|
+
// User exists — look up their ID
|
|
349
|
+
const { data: listData } = await supabase.auth.admin.listUsers();
|
|
350
|
+
const existingUser = listData?.users?.find((u) => u.email === email);
|
|
351
|
+
if (existingUser) {
|
|
352
|
+
userId = existingUser.id;
|
|
353
|
+
console.log(` Found existing user ${email} (user: ${userId})`);
|
|
354
|
+
} else {
|
|
355
|
+
console.error(
|
|
356
|
+
` User ${email} reported as registered but not found in listUsers`,
|
|
357
|
+
);
|
|
358
|
+
process.exit(1);
|
|
359
|
+
}
|
|
360
|
+
} else {
|
|
361
|
+
console.error(` Failed to create auth user: ${createError.message}`);
|
|
362
|
+
process.exit(1);
|
|
363
|
+
}
|
|
364
|
+
} else {
|
|
365
|
+
userId = createData!.user.id;
|
|
366
|
+
console.log(` Created user ${email} (user: ${userId})`);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// Build synthetic JWT and mock responses — no real sign-in needed.
|
|
370
|
+
// The preload module intercepts server-side getUser() calls so Next.js
|
|
371
|
+
// middleware returns the mock user without hitting real Supabase.
|
|
372
|
+
const fakeJwt = buildFakeJwt(userId!, email);
|
|
373
|
+
const userResponse = buildUserResponse({ id: userId!, email });
|
|
374
|
+
|
|
375
|
+
const projectRef = getProjectRef();
|
|
376
|
+
const sessionOutput = {
|
|
377
|
+
cookies: [
|
|
378
|
+
{
|
|
379
|
+
name: `sb-${projectRef}-auth-token`,
|
|
380
|
+
value: JSON.stringify({
|
|
381
|
+
access_token: fakeJwt,
|
|
382
|
+
refresh_token: 'codeyam-mock-refresh-token',
|
|
383
|
+
token_type: 'bearer',
|
|
384
|
+
expires_in: 315360000,
|
|
385
|
+
expires_at: 9999999999,
|
|
386
|
+
}),
|
|
387
|
+
path: '/',
|
|
388
|
+
sameSite: 'Lax' as const,
|
|
389
|
+
},
|
|
390
|
+
],
|
|
391
|
+
externalApis: {
|
|
392
|
+
[`${supabaseUrl}/auth/v1/user`]: {
|
|
393
|
+
body: userResponse,
|
|
394
|
+
status: 200,
|
|
395
|
+
},
|
|
396
|
+
[`${supabaseUrl}/auth/v1/token`]: {
|
|
397
|
+
body: {
|
|
398
|
+
access_token: fakeJwt,
|
|
399
|
+
token_type: 'bearer',
|
|
400
|
+
expires_in: 315360000,
|
|
401
|
+
expires_at: 9999999999,
|
|
402
|
+
refresh_token: 'codeyam-mock-refresh-token',
|
|
403
|
+
user: userResponse,
|
|
404
|
+
},
|
|
405
|
+
status: 200,
|
|
406
|
+
},
|
|
407
|
+
},
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
const outputDir = path.join(process.cwd(), '.codeyam', 'tmp');
|
|
411
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
412
|
+
const outputPath = path.join(outputDir, 'seed-session.json');
|
|
413
|
+
fs.writeFileSync(outputPath, JSON.stringify(sessionOutput, null, 2));
|
|
414
|
+
console.log(` Session cookies + auth mocks written to ${outputPath}`);
|
|
415
|
+
|
|
416
|
+
return userId!;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Replace __AUTH_USER_ID__ placeholders in seed data with the actual Supabase user ID.
|
|
421
|
+
* This lets scenarios reference the authenticated user in foreign key columns (e.g. user_id)
|
|
422
|
+
* without knowing the UUID ahead of time.
|
|
423
|
+
*/
|
|
424
|
+
function replaceAuthPlaceholders(
|
|
425
|
+
seed: Record<string, unknown[]>,
|
|
426
|
+
userId: string,
|
|
427
|
+
): Record<string, unknown[]> {
|
|
428
|
+
const json = JSON.stringify(seed);
|
|
429
|
+
const replaced = json.replace(/__AUTH_USER_ID__/g, userId);
|
|
430
|
+
return JSON.parse(replaced);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
async function main() {
|
|
434
|
+
const seedDataPath = process.argv[2];
|
|
435
|
+
if (!seedDataPath) {
|
|
436
|
+
console.error('Usage: npx tsx .codeyam/seed-adapter.ts <seed-data.json>');
|
|
437
|
+
process.exit(1);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
const raw = fs.readFileSync(seedDataPath, 'utf-8');
|
|
441
|
+
const data = JSON.parse(raw);
|
|
442
|
+
|
|
443
|
+
// Separate auth config from table data
|
|
444
|
+
const auth = data._auth;
|
|
445
|
+
let seed: Record<string, unknown[]> = {};
|
|
446
|
+
for (const [key, value] of Object.entries(data)) {
|
|
447
|
+
if (key === '_auth') continue;
|
|
448
|
+
seed[key] = value as unknown[];
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// Auth first: we need the user ID to replace __AUTH_USER_ID__ placeholders
|
|
452
|
+
// in seed data (e.g. for user_id foreign key columns with Supabase RLS)
|
|
453
|
+
if (auth) {
|
|
454
|
+
const userId = await handleAuth(
|
|
455
|
+
auth as { email: string; password?: string },
|
|
456
|
+
);
|
|
457
|
+
seed = replaceAuthPlaceholders(seed, userId);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
await seedTables(seed);
|
|
461
|
+
|
|
462
|
+
console.log('Seed complete');
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
if (process.argv[2] === '--export') {
|
|
466
|
+
exportData(process.argv[3]).catch((e) => {
|
|
467
|
+
console.error('Seed adapter export error:', e);
|
|
468
|
+
process.exit(1);
|
|
469
|
+
});
|
|
470
|
+
} else {
|
|
471
|
+
main().catch((e) => {
|
|
472
|
+
console.error('Seed adapter error:', e);
|
|
473
|
+
process.exit(1);
|
|
474
|
+
});
|
|
475
|
+
}
|
|
@@ -16,6 +16,77 @@ You MUST follow a step-by-step workflow driven by `codeyam editor` commands. Eac
|
|
|
16
16
|
|
|
17
17
|
**The rule:** After completing what a command tells you to do, run the NEXT command it specifies. The commands are your instructions — follow them one at a time.
|
|
18
18
|
|
|
19
|
+
## TASK Directive
|
|
20
|
+
|
|
21
|
+
Some `codeyam editor N` commands output a `━━━ TASK ━━━` section with an `EXACT_TASK_TITLE:` line. When you see one:
|
|
22
|
+
|
|
23
|
+
1. Delete ALL existing tasks: run TaskList, then run TaskUpdate with status "deleted" for every task returned
|
|
24
|
+
2. Run TaskCreate with the EXACT title from the `EXACT_TASK_TITLE:` line — copy it character-for-character, do NOT paraphrase
|
|
25
|
+
|
|
26
|
+
This ensures only one task is ever visible. Do NOT create tasks on your own. Only create them when a `━━━ TASK ━━━` directive tells you to.
|
|
27
|
+
|
|
28
|
+
## Migration Mode
|
|
29
|
+
|
|
30
|
+
When `codeyam editor steps` shows **"Project Migration"** instead of "Feature Cycle", the project is being migrated from an existing codebase. Follow the `codeyam editor migrate` commands instead of the normal 13-step cycle.
|
|
31
|
+
|
|
32
|
+
Migration uses a different command set:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
codeyam editor migrate → Survey the project (explore pages, confirm order)
|
|
36
|
+
codeyam editor migrate 1-8 → Run migration step N for the current page
|
|
37
|
+
codeyam editor migrate next → Advance to the next page
|
|
38
|
+
codeyam editor migrate status → Show migration progress
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**The same rule applies:** run the command shown in the output, follow its checklist, then run the next command it specifies. Migration steps are 1-8 per page: Capture → Preview → Discuss → Decompose → Extract → Recapture → Journal → Present. Steps 4-6 (Decompose/Extract/Recapture) are optional — the user decides at step 3 whether to decompose or skip to step 7. After all pages are migrated, the project transitions to the normal feature cycle.
|
|
42
|
+
|
|
43
|
+
**IMPORTANT:** When `codeyam editor steps` tells you to run a `codeyam editor migrate` command, run THAT command — do NOT run `codeyam editor 1` or any other normal step command.
|
|
44
|
+
|
|
45
|
+
### Migration Survey (codeyam editor migrate)
|
|
46
|
+
|
|
47
|
+
When you run `codeyam editor migrate` with no arguments and no existing migration state, follow this survey checklist:
|
|
48
|
+
|
|
49
|
+
1. Read `package.json` — understand the framework, dependencies, and scripts
|
|
50
|
+
2. Explore the project structure — find all page/route files
|
|
51
|
+
- Next.js App Router: `app/**/page.tsx` | Pages Router: `pages/**/*.tsx`
|
|
52
|
+
- Check for other patterns: `src/` directory, custom routing, etc.
|
|
53
|
+
3. Read each page/route to assess complexity and data flow
|
|
54
|
+
4. Identify how the dev server starts (check `scripts` in package.json)
|
|
55
|
+
5. Note any environment variables, databases, or external services needed
|
|
56
|
+
6. Present a numbered list of all pages with:
|
|
57
|
+
- Page name and route
|
|
58
|
+
- File path
|
|
59
|
+
- Complexity assessment (simple / moderate / complex)
|
|
60
|
+
7. Suggest a migration order — **start with the most complex pages** (dashboards, analytics, etc.) as they best demonstrate CodeYam's value and have rich decomposition opportunities
|
|
61
|
+
8. Wait for user confirmation of the order
|
|
62
|
+
|
|
63
|
+
**After user confirms**, write `.codeyam/migration-state.json`:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"status": "surveyed",
|
|
68
|
+
"startedAt": "<ISO>",
|
|
69
|
+
"completedAt": null,
|
|
70
|
+
"pages": [
|
|
71
|
+
{
|
|
72
|
+
"name": "Home",
|
|
73
|
+
"route": "/",
|
|
74
|
+
"filePath": "app/page.tsx",
|
|
75
|
+
"status": "pending",
|
|
76
|
+
"startedAt": null,
|
|
77
|
+
"completedAt": null,
|
|
78
|
+
"extractedComponents": [],
|
|
79
|
+
"extractedFunctions": [],
|
|
80
|
+
"scenarioCount": 0
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"currentPageIndex": 0,
|
|
84
|
+
"sharedComponents": []
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Then run: `codeyam editor migrate 1`
|
|
89
|
+
|
|
19
90
|
## The Cycle
|
|
20
91
|
|
|
21
92
|
Every feature follows 13 gated steps:
|
|
@@ -55,6 +126,9 @@ This command gives you the post-change checklist (re-register scenarios, re-run
|
|
|
55
126
|
## Key Rules
|
|
56
127
|
|
|
57
128
|
- **Run the commands** — they ARE your instructions, not suggestions
|
|
129
|
+
- **One step at a time** — run each `codeyam editor N` command, read its FULL output, complete every checklist item, then advance. The CLI enforces a minimum time per step.
|
|
130
|
+
- **NEVER batch-run steps** — `for step in 5 6 7 8; do codeyam editor $step; done` or piping to `head` defeats the entire workflow. Each step has unique instructions you must read and follow.
|
|
131
|
+
- **NEVER delegate multiple steps to a subagent** — each step must be run, read, and completed in the main conversation. You MAY use subagents for parallelizable work _within_ a single step (e.g. extracting components + writing tests in step 5).
|
|
58
132
|
- **Every feature gets scenarios** — this is the core value of CodeYam
|
|
59
133
|
- **Always scaffold with a database** (Prisma + SQLite)
|
|
60
134
|
- **Build real API routes** — the proxy handles scenario data transparently
|
|
@@ -83,13 +157,13 @@ The user is watching the live preview panel while you work. A static preview mak
|
|
|
83
157
|
**How to refresh:**
|
|
84
158
|
|
|
85
159
|
```
|
|
86
|
-
codeyam editor preview
|
|
160
|
+
codeyam editor preview '{"dimension":"<name from screenSizes>"}'
|
|
87
161
|
```
|
|
88
162
|
|
|
89
163
|
Navigate to a specific path or switch scenario:
|
|
90
164
|
|
|
91
165
|
```
|
|
92
|
-
codeyam editor preview '{"path":"/drinks/1"}'
|
|
166
|
+
codeyam editor preview '{"path":"/drinks/1","dimension":"<name from screenSizes>"}'
|
|
93
167
|
codeyam editor preview '{"scenarioId":"abc-123"}'
|
|
94
168
|
```
|
|
95
169
|
|
|
@@ -101,19 +175,41 @@ Isolation routes are committed to git (not gitignored). They are protected by a
|
|
|
101
175
|
|
|
102
176
|
When a collaborator clones the repo and runs `codeyam editor`, scenarios are auto-imported from `scenarios-manifest.json`. Run `codeyam editor sync` to manually re-sync after pulling new changes.
|
|
103
177
|
|
|
178
|
+
## Expo / React Native Projects
|
|
179
|
+
|
|
180
|
+
When working with an Expo project (tech stack `expo-react-native`):
|
|
181
|
+
|
|
182
|
+
- Use `<View>`, `<Text>`, `<ScrollView>`, `<Pressable>` from `react-native` — **never use HTML elements** (`<div>`, `<span>`, `<h1>`, etc.)
|
|
183
|
+
- Do NOT use `'use client'` — this is a Next.js directive that has no meaning in Expo
|
|
184
|
+
- Do NOT import from `next/navigation`, `next/router`, or any `next/*` package
|
|
185
|
+
- Use `expo-router` for navigation: `useRouter()`, `useLocalSearchParams()`, `<Link>`
|
|
186
|
+
- Use `@/lib/theme` for all design tokens — not CSS custom properties (`var(--token)` does not work in React Native)
|
|
187
|
+
- AsyncStorage maps to localStorage on web — CodeYam's `localStorage` injection in scenarios works automatically
|
|
188
|
+
- Test with `npx jest`, not `npx vitest`
|
|
189
|
+
- Isolation routes use Expo Router: `app/isolated-components/ComponentName.tsx` (not a `/page.tsx` subdirectory)
|
|
190
|
+
- Capture wrappers use `nativeID="codeyam-capture"` (not `id="codeyam-capture"`) — `nativeID` maps to `id` on web
|
|
191
|
+
- The preview renders via react-native-web in a browser — some visual differences from native devices are expected (fonts, SafeAreaView, shadows). See `MOBILE_SETUP.md` for details.
|
|
192
|
+
|
|
104
193
|
## Quick Reference
|
|
105
194
|
|
|
106
195
|
```bash
|
|
107
196
|
# Register component scenario (auto-captures screenshot)
|
|
108
|
-
|
|
197
|
+
# ALWAYS include "dimensions" — use the project's default screen size name from setup
|
|
198
|
+
codeyam editor register '{"name":"DrinkCard - Default","componentName":"DrinkCard","componentPath":"app/components/DrinkCard.tsx","url":"/isolated-components/DrinkCard?s=Default","dimensions":["<name from screenSizes>"],"mockData":{"routes":{"/api/...":{"body":[...]}}}}'
|
|
109
199
|
|
|
110
|
-
# Register app scenario with seed data (ALWAYS include "url"
|
|
111
|
-
codeyam editor register '{"name":"Full Catalog","type":"application","url":"/","seed":{"drinks":[...]}}'
|
|
200
|
+
# Register app scenario with seed data (ALWAYS include "url" and "dimensions")
|
|
201
|
+
codeyam editor register '{"name":"Full Catalog","type":"application","url":"/","dimensions":["<name from screenSizes>"],"seed":{"drinks":[...]}}'
|
|
112
202
|
|
|
113
203
|
# Register app scenario with localStorage (for apps using client-side storage instead of a database)
|
|
114
|
-
codeyam editor register '{"name":"Full Library","type":"application","url":"/","localStorage":{"articles":[...],"collections":[...]}}'
|
|
204
|
+
codeyam editor register '{"name":"Full Library","type":"application","url":"/","dimensions":["<name from screenSizes>"],"localStorage":{"articles":[...],"collections":[...]}}'
|
|
205
|
+
|
|
206
|
+
# BULK REGISTRATION (preferred — register all scenarios at once):
|
|
207
|
+
# Write an array of scenarios to a temp file, then register with @ prefix.
|
|
208
|
+
# This is faster and avoids repeated screenshot capture overhead.
|
|
209
|
+
# File format: [{"name":"...","type":"...","url":"...","seed":{...}}, ...]
|
|
210
|
+
codeyam editor register @.codeyam/tmp/scenarios.json
|
|
115
211
|
|
|
116
|
-
#
|
|
212
|
+
# Single scenario from file (for large seed/localStorage data):
|
|
117
213
|
codeyam editor register @/tmp/scenario-data.json
|
|
118
214
|
|
|
119
215
|
# Journal entry (one per feature, references scenario names)
|
|
@@ -122,9 +218,9 @@ codeyam editor journal '{"title":"...","type":"feature","description":"..."}'
|
|
|
122
218
|
# Update journal with commit info
|
|
123
219
|
codeyam editor journal-update '{"time":"...","commitSha":"...","commitMessage":"..."}'
|
|
124
220
|
|
|
125
|
-
# Refresh preview / navigate / switch scenario
|
|
126
|
-
codeyam editor preview
|
|
127
|
-
codeyam editor preview '{"path":"/drinks/1"}'
|
|
221
|
+
# Refresh preview / navigate / switch scenario (ALWAYS include "dimension")
|
|
222
|
+
codeyam editor preview '{"dimension":"<name from screenSizes>"}'
|
|
223
|
+
codeyam editor preview '{"path":"/drinks/1","dimension":"<name from screenSizes>"}'
|
|
128
224
|
codeyam editor preview '{"scenarioId":"abc-123"}'
|
|
129
225
|
|
|
130
226
|
# Show/hide results panel
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeyam/codeyam-cli",
|
|
3
|
-
"version": "0.1.0-staging.
|
|
3
|
+
"version": "0.1.0-staging.df25827",
|
|
4
4
|
"description": "Local development CLI for CodeYam analysis",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"p-queue": "^9.1.0",
|
|
47
47
|
"p-retry": "^7.1.1",
|
|
48
48
|
"pg": "^8.19.0",
|
|
49
|
+
"posthog-node": "^4.0.0",
|
|
49
50
|
"piscina": "^5.1.4",
|
|
50
51
|
"pixelmatch": "^5.3.0",
|
|
51
52
|
"playwright": "1.58.0",
|