srcly 1.10.0__tar.gz → 1.12.0__tar.gz

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 (274) hide show
  1. {srcly-1.10.0 → srcly-1.12.0}/.gitignore +3 -0
  2. {srcly-1.10.0 → srcly-1.12.0}/PKG-INFO +1 -1
  3. {srcly-1.10.0 → srcly-1.12.0}/app/engine/VERSION.json +1 -1
  4. {srcly-1.10.0 → srcly-1.12.0}/app/main.py +2 -1
  5. {srcly-1.10.0 → srcly-1.12.0}/app/models.py +132 -1
  6. srcly-1.12.0/app/routers/symbols.py +84 -0
  7. {srcly-1.10.0 → srcly-1.12.0}/app/run.py +72 -7
  8. {srcly-1.10.0 → srcly-1.12.0}/app/services/analysis.py +31 -12
  9. {srcly-1.10.0 → srcly-1.12.0}/app/services/analysis_types.py +40 -3
  10. {srcly-1.10.0 → srcly-1.12.0}/app/services/cache.py +1 -1
  11. {srcly-1.10.0 → srcly-1.12.0}/app/services/deps/typescript_deps.py +64 -40
  12. {srcly-1.10.0 → srcly-1.12.0}/app/services/file_classes.py +6 -2
  13. {srcly-1.10.0 → srcly-1.12.0}/app/services/findings/__init__.py +3 -1
  14. srcly-1.12.0/app/services/findings/astgrep.py +124 -0
  15. srcly-1.12.0/app/services/findings/async_loops.py +280 -0
  16. srcly-1.12.0/app/services/findings/fixes.py +141 -0
  17. {srcly-1.10.0 → srcly-1.12.0}/app/services/findings/model.py +4 -0
  18. srcly-1.12.0/app/services/findings/reachability.py +427 -0
  19. {srcly-1.10.0 → srcly-1.12.0}/app/services/findings/runner.py +11 -3
  20. srcly-1.12.0/app/services/findings/solid.py +163 -0
  21. {srcly-1.10.0 → srcly-1.12.0}/app/services/findings/tools.py +1 -1
  22. {srcly-1.10.0 → srcly-1.12.0}/app/services/markers.py +1 -1
  23. {srcly-1.10.0 → srcly-1.12.0}/app/services/metric_catalog.py +21 -6
  24. {srcly-1.10.0 → srcly-1.12.0}/app/services/python/python_analysis.py +34 -1
  25. {srcly-1.10.0 → srcly-1.12.0}/app/services/reporting.py +25 -6
  26. srcly-1.12.0/app/services/scope_evidence.py +124 -0
  27. {srcly-1.10.0 → srcly-1.12.0}/app/services/scopes.py +207 -35
  28. srcly-1.12.0/app/services/size_budget.py +90 -0
  29. srcly-1.12.0/app/services/symbols/__init__.py +0 -0
  30. srcly-1.12.0/app/services/symbols/index.py +595 -0
  31. srcly-1.12.0/app/services/symbols/model.py +149 -0
  32. srcly-1.12.0/app/services/symbols/python.py +922 -0
  33. srcly-1.12.0/app/services/symbols/typescript.py +800 -0
  34. {srcly-1.10.0 → srcly-1.12.0}/app/services/typescript/typescript_analysis.py +49 -2
  35. srcly-1.12.0/app/static/assets/CodeModal-C_AIo1QB.js +39 -0
  36. srcly-1.10.0/app/static/assets/CompareApp-BiZkK4jb.js → srcly-1.12.0/app/static/assets/CompareApp-RH7Bjs4O.js +3 -3
  37. srcly-1.12.0/app/static/assets/DependencyView-DM38dwrh.js +38 -0
  38. srcly-1.10.0/app/static/assets/ScatterView-C8Ybu_2D.js → srcly-1.12.0/app/static/assets/ScatterView-DKs8gvG8.js +1 -1
  39. srcly-1.12.0/app/static/assets/api-DLzyt-_R.js +5 -0
  40. srcly-1.10.0/app/static/assets/chevron-left-DzY43DnQ.js → srcly-1.12.0/app/static/assets/chevron-left-BcFywGMG.js +1 -1
  41. srcly-1.12.0/app/static/assets/index-B3Qnm0_a.js +3 -0
  42. srcly-1.12.0/app/static/assets/index-Bhz0bj-o.css +1 -0
  43. srcly-1.12.0/app/static/assets/layout-CXqN8SN7.js +1 -0
  44. srcly-1.10.0/app/static/assets/rotate-ccw-B8VHUanK.js → srcly-1.12.0/app/static/assets/rotate-ccw-DSaV6PQb.js +1 -1
  45. {srcly-1.10.0 → srcly-1.12.0}/app/static/index.html +2 -2
  46. {srcly-1.10.0 → srcly-1.12.0}/pyproject.toml +1 -1
  47. srcly-1.10.0/app/static/assets/CodeModal-CrwBs8Qw.js +0 -38
  48. srcly-1.10.0/app/static/assets/DependencyView-BzcDf12a.js +0 -29
  49. srcly-1.10.0/app/static/assets/EffectsPanel-DQmn_9OC.js +0 -5
  50. srcly-1.10.0/app/static/assets/index-B8YAhGWb.css +0 -1
  51. srcly-1.10.0/app/static/assets/index-BDI7jF6_.js +0 -3
  52. srcly-1.10.0/app/static/assets/layout-CNArMkpZ.js +0 -1
  53. {srcly-1.10.0 → srcly-1.12.0}/README.md +0 -0
  54. {srcly-1.10.0 → srcly-1.12.0}/app/.gitignore +0 -0
  55. {srcly-1.10.0 → srcly-1.12.0}/app/__init__.py +0 -0
  56. {srcly-1.10.0 → srcly-1.12.0}/app/config.py +0 -0
  57. {srcly-1.10.0 → srcly-1.12.0}/app/engine/analysis-worker.js +0 -0
  58. {srcly-1.10.0 → srcly-1.12.0}/app/engine/models/ecmascript.json +0 -0
  59. {srcly-1.10.0 → srcly-1.12.0}/app/engine/models/library-models.schema.json +0 -0
  60. {srcly-1.10.0 → srcly-1.12.0}/app/engine/models/node.json +0 -0
  61. {srcly-1.10.0 → srcly-1.12.0}/app/engine/models/python.json +0 -0
  62. {srcly-1.10.0 → srcly-1.12.0}/app/engine/models/react.json +0 -0
  63. {srcly-1.10.0 → srcly-1.12.0}/app/engine/models/solid.json +0 -0
  64. {srcly-1.10.0 → srcly-1.12.0}/app/engine/models/utilities.json +0 -0
  65. {srcly-1.10.0 → srcly-1.12.0}/app/engine/models/web.json +0 -0
  66. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/LICENSE.txt +0 -0
  67. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/ThirdPartyNoticeText.txt +0 -0
  68. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.d.ts +0 -0
  69. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.decorators.d.ts +0 -0
  70. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.decorators.legacy.d.ts +0 -0
  71. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +0 -0
  72. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.dom.d.ts +0 -0
  73. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.dom.iterable.d.ts +0 -0
  74. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2015.collection.d.ts +0 -0
  75. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2015.core.d.ts +0 -0
  76. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2015.d.ts +0 -0
  77. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2015.generator.d.ts +0 -0
  78. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2015.iterable.d.ts +0 -0
  79. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2015.promise.d.ts +0 -0
  80. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2015.proxy.d.ts +0 -0
  81. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2015.reflect.d.ts +0 -0
  82. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2015.symbol.d.ts +0 -0
  83. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +0 -0
  84. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2016.array.include.d.ts +0 -0
  85. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2016.d.ts +0 -0
  86. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2016.full.d.ts +0 -0
  87. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2016.intl.d.ts +0 -0
  88. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +0 -0
  89. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2017.d.ts +0 -0
  90. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2017.date.d.ts +0 -0
  91. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2017.full.d.ts +0 -0
  92. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2017.intl.d.ts +0 -0
  93. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2017.object.d.ts +0 -0
  94. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +0 -0
  95. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2017.string.d.ts +0 -0
  96. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +0 -0
  97. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +0 -0
  98. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +0 -0
  99. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2018.d.ts +0 -0
  100. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2018.full.d.ts +0 -0
  101. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2018.intl.d.ts +0 -0
  102. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2018.promise.d.ts +0 -0
  103. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2018.regexp.d.ts +0 -0
  104. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2019.array.d.ts +0 -0
  105. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2019.d.ts +0 -0
  106. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2019.full.d.ts +0 -0
  107. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2019.intl.d.ts +0 -0
  108. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2019.object.d.ts +0 -0
  109. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2019.string.d.ts +0 -0
  110. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2019.symbol.d.ts +0 -0
  111. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2020.bigint.d.ts +0 -0
  112. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2020.d.ts +0 -0
  113. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2020.date.d.ts +0 -0
  114. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2020.full.d.ts +0 -0
  115. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2020.intl.d.ts +0 -0
  116. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2020.number.d.ts +0 -0
  117. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2020.promise.d.ts +0 -0
  118. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +0 -0
  119. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2020.string.d.ts +0 -0
  120. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +0 -0
  121. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2021.d.ts +0 -0
  122. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2021.full.d.ts +0 -0
  123. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2021.intl.d.ts +0 -0
  124. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2021.promise.d.ts +0 -0
  125. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2021.string.d.ts +0 -0
  126. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2021.weakref.d.ts +0 -0
  127. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2022.array.d.ts +0 -0
  128. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2022.d.ts +0 -0
  129. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2022.error.d.ts +0 -0
  130. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2022.full.d.ts +0 -0
  131. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2022.intl.d.ts +0 -0
  132. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2022.object.d.ts +0 -0
  133. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2022.regexp.d.ts +0 -0
  134. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2022.string.d.ts +0 -0
  135. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2023.array.d.ts +0 -0
  136. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2023.collection.d.ts +0 -0
  137. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2023.d.ts +0 -0
  138. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2023.full.d.ts +0 -0
  139. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2023.intl.d.ts +0 -0
  140. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +0 -0
  141. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2024.collection.d.ts +0 -0
  142. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2024.d.ts +0 -0
  143. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2024.full.d.ts +0 -0
  144. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2024.object.d.ts +0 -0
  145. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2024.promise.d.ts +0 -0
  146. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2024.regexp.d.ts +0 -0
  147. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +0 -0
  148. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es2024.string.d.ts +0 -0
  149. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es5.d.ts +0 -0
  150. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.es6.d.ts +0 -0
  151. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.esnext.array.d.ts +0 -0
  152. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.esnext.collection.d.ts +0 -0
  153. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.esnext.d.ts +0 -0
  154. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.esnext.decorators.d.ts +0 -0
  155. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.esnext.disposable.d.ts +0 -0
  156. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.esnext.error.d.ts +0 -0
  157. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.esnext.float16.d.ts +0 -0
  158. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.esnext.full.d.ts +0 -0
  159. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.esnext.intl.d.ts +0 -0
  160. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.esnext.iterator.d.ts +0 -0
  161. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.esnext.promise.d.ts +0 -0
  162. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +0 -0
  163. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.scripthost.d.ts +0 -0
  164. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +0 -0
  165. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.webworker.d.ts +0 -0
  166. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +0 -0
  167. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/lib.webworker.iterable.d.ts +0 -0
  168. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/lib/typescript.js +0 -0
  169. {srcly-1.10.0 → srcly-1.12.0}/app/engine/node_modules/typescript/package.json +0 -0
  170. {srcly-1.10.0 → srcly-1.12.0}/app/engine/package.json +0 -0
  171. {srcly-1.10.0 → srcly-1.12.0}/app/engine/srcly-engine.mjs +0 -0
  172. {srcly-1.10.0 → srcly-1.12.0}/app/engine/srcly_pyfacts.py +0 -0
  173. {srcly-1.10.0 → srcly-1.12.0}/app/routers/analysis.py +0 -0
  174. {srcly-1.10.0 → srcly-1.12.0}/app/routers/compare.py +0 -0
  175. {srcly-1.10.0 → srcly-1.12.0}/app/routers/dataflow.py +0 -0
  176. {srcly-1.10.0 → srcly-1.12.0}/app/routers/files.py +0 -0
  177. {srcly-1.10.0 → srcly-1.12.0}/app/routers/metrics.py +0 -0
  178. {srcly-1.10.0 → srcly-1.12.0}/app/routers/scans.py +0 -0
  179. {srcly-1.10.0 → srcly-1.12.0}/app/services/activity.py +0 -0
  180. {srcly-1.10.0 → srcly-1.12.0}/app/services/comment_noise.py +0 -0
  181. {srcly-1.10.0 → srcly-1.12.0}/app/services/compare/__init__.py +0 -0
  182. {srcly-1.10.0 → srcly-1.12.0}/app/services/compare/diff.py +0 -0
  183. {srcly-1.10.0 → srcly-1.12.0}/app/services/compare/git_refs.py +0 -0
  184. {srcly-1.10.0 → srcly-1.12.0}/app/services/compare/github.py +0 -0
  185. {srcly-1.10.0 → srcly-1.12.0}/app/services/compare/jobs.py +0 -0
  186. {srcly-1.10.0 → srcly-1.12.0}/app/services/compare/service.py +0 -0
  187. {srcly-1.10.0 → srcly-1.12.0}/app/services/compare/snapshots.py +0 -0
  188. {srcly-1.10.0 → srcly-1.12.0}/app/services/compare/sources.py +0 -0
  189. {srcly-1.10.0 → srcly-1.12.0}/app/services/css/css_analysis.py +0 -0
  190. {srcly-1.10.0 → srcly-1.12.0}/app/services/dataflow/__init__.py +0 -0
  191. {srcly-1.10.0 → srcly-1.12.0}/app/services/dataflow/availability.py +0 -0
  192. {srcly-1.10.0 → srcly-1.12.0}/app/services/dataflow/contracts/anchorGraph.schema.json +0 -0
  193. {srcly-1.10.0 → srcly-1.12.0}/app/services/dataflow/contracts/fileExports.schema.json +0 -0
  194. {srcly-1.10.0 → srcly-1.12.0}/app/services/dataflow/contracts/functionEffects.schema.json +0 -0
  195. {srcly-1.10.0 → srcly-1.12.0}/app/services/dataflow/contracts/hello.schema.json +0 -0
  196. {srcly-1.10.0 → srcly-1.12.0}/app/services/dataflow/contracts/routeGraph.schema.json +0 -0
  197. {srcly-1.10.0 → srcly-1.12.0}/app/services/dataflow/contracts/routePath.schema.json +0 -0
  198. {srcly-1.10.0 → srcly-1.12.0}/app/services/dataflow/contracts/routes.schema.json +0 -0
  199. {srcly-1.10.0 → srcly-1.12.0}/app/services/dataflow/contracts/selectExpression.schema.json +0 -0
  200. {srcly-1.10.0 → srcly-1.12.0}/app/services/dataflow/contracts/status.schema.json +0 -0
  201. {srcly-1.10.0 → srcly-1.12.0}/app/services/dataflow/contracts/valueFlow.schema.json +0 -0
  202. {srcly-1.10.0 → srcly-1.12.0}/app/services/dataflow/engine.py +0 -0
  203. {srcly-1.10.0 → srcly-1.12.0}/app/services/dataflow/models.py +0 -0
  204. {srcly-1.10.0 → srcly-1.12.0}/app/services/deps/__init__.py +0 -0
  205. {srcly-1.10.0 → srcly-1.12.0}/app/services/deps/common.py +0 -0
  206. {srcly-1.10.0 → srcly-1.12.0}/app/services/deps/graph.py +0 -0
  207. {srcly-1.10.0 → srcly-1.12.0}/app/services/deps/python_deps.py +0 -0
  208. {srcly-1.10.0 → srcly-1.12.0}/app/services/deps/tsconfig.py +0 -0
  209. {srcly-1.10.0 → srcly-1.12.0}/app/services/findings/builtin_ts.py +0 -0
  210. {srcly-1.10.0 → srcly-1.12.0}/app/services/findings/jobs.py +0 -0
  211. {srcly-1.10.0 → srcly-1.12.0}/app/services/findings/overlay.py +0 -0
  212. {srcly-1.10.0 → srcly-1.12.0}/app/services/findings/ruff.py +0 -0
  213. {srcly-1.10.0 → srcly-1.12.0}/app/services/findings/typescript.py +0 -0
  214. {srcly-1.10.0 → srcly-1.12.0}/app/services/ipynb/ipynb_analysis.py +0 -0
  215. {srcly-1.10.0 → srcly-1.12.0}/app/services/markdown/markdown_analysis.py +0 -0
  216. {srcly-1.10.0 → srcly-1.12.0}/app/services/quadrants.py +0 -0
  217. {srcly-1.10.0 → srcly-1.12.0}/app/services/scan_jobs.py +0 -0
  218. {srcly-1.10.0 → srcly-1.12.0}/app/services/scan_progress.py +0 -0
  219. {srcly-1.10.0 → srcly-1.12.0}/app/services/scan_workers.py +0 -0
  220. {srcly-1.10.0 → srcly-1.12.0}/app/services/typescript/components.py +0 -0
  221. {srcly-1.10.0 → srcly-1.12.0}/app/startup_info.py +0 -0
  222. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/bash-DgJyDXW6.js +0 -0
  223. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/css-PZBBrkI0.js +0 -0
  224. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/github-light-Rcb2q3L5.js +0 -0
  225. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/highlight.worker-C64dOQ1-.js +0 -0
  226. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/html-DOf0XnR2.js +0 -0
  227. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  228. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  229. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
  230. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
  231. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
  232. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
  233. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  234. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  235. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
  236. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
  237. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
  238. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
  239. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  240. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  241. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  242. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  243. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
  244. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
  245. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  246. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  247. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
  248. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
  249. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
  250. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
  251. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  252. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  253. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
  254. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
  255. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
  256. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
  257. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  258. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  259. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  260. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  261. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  262. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  263. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  264. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/javascript-WyGyM1wV.js +0 -0
  265. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/json-B8JryHcM.js +0 -0
  266. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/jsx-8cLv2Six.js +0 -0
  267. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/markdown-DX-TNHnc.js +0 -0
  268. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/python-B6Ihcp-E.js +0 -0
  269. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/toml-Ms459DBw.js +0 -0
  270. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/tsx-D6116Ycy.js +0 -0
  271. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/typescript-BqvgUolh.js +0 -0
  272. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/wasm-CG6Dc4jp.js +0 -0
  273. {srcly-1.10.0 → srcly-1.12.0}/app/static/assets/yaml-Bopit2L3.js +0 -0
  274. {srcly-1.10.0 → srcly-1.12.0}/app/static/favicon.svg +0 -0
