@codeyam/codeyam-cli 0.1.0-staging.c90f8c9 → 0.1.0-staging.c9dc00c

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.
Files changed (513) hide show
  1. package/analyzer-template/.build-info.json +7 -7
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/package.json +7 -7
  4. package/analyzer-template/packages/ai/index.ts +10 -2
  5. package/analyzer-template/packages/ai/package.json +2 -2
  6. package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +86 -18
  7. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +67 -9
  8. package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +41 -17
  9. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.ts +10 -17
  10. package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +308 -50
  11. package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +15 -6
  12. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +837 -243
  13. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +5 -1
  14. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.ts +16 -3
  15. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.ts +6 -4
  16. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +54 -3
  17. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +60 -15
  18. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.ts +70 -0
  19. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +80 -5
  20. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +179 -0
  21. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.ts +40 -30
  22. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +393 -97
  23. package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +58 -3
  24. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +283 -1
  25. package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +9 -5
  26. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +11 -3
  27. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +1 -1
  28. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +297 -7
  29. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +1 -1
  30. package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +51 -3
  31. package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +90 -96
  32. package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +10 -7
  33. package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +25 -13
  34. package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +4 -3
  35. package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +114 -2
  36. package/analyzer-template/packages/analyze/index.ts +2 -0
  37. package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +65 -59
  38. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +113 -26
  39. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +19 -0
  40. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.ts +19 -0
  41. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExports.ts +11 -0
  42. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.ts +8 -0
  43. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.ts +49 -1
  44. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.ts +2 -1
  45. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +71 -9
  46. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +19 -4
  47. package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +6 -0
  48. package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +4 -2
  49. package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +0 -3
  50. package/analyzer-template/packages/analyze/src/lib/files/analyzeRemixRoute.ts +4 -5
  51. package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +14 -12
  52. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1315 -0
  53. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +61 -13
  54. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +37 -0
  55. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +229 -19
  56. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +117 -9
  57. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +459 -39
  58. package/analyzer-template/packages/analyze/src/lib/files/scenarios/propagateArrayItemSchemas.ts +474 -0
  59. package/analyzer-template/packages/analyze/src/lib/files/setImportedExports.ts +2 -1
  60. package/analyzer-template/packages/analyze/src/lib/index.ts +1 -0
  61. package/analyzer-template/packages/analyze/src/lib/utils/getFileByPath.ts +19 -0
  62. package/analyzer-template/packages/aws/package.json +1 -1
  63. package/analyzer-template/packages/database/package.json +1 -1
  64. package/analyzer-template/packages/database/src/lib/analysisBranchToDb.ts +1 -1
  65. package/analyzer-template/packages/database/src/lib/analysisToDb.ts +1 -1
  66. package/analyzer-template/packages/database/src/lib/branchToDb.ts +1 -1
  67. package/analyzer-template/packages/database/src/lib/commitBranchToDb.ts +1 -1
  68. package/analyzer-template/packages/database/src/lib/commitToDb.ts +1 -1
  69. package/analyzer-template/packages/database/src/lib/fileToDb.ts +1 -1
  70. package/analyzer-template/packages/database/src/lib/kysely/db.ts +14 -1
  71. package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -0
  72. package/analyzer-template/packages/database/src/lib/kysely/tables/labsRequestsTable.ts +52 -0
  73. package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +13 -0
  74. package/analyzer-template/packages/database/src/lib/loadBranch.ts +16 -1
  75. package/analyzer-template/packages/database/src/lib/loadCommit.ts +11 -0
  76. package/analyzer-template/packages/database/src/lib/loadCommits.ts +12 -0
  77. package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +12 -0
  78. package/analyzer-template/packages/database/src/lib/projectToDb.ts +1 -1
  79. package/analyzer-template/packages/database/src/lib/saveFiles.ts +1 -1
  80. package/analyzer-template/packages/database/src/lib/scenarioToDb.ts +1 -1
  81. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +7 -14
  82. package/analyzer-template/packages/database/src/lib/userScenarioToDb.ts +1 -1
  83. package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js +1 -1
  84. package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js.map +1 -1
  85. package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js +1 -1
  86. package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js.map +1 -1
  87. package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js +1 -1
  88. package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js.map +1 -1
  89. package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js +1 -1
  90. package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js.map +1 -1
  91. package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js +1 -1
  92. package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js.map +1 -1
  93. package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js +1 -1
  94. package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js.map +1 -1
  95. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -0
  96. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  97. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +11 -1
  98. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  99. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts +1 -0
  100. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts.map +1 -1
  101. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js +3 -0
  102. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  103. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts +23 -0
  104. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts.map +1 -0
  105. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
  106. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
  107. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
  108. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +8 -0
  109. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
  110. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js +11 -1
  111. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js.map +1 -1
  112. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.d.ts.map +1 -1
  113. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js +7 -0
  114. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js.map +1 -1
  115. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  116. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +9 -0
  117. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  118. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.d.ts.map +1 -1
  119. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js +9 -0
  120. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js.map +1 -1
  121. package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js +1 -1
  122. package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js.map +1 -1
  123. package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js +1 -1
  124. package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js.map +1 -1
  125. package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js +1 -1
  126. package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js.map +1 -1
  127. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts +2 -2
  128. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  129. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +5 -4
  130. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  131. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts +2 -0
  132. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts.map +1 -1
  133. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +7 -0
  134. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  135. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +5 -5
  136. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  137. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  138. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  139. package/analyzer-template/packages/github/package.json +1 -1
  140. package/analyzer-template/packages/types/src/types/Commit.ts +2 -0
  141. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +7 -0
  142. package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +6 -5
  143. package/analyzer-template/packages/types/src/types/ScopeAnalysis.ts +6 -1
  144. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts +2 -0
  145. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts.map +1 -1
  146. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +7 -0
  147. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  148. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +5 -5
  149. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  150. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  151. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  152. package/analyzer-template/playwright/capture.ts +20 -8
  153. package/analyzer-template/playwright/captureStatic.ts +1 -1
  154. package/analyzer-template/project/analyzeBaselineCommit.ts +5 -0
  155. package/analyzer-template/project/analyzeRegularCommit.ts +5 -0
  156. package/analyzer-template/project/captureLibraryFunctionDirect.ts +29 -26
  157. package/analyzer-template/project/constructMockCode.ts +90 -10
  158. package/analyzer-template/project/createEntitiesAndSortFiles.ts +83 -0
  159. package/analyzer-template/project/loadReadyToBeCaptured.ts +65 -41
  160. package/analyzer-template/project/orchestrateCapture/AwsCaptureTaskRunner.ts +12 -4
  161. package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +11 -6
  162. package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
  163. package/analyzer-template/project/orchestrateCapture.ts +45 -6
  164. package/analyzer-template/project/start.ts +35 -11
  165. package/analyzer-template/project/writeMockDataTsx.ts +181 -8
  166. package/analyzer-template/project/writeScenarioComponents.ts +60 -12
  167. package/analyzer-template/project/writeSimpleRoot.ts +21 -11
  168. package/analyzer-template/scripts/comboWorkerLoop.cjs +98 -50
  169. package/background/src/lib/local/createLocalAnalyzer.js +1 -1
  170. package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
  171. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +5 -0
  172. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
  173. package/background/src/lib/virtualized/project/analyzeRegularCommit.js +5 -0
  174. package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
  175. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js +3 -3
  176. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js.map +1 -1
  177. package/background/src/lib/virtualized/project/constructMockCode.js +75 -4
  178. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  179. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js +73 -1
  180. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js.map +1 -1
  181. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js +19 -8
  182. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js.map +1 -1
  183. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js +2 -2
  184. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js.map +1 -1
  185. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +4 -4
  186. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
  187. package/background/src/lib/virtualized/project/orchestrateCapture.js +38 -6
  188. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  189. package/background/src/lib/virtualized/project/start.js +32 -11
  190. package/background/src/lib/virtualized/project/start.js.map +1 -1
  191. package/background/src/lib/virtualized/project/writeMockDataTsx.js +162 -4
  192. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  193. package/background/src/lib/virtualized/project/writeScenarioComponents.js +60 -15
  194. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  195. package/background/src/lib/virtualized/project/writeSimpleRoot.js +21 -11
  196. package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
  197. package/codeyam-cli/scripts/apply-setup.js +180 -0
  198. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  199. package/codeyam-cli/src/cli.js +4 -0
  200. package/codeyam-cli/src/cli.js.map +1 -1
  201. package/codeyam-cli/src/commands/analyze.js +2 -0
  202. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  203. package/codeyam-cli/src/commands/baseline.js +2 -0
  204. package/codeyam-cli/src/commands/baseline.js.map +1 -1
  205. package/codeyam-cli/src/commands/debug.js +9 -5
  206. package/codeyam-cli/src/commands/debug.js.map +1 -1
  207. package/codeyam-cli/src/commands/default.js +14 -4
  208. package/codeyam-cli/src/commands/default.js.map +1 -1
  209. package/codeyam-cli/src/commands/detect-universal-mocks.js +2 -0
  210. package/codeyam-cli/src/commands/detect-universal-mocks.js.map +1 -1
  211. package/codeyam-cli/src/commands/init.js +42 -184
  212. package/codeyam-cli/src/commands/init.js.map +1 -1
  213. package/codeyam-cli/src/commands/memory.js +264 -0
  214. package/codeyam-cli/src/commands/memory.js.map +1 -0
  215. package/codeyam-cli/src/commands/recapture.js +2 -0
  216. package/codeyam-cli/src/commands/recapture.js.map +1 -1
  217. package/codeyam-cli/src/commands/setup-sandbox.js +2 -0
  218. package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -1
  219. package/codeyam-cli/src/commands/setup-simulations.js +284 -0
  220. package/codeyam-cli/src/commands/setup-simulations.js.map +1 -0
  221. package/codeyam-cli/src/commands/test-startup.js +2 -0
  222. package/codeyam-cli/src/commands/test-startup.js.map +1 -1
  223. package/codeyam-cli/src/commands/verify.js +2 -0
  224. package/codeyam-cli/src/commands/verify.js.map +1 -1
  225. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +128 -86
  226. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  227. package/codeyam-cli/src/utils/analysisRunner.js +1 -1
  228. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  229. package/codeyam-cli/src/utils/analyzer.js +7 -0
  230. package/codeyam-cli/src/utils/analyzer.js.map +1 -1
  231. package/codeyam-cli/src/utils/backgroundServer.js +4 -0
  232. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  233. package/codeyam-cli/src/utils/install-skills.js +71 -46
  234. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  235. package/codeyam-cli/src/utils/labsAutoCheck.js +48 -0
  236. package/codeyam-cli/src/utils/labsAutoCheck.js.map +1 -0
  237. package/codeyam-cli/src/utils/progress.js +7 -0
  238. package/codeyam-cli/src/utils/progress.js.map +1 -1
  239. package/codeyam-cli/src/utils/queue/job.js +4 -0
  240. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  241. package/codeyam-cli/src/utils/requireSimulations.js +10 -0
  242. package/codeyam-cli/src/utils/requireSimulations.js.map +1 -0
  243. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js +82 -0
  244. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js.map +1 -0
  245. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +230 -0
  246. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -0
  247. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +67 -0
  248. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -0
  249. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js +105 -0
  250. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js.map +1 -0
  251. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js +34 -0
  252. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js.map +1 -0
  253. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js +162 -0
  254. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js.map +1 -0
  255. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +75 -0
  256. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -0
  257. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +378 -0
  258. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -0
  259. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +115 -0
  260. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -0
  261. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js +127 -0
  262. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js.map +1 -0
  263. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js +50 -0
  264. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js.map +1 -0
  265. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +116 -0
  266. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -0
  267. package/codeyam-cli/src/utils/ruleReflection/index.js +5 -0
  268. package/codeyam-cli/src/utils/ruleReflection/index.js.map +1 -0
  269. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js +44 -0
  270. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js.map +1 -0
  271. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js +85 -0
  272. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js.map +1 -0
  273. package/codeyam-cli/src/utils/ruleReflection/types.js +5 -0
  274. package/codeyam-cli/src/utils/ruleReflection/types.js.map +1 -0
  275. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +293 -0
  276. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
  277. package/codeyam-cli/src/utils/rules/index.js +6 -0
  278. package/codeyam-cli/src/utils/rules/index.js.map +1 -0
  279. package/codeyam-cli/src/utils/rules/parser.js +83 -0
  280. package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
  281. package/codeyam-cli/src/utils/rules/pathMatcher.js +18 -0
  282. package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -0
  283. package/codeyam-cli/src/utils/rules/ruleState.js +150 -0
  284. package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -0
  285. package/codeyam-cli/src/utils/rules/staleness.js +137 -0
  286. package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
  287. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +20 -43
  288. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  289. package/codeyam-cli/src/webserver/app/lib/database.js +15 -3
  290. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  291. package/codeyam-cli/src/webserver/backgroundServer.js +31 -0
  292. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  293. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CA3JxPb7.js +1 -0
  294. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-B86KKU7e.js +11 -0
  295. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-DLqD3qNt.js → EntityTypeBadge-B5ctlSYt.js} +1 -1
  296. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-Ba2JVPzP.js → EntityTypeIcon-BqY8gDAW.js} +1 -1
  297. package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-C8lyxW9k.js → InlineSpinner-ClaLpuOo.js} +1 -1
  298. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-aht4aafF.js → InteractivePreview-BDhPilK7.js} +2 -2
  299. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CVtiBnY5.js → LibraryFunctionPreview-VeqEBv9v.js} +1 -1
  300. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-B0GLXMsr.js → LoadingDots-Bs7Nn1Jr.js} +1 -1
  301. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-xgeCVgSM.js → LogViewer-Bm3PmcCz.js} +1 -1
  302. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-D4TZhLuw.js → ReportIssueModal-C6PKeMYR.js} +3 -13
  303. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-DuDvi0jm.js → SafeScreenshot-Gq3Ocjo6.js} +1 -1
  304. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-DEx02QDa.js → ScenarioViewer-BNLaXBHR.js} +3 -3
  305. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-DyFZkK0l.js → TruncatedFilePath-CiwXDxLh.js} +1 -1
  306. package/codeyam-cli/src/webserver/build/client/assets/{_index-BwqWJOgH.js → _index-B3TDXxnk.js} +1 -1
  307. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-DoLIqZX2.js → activity.(_tab)-BtBFH820.js} +6 -16
  308. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-CN61MOMa.js +11 -0
  309. package/codeyam-cli/src/webserver/build/client/assets/api.labs-survey-l0sNRNKZ.js +1 -0
  310. package/codeyam-cli/src/webserver/build/client/assets/api.labs-unlock-l0sNRNKZ.js +1 -0
  311. package/codeyam-cli/src/webserver/build/client/assets/api.memory-profile-l0sNRNKZ.js +1 -0
  312. package/codeyam-cli/src/webserver/build/client/assets/api.save-fixture-l0sNRNKZ.js +1 -0
  313. package/codeyam-cli/src/webserver/build/client/assets/book-open-PttOB2SF.js +6 -0
  314. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-Cx24_aWc.js → chevron-down-TJp6ofnp.js} +1 -1
  315. package/codeyam-cli/src/webserver/build/client/assets/{chunk-EPOLDU6W-CXRTFQ3F.js → chunk-JZWAC4HX-JE9ZIoBl.js} +12 -12
  316. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BOARzkeR.js → circle-check-CXhHQYrI.js} +1 -1
  317. package/codeyam-cli/src/webserver/build/client/assets/copy-6y9ALfGT.js +11 -0
  318. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-BdhJEx6B.js → createLucideIcon-Ca9fAY46.js} +1 -1
  319. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-C5lqplTC.js +1 -0
  320. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-C2N4Op8e.js → entity._sha._-n38keI1k.js} +10 -10
  321. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js → entity._sha.scenarios._scenarioId.fullscreen-CBoafmVs.js} +1 -1
  322. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-D1T4TGjf.js → entity._sha_.create-scenario-DGgZjdFg.js} +1 -1
  323. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CTBG2mmz.js → entity._sha_.edit._scenarioId-38yPijoD.js} +1 -1
  324. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-CS2cb_eZ.js → entry.client-BSHEfydn.js} +1 -1
  325. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DMJ7zii9.js → fileTableUtils-DCPhhSMo.js} +1 -1
  326. package/codeyam-cli/src/webserver/build/client/assets/files-0N0YJQv7.js +1 -0
  327. package/codeyam-cli/src/webserver/build/client/assets/{git-B4RJRvYB.js → git-DXnyr8uP.js} +8 -8
  328. package/codeyam-cli/src/webserver/build/client/assets/globals-EVn6Z9pz.css +1 -0
  329. package/codeyam-cli/src/webserver/build/client/assets/{index-lzqtyFU8.js → index-CcsFv748.js} +1 -1
  330. package/codeyam-cli/src/webserver/build/client/assets/{index-B1h680n5.js → index-ChN9-fAY.js} +1 -1
  331. package/codeyam-cli/src/webserver/build/client/assets/labs-CmBYA0PH.js +1 -0
  332. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-B7B9V-bu.js → loader-circle-CTqLEAGU.js} +1 -1
  333. package/codeyam-cli/src/webserver/build/client/assets/manifest-aa4ff97b.js +1 -0
  334. package/codeyam-cli/src/webserver/build/client/assets/memory-BSlqS1QA.js +81 -0
  335. package/codeyam-cli/src/webserver/build/client/assets/pause-D6vreykR.js +11 -0
  336. package/codeyam-cli/src/webserver/build/client/assets/root-DVAbJY8B.js +62 -0
  337. package/codeyam-cli/src/webserver/build/client/assets/{search-CxXUmBSd.js → search-B8VUL8nl.js} +1 -1
  338. package/codeyam-cli/src/webserver/build/client/assets/settings-BK-cnzp-.js +1 -0
  339. package/codeyam-cli/src/webserver/build/client/assets/{simulations-DwFIBT09.js → simulations-CPoAg7Zo.js} +1 -1
  340. package/codeyam-cli/src/webserver/build/client/assets/terminal-BrCP7uQo.js +11 -0
  341. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-B6LgvRJg.js → triangle-alert-BZz2NjYa.js} +1 -1
  342. package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-C1v1PQzo.js → useCustomSizes-DNwUduNu.js} +1 -1
  343. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-aSv48UbS.js → useLastLogLine-COky1GVF.js} +1 -1
  344. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-DYxHZQuP.js → useReportContext-CpZgwliL.js} +1 -1
  345. package/codeyam-cli/src/webserver/build/client/assets/{useToast-mBRpZPiu.js → useToast-Bv9JFvUO.js} +1 -1
  346. package/codeyam-cli/src/webserver/build/server/assets/index-Cz2RkDCa.js +1 -0
  347. package/codeyam-cli/src/webserver/build/server/assets/server-build-CUVsWicu.js +260 -0
  348. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  349. package/codeyam-cli/src/webserver/build-info.json +5 -5
  350. package/codeyam-cli/templates/{codeyam-power-rules-hook.sh → codeyam-memory-hook.sh} +12 -13
  351. package/codeyam-cli/templates/codeyam:diagnose.md +195 -496
  352. package/codeyam-cli/templates/codeyam:memory.md +403 -0
  353. package/codeyam-cli/templates/codeyam:new-rule.md +2 -2
  354. package/codeyam-cli/templates/codeyam:setup.md +12 -0
  355. package/codeyam-cli/templates/rule-notification-hook.py +56 -0
  356. package/codeyam-cli/templates/rule-reflection-hook.py +627 -0
  357. package/codeyam-cli/templates/rules-instructions.md +136 -0
  358. package/package.json +8 -6
  359. package/packages/ai/index.js +3 -2
  360. package/packages/ai/index.js.map +1 -1
  361. package/packages/ai/src/lib/analyzeScope.js +68 -13
  362. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  363. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +54 -8
  364. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  365. package/packages/ai/src/lib/astScopes/methodSemantics.js +41 -17
  366. package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
  367. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js +10 -14
  368. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js.map +1 -1
  369. package/packages/ai/src/lib/astScopes/processExpression.js +239 -43
  370. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  371. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +654 -166
  372. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  373. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +5 -1
  374. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
  375. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js +13 -3
  376. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -1
  377. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +6 -4
  378. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -1
  379. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +52 -3
  380. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  381. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +55 -11
  382. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  383. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js +63 -0
  384. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js.map +1 -0
  385. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +73 -5
  386. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
  387. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +173 -0
  388. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -0
  389. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js +37 -20
  390. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js.map +1 -1
  391. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +333 -86
  392. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
  393. package/packages/ai/src/lib/generateEntityDataStructure.js +46 -2
  394. package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
  395. package/packages/ai/src/lib/generateEntityScenarioData.js +205 -1
  396. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  397. package/packages/ai/src/lib/generateEntityScenarios.js +7 -1
  398. package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
  399. package/packages/ai/src/lib/generateExecutionFlows.js +10 -2
  400. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
  401. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +209 -3
  402. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -1
  403. package/packages/ai/src/lib/isolateScopes.js +39 -3
  404. package/packages/ai/src/lib/isolateScopes.js.map +1 -1
  405. package/packages/ai/src/lib/mergeStatements.js +70 -51
  406. package/packages/ai/src/lib/mergeStatements.js.map +1 -1
  407. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +10 -4
  408. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
  409. package/packages/ai/src/lib/resolvePathToControllable.js +24 -14
  410. package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -1
  411. package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
  412. package/packages/ai/src/lib/worker/analyzeScopeWorker.js +94 -1
  413. package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
  414. package/packages/analyze/index.js +1 -0
  415. package/packages/analyze/index.js.map +1 -1
  416. package/packages/analyze/src/lib/FileAnalyzer.js +60 -36
  417. package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
  418. package/packages/analyze/src/lib/ProjectAnalyzer.js +96 -26
  419. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  420. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +14 -0
  421. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -1
  422. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js +14 -0
  423. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js.map +1 -1
  424. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js +6 -0
  425. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js.map +1 -1
  426. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js +6 -0
  427. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js.map +1 -1
  428. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js +39 -1
  429. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js.map +1 -1
  430. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js +2 -1
  431. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js.map +1 -1
  432. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +54 -6
  433. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  434. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +17 -4
  435. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  436. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +5 -0
  437. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
  438. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +2 -1
  439. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
  440. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +0 -3
  441. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
  442. package/packages/analyze/src/lib/files/analyzeRemixRoute.js +3 -2
  443. package/packages/analyze/src/lib/files/analyzeRemixRoute.js.map +1 -1
  444. package/packages/analyze/src/lib/files/getImportedExports.js +11 -7
  445. package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
  446. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +880 -0
  447. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -0
  448. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +56 -10
  449. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
  450. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +33 -8
  451. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  452. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +150 -17
  453. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  454. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +56 -8
  455. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
  456. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +399 -31
  457. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  458. package/packages/analyze/src/lib/files/setImportedExports.js +2 -1
  459. package/packages/analyze/src/lib/files/setImportedExports.js.map +1 -1
  460. package/packages/analyze/src/lib/index.js +1 -0
  461. package/packages/analyze/src/lib/index.js.map +1 -1
  462. package/packages/analyze/src/lib/utils/getFileByPath.js +12 -0
  463. package/packages/analyze/src/lib/utils/getFileByPath.js.map +1 -0
  464. package/packages/database/src/lib/analysisBranchToDb.js +1 -1
  465. package/packages/database/src/lib/analysisBranchToDb.js.map +1 -1
  466. package/packages/database/src/lib/analysisToDb.js +1 -1
  467. package/packages/database/src/lib/analysisToDb.js.map +1 -1
  468. package/packages/database/src/lib/branchToDb.js +1 -1
  469. package/packages/database/src/lib/branchToDb.js.map +1 -1
  470. package/packages/database/src/lib/commitBranchToDb.js +1 -1
  471. package/packages/database/src/lib/commitBranchToDb.js.map +1 -1
  472. package/packages/database/src/lib/commitToDb.js +1 -1
  473. package/packages/database/src/lib/commitToDb.js.map +1 -1
  474. package/packages/database/src/lib/fileToDb.js +1 -1
  475. package/packages/database/src/lib/fileToDb.js.map +1 -1
  476. package/packages/database/src/lib/kysely/db.js +11 -1
  477. package/packages/database/src/lib/kysely/db.js.map +1 -1
  478. package/packages/database/src/lib/kysely/tables/commitsTable.js +3 -0
  479. package/packages/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  480. package/packages/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
  481. package/packages/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
  482. package/packages/database/src/lib/loadAnalysis.js +8 -0
  483. package/packages/database/src/lib/loadAnalysis.js.map +1 -1
  484. package/packages/database/src/lib/loadBranch.js +11 -1
  485. package/packages/database/src/lib/loadBranch.js.map +1 -1
  486. package/packages/database/src/lib/loadCommit.js +7 -0
  487. package/packages/database/src/lib/loadCommit.js.map +1 -1
  488. package/packages/database/src/lib/loadCommits.js +9 -0
  489. package/packages/database/src/lib/loadCommits.js.map +1 -1
  490. package/packages/database/src/lib/loadEntityBranches.js +9 -0
  491. package/packages/database/src/lib/loadEntityBranches.js.map +1 -1
  492. package/packages/database/src/lib/projectToDb.js +1 -1
  493. package/packages/database/src/lib/projectToDb.js.map +1 -1
  494. package/packages/database/src/lib/saveFiles.js +1 -1
  495. package/packages/database/src/lib/saveFiles.js.map +1 -1
  496. package/packages/database/src/lib/scenarioToDb.js +1 -1
  497. package/packages/database/src/lib/scenarioToDb.js.map +1 -1
  498. package/packages/database/src/lib/updateCommitMetadata.js +5 -4
  499. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  500. package/scripts/finalize-analyzer.cjs +8 -76
  501. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-BXhEawa3.js +0 -1
  502. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BRb-0kQl.js +0 -1
  503. package/codeyam-cli/src/webserver/build/client/assets/files-Cs4MdYtv.js +0 -1
  504. package/codeyam-cli/src/webserver/build/client/assets/git-commit-horizontal-CysbcZxi.js +0 -6
  505. package/codeyam-cli/src/webserver/build/client/assets/globals-DMUaGAqV.css +0 -1
  506. package/codeyam-cli/src/webserver/build/client/assets/manifest-f874c610.js +0 -1
  507. package/codeyam-cli/src/webserver/build/client/assets/root-Bz5TunQg.js +0 -57
  508. package/codeyam-cli/src/webserver/build/client/assets/rules-hEkvVw2-.js +0 -97
  509. package/codeyam-cli/src/webserver/build/client/assets/settings-CS5f3WzT.js +0 -1
  510. package/codeyam-cli/src/webserver/build/server/assets/index-uNNbimct.js +0 -1
  511. package/codeyam-cli/src/webserver/build/server/assets/server-build-B08qC4Y7.js +0 -257
  512. package/codeyam-cli/templates/codeyam:power-rules.md +0 -449
  513. /package/codeyam-cli/src/webserver/build/client/assets/{api.rules-l0sNRNKZ.js → api.agent-transcripts-l0sNRNKZ.js} +0 -0
