@codeyam/codeyam-cli 0.1.0-staging.6e699e5 → 0.1.0-staging.79ef713

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 (437) hide show
  1. package/analyzer-template/.build-info.json +7 -7
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/package.json +7 -7
  4. package/analyzer-template/packages/ai/index.ts +10 -2
  5. package/analyzer-template/packages/ai/package.json +2 -2
  6. package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +86 -18
  7. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +67 -9
  8. package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +41 -17
  9. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.ts +10 -17
  10. package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +308 -50
  11. package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +15 -6
  12. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +833 -243
  13. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +5 -1
  14. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.ts +16 -3
  15. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.ts +6 -4
  16. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +54 -3
  17. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +60 -15
  18. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.ts +70 -0
  19. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +80 -5
  20. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +179 -0
  21. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.ts +40 -30
  22. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +393 -97
  23. package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +58 -3
  24. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +283 -1
  25. package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +9 -5
  26. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +11 -3
  27. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +1 -1
  28. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +297 -7
  29. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +1 -1
  30. package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +51 -3
  31. package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +90 -96
  32. package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +10 -7
  33. package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +25 -13
  34. package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +4 -3
  35. package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +114 -2
  36. package/analyzer-template/packages/analyze/index.ts +2 -0
  37. package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +65 -59
  38. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +113 -26
  39. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +19 -0
  40. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.ts +19 -0
  41. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExports.ts +11 -0
  42. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.ts +8 -0
  43. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.ts +49 -1
  44. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.ts +2 -1
  45. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +71 -9
  46. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +19 -4
  47. package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +6 -0
  48. package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +4 -2
  49. package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +0 -3
  50. package/analyzer-template/packages/analyze/src/lib/files/analyzeRemixRoute.ts +4 -5
  51. package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +14 -12
  52. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1315 -0
  53. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +61 -13
  54. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +37 -0
  55. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +229 -19
  56. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +117 -9
  57. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +459 -39
  58. package/analyzer-template/packages/analyze/src/lib/files/scenarios/propagateArrayItemSchemas.ts +474 -0
  59. package/analyzer-template/packages/analyze/src/lib/files/setImportedExports.ts +2 -1
  60. package/analyzer-template/packages/analyze/src/lib/index.ts +1 -0
  61. package/analyzer-template/packages/analyze/src/lib/utils/getFileByPath.ts +19 -0
  62. package/analyzer-template/packages/aws/package.json +1 -1
  63. package/analyzer-template/packages/database/package.json +1 -1
  64. package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -1
  65. package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -0
  66. package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
  67. package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +13 -0
  68. package/analyzer-template/packages/database/src/lib/loadBranch.ts +16 -1
  69. package/analyzer-template/packages/database/src/lib/loadCommit.ts +11 -0
  70. package/analyzer-template/packages/database/src/lib/loadCommits.ts +28 -0
  71. package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -3
  72. package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +12 -0
  73. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +7 -14
  74. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  75. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +8 -1
  76. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  77. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts +1 -0
  78. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts.map +1 -1
  79. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js +3 -0
  80. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  81. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts +2 -0
  82. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts.map +1 -1
  83. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js +45 -2
  84. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js.map +1 -1
  85. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
  86. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +8 -0
  87. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
  88. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js +11 -1
  89. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js.map +1 -1
  90. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.d.ts.map +1 -1
  91. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js +7 -0
  92. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js.map +1 -1
  93. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts +3 -1
  94. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  95. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +22 -1
  96. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  97. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts +3 -1
  98. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
  99. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +23 -4
  100. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
  101. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.d.ts.map +1 -1
  102. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js +9 -0
  103. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js.map +1 -1
  104. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts +2 -2
  105. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  106. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +5 -4
  107. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  108. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts +2 -0
  109. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts.map +1 -1
  110. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +3 -0
  111. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  112. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +5 -5
  113. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  114. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  115. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  116. package/analyzer-template/packages/github/package.json +1 -1
  117. package/analyzer-template/packages/types/src/types/Commit.ts +2 -0
  118. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +1 -0
  119. package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +6 -5
  120. package/analyzer-template/packages/types/src/types/ScopeAnalysis.ts +6 -1
  121. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts +2 -0
  122. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts.map +1 -1
  123. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +3 -0
  124. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  125. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +5 -5
  126. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  127. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  128. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  129. package/analyzer-template/playwright/capture.ts +20 -8
  130. package/analyzer-template/playwright/captureStatic.ts +1 -1
  131. package/analyzer-template/project/analyzeBaselineCommit.ts +5 -0
  132. package/analyzer-template/project/analyzeRegularCommit.ts +5 -0
  133. package/analyzer-template/project/captureLibraryFunctionDirect.ts +29 -26
  134. package/analyzer-template/project/constructMockCode.ts +90 -10
  135. package/analyzer-template/project/createEntitiesAndSortFiles.ts +83 -0
  136. package/analyzer-template/project/loadReadyToBeCaptured.ts +65 -41
  137. package/analyzer-template/project/orchestrateCapture/AwsCaptureTaskRunner.ts +12 -4
  138. package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +11 -6
  139. package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
  140. package/analyzer-template/project/orchestrateCapture.ts +45 -6
  141. package/analyzer-template/project/start.ts +35 -11
  142. package/analyzer-template/project/writeMockDataTsx.ts +181 -8
  143. package/analyzer-template/project/writeScenarioComponents.ts +103 -12
  144. package/analyzer-template/project/writeSimpleRoot.ts +21 -11
  145. package/analyzer-template/scripts/comboWorkerLoop.cjs +98 -50
  146. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +5 -0
  147. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
  148. package/background/src/lib/virtualized/project/analyzeRegularCommit.js +5 -0
  149. package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
  150. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js +3 -3
  151. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js.map +1 -1
  152. package/background/src/lib/virtualized/project/constructMockCode.js +75 -4
  153. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  154. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js +73 -1
  155. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js.map +1 -1
  156. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js +19 -8
  157. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js.map +1 -1
  158. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js +2 -2
  159. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js.map +1 -1
  160. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +4 -4
  161. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
  162. package/background/src/lib/virtualized/project/orchestrateCapture.js +38 -6
  163. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  164. package/background/src/lib/virtualized/project/start.js +32 -11
  165. package/background/src/lib/virtualized/project/start.js.map +1 -1
  166. package/background/src/lib/virtualized/project/writeMockDataTsx.js +162 -4
  167. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  168. package/background/src/lib/virtualized/project/writeScenarioComponents.js +85 -15
  169. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  170. package/background/src/lib/virtualized/project/writeSimpleRoot.js +21 -11
  171. package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
  172. package/codeyam-cli/scripts/apply-setup.js +180 -0
  173. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  174. package/codeyam-cli/src/cli.js +2 -0
  175. package/codeyam-cli/src/cli.js.map +1 -1
  176. package/codeyam-cli/src/commands/debug.js +7 -5
  177. package/codeyam-cli/src/commands/debug.js.map +1 -1
  178. package/codeyam-cli/src/commands/memory.js +264 -0
  179. package/codeyam-cli/src/commands/memory.js.map +1 -0
  180. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +2 -2
  181. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  182. package/codeyam-cli/src/utils/analysisRunner.js +21 -2
  183. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  184. package/codeyam-cli/src/utils/backgroundServer.js +4 -0
  185. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  186. package/codeyam-cli/src/utils/install-skills.js +55 -10
  187. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  188. package/codeyam-cli/src/utils/queue/job.js +4 -0
  189. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  190. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js +82 -0
  191. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js.map +1 -0
  192. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +230 -0
  193. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -0
  194. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +67 -0
  195. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -0
  196. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js +105 -0
  197. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js.map +1 -0
  198. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js +34 -0
  199. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js.map +1 -0
  200. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js +162 -0
  201. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js.map +1 -0
  202. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +75 -0
  203. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -0
  204. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +285 -0
  205. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -0
  206. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +115 -0
  207. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -0
  208. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js +127 -0
  209. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js.map +1 -0
  210. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js +50 -0
  211. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js.map +1 -0
  212. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +116 -0
  213. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -0
  214. package/codeyam-cli/src/utils/ruleReflection/index.js +5 -0
  215. package/codeyam-cli/src/utils/ruleReflection/index.js.map +1 -0
  216. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js +44 -0
  217. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js.map +1 -0
  218. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js +85 -0
  219. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js.map +1 -0
  220. package/codeyam-cli/src/utils/ruleReflection/types.js +5 -0
  221. package/codeyam-cli/src/utils/ruleReflection/types.js.map +1 -0
  222. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +293 -0
  223. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
  224. package/codeyam-cli/src/utils/rules/index.js +6 -0
  225. package/codeyam-cli/src/utils/rules/index.js.map +1 -0
  226. package/codeyam-cli/src/utils/rules/parser.js +78 -0
  227. package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
  228. package/codeyam-cli/src/utils/rules/pathMatcher.js +18 -0
  229. package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -0
  230. package/codeyam-cli/src/utils/rules/ruleState.js +150 -0
  231. package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -0
  232. package/codeyam-cli/src/utils/rules/staleness.js +137 -0
  233. package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
  234. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +1 -1
  235. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  236. package/codeyam-cli/src/webserver/app/lib/database.js +7 -3
  237. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  238. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CA3JxPb7.js +1 -0
  239. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-B86KKU7e.js +11 -0
  240. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-DLqD3qNt.js → EntityTypeBadge-B5ctlSYt.js} +1 -1
  241. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-Ba2JVPzP.js → EntityTypeIcon-BqY8gDAW.js} +1 -1
  242. package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-C8lyxW9k.js → InlineSpinner-ClaLpuOo.js} +1 -1
  243. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-aht4aafF.js → InteractivePreview-BDhPilK7.js} +2 -2
  244. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CVtiBnY5.js → LibraryFunctionPreview-VeqEBv9v.js} +1 -1
  245. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-B0GLXMsr.js → LoadingDots-Bs7Nn1Jr.js} +1 -1
  246. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-xgeCVgSM.js → LogViewer-Bm3PmcCz.js} +1 -1
  247. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-D4TZhLuw.js → ReportIssueModal-C6PKeMYR.js} +3 -13
  248. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-DuDvi0jm.js → SafeScreenshot-Gq3Ocjo6.js} +1 -1
  249. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-DEx02QDa.js → ScenarioViewer-BNLaXBHR.js} +3 -3
  250. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-DyFZkK0l.js → TruncatedFilePath-CiwXDxLh.js} +1 -1
  251. package/codeyam-cli/src/webserver/build/client/assets/{_index-BwqWJOgH.js → _index-B3TDXxnk.js} +1 -1
  252. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-DoLIqZX2.js → activity.(_tab)-BtBFH820.js} +6 -16
  253. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DfKzxuoe.js +11 -0
  254. package/codeyam-cli/src/webserver/build/client/assets/api.memory-profile-l0sNRNKZ.js +1 -0
  255. package/codeyam-cli/src/webserver/build/client/assets/api.save-fixture-l0sNRNKZ.js +1 -0
  256. package/codeyam-cli/src/webserver/build/client/assets/book-open-PttOB2SF.js +6 -0
  257. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-Cx24_aWc.js → chevron-down-TJp6ofnp.js} +1 -1
  258. package/codeyam-cli/src/webserver/build/client/assets/{chunk-EPOLDU6W-CXRTFQ3F.js → chunk-JZWAC4HX-JE9ZIoBl.js} +12 -12
  259. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BOARzkeR.js → circle-check-CXhHQYrI.js} +1 -1
  260. package/codeyam-cli/src/webserver/build/client/assets/copy-6y9ALfGT.js +11 -0
  261. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-BdhJEx6B.js → createLucideIcon-Ca9fAY46.js} +1 -1
  262. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-C5lqplTC.js +1 -0
  263. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-C2N4Op8e.js → entity._sha._-n38keI1k.js} +10 -10
  264. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js → entity._sha.scenarios._scenarioId.fullscreen-CBoafmVs.js} +1 -1
  265. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-D1T4TGjf.js → entity._sha_.create-scenario-DGgZjdFg.js} +1 -1
  266. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CTBG2mmz.js → entity._sha_.edit._scenarioId-38yPijoD.js} +1 -1
  267. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-CS2cb_eZ.js → entry.client-BSHEfydn.js} +1 -1
  268. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DMJ7zii9.js → fileTableUtils-DCPhhSMo.js} +1 -1
  269. package/codeyam-cli/src/webserver/build/client/assets/files-0N0YJQv7.js +1 -0
  270. package/codeyam-cli/src/webserver/build/client/assets/{git-B4RJRvYB.js → git-DXnyr8uP.js} +8 -8
  271. package/codeyam-cli/src/webserver/build/client/assets/globals-Bh6jH0cL.css +1 -0
  272. package/codeyam-cli/src/webserver/build/client/assets/{index-lzqtyFU8.js → index-CcsFv748.js} +1 -1
  273. package/codeyam-cli/src/webserver/build/client/assets/{index-B1h680n5.js → index-ChN9-fAY.js} +1 -1
  274. package/codeyam-cli/src/webserver/build/client/assets/labs-CdVUfvji.js +1 -0
  275. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-B7B9V-bu.js → loader-circle-CTqLEAGU.js} +1 -1
  276. package/codeyam-cli/src/webserver/build/client/assets/manifest-87319d0f.js +1 -0
  277. package/codeyam-cli/src/webserver/build/client/assets/memory-CPIDnDEj.js +76 -0
  278. package/codeyam-cli/src/webserver/build/client/assets/pause-D6vreykR.js +11 -0
  279. package/codeyam-cli/src/webserver/build/client/assets/root-D6oziHts.js +62 -0
  280. package/codeyam-cli/src/webserver/build/client/assets/{search-CxXUmBSd.js → search-B8VUL8nl.js} +1 -1
  281. package/codeyam-cli/src/webserver/build/client/assets/{settings-CS5f3WzT.js → settings-eBI36Yv5.js} +1 -1
  282. package/codeyam-cli/src/webserver/build/client/assets/{simulations-DwFIBT09.js → simulations-CPoAg7Zo.js} +1 -1
  283. package/codeyam-cli/src/webserver/build/client/assets/terminal-BrCP7uQo.js +11 -0
  284. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-B6LgvRJg.js → triangle-alert-BZz2NjYa.js} +1 -1
  285. package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-C1v1PQzo.js → useCustomSizes-DNwUduNu.js} +1 -1
  286. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-aSv48UbS.js → useLastLogLine-COky1GVF.js} +1 -1
  287. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-DYxHZQuP.js → useReportContext-CpZgwliL.js} +1 -1
  288. package/codeyam-cli/src/webserver/build/client/assets/{useToast-mBRpZPiu.js → useToast-Bv9JFvUO.js} +1 -1
  289. package/codeyam-cli/src/webserver/build/server/assets/index-9ox9LcrG.js +1 -0
  290. package/codeyam-cli/src/webserver/build/server/assets/server-build-Cq5Vqcob.js +260 -0
  291. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  292. package/codeyam-cli/src/webserver/build-info.json +5 -5
  293. package/codeyam-cli/templates/{codeyam-power-rules-hook.sh → codeyam-memory-hook.sh} +12 -13
  294. package/codeyam-cli/templates/codeyam:diagnose.md +178 -25
  295. package/codeyam-cli/templates/codeyam:memory.md +404 -0
  296. package/codeyam-cli/templates/codeyam:new-rule.md +2 -2
  297. package/codeyam-cli/templates/rule-notification-hook.py +56 -0
  298. package/codeyam-cli/templates/rule-reflection-hook.py +590 -0
  299. package/codeyam-cli/templates/rules-instructions.md +123 -0
  300. package/package.json +8 -6
  301. package/packages/ai/index.js +3 -2
  302. package/packages/ai/index.js.map +1 -1
  303. package/packages/ai/src/lib/analyzeScope.js +68 -13
  304. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  305. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +54 -8
  306. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  307. package/packages/ai/src/lib/astScopes/methodSemantics.js +41 -17
  308. package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
  309. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js +10 -14
  310. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js.map +1 -1
  311. package/packages/ai/src/lib/astScopes/processExpression.js +239 -43
  312. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  313. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +650 -166
  314. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  315. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +5 -1
  316. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
  317. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js +13 -3
  318. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -1
  319. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +6 -4
  320. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -1
  321. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +52 -3
  322. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  323. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +55 -11
  324. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  325. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js +63 -0
  326. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js.map +1 -0
  327. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +73 -5
  328. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
  329. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +173 -0
  330. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -0
  331. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js +37 -20
  332. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js.map +1 -1
  333. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +333 -86
  334. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
  335. package/packages/ai/src/lib/generateEntityDataStructure.js +46 -2
  336. package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
  337. package/packages/ai/src/lib/generateEntityScenarioData.js +205 -1
  338. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  339. package/packages/ai/src/lib/generateEntityScenarios.js +7 -1
  340. package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
  341. package/packages/ai/src/lib/generateExecutionFlows.js +10 -2
  342. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
  343. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +209 -3
  344. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -1
  345. package/packages/ai/src/lib/isolateScopes.js +39 -3
  346. package/packages/ai/src/lib/isolateScopes.js.map +1 -1
  347. package/packages/ai/src/lib/mergeStatements.js +70 -51
  348. package/packages/ai/src/lib/mergeStatements.js.map +1 -1
  349. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +10 -4
  350. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
  351. package/packages/ai/src/lib/resolvePathToControllable.js +24 -14
  352. package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -1
  353. package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
  354. package/packages/ai/src/lib/worker/analyzeScopeWorker.js +94 -1
  355. package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
  356. package/packages/analyze/index.js +1 -0
  357. package/packages/analyze/index.js.map +1 -1
  358. package/packages/analyze/src/lib/FileAnalyzer.js +60 -36
  359. package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
  360. package/packages/analyze/src/lib/ProjectAnalyzer.js +96 -26
  361. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  362. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +14 -0
  363. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -1
  364. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js +14 -0
  365. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js.map +1 -1
  366. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js +6 -0
  367. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js.map +1 -1
  368. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js +6 -0
  369. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js.map +1 -1
  370. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js +39 -1
  371. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js.map +1 -1
  372. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js +2 -1
  373. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js.map +1 -1
  374. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +54 -6
  375. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  376. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +17 -4
  377. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  378. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +5 -0
  379. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
  380. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +2 -1
  381. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
  382. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +0 -3
  383. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
  384. package/packages/analyze/src/lib/files/analyzeRemixRoute.js +3 -2
  385. package/packages/analyze/src/lib/files/analyzeRemixRoute.js.map +1 -1
  386. package/packages/analyze/src/lib/files/getImportedExports.js +11 -7
  387. package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
  388. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +880 -0
  389. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -0
  390. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +56 -10
  391. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
  392. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +33 -8
  393. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  394. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +150 -17
  395. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  396. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +56 -8
  397. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
  398. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +399 -31
  399. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  400. package/packages/analyze/src/lib/files/setImportedExports.js +2 -1
  401. package/packages/analyze/src/lib/files/setImportedExports.js.map +1 -1
  402. package/packages/analyze/src/lib/index.js +1 -0
  403. package/packages/analyze/src/lib/index.js.map +1 -1
  404. package/packages/analyze/src/lib/utils/getFileByPath.js +12 -0
  405. package/packages/analyze/src/lib/utils/getFileByPath.js.map +1 -0
  406. package/packages/database/src/lib/kysely/db.js +8 -1
  407. package/packages/database/src/lib/kysely/db.js.map +1 -1
  408. package/packages/database/src/lib/kysely/tables/commitsTable.js +3 -0
  409. package/packages/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  410. package/packages/database/src/lib/loadAnalyses.js +45 -2
  411. package/packages/database/src/lib/loadAnalyses.js.map +1 -1
  412. package/packages/database/src/lib/loadAnalysis.js +8 -0
  413. package/packages/database/src/lib/loadAnalysis.js.map +1 -1
  414. package/packages/database/src/lib/loadBranch.js +11 -1
  415. package/packages/database/src/lib/loadBranch.js.map +1 -1
  416. package/packages/database/src/lib/loadCommit.js +7 -0
  417. package/packages/database/src/lib/loadCommit.js.map +1 -1
  418. package/packages/database/src/lib/loadCommits.js +22 -1
  419. package/packages/database/src/lib/loadCommits.js.map +1 -1
  420. package/packages/database/src/lib/loadEntities.js +23 -4
  421. package/packages/database/src/lib/loadEntities.js.map +1 -1
  422. package/packages/database/src/lib/loadEntityBranches.js +9 -0
  423. package/packages/database/src/lib/loadEntityBranches.js.map +1 -1
  424. package/packages/database/src/lib/updateCommitMetadata.js +5 -4
  425. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  426. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-BXhEawa3.js +0 -1
  427. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BRb-0kQl.js +0 -1
  428. package/codeyam-cli/src/webserver/build/client/assets/files-Cs4MdYtv.js +0 -1
  429. package/codeyam-cli/src/webserver/build/client/assets/git-commit-horizontal-CysbcZxi.js +0 -6
  430. package/codeyam-cli/src/webserver/build/client/assets/globals-DMUaGAqV.css +0 -1
  431. package/codeyam-cli/src/webserver/build/client/assets/manifest-f874c610.js +0 -1
  432. package/codeyam-cli/src/webserver/build/client/assets/root-Bz5TunQg.js +0 -57
  433. package/codeyam-cli/src/webserver/build/client/assets/rules-hEkvVw2-.js +0 -97
  434. package/codeyam-cli/src/webserver/build/server/assets/index-967OuJoF.js +0 -1
  435. package/codeyam-cli/src/webserver/build/server/assets/server-build-DRTmerg9.js +0 -257
  436. package/codeyam-cli/templates/codeyam:power-rules.md +0 -447
  437. /package/codeyam-cli/src/webserver/build/client/assets/{api.rules-l0sNRNKZ.js → api.agent-transcripts-l0sNRNKZ.js} +0 -0