@@ -1,6 +1,9 @@
1
1
  # General
2
2
  .DS_Store
3
3
  node_modules/
4
+ .pnpm-store/
5
+ site/.ssr/
6
+ site/test-results/
4
7
  # Screenshots, briefs and scratch output (never committed).
5
8
  tmp/
6
9
  # Per-worktree ports, written by scripts/bootstrap.sh.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: srcly
3
- Version: 1.10.0
3
+ Version: 1.12.0
4
4
  Summary: Interactive codebase treemap and metrics viewer.
5
5
  Requires-Python: >=3.13
6
6
  Requires-Dist: fastapi>=0.121.3
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "engine": "0.1.0",
3
3
  "typescript": "5.9.3",
4
- "builtAt": "2026-11-04T04:43:24.340Z"
4
+ "builtAt": "2026-11-15T02:51:39.342Z"
5
5
  }
@@ -8,7 +8,7 @@ import os
8
8
  import signal
9
9
  import threading
10
10
 
11
- from app.routers import analysis, compare, dataflow, files, metrics, scans
11
+ from app.routers import analysis, compare, dataflow, files, metrics, scans, symbols
12
12
  from app.services.dataflow import engine as dataflow_engine
13
13
  from app.services.scan_workers import cancel_all_scans
14
14
 
