@codeyam/codeyam-cli 0.1.0-staging.ad88eeb → 0.1.0-staging.b147f46
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 +4 -4
- 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 +2 -2
- package/analyzer-template/packages/database/package.json +2 -2
- package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +82 -0
- package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +19 -15
- 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/updateCommitMetadata.ts +0 -65
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +5 -0
- 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 +84 -0
- 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 +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.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/updateCommitMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +0 -25
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.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/background/src/lib/virtualized/project/analyzeFileEntities.js +22 -0
- package/background/src/lib/virtualized/project/analyzeFileEntities.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.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/editor.js +3495 -553
- 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 +69 -34
- 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/techStacks.js +2 -7
- package/codeyam-cli/src/data/techStacks.js.map +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__/backgroundServer.test.js +46 -0
- package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorApi.test.js +18 -8
- package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +3380 -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__/editorDevServer.test.js +27 -2
- package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -1
- 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 +202 -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 +96 -1
- package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +47 -1
- package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +70 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +1548 -1
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +117 -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 +395 -11
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js +177 -0
- package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +16 -1
- package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/manualEntityAnalysis.test.js +302 -0
- package/codeyam-cli/src/utils/__tests__/manualEntityAnalysis.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/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 +284 -0
- package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +649 -223
- 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 +217 -0
- package/codeyam-cli/src/utils/__tests__/testRunner.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 +93 -17
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/database.js +37 -2
- package/codeyam-cli/src/utils/database.js.map +1 -1
- package/codeyam-cli/src/utils/editorApi.js +11 -5
- package/codeyam-cli/src/utils/editorApi.js.map +1 -1
- package/codeyam-cli/src/utils/editorAudit.js +673 -5
- 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/editorDevServer.js +5 -1
- package/codeyam-cli/src/utils/editorDevServer.js.map +1 -1
- 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 +72 -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/editorScenarioSwitch.js +24 -2
- package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -1
- package/codeyam-cli/src/utils/editorScenarios.js +580 -0
- package/codeyam-cli/src/utils/editorScenarios.js.map +1 -1
- package/codeyam-cli/src/utils/editorSeedAdapter.js +295 -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 +53 -6
- package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -1
- package/codeyam-cli/src/utils/entityChangeStatus.server.js +57 -3
- package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -1
- 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/install-skills.js +14 -0
- 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/job.js +26 -5
- 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 +77 -0
- package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -0
- package/codeyam-cli/src/utils/scenariosManifest.js +269 -74
- 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/serverState.js +30 -0
- package/codeyam-cli/src/utils/serverState.js.map +1 -1
- 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 +17 -1
- package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -1
- 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 +2 -2
- 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/testRunner.js +199 -1
- package/codeyam-cli/src/utils/testRunner.js.map +1 -1
- 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 +469 -0
- package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -1
- package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js +283 -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/git.js +3 -2
- package/codeyam-cli/src/webserver/app/lib/git.js.map +1 -1
- 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-CLe80MMu.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-BcgbViKV.js → EntityItem-Crt_KN_U.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-CD7lGABo.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-CgTNOhnu.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-CKeQT5Ty.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-BU_OAEMP.js → LoadingDots-By5zI316.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-ceAyBX-H.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-BzHcG7SE.js → ReportIssueModal-C2PLkej3.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-DanvyBPb.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-0DY_NKil.js → ScenarioViewer-DUMfcNVK.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/Spinner-D0LgAaSa.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-DLxKhri3.js → _index-BAWd-Xjf.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BcY3q6nt.js → activity.(_tab)-BOARiB-g.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/{addon-web-links-Duc5hnl7.js → addon-web-links-CHx25PAe.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-Bni3iiUj.js → agent-transcripts-Bg3e7q4S.js} +3 -3
- 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-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-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/{book-open-BYOypzCa.js → book-open-CL-lMgHh.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-C_Pmso5S.js → chevron-down-GmAjGS9-.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-BAdwhyCx.js +43 -0
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BVMi9VA5.js → circle-check-DFcQkN5j.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{copy-n2FB0_Sw.js → copy-C6iF61Xs.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-CC6AbExI.js → createLucideIcon-4ImjHTVC.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-C8y4mmyv.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)-DMv5ESGo.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._-BF4oLwaE.js → entity._sha._-ByHz6rAQ.js} +13 -12
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-CmLO432x.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-Bz9sCUF_.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-DQM8E7L4.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BMvVHNXU.js → entity._sha_.edit._scenarioId-CAoXLsQr.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DTvKq3TY.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-oyPmV37k.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-BcvgDzbZ.js → index-Bp1l4hSv.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-10oVnAAH.js → index-CWV9XZiG.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-yHOVb4rc.js → index-DE3jI_dv.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-B_IX45ih.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-DaAZ_H2w.js → loader-circle-De-7qQ2u.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-1a45e154.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-f5-1lKBt.js → pause-CFxEKL1u.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-D2_tktnk.js +80 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-Di64LWVb.js → search-BdBb5aqc.js} +1 -1
- 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-Br7MOqts.js → terminal-CrplD4b1.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BLdiCuG-.js → triangle-alert-DqJ0j69l.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-DhXHbEjP.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-C14nCb1q.js → useLastLogLine-BNd5hYuW.js} +1 -1
- 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/sound-test.html +98 -0
- package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-By5slFjw.js +16 -0
- package/codeyam-cli/src/webserver/build/server/assets/index-DXaOwBnm.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/init-CLG1LjQM.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-NZmUqQv6.js +688 -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 +436 -13
- package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
- package/codeyam-cli/src/webserver/idleDetector.js +121 -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 +125 -4
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/src/webserver/terminalServer.js +288 -43
- 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/chrome-extension-react/README.md +46 -0
- package/codeyam-cli/templates/chrome-extension-react/package.json +1 -0
- package/codeyam-cli/templates/chrome-extension-react/vite.config.ts +6 -0
- package/codeyam-cli/templates/codeyam-editor-claude.md +86 -5
- package/codeyam-cli/templates/codeyam-editor-reference.md +216 -0
- package/codeyam-cli/templates/editor-step-hook.py +193 -56
- package/codeyam-cli/templates/expo-react-native/README.md +41 -0
- package/codeyam-cli/templates/expo-react-native/package.json +1 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/DATABASE.md +14 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/README.md +53 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +2 -1
- package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +83 -40
- package/codeyam-cli/templates/nextjs-prisma-supabase/README.md +52 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/package.json +2 -1
- package/codeyam-cli/templates/seed-adapters/supabase.ts +282 -0
- package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +1 -1
- package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +94 -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 +84 -0
- package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
- package/packages/database/src/lib/loadAnalysis.js +1 -1
- package/packages/database/src/lib/loadAnalysis.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/updateCommitMetadata.js +0 -25
- package/packages/database/src/lib/updateCommitMetadata.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-BuT_Huj0.js +0 -10
- package/codeyam-cli/src/webserver/build/client/assets/editorPreview-B7ztwLut.js +0 -41
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-D5rYBT5x.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-BkWJ_UNc.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-b0f1372e.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/memory-Bl2rpw8u.js +0 -96
- package/codeyam-cli/src/webserver/build/client/assets/root-B_X8HS1x.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/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/index-CbF6h3dj.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-DRFwTJqO.js +0 -367
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Project Name
|
|
2
|
+
|
|
3
|
+
Brief description of what this app does.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
Run the setup script to install dependencies, initialize the database, and seed it with demo data:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm run setup
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Development
|
|
14
|
+
|
|
15
|
+
Start the dev server:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm run dev
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Open [http://localhost:3000](http://localhost:3000) in your browser.
|
|
22
|
+
|
|
23
|
+
## Using CodeYam Editor
|
|
24
|
+
|
|
25
|
+
This project was built with [CodeYam](https://codeyam.com). To launch the editor:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
codeyam editor
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The editor provides a live preview alongside a Claude Code terminal for iterating on the app.
|
|
32
|
+
|
|
33
|
+
## Database
|
|
34
|
+
|
|
35
|
+
This project uses Supabase (PostgreSQL) via Prisma. Common commands:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm run db:push # Apply schema changes and generate Prisma client
|
|
39
|
+
npm run db:seed # Seed the database with demo data
|
|
40
|
+
npm run db:reset # Reset database (runs prisma migrate reset)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Scripts
|
|
44
|
+
|
|
45
|
+
| Script | Description |
|
|
46
|
+
| ------------------ | -------------------------------------------- |
|
|
47
|
+
| `npm run setup` | One-line project setup (install + db + seed) |
|
|
48
|
+
| `npm run dev` | Start the development server |
|
|
49
|
+
| `npm run build` | Build for production |
|
|
50
|
+
| `npm run db:push` | Apply Prisma schema changes |
|
|
51
|
+
| `npm run db:seed` | Seed the database |
|
|
52
|
+
| `npm run db:reset` | Reset the database |
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
|
+
"setup": "npm install && npm run db:push && npm run db:seed",
|
|
6
7
|
"dev": "next dev --turbopack",
|
|
7
8
|
"build": "next build",
|
|
8
9
|
"start": "next start",
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
"@prisma/adapter-pg": "^7.4.1",
|
|
16
17
|
"@prisma/client": "^7.4.1",
|
|
17
18
|
"@supabase/supabase-js": "^2.49.4",
|
|
18
|
-
"next": "^
|
|
19
|
+
"next": "^16.1.7",
|
|
19
20
|
"pg": "^8.16.0",
|
|
20
21
|
"prisma": "^7.4.1",
|
|
21
22
|
"react": "^19.1.0",
|
|
@@ -0,0 +1,282 @@
|
|
|
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"
|
|
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. Signs in with signInWithPassword to get a valid session
|
|
20
|
+
* 3. Writes session cookies to .codeyam/tmp/seed-session.json
|
|
21
|
+
* so the CodeYam proxy can inject them into the browser
|
|
22
|
+
*
|
|
23
|
+
* Requirements:
|
|
24
|
+
* - A Supabase project URL (https://<ref>.supabase.co) in any env var
|
|
25
|
+
* - A secret key (sb_secret_... or legacy eyJ... service_role JWT) in any env var
|
|
26
|
+
*
|
|
27
|
+
* The adapter scans ALL env vars by value pattern — no specific naming required.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import { createClient } from '@supabase/supabase-js';
|
|
31
|
+
import * as fs from 'fs';
|
|
32
|
+
import * as path from 'path';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Scan all env vars for values matching a pattern.
|
|
36
|
+
* Returns ALL unique matches (not just the first) so callers can disambiguate.
|
|
37
|
+
*/
|
|
38
|
+
function findAllEnvByPattern(pattern: RegExp): string[] {
|
|
39
|
+
const matches = new Set<string>();
|
|
40
|
+
for (const value of Object.values(process.env)) {
|
|
41
|
+
if (value && pattern.test(value)) matches.add(value);
|
|
42
|
+
}
|
|
43
|
+
return [...matches];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* For legacy Supabase JWTs, decode the payload to check the `role` claim.
|
|
48
|
+
* Returns the role string ("service_role", "anon", etc.) or undefined.
|
|
49
|
+
*/
|
|
50
|
+
function getJwtRole(jwt: string): string | undefined {
|
|
51
|
+
try {
|
|
52
|
+
const payload = jwt.split('.')[1];
|
|
53
|
+
const decoded = JSON.parse(Buffer.from(payload, 'base64url').toString());
|
|
54
|
+
return decoded.role;
|
|
55
|
+
} catch {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Detect Supabase credentials by value pattern, not env var name.
|
|
61
|
+
// This works regardless of what the user named their env vars.
|
|
62
|
+
const supabaseUrl = findAllEnvByPattern(
|
|
63
|
+
/^https:\/\/[a-z0-9]+\.supabase\.co\b/,
|
|
64
|
+
)[0];
|
|
65
|
+
|
|
66
|
+
// New-format keys are unambiguous by prefix
|
|
67
|
+
const newSecretKey = findAllEnvByPattern(/^sb_secret_/)[0];
|
|
68
|
+
const newAnonKey = findAllEnvByPattern(/^sb_publishable_/)[0];
|
|
69
|
+
|
|
70
|
+
// Legacy JWT keys — disambiguate by decoding the role claim
|
|
71
|
+
const legacyJwts = findAllEnvByPattern(
|
|
72
|
+
/^eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/,
|
|
73
|
+
);
|
|
74
|
+
const legacyServiceRole = legacyJwts.find(
|
|
75
|
+
(jwt) => getJwtRole(jwt) === 'service_role',
|
|
76
|
+
);
|
|
77
|
+
const legacyAnon = legacyJwts.find((jwt) => getJwtRole(jwt) === 'anon');
|
|
78
|
+
|
|
79
|
+
const secretKey = newSecretKey || legacyServiceRole;
|
|
80
|
+
const anonKey = newAnonKey || legacyAnon;
|
|
81
|
+
|
|
82
|
+
if (!supabaseUrl || !secretKey) {
|
|
83
|
+
console.error(
|
|
84
|
+
'Could not find Supabase credentials in environment variables.',
|
|
85
|
+
);
|
|
86
|
+
console.error(
|
|
87
|
+
'Looking for: a URL matching https://<ref>.supabase.co and a key starting with sb_secret_ (or a service_role JWT)',
|
|
88
|
+
);
|
|
89
|
+
console.error(
|
|
90
|
+
'Add them to .env.local — the seed adapter scans all env vars by value pattern.',
|
|
91
|
+
);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Admin client for user management (uses secret key to bypass RLS)
|
|
96
|
+
const supabase = createClient(supabaseUrl, secretKey, {
|
|
97
|
+
auth: { autoRefreshToken: false, persistSession: false },
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Derive the project ref from the URL for cookie naming
|
|
101
|
+
// e.g. "https://abcdefgh.supabase.co" → "abcdefgh"
|
|
102
|
+
function getProjectRef(): string {
|
|
103
|
+
try {
|
|
104
|
+
const hostname = new URL(supabaseUrl!).hostname;
|
|
105
|
+
return hostname.split('.')[0];
|
|
106
|
+
} catch {
|
|
107
|
+
return 'unknown';
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async function seedTables(seed: Record<string, unknown[]>) {
|
|
112
|
+
const tableNames = Object.keys(seed);
|
|
113
|
+
if (tableNames.length === 0) return;
|
|
114
|
+
|
|
115
|
+
console.log(`Seeding tables: ${tableNames.join(', ')}`);
|
|
116
|
+
|
|
117
|
+
// Wipe tables in reverse order (to respect foreign keys)
|
|
118
|
+
for (const table of [...tableNames].reverse()) {
|
|
119
|
+
const { error } = await supabase.from(table).delete().gte('id', 0);
|
|
120
|
+
if (error) {
|
|
121
|
+
const { error: error2 } = await supabase
|
|
122
|
+
.from(table)
|
|
123
|
+
.delete()
|
|
124
|
+
.not('id', 'is', null);
|
|
125
|
+
if (error2) {
|
|
126
|
+
console.warn(` Could not clear ${table}: ${error2.message}`);
|
|
127
|
+
} else {
|
|
128
|
+
console.log(` Cleared ${table}`);
|
|
129
|
+
}
|
|
130
|
+
} else {
|
|
131
|
+
console.log(` Cleared ${table}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Insert seed data
|
|
136
|
+
for (const [table, rows] of Object.entries(seed)) {
|
|
137
|
+
if (!Array.isArray(rows) || rows.length === 0) continue;
|
|
138
|
+
const { error } = await supabase.from(table).insert(rows);
|
|
139
|
+
if (error) {
|
|
140
|
+
console.error(` Failed to seed ${table}: ${error.message}`);
|
|
141
|
+
process.exit(1);
|
|
142
|
+
}
|
|
143
|
+
console.log(` Seeded ${rows.length} rows into ${table}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Handle auth: create user, sign in, write session cookies.
|
|
149
|
+
* Returns the user ID so callers can replace __AUTH_USER_ID__ placeholders in seed data.
|
|
150
|
+
*/
|
|
151
|
+
async function handleAuth(auth: {
|
|
152
|
+
email: string;
|
|
153
|
+
password: string;
|
|
154
|
+
}): Promise<string> {
|
|
155
|
+
const { email, password } = auth;
|
|
156
|
+
|
|
157
|
+
// Create user if they don't exist (auto-confirm email so sign-in works)
|
|
158
|
+
const { data: createData, error: createError } =
|
|
159
|
+
await supabase.auth.admin.createUser({
|
|
160
|
+
email,
|
|
161
|
+
password,
|
|
162
|
+
email_confirm: true,
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
if (createError) {
|
|
166
|
+
if (createError.message.includes('already been registered')) {
|
|
167
|
+
// User exists — update their password so sign-in works even if the
|
|
168
|
+
// scenario specifies a different password than a previous run.
|
|
169
|
+
const { data: listData } = await supabase.auth.admin.listUsers();
|
|
170
|
+
const existingUser = listData?.users?.find((u) => u.email === email);
|
|
171
|
+
if (existingUser) {
|
|
172
|
+
await supabase.auth.admin.updateUserById(existingUser.id, {
|
|
173
|
+
password,
|
|
174
|
+
});
|
|
175
|
+
console.log(` Updated password for existing user ${email}`);
|
|
176
|
+
}
|
|
177
|
+
} else {
|
|
178
|
+
console.error(` Failed to create auth user: ${createError.message}`);
|
|
179
|
+
process.exit(1);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Sign in to get a valid session
|
|
184
|
+
// Use a separate client with the publishable/anon key for sign-in (if available)
|
|
185
|
+
const signInClient =
|
|
186
|
+
anonKey && anonKey !== secretKey
|
|
187
|
+
? createClient(supabaseUrl!, anonKey, {
|
|
188
|
+
auth: { autoRefreshToken: false, persistSession: false },
|
|
189
|
+
})
|
|
190
|
+
: supabase;
|
|
191
|
+
|
|
192
|
+
const { data: signInData, error: signInError } =
|
|
193
|
+
await signInClient.auth.signInWithPassword({ email, password });
|
|
194
|
+
|
|
195
|
+
if (signInError || !signInData.session) {
|
|
196
|
+
console.error(
|
|
197
|
+
` Failed to sign in as ${email}: ${signInError?.message || 'no session returned'}`,
|
|
198
|
+
);
|
|
199
|
+
process.exit(1);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const userId = signInData.user.id;
|
|
203
|
+
console.log(` Signed in as ${email} (user: ${userId})`);
|
|
204
|
+
|
|
205
|
+
// Write session cookies for the proxy to inject
|
|
206
|
+
const projectRef = getProjectRef();
|
|
207
|
+
const sessionOutput = {
|
|
208
|
+
cookies: [
|
|
209
|
+
{
|
|
210
|
+
name: `sb-${projectRef}-auth-token`,
|
|
211
|
+
value: JSON.stringify({
|
|
212
|
+
access_token: signInData.session.access_token,
|
|
213
|
+
refresh_token: signInData.session.refresh_token,
|
|
214
|
+
token_type: 'bearer',
|
|
215
|
+
expires_in: signInData.session.expires_in,
|
|
216
|
+
expires_at: signInData.session.expires_at,
|
|
217
|
+
}),
|
|
218
|
+
path: '/',
|
|
219
|
+
sameSite: 'Lax' as const,
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const outputDir = path.join(process.cwd(), '.codeyam', 'tmp');
|
|
225
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
226
|
+
const outputPath = path.join(outputDir, 'seed-session.json');
|
|
227
|
+
fs.writeFileSync(outputPath, JSON.stringify(sessionOutput, null, 2));
|
|
228
|
+
console.log(` Session cookies written to ${outputPath}`);
|
|
229
|
+
|
|
230
|
+
return userId;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Replace __AUTH_USER_ID__ placeholders in seed data with the actual Supabase user ID.
|
|
235
|
+
* This lets scenarios reference the authenticated user in foreign key columns (e.g. user_id)
|
|
236
|
+
* without knowing the UUID ahead of time.
|
|
237
|
+
*/
|
|
238
|
+
function replaceAuthPlaceholders(
|
|
239
|
+
seed: Record<string, unknown[]>,
|
|
240
|
+
userId: string,
|
|
241
|
+
): Record<string, unknown[]> {
|
|
242
|
+
const json = JSON.stringify(seed);
|
|
243
|
+
const replaced = json.replace(/__AUTH_USER_ID__/g, userId);
|
|
244
|
+
return JSON.parse(replaced);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
async function main() {
|
|
248
|
+
const seedDataPath = process.argv[2];
|
|
249
|
+
if (!seedDataPath) {
|
|
250
|
+
console.error('Usage: npx tsx .codeyam/seed-adapter.ts <seed-data.json>');
|
|
251
|
+
process.exit(1);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const raw = fs.readFileSync(seedDataPath, 'utf-8');
|
|
255
|
+
const data = JSON.parse(raw);
|
|
256
|
+
|
|
257
|
+
// Separate auth config from table data
|
|
258
|
+
const auth = data._auth;
|
|
259
|
+
let seed: Record<string, unknown[]> = {};
|
|
260
|
+
for (const [key, value] of Object.entries(data)) {
|
|
261
|
+
if (key === '_auth') continue;
|
|
262
|
+
seed[key] = value as unknown[];
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Auth first: we need the user ID to replace __AUTH_USER_ID__ placeholders
|
|
266
|
+
// in seed data (e.g. for user_id foreign key columns with Supabase RLS)
|
|
267
|
+
if (auth) {
|
|
268
|
+
const userId = await handleAuth(
|
|
269
|
+
auth as { email: string; password: string },
|
|
270
|
+
);
|
|
271
|
+
seed = replaceAuthPlaceholders(seed, userId);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
await seedTables(seed);
|
|
275
|
+
|
|
276
|
+
console.log('Seed complete');
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
main().catch((e) => {
|
|
280
|
+
console.error('Seed adapter error:', e);
|
|
281
|
+
process.exit(1);
|
|
282
|
+
});
|
|
@@ -53,7 +53,7 @@ Then present a **concise** overview to the user:
|
|
|
53
53
|
|
|
54
54
|
1. **Component Summary** — 2-3 sentences on what the component does and the current scenario being previewed.
|
|
55
55
|
|
|
56
|
-
2. **Suggested Tests** — Compare the component's code paths (conditionals, edge cases, visual states) against the existing scenarios from the database. Recommend 2-4 specific ways to test the component that are **not yet covered** by saved scenarios. Focus on interesting visual states — e.g. "What does this look like with a very long title?", "What happens when the list is empty?", "How does the error state render?". Be specific to this component, not generic.
|
|
56
|
+
2. **Suggested Tests** — Compare the component's code paths (conditionals, edge cases, visual states) against the existing scenarios from the database. Recommend 2-4 specific ways to test the component that are **not yet covered** by saved scenarios. Focus on interesting visual states — e.g. "What does this look like with a very long title?", "What happens when the list is empty?", "How does the error state render?". Also suggest ways to enrich the _existing_ scenario's data to better exercise the component (more realistic content, populated optional fields, diverse values). Be specific to this component, not generic.
|
|
57
57
|
|
|
58
58
|
Keep it brief — no tables, no exhaustive attribute lists. The user can see the preview and wants actionable suggestions, not a data dump.
|
|
59
59
|
|
|
@@ -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:
|
|
@@ -44,7 +115,7 @@ codeyam editor 13 → Present summary, get final approval
|
|
|
44
115
|
When the user asks for changes — whether through the menu, a direct request, or even a question that implies a change (e.g., "Can the cards have images?") — you MUST run `codeyam editor change` **before** making any modifications. This includes:
|
|
45
116
|
|
|
46
117
|
- Code changes (components, routes, lib functions, styles)
|
|
47
|
-
- Scenario data updates (seed data, mock data)
|
|
118
|
+
- Scenario data updates (seed data, localStorage data, mock data)
|
|
48
119
|
- Style adjustments (CSS, Tailwind classes, layout tweaks)
|
|
49
120
|
- Even small fixes (typos, color tweaks, spacing)
|
|
50
121
|
|
|
@@ -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
|
|
|
@@ -105,12 +179,22 @@ When a collaborator clones the repo and runs `codeyam editor`, scenarios are aut
|
|
|
105
179
|
|
|
106
180
|
```bash
|
|
107
181
|
# Register component scenario (auto-captures screenshot)
|
|
108
|
-
|
|
182
|
+
# ALWAYS include "dimensions" — use the project's default screen size name from setup
|
|
183
|
+
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":[...]}}}}'
|
|
184
|
+
|
|
185
|
+
# Register app scenario with seed data (ALWAYS include "url" and "dimensions")
|
|
186
|
+
codeyam editor register '{"name":"Full Catalog","type":"application","url":"/","dimensions":["<name from screenSizes>"],"seed":{"drinks":[...]}}'
|
|
187
|
+
|
|
188
|
+
# Register app scenario with localStorage (for apps using client-side storage instead of a database)
|
|
189
|
+
codeyam editor register '{"name":"Full Library","type":"application","url":"/","dimensions":["<name from screenSizes>"],"localStorage":{"articles":[...],"collections":[...]}}'
|
|
109
190
|
|
|
110
|
-
#
|
|
111
|
-
|
|
191
|
+
# BULK REGISTRATION (preferred — register all scenarios at once):
|
|
192
|
+
# Write an array of scenarios to a temp file, then register with @ prefix.
|
|
193
|
+
# This is faster and avoids repeated screenshot capture overhead.
|
|
194
|
+
# File format: [{"name":"...","type":"...","url":"...","seed":{...}}, ...]
|
|
195
|
+
codeyam editor register @.codeyam/tmp/scenarios.json
|
|
112
196
|
|
|
113
|
-
#
|
|
197
|
+
# Single scenario from file (for large seed/localStorage data):
|
|
114
198
|
codeyam editor register @/tmp/scenario-data.json
|
|
115
199
|
|
|
116
200
|
# Journal entry (one per feature, references scenario names)
|
|
@@ -119,9 +203,9 @@ codeyam editor journal '{"title":"...","type":"feature","description":"..."}'
|
|
|
119
203
|
# Update journal with commit info
|
|
120
204
|
codeyam editor journal-update '{"time":"...","commitSha":"...","commitMessage":"..."}'
|
|
121
205
|
|
|
122
|
-
# Refresh preview / navigate / switch scenario
|
|
123
|
-
codeyam editor preview
|
|
124
|
-
codeyam editor preview '{"path":"/drinks/1"}'
|
|
206
|
+
# Refresh preview / navigate / switch scenario (ALWAYS include "dimension")
|
|
207
|
+
codeyam editor preview '{"dimension":"<name from screenSizes>"}'
|
|
208
|
+
codeyam editor preview '{"path":"/drinks/1","dimension":"<name from screenSizes>"}'
|
|
125
209
|
codeyam editor preview '{"scenarioId":"abc-123"}'
|
|
126
210
|
|
|
127
211
|
# 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.b147f46",
|
|
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",
|
|
@@ -616,6 +616,97 @@ export class UseStateSemantics {
|
|
|
616
616
|
return true;
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
+
// ─── Set/Map method semantics ──────────────────────────────────────────
|
|
620
|
+
//
|
|
621
|
+
// Set/Map membership operations (.has, .delete, .add, .get, .set, .clear)
|
|
622
|
+
// don't create data flow equivalencies — they're membership checks or
|
|
623
|
+
// mutations, not transformations that propagate schema structure.
|
|
624
|
+
// Without these semantics, code like `filterRatings.has(articleId)` creates
|
|
625
|
+
// spurious equivalencies (332 entries in the Margo LibraryPage case).
|
|
626
|
+
/**
|
|
627
|
+
* Set.has() / Map.has() — membership check, returns boolean
|
|
628
|
+
*/
|
|
629
|
+
export class CollectionHasSemantics {
|
|
630
|
+
getReturnType() {
|
|
631
|
+
return 'boolean';
|
|
632
|
+
}
|
|
633
|
+
addEquivalences(methodCallPath, _sourcePath, context) {
|
|
634
|
+
context.addType(methodCallPath, 'boolean');
|
|
635
|
+
}
|
|
636
|
+
isComplete() {
|
|
637
|
+
return true;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Set.delete() / Map.delete() — removal, returns boolean
|
|
642
|
+
*/
|
|
643
|
+
export class CollectionDeleteSemantics {
|
|
644
|
+
getReturnType() {
|
|
645
|
+
return 'boolean';
|
|
646
|
+
}
|
|
647
|
+
addEquivalences(methodCallPath, _sourcePath, context) {
|
|
648
|
+
context.addType(methodCallPath, 'boolean');
|
|
649
|
+
}
|
|
650
|
+
isComplete() {
|
|
651
|
+
return true;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Set.add() — adds an element, returns the Set (for chaining)
|
|
656
|
+
*/
|
|
657
|
+
export class SetAddSemantics {
|
|
658
|
+
getReturnType() {
|
|
659
|
+
return 'object'; // Returns the Set itself
|
|
660
|
+
}
|
|
661
|
+
addEquivalences(_methodCallPath, _sourcePath, _context) {
|
|
662
|
+
// No equivalencies — add() doesn't create data flow
|
|
663
|
+
}
|
|
664
|
+
isComplete() {
|
|
665
|
+
return true;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Set.clear() / Map.clear() — removes all elements, returns void
|
|
670
|
+
*/
|
|
671
|
+
export class CollectionClearSemantics {
|
|
672
|
+
getReturnType() {
|
|
673
|
+
return 'void';
|
|
674
|
+
}
|
|
675
|
+
addEquivalences() {
|
|
676
|
+
// No equivalencies
|
|
677
|
+
}
|
|
678
|
+
isComplete() {
|
|
679
|
+
return true;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Map.get() — retrieves a value by key, returns unknown (value type)
|
|
684
|
+
*/
|
|
685
|
+
export class MapGetSemantics {
|
|
686
|
+
getReturnType() {
|
|
687
|
+
return 'unknown';
|
|
688
|
+
}
|
|
689
|
+
addEquivalences(_methodCallPath, _sourcePath, _context) {
|
|
690
|
+
// No equivalencies — the return value type depends on the map contents
|
|
691
|
+
}
|
|
692
|
+
isComplete() {
|
|
693
|
+
return true;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Map.set() — sets a key-value pair, returns the Map (for chaining)
|
|
698
|
+
*/
|
|
699
|
+
export class MapSetSemantics {
|
|
700
|
+
getReturnType() {
|
|
701
|
+
return 'object'; // Returns the Map itself
|
|
702
|
+
}
|
|
703
|
+
addEquivalences() {
|
|
704
|
+
// No equivalencies
|
|
705
|
+
}
|
|
706
|
+
isComplete() {
|
|
707
|
+
return true;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
619
710
|
/**
|
|
620
711
|
* Create and populate the registry with method semantics
|
|
621
712
|
*/
|
|
@@ -645,6 +736,14 @@ export function createMethodRegistry() {
|
|
|
645
736
|
// Register React hooks
|
|
646
737
|
registry.register('useState', new UseStateSemantics(), 'React');
|
|
647
738
|
registry.register('useMemo', new UseMemoSemantics(), 'React');
|
|
739
|
+
// Register Set/Map collection methods.
|
|
740
|
+
// Only .has() and .delete() are safe to register by method name — they always
|
|
741
|
+
// return boolean regardless of the collection type (Set, Map, WeakSet, WeakMap,
|
|
742
|
+
// FormData, URLSearchParams, etc.).
|
|
743
|
+
// .add(), .clear(), .get(), .set() are too ambiguous across different types
|
|
744
|
+
// and can't be registered until the lookup code supports class-aware resolution.
|
|
745
|
+
registry.register('has', new CollectionHasSemantics());
|
|
746
|
+
registry.register('delete', new CollectionDeleteSemantics());
|
|
648
747
|
return registry;
|
|
649
748
|
}
|
|
650
749
|
// Create a singleton instance of the registry for use throughout the codebase
|