@@ -2,100 +2,60 @@
2
2
 
3
3
  When a user asks to debug a scenario or analysis (e.g., `/codeyam:diagnose [ID]`), use this systematic process.
4
4
 
5
- ## Goal
5
+ ## Goal & Rules
6
6
 
7
- **Capture quality screenshots** by fixing all errors, then document what was wrong. Every issue can be fixed locally—the question is whether the fix is in the database (Categories 1-3) or in the tmp folder code (Category 4). Either way, you must capture screenshots before concluding.
7
+ **Goal:** Capture quality screenshots by fixing all errors, then document what was wrong.
8
8
 
9
- ## Definition of Done
9
+ **Definition of Done** — debugging is NOT complete until one of:
10
10
 
11
- **Debugging is NOT complete until one of these conditions is met:**
11
+ | Outcome | What's Required |
12
+ | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
13
+ | **SUCCESS (DB Fix)** | Issue fixed via database/config changes, screenshots recaptured, all files verified on disk AND visually inspected |
14
+ | **SUCCESS (File Fix)** | Issue fixed via tmp folder edits, screenshots recaptured with `--capture-only`, all files verified AND visually inspected, changes documented |
15
+ | **UNFIXABLE** | Issue cannot be fixed locally (rare), documented in final report with full details |
12
16
 