@@ -1,447 +0,0 @@
1
- ---
2
- name: codeyam:power-rules
3
- autoApprove: true
4
- description: |
5
- Generate and maintain Claude Rules for your codebase based on thorough analysis.
6
- Use when: User wants to set up power rules, document confusing areas, or ensure
7
- Claude has proper context for working in the codebase.
8
- ---
9
-
10
- # CodeYam Power Rules Assistant
11
-
12
- This skill helps you generate and maintain Claude Rules (`.claude/rules/`) that provide context-specific guidance. The goal is robust coverage of anything confusing while avoiding documentation of things Claude can intuit.
13
-
14
- ## When to Use This Skill
15
-
16
- - Initial setup: User asks to "set up power rules" or "generate claude rules"
17
- - Maintenance: After completing complex work where lessons should be preserved
18
- - Review: Periodically to ensure rules are accurate and up-to-date
19
-
20
- ---
21
-
22
- ## Phase 1: Setup (First Run Only)
23
-
24
- Check if this is the first time running power rules.
25
-
26
- ### 1A. Add Documentation Section to CLAUDE.md
27
-
28
- If CLAUDE.md doesn't contain a "Power Rules" or "Automated Architectural Documentation" section, add:
29
-
30
- ```markdown
31
- ## Automated Architectural Documentation (Claude Rules via CodeYam)
32
-
33
- This project uses significant documentation stored as Claude Rules (`.claude/rules`).
34
- It is your responsibility to add to, update, and improve this documentation.
35
- We focus on three categories of documentation:
36
-
37
- 1. Architecture
38
-
39
- - Any time there is a specific relationship between files please capture the architecture
40
- - Note how the files relate, how data flows, and how changes should be approached
41
-
42
- 2. Testing
43
-
44
- - For complex areas of the app where both manual and automated testing is complex track:
45
- - Helpful commands used in debugging and testing
46
- - Where test files are located if it is not obvious (and the command to run them if not obvious)
47
-
48
- 3. FAQ
49
-
50
- - If you are ever confused about something that does not fit into the above categories document it here.
51
- - Anything you have to figure out or ask the user about should be captured here.
52
-
53
- During each development session modify and add appropriate rules to track anything that is at all confusing.
54
- Ask clarifying questions to ensure you are not documenting anything inaccurate.
55
- After each development session review and improve all appropriate rules to ensure they are accurate, concise, and up-to-date.
56
- Always focus on positive instructions explaining how it works, what to run, where to find things, etc in concise terms. Do not add warnings unless necessary.
57
- When adding a new rules document see `.codeyam/rules/instructions.md` for instructions on where to create the rule and the format to use.
58
- ```
59
-
60
- ### 1B. Create Instructions File
61
-
62
- Create `.codeyam/rules/instructions.md` with the content from the Instructions File section at the end of this document.
63
-
64
- ### 1C. Install Pre-commit Hook
65
-
66
- Check if the project uses Husky (`.husky/` directory exists).
67
-
68
- **If using Husky**, append to `.husky/pre-commit`:
69
-
70
- ```bash
71
- # CodeYam Power Rules Check
72
- if [ -f ".codeyam/bin/power-rules-hook.sh" ]; then
73
- .codeyam/bin/power-rules-hook.sh
74
- fi
75
- ```
76
-
77
- **If not using Husky**, create or append to `.git/hooks/pre-commit`.
78
-
79
- Ensure `.codeyam/bin/power-rules-hook.sh` exists and is executable (`chmod +x`).
80
-
81
- ---
82
-
83
- ## Phase 2: Deep Codebase Analysis
84
-
85
- Perform thorough analysis to identify areas that may be confusing. The goal is to find everything that might trip up someone (or Claude) working in this codebase.
86
-
87
- ### 2A. Analyze Git Commit Messages for Problem Signals
88
-
89
- Look for commits indicating gotchas, workarounds, or complexity:
90
-
91
- ```bash
92
- # Find commits with problem-indicating keywords
93
- git log --oneline --since="6 months ago" --grep="fix" --grep="bug" --grep="workaround" --grep="hack" --grep="revert" --grep="oops" --grep="forgot" --grep="actually" --all-match | head -30
94
-
95
- # Find commits with long messages (indicate complex changes)
96
- git log --since="6 months ago" --format="%h %s" | awk 'length($0) > 80' | head -20
97
-
98
- # Find reverted commits
99
- git log --oneline --since="6 months ago" --grep="revert" -i | head -10
100
- ```
101
-
102
- For interesting commits, examine the full message and changes:
103
-
104
- ```bash
105
- git show <commit-hash> --stat
106
- git log -1 --format="%B" <commit-hash>
107
- ```
108
-
109
- ### 2B. Identify Files with High Churn or Complexity Signals
110
-
111
- ```bash
112
- # Files changed most frequently (last 6 months)
113
- git log --since="6 months ago" --name-only --pretty=format: | sort | uniq -c | sort -rn | head -30
114
-
115
- # Files with many different authors (tribal knowledge risk)
116
- git shortlog -sn --since="6 months ago" -- . | head -20
117
-
118
- # Files frequently modified together (hidden dependencies)
119
- git log --since="6 months ago" --name-only --pretty=format: | awk '/^$/{if(NR>1)print "---"}; /./{print}' | head -100
120
- ```
121
-
122
- Look for patterns where the same 2-3 files appear together repeatedly.
123
-
124
- ### 2C. Scan for Developer Notes in Code
125
-
126
- ```bash
127
- # Find TODO, FIXME, HACK, XXX, NOTE comments
128
- grep -rn "TODO\|FIXME\|HACK\|XXX\|NOTE:" --include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" --include="*.py" --include="*.rb" --include="*.go" --include="*.java" --include="*.rs" . 2>/dev/null | head -50
129
-
130
- # Find "workaround" or "hack" mentions in comments
131
- grep -rni "workaround\|hack\|temporary\|legacy" --include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" --include="*.py" . 2>/dev/null | head -30
132
- ```
133
-
134
- ### 2D. Analyze Project Structure
135
-
136
- ```bash
137
- # Get directory structure (2 levels deep)
138
- find . -type d -maxdepth 3 | grep -v node_modules | grep -v .git | grep -v dist | grep -v build | head -50
139
-
140
- # Find config files
141
- find . -name "*.config.*" -o -name "*.rc" -o -name ".env*" -o -name "tsconfig*" -o -name "package.json" 2>/dev/null | grep -v node_modules | head -30
142
-
143
- # Find test directories
144
- find . -type d -name "*test*" -o -type d -name "*spec*" -o -type d -name "__tests__" 2>/dev/null | grep -v node_modules | head -20
145
- ```
146
-
147
- ### 2E. Check for Environment and Configuration Complexity
148
-
149
- ```bash
150
- # Find environment variable references
151
- grep -rn "process.env\|os.environ\|ENV\[" --include="*.ts" --include="*.tsx" --include="*.js" --include="*.py" . 2>/dev/null | head -30
152
-
153
- # Find multiple config files that might conflict or confuse
154
- ls -la *.config.* .*.rc tsconfig*.json 2>/dev/null
155
- ```
156
-
157
- ### 2F. Review Existing Documentation
158
-
159
- Read these files if they exist:
160
-
161
- - `README.md`
162
- - `CLAUDE.md`
163
- - `CONTRIBUTING.md`
164
- - `docs/` directory
165
- - Any `*.md` files in the root
166
-
167
- Note what's already documented and what gaps exist.
168
-
169
- ### 2G. Examine Import/Dependency Patterns
170
-
171
- ```bash
172
- # Find files with many imports (high coupling)
173
- for f in $(find . -name "*.ts" -o -name "*.tsx" -o -name "*.js" 2>/dev/null | grep -v node_modules | head -100); do
174
- count=$(grep -c "^import\|^from\|require(" "$f" 2>/dev/null || echo 0)
175
- if [ "$count" -gt 15 ]; then
176
- echo "$count $f"
177
- fi
178
- done | sort -rn | head -20
179
-
180
- # Find commonly imported local modules (core utilities)
181
- grep -rh "from '\.\|from \"\.\|require('\.\|require(\"\." --include="*.ts" --include="*.tsx" --include="*.js" . 2>/dev/null | sort | uniq -c | sort -rn | head -20
182
- ```
183
-
184
- ---
185
-
186
- ## Phase 3: Cluster and Prioritize Findings
187
-
188
- After gathering signals, organize them by area/module:
189
-
190
- 1. **Group findings by directory** - Which parts of the codebase have the most signals?
191
- 2. **Identify themes**:
192
- - Architecture patterns (how things connect)
193
- - Testing complexity (special setup needed)
194
- - Configuration/environment gotchas
195
- - Historical workarounds still in place
196
- - Non-obvious conventions
197
-
198
- 3. **Score areas** - More signals = higher priority for documentation
199
-
200
- Create a mental map of:
201
-
202
- - Which directories/modules are most complex?
203
- - What relationships exist between different parts?
204
- - Where are the gotchas hiding?
205
-
206
- ---
207
-
208
- ## Phase 4: Ask Specific Questions
209
-
210
- Based on your analysis, ask the user specific questions about the actual findings. Reference the concrete evidence you found (file names, commit messages, code patterns) and ask about the substance.
211
-
212
- Always include "I'm not sure" as an easy opt-out option.
213
-
214
- ### Question Format
215
-
216
- Ask about the **specific finding**, not the file generally:
217
-
218
- **For high-churn files with concerning commits:**
219
-
220
- > "ScopeDataStructure.ts has commits mentioning 'exponential blowup' and 'execution flows'. What causes this blowup? When does it happen?"
221
- >
222
- > Options: [Explain the cause] [I'm not sure]
223
-
224
- **For files frequently modified together:**
225
-
226
- > "`src/api/auth.ts` and `src/middleware/session.ts` are modified together in 12 commits. Why do these need to change together?"
227
- >
228
- > Options: [Explain the relationship] [I'm not sure]
229
-
230
- **For commits with workaround language:**
231
-
232
- > "Commit `abc123` says 'workaround for webpack issue'. What's the underlying issue and what's the workaround?"
233
- >
234
- > Options: [Explain] [I'm not sure]
235
-
236
- **For multiple config files:**
237
-
238
- > "There are 3 tsconfig files. When is each one used?"
239
- >
240
- > Options: [Explain usage] [I'm not sure]
241
-
242
- **For TODO/FIXME comments:**
243
-
244
- > "There's a FIXME in `src/parser.ts:142` about 'handle nested callbacks'. What's the issue with nested callbacks here?"
245
- >
246
- > Options: [Explain] [I'm not sure]
247
-
248
- **For test organization:**
249
-
250
- > "Tests are split between `__tests__/` folders and colocated `*.test.ts` files. When should each approach be used?"
251
- >
252
- > Options: [Explain convention] [I'm not sure]
253
-
254
- ### Process
255
-
256
- 1. Group related questions by area/module
257
- 2. Ask 2-3 questions at a time, wait for answers
258
- 3. If user says "I'm not sure", either:
259
- - Read the code/commits yourself to understand, OR
260
- - Skip documenting that specific detail (but still document what you do know)
261
- 4. Move to next area after capturing answers
262
-
263
- ---
264
-
265
- ## Phase 5: Generate Rules
266
-
267
- For each area where you have enough information, create a rule file.
268
-
269
- ### Rule File Guidelines:
270
-
271
- 1. **Location mirrors code structure**
272
- - Rule for `src/api/` → `.claude/rules/src/api/architecture.md`
273
- - Rule for testing patterns → `.claude/rules/testing-patterns.md`
274
-
275
- 2. **Paths must be specific**
276
- - Good: `paths: ['src/api/**/*.ts']`
277
- - Bad: `paths: ['**/*.ts']` (too broad, wastes context)
278
-
279
- 3. **Content should be actionable**
280
- - Focus on "how to" and "what to know"
281
- - Avoid warnings unless truly critical
282
- - Be concise - every word costs context
283
-
284
- 4. **Timestamp must be current**
285
- - Use ISO 8601 format: `2026-01-27T15:30:00Z`
286
- - This enables the pre-commit hook enforcement
287
-
288
- ### Rule Template:
289
-
290
- ```markdown
291
- ---
292
- paths:
293
- - 'specific/path/**/*.ts'
294
- category: architecture | testing | faq
295
- timestamp: [CURRENT_ISO_TIMESTAMP]
296
- ---
297
-
298
- ## [Clear, Descriptive Title]
299
-
300
- [Concise explanation of what this covers]
301
-
302
- ### [Section as appropriate]
303
-
304
- [Specific, actionable content]
305
-
306
- **Learned:** [DATE] from [context - e.g., "analysis of git history", "discussion with user"]
307
- ```
308
-
309
- ---
310
-
311
- ## Phase 6: Final Review
312
-
313
- After generating rules based on your analysis and user answers:
314
-
315
- 1. **Present a summary** of all rules created
316
- 2. **Ask the user:**
317
-
318
- > "I've created rules covering [list areas]. Are there any other areas of the codebase that you know are confusing or have tribal knowledge that I might have missed?"
319
-
320
- 3. **Generate any additional rules** based on their response
321
-
322
- 4. **Suggest viewing rules in the dashboard:**
323
-
324
- > "Run `codeyam` to open the dashboard and view all rules in the Rules tab."
325
-
326
- 5. **Remind the user** to commit the new rules:
327
- ```
328
- git add .claude/rules/ .codeyam/rules/
329
- git commit -m "Add Power Rules for Claude Code"
330
- ```
331
-
332
- ---
333
-
334
- ## Ongoing Maintenance
335
-
336
- ### When Claude Should Update Rules
337
-
338
- - After fixing a bug that revealed a gotcha
339
- - After making an architectural decision
340
- - When code patterns change
341
- - When asking "why does this work this way?" and learning the answer
342
- - When receiving clarification from the user about any confusion
343
-
344
- ### Pre-commit Hook Behavior
345
-
346
- The pre-commit hook **blocks commits** when:
347
-
348
- - Code files matching a rule's `paths` are modified
349
- - The rule's `timestamp` is older than the code changes
350
-
351
- To proceed:
352
-
353
- 1. Review the flagged rule(s)
354
- 2. Update content if needed
355
- 3. Update the `timestamp` to current time
356
- 4. Stage and commit
357
-
358
- ---
359
-
360
- ## Instructions File Content
361
-
362
- Create `.codeyam/rules/instructions.md` with this content:
363
-
364
- ```markdown
365
- # Power Rules Guide
366
-
367
- ## Creating a New Rule
368
-
369
- 1. **Ask the user** what they want to document (architecture, testing pattern, or gotcha/FAQ)
370
- 2. **Read the relevant source files** to understand the patterns
371
- 3. **Ask clarifying questions** if anything is unclear
372
- 4. **Determine the file location** - rules mirror the source code structure (see below)
373
- 5. **Create the rule file** with proper YAML frontmatter and concise content
374
- 6. **Remind the user** to commit the rule and suggest running `codeyam` to view it in the dashboard
375
-
376
- ## File Locations
377
-
378
- Rules mirror the source code structure:
379
-
380
- | Source Path | Rule Path |
381
- | -------------------- | ----------------------------------------- |
382
- | `src/api/auth.ts` | `.claude/rules/src/api/auth.md` |
383
- | `src/utils/**` | `.claude/rules/src/utils/architecture.md` |
384
- | Project-wide testing | `.claude/rules/testing-patterns.md` |
385
-
386
- ## YAML Frontmatter (Required)
387
-
388
- Every rule file MUST have this structure:
389
-
390
- ## \`\`\`yaml
391
-
392
- paths:
393
-
394
- - 'specific/path/\*_/_.ts'
395
- - 'another/path/\*.tsx'
396
- category: architecture | testing | faq
397
- timestamp: 2026-01-27T15:30:00Z
398
-
399
- ---
400
-
401
- \`\`\`
402
-
403
- ### Fields
404
-
405
- | Field | Required | Description |
406
- | ----------- | -------- | ---------------------------------------------------- |
407
- | `paths` | Yes | Glob patterns - be specific to avoid wasting context |
408
- | `category` | Yes | `architecture`, `testing`, or `faq` |
409
- | `timestamp` | Yes | ISO 8601 - must update when reviewing rule |
410
-
411
- ### Timestamp Enforcement
412
-
413
- The pre-commit hook blocks commits when:
414
-
415
- - You modify files matching a rule's `paths`
416
- - The rule's `timestamp` is older than your changes
417
-
418
- To proceed: review the rule, update timestamp, commit.
419
-
420
- ## Content Guidelines
421
-
422
- ### Be Specific and Actionable
423
-
424
- - Good: "Run `pnpm test:api` for API tests, `pnpm test:ui` for component tests"
425
- - Bad: "Make sure to run the appropriate tests"
426
-
427
- ### Be Concise
428
-
429
- Every word costs context window space. Trim aggressively.
430
-
431
- ### Focus on Positive Instructions
432
-
433
- - Good: "Auth tokens are stored in httpOnly cookies managed by `src/auth/cookies.ts`"
434
- - Bad: "WARNING: Don't store tokens in localStorage!"
435
-
436
- ### Include Provenance
437
-
438
- End with: `**Learned:** YYYY-MM-DD from [context]`
439
-
440
- ## Categories
441
-
442
- **architecture** - Design decisions, file relationships, data flow, "why X is done this way"
443
-
444
- **testing** - Test commands, mock patterns, fixtures, "how to test X"
445
-
446
- **faq** - Gotchas, workarounds, common questions, "if you see X, do Y"
447
- ```