@@ -84,6 +84,7 @@ app.include_router(scans.router)
84
84
  app.include_router(compare.router)
85
85
  app.include_router(metrics.router)
86
86
  app.include_router(dataflow.router)
87
+ app.include_router(symbols.router)
87
88
 
88
89
 
89
90
  @app.get("/api-status")
@@ -1,5 +1,5 @@
1
1
  from typing import List
2
- from pydantic import BaseModel, Field
2
+ from pydantic import BaseModel, Field, PrivateAttr
3
3
 
4
4
  class Witness(BaseModel):
5
5
  """The function responsible for a max-type metric, so the UI can open it."""
@@ -32,6 +32,9 @@ class Metrics(BaseModel):
32
32
  # Mean CCN over executable functions (any depth), weighted by function
33
33
  # count for folders.
34
34
  complexity_avg: float | None = None
35
+ # Cognitive complexity (Sonar's rules): exact for a function; a file or folder
36
+ # holds its worst function's value and names it in ``witnesses``.
37
+ cognitive_complexity: int | None = None
35
38
  # Executable functions at any depth (methods, nested functions, arrows);
36
39
  # classes, types, object literals and JSX containers don't count.
37
40
  function_count: int | None = None
@@ -148,6 +151,15 @@ class FindingsInfo(BaseModel):
148
151
  finding_count: int = 0