13
- 1. **SUCCESS (Database Fix)**: Issue fixed via database/config changes, screenshots recaptured, ALL screenshot files verified on disk AND visually inspected
14
- 2. **SUCCESS (File Fix)**: Issue fixed via tmp folder edits, screenshots recaptured with `--capture-only`, ALL screenshot files verified AND visually inspected, changes documented for CodeYam team
15
- 3. **UNFIXABLE**: Issue cannot be fixed locally (rare), documented in final report with full details
17
+ ### KEY RULE 1: Never stop before capturing screenshots
16
18
 
17
- **CRITICAL: NEVER stop debugging before capturing quality screenshots.** Even if you identify the root cause as a "Category 4 engine bug", you MUST:
19
+ Category 4 ("engine bug") is a **diagnosis category, not a blocker**. You have full access to edit any file in `/tmp/codeyam/local-dev/{slug}/project/` — the "engine" just wrote those files as plain TypeScript/JavaScript. Every issue can be fixed locally.
18
20
 
19
- 1. Fix the issue manually in the tmp folder (this is always possible)
20
- 2. Run `codeyam recapture --capture-only` to capture screenshots with your fixes in place
21
- 3. Verify the screenshots show the component rendering correctly
22
- 4. ONLY THEN document the engine bug for the CodeYam team
21
+ If you find yourself thinking "this requires an engine-level fix" or "this is blocked by a code generation bug" — **STOP**.
23
22
 
