@codeyam/codeyam-cli 0.1.0-staging.eb21b2f → 0.1.0-staging.f777668

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 (544) 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 +21 -21
  4. package/analyzer-template/packages/ai/package.json +2 -2
  5. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +34 -3
  6. package/analyzer-template/packages/ai/src/lib/completionCall.ts +114 -113
  7. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +259 -5
  8. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.ts +62 -0
  9. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.ts +35 -0
  10. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +78 -2
  11. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +0 -33
  12. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +19 -7
  13. package/analyzer-template/packages/analyze/src/lib/asts/index.ts +7 -2
  14. package/analyzer-template/packages/analyze/src/lib/asts/nodes/getNodeType.ts +1 -0
  15. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +9 -1
  16. package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +0 -6
  17. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +12 -0
  18. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +65 -28
  19. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +83 -0
  20. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +0 -98
  21. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +23 -4
  22. package/analyzer-template/packages/aws/package.json +10 -10
  23. package/analyzer-template/packages/database/index.ts +1 -0
  24. package/analyzer-template/packages/database/package.json +3 -3
  25. package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -0
  26. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +68 -0
  27. package/analyzer-template/packages/database/src/lib/loadCommits.ts +31 -20
  28. package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +0 -5
  29. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +151 -135
  30. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatus.ts +58 -42
  31. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.ts +81 -65
  32. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +29 -1
  33. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +33 -5
  34. package/analyzer-template/packages/github/dist/database/index.d.ts +1 -0
  35. package/analyzer-template/packages/github/dist/database/index.d.ts.map +1 -1
  36. package/analyzer-template/packages/github/dist/database/index.js +1 -0
  37. package/analyzer-template/packages/github/dist/database/index.js.map +1 -1
  38. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -0
  39. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  40. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +5 -0
  41. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  42. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +22 -0
  43. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -0
  44. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +51 -0
  45. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  46. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +5 -0
  47. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  48. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  49. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +23 -13
  50. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  51. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
  52. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  53. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  54. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  55. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +100 -89
  56. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  57. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.d.ts.map +1 -1
  58. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  59. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  60. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.d.ts.map +1 -1
  61. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  62. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  63. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -1
  64. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  65. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  66. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  67. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  68. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  69. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +1 -0
  70. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  71. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +10 -0
  72. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  73. package/analyzer-template/packages/github/package.json +1 -1
  74. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +1 -0
  75. package/analyzer-template/packages/types/src/types/Scenario.ts +10 -0
  76. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +1 -0
  77. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  78. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +10 -0
  79. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  80. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
  81. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +6 -2
  82. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  83. package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +14 -2
  84. package/analyzer-template/playwright/captureFromUrl.ts +89 -82
  85. package/analyzer-template/project/constructMockCode.ts +168 -48
  86. package/analyzer-template/project/orchestrateCapture.ts +4 -1
  87. package/analyzer-template/project/reconcileMockDataKeys.ts +19 -14
  88. package/analyzer-template/project/start.ts +3 -0
  89. package/analyzer-template/project/startScenarioCapture.ts +9 -0
  90. package/analyzer-template/project/writeClientLogRoute.ts +125 -0
  91. package/analyzer-template/project/writeMockDataTsx.ts +17 -0
  92. package/analyzer-template/project/writeScenarioComponents.ts +96 -17
  93. package/analyzer-template/tsconfig.json +13 -1
  94. package/background/src/lib/virtualized/project/constructMockCode.js +143 -39
  95. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  96. package/background/src/lib/virtualized/project/orchestrateCapture.js +4 -1
  97. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  98. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +17 -11
  99. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  100. package/background/src/lib/virtualized/project/start.js +2 -0
  101. package/background/src/lib/virtualized/project/start.js.map +1 -1
  102. package/background/src/lib/virtualized/project/startScenarioCapture.js +5 -0
  103. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  104. package/background/src/lib/virtualized/project/writeClientLogRoute.js +110 -0
  105. package/background/src/lib/virtualized/project/writeClientLogRoute.js.map +1 -0
  106. package/background/src/lib/virtualized/project/writeMockDataTsx.js +12 -0
  107. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  108. package/background/src/lib/virtualized/project/writeScenarioComponents.js +73 -12
  109. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  110. package/codeyam-cli/scripts/apply-setup.js +208 -11
  111. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  112. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js +196 -0
  113. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js.map +1 -0
  114. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js +114 -0
  115. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js.map +1 -0
  116. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js +149 -0
  117. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js.map +1 -0
  118. package/codeyam-cli/src/cli.js +32 -25
  119. package/codeyam-cli/src/cli.js.map +1 -1
  120. package/codeyam-cli/src/commands/analyze.js +17 -7
  121. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  122. package/codeyam-cli/src/commands/default.js +14 -2
  123. package/codeyam-cli/src/commands/default.js.map +1 -1
  124. package/codeyam-cli/src/commands/editor.js +2607 -0
  125. package/codeyam-cli/src/commands/editor.js.map +1 -0
  126. package/codeyam-cli/src/commands/init.js +40 -11
  127. package/codeyam-cli/src/commands/init.js.map +1 -1
  128. package/codeyam-cli/src/commands/memory.js +29 -58
  129. package/codeyam-cli/src/commands/memory.js.map +1 -1
  130. package/codeyam-cli/src/utils/__tests__/devServerState.test.js +134 -0
  131. package/codeyam-cli/src/utils/__tests__/devServerState.test.js.map +1 -0
  132. package/codeyam-cli/src/utils/__tests__/editorApi.test.js +127 -0
  133. package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -0
  134. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +635 -0
  135. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
  136. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js +93 -0
  137. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js.map +1 -0
  138. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +155 -0
  139. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
  140. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +121 -0
  141. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -0
  142. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js +294 -0
  143. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js.map +1 -0
  144. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +542 -0
  145. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -0
  146. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +393 -0
  147. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -0
  148. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js +270 -0
  149. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js.map +1 -0
  150. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +217 -0
  151. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -0
  152. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +266 -0
  153. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
  154. package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js +139 -0
  155. package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js.map +1 -0
  156. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +221 -0
  157. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -0
  158. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +221 -0
  159. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
  160. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +213 -0
  161. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -0
  162. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +1686 -0
  163. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -0
  164. package/codeyam-cli/src/utils/__tests__/git.editor.test.js +134 -0
  165. package/codeyam-cli/src/utils/__tests__/git.editor.test.js.map +1 -0
  166. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +107 -0
  167. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -0
  168. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js +6 -0
  169. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -1
  170. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js +101 -0
  171. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js.map +1 -0
  172. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js +9 -0
  173. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js.map +1 -1
  174. package/codeyam-cli/src/utils/__tests__/project.test.js +65 -0
  175. package/codeyam-cli/src/utils/__tests__/project.test.js.map +1 -0
  176. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js +121 -0
  177. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js.map +1 -0
  178. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +246 -0
  179. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -0
  180. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +50 -4
  181. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  182. package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js +50 -0
  183. package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js.map +1 -0
  184. package/codeyam-cli/src/utils/backgroundServer.js +21 -5
  185. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  186. package/codeyam-cli/src/utils/buildFlags.js +4 -0
  187. package/codeyam-cli/src/utils/buildFlags.js.map +1 -0
  188. package/codeyam-cli/src/utils/devModeEvents.js +40 -0
  189. package/codeyam-cli/src/utils/devModeEvents.js.map +1 -0
  190. package/codeyam-cli/src/utils/devServerState.js +71 -0
  191. package/codeyam-cli/src/utils/devServerState.js.map +1 -0
  192. package/codeyam-cli/src/utils/editorApi.js +73 -0
  193. package/codeyam-cli/src/utils/editorApi.js.map +1 -0
  194. package/codeyam-cli/src/utils/editorAudit.js +159 -0
  195. package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
  196. package/codeyam-cli/src/utils/editorCapture.js +102 -0
  197. package/codeyam-cli/src/utils/editorCapture.js.map +1 -0
  198. package/codeyam-cli/src/utils/editorDevServer.js +109 -0
  199. package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
  200. package/codeyam-cli/src/utils/editorEntityChangeStatus.js +44 -0
  201. package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -0
  202. package/codeyam-cli/src/utils/editorImageVerifier.js +155 -0
  203. package/codeyam-cli/src/utils/editorImageVerifier.js.map +1 -0
  204. package/codeyam-cli/src/utils/editorJournal.js +225 -0
  205. package/codeyam-cli/src/utils/editorJournal.js.map +1 -0
  206. package/codeyam-cli/src/utils/editorLoaderHelpers.js +81 -0
  207. package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -0
  208. package/codeyam-cli/src/utils/editorMockState.js +248 -0
  209. package/codeyam-cli/src/utils/editorMockState.js.map +1 -0
  210. package/codeyam-cli/src/utils/editorPreloadHelpers.js +135 -0
  211. package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -0
  212. package/codeyam-cli/src/utils/editorPreview.js +106 -0
  213. package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
  214. package/codeyam-cli/src/utils/editorScenarioSwitch.js +112 -0
  215. package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -0
  216. package/codeyam-cli/src/utils/editorScenarios.js +96 -0
  217. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
  218. package/codeyam-cli/src/utils/editorSeedAdapter.js +173 -0
  219. package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -0
  220. package/codeyam-cli/src/utils/entityChangeStatus.js +337 -0
  221. package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -0
  222. package/codeyam-cli/src/utils/entityChangeStatus.server.js +107 -0
  223. package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -0
  224. package/codeyam-cli/src/utils/fileMetadata.js +5 -0
  225. package/codeyam-cli/src/utils/fileMetadata.js.map +1 -1
  226. package/codeyam-cli/src/utils/fileWatcher.js +25 -9
  227. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  228. package/codeyam-cli/src/utils/git.js +103 -0
  229. package/codeyam-cli/src/utils/git.js.map +1 -1
  230. package/codeyam-cli/src/utils/install-skills.js +57 -15
  231. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  232. package/codeyam-cli/src/utils/interactiveSyncWatcher.js +126 -0
  233. package/codeyam-cli/src/utils/interactiveSyncWatcher.js.map +1 -0
  234. package/codeyam-cli/src/utils/npmVersionCheck.js +2 -2
  235. package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -1
  236. package/codeyam-cli/src/utils/parseRegisterArg.js +31 -0
  237. package/codeyam-cli/src/utils/parseRegisterArg.js.map +1 -0
  238. package/codeyam-cli/src/utils/pathIgnoring.js +19 -7
  239. package/codeyam-cli/src/utils/pathIgnoring.js.map +1 -1
  240. package/codeyam-cli/src/utils/project.js +15 -5
  241. package/codeyam-cli/src/utils/project.js.map +1 -1
  242. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js +11 -11
  243. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js.map +1 -1
  244. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +22 -0
  245. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  246. package/codeyam-cli/src/utils/queue/heartbeat.js +13 -5
  247. package/codeyam-cli/src/utils/queue/heartbeat.js.map +1 -1
  248. package/codeyam-cli/src/utils/queue/job.js +70 -1
  249. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  250. package/codeyam-cli/src/utils/queue/manager.js +7 -6
  251. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  252. package/codeyam-cli/src/utils/requireSimulations.js +1 -1
  253. package/codeyam-cli/src/utils/requireSimulations.js.map +1 -1
  254. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +5 -6
  255. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -1
  256. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +1 -1
  257. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -1
  258. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +0 -1
  259. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -1
  260. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +2 -4
  261. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -1
  262. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +2 -5
  263. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -1
  264. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js +83 -0
  265. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js.map +1 -0
  266. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js +118 -0
  267. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js.map +1 -0
  268. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js +72 -0
  269. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js.map +1 -0
  270. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js +76 -0
  271. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js.map +1 -0
  272. package/codeyam-cli/src/utils/rules/index.js +1 -0
  273. package/codeyam-cli/src/utils/rules/index.js.map +1 -1
  274. package/codeyam-cli/src/utils/rules/parser.js +14 -4
  275. package/codeyam-cli/src/utils/rules/parser.js.map +1 -1
  276. package/codeyam-cli/src/utils/rules/pathMatcher.js +34 -3
  277. package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -1
  278. package/codeyam-cli/src/utils/rules/rulePlacement.js +65 -0
  279. package/codeyam-cli/src/utils/rules/rulePlacement.js.map +1 -0
  280. package/codeyam-cli/src/utils/rules/sourceFiles.js +43 -0
  281. package/codeyam-cli/src/utils/rules/sourceFiles.js.map +1 -0
  282. package/codeyam-cli/src/utils/scenarioMarkers.js +134 -0
  283. package/codeyam-cli/src/utils/scenarioMarkers.js.map +1 -0
  284. package/codeyam-cli/src/utils/scenariosManifest.js +112 -0
  285. package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -0
  286. package/codeyam-cli/src/utils/serverState.js +27 -2
  287. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  288. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +82 -11
  289. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  290. package/codeyam-cli/src/utils/simulationGateMiddleware.js +159 -0
  291. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
  292. package/codeyam-cli/src/utils/syncMocksMiddleware.js +5 -24
  293. package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
  294. package/codeyam-cli/src/utils/testRunner.js +158 -0
  295. package/codeyam-cli/src/utils/testRunner.js.map +1 -0
  296. package/codeyam-cli/src/utils/transcriptPruning.js +67 -0
  297. package/codeyam-cli/src/utils/transcriptPruning.js.map +1 -0
  298. package/codeyam-cli/src/utils/versionInfo.js +21 -0
  299. package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
  300. package/codeyam-cli/src/utils/webappDetection.js +14 -2
  301. package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
  302. package/codeyam-cli/src/webserver/app/lib/database.js +41 -27
  303. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  304. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  305. package/codeyam-cli/src/webserver/app/lib/git.js +396 -0
  306. package/codeyam-cli/src/webserver/app/lib/git.js.map +1 -0
  307. package/codeyam-cli/src/webserver/backgroundServer.js +118 -18
  308. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  309. package/codeyam-cli/src/webserver/build/client/assets/{CopyButton-jNYXRRNI.js → CopyButton-DmJveP3T.js} +1 -1
  310. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-bwuHPyTa.js → EntityItem-C76mRRiF.js} +1 -1
  311. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-CvzqMxcu.js → EntityTypeBadge-g3saevPb.js} +1 -1
  312. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-BH0XDim7.js → EntityTypeIcon-CobE682z.js} +1 -1
  313. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +1 -0
  314. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-yjIHlOGa.js → InteractivePreview-DYFW3lDD.js} +3 -3
  315. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-Cq5o8jL4.js → LibraryFunctionPreview-DLeucoVX.js} +1 -1
  316. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-BvMu2i-g.js → LoadingDots-BU_OAEMP.js} +1 -1
  317. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-kgBTLoJD.js → LogViewer-ceAyBX-H.js} +1 -1
  318. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-BzPgx-xO.js → ReportIssueModal-djPLI-WV.js} +1 -1
  319. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-CwZrv-Ok.js → SafeScreenshot-BED4B6sP.js} +1 -1
  320. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-BX2Ny2Qj.js → ScenarioViewer-ZlRKbhrq.js} +3 -3
  321. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +34 -0
  322. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-CDpEprKa.js → TruncatedFilePath-C8OKAR5x.js} +1 -1
  323. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-oAf2Kqsf.js +1 -0
  324. package/codeyam-cli/src/webserver/build/client/assets/{_index-BRx8ZGZo.js → _index-C96V0n15.js} +1 -1
  325. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-4S4yPfFw.js → activity.(_tab)-BpKzcsJz.js} +1 -1
  326. package/codeyam-cli/src/webserver/build/client/assets/addon-canvas-DpzMmAy5.js +1 -0
  327. package/codeyam-cli/src/webserver/build/client/assets/addon-fit-YJmn1quW.js +12 -0
  328. package/codeyam-cli/src/webserver/build/client/assets/addon-web-links-Duc5hnl7.js +1 -0
  329. package/codeyam-cli/src/webserver/build/client/assets/addon-webgl-DI8QOUvO.js +58 -0
  330. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-D9hemwl6.js +22 -0
  331. package/codeyam-cli/src/webserver/build/client/assets/api.dev-mode-events-l0sNRNKZ.js +1 -0
  332. package/codeyam-cli/src/webserver/build/client/assets/api.editor-audit-l0sNRNKZ.js +1 -0
  333. package/codeyam-cli/src/webserver/build/client/assets/api.editor-capture-scenario-l0sNRNKZ.js +1 -0
  334. package/codeyam-cli/src/webserver/build/client/assets/api.editor-client-errors-l0sNRNKZ.js +1 -0
  335. package/codeyam-cli/src/webserver/build/client/assets/api.editor-commit-l0sNRNKZ.js +1 -0
  336. package/codeyam-cli/src/webserver/build/client/assets/api.editor-dev-server-l0sNRNKZ.js +1 -0
  337. package/codeyam-cli/src/webserver/build/client/assets/api.editor-entity-status-l0sNRNKZ.js +1 -0
  338. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-diff-l0sNRNKZ.js +1 -0
  339. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-l0sNRNKZ.js +1 -0
  340. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-entry-l0sNRNKZ.js +1 -0
  341. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-image._-l0sNRNKZ.js +1 -0
  342. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-l0sNRNKZ.js +1 -0
  343. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-screenshot-l0sNRNKZ.js +1 -0
  344. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-update-l0sNRNKZ.js +1 -0
  345. package/codeyam-cli/src/webserver/build/client/assets/api.editor-load-commit-l0sNRNKZ.js +1 -0
  346. package/codeyam-cli/src/webserver/build/client/assets/api.editor-project-info-l0sNRNKZ.js +1 -0
  347. package/codeyam-cli/src/webserver/build/client/assets/api.editor-refresh-l0sNRNKZ.js +1 -0
  348. package/codeyam-cli/src/webserver/build/client/assets/api.editor-register-scenario-l0sNRNKZ.js +1 -0
  349. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-data-l0sNRNKZ.js +1 -0
  350. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-image._-l0sNRNKZ.js +1 -0
  351. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenarios-l0sNRNKZ.js +1 -0
  352. package/codeyam-cli/src/webserver/build/client/assets/api.editor-switch-scenario-l0sNRNKZ.js +1 -0
  353. package/codeyam-cli/src/webserver/build/client/assets/api.editor-test-results-l0sNRNKZ.js +1 -0
  354. package/codeyam-cli/src/webserver/build/client/assets/api.rule-path-l0sNRNKZ.js +1 -0
  355. package/codeyam-cli/src/webserver/build/client/assets/{book-open-D4IPYH_y.js → book-open-D_nMCFmP.js} +1 -1
  356. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-CG65viiV.js → chevron-down-BH2h1Ea2.js} +1 -1
  357. package/codeyam-cli/src/webserver/build/client/assets/{chunk-JZWAC4HX-DB3aFuEO.js → chunk-JZWAC4HX-C4pqxYJB.js} +1 -1
  358. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-igfMr5DY.js → circle-check-DyIKORY6.js} +1 -1
  359. package/codeyam-cli/src/webserver/build/client/assets/{copy-Coc4o_8c.js → copy-NDbZjXao.js} +1 -1
  360. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-D1zB-pYc.js → createLucideIcon-CMT1jU2q.js} +1 -1
  361. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CltMNppm.js +1 -0
  362. package/codeyam-cli/src/webserver/build/client/assets/editor-DTEBHY7Z.js +10 -0
  363. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-B7ztwLut.js +41 -0
  364. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-B0h9AqE6.js → entity._sha._-DItJnD8s.js} +10 -10
  365. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-D5rYBT5x.js +6 -0
  366. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CF164ouH.js +6 -0
  367. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +6 -0
  368. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-PePWg17F.js → entity._sha_.edit._scenarioId-BMvVHNXU.js} +2 -2
  369. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-I-Wo99C_.js → entry.client-DTvKq3TY.js} +1 -1
  370. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-9sMMAiWJ.js → fileTableUtils-cPo8LiG3.js} +1 -1
  371. package/codeyam-cli/src/webserver/build/client/assets/{files-Co65J0s3.js → files-DO4CZ16O.js} +1 -1
  372. package/codeyam-cli/src/webserver/build/client/assets/git-CdN8sCqs.js +1 -0
  373. package/codeyam-cli/src/webserver/build/client/assets/globals-JMY99HpD.css +1 -0
  374. package/codeyam-cli/src/webserver/build/client/assets/{index-CUM5iXwc.js → index-10oVnAAH.js} +1 -1
  375. package/codeyam-cli/src/webserver/build/client/assets/{index-_417gcQW.js → index-BcvgDzbZ.js} +1 -1
  376. package/codeyam-cli/src/webserver/build/client/assets/index-yHOVb4rc.js +15 -0
  377. package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +1 -0
  378. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-TzRHMVog.js → loader-circle-BAXYRVEO.js} +1 -1
  379. package/codeyam-cli/src/webserver/build/client/assets/manifest-7aab51c4.js +1 -0
  380. package/codeyam-cli/src/webserver/build/client/assets/memory-Dg0mvYrI.js +96 -0
  381. package/codeyam-cli/src/webserver/build/client/assets/{pause-hjzB7t2z.js → pause-DTAcYxBt.js} +1 -1
  382. package/codeyam-cli/src/webserver/build/client/assets/root-FRztnN-P.js +67 -0
  383. package/codeyam-cli/src/webserver/build/client/assets/{search-DcAwD_Ln.js → search-fKo7v0Zo.js} +1 -1
  384. package/codeyam-cli/src/webserver/build/client/assets/settings-DfuTtcJP.js +1 -0
  385. package/codeyam-cli/src/webserver/build/client/assets/{simulations-DVNJVQgD.js → simulations-B3aOzpCZ.js} +1 -1
  386. package/codeyam-cli/src/webserver/build/client/assets/{terminal-DbEAHMbA.js → terminal-BG4heKCG.js} +1 -1
  387. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-CAD5b1o_.js → triangle-alert-DtSmdtM4.js} +1 -1
  388. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-CrAK28Bc.js +1 -0
  389. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C14nCb1q.js +2 -0
  390. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-DZlYx2c4.js → useReportContext-O-jkvSPx.js} +1 -1
  391. package/codeyam-cli/src/webserver/build/client/assets/{useToast-ihdMtlf6.js → useToast-9FIWuYfK.js} +1 -1
  392. package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
  393. package/codeyam-cli/src/webserver/build/server/assets/index-Cz751Dm2.js +1 -0
  394. package/codeyam-cli/src/webserver/build/server/assets/server-build-DSylnYVM.js +367 -0
  395. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  396. package/codeyam-cli/src/webserver/build-info.json +5 -5
  397. package/codeyam-cli/src/webserver/devServer.js +39 -5
  398. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  399. package/codeyam-cli/src/webserver/editorProxy.js +431 -0
  400. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -0
  401. package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +414 -0
  402. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +230 -0
  403. package/codeyam-cli/src/webserver/server.js +258 -1
  404. package/codeyam-cli/src/webserver/server.js.map +1 -1
  405. package/codeyam-cli/src/webserver/terminalServer.js +706 -0
  406. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -0
  407. package/codeyam-cli/templates/codeyam-editor-claude.md +68 -0
  408. package/codeyam-cli/templates/editor-step-hook.py +208 -0
  409. package/codeyam-cli/templates/hooks/staleness-check.sh +43 -0
  410. package/codeyam-cli/templates/isolation-route/next-app.tsx.template +80 -0
  411. package/codeyam-cli/templates/isolation-route/next-pages.tsx.template +79 -0
  412. package/codeyam-cli/templates/isolation-route/vite-react.tsx.template +78 -0
  413. package/codeyam-cli/templates/msw/browser-setup.ts.template +47 -0
  414. package/codeyam-cli/templates/msw/handler-router.ts.template +47 -0
  415. package/codeyam-cli/templates/msw/server-setup.ts.template +52 -0
  416. package/codeyam-cli/templates/nextjs-prisma-sqlite/PRISMA_SETUP.md +84 -0
  417. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/api/todos/route.ts +17 -0
  418. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/codeyam-isolate/layout.tsx +12 -0
  419. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/globals.css +26 -0
  420. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/layout.tsx +34 -0
  421. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/lib/prisma.ts +19 -0
  422. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/page.tsx +10 -0
  423. package/codeyam-cli/templates/nextjs-prisma-sqlite/eslint.config.mjs +11 -0
  424. package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +64 -0
  425. package/codeyam-cli/templates/nextjs-prisma-sqlite/next.config.ts +14 -0
  426. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +38 -0
  427. package/codeyam-cli/templates/nextjs-prisma-sqlite/postcss.config.mjs +7 -0
  428. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/schema.prisma +27 -0
  429. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/seed.ts +37 -0
  430. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma.config.ts +12 -0
  431. package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +89 -0
  432. package/codeyam-cli/templates/nextjs-prisma-sqlite/tsconfig.json +34 -0
  433. package/codeyam-cli/templates/nextjs-prisma-sqlite/vitest.config.ts +13 -0
  434. package/codeyam-cli/templates/prompts/conversation-guidance.txt +44 -0
  435. package/codeyam-cli/templates/prompts/conversation-prompt.txt +28 -0
  436. package/codeyam-cli/templates/prompts/interruption-prompt.txt +31 -0
  437. package/codeyam-cli/templates/prompts/stale-rules-prompt.txt +24 -0
  438. package/codeyam-cli/templates/rule-notification-hook.py +44 -17
  439. package/codeyam-cli/templates/rule-reflection-hook.py +24 -4
  440. package/codeyam-cli/templates/rules-instructions.md +34 -88
  441. package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +237 -0
  442. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +136 -0
  443. package/codeyam-cli/templates/{codeyam-memory.md → skills/codeyam-memory/SKILL.md} +215 -0
  444. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md +100 -0
  445. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.mjs +139 -0
  446. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.mjs +52 -0
  447. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/misleading-api-prompt.md +117 -0
  448. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/read-json-field.mjs +61 -0
  449. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/ripgrep-fallback.mjs +155 -0
  450. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/analyze-prompt.md +46 -0
  451. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.mjs +13 -0
  452. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter-session.mjs +95 -0
  453. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.mjs +160 -0
  454. package/codeyam-cli/templates/{codeyam-new-rule.md → skills/codeyam-new-rule/SKILL.md} +0 -2
  455. package/package.json +21 -14
  456. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +22 -4
  457. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  458. package/packages/ai/src/lib/completionCall.js +10 -7
  459. package/packages/ai/src/lib/completionCall.js.map +1 -1
  460. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +234 -3
  461. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  462. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js +54 -0
  463. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js.map +1 -0
  464. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js +34 -0
  465. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js.map +1 -0
  466. package/packages/ai/src/lib/generateEntityScenarioData.js +57 -2
  467. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  468. package/packages/ai/src/lib/generateExecutionFlows.js +0 -11
  469. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
  470. package/packages/analyze/src/lib/ProjectAnalyzer.js +13 -4
  471. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  472. package/packages/analyze/src/lib/asts/index.js +4 -2
  473. package/packages/analyze/src/lib/asts/index.js.map +1 -1
  474. package/packages/analyze/src/lib/asts/nodes/getNodeType.js +1 -0
  475. package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
  476. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +8 -1
  477. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  478. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +0 -5
  479. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
  480. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +9 -0
  481. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  482. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +54 -27
  483. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -1
  484. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +65 -0
  485. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  486. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +0 -40
  487. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
  488. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +18 -4
  489. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  490. package/packages/database/index.js +1 -0
  491. package/packages/database/index.js.map +1 -1
  492. package/packages/database/src/lib/kysely/db.js +5 -0
  493. package/packages/database/src/lib/kysely/db.js.map +1 -1
  494. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +51 -0
  495. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  496. package/packages/database/src/lib/loadCommits.js +23 -13
  497. package/packages/database/src/lib/loadCommits.js.map +1 -1
  498. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  499. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  500. package/packages/database/src/lib/updateCommitMetadata.js +100 -89
  501. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  502. package/packages/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  503. package/packages/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  504. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  505. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  506. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  507. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  508. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  509. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  510. package/packages/utils/src/lib/fs/rsyncCopy.js +6 -2
  511. package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  512. package/scripts/npm-post-install.cjs +34 -0
  513. package/codeyam-cli/src/commands/detect-universal-mocks.js +0 -120
  514. package/codeyam-cli/src/commands/detect-universal-mocks.js.map +0 -1
  515. package/codeyam-cli/src/commands/list.js +0 -31
  516. package/codeyam-cli/src/commands/list.js.map +0 -1
  517. package/codeyam-cli/src/commands/webapp-info.js +0 -146
  518. package/codeyam-cli/src/commands/webapp-info.js.map +0 -1
  519. package/codeyam-cli/src/utils/universal-mocks.js +0 -152
  520. package/codeyam-cli/src/utils/universal-mocks.js.map +0 -1
  521. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-EhOseatT.js +0 -34
  522. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DHKuQSmR.js +0 -17
  523. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-JTAjQ54M.js +0 -1
  524. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DjLxr2JB.js +0 -6
  525. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-CtYowLOt.js +0 -6
  526. package/codeyam-cli/src/webserver/build/client/assets/git-BdHOxVfg.js +0 -15
  527. package/codeyam-cli/src/webserver/build/client/assets/globals-CCgBKWy4.css +0 -1
  528. package/codeyam-cli/src/webserver/build/client/assets/labs-BK0C1H1T.js +0 -1
  529. package/codeyam-cli/src/webserver/build/client/assets/manifest-390cb8fa.js +0 -1
  530. package/codeyam-cli/src/webserver/build/client/assets/memory-CzZySbBE.js +0 -78
  531. package/codeyam-cli/src/webserver/build/client/assets/root-DnbDhvTU.js +0 -62
  532. package/codeyam-cli/src/webserver/build/client/assets/settings-CclxrcPK.js +0 -1
  533. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BqgrAzs3.js +0 -1
  534. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-DAFqfEDH.js +0 -2
  535. package/codeyam-cli/src/webserver/build/server/assets/index-CXfuiwt3.js +0 -1
  536. package/codeyam-cli/src/webserver/build/server/assets/server-build-BSvme_Ao.js +0 -259
  537. package/codeyam-cli/templates/codeyam-stop-hook.sh +0 -284
  538. package/scripts/finalize-analyzer.cjs +0 -13
  539. /package/codeyam-cli/templates/{codeyam-diagnose.md → commands/codeyam-diagnose.md} +0 -0
  540. /package/codeyam-cli/templates/{codeyam-debug.md → skills/codeyam-debug/SKILL.md} +0 -0
  541. /package/codeyam-cli/templates/{codeyam-setup.md → skills/codeyam-setup/SKILL.md} +0 -0
  542. /package/codeyam-cli/templates/{codeyam-sim.md → skills/codeyam-sim/SKILL.md} +0 -0
  543. /package/codeyam-cli/templates/{codeyam-test.md → skills/codeyam-test/SKILL.md} +0 -0
  544. /package/codeyam-cli/templates/{codeyam-verify.md → skills/codeyam-verify/SKILL.md} +0 -0