149
152
 
150
153
 
154
+ class AnalysisInfo(BaseModel):
155
+ """Where a CLI command's tree came from (root node only; set by ``reporting.scan_tree``)."""
156
+
157
+ reused: bool # True: the saved scan matched the files' fingerprint, so nothing was rescanned
158
+ scanned_at: str # ISO time of the scan the tree came from
159
+ scan_seconds: float = 0.0
160
+ files_failed: int = 0 # analyzer timeouts, crashes and errors (fallback LOC only)
161
+
162
+
151
163
  class Node(BaseModel):
152
164
  name: str
153
165
  type: str # "folder", "file", "function", "function_body"
@@ -165,6 +177,8 @@ class Node(BaseModel):
165
177
  activity: ActivityInfo | None = None
166
178
  # Root only: whether the checks finished, and which tools ran.
167
179
  findings: FindingsInfo | None = None
180
+ # Root only, CLI only (never on the wire): whether ``reporting.scan_tree`` reused the saved scan.
181
+ _analysis: AnalysisInfo | None = PrivateAttr(default=None)
168
182
 
169
183
  model_config = {
170
184
  "populate_by_name": True
@@ -205,3 +219,120 @@ class DepGraph(BaseModel):
205
219
  root: str
206
220
  nodes: List[DepGraphNode]
207
221
  edges: List[DepGraphEdge]
222
+
223
+
224
+ class SymbolGraphNode(BaseModel):
225
+ """A declaration in the symbol reference graph, or a file's module-level code (`kind: module`)."""
226
+
227
+ model_config = {"populate_by_name": True}
228
+
229
+ id: str
230
+ name: str
231
+ kind: str
232
+ file: str
233
+ line: int
234
+ end_line: int = Field(alias="endLine")
235
+ container: str | None = None
236
+ exported: bool | None = None
237
+ is_test: bool | None = Field(default=None, alias="isTest")
238
+ language: str
239
+ # Distinct symbols that reference it, and that it references, over the whole index.
240
+ in_count: int = Field(alias="inCount")
241
+ out_count: int = Field(alias="outCount")
242
+ # Hops from the focus in a neighbourhood (0 for the focus).
243
+ hop: int | None = None
244
+ # `none`: nothing in the index references it; `tests`: only test files do. Absent otherwise (and for modules).
245
+ refs: str | None = None
246
+
247
+
248
+ class SymbolGraphEdge(BaseModel):
249
+ """source references target: `call`, `instantiate`, `read`, `write`, `type`, `extends` or `implements`."""
250
+
251
+ source: str
252
+ target: str
253
+ kind: str
254
+ # Where in the source's file, ascending; at most MAX_EDGE_LINES of them.
255
+ lines: List[int]
256
+ count: int
257
+ # How the reference was resolved: `exact`, `typed` (through a declared type) or `name` (member name alone).
258
+ resolution: str
259
+ # An `http` reference: the request as matched, `GET /api/items/{id}`.
260
+ via: str | None = None
261
+
262
+
263
+ class SymbolIndexInfo(BaseModel):
264
+ model_config = {"populate_by_name": True}
265
+
266
+ symbols: int
267
+ references: int
268
+ files: int
269
+ unresolved_members: int = Field(alias="unresolvedMembers")
270
+ built_ms: int = Field(alias="builtMs")
271
+ # Client requests joined to a handler of the index, and ones nothing answers.
272
+ http_links: int = Field(0, alias="httpLinks")
273
+ http_unmatched: int = Field(0, alias="httpUnmatched")
274
+
275
+
276
+ class SymbolGraph(BaseModel):
277
+ root: str
278
+ focus: str
279
+ nodes: List[SymbolGraphNode]
280
+ edges: List[SymbolGraphEdge]
281
+ truncated: bool | None = None
282
+ index: SymbolIndexInfo
283
+
284
+
285
+ class SymbolPath(BaseModel):
286
+ """The shortest chain of references between two symbols, or that there is none."""
287
+
288
+ root: str
289
+ start: str
290
+ end: str
291
+ found: bool
292
+ # `forward`: start references … references end; `backward`: the chain runs the other way; None: no chain.
293
+ direction: str | None = None
294
+ steps: int
295
+ # On a chain, in order (`hop` is the position); otherwise the two ends.
296
+ nodes: List[SymbolGraphNode]
297
+ # The merged references of each step.
298
+ edges: List[SymbolGraphEdge]
299
+ index: SymbolIndexInfo
300
+
301
+
302
+ class SymbolSearchHit(BaseModel):
303
+ model_config = {"populate_by_name": True}
304
+
305
+ id: str
306
+ name: str
307
+ kind: str
308
+ file: str
309
+ line: int
310
+ container: str | None = None
311
+ in_count: int = Field(alias="inCount")
312
+ out_count: int = Field(alias="outCount")
313
+ exported: bool | None = None
314
+ # Declared lines, for ranking what is unreferenced by its size.
315
+ lines: int | None = None
316
+
317
+
318
+ class SymbolSearch(BaseModel):
319
+ hits: List[SymbolSearchHit]
320
+ index: SymbolIndexInfo
321
+
322
+
323
+ class SymbolStats(BaseModel):
324
+ """What stands out in the whole index: symbols nothing references, and the ones everything does."""
325
+
326
+ model_config = {"populate_by_name": True}
327
+
328
+ root: str
329
+ # Nothing in the index references them (modules and test files aside): private ones first, then by size.
330
+ unreferenced: List[SymbolSearchHit]
331
+ unreferenced_count: int = Field(alias="unreferencedCount")
332
+ unreferenced_private: int = Field(alias="unreferencedPrivate")
333
+ # Referenced from test files only.
334
+ test_only: List[SymbolSearchHit] = Field(alias="testOnly")
335
+ test_only_count: int = Field(alias="testOnlyCount")
336
+ # Most distinct referencing symbols first.
337
+ hubs: List[SymbolSearchHit]
338
+ index: SymbolIndexInfo
@@ -0,0 +1,84 @@
1
+ """
2
+ The symbol reference graph: who calls, instantiates, reads, writes, extends or
3
+ names whom, inside and across files. Built once per root by name (tree-sitter)
4
+ and cached by file mtimes; served as neighbourhoods, never whole.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from pathlib import Path
10
+
11
+ from fastapi import APIRouter, HTTPException, Query
12
+
13
+ from app.models import SymbolGraph, SymbolPath, SymbolSearch, SymbolStats
14
+ from app.services.symbols.index import build_symbol_index
15
+ from app.services.symbols.model import REF_KINDS
16
+
17
+ router = APIRouter(prefix="/api/symbols", tags=["symbols"])
18
+
19
+
20
+ def _root(path: str | None) -> Path:
21
+ target = Path(path) if path else Path.cwd()
22
+ if not target.exists():
23
+ raise HTTPException(status_code=404, detail="Path not found")
24
+ return target.parent if target.is_file() else target
25
+
26
+
27
+ @router.get("/graph", response_model=SymbolGraph, response_model_exclude_none=True, response_model_by_alias=True)
28
+ def get_symbol_graph(
29
+ path: str | None = None,
30
+ at: str = Query(..., description="The focus symbol id: `<file>#<Qualified.name>`, or a file for its module-level code"),
31
+ hops: int = Query(1, ge=1, le=4),
32
+ kinds: str | None = Query(None, description="Comma-separated reference kinds to follow; default all"),
33
+ direction: str = Query("both", pattern="^(both|in|out)$"),
34
+ tests: bool = True,
35
+ members: bool = Query(True, description="Draw the focus's members (a class's methods, a file's top-level symbols) with it"),
36
+ more: str | None = Query(None, description="Comma-separated symbol ids whose own one-hop neighbourhoods join the graph (hops opened in place)"),
37
+ ):
38
+ """The focus symbol (and its members), every symbol within `hops` references of them, and the references among them."""
39
+ chosen = None
40
+ if kinds:
41
+ chosen = [k for k in kinds.split(",") if k in REF_KINDS]
42
+ if not chosen:
43
+ raise HTTPException(status_code=400, detail=f"kinds must be some of {', '.join(REF_KINDS)}")
44
+ index = build_symbol_index(_root(path))
45
+ opened = [m for m in (more or "").split(",") if m]
46
+ graph = index.neighbourhood(at, hops=hops, kinds=chosen, include_tests=tests, direction=direction, members=members, more=opened)
47
+ if graph is None:
48
+ raise HTTPException(status_code=404, detail=f"No symbol {at!r} in the index")
49
+ return graph
50
+
51
+
52
+ @router.get("/search", response_model=SymbolSearch, response_model_exclude_none=True, response_model_by_alias=True)
53
+ def search_symbols(path: str | None = None, q: str = Query("", max_length=200), limit: int = Query(30, ge=1, le=200), tests: bool = True):
54
+ """Symbols whose name, qualified name or file contains `q`, best match first, with their reference counts."""
55
+ index = build_symbol_index(_root(path))
56
+ return SymbolSearch(hits=index.search(q, limit=limit, include_tests=tests), index=index.info())
57
+
58
+
59
+ @router.get("/path", response_model=SymbolPath, response_model_exclude_none=True, response_model_by_alias=True)
60
+ def get_symbol_path(
61
+ path: str | None = None,
62
+ start: str = Query(..., alias="from", description="A symbol id"),
63
+ end: str = Query(..., alias="to", description="A symbol id"),
64
+ kinds: str | None = Query(None, description="Comma-separated reference kinds to follow; default all"),
65
+ tests: bool = True,
66
+ ):
67
+ """The shortest chain of references from one symbol to another (forward, else backward), or that there is none."""
68
+ chosen = None
69
+ if kinds:
70
+ chosen = [k for k in kinds.split(",") if k in REF_KINDS]
71
+ if not chosen:
72
+ raise HTTPException(status_code=400, detail=f"kinds must be some of {', '.join(REF_KINDS)}")
73
+ index = build_symbol_index(_root(path))
74
+ result = index.path(start, end, kinds=chosen, include_tests=tests)
75
+ if result is None:
76
+ missing = start if start not in index.symbols else end
77
+ raise HTTPException(status_code=404, detail=f"No symbol {missing!r} in the index")
78
+ return result
79
+
80
+
81
+ @router.get("/stats", response_model=SymbolStats, response_model_exclude_none=True, response_model_by_alias=True)
82
+ def get_symbol_stats(path: str | None = None, limit: int = Query(50, ge=1, le=500), hubs: int = Query(30, ge=1, le=200)):
83
+ """Symbols nothing references (private first, then largest), the ones only test files reference, and the top hubs."""
84
+ return build_symbol_index(_root(path)).stats(limit=limit, hubs=hubs)
@@ -80,7 +80,7 @@ def _main(argv: list[str] | None = None) -> None:
80
80
  - Opens the default browser to the app URL.
81
81
  """
82
82
  argv = list(argv) if argv is not None else sys.argv[1:]
83
- if argv and argv[0] in {"scan", "report", "hotspots", "explain", "compare"}:
83
+ if argv and argv[0] in {"scan", "report", "hotspots", "explain", "compare", "fix", "check"}:
84
84
  # stderr, so JSON on stdout stays clean.
85
85
  print(startup_info.version_line(), file=sys.stderr, flush=True)
86
86
  _run_headless(argv)
@@ -99,6 +99,8 @@ def _main(argv: list[str] | None = None) -> None:
99
99
  " explain drill into the repo, a folder, a file, or file::symbol\n"
100
100
  " hotspots rank files or functions by one metric\n"
101
101
  " compare metric and dependency changes between two git refs\n"
102
+ " fix show, then apply (--write), safe fixes for srcly's own findings\n"
103
+ " check --ratchet: fail when a file over the size budget grows\n"
102
104
  " scan write the raw analysis tree as JSON"
103
105
  ),