24
- Stopping after identifying a bug category without capturing screenshots defeats the purpose of debugging.
23
+ - Fix the files in the tmp folder, then capture screenshots, THEN document the bug
24
+ - Try at least 3 different approaches before asking the user whether to continue
25
+ - Only stop when the user agrees or you've captured quality screenshots
25
26
 
26
- ## Critical: Persistence and User Communication
27
+ ### KEY RULE 2: Original Repo vs Tmp Folder
27
28
 
28
- **DO NOT give up prematurely.** Every issue can be fixed by editing files in the tmp folder. If you find yourself thinking:
29
+ | Location | What's There | Use For |
30
+ | --------------------------------------------------------- | ------------------------------------------------------------------- | ----------------------------------------------------- |
31
+ | **Original Repo** (your working directory) | Database (`.codeyam/db.sqlite3`), config, universal mocks, captures | **Run all `codeyam` commands here** |
32
+ | **Tmp Folder** (`/tmp/codeyam/local-dev/{slug}/project/`) | Copy of project with mock injections, generated scenario files | **Only edit files here — never run codeyam commands** |
29
33
 
30
- - "This requires an engine-level fix"
31
- - "This is blocked by a code generation bug"
32
- - "The engine doesn't properly handle X"
34
+ Running `codeyam recapture` from the tmp folder fails with "Not in a CodeYam project" because the database isn't there.
33
35
 
34
- **STOP.** These statements are incorrect. You have full access to edit any file in `/tmp/codeyam/local-dev/{slug}/project/`. The "engine" just wrote those files—they're plain TypeScript/JavaScript that you can edit directly.
36
+ ### KEY RULE 3: Never modify client code
35
37
 
36
- ### Before Stopping or Concluding
38
+ Fix the **mock data or mock code** — never the client's components or application code. The client's code is sacred. Our job is to make the simulation environment correct. You CAN modify:
37
39
 
38
- 1. **Try at least 3 different approaches** to fix the issue
39
- 2. **Never unilaterally decide to stop.** If you've been debugging and aren't making progress, ASK THE USER:
40
- > "I've tried X, Y, and Z but haven't resolved the issue yet. Would you like me to continue investigating other approaches, or should I document what I've found so far?"
41
- 3. **Only stop when the user agrees** or when you've successfully captured quality screenshots
40
+ - Database data (`.codeyam/db.sqlite3`) in Original Repo
41
+ - Universal mocks (`.codeyam/universal-mocks`) in Original Repo
42
+ - Generated files in tmp folder (`__codeyamMocks__/`, layouts, routes)
42
43
 
43
- ### The "Engine Bug" Misconception
44
+ ### KEY RULE 4: `--capture-only` preserves tmp folder edits
44
45
 
45
- When you identify a Category 4 issue (code generation bug), this does NOT mean you're blocked. It means:
46
+ - `codeyam recapture ID` regenerates files from database, then captures (overwrites tmp edits)
47
+ - `codeyam recapture ID --capture-only` — captures without regenerating (preserves your edits)
48
+ - `codeyam debug ID` — regenerates files only (also overwrites tmp edits)
46
49
 
47
- - The bug is in how CodeYam generates code (useful info for the CodeYam team)
48
- - You MUST still fix it manually by editing files in the tmp folder
49
- - You MUST still capture quality screenshots
50
- - You document what you fixed so the CodeYam team can improve the engine
51
-
52
- **"Engine bug" is a diagnosis category, not an excuse to stop.**
50
+ If you edited files in the tmp folder, you **MUST** use `--capture-only` when recapturing.
53
51
 
54
52
  ---
55
53
 
56
- ## Debug Flow Summary
54
+ ## Setup
57
55
 
58
- ```
59
- ┌─────────────────────────────────────────────────────────────────────┐
60
- │ Step 0: Query database for scenario status (DO THIS FIRST!) │
61
- │ Check ALL scenarios in the analysis for failures │
62
- │ Retrieve the analysis id to use in the debug command │
63
- │ │ │
64
- │ ▼ │
65
- │ Step 1: Copy the logs to a temporary location (see below). |
66
- | Step 2: codeyam debug [ANALYSIS ID] (generates files to inspect) │
67
- │ Step 3: Identify error type from logs/output │
68
- │ Step 4: Diagnose root cause category (1-4) │
69
- │ Step 5: Attempt fix (database edit or universal mock) │
70
- │ Step 6: Verify locally (curl returns 200) │
71
- │ │ │
72
- │ ┌─────────┴─────────┐ │
73
- │ ▼ ▼ │
74
- │ Fix worked Fix didn't work │
75
- │ (DB changes) │ │
76
- │ │ ▼ │
77
- │ │ Step 5a: Fix code in tmp folder │
78
- │ │ (edit files directly, track changes) │
79
- │ │ │ │
80
- │ │ ▼ │
81
- │ │ Verify without regenerating │
82
- │ │ │ │
83
- │ ▼ ▼ │
84
- │ Step 7: Recapture Step 7: Recapture --capture-only │
85
- │ (normal) (preserves file fixes) │
86
- │ │ │ │
87
- │ └─────────┬─────────┘ │
88
- │ ▼ │
89
- │ Step 8: Verify screenshots (check for client-side errors) │
90
- │ │ │
91
- │ ▼ │
92
- │ Verify ALL files exist on disk │
93
- │ │ │
94
- │ ▼ │
95
- │ ✅ DONE - Produce Final Debug Report │
96
- │ (document ALL changes for CodeYam team) │
97
- └─────────────────────────────────────────────────────────────────────┘
98
- ```
56
+ ### Note Key Locations
57
+
58
+ **Database:** The codeyam database relevant for this command should always be found in the repo where this command is called in the `.codeyam/db.sqlite3` file.
99
59
 
100
60
  **Logs:** Before debugging copy the original logs to a temorary location as the debugging will overwrite these logs and they are valuable for debugging issues.
101
61
 