@@ -0,0 +1,117 @@
1
+ # Misleading API Analysis
2
+
3
+ You are analyzing a codebase for **misleading APIs** — exported functions whose names promise one thing but whose implementations do another. These are dangerous because a coding agent reading the function signature will make incorrect assumptions about behavior.
4
+
5
+ ## Input
6
+
7
+ Read the export index from `/tmp/codeyam-memory/exports-scan.json`. It contains:
8
+
9
+ - `files`: Object keyed by file path, each containing an array of `{line, text}` export declarations
10
+ - `stats`: `total_files` and `total_exports` counts
11
+
12
+ ## Analysis Steps
13
+
14
+ ### 1. Triage by Name Pattern
15
+
16
+ Scan all export names and prioritize **pure-sounding** functions — names that imply no side effects or predictable behavior:
17
+
18
+ **Highest priority** (names suggesting pure computation):
19
+
20
+ - `get*`, `compute*`, `calculate*`, `derive*`, `extract*`
21
+ - `is*`, `has*`, `check*`, `can*`
22
+ - `parse*`, `format*`, `transform*`, `convert*`
23
+ - `to*`, `from*`, `create*` (when suggesting a factory)
24
+ - `validate*`, `verify*`
25
+
26
+ **Medium priority** (names suggesting single responsibility):
27
+
28
+ - `save*`, `update*`, `delete*`, `remove*` — check for hidden secondary effects
29
+ - `send*`, `notify*`, `emit*` — check for unexpected mutations
30
+ - `init*`, `setup*`, `configure*` — check for non-obvious global state changes
31
+
32
+ ### 2. Deep Read Suspicious Exports
33
+
34
+ For each pure-sounding or single-responsibility export, use the Read tool to read the **full function implementation** (not just 30 lines — read until the function ends). Look for these red flags:
35
+
36
+ **Side effects in "pure" functions:**
37
+
38
+ - Writes to external state (database, cache, filesystem, global variables)
39
+ - Network calls (fetch, HTTP requests, WebSocket messages)
40
+ - Logging that includes sensitive data or business logic decisions
41
+ - Event emission or pub/sub publishing
42
+
43
+ **Input mutation:**
44
+
45
+ - Modifying objects/arrays passed as arguments (when the name doesn't suggest mutation)
46
+ - Reassigning properties on `this` in methods that sound like getters
47
+
48
+ **Silent error swallowing:**
49
+
50
+ - `catch` blocks that return default values instead of throwing or propagating
51
+ - `try/catch` around critical operations where the function signature suggests it will throw on failure
52
+ - Optional chaining (`?.`) chains that silently return `undefined` for important data
53
+
54
+ **Unexpected returns:**
55
+
56
+ - Function name suggests returning one type but actually returns something different
57
+ - `get*` functions that return `null` or `undefined` instead of throwing when the entity doesn't exist
58
+ - Boolean-named functions (`is*`, `has*`) that return non-boolean values
59
+
60
+ **Hidden coupling:**
61
+
62
+ - Functions that read from or write to module-level state
63
+ - Functions that depend on call order (must call A before B)
64
+ - Functions that modify shared caches or memoization stores
65
+
66
+ ### 3. Scan Non-Pure Exports Too
67
+
68
+ Quickly scan action-oriented exports (`save*`, `update*`, etc.) at a glance for **hidden secondary effects**:
69
+
70
+ - `saveUser()` that also sends a welcome email
71
+ - `deleteProject()` that also archives data elsewhere
72
+ - `updateConfig()` that also restarts a service
73
+
74
+ ### 4. Count Callsites
75
+
76
+ For each finding, use Grep to count how many files import or call the misleading function. More callsites = higher impact.
77
+
78
+ ### 5. Assess Severity
79
+
80
+ - **high**: The mismatch could cause data corruption, silent failures, security issues, or affects >10 callsites
81
+ - **medium**: The mismatch leads to unexpected behavior that would cause bugs, or affects 3–10 callsites
82
+ - **low**: Minor naming inconsistency, affects few callsites, unlikely to cause bugs
83
+
84
+ ## Output
85
+
86
+ Return your findings as a JSON code block in your response, using this format:
87
+
88
+ ```json
89
+ {
90
+ "findings": [
91
+ {
92
+ "type": "misleading-api",
93
+ "function": "functionName",
94
+ "file": "path/to/file.ts",
95
+ "name_implies": "what the name suggests the function does",
96
+ "actually_does": "what it actually does (with specific line numbers for the divergent behavior)",
97
+ "severity": "high|medium|low",
98
+ "callsite_count": 0
99
+ }
100
+ ],
101
+ "stats": {
102
+ "exports_scanned": 0,
103
+ "deep_reads": 0,
104
+ "findings_count": 0
105
+ }
106
+ }
107
+ ```
108
+
109
+ After the JSON block, return a **brief one-paragraph summary** of your findings. Include the number of findings and the most notable misleading API discovered.
110
+
111
+ ## Important Notes
112
+
113
+ - **Read full implementations** — don't just look at the first few lines. Side effects often live at the end of functions or in helper calls.
114
+ - Be conservative with "low" severity findings — only flag things that would actually mislead a coding agent into writing incorrect code
115
+ - **Skip type exports** (type, interface, enum) — these can't have behavioral mismatches
116
+ - **Skip trivial getters** that just return a property — focus on functions with actual logic
117
+ - When a function delegates to a helper, read the helper too if the function name implies purity but the helper name suggests side effects
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env node
2
+ // Lightweight jq replacement for simple field lookups.
3
+ // Usage: node read-json-field.mjs <file> '<expression>'
4
+ // Supports: .field.subfield, .field | length
5
+
6
+ import { readFile } from 'node:fs/promises';
7
+
8
+ const [, , filePath, expression] = process.argv;
9
+
10
+ if (!filePath || !expression) {
11
+ console.error('Usage: node read-json-field.mjs <file> <expression>');
12
+ process.exit(1);
13
+ }
14
+
15
+ try {
16
+ const raw = await readFile(filePath, 'utf-8');
17
+ const data = JSON.parse(raw);
18
+ const result = evaluate(data, expression);
19
+ console.log(typeof result === 'string' ? result : JSON.stringify(result));
20
+ } catch (err) {
21
+ console.error(err.message);
22
+ process.exit(1);
23
+ }
24
+
25
+ function evaluate(data, expr) {
26
+ const trimmed = expr.trim();
27
+
28
+ // Handle pipe: ".field | length"
29
+ const pipeIdx = trimmed.indexOf('|');
30
+ if (pipeIdx !== -1) {
31
+ const left = trimmed.slice(0, pipeIdx).trim();
32
+ const right = trimmed.slice(pipeIdx + 1).trim();
33
+ const intermediate = resolvePath(data, left);
34
+
35
+ if (right === 'length') {
36
+ if (Array.isArray(intermediate)) return intermediate.length;
37
+ if (typeof intermediate === 'object' && intermediate !== null) return Object.keys(intermediate).length;
38
+ if (typeof intermediate === 'string') return intermediate.length;
39
+ throw new Error(`Cannot get length of ${typeof intermediate}`);
40
+ }
41
+ throw new Error(`Unsupported pipe function: ${right}`);
42
+ }
43
+
44
+ return resolvePath(data, trimmed);
45
+ }
46
+
47
+ function resolvePath(data, pathExpr) {
48
+ // Strip leading dot: ".foo.bar" -> "foo.bar"
49
+ const cleaned = pathExpr.startsWith('.') ? pathExpr.slice(1) : pathExpr;
50
+ if (cleaned === '') return data;
51
+
52
+ const keys = cleaned.split('.');
53
+ let current = data;
54
+ for (const key of keys) {
55
+ if (current == null || typeof current !== 'object') {
56
+ throw new Error(`Cannot access '${key}' on ${JSON.stringify(current)}`);
57
+ }
58
+ current = current[key];
59
+ }
60
+ return current;
61
+ }
@@ -0,0 +1,155 @@
1
+ #!/usr/bin/env node
2
+ // Shared ripgrep wrapper with pure-Node fallback when rg is not installed.
3
+
4
+ import { execFile } from 'node:child_process';
5
+ import { readdir, readFile } from 'node:fs/promises';
6
+ import { join } from 'node:path';
7
+
8
+ /**
9
+ * @param {string} pattern - Regex pattern to search for
10
+ * @param {object} [opts]
11
+ * @param {string[]} [opts.types] - File type filters, e.g. ['ts', 'js']
12
+ * @param {string[]} [opts.globs] - Glob filters, e.g. ['!node_modules']
13
+ * @param {number} [opts.context] - Lines of context around matches (-C)
14
+ * @param {boolean} [opts.lineNumbers] - Include line numbers (-n)
15
+ * @param {string} [opts.cwd] - Working directory (defaults to process.cwd())
16
+ * @returns {Promise<string>} ripgrep-compatible output: "file:line:text\n" lines
17
+ */
18
+ export async function ripgrepSearch(pattern, opts = {}) {
19
+ const { types = [], globs = [], context, lineNumbers = true, cwd = process.cwd() } = opts;
20
+
21
+ try {
22
+ return await runRipgrep(pattern, { types, globs, context, lineNumbers, cwd });
23
+ } catch (err) {
24
+ if (err.code === 'ENOENT') {
25
+ // rg not installed — use Node fallback
26
+ return nodeFallback(pattern, { types, globs, context, lineNumbers, cwd });
27
+ }
28
+ throw err;
29
+ }
30
+ }
31
+
32
+ function runRipgrep(pattern, { types, globs, context, lineNumbers, cwd }) {
33
+ return new Promise((resolve, reject) => {
34
+ const args = [];
35
+ if (lineNumbers) args.push('-n');
36
+ if (context != null) args.push('-C', String(context));
37
+ for (const t of types) args.push('--type', t);
38
+ for (const g of globs) args.push('--glob', g);
39
+ args.push(pattern, '.'); // Explicit path prevents rg from reading stdin
40
+
41
+ execFile('rg', args, { cwd, maxBuffer: 50 * 1024 * 1024 }, (err, stdout) => {
42
+ if (err) {
43
+ // Exit code 1 = no matches, 2 = error (e.g. no files searched)
44
+ if (err.code === 1 || err.code === 2) return resolve('');
45
+ // ENOENT = rg binary not found
46
+ if (err.code === 'ENOENT') {
47
+ const e = new Error('rg not found');
48
+ e.code = 'ENOENT';
49
+ return reject(e);
50
+ }
51
+ return reject(err);
52
+ }
53
+ resolve(stdout);
54
+ });
55
+ });
56
+ }
57
+
58
+ const TYPE_EXTENSIONS = {
59
+ ts: ['.ts', '.tsx', '.mts', '.cts'],
60
+ js: ['.js', '.jsx', '.mjs', '.cjs'],
61
+ };
62
+
63
+ const DEFAULT_IGNORE = ['node_modules', 'dist', 'build', '.next', '.git'];
64
+
65
+ async function nodeFallback(pattern, { types = [], globs = [], context, lineNumbers = true, cwd = process.cwd() } = {}) {
66
+ // Build file extension filter from types
67
+ const extensions = new Set();
68
+ for (const t of types) {
69
+ const exts = TYPE_EXTENSIONS[t];
70
+ if (exts) exts.forEach((e) => extensions.add(e));
71
+ }
72
+
73
+ // Parse globs for negative patterns (simple heuristic: "!dirname")
74
+ const ignoreDirs = new Set(DEFAULT_IGNORE);
75
+ for (const g of globs) {
76
+ if (g.startsWith('!')) ignoreDirs.add(g.slice(1));
77
+ }
78
+ // Also handle glob patterns like "!*.d.ts" and "!*.map"
79
+ const ignoreExtensions = new Set();
80
+ for (const g of globs) {
81
+ const m = g.match(/^!\*(\.\w+(?:\.\w+)*)$/);
82
+ if (m) ignoreExtensions.add(m[1]);
83
+ }
84
+
85
+ const regex = new RegExp(pattern);
86
+ const contextLines = context ?? 0;
87
+ const results = [];
88
+
89
+ let entries;
90
+ try {
91
+ entries = await readdir(cwd, { recursive: true });
92
+ } catch {
93
+ return '';
94
+ }
95
+
96
+ for (const relPath of entries) {
97
+ // Skip ignored directories
98
+ const parts = relPath.split('/');
99
+ if (parts.some((p) => ignoreDirs.has(p))) continue;
100
+
101
+ // Check extension filters
102
+ if (extensions.size > 0) {
103
+ const hasMatchingExt = [...extensions].some((ext) => relPath.endsWith(ext));
104
+ if (!hasMatchingExt) continue;
105
+ }
106
+
107
+ // Check ignore extensions
108
+ if ([...ignoreExtensions].some((ext) => relPath.endsWith(ext))) continue;
109
+
110
+ const fullPath = join(cwd, relPath);
111
+ let content;
112
+ try {
113
+ content = await readFile(fullPath, 'utf-8');
114
+ } catch {
115
+ continue;
116
+ }
117
+
118
+ const lines = content.split('\n');
119
+ const matchIndices = [];
120
+ for (let i = 0; i < lines.length; i++) {
121
+ if (regex.test(lines[i])) matchIndices.push(i);
122
+ }
123
+
124
+ if (matchIndices.length === 0) continue;
125
+
126
+ if (contextLines === 0) {
127
+ for (const idx of matchIndices) {
128
+ const lineNum = idx + 1;
129
+ const prefix = lineNumbers ? `${relPath}:${lineNum}:` : `${relPath}:`;
130
+ results.push(`${prefix}${lines[idx]}`);
131
+ }
132
+ } else {
133
+ // With context: output blocks separated by "--"
134
+ const emitted = new Set();
135
+ for (const idx of matchIndices) {
136
+ const start = Math.max(0, idx - contextLines);
137
+ const end = Math.min(lines.length - 1, idx + contextLines);
138
+ for (let i = start; i <= end; i++) {
139
+ if (!emitted.has(i)) {
140
+ emitted.add(i);
141
+ const lineNum = i + 1;
142
+ const sep = i === idx ? ':' : '-';
143
+ const prefix = lineNumbers ? `${relPath}${sep}${lineNum}${sep}` : `${relPath}${sep}`;
144
+ results.push(`${prefix}${lines[i]}`);
145
+ }
146
+ }
147
+ }
148
+ }
149
+ }
150
+
151
+ return results.join('\n') + (results.length > 0 ? '\n' : '');
152
+ }
153
+
154
+ // Exported for testing — not part of the public API.
155
+ export { nodeFallback as _nodeFallback };
@@ -0,0 +1,46 @@
1
+ # Session Log Analysis Prompt
2
+
3
+ You are analyzing a filtered Claude Code session transcript to find instances where Claude got confused about **this specific codebase**. The transcript has been preprocessed — each line is a JSON object with `type` ("user" or "assistant"), `ts` (timestamp), and `content`.
4
+
5
+ ## Your Task
6
+
7
+ Read the session file provided and identify moments where Claude demonstrated confusion that a `.claude/rules/` rule could have prevented.
8
+
9
+ ## Signal Types to Detect
10
+
11
+ 1. **USER_CORRECTION** — The user corrects Claude's approach, code, or assumption. Look for: "no, that's not how...", "actually...", "you need to use X not Y", "that's wrong", explicit disagreement.
12
+
13
+ 2. **RE_EDIT** — Claude edits the same file multiple times in quick succession, indicating the first attempt was wrong. Look for: multiple Edit/Write tool calls targeting the same file path with different content.
14
+
15
+ 3. **FAILED_PIVOT** — A tool call fails (test failure, bash error, type error) and Claude switches to a different approach. Look for: error in tool result followed by a new strategy in the next assistant message.
16
+
17
+ 4. **WRONG_ASSUMPTION** — Claude's thinking or text reveals an incorrect assumption about the codebase. Look for: statements that contradict later evidence, "I assumed...", reasoning that turns out wrong.
18
+
19
+ 5. **TRIBAL_KNOWLEDGE** — The user provides context Claude didn't have but needed. Look for: the user explaining how something works, why something is the way it is, historical context, non-obvious conventions.
20
+
21
+ 6. **APPROACH_PIVOT** — Claude abandons a call chain mid-stream and tries something completely different (without an explicit error triggering it). Look for: sudden topic/strategy shifts in assistant messages.
22
+
23
+ ## Rules for Reporting
24
+
25
+ - **Only report codebase-specific confusion.** Generic programming mistakes (typos, syntax errors, forgetting imports for standard libraries) are NOT worth reporting.
26
+ - **Only report findings where a `.claude/rules/` rule would prevent the confusion.** If the confusion is situational or one-off, skip it.
27
+ - **Maximum 5 findings per session.** Prioritize the strongest, most rule-worthy signals.
28
+ - **Be precise about file paths.** If the confusion relates to specific files, include them.
29
+
30
+ ## Output Format
31
+
32
+ Return a JSON array (no markdown fences, no explanation outside the array). Each element:
33
+
34
+ ```json
35
+ {
36
+ "signal": "USER_CORRECTION | RE_EDIT | FAILED_PIVOT | WRONG_ASSUMPTION | TRIBAL_KNOWLEDGE | APPROACH_PIVOT",
37
+ "summary": "One sentence describing what went wrong",
38
+ "evidence": "Brief quote or paraphrase from the session proving this happened",
39
+ "file_path": "path/to/relevant/file.ts or null if not file-specific",
40
+ "topic": "kebab-case-topic-label",
41
+ "rule_worthy": true,
42
+ "rule_worthy_reason": "Why a rule would prevent this from recurring"
43
+ }
44
+ ```
45
+
46
+ If the session contains no codebase-specific confusion worth documenting, return an empty array: `[]`
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ // Removes cached preprocessed session files.
3
+
4
+ import { rm } from 'node:fs/promises';
5
+
6
+ const OUTPUT_DIR = '/tmp/cc-session-analysis';
7
+
8
+ try {
9
+ await rm(OUTPUT_DIR, { recursive: true, force: true });
10
+ console.log(`Cleaned up ${OUTPUT_DIR}`);
11
+ } catch {
12
+ console.log(`Nothing to clean up (${OUTPUT_DIR} does not exist)`);
13
+ }
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env node
2
+ // Session log filter — replaces filter.jq.
3
+ // Strips progress/system/queue records, compresses tool inputs to 300 chars,
4
+ // tool results to 500 chars, thinking to 1000 chars. Output is compact JSONL.
5
+
6
+ import { createReadStream } from 'node:fs';
7
+ import { createInterface } from 'node:readline';
8
+
9
+ /**
10
+ * Filter a single parsed session log object.
11
+ * Returns the filtered object, or null if it should be skipped.
12
+ */
13
+ export function filterSessionLine(obj) {
14
+ if (obj.type === 'assistant') {
15
+ const contentItems = obj.message?.content;
16
+ if (!Array.isArray(contentItems)) return null;
17
+
18
+ const filtered = [];
19
+ for (const item of contentItems) {
20
+ if (item.type === 'text') {
21
+ filtered.push({ t: 'text', text: item.text });
22
+ } else if (item.type === 'thinking') {
23
+ const thinking = item.thinking ?? '';
24
+ filtered.push({
25
+ t: 'think',
26
+ thinking: thinking.length > 1000 ? thinking.slice(0, 1000) + '...[truncated]' : thinking,
27
+ });
28
+ } else if (item.type === 'tool_use') {
29
+ const inputStr = typeof item.input === 'string' ? item.input : JSON.stringify(item.input);
30
+ filtered.push({
31
+ t: 'tool',
32
+ name: item.name,
33
+ input: inputStr.length > 300 ? inputStr.slice(0, 300) + '...' : inputStr,
34
+ });
35
+ }
36
+ }
37
+
38
+ return { type: 'assistant', ts: obj.timestamp, content: filtered };
39
+ }
40
+
41
+ if (obj.type === 'user') {
42
+ const msgContent = obj.message?.content;
43
+
44
+ if (typeof msgContent === 'string') {
45
+ return { type: 'user', ts: obj.timestamp, content: msgContent };
46
+ }
47
+
48
+ if (Array.isArray(msgContent)) {
49
+ const items = [];
50
+ for (const item of msgContent) {
51
+ if (item.type === 'tool_result') {
52
+ const contentStr = typeof item.content === 'string' ? item.content : JSON.stringify(item.content);
53
+ items.push({
54
+ t: 'result',
55
+ id: item.tool_use_id,
56
+ err: item.is_error ?? false,
57
+ content: contentStr.length > 500 ? contentStr.slice(0, 500) + '...[truncated]' : contentStr,
58
+ });
59
+ } else {
60
+ const text = typeof item === 'string' ? item : JSON.stringify(item);
61
+ items.push({
62
+ t: 'msg',
63
+ text: text.length > 500 ? text.slice(0, 500) + '...[truncated]' : text,
64
+ });
65
+ }
66
+ }
67
+ return { type: 'user', ts: obj.timestamp, content: items };
68
+ }
69
+
70
+ // Fallback: stringify whatever content is
71
+ const fallback = typeof msgContent === 'string' ? msgContent : JSON.stringify(msgContent);
72
+ return {
73
+ type: 'user',
74
+ ts: obj.timestamp,
75
+ content: fallback.length > 500 ? fallback.slice(0, 500) + '...[truncated]' : fallback,
76
+ };
77
+ }
78
+
79
+ return null;
80
+ }
81
+
82
+ // Standalone mode: node filter-session.mjs input.jsonl → filtered JSONL to stdout
83
+ const inputFile = process.argv[2];
84
+ if (inputFile) {
85
+ const rl = createInterface({ input: createReadStream(inputFile) });
86
+ for await (const line of rl) {
87
+ try {
88
+ const obj = JSON.parse(line);
89
+ const result = filterSessionLine(obj);
90
+ if (result) console.log(JSON.stringify(result));
91
+ } catch {
92
+ // Skip malformed lines (matching jq's silent-skip behavior)
93
+ }
94
+ }
95
+ }
@@ -0,0 +1,160 @@
1
+ #!/usr/bin/env node
2
+ // Preprocesses Claude Code session logs for the codeyam-memory skill.
3
+ // Replaces preprocess.sh — no jq or platform-specific stat required.
4
+ //
5
+ // - Finds JSONL session files (>=10KB, last 30 days)
6
+ // - Excludes the current active session
7
+ // - Runs JS filter for 5-50x compression
8
+ // - Caches results in /tmp/cc-session-analysis/
9
+ // - Prints filtered file paths to stdout (one per line)
10
+
11
+ import { readdir, stat, mkdir, readFile, rm } from 'node:fs/promises';
12
+ import { createReadStream, createWriteStream } from 'node:fs';
13
+ import { createInterface } from 'node:readline';
14
+ import { join, basename } from 'node:path';
15
+ import { homedir } from 'node:os';
16
+ import { filterSessionLine } from './filter-session.mjs';
17
+
18
+ const OUTPUT_DIR = '/tmp/cc-session-analysis';
19
+ const MIN_SIZE = 10240; // 10KB
20
+ const MAX_AGE_DAYS = 30;
21
+ const MAX_SESSIONS = 30;
22
+ const FILTER_TIMEOUT = 30_000; // 30s per file
23
+
24
+ // Compute Claude project directory (mirrors Claude Code's path hashing)
25
+ const projectDir = process.cwd();
26
+ const projectHash = projectDir.replace(/[/.]/g, '-');
27
+ const sessionDir = join(homedir(), '.claude', 'projects', projectHash);
28
+
29
+ // Check session directory exists
30
+ try {
31
+ await stat(sessionDir);
32
+ } catch {
33
+ process.stderr.write(`No Claude session directory found at ${sessionDir}\n`);
34
+ process.stderr.write('This project may not have any Claude Code session history.\n');
35
+ process.exit(0);
36
+ }
37
+
38
+ // Find eligible session files
39
+ await mkdir(OUTPUT_DIR, { recursive: true });
40
+
41
+ const entries = await readdir(sessionDir);
42
+ const now = Date.now();
43
+ const maxAgeMs = MAX_AGE_DAYS * 24 * 60 * 60 * 1000;
44
+
45
+ const sessionFiles = [];
46
+ for (const name of entries) {
47
+ if (!name.endsWith('.jsonl')) continue;
48
+ const fullPath = join(sessionDir, name);
49
+ try {
50
+ const st = await stat(fullPath);
51
+ if (!st.isFile()) continue;
52
+ if (st.size < MIN_SIZE) continue;
53
+ if (now - st.mtimeMs > maxAgeMs) continue;
54
+ sessionFiles.push({ path: fullPath, mtimeMs: st.mtimeMs });
55
+ } catch {
56
+ continue;
57
+ }
58
+ }
59
+
60
+ if (sessionFiles.length === 0) process.exit(0);
61
+
62
+ // Sort newest first, cap to MAX_SESSIONS
63
+ sessionFiles.sort((a, b) => b.mtimeMs - a.mtimeMs);
64
+ if (sessionFiles.length > MAX_SESSIONS) {
65
+ process.stderr.write(`Note: ${sessionFiles.length} sessions found, capping to ${MAX_SESSIONS} most recent\n`);
66
+ }
67
+ const sessions = sessionFiles.slice(0, MAX_SESSIONS);
68
+
69
+ // Determine active session to exclude
70
+ let activeSession = '';
71
+ const claudeSessionId = process.env.CLAUDE_SESSION_ID;
72
+ if (claudeSessionId) {
73
+ const match = sessions.find((s) => basename(s.path, '.jsonl') === claudeSessionId);
74
+ if (match) activeSession = match.path;
75
+ }
76
+ if (!activeSession && sessions.length > 0) {
77
+ activeSession = sessions[0].path; // newest = likely active
78
+ }
79
+
80
+ // Process each session
81
+ for (const session of sessions) {
82
+ if (session.path === activeSession) continue;
83
+
84
+ const uuid = basename(session.path, '.jsonl');
85
+ const filtered = join(OUTPUT_DIR, `${uuid}.filtered.jsonl`);
86
+
87
+ // Check cache: skip if filtered file has a valid sentinel
88
+ try {
89
+ const firstLine = (await readFile(filtered, 'utf-8')).split('\n')[0];
90
+ const sentinel = JSON.parse(firstLine);
91
+ if (sentinel.processed_at) {
92
+ console.log(filtered);
93
+ continue;
94
+ }
95
+ } catch {
96
+ // No cache or invalid — reprocess
97
+ }
98
+
99
+ // Filter with timeout
100
+ try {
101
+ await filterFile(session.path, filtered);
102
+ console.log(filtered);
103
+ } catch (err) {
104
+ if (err.name === 'AbortError') {
105
+ process.stderr.write(`Warning: filter timed out after ${FILTER_TIMEOUT / 1000}s on ${basename(session.path)} — skipping\n`);
106
+ await rm(filtered, { force: true });
107
+ } else {
108
+ process.stderr.write(`Warning: error processing ${basename(session.path)}: ${err.message}\n`);
109
+ await rm(filtered, { force: true });
110
+ }
111
+ }
112
+ }
113
+
114
+ async function filterFile(inputPath, outputPath) {
115
+ const ac = new AbortController();
116
+ const timer = setTimeout(() => ac.abort(), FILTER_TIMEOUT);
117
+
118
+ try {
119
+ const st = await stat(inputPath);
120
+ const sentinel = JSON.stringify({
121
+ processed_at: new Date().toISOString(),
122
+ source_size: st.size,
123
+ });
124
+
125
+ const output = createWriteStream(outputPath);
126
+ output.write(sentinel + '\n');
127
+
128
+ const rl = createInterface({
129
+ input: createReadStream(inputPath),
130
+ signal: ac.signal,
131
+ });
132
+
133
+ let lineCount = 0;
134
+ for await (const line of rl) {
135
+ try {
136
+ const obj = JSON.parse(line);
137
+ const result = filterSessionLine(obj);
138
+ if (result) {
139
+ output.write(JSON.stringify(result) + '\n');
140
+ lineCount++;
141
+ }
142
+ } catch {
143
+ // Skip malformed lines
144
+ }
145
+ }
146
+
147
+ output.end();
148
+ await new Promise((resolve, reject) => {
149
+ output.on('finish', resolve);
150
+ output.on('error', reject);
151
+ });
152
+
153
+ // Remove files with no content beyond the sentinel
154
+ if (lineCount === 0) {
155
+ await rm(outputPath, { force: true });
156
+ }
157
+ } finally {
158
+ clearTimeout(timer);
159
+ }
160
+ }
@@ -9,5 +9,3 @@ description: |
9
9
  # Create New Claude Rule
10
10
 
11
11
  Read `.codeyam/rules/instructions.md` for detailed guidance on structure and formatting.
12
-
13
- If the instructions file doesn't exist, copy it from `codeyam-cli/templates/rules-instructions.md`.