104
106
  )
@@ -184,7 +186,13 @@ def _cwd_scope(root: Path, path_arg: str | None) -> str:
184
186
 
185
187
 
186
188
  def _resolve_scope(root: Path, at: str) -> str:
187
- """``--at`` relative to the analyzed root (an absolute path inside it also works); keeps ``::symbol``."""
189
+ """``--at`` relative to the analyzed root (an absolute path inside it also works); keeps ``::symbol``
190
+ and a ``:line`` with any name after it (a pasted "start at" value such as ``a.py:12 parse``)."""
191
+ import re
192
+
193
+ line_at = re.match(r"^([^:\s]+):(\d+)(?:\s.*)?$", at.strip())
194
+ if line_at and "::" not in at:
195
+ return f"{_resolve_scope(root, line_at[1])}:{line_at[2]}{at.strip()[line_at.end(2):]}"
188
196
  file, sep, symbol = at.partition("::")
189
197
  target = (root / file).resolve()
190
198
  if not target.is_relative_to(root):
@@ -428,6 +436,27 @@ def _run_headless(argv: list[str]) -> None:
428
436
  compare_parser.add_argument("--refresh", action="store_true", help="Rescan both sides instead of using the cache.")
429
437
  compare_parser.add_argument("--limit", type=_positive_int, default=40, help="Maximum files in the markdown summary.")