@@ -117,15 +77,12 @@ At the **very start** of debugging, create `.codeyam/debug-session.md` in the **
117
77
  ```markdown
118
78
  # Debug Session Context
119
79
 
120
- **IMPORTANT**: Keep a todo item "📍 Re-read debug session context" that is NEVER marked complete.
121
- If the todo disappears, add it back immediately.
122
-
123
80
  ## Key Locations
124
81
 
125
- - **Original project**: [FULL PATH - run all codeyam commands here]
126
- - **Tmp folder**: /tmp/codeyam/local-dev/[SLUG]/project (edit files here, do NOT run codeyam commands)
127
- - **Database**: [ORIGINAL PROJECT]/.codeyam/db.sqlite3
128
- - **Logs**: /tmp/codeyam/local-dev/[SLUG]/codeyam/log.txt
82
+ - **Original Repo**: [FULL PATH]
83
+ - **Tmp Folder**: /tmp/codeyam/local-dev/[PROJECT SLUG]/project
84
+ - **Database**: [Original Repo]/.codeyam/db.sqlite3
85
+ - **Logs**: /tmp/codeyam/local-dev/[PROJECT SLUG]/codeyam/log.txt
129
86
 
130
87
  ## IDs
131
88
 
@@ -133,198 +90,109 @@ If the todo disappears, add it back immediately.
133
90
  - **Scenario ID**: [ID]
134
91
  - **Entity**: [NAME] at [FILE PATH]
135
92
 
136
- ## URLs (fill in after running codeyam debug)
93
+ ## URLs (fill in after codeyam debug)
137
94
 
138
95
  - **Scenario URL**: http://localhost:[PORT]/static/codeyam-sample
139
- - **Dev server port**: [PORT from codeyam debug output]
140
-
141
- ## Commands Reference
142
-
143
- All commands run from: [ORIGINAL PROJECT PATH]
144
-
145
- - `codeyam debug [ANALYSIS_ID]` - regenerate files (overwrites tmp folder!)
146
- - `codeyam recapture [ID]` - regenerate AND capture (overwrites tmp folder!)
147
- - `codeyam recapture [ID] --capture-only` - capture WITHOUT regenerating (preserves your edits)
148
- - `codeyam test-startup` - test startup (overwrites tmp folder!)
149
- ```
150
-
151
- ### Step 2: Create Persistent Todo
152
-
153
- Use TodoWrite to create this todo list with the first item being a persistent reminder:
154
-
155
- ```
156
- 📍 Re-read .codeyam/debug-session.md before any codeyam command (NEVER complete this)
157
- ```
158
-
159
- **CRITICAL**: The first todo item must NEVER be marked as completed. It serves as a constant reminder to check your session context before running commands. If you accidentally complete it or it disappears, add it back immediately.
160
-
161
- ### Step 3: Read Context Before Actions
162
-
163
- **Before running ANY of these commands**, re-read `.codeyam/debug-session.md`:
164
-
165
- - `codeyam debug`
166
- - `codeyam recapture`
167
- - `codeyam test-startup`
168
- - Any database queries
169
-
170
- This prevents running commands from the wrong directory or forgetting key IDs.
171
-
172
- ---
173
-
174
- ## Critical: Where to Run Commands
175
-
176
- **All `codeyam` commands MUST be run from the ORIGINAL PROJECT DIRECTORY**, not from the tmp folder.
177
-
178
- | Location | What's There | Run Commands Here? |
179
- | ---------------------------------------------------------------------- | -------------------------------------------------------------- | ------------------------------------------------- |
180
- | **Original project** (e.g., `/Users/.../clients-codeyam/boltwise/app`) | Database (`.codeyam/db.sqlite3`), config, universal mocks | **YES - run all codeyam commands here** |
181
- | **Tmp folder** (`/tmp/codeyam/local-dev/{slug}/project/`) | Copy of project with mock injections, generated scenario files | **NO - only edit files here, don't run commands** |
182
-
183
- **Common mistake:** Running `codeyam recapture` from the tmp folder. This will fail with "Not in a CodeYam project" because the database doesn't exist there.
184
-
185
- ```bash
186
- # WRONG - running from tmp folder
187
- cd /tmp/codeyam/local-dev/boltwise-app/project
188
- codeyam recapture abc123 # ❌ Fails: "Not in a CodeYam project"
189
-
190
- # CORRECT - running from original project directory
191
- cd /Users/jaredcosulich/workspace/codeyam/clients-codeyam/boltwise/app
192
- codeyam recapture abc123 # ✅ Works
193
96
  ```
194
97
 
195
- **Workflow:**
98
+ Re-read this file before running any `codeyam` command to avoid running commands from the wrong directory.
196
99
 
197
- 1. Edit files in `/tmp/codeyam/local-dev/{slug}/project/` to fix issues
198
- 2. Test by curling the dev server running from the tmp folder
199
- 3. **Switch back to the original project directory** to run `codeyam recapture`
100
+ ### Copy Original Logs
200
101
 
201
- ---
102
+ Copy logs before debugging overwrites them:
202
103
 
203
- ## What You Can and Cannot Modify
204
-
205
- **NEVER modify the client's original source code in the workspace.** Only modify files in the tmp folder.
206
-
207
- **You CAN modify:**
208
-
209
- - Data in the local SQLite database (`.codeyam/db.sqlite3`) - in the **original project directory**
210
- - Universal mocks in `.codeyam/universal-mocks` - in the **original project directory**
211
- - **Files in `/tmp/codeyam/local-dev/{slug}/project/`** - These are temporary copies used for simulation
212
- - Generated mock files in `__codeyamMocks__/` directories
213
- - Layout/route files that wrap scenarios
214
- - Any generated code that has errors
215
- - Mock data files for testing
216
-
217
- **IMPORTANT**: When you edit files in the tmp folder, you MUST use `codeyam recapture --capture-only` when recapturing, otherwise your changes will be overwritten! Be sure to address all issues so that the simulation runs correctly. Then, if one of the issues required editing code in the tmp directory you MUST use `codeyam recapture --capture-only`, but if only data was changed then as long as that data is updated in the local database as well you can run `codeyam recapture` and have the system overwrite the tmp project code and use the valid data from the database.
104
+ - **From:** `/tmp/codeyam/local-dev/{slug}/codeyam/logs.txt`
105
+ - **To:** `/tmp/codeyam/local-dev/{slug}/debug/original-logs.txt`
218
106
 
219
107
  ---
220
108
 
221
- ## Step 0: Check for Other Failing Scenarios (MANDATORY FIRST STEP)
109
+ ## Step 1: Check Database (MANDATORY FIRST STEP)
222
110
 
223
- **DO NOT run `codeyam debug` yet!** First, query the database to check if other scenarios in the same analysis are also failing.
111
+ **DO NOT run `codeyam debug` yet!** First check if other scenarios in the same analysis are also failing.
224
112
 
225
113
  ```bash
226
- # First, get the analysis ID (if you have a scenario ID)
114
+ # Get analysis ID (if you have a scenario ID)
227
115
  sqlite3 .codeyam/db.sqlite3 "SELECT analysis_id FROM scenarios WHERE id = 'SCENARIO_ID'"
228
116
 
229
- # Then check ALL scenarios for that analysis
117
+ # Check ALL scenarios for that analysis
230
118
  sqlite3 .codeyam/db.sqlite3 "
231
- SELECT
232
- s.id,
233
- s.name,
234
- json_extract(s.metadata, '$.screenshotPaths') as screenshots
235
- FROM scenarios s
236
- WHERE s.analysis_id = 'ANALYSIS_ID'
237
- "
119
+ SELECT s.id, s.name, json_extract(s.metadata, '$.screenshotPaths') as screenshots
120
+ FROM scenarios s WHERE s.analysis_id = 'ANALYSIS_ID'"
238
121
 
239
122
  # Check for errors in scenario status
240
123
  sqlite3 .codeyam/db.sqlite3 "
241
- SELECT json_extract(status, '$.scenarios') FROM analyses WHERE id = 'ANALYSIS_ID'
242
- "
124
+ SELECT json_extract(status, '$.scenarios') FROM analyses WHERE id = 'ANALYSIS_ID'"
243
125
  ```
244
126
 
245
- **If multiple scenarios are failing, ASK THE USER** whether to fix just the requested scenario or all failing scenarios.
127
+ **If multiple scenarios failing, ASK THE USER** whether to fix just the requested one or all.
246
128
 
247
- ### Check for Client-Side Errors in Screenshots
129
+ ### Check Existing Screenshots for Client-Side Errors
248
130
 
249
- **IMPORTANT:** Even if the database shows no errors and screenshots exist, the scenario may still have a client-side error. Use the Read tool to view the screenshot file and check for:
131
+ Even if screenshots exist, view them with the Read tool and check for:
250
132
 
251
- - Red error boundaries or error messages in the rendered UI
133
+ - Red error boundaries or React error overlays
252
134
  - "Something went wrong" or similar error text
253
135
  - Blank/white screens that should have content
254
- - React error overlays
255
136
 
256
- ```bash
257
- # View the screenshot to check for client-side errors
258
- # Use the Read tool on the screenshot path from the database
259
- ```
260
-
261
- If the screenshot shows a client-side error, proceed to Step 1 to debug it.
137
+ If the screenshot shows errors, proceed to Step 2.
262
138
 
263
139
  ---
264
140
 
265
- ## Step 1: Run Debug Command
141
+ ## Step 2: Run Debug Command
266
142
 
267
143
  ```bash
268
144
  codeyam debug ANALYSIS_ID
269
145
  ```
270
146
 
271
- Output includes:
272
-
273
- - **Project path**: `/tmp/codeyam/local-dev/{slug}/project`
274
- - **Start command**: How to run the dev server
275
- - **URL**: Where to access the scenario
276
- - **Log path**: Where to watch for errors
147
+ Output includes: **project path**, **start command**, **URL**, **log path**. Update your session context file with these.
277
148
 
278
149
  ---
279
150
 
280
- ## Step 2: Identify the Error Type
151
+ ## Step 3: Identify Error Type
281
152
 
282
- Read the log file or error output to categorize the issue:
153
+ Read the log file or error output to categorize:
283
154
 
284
- | Error Type | Symptoms | Likely Category |
285
- | ---------------------------------- | ----------------------------------- | ---------------------------------------- |
286
- | **Syntax error in generated file** | `Unexpected token`, `Parse error` | Category 4 (mock code writing) |
287
- | **Runtime error** | `TypeError`, `ReferenceError` | Category 1-3 (data issue) or 4 |
288
- | **Missing mock** | `Cannot read property of undefined` | Category 1-2 (missing in data structure) |
289
- | **Wrong mock type** | `X is not a function` | Category 3-4 (wrong data or mock code) |
155
+ | Error Type | Symptoms | Likely Category |
156
+ | ---------------------------------- | ----------------------------------- | ----------------- |
157
+ | **Syntax error in generated file** | `Unexpected token`, `Parse error` | Category 4 |
158
+ | **Runtime error** | `TypeError`, `ReferenceError` | Category 1-3 or 4 |
159
+ | **Missing mock** | `Cannot read property of undefined` | Category 1-2 |
160
+ | **Wrong mock type** | `X is not a function` | Category 3-4 |
290
161
 
