@codeyam/codeyam-cli 0.1.6 → 0.1.8

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 (398) 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 +6 -6
  4. package/analyzer-template/packages/ai/package.json +1 -1
  5. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +34 -3
  6. package/analyzer-template/packages/ai/src/lib/completionCall.ts +14 -2
  7. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +27 -0
  8. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.ts +62 -0
  9. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +78 -2
  10. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +6 -0
  11. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +9 -1
  12. package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +0 -6
  13. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +12 -0
  14. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +65 -28
  15. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +83 -0
  16. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +23 -4
  17. package/analyzer-template/packages/aws/package.json +1 -1
  18. package/analyzer-template/packages/database/index.ts +1 -0
  19. package/analyzer-template/packages/database/package.json +3 -3
  20. package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -0
  21. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +62 -0
  22. package/analyzer-template/packages/database/src/lib/loadCommits.ts +31 -20
  23. package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +0 -5
  24. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +151 -135
  25. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatus.ts +58 -42
  26. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.ts +81 -65
  27. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +29 -1
  28. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +33 -5
  29. package/analyzer-template/packages/github/dist/database/index.d.ts +1 -0
  30. package/analyzer-template/packages/github/dist/database/index.d.ts.map +1 -1
  31. package/analyzer-template/packages/github/dist/database/index.js +1 -0
  32. package/analyzer-template/packages/github/dist/database/index.js.map +1 -1
  33. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -0
  34. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  35. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +5 -0
  36. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  37. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +20 -0
  38. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -0
  39. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +45 -0
  40. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  41. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +5 -0
  42. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  43. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  44. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +23 -13
  45. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  46. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
  47. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  48. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  49. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  50. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +100 -89
  51. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  52. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.d.ts.map +1 -1
  53. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  54. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  55. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.d.ts.map +1 -1
  56. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  57. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  58. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -1
  59. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  60. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  61. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  62. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  63. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  64. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +1 -0
  65. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  66. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +10 -0
  67. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  68. package/analyzer-template/packages/github/package.json +1 -1
  69. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +1 -0
  70. package/analyzer-template/packages/types/src/types/Scenario.ts +10 -0
  71. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +1 -0
  72. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  73. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +10 -0
  74. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  75. package/analyzer-template/playwright/captureFromUrl.ts +89 -82
  76. package/analyzer-template/project/constructMockCode.ts +136 -43
  77. package/analyzer-template/project/reconcileMockDataKeys.ts +19 -14
  78. package/analyzer-template/project/start.ts +3 -0
  79. package/analyzer-template/project/startScenarioCapture.ts +9 -0
  80. package/analyzer-template/project/writeClientLogRoute.ts +125 -0
  81. package/analyzer-template/project/writeMockDataTsx.ts +17 -0
  82. package/analyzer-template/project/writeScenarioComponents.ts +36 -7
  83. package/analyzer-template/tsconfig.json +13 -1
  84. package/background/src/lib/virtualized/project/constructMockCode.js +115 -34
  85. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  86. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +17 -11
  87. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  88. package/background/src/lib/virtualized/project/start.js +2 -0
  89. package/background/src/lib/virtualized/project/start.js.map +1 -1
  90. package/background/src/lib/virtualized/project/startScenarioCapture.js +5 -0
  91. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  92. package/background/src/lib/virtualized/project/writeClientLogRoute.js +110 -0
  93. package/background/src/lib/virtualized/project/writeClientLogRoute.js.map +1 -0
  94. package/background/src/lib/virtualized/project/writeMockDataTsx.js +12 -0
  95. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  96. package/background/src/lib/virtualized/project/writeScenarioComponents.js +29 -7
  97. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  98. package/codeyam-cli/scripts/apply-setup.js +208 -11
  99. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  100. package/codeyam-cli/src/cli.js +2 -0
  101. package/codeyam-cli/src/cli.js.map +1 -1
  102. package/codeyam-cli/src/commands/analyze.js +17 -7
  103. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  104. package/codeyam-cli/src/commands/default.js +58 -3
  105. package/codeyam-cli/src/commands/default.js.map +1 -1
  106. package/codeyam-cli/src/commands/editor.js +1839 -0
  107. package/codeyam-cli/src/commands/editor.js.map +1 -0
  108. package/codeyam-cli/src/commands/init.js +40 -11
  109. package/codeyam-cli/src/commands/init.js.map +1 -1
  110. package/codeyam-cli/src/commands/memory.js +26 -2
  111. package/codeyam-cli/src/commands/memory.js.map +1 -1
  112. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +246 -0
  113. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
  114. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +126 -0
  115. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
  116. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +295 -0
  117. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -0
  118. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js +270 -0
  119. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js.map +1 -0
  120. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +100 -0
  121. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -0
  122. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +147 -0
  123. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
  124. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +76 -0
  125. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
  126. package/codeyam-cli/src/utils/__tests__/git.editor.test.js +134 -0
  127. package/codeyam-cli/src/utils/__tests__/git.editor.test.js.map +1 -0
  128. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js +9 -0
  129. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js.map +1 -1
  130. package/codeyam-cli/src/utils/__tests__/project.test.js +65 -0
  131. package/codeyam-cli/src/utils/__tests__/project.test.js.map +1 -0
  132. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js +121 -0
  133. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js.map +1 -0
  134. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +26 -0
  135. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  136. package/codeyam-cli/src/utils/backgroundServer.js +19 -3
  137. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  138. package/codeyam-cli/src/utils/buildFlags.js +4 -0
  139. package/codeyam-cli/src/utils/buildFlags.js.map +1 -0
  140. package/codeyam-cli/src/utils/devModeEvents.js +40 -0
  141. package/codeyam-cli/src/utils/devModeEvents.js.map +1 -0
  142. package/codeyam-cli/src/utils/editorAudit.js +82 -0
  143. package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
  144. package/codeyam-cli/src/utils/editorDevServer.js +98 -0
  145. package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
  146. package/codeyam-cli/src/utils/editorJournal.js +137 -0
  147. package/codeyam-cli/src/utils/editorJournal.js.map +1 -0
  148. package/codeyam-cli/src/utils/editorMockState.js +248 -0
  149. package/codeyam-cli/src/utils/editorMockState.js.map +1 -0
  150. package/codeyam-cli/src/utils/editorPreloadHelpers.js +64 -0
  151. package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -0
  152. package/codeyam-cli/src/utils/editorPreview.js +66 -0
  153. package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
  154. package/codeyam-cli/src/utils/editorScenarios.js +56 -0
  155. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
  156. package/codeyam-cli/src/utils/fileMetadata.js +5 -0
  157. package/codeyam-cli/src/utils/fileMetadata.js.map +1 -1
  158. package/codeyam-cli/src/utils/fileWatcher.js +25 -9
  159. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  160. package/codeyam-cli/src/utils/git.js +103 -0
  161. package/codeyam-cli/src/utils/git.js.map +1 -1
  162. package/codeyam-cli/src/utils/install-skills.js +55 -13
  163. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  164. package/codeyam-cli/src/utils/interactiveSyncWatcher.js +126 -0
  165. package/codeyam-cli/src/utils/interactiveSyncWatcher.js.map +1 -0
  166. package/codeyam-cli/src/utils/pathIgnoring.js +19 -7
  167. package/codeyam-cli/src/utils/pathIgnoring.js.map +1 -1
  168. package/codeyam-cli/src/utils/project.js +15 -5
  169. package/codeyam-cli/src/utils/project.js.map +1 -1
  170. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js +11 -11
  171. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js.map +1 -1
  172. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +22 -0
  173. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  174. package/codeyam-cli/src/utils/queue/heartbeat.js +13 -5
  175. package/codeyam-cli/src/utils/queue/heartbeat.js.map +1 -1
  176. package/codeyam-cli/src/utils/queue/job.js +70 -1
  177. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  178. package/codeyam-cli/src/utils/queue/manager.js +7 -6
  179. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  180. package/codeyam-cli/src/utils/scenarioMarkers.js +134 -0
  181. package/codeyam-cli/src/utils/scenarioMarkers.js.map +1 -0
  182. package/codeyam-cli/src/utils/serverState.js +27 -2
  183. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  184. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +45 -4
  185. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  186. package/codeyam-cli/src/utils/testRunner.js +158 -0
  187. package/codeyam-cli/src/utils/testRunner.js.map +1 -0
  188. package/codeyam-cli/src/utils/transcriptPruning.js +67 -0
  189. package/codeyam-cli/src/utils/transcriptPruning.js.map +1 -0
  190. package/codeyam-cli/src/utils/webappDetection.js +14 -2
  191. package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
  192. package/codeyam-cli/src/webserver/app/lib/database.js +41 -27
  193. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  194. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  195. package/codeyam-cli/src/webserver/backgroundServer.js +109 -19
  196. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  197. package/codeyam-cli/src/webserver/build/client/assets/{CopyButton-CtmbP4Gl.js → CopyButton-DmJveP3T.js} +1 -1
  198. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-DlMph_Hm.js → EntityItem-C76mRRiF.js} +1 -1
  199. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-B-0PjGOU.js → EntityTypeBadge-g3saevPb.js} +1 -1
  200. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-DN9eiJAO.js → EntityTypeIcon-CobE682z.js} +1 -1
  201. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +1 -0
  202. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-rE_fI2h2.js → InteractivePreview-DYFW3lDD.js} +3 -3
  203. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CnatsCw2.js → LibraryFunctionPreview-DLeucoVX.js} +1 -1
  204. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-CSP6DZrh.js → LoadingDots-BU_OAEMP.js} +1 -1
  205. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-CMK8Q7yk.js → LogViewer-ceAyBX-H.js} +1 -1
  206. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-TCV_HBjy.js → ReportIssueModal-djPLI-WV.js} +1 -1
  207. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-CG2uh31y.js → SafeScreenshot-BED4B6sP.js} +1 -1
  208. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-CU_TDYd8.js → ScenarioViewer-B76aig_2.js} +1 -1
  209. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +34 -0
  210. package/codeyam-cli/src/webserver/build/client/assets/Terminal-Dnj5CY9R.js +41 -0
  211. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-D7IoaWUW.js → TruncatedFilePath-C8OKAR5x.js} +1 -1
  212. package/codeyam-cli/src/webserver/build/client/assets/{_index-B8z7mjR-.js → _index-C96V0n15.js} +1 -1
  213. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-DZu78RI1.js → activity.(_tab)-BpKzcsJz.js} +1 -1
  214. package/codeyam-cli/src/webserver/build/client/assets/addon-fit-CUXOrorO.js +1 -0
  215. package/codeyam-cli/src/webserver/build/client/assets/addon-web-links-Duc5hnl7.js +1 -0
  216. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-D9hemwl6.js +22 -0
  217. package/codeyam-cli/src/webserver/build/client/assets/api.dev-mode-events-l0sNRNKZ.js +1 -0
  218. package/codeyam-cli/src/webserver/build/client/assets/api.editor-audit-l0sNRNKZ.js +1 -0
  219. package/codeyam-cli/src/webserver/build/client/assets/api.editor-capture-scenario-l0sNRNKZ.js +1 -0
  220. package/codeyam-cli/src/webserver/build/client/assets/api.editor-client-errors-l0sNRNKZ.js +1 -0
  221. package/codeyam-cli/src/webserver/build/client/assets/api.editor-commit-l0sNRNKZ.js +1 -0
  222. package/codeyam-cli/src/webserver/build/client/assets/api.editor-dev-server-l0sNRNKZ.js +1 -0
  223. package/codeyam-cli/src/webserver/build/client/assets/api.editor-entity-status-l0sNRNKZ.js +1 -0
  224. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-entry-l0sNRNKZ.js +1 -0
  225. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-image._-l0sNRNKZ.js +1 -0
  226. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-l0sNRNKZ.js +1 -0
  227. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-screenshot-l0sNRNKZ.js +1 -0
  228. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-update-l0sNRNKZ.js +1 -0
  229. package/codeyam-cli/src/webserver/build/client/assets/api.editor-load-commit-l0sNRNKZ.js +1 -0
  230. package/codeyam-cli/src/webserver/build/client/assets/api.editor-refresh-l0sNRNKZ.js +1 -0
  231. package/codeyam-cli/src/webserver/build/client/assets/api.editor-register-scenario-l0sNRNKZ.js +1 -0
  232. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-data-l0sNRNKZ.js +1 -0
  233. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-image._-l0sNRNKZ.js +1 -0
  234. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenarios-l0sNRNKZ.js +1 -0
  235. package/codeyam-cli/src/webserver/build/client/assets/api.editor-switch-scenario-l0sNRNKZ.js +1 -0
  236. package/codeyam-cli/src/webserver/build/client/assets/api.editor-test-results-l0sNRNKZ.js +1 -0
  237. package/codeyam-cli/src/webserver/build/client/assets/{book-open-Bp5FLkd4.js → book-open-D_nMCFmP.js} +1 -1
  238. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-DQJA9f4o.js → chevron-down-BH2h1Ea2.js} +1 -1
  239. package/codeyam-cli/src/webserver/build/client/assets/{chunk-JZWAC4HX-7VptmeIr.js → chunk-JZWAC4HX-C4pqxYJB.js} +1 -1
  240. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-B6C4LY9o.js → circle-check-DyIKORY6.js} +1 -1
  241. package/codeyam-cli/src/webserver/build/client/assets/{copy-6nzYCu0G.js → copy-NDbZjXao.js} +1 -1
  242. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-D-QUFOwe.js → createLucideIcon-CMT1jU2q.js} +1 -1
  243. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BiM6z3Do.js +1 -0
  244. package/codeyam-cli/src/webserver/build/client/assets/editor-D1DAKXtT.js +8 -0
  245. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._--zvFJ4OH.js → entity._sha._-CrjR3zZW.js} +10 -10
  246. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-DkzqFzFj.js +6 -0
  247. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-C28BiQzt.js +6 -0
  248. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +6 -0
  249. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-C7ysA4Jq.js → entity._sha_.edit._scenarioId-BMvVHNXU.js} +2 -2
  250. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-CU6EUArK.js → entry.client-DTvKq3TY.js} +1 -1
  251. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-EWpfFU4X.js → fileTableUtils-cPo8LiG3.js} +1 -1
  252. package/codeyam-cli/src/webserver/build/client/assets/{files-CrxAoWIL.js → files-DO4CZ16O.js} +1 -1
  253. package/codeyam-cli/src/webserver/build/client/assets/{git-BldHtKeW.js → git-CFCTYk9I.js} +1 -1
  254. package/codeyam-cli/src/webserver/build/client/assets/globals-B17TBSS6.css +1 -0
  255. package/codeyam-cli/src/webserver/build/client/assets/{index-7-1FmlHo.js → index-10oVnAAH.js} +1 -1
  256. package/codeyam-cli/src/webserver/build/client/assets/{index-DuYcwYp_.js → index-BcvgDzbZ.js} +1 -1
  257. package/codeyam-cli/src/webserver/build/client/assets/{labs-CPPVOSWB.js → labs-Zk7ryIM1.js} +1 -1
  258. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-BnDcD54R.js → loader-circle-BAXYRVEO.js} +1 -1
  259. package/codeyam-cli/src/webserver/build/client/assets/manifest-a632de18.js +1 -0
  260. package/codeyam-cli/src/webserver/build/client/assets/memory-Dg0mvYrI.js +96 -0
  261. package/codeyam-cli/src/webserver/build/client/assets/{pause-DhQX2g22.js → pause-DTAcYxBt.js} +1 -1
  262. package/codeyam-cli/src/webserver/build/client/assets/root-DUKqhFlb.js +67 -0
  263. package/codeyam-cli/src/webserver/build/client/assets/{search-DborVoKD.js → search-fKo7v0Zo.js} +1 -1
  264. package/codeyam-cli/src/webserver/build/client/assets/settings-DfuTtcJP.js +1 -0
  265. package/codeyam-cli/src/webserver/build/client/assets/{simulations-BtrtCYJg.js → simulations-B3aOzpCZ.js} +1 -1
  266. package/codeyam-cli/src/webserver/build/client/assets/{terminal-Bs4NC-VZ.js → terminal-BG4heKCG.js} +1 -1
  267. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-DTf3Jojp.js → triangle-alert-DtSmdtM4.js} +1 -1
  268. package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-D_bDZyDU.js → useCustomSizes-ByhSyh0W.js} +1 -1
  269. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C14nCb1q.js +2 -0
  270. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-BsQb6rFd.js → useReportContext-O-jkvSPx.js} +1 -1
  271. package/codeyam-cli/src/webserver/build/client/assets/{useToast-BOur3mUv.js → useToast-9FIWuYfK.js} +1 -1
  272. package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
  273. package/codeyam-cli/src/webserver/build/server/assets/index-HfLydfDq.js +1 -0
  274. package/codeyam-cli/src/webserver/build/server/assets/server-build-CUu_F-oo.js +366 -0
  275. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  276. package/codeyam-cli/src/webserver/build-info.json +5 -5
  277. package/codeyam-cli/src/webserver/devServer.js +39 -5
  278. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  279. package/codeyam-cli/src/webserver/editorProxy.js +440 -0
  280. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -0
  281. package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +175 -0
  282. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +140 -0
  283. package/codeyam-cli/src/webserver/server.js +226 -1
  284. package/codeyam-cli/src/webserver/server.js.map +1 -1
  285. package/codeyam-cli/src/webserver/terminalServer.js +698 -0
  286. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -0
  287. package/codeyam-cli/templates/codeyam-editor-claude.md +68 -0
  288. package/codeyam-cli/templates/editor-step-hook.py +147 -0
  289. package/codeyam-cli/templates/isolation-route/next-app.tsx.template +80 -0
  290. package/codeyam-cli/templates/isolation-route/next-pages.tsx.template +79 -0
  291. package/codeyam-cli/templates/isolation-route/vite-react.tsx.template +78 -0
  292. package/codeyam-cli/templates/msw/browser-setup.ts.template +47 -0
  293. package/codeyam-cli/templates/msw/handler-router.ts.template +47 -0
  294. package/codeyam-cli/templates/msw/server-setup.ts.template +52 -0
  295. package/codeyam-cli/templates/nextjs-prisma-sqlite/PRISMA_SETUP.md +84 -0
  296. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/api/todos/route.ts +17 -0
  297. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/globals.css +26 -0
  298. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/layout.tsx +34 -0
  299. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/lib/prisma.ts +19 -0
  300. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/page.tsx +10 -0
  301. package/codeyam-cli/templates/nextjs-prisma-sqlite/eslint.config.mjs +11 -0
  302. package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +43 -0
  303. package/codeyam-cli/templates/nextjs-prisma-sqlite/next.config.ts +14 -0
  304. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +35 -0
  305. package/codeyam-cli/templates/nextjs-prisma-sqlite/postcss.config.mjs +7 -0
  306. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/schema.prisma +27 -0
  307. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/seed.ts +37 -0
  308. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma.config.ts +12 -0
  309. package/codeyam-cli/templates/nextjs-prisma-sqlite/tsconfig.json +34 -0
  310. package/codeyam-cli/templates/prompts/conversation-guidance.txt +12 -0
  311. package/codeyam-cli/templates/prompts/conversation-prompt.txt +3 -3
  312. package/codeyam-cli/templates/prompts/interruption-prompt.txt +3 -3
  313. package/codeyam-cli/templates/prompts/stale-rules-prompt.txt +3 -3
  314. package/codeyam-cli/templates/rule-notification-hook.py +44 -17
  315. package/codeyam-cli/templates/rule-reflection-hook.py +24 -4
  316. package/codeyam-cli/templates/rules-instructions.md +4 -3
  317. package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +237 -0
  318. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +69 -0
  319. package/codeyam-cli/templates/{codeyam-memory.md → skills/codeyam-memory/SKILL.md} +215 -0
  320. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md +100 -0
  321. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.sh +108 -0
  322. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.sh +69 -0
  323. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/misleading-api-prompt.md +117 -0
  324. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/analyze-prompt.md +46 -0
  325. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.sh +12 -0
  326. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter.jq +45 -0
  327. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.sh +139 -0
  328. package/package.json +4 -2
  329. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +22 -4
  330. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  331. package/packages/ai/src/lib/completionCall.js +10 -2
  332. package/packages/ai/src/lib/completionCall.js.map +1 -1
  333. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +21 -0
  334. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  335. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js +54 -0
  336. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js.map +1 -0
  337. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js +34 -0
  338. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js.map +1 -0
  339. package/packages/ai/src/lib/generateEntityScenarioData.js +57 -2
  340. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  341. package/packages/analyze/src/lib/ProjectAnalyzer.js +3 -0
  342. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  343. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +8 -1
  344. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  345. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +0 -5
  346. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
  347. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +9 -0
  348. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  349. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +54 -27
  350. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -1
  351. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +65 -0
  352. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  353. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +18 -4
  354. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  355. package/packages/database/index.js +1 -0
  356. package/packages/database/index.js.map +1 -1
  357. package/packages/database/src/lib/kysely/db.js +5 -0
  358. package/packages/database/src/lib/kysely/db.js.map +1 -1
  359. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +45 -0
  360. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  361. package/packages/database/src/lib/loadCommits.js +23 -13
  362. package/packages/database/src/lib/loadCommits.js.map +1 -1
  363. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  364. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  365. package/packages/database/src/lib/updateCommitMetadata.js +100 -89
  366. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  367. package/packages/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  368. package/packages/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  369. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  370. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  371. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  372. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  373. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  374. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  375. package/scripts/npm-post-install.cjs +34 -0
  376. package/codeyam-cli/src/webserver/app/routes/api.agent-transcripts.js +0 -486
  377. package/codeyam-cli/src/webserver/app/routes/api.agent-transcripts.js.map +0 -1
  378. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-C1rIyZdV.js +0 -34
  379. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DxCa1oBt.js +0 -23
  380. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DmzSmblj.js +0 -1
  381. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DVTcUnur.js +0 -6
  382. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-BVgNO76F.js +0 -6
  383. package/codeyam-cli/src/webserver/build/client/assets/globals-B4MPiL7S.css +0 -1
  384. package/codeyam-cli/src/webserver/build/client/assets/manifest-c1fc3656.js +0 -1
  385. package/codeyam-cli/src/webserver/build/client/assets/memory-CfpYxpNu.js +0 -93
  386. package/codeyam-cli/src/webserver/build/client/assets/root-CAAbm4U5.js +0 -62
  387. package/codeyam-cli/src/webserver/build/client/assets/settings-BpLDWmGh.js +0 -1
  388. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-DZp6rrQD.js +0 -2
  389. package/codeyam-cli/src/webserver/build/server/assets/index-B8A_aaGG.js +0 -1
  390. package/codeyam-cli/src/webserver/build/server/assets/server-build-69rRZnZo.js +0 -286
  391. package/scripts/finalize-analyzer.cjs +0 -13
  392. /package/codeyam-cli/templates/{codeyam-diagnose.md → commands/codeyam-diagnose.md} +0 -0
  393. /package/codeyam-cli/templates/{codeyam-debug.md → skills/codeyam-debug/SKILL.md} +0 -0
  394. /package/codeyam-cli/templates/{codeyam-new-rule.md → skills/codeyam-new-rule/SKILL.md} +0 -0
  395. /package/codeyam-cli/templates/{codeyam-setup.md → skills/codeyam-setup/SKILL.md} +0 -0
  396. /package/codeyam-cli/templates/{codeyam-sim.md → skills/codeyam-sim/SKILL.md} +0 -0
  397. /package/codeyam-cli/templates/{codeyam-test.md → skills/codeyam-test/SKILL.md} +0 -0
  398. /package/codeyam-cli/templates/{codeyam-verify.md → skills/codeyam-verify/SKILL.md} +0 -0
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env bash
2
+ # Gathers deprecation signals from package.json, source markers, and git history.
3
+ # Outputs structured JSON to /tmp/codeyam-memory/deprecated-scan.json
4
+
5
+ set -euo pipefail
6
+
7
+ OUTPUT_DIR="/tmp/codeyam-memory"
8
+ OUTPUT_FILE="$OUTPUT_DIR/deprecated-scan.json"
9
+ mkdir -p "$OUTPUT_DIR"
10
+
11
+ # --- Dependency scan ---
12
+ # Collect all dependency names from package.json files (root + workspace packages)
13
+ deps_json="[]"
14
+ while IFS= read -r pkg_file; do
15
+ # Extract dependency names from both dependencies and devDependencies
16
+ file_deps=$(jq -r '(.dependencies // {} | keys[]) , (.devDependencies // {} | keys[])' "$pkg_file" 2>/dev/null || true)
17
+ if [ -n "$file_deps" ]; then
18
+ deps_json=$(echo "$deps_json" | jq --arg d "$file_deps" '. + ($d | split("\n") | map(select(. != "")))')
19
+ fi
20
+ done < <(find . -name "package.json" -not -path "*/node_modules/*" -not -path "*/dist/*" -not -path "*/.next/*" 2>/dev/null)
21
+
22
+ # Deduplicate
23
+ deps_json=$(echo "$deps_json" | jq 'unique')
24
+
25
+ # --- Explicit marker scan ---
26
+ markers_json="[]"
27
+ marker_output=$(rg -n "@deprecated|// legacy|// deprecated|// old approach|TODO.*deprecat|FIXME.*deprecat" \
28
+ --type ts --type js \
29
+ --glob '!node_modules' --glob '!dist' --glob '!build' --glob '!.next' \
30
+ -C 2 2>/dev/null || true)
31
+
32
+ if [ -n "$marker_output" ]; then
33
+ # Parse ripgrep output into JSON entries
34
+ markers_json=$(echo "$marker_output" | awk -F: '
35
+ /^[^-].*:[0-9]+:/ {
36
+ file = $1
37
+ line = $2
38
+ # Rejoin the rest as text (handles colons in content)
39
+ text = ""
40
+ for (i = 3; i <= NF; i++) {
41
+ text = (text == "" ? $i : text ":" $i)
42
+ }
43
+ gsub(/^[ \t]+/, "", text)
44
+ gsub(/"/, "\\\"", text)
45
+ gsub(/\t/, " ", text)
46
+ printf "{\"file\":\"%s\",\"line\":%s,\"text\":\"%s\"},\n", file, line, text
47
+ }
48
+ ' | sed '$ s/,$//' | awk 'BEGIN{print "["} {print} END{print "]"}')
49
+
50
+ # Validate JSON — fall back to empty array if malformed
51
+ if ! echo "$markers_json" | jq empty 2>/dev/null; then
52
+ markers_json="[]"
53
+ fi
54
+ fi
55
+
56
+ # --- Git recency comparison ---
57
+ # Extract all import lines from git patches in two passes (recent + old), then count per-dep
58
+ recency_json="{}"
59
+ dep_count=$(echo "$deps_json" | jq length)
60
+
61
+ if [ "$dep_count" -gt 0 ]; then
62
+ RECENT_IMPORTS="$OUTPUT_DIR/recent-imports.txt"
63
+ OLD_IMPORTS="$OUTPUT_DIR/old-imports.txt"
64
+
65
+ # Single git log pass per time window — extract only import lines
66
+ git log --since="3 months ago" -p -- '*.ts' '*.tsx' '*.js' '*.jsx' 2>/dev/null \
67
+ | grep -oE "from ['\"][^'\"]+['\"]" > "$RECENT_IMPORTS" 2>/dev/null || true
68
+ git log --since="12 months ago" --until="3 months ago" -p -- '*.ts' '*.tsx' '*.js' '*.jsx' 2>/dev/null \
69
+ | grep -oE "from ['\"][^'\"]+['\"]" > "$OLD_IMPORTS" 2>/dev/null || true
70
+
71
+ for dep in $(echo "$deps_json" | jq -r '.[]'); do
72
+ # Skip short names that would match too broadly
73
+ if [ ${#dep} -lt 3 ]; then
74
+ continue
75
+ fi
76
+
77
+ recent=$(grep -c "from ['\"]${dep}" "$RECENT_IMPORTS" 2>/dev/null || true)
78
+ recent=${recent:-0}
79
+ old=$(grep -c "from ['\"]${dep}" "$OLD_IMPORTS" 2>/dev/null || true)
80
+ old=${old:-0}
81
+
82
+ if [ "$recent" -gt 0 ] || [ "$old" -gt 0 ]; then
83
+ recency_json=$(echo "$recency_json" | jq \
84
+ --arg dep "$dep" \
85
+ --argjson recent "$recent" \
86
+ --argjson old "$old" \
87
+ '. + {($dep): {"recent_imports": $recent, "old_imports": $old}}')
88
+ fi
89
+ done
90
+
91
+ rm -f "$RECENT_IMPORTS" "$OLD_IMPORTS"
92
+ fi
93
+
94
+ # --- Assemble final output ---
95
+ jq -n \
96
+ --argjson dependencies "$deps_json" \
97
+ --argjson explicit_markers "$markers_json" \
98
+ --argjson git_recency "$recency_json" \
99
+ '{
100
+ dependencies: $dependencies,
101
+ explicit_markers: $explicit_markers,
102
+ git_recency: $git_recency
103
+ }' > "$OUTPUT_FILE"
104
+
105
+ echo "Deprecated pattern scan complete: $OUTPUT_FILE"
106
+ echo " Dependencies found: $(echo "$deps_json" | jq length)"
107
+ echo " Explicit markers found: $(echo "$markers_json" | jq length)"
108
+ echo " Deps with git activity: $(echo "$recency_json" | jq 'length')"
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env bash
2
+ # Indexes the project's public API surface by finding all exports.
3
+ # Outputs structured JSON to /tmp/codeyam-memory/exports-scan.json
4
+
5
+ set -euo pipefail
6
+
7
+ OUTPUT_DIR="/tmp/codeyam-memory"
8
+ OUTPUT_FILE="$OUTPUT_DIR/exports-scan.json"
9
+ mkdir -p "$OUTPUT_DIR"
10
+
11
+ # Find all export declarations, excluding noise directories and .d.ts files
12
+ export_output=$(rg -n "^export (function|const|class|default|async function|type|interface|enum)" \
13
+ --type ts --type js \
14
+ --glob '!node_modules' --glob '!dist' --glob '!build' --glob '!.next' \
15
+ --glob '!*.d.ts' --glob '!*.map' \
16
+ 2>/dev/null || true)
17
+
18
+ if [ -z "$export_output" ]; then
19
+ # No exports found — output empty structure
20
+ jq -n '{files: {}, stats: {total_files: 0, total_exports: 0}}' > "$OUTPUT_FILE"
21
+ echo "Export scan complete: $OUTPUT_FILE (no exports found)"
22
+ exit 0
23
+ fi
24
+
25
+ # Parse ripgrep output into JSON grouped by file
26
+ # Format: file:line:text
27
+ files_json=$(echo "$export_output" | awk -F: '
28
+ {
29
+ file = $1
30
+ line = $2
31
+ # Rejoin rest as text
32
+ text = ""
33
+ for (i = 3; i <= NF; i++) {
34
+ text = (text == "" ? $i : text ":" $i)
35
+ }
36
+ # Trim leading whitespace
37
+ gsub(/^[ \t]+/, "", text)
38
+ # Escape quotes for JSON
39
+ gsub(/"/, "\\\"", text)
40
+ gsub(/\t/, " ", text)
41
+ printf "%s\t%s\t%s\n", file, line, text
42
+ }' | jq -Rsn '
43
+ [inputs | split("\n") | .[] | select(. != "") |
44
+ split("\t") | select(length >= 3) |
45
+ {file: .[0], line: (.[1] | tonumber), text: .[2]}
46
+ ] |
47
+ group_by(.file) |
48
+ reduce .[] as $group ({};
49
+ . + {($group[0].file): [$group[] | {line: .line, text: .text}]}
50
+ )
51
+ ')
52
+
53
+ # Compute stats
54
+ total_files=$(echo "$files_json" | jq 'length')
55
+ total_exports=$(echo "$files_json" | jq '[.[] | length] | add // 0')
56
+
57
+ # Assemble final output
58
+ jq -n \
59
+ --argjson files "$files_json" \
60
+ --argjson total_files "$total_files" \
61
+ --argjson total_exports "$total_exports" \
62
+ '{
63
+ files: $files,
64
+ stats: {total_files: $total_files, total_exports: $total_exports}
65
+ }' > "$OUTPUT_FILE"
66
+
67
+ echo "Export scan complete: $OUTPUT_FILE"
68
+ echo " Files with exports: $total_files"
69
+ echo " Total exports: $total_exports"
@@ -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,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,12 @@
1
+ #!/usr/bin/env bash
2
+ # Removes cached preprocessed session files.
3
+ set -euo pipefail
4
+
5
+ OUTPUT_DIR="/tmp/cc-session-analysis"
6
+
7
+ if [ -d "$OUTPUT_DIR" ]; then
8
+ rm -rf "$OUTPUT_DIR"
9
+ echo "Cleaned up $OUTPUT_DIR"
10
+ else
11
+ echo "Nothing to clean up ($OUTPUT_DIR does not exist)"
12
+ fi
@@ -0,0 +1,45 @@
1
+ # Session log filter for codeyam-memory skill.
2
+ # Strips progress/system/queue records, compresses tool inputs to 300 chars,
3
+ # tool results to 500 chars, thinking to 1000 chars. Output is compact JSONL.
4
+
5
+ select(.type == "user" or .type == "assistant") |
6
+ if .type == "assistant" then
7
+ {
8
+ type: "assistant",
9
+ ts: .timestamp,
10
+ content: [
11
+ (.message.content[]? |
12
+ if .type == "text" then
13
+ {t: "text", text}
14
+ elif .type == "thinking" then
15
+ {t: "think", thinking: (.thinking // "" | if length > 1000 then (.[0:1000] + "...[truncated]") else . end)}
16
+ elif .type == "tool_use" then
17
+ {t: "tool", name, input: (.input | tostring | if length > 300 then .[0:300] + "..." else . end)}
18
+ else empty
19
+ end
20
+ )
21
+ ]
22
+ }
23
+ elif .type == "user" then
24
+ {
25
+ type: "user",
26
+ ts: .timestamp,
27
+ content: (
28
+ if (.message.content | type) == "string" then
29
+ .message.content
30
+ elif (.message.content | type) == "array" then
31
+ [.message.content[]? |
32
+ if .type == "tool_result" then
33
+ {t: "result", id: .tool_use_id, err: (.is_error // false),
34
+ content: (.content | tostring | if length > 500 then .[0:500] + "...[truncated]" else . end)}
35
+ else
36
+ {t: "msg", text: (. | tostring | if length > 500 then .[0:500] + "...[truncated]" else . end)}
37
+ end
38
+ ]
39
+ else
40
+ (.message.content | tostring | if length > 500 then .[0:500] + "...[truncated]" else . end)
41
+ end
42
+ )
43
+ }
44
+ else empty
45
+ end
@@ -0,0 +1,139 @@
1
+ #!/usr/bin/env bash
2
+ # Preprocesses Claude Code session logs for the codeyam-memory skill.
3
+ #
4
+ # - Finds JSONL session files (>=10KB, last 30 days)
5
+ # - Excludes the current active session
6
+ # - Runs jq filter for 5-50x compression
7
+ # - Caches results in /tmp/cc-session-analysis/
8
+ # - Prints filtered file paths to stdout (one per line)
9
+ set -euo pipefail
10
+
11
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12
+ FILTER="$SCRIPT_DIR/filter.jq"
13
+ OUTPUT_DIR="/tmp/cc-session-analysis"
14
+ MIN_SIZE=10240 # 10KB
15
+ MAX_AGE_DAYS=30
16
+ MAX_SESSIONS=30 # Diminishing returns past this; keeps agent fleet manageable
17
+ JQ_TIMEOUT=30 # Seconds — skip files that take longer than this to filter
18
+
19
+ # --- Dependency check ---
20
+ if ! command -v jq &>/dev/null; then
21
+ echo "Error: jq is required but not installed." >&2
22
+ echo " macOS: brew install jq" >&2
23
+ echo " Ubuntu: sudo apt-get install jq" >&2
24
+ echo " Other: https://jqlang.github.io/jq/download/" >&2
25
+ exit 1
26
+ fi
27
+
28
+ # --- Compute Claude project directory ---
29
+ PROJECT_DIR="$PWD"
30
+ # Claude Code replaces both / and . with - in the project hash
31
+ PROJECT_HASH=$(echo "$PROJECT_DIR" | sed 's|[/.]|-|g')
32
+ SESSION_DIR="$HOME/.claude/projects/$PROJECT_HASH"
33
+
34
+ if [ ! -d "$SESSION_DIR" ]; then
35
+ echo "No Claude session directory found at $SESSION_DIR" >&2
36
+ echo "This project may not have any Claude Code session history." >&2
37
+ exit 0
38
+ fi
39
+
40
+ # --- Find session files ---
41
+ mkdir -p "$OUTPUT_DIR"
42
+
43
+ # Collect eligible session files: >=10KB, modified within last 30 days, .jsonl extension
44
+ # Sort by mtime (newest first) so the cap keeps the most recent sessions
45
+ ALL_SESSIONS=()
46
+ while IFS= read -r file; do
47
+ ALL_SESSIONS+=("$file")
48
+ done < <(find "$SESSION_DIR" -maxdepth 1 -name "*.jsonl" -size +"$MIN_SIZE"c -mtime -"$MAX_AGE_DAYS" -print0 2>/dev/null \
49
+ | xargs -0 stat -f "%m %N" 2>/dev/null \
50
+ | sort -rn \
51
+ | awk '{print $2}')
52
+
53
+ if [ ${#ALL_SESSIONS[@]} -eq 0 ]; then
54
+ exit 0
55
+ fi
56
+
57
+ # Cap to most recent N sessions
58
+ SESSIONS=("${ALL_SESSIONS[@]:0:$MAX_SESSIONS}")
59
+ if [ ${#ALL_SESSIONS[@]} -gt "$MAX_SESSIONS" ]; then
60
+ echo "Note: ${#ALL_SESSIONS[@]} sessions found, capping to $MAX_SESSIONS most recent" >&2
61
+ fi
62
+
63
+ # --- Exclude current active session ---
64
+ # The newest file by mtime is likely the current session.
65
+ # If CLAUDE_SESSION_ID is set, use that for a more precise match.
66
+ NEWEST_FILE=""
67
+ NEWEST_MTIME=0
68
+ for file in "${SESSIONS[@]}"; do
69
+ mtime=$(stat -f "%m" "$file" 2>/dev/null || stat -c "%Y" "$file" 2>/dev/null || echo "0")
70
+ if [ "$mtime" -gt "$NEWEST_MTIME" ]; then
71
+ NEWEST_MTIME="$mtime"
72
+ NEWEST_FILE="$file"
73
+ fi
74
+ done
75
+
76
+ ACTIVE_SESSION=""
77
+ if [ -n "${CLAUDE_SESSION_ID:-}" ]; then
78
+ for file in "${SESSIONS[@]}"; do
79
+ if [[ "$(basename "$file" .jsonl)" == "$CLAUDE_SESSION_ID" ]]; then
80
+ ACTIVE_SESSION="$file"
81
+ break
82
+ fi
83
+ done
84
+ fi
85
+ # Fall back to newest file if no env var match
86
+ if [ -z "$ACTIVE_SESSION" ]; then
87
+ ACTIVE_SESSION="$NEWEST_FILE"
88
+ fi
89
+
90
+ # --- Process each session ---
91
+ for file in "${SESSIONS[@]}"; do
92
+ # Skip active session
93
+ if [ "$file" = "$ACTIVE_SESSION" ]; then
94
+ continue
95
+ fi
96
+
97
+ uuid=$(basename "$file" .jsonl)
98
+ filtered="$OUTPUT_DIR/${uuid}.filtered.jsonl"
99
+
100
+ # Check cache: skip if filtered file exists and has a valid sentinel
101
+ if [ -f "$filtered" ]; then
102
+ first_line=$(head -1 "$filtered" 2>/dev/null || true)
103
+ if echo "$first_line" | jq -e '.processed_at' &>/dev/null; then
104
+ echo "$filtered"
105
+ continue
106
+ fi
107
+ fi
108
+
109
+ # Run jq filter
110
+ source_size=$(stat -f "%z" "$file" 2>/dev/null || stat -c "%s" "$file" 2>/dev/null || echo "0")
111
+ sentinel=$(printf '{"processed_at":"%s","source_size":%s}' "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" "$source_size")
112
+
113
+ # Write sentinel as first line, then filtered content (with timeout)
114
+ jq_exit=0
115
+ {
116
+ echo "$sentinel"
117
+ if command -v timeout &>/dev/null; then
118
+ timeout "$JQ_TIMEOUT" jq -c -f "$FILTER" "$file" 2>/dev/null
119
+ elif command -v gtimeout &>/dev/null; then
120
+ gtimeout "$JQ_TIMEOUT" jq -c -f "$FILTER" "$file" 2>/dev/null
121
+ else
122
+ jq -c -f "$FILTER" "$file" 2>/dev/null
123
+ fi
124
+ } > "$filtered" || jq_exit=$?
125
+
126
+ if [ "$jq_exit" -eq 124 ]; then
127
+ echo "Warning: jq timed out after ${JQ_TIMEOUT}s on $(basename "$file") — skipping" >&2
128
+ rm -f "$filtered"
129
+ continue
130
+ fi
131
+
132
+ # Only output if the file has content beyond the sentinel
133
+ line_count=$(wc -l < "$filtered" | tr -d ' ')
134
+ if [ "$line_count" -gt 1 ]; then
135
+ echo "$filtered"
136
+ else
137
+ rm -f "$filtered"
138
+ fi
139
+ done
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@codeyam/codeyam-cli",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Local development CLI for CodeYam analysis",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "codeyam": "./codeyam-cli/src/codeyam-cli.js"
8
8
  },
9
9
  "scripts": {
10
- "postinstall": "node ./scripts/finalize-analyzer.cjs"
10
+ "postinstall": "node ./scripts/npm-post-install.cjs"
11
11
  },
12
12
  "dependencies": {
13
13
  "@anthropic-ai/claude-code": "^2.1.7",
@@ -58,7 +58,9 @@
58
58
  "react-resizable": "^3.0.5",
59
59
  "react-syntax-highlighter": "^15.6.1",
60
60
  "remark-gfm": "^4.0.1",
61
+ "node-pty": "^1.0.0",
61
62
  "sharp": "^0.34.5",
63
+ "ws": "^8.18.3",
62
64
  "simple-git": "^3.28.0",
63
65
  "typescript": "^5.9.3",
64
66
  "uuid": "^11.1.0",
@@ -742,10 +742,28 @@ export class ASTScopeAnalyzer {
742
742
  // Handle union types - we simplify unions to the most specific common type
743
743
  if (tsType.flags & ts.TypeFlags.Union) {
744
744
  const unionType = tsType;
745
- // Check if it's a string literal union
746
- const isAllStringLiterals = unionType.types.every((t) => (t.flags & ts.TypeFlags.StringLiteral) !== 0);
747
- if (isAllStringLiterals)
748
- return 'string';
745
+ // Check if it's a string literal union (optionally with null/undefined).
746
+ // Preserve literal values so the LLM knows which values are valid when
747
+ // generating mock data. Without this, types like
748
+ // 'suggestion' | 'warning' | 'achievement' | 'tip' become just 'string'
749
+ // and the LLM generates invalid values (e.g. "Motivational").
750
+ const stringLiterals = unionType.types.filter((t) => (t.flags & ts.TypeFlags.StringLiteral) !== 0);
751
+ const nullishTypes = unionType.types.filter((t) => (t.flags & ts.TypeFlags.Undefined) !== 0 ||
752
+ (t.flags & ts.TypeFlags.Null) !== 0);
753
+ if (stringLiterals.length > 0 &&
754
+ stringLiterals.length + nullishTypes.length === unionType.types.length) {
755
+ const literalValues = stringLiterals.map((t) => `'${t.value}'`);
756
+ const literalUnion = literalValues.join(' | ');
757
+ if (nullishTypes.length > 0) {
758
+ const nullishParts = [];
759
+ if (nullishTypes.some((t) => (t.flags & ts.TypeFlags.Null) !== 0))
760
+ nullishParts.push('null');
761
+ if (nullishTypes.some((t) => (t.flags & ts.TypeFlags.Undefined) !== 0))
762
+ nullishParts.push('undefined');
763
+ return `${literalUnion} | ${nullishParts.join(' | ')}`;
764
+ }
765
+ return literalUnion;
766
+ }
749
767
  // Check if it's a number literal union
750
768
  const isAllNumberLiterals = unionType.types.every((t) => (t.flags & ts.TypeFlags.NumberLiteral) !== 0);
751
769
  if (isAllNumberLiterals)