430
438
 
439
+ fix_parser = subparsers.add_parser(
440
+ "fix", help="Show, then apply, the safe mechanical fixes for srcly's own findings."
441
+ )
442
+ fix_parser.add_argument("path", nargs="?", help="Path to fix. Defaults to the enclosing Git repo root.")
443
+ fix_parser.add_argument(
444
+ "--rule",
445
+ action="append",
446
+ default=None,
447
+ help="Only this rule's fixes. May be repeated. unreachable-file (deletes files) runs only when named.",
448
+ )
449
+ fix_parser.add_argument("--write", action="store_true", help="Apply the fixes. Without it, print the diff.")
450
+
451
+ check_parser = subparsers.add_parser("check", help="Fail when a code file over the size budget grows.")
452
+ check_parser.add_argument("path", nargs="?", help="Path to check. Defaults to the enclosing Git repo root.")
453
+ check_parser.add_argument(
454
+ "--ratchet", action="store_true", required=True, help="Compare file sizes with size_budget.json."
455
+ )
456
+ check_parser.add_argument(
457
+ "--budget", default=None, help="The size_budget.json to compare with. Defaults to <path>/.srcly/size_budget.json."
458
+ )
459
+
431
460
  args = parser.parse_args(argv)
432
461
  try:
433
462
  _dispatch(args)
@@ -439,6 +468,18 @@ def _run_headless(argv: list[str]) -> None:
439
468
 
440
469
 
441
470
  def _dispatch(args) -> None:
471
+ if args.command == "fix":
472
+ from app.services.findings import fixes
473
+
474
+ print(fixes.run(_resolve_target_path(args.path), set(args.rule or ()), apply=args.write))
475
+ return
476
+ if args.command == "check":
477
+ from app.services import size_budget
478
+
479
+ root = _resolve_target_path(args.path)
480
+ code, text = size_budget.check(root, Path(args.budget) if args.budget else root / ".srcly" / size_budget.FILE_NAME)
481
+ print(text)
482
+ raise SystemExit(code)
442
483
 
443
484
  if args.command == "compare":
444
485
  _run_compare(args)
@@ -488,9 +529,8 @@ def _dispatch(args) -> None:
488
529
  else:
489
530
  out_dir = Path(args.out).resolve()
490
531
  output_format = "both" if args.fail_on != "none" and args.format == "markdown" else args.format
491
- written = reporting.write_report(
532
+ payload = reporting.build_report_payload(
492
533
  target_path,
493
- out_dir,
494
534
  profile=args.profile,
495
535
  metric=args.metric,
496
536
  limit=args.limit,
@@ -509,12 +549,14 @@ def _dispatch(args) -> None:
509
549
  quadrant_cohort=args.quadrant_cohort,
510
550
  include_classes=("code", *args.include_class),
511
551
  )
552
+ written = reporting.write_artifacts(payload, out_dir, output_format=output_format)
512
553
  if args.verbose:
513
554
  print(f"Wrote Srcly report artifacts to {out_dir}")
514
555
  for path in written.values():
515
556
  print(f"- {path}")
516
557
  else:
517
- print(_format_quiet_report_summary(out_dir, written))
558
+ command = "srcly explain" + (f" {shlex.quote(args.path)}" if args.path else "")
559
+ print(_format_quiet_report_summary(out_dir, written, payload, command=command))
518
560
  if args.fail_on != "none":
519
561
  if args.stdout:
520
562
  _enforce_fail_on_payload(payload["findings"], args.fail_on)
@@ -607,10 +649,33 @@ def _deprioritize_paths(args) -> tuple[str, ...]:
607
649
  return tuple(reporting.DEFAULT_DEPRIORITIZED_PATHS) + tuple(args.deprioritize or ())
608
650
 
609
651
 
610
- def _format_quiet_report_summary(out_dir: Path, written: dict[str, Path]) -> str:
652
+ # Findings printed by a quiet `report`: enough to pick a first `explain --at` without opening an artifact.
653
+ REPORT_PRINTED_FINDINGS = 5
654
+
655
+
656
+ def _format_quiet_report_summary(
657
+ out_dir: Path, written: dict[str, Path], payload: dict, *, command: str = "srcly explain"
658
+ ) -> str:
659
+ from app.services import scopes
660
+
611
661
  names = ", ".join(path.name for path in written.values())
612
662
  read_first = written.get("report") or written["findings_top"]
613
- return f"Wrote {len(written)} Srcly artifacts to {out_dir}: {names}\nRead first: {read_first}"
663
+ lines = [f"Wrote {len(written)} Srcly artifacts to {out_dir}: {names}", f"Read first: {read_first}"]
664
+ findings = payload["findings"]["findings"]
665
+ top = [f for f in findings if f["priority"] in ("high", "medium")][:REPORT_PRINTED_FINDINGS]
666
+ if top:
667
+ lines += ["", f"Top findings ({len(top)} of {len(findings)}):", ""]
668
+ lines += [f"- {f['priority']} {f['score']} `{f['path']}`: {f['reason']}. Start at `{scopes.start_at(f)}`" for f in top]
669
+ elif findings:
670
+ lines += ["", f"No high or medium findings; {len(findings)} low ones in findings.json."]
671
+ else:
672
+ lines += ["", "No findings: no code files were ranked."]
673
+ analysis = payload["manifest"].get("analysis")
674
+ if analysis:
675
+ lines += ["", scopes.provenance_line(analysis)]
676
+ if top:
677
+ lines += ["", f"Next: `{command} --at {shlex.quote(top[0]['path'])}`"]
678
+ return "\n".join(lines)
614
679
 
615
680
 
616
681
  def _enforce_fail_on(findings_path: Path, fail_on: str) -> None:
@@ -125,6 +125,9 @@ def create_node(name: str, node_type: str, path: str) -> Node:
125
125
  children=[]
126
126
  )