291
162
  ---
292
163
 
293
- ## Step 3: Diagnose Root Cause Category
164
+ ## Step 4: Diagnose Root Cause Category
294
165
 
295
- This is the most important step. Determine WHERE in the pipeline the bug originated.
166
+ Determine WHERE in the pipeline the bug originated.
296
167
 
297
168
  ### The 4 Error Categories
298
169
 
299
- | Category | What's Wrong | Where to Check | Fixable Locally? |
300
- | -------- | ---------------------------------------------------- | ------------------------- | ----------------------------- |
301
- | **1** | Missing attribute in `isolatedDataStructure` | `entities.metadata` | Sometimes (re-analyze) |
302
- | **2** | Attribute not merged into `mergedDataStructure` | `analyses.metadata` | Sometimes (re-analyze) |
303
- | **3** | Data structure complete, but scenario data wrong | `scenarios.metadata` | Yes (edit mockData) |
304
- | **4** | Data complete, but mock code/mock data written wrong | Generated files in `/tmp` | **Yes (edit files directly)** |
170
+ | Category | What's Wrong | Where to Check | Fix |
171
+ | -------- | ------------------------------------------------ | -------------------- | ------------------- |
172
+ | **1** | Missing attribute in `isolatedDataStructure` | `entities.metadata` | Re-analyze |
173
+ | **2** | Attribute not merged into `mergedDataStructure` | `analyses.metadata` | Re-analyze |
174
+ | **3** | Data structure complete, but scenario data wrong | `scenarios.metadata` | Edit mockData in DB |
175
+ | **4** | Data complete, but generated code wrong | Files in `/tmp` | Edit files directly |
305
176
 
306
177
  ### Diagnostic Queries
307
178
 
308
179
  ```bash
309
180
  # Category 1: Check isolatedDataStructure
310
- # Is the attribute traced at all in the entity?
311
181
  sqlite3 .codeyam/db.sqlite3 \
312
182
  "SELECT json_extract(metadata, '$.isolatedDataStructure') FROM entities WHERE sha = 'ENTITY_SHA'" \
313
183
  | python3 -m json.tool
314
184
 
315
185
  # Category 2: Check mergedDataStructure
316
- # Was the attribute properly merged from dependencies?
317
186
  sqlite3 .codeyam/db.sqlite3 \
318
187
  "SELECT json_extract(metadata, '$.mergedDataStructure') FROM analyses WHERE id = 'ANALYSIS_ID'" \
319
188
  | python3 -m json.tool
320
189
 
321
- # Category 2 (also check): scenariosDataStructure
190
+ # Category 2 (also): scenariosDataStructure
322
191
  sqlite3 .codeyam/db.sqlite3 \
323
192
  "SELECT json_extract(metadata, '$.scenariosDataStructure') FROM analyses WHERE id = 'ANALYSIS_ID'" \
324
193
  | python3 -m json.tool
325
194
 
326
195
  # Category 3: Check scenario mockData
327
- # Did the LLM generate correct mock data?
328
196
  sqlite3 .codeyam/db.sqlite3 \
329
197
  "SELECT json_extract(metadata, '$.data.mockData') FROM scenarios WHERE id = 'SCENARIO_ID'" \
330
198
  | python3 -m json.tool
@@ -332,49 +200,41 @@ sqlite3 .codeyam/db.sqlite3 \
332
200
 
333
201
  ### Diagnosis Flow
334
202
 
335
- 1. **Start with the error** - What attribute/value is missing or wrong at runtime?
336
- 2. **Check `isolatedDataStructure`** - Is the attribute traced in the entity? If missing → Category 1
337
- 3. **Check `mergedDataStructure`** - Is the attribute present after merging? If missing → Category 2
338
- 4. **Check `scenariosDataStructure`** - Is the data structure for mocks correct? If wrong → Category 2
339
- 5. **Check scenario `mockData`** - Does the scenario have correct mock values? If wrong → Category 3
340
- 6. **Check generated mock code** - Is the mock code syntactically/semantically correct? If wrong → **Category 4 (engine bug)**
341
- 7. **Check generated imports** - Are the imports correct? Are entities containing environment variables mocked out? If wrong → **Category 4 (engine bug)**
342
-
343
- ### Category 4 Indicators (Code Generation Issue)
203
+ Work through these checks in order stop at the first failure:
344
204
 
345
- The issue is Category 4 if:
205
+ | Step | Check | If wrong → |
206
+ | ---- | ------------------------------------------------------------------------------- | ---------- |
207
+ | 1 | **Start with the error** — what attribute/value is missing or wrong at runtime? | — |
208
+ | 2 | Is the attribute in `isolatedDataStructure`? | Category 1 |
209
+ | 3 | Is the attribute in `mergedDataStructure`? | Category 2 |
210
+ | 4 | Is `scenariosDataStructure` correct? | Category 2 |
211
+ | 5 | Does scenario `mockData` have correct values? | Category 3 |
212
+ | 6 | Is the generated mock code syntactically/semantically correct? | Category 4 |
213
+ | 7 | Are imports correct? Environment variable entities mocked out? | Category 4 |
346
214
 
347
- - All data structures in the database look correct
348
- - The scenario's mockData has the right keys and values
349
- - BUT the generated mock code has syntax errors, wrong structure, or doesn't match the data
350
- - Database edits don't fix the generated code (it regenerates wrong)
215
+ If all database data looks correct but the generated code has syntax errors, wrong structure, or doesn't match the data → **Category 4**.
351
216
 
352
- **Category 4 does NOT mean you are blocked.** You have full access to fix these issues:
353
-
354
- 1. **Edit the files directly** in `/tmp/codeyam/local-dev/{slug}/project/`
355
- 2. **Fix any syntax errors, wrong imports, missing mocks** - these are just TypeScript files
356
- 3. **Restart the dev server** and verify the fix works
357
- 4. **Capture quality screenshots** with `codeyam recapture --capture-only`
358
- 5. **Document what you fixed** for the CodeYam team to improve the engine
217
+ ---
359
218
 
360
- The term "engine bug" means the CodeYam code generation has a bug—it does NOT mean you cannot fix the issue locally. You always can.
219
+ ## Step 5: Fix the Issue
361
220
 
362
- ---
221
+ Jump to the subsection matching your category:
363
222
 
364
- ## Step 4: Attempt Fix
223
+ - **Categories 1-2** Re-analyze
224
+ - **Category 3** → Edit mockData in database
225
+ - **Category 4** → Edit generated files in tmp folder
365
226
 
366
- ### For Categories 1-2 (Data Structure Issues)
227
+ ### Categories 1-2 (Data Structure Issues)
367
228
 
368
- These usually require re-running analysis. You can try:
229
+ Re-run analysis:
369
230
 
370
231
  ```bash
371
- # Delete the analysis and re-analyze
372
232
  codeyam analyze --entity EntityName path/to/file.tsx
373
233
  ```
374
234
 
375
- ### For Category 3 (Scenario Data Issues)
235
+ ### Category 3 (Scenario Data Issues)
376
236
 
377
- Fix the mockData directly in the database:
237
+ Fix mockData directly in the database:
378
238
 
379
239
  ```bash
380
240
  # Export metadata
@@ -393,14 +253,11 @@ with open('/tmp/metadata_fixed.json', 'w') as f:
393
253
  f.write(json.dumps(data))
394
254
  EOF
395
255
 
396
- # Update database (use Python to avoid escaping issues)
256
+ # Update database
397
257
  python3 << 'EOF'
398
- import sqlite3
399
- import json
400
-
258
+ import sqlite3, json
401
259
  with open('/tmp/metadata_fixed.json') as f:
402
260
  metadata = f.read()
403
-
404
261
  conn = sqlite3.connect('.codeyam/db.sqlite3')
405
262
  conn.execute("UPDATE scenarios SET metadata = ? WHERE id = 'SCENARIO_ID'", (metadata,))
406
263
  conn.commit()
@@ -408,242 +265,141 @@ conn.close()
408
265
  EOF