127
127
 
128
+ JS_SUFFIXES = (".js", ".mjs", ".cjs")
129
+
130
+
128
131
  def language_for_path(path: str) -> str:
129
132
  """Which analyzer handles ``path``; mirrors ``analyze_single_file``."""
130
133
  lower = path.lower()
@@ -132,6 +135,10 @@ def language_for_path(path: str) -> str:
132
135
  return "tsx"
133
136
  if lower.endswith(".ts"):
134
137
  return "ts"
138
+ if lower.endswith(".jsx"):
139
+ return "jsx"
140
+ if lower.endswith(JS_SUFFIXES):
141
+ return "js"
135
142
  if lower.endswith(".py"):
136
143
  return "python"
137
144
  if lower.endswith(".ipynb"):
@@ -145,7 +152,7 @@ def language_for_path(path: str) -> str:
145
152
 
146
153
  # Computed here from the executable scopes, not taken from the analyzer, so
147
154
  # every language counts functions the same way.
148
- _FROM_SCOPES = frozenset({"complexity", "complexity_avg", "function_count", "average_function_length", "parameter_count"})
155
+ _FROM_SCOPES = frozenset({"complexity", "cognitive_complexity", "complexity_avg", "function_count", "average_function_length", "parameter_count"})
149
156
 
150
157
 
151
158
  def _scope_value(func, name: str):
@@ -239,6 +246,10 @@ def attach_file_metrics(node: Node, file_info) -> None:
239
246
  witness = _most_complex_function(node)
240
247
  m.complexity = witness.metrics.complexity if witness else 0
241
248
  m.complexity_witness = _witness_for(witness) if witness else None
249
+ cognitive_witness = None
250
+ if "cognitive_complexity" in file_measured:
251
+ cognitive_witness = _most_complex_function(node, "cognitive_complexity")
252
+ m.cognitive_complexity = cognitive_witness.metrics.cognitive_complexity if cognitive_witness else 0
242
253
 
243
254
  # Component metrics: the max over the file's components, each naming its
244
255
  # component. N/A when the file has none.
@@ -249,6 +260,8 @@ def attach_file_metrics(node: Node, file_info) -> None:
249
260
  top = max(components, key=lambda c: getattr(c.metrics, name)) # first in source order on ties
250
261
  setattr(m, name, getattr(top.metrics, name))
251
262
  m.witnesses[name] = _witness_for(top)
263
+ if cognitive_witness is not None:
264
+ m.witnesses = {**(m.witnesses or {}), "cognitive_complexity": _witness_for(cognitive_witness)}
252
265
 
253
266
  reasons = []
254
267
  if any(getattr(m, name) is None for name in OPTIONAL_METRIC_FIELDS if name not in file_measured | OVERLAY_METRICS):
@@ -260,14 +273,15 @@ def attach_file_metrics(node: Node, file_info) -> None:
260
273
  m.na_reason = "; ".join(reasons)
261
274
 
262
275
 
263
- def _most_complex_function(node: Node) -> Node | None:
264
- """The executable function with the highest CCN below ``node`` (first in source order on ties)."""
276
+ def _most_complex_function(node: Node, metric: str = "complexity") -> Node | None:
277
+ """The executable function with the highest ``metric`` below ``node`` (first in source order on ties)."""
265
278
  best: Node | None = None
266
279
  stack = list(reversed(node.children))
267
280
  while stack:
268
281
  child = stack.pop()
269
- if child.kind == "function" and child.metrics.complexity is not None:
270
- if best is None or child.metrics.complexity > best.metrics.complexity:
282
+ value = getattr(child.metrics, metric)
283
+ if child.kind == "function" and value is not None:
284
+ if best is None or value > getattr(best.metrics, metric):
271
285
  best = child
272
286
  stack.extend(reversed(child.children))
273
287
  return best
@@ -312,15 +326,16 @@ def _translate_gitignore_pattern(raw_line: str, base_rel: str) -> str | None:
312
326
  body = line[1:] if negated else line
313
327
 
314
328
  # Strip leading slash: anchored to the directory containing the .gitignore
315
- if body.startswith("/"):
329
+ anchored = body.startswith("/")
330
+ if anchored:
316
331
  body = body[1:]
317
332
 
318
333
  # Compute prefix for this .gitignore directory
319
334
  prefix = f"{base_rel}/" if base_rel else ""
320
335
 
321
- # If the pattern contains a slash, it's relative to the directory root.
322
- # Otherwise, it should match that name anywhere under the directory.
323
- if "/" in body:
336
+ # If the pattern is anchored or contains a slash, it's relative to the
337
+ # directory root. Otherwise, it matches that name anywhere under the directory.
338
+ if anchored or "/" in body.rstrip("/"):
324
339
  pat = prefix + body
325
340
  else:
326
341
  if base_rel:
@@ -839,7 +854,9 @@ def _should_log_file_progress(completed_count: int, total_count: int) -> bool:
839
854
  # How folders roll up each N/A-able metric. N/A children are skipped, so a
840
855
  # folder of Markdown and Python files gets the Python files' complexity, and a
841
856
  # folder is N/A only when no child measured the metric.
842
- _MAX_ROLLUP = frozenset({"complexity", "max_nesting_depth"}) | COMPONENT_METRICS
857
+ _MAX_ROLLUP = frozenset({"complexity", "cognitive_complexity", "max_nesting_depth"}) | COMPONENT_METRICS
858
+ # Max metrics that name the scope behind them in ``Metrics.witnesses``.
859
+ _WITNESSED = COMPONENT_METRICS | {"cognitive_complexity"}
843
860
  _MEAN_ROLLUP = frozenset({"complexity_avg", "average_function_length"}) # weighted by function_count
844
861
 
845
862
 
@@ -880,7 +897,7 @@ def aggregate_metrics(node: Node) -> Metrics:
880
897
  m.complexity_witness = witness_source.complexity_witness if witness_source else None
881
898
 
882
899
  witnesses = {}
883
- for name in COMPONENT_METRICS:
900
+ for name in _WITNESSED:
884
901
  value = getattr(m, name)
885
902
  source = next((c for c in child_metrics if c.witnesses and name in c.witnesses and getattr(c, name) == value), None)
886
903
  if source is not None:
@@ -897,7 +914,9 @@ def analyze_single_file(file_path: str):
897
914
  Must be top-level for multiprocessing pickling.