409
266
  ```
410
267
 
411
- ### For Category 4 (Code Generation Issues)
412
-
413
- **MUST be fixed locally by editing files in the tmp folder.** This is a REQUIRED step, not optional.
414
-
415
- 1. Go to Step 5a and fix all code issues in the tmp folder
416
- 2. Verify the scenario loads correctly (curl returns 200)
417
- 3. Run `codeyam recapture --capture-only` to capture screenshots (this preserves your fixes)
418
- 4. Verify the screenshots look correct
419
- 5. THEN document the engine bug in your final report
420
-
421
- **DO NOT stop after identifying a Category 4 issue.** The goal is to capture quality screenshots, then document what you fixed.
422
-
423
- ### Universal Mocks (for infrastructure dependencies)
424
-
425
- You can use universal mocks to mock out functions that are not detected by the analysis (are not part of the dependency tree). This often includes things like middleware or functions that run on startup and require environment variables.
426
-
427
- ## Quick Reference: Mock Path Decision Tree
428
-
429
- ```
430
- Where is the error coming from?
431
-
432
- ├── node_modules package (e.g., @prisma/client, @supabase/supabase-js)
433
- │ └── Mock path: .codeyam/universal-mocks/node_modules/{package}.ts
434
- │ Example: .codeyam/universal-mocks/node_modules/@prisma/client.ts
435
-
436
- └── Project file (e.g., lib/db.ts, packages/prisma/index.ts)
437
- └── Mock path: .codeyam/universal-mocks/{same-path-as-original}
438
- Example: .codeyam/universal-mocks/lib/db.ts
439
- Example: .codeyam/universal-mocks/packages/prisma/index.ts
440
- ```
441
-
442
- ## Quick Reference: Mock Writing Rules
443
-
444
- **BEFORE writing any mock:**
445
-
446
- 1. Read the original file first
447
- 2. Note all its export names exactly
448
-
449
- **WHEN writing the mock:**
450
-
451
- 1. Export names MUST match exactly (case-sensitive)
452
- 2. ALL code MUST be inside exports (no helper variables outside)
453
- 3. Keep it minimal - empty methods are fine
454
-
455
- **AFTER writing the mock:**
456
-
457
- ```bash
458
- codeyam validate-mock .codeyam/universal-mocks/{path-to-your-mock}
459
- ```
460
-
461
- ---
462
-
463
- ## Step 5: Verify Database Fixes Locally
464
-
465
- After making **database changes** (Categories 1-3):
466
-
467
- 1. **Re-run `codeyam debug ID`** to regenerate scenario files with updated data
468
- 2. **Start the dev server** and curl the URL to check for errors:
469
- ```bash
470
- curl -s http://localhost:3112/static/... | head -50
471
- ```
472
- 3. **Check for 200 response** (no `statusCode:500`)
473
-
474
- **If verification fails and you've already tried database fixes:** Proceed to Step 5a to fix code directly.
475
-
476
- ---
477
-
478
- ## Step 5a: Fix Code Issues in Tmp Folder (Category 4)
479
-
480
- If the error is in bad imports, generated code or mock files, you can fix them directly in the tmp folder:
481
-
482
- ### Locate the Problematic File
268
+ ### Category 4 (Code Generation Issues) — Edit Files Directly
483
269
 
484
- Files are in `/tmp/codeyam/local-dev/{slug}/project/`. Common locations:
270
+ Fix generated files in `/tmp/codeyam/local-dev/{slug}/project/`. Common locations:
485
271
 
486
272
  - **Generated mocks**: `__codeyamMocks__/MockData_*.tsx` or `__codeyamMocks__/MockCode_*.tsx`
487
273
  - **Scenario layouts**: `app/static/{projectSlug}/{analysisId}/{entitySlug}/{scenarioSlug}/`
488
274
  - **Route files**: `app/routes/` or `pages/` depending on framework
489
275
 
490
- ### Make the Fix
276
+ Common fixes:
491
277
 
492
- Edit the problematic file directly using the Edit tool. Common fixes include:
278
+ - Syntax errors (missing brackets, commas, quotes)
279
+ - Wrong import paths
280
+ - Missing named or default exports
281
+ - TypeScript type issues
282
+ - Wrong mock data shape
493
283
 
494
- - **Syntax errors**: Fix missing brackets, commas, or quotes in generated code
495
- - **Wrong import paths**: Correct import statements
496
- - **Missing exports**: Add missing named or default exports
497
- - **Type errors**: Fix TypeScript type issues
498
- - **Wrong mock structure**: Adjust the shape of generated mock data
284
+ **Only fix GENERATED files** (mocks, layouts, routes) never the client's application code. If a client component crashes, the fix is in the mock data or mock code.
499
285
 
500
- ### Track Your Changes (MANDATORY)
501
-
502
- For every file you edit, record:
503
-
504
- - The full file path
505
- - What you changed (brief description)
506
- - The before/after code (for the final report)
507
-
508
- ### Verify Without Regenerating
286
+ ### Universal Mocks (for infrastructure dependencies)
509
287
 
510
- After editing files, **do NOT run `codeyam debug` again** (it would overwrite your changes).
288
+ Use universal mocks to mock functions not in the dependency tree (middleware, startup functions needing env vars).
511
289
 
512
- Instead, manually start the dev server:
290
+ **Mock path decision tree:**
513
291
 
514
- ```bash
515
- cd /tmp/codeyam/local-dev/{slug}/project
516
- npm run dev # or pnpm dev / yarn dev
517
292
  ```
518
-
519
- Then curl the scenario URL to verify the fix works:
520
-
521
- ```bash
522
- curl -s http://localhost:3112/static/codeyam-sample | head -50
293
+ Error source?
294
+ ├── node_modules package .codeyam/universal-mocks/node_modules/{package}.ts
295
+ │ Example: .codeyam/universal-mocks/node_modules/@prisma/client.ts
296
+ └── Project file → .codeyam/universal-mocks/{same-path-as-original}
297
+ Example: .codeyam/universal-mocks/lib/db.ts
523
298
  ```
524
299
 
525
- ---
300
+ **Mock writing rules:**
526
301
 
527
- ## Change Tracking (MANDATORY)
302
+ 1. Read the original file first, note all export names exactly
303
+ 2. Export names MUST match exactly (case-sensitive)
304
+ 3. ALL code MUST be inside exports (no helper variables outside)
305
+ 4. Keep it minimal — empty methods are fine
306
+ 5. Validate: `codeyam validate-mock .codeyam/universal-mocks/{path}`
528
307
 
529
- **You MUST track all changes for the final report.** This is essential for the CodeYam team to fix engine bugs.
308
+ ### Track All Changes (MANDATORY)
530
309
 
531
- ### Database Changes
310
+ For every change, record for the final report:
532
311
 
533
- For each database modification, record:
312
+ **Database changes:**
534
313
 
535
314
  | Table | Record ID | Field Path | Before | After |
536
315
  | ----------- | --------- | ---------------------------- | --------- | ----------- |
537
316
  | `scenarios` | `abc123` | `metadata.data.mockData.key` | `"wrong"` | `"correct"` |
538
317
 
539
- ### File Changes
318
+ **File changes:**
540
319
 
541
- For each file modification in the tmp folder, record:
320
+ | File Path | Change Description |
321
+ | ---------------------------------------------------- | ------------------- |
322
+ | `/tmp/.../project/__codeyamMocks__/MockData_xyz.tsx` | Fixed missing comma |
542
323
 
543
- | File Path | Change Description |
544
- | ---------------------------------------------------- | ------------------------------------- |
545
- | `/tmp/.../project/__codeyamMocks__/MockData_xyz.tsx` | Fixed missing comma in object literal |
324
+ Include actual diffs for file changes.
546
325
 
547
- Include the actual diff:
326
+ ---
548
327
 
549
- ```diff
550
- --- before
551
- +++ after
552
- @@ -10,3 +10,3 @@
553
- - key: "value"
554
- + key: "value",
555
- anotherKey: "value2"
556
- ```
328
+ ## Step 6: Verify Fix
557
329
 
558
- ---
330
+ ### After Database Changes (Categories 1-3)
331
+
332
+ 1. Re-run `codeyam debug ANALYSIS_ID` to regenerate files with updated data
333
+ 2. Curl the URL to check for errors:
334
+ ```bash
335
+ curl -s http://localhost:PORT/static/codeyam-sample | head -50
336
+ ```
337
+ 3. Check for 200 response (no `statusCode:500`)
338
+
339
+ If verification fails after database fixes, proceed to fix files directly (Category 4 approach).
340
+
341
+ ### After File Changes (Category 4)
342
+
343
+ **Do NOT run `codeyam debug` again** — it overwrites your changes.
344
+
345
+ 1. Start the dev server manually from the tmp folder
346
+ 2. Curl the URL to check for errors
347
+ 3. For visual/rendering issues, ask the user to verify: _"Can you visit http://localhost:PORT/static/codeyam-sample and confirm the component renders correctly?"_
559
348
 
560
- ## Step 6: Recapture Screenshots
349
+ ---
561
350
 
562
- **Only proceed here if Step 5 or 5a verification passed.**
351
+ ## Step 7: Recapture & Verify Screenshots
563
352
 
564
- ### Choose the Right Recapture Mode
353
+ ### Choose Recapture Mode
565
354
 
566
- **If you only made DATABASE changes (Categories 1-3):**
355
+ **Database-only changes:**
567
356
 
568
357
  ```bash
569
358
  codeyam recapture SCENARIO_ID
570
359
  ```
571
360
 
572
- This will regenerate the tmp folder files using the updated database data, then capture screenshots.
573
-
574
- **If you made FILE changes in the tmp folder (Category 4):**
361
+ **File changes (or mixed):**
575
362
 
576
363
  ```bash
577
364
  codeyam recapture SCENARIO_ID --capture-only
578
365
  ```
579
366
 
580
- **CRITICAL**: The `--capture-only` flag preserves your manual file fixes. Without this flag, your changes would be overwritten!
581
-
582
- ### Verify Files After Capture
367
+ ### Verify Files Exist
583
368
 
584
369
  ```bash
585
- # Check database for screenshot paths
586
370
  sqlite3 .codeyam/db.sqlite3 "SELECT name, json_extract(metadata, '$.screenshotPaths') FROM scenarios WHERE analysis_id = 'ANALYSIS_ID'"
587
-
588
- # Verify files actually exist
589
371
  find .codeyam/captures -name "*.png" -path "*ANALYSIS_ID*" -mmin -5
590
372
  ```
591
373
 
592
- ---
593
-
594
- ## Step 7: Verify Screenshots for Client-Side Errors
595
-
596
- **IMPORTANT**: Even if capture completes successfully, the screenshots may show client-side errors!
597
-
598
- ### View the Screenshots
374
+ ### Visually Inspect Screenshots
599
375
 
600
- Use the Read tool to view each captured screenshot file:
376
+ Use the Read tool to view each screenshot. Check for:
601
377
 
602
- ```bash
603
- # Get the screenshot path from the database
604
- sqlite3 .codeyam/db.sqlite3 "SELECT json_extract(metadata, '$.screenshotPaths[0]') FROM scenarios WHERE id = 'SCENARIO_ID'"
605
- ```
606
-
607
- Then read the screenshot file to visually inspect it.
608
-
609
- ### Check for These Issues
610
-
611
- - **Red error boundaries** or React error overlays
612
- - **"Something went wrong"** or similar error text
613
- - **Blank/white screens** that should have content
614
- - **Missing components** or broken layouts
615
- - **Console errors** shown in error overlays
616
-
617
- If the screenshot shows a dedicated 500 page with no clear error then you may want to find and comment out any error boundary logic that is catching errors and preventing you from easily reading them.
378
+ - Red error boundaries or React error overlays
379
+ - "Something went wrong" or similar error text
380
+ - Blank/white screens that should have content
381
+ - Missing components or broken layouts
618
382
 
619
- ### If Screenshot Shows Errors
383
+ If the screenshot shows a dedicated 500 page with no clear error, consider commenting out error boundary logic to expose the real error.
620
384
 
621
- 1. The fix didn't fully work - go back to Step 5 or 5a
622
- 2. Check the log file for additional error details:
623
- ```bash
624
- tail -100 /tmp/codeyam/local-dev/{slug}/codeyam/log.txt
625
- ```
626
- 3. Fix the remaining issues
627
- 4. Run recapture again (with `--capture-only` if you edited files)
385
+ **If screenshots show errors:** Go back to Step 5, check the log file (`tail -100 /tmp/codeyam/local-dev/{slug}/codeyam/log.txt`), fix remaining issues, and recapture again.
628
386
 
629
387
  ---
630
388
 
631
- ## Final Debug Report (MANDATORY)
389
+ ## Reference
632
390
 
633
- **Always produce this report**, whether the issue was fixed or identified as an engine bug.
391
+ ### Debug Report Template
634
392
 
635
- ---
393
+ **Always produce this report** after debugging. Save to `.codeyam/debug-report.md`.
636
394
 
395
+ ```markdown
637
396
  ## Debug Session Report
638
397
 
639
398
  ### Issue Summary
640
399
 
641
- **Error:** `[Exact error message, e.g., "Transform failed: Unexpected token at line 66"]`
642
-
400
+ **Error:** `[Exact error message]`
643
401
  **Entity:** `[Entity name]` in `[file/path.tsx]`
644
-
645
402
  **Root Cause Category:** [1, 2, 3, or 4]
646
-
647
403
  **Outcome:** [Fixed via database changes / Fixed via file edits (engine bug) / Unfixable]
648
404
 
649
405
  ### Affected Scenarios
@@ -655,115 +411,58 @@ If the screenshot shows a dedicated 500 page with no clear error then you may wa
655
411
  ### Root Cause Category Determination
656
412
 
657
413
  **Category identified:** [1 / 2 / 3 / 4]
658
-
659
414
  **Evidence:**
660
415
 
661
- - [ ] **Category 1** (isolatedDataStructure): [What was missing/wrong in entity metadata?]
662
- - [ ] **Category 2** (mergedDataStructure): [What was missing/wrong after merge?]
663
- - [ ] **Category 3** (scenario mockData): [What was wrong in the LLM-generated data?]
664
- - [ ] **Category 4** (mock code writing): [What was wrong in the generated code?]
416
+ - [ ] **Category 1** (isolatedDataStructure): [What was missing/wrong?]
417
+ - [ ] **Category 2** (mergedDataStructure): [What was missing/wrong?]
418
+ - [ ] **Category 3** (scenario mockData): [What was wrong in LLM-generated data?]
419
+ - [ ] **Category 4** (mock code writing): [What was wrong in generated code?]
665
420
 
666
- **How determined:**
667
- [Explain what you checked and what you found. Include relevant JSON snippets.]
421
+ **How determined:** [Explain what you checked. Include relevant JSON snippets.]
668
422
 
669
423
  ### Database Changes Made (if any)
670
424
 
671
- | Table | Record ID | Field Path | Before | After |
672
- | --------- | --------- | ---------- | ------------- | ------------- |
673
- | `[table]` | `[id]` | `[path]` | `[old value]` | `[new value]` |
425
+ | Table | Record ID | Field Path | Before | After |
426
+ | --------- | --------- | ---------- | ------- | ------- |
427
+ | `[table]` | `[id]` | `[path]` | `[old]` | `[new]` |
674
428
 
675
429
  **SQL/Python commands used:**
676
-
677
- ```sql
678
- [Include the exact commands]
679
- ```
430
+ [Include exact commands]
680
431
 
681
432
  ### File Changes Made (if any)
682
433
 
683
- If you edited files in the tmp folder to fix Category 4 issues:
684
-
685
- | File Path | Change Description |
686
- | -------------------------------------------------------- | -------------------------- |
687
- | `/tmp/codeyam/local-dev/{slug}/project/path/to/file.tsx` | [Brief description of fix] |
434
+ | File Path | Change Description |
435
+ | -------------------------------------------------------- | ------------------- |
436
+ | `/tmp/codeyam/local-dev/{slug}/project/path/to/file.tsx` | [Brief description] |
688
437
 
689
438
  **Diffs:**
690
-
691
- ```diff
692
- --- before
693
- +++ after
694
- @@ -line,count +line,count @@
695
- -[old code]
696
- +[new code]
697
- ```
439
+ [Include actual diffs]
698
440
 
699
441
  **Recapture command used:**
442
+ `codeyam recapture SCENARIO_ID [--capture-only]`
700
443
 
701
- ```bash
702
- codeyam recapture SCENARIO_ID --capture-only
703
- ```
704
-
705
- ### For Category 4 (Code Generation Bug) - Required Details
706
-
707
- If this is an engine bug, include:
708
-
709
- **What the data looks like (correct):**
710
-
711
- ```json
712
- [Show the relevant data structure from the database that looks correct]
713
- ```
714
-
715
- **What the generated code looks like (wrong):**
444
+ ### For Category 4 — Required Details
716
445
 
717
- ```javascript
718
- [Show the problematic generated mock code]
719
- ```
720
-
721
- **What the generated code should look like:**
722
-
723
- ```javascript
724
- [Show what correct code would look like]
725
- ```
726
-
727
- **Pattern/Edge case:**
728
- [Describe the pattern that causes this bug, e.g., "Function call signatures like '()' in array item schemas get converted to empty computed property keys"]
446
+ **What the data looks like (correct):** [database data structure]
447
+ **What the generated code looks like (wrong):** [problematic code]
448
+ **What the generated code should look like:** [correct code]
449
+ **Pattern/Edge case:** [Describe the pattern that causes this bug]
729
450
 
730
451
  ### Verification
731
452
 
732
- **All of these must be checked before the debug session is complete:**
733
-
734
453
  - [ ] Scenario loads without errors (curl returns 200)
735
- - [ ] Screenshots recaptured successfully (this is REQUIRED, not optional)
454
+ - [ ] Screenshots recaptured successfully
736
455
  - [ ] Used `--capture-only` flag (if file changes were made)
737
456
  - [ ] Screenshot files verified to exist on disk
738
- - [ ] Screenshots visually inspected - no client-side errors visible
739
- - [ ] All changes documented above for CodeYam team
740
-
741
- ---
742
-
743
- ## Saving and Uploading the Report (MANDATORY)
744
-
745
- After completing the debug session, **you MUST save the report**:
746
-
747
- 1. **Write the report to file:**
748
-
749
- ```bash
750
- # Write the full "Debug Session Report" section above to this file
751
- # Use the Write tool to save to:
752
- .codeyam/debug-report.md
753
- ```
754
-
755
- 2. **Ask user if they want to upload:**
756
- After saving, ask the user: "Would you like me to upload this debug report to CodeYam for the team to review?"
757
-
758
- - If the user response affirmatively then run `codeyam report --upload` to upload the report.
759
-
760
- The report will be:
457
+ - [ ] Screenshots visually inspected no client-side errors visible
458
+ - [ ] All changes documented for CodeYam team
459
+ ```
761
460
 
762
- - Included in the delta tarball at the root level for easy access
763
- - Stored in the database metadata for searchability
764
- - Available to CodeYam engineers when they download the report
461
+ ### Saving & Uploading Report
765
462
 
766
- ---
463
+ 1. Save report to `.codeyam/debug-report.md`
464
+ 2. Ask user: "Would you like me to upload this debug report to CodeYam for the team to review?"
465
+ 3. If yes: `codeyam report --upload`
767
466
 
768
467
  ### Helper Queries
769
468