898
915
  """
899
916
  try:
900
- if file_path.endswith(".ts") or file_path.endswith(".tsx"):
917
+ # Lizard misreads JS template literals (a one-line arrow function took in 1,300 lines),
918
+ # so JS goes through the same tree-sitter analyzer as TypeScript.
919
+ if file_path.endswith((".ts", ".tsx", ".jsx", *JS_SUFFIXES)):
901
920
  analyzer = get_ts_analyzer()
902
921
  return analyzer.analyze_file(file_path)
903
922
  if file_path.endswith(".css") or file_path.endswith(".scss"):
@@ -12,6 +12,8 @@ class FunctionMetrics:
12
12
  max_nesting_depth: int = 0
13
13
  comment_lines: int = 0
14
14
  todo_count: int = 0
15
+ # Cognitive complexity (Sonar's rules; see add_cognitive).
16
+ cognitive_complexity: int = 0
15
17
  # Comment noise flags in this scope (see comment_noise.py).
16
18
  comment_noise: int = 0
17
19
  comment_noise_ratio: int = 0
@@ -87,6 +89,35 @@ def is_executable_scope(func) -> bool:
87
89
  return scope_kind(func) == "function"
88
90
 
89
91
 
92
+ def cognitive_nesting(node, breaks: frozenset[str], functions: frozenset[str], chained) -> int:
93
+ """How many structural breaks enclose ``node`` inside its own function (Sonar's nesting level).
94
+
95
+ ``try`` and plain blocks never nest; ``chained(n)`` is true for an ``else if`` that continues
96
+ its chain at the same level."""
97
+ depth, parent = 0, node.parent
98
+ while parent is not None and parent.type not in functions:
99
+ if parent.type in breaks and not chained(parent):
100
+ depth += 1
101
+ parent = parent.parent
102
+ return depth
103
+
104
+
105
+ def add_cognitive(active_scopes: list[dict], amount: int, *, propagate: bool) -> None:
106
+ """Add a cognitive-complexity increment to the innermost scope, and with ``propagate`` to the
107
+ nearest executable scope when the innermost is a display scope (JSX, object literal).
108
+
109
+ Sonar's rules: a structural break (``if``, loop, ``catch``, ternary, ``switch``) costs 1 plus
110
+ its nesting level; ``else``, ``else if`` and each run of one boolean operator cost 1. So a flat
111
+ chain of route checks stays low and nested code grows fast.
112
+ """
113
+ active_scopes[-1]["metrics"].cognitive_complexity += amount
114
+ if propagate and not is_executable_scope(active_scopes[-1]["metrics"]):
115
+ for scope in reversed(active_scopes[:-1]):
116
+ if is_executable_scope(scope["metrics"]):
117
+ scope["metrics"].cognitive_complexity += amount
118
+ break
119
+
120
+
90
121
  def iter_executable_scopes(funcs):
91
122
  """Every executable scope at any depth, display scopes skipped but descended."""
92
123
  for func in funcs:
@@ -97,11 +128,13 @@ def iter_executable_scopes(funcs):
97
128
 
98
129
  # Which analyzer handled a file, mirroring ``analysis.analyze_single_file``.
99
130
  # The client keeps the same ids (``metricApplicability.ts``: ``MetricLanguage``).
100
- Language = str # "ts" | "tsx" | "python" | "notebook" | "markdown" | "css" | "code" | "text"
131
+ Language = str # "ts" | "tsx" | "js" | "jsx" | "python" | "notebook" | "markdown" | "css" | "code" | "text"
101
132
 
102
133
  LANGUAGE_LABELS: dict[str, str] = {
103
134
  "ts": "TypeScript",
104
135
  "tsx": "TSX",
136
+ "js": "JavaScript",
137
+ "jsx": "JSX",
105
138
  "python": "Python",
106
139
  "notebook": "notebook",
107
140
  "markdown": "Markdown",
@@ -120,7 +153,7 @@ COMMENT_NOISE_METRICS = frozenset({
120
153
  "comment_noise_docblock",
121
154
  "comment_noise_commented_code",
122
155
  })
123
- _TREE_SITTER_CODE = _CODE_CORE | COMMENT_NOISE_METRICS | {"comment_lines", "max_nesting_depth", "todo_count", "classes_count"}
156
+ _TREE_SITTER_CODE = _CODE_CORE | COMMENT_NOISE_METRICS | {"comment_lines", "max_nesting_depth", "todo_count", "classes_count", "cognitive_complexity"}
124
157
  _TS = _TREE_SITTER_CODE | {
125
158
  "ts_any_usage_count",
126
159
  "ts_ignore_count",
@@ -142,6 +175,8 @@ COMPONENT_METRICS = frozenset({
142
175
  MEASURED_FILE_METRICS: dict[str, frozenset[str]] = {
143
176
  "ts": frozenset(_TS),
144
177
  "tsx": frozenset(_TS | COMPONENT_METRICS),
178
+ "js": frozenset(_TREE_SITTER_CODE),
179
+ "jsx": frozenset(_TREE_SITTER_CODE | COMPONENT_METRICS),
145
180
  "python": frozenset(_TREE_SITTER_CODE | {"python_import_count"}),
146
181
  "code": _CODE_CORE,
147
182
  "markdown": frozenset({"md_data_url_count"}),
@@ -150,10 +185,12 @@ MEASURED_FILE_METRICS: dict[str, frozenset[str]] = {
150
185
  "text": frozenset(),
151
186
  }
152
187
 
153
- _TREE_SITTER_SCOPE = frozenset({"complexity", "parameter_count", "max_nesting_depth", "comment_lines", "todo_count"}) | COMMENT_NOISE_METRICS
188
+ _TREE_SITTER_SCOPE = frozenset({"complexity", "cognitive_complexity", "parameter_count", "max_nesting_depth", "comment_lines", "todo_count"}) | COMMENT_NOISE_METRICS
154
189
  MEASURED_SCOPE_METRICS: dict[str, frozenset[str]] = {
155
190
  "ts": _TREE_SITTER_SCOPE | {"ts_type_interface_count"},
156
191
  "tsx": _TREE_SITTER_SCOPE | {"ts_type_interface_count"} | COMPONENT_METRICS,
192
+ "js": _TREE_SITTER_SCOPE,
193
+ "jsx": _TREE_SITTER_SCOPE | COMPONENT_METRICS,
157
194
  "python": _TREE_SITTER_SCOPE,
158
195
  "code": frozenset({"complexity", "parameter_count"}),
159
196
  "markdown": frozenset({"md_data_url_count"}),
@@ -39,7 +39,7 @@ from app.config import IGNORE_DIRS
39
39
  from app.services import analysis
40
40
 
41
41
  # Bump when the stored tree's shape changes in a way old entries can't serve.
42
- CACHE_FORMAT = 3
42
+ CACHE_FORMAT = 5
43
43
  CACHE_DIR_ENV = "SRCLY_CACHE_DIR"
44
44
  # On-disk entries kept; older ones are deleted on save.
45
45
  MAX_DISK_ENTRIES = 20