@opensip-cli/checks-typescript 0.1.0

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 (404) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +8 -0
  3. package/README.md +31 -0
  4. package/dist/__tests__/all-checks-execute.test.d.ts +12 -0
  5. package/dist/__tests__/all-checks-execute.test.d.ts.map +1 -0
  6. package/dist/__tests__/all-checks-execute.test.js +846 -0
  7. package/dist/__tests__/all-checks-execute.test.js.map +1 -0
  8. package/dist/__tests__/behavior-fixtures-2.test.d.ts +9 -0
  9. package/dist/__tests__/behavior-fixtures-2.test.d.ts.map +1 -0
  10. package/dist/__tests__/behavior-fixtures-2.test.js +625 -0
  11. package/dist/__tests__/behavior-fixtures-2.test.js.map +1 -0
  12. package/dist/__tests__/behavior-fixtures-3.test.d.ts +7 -0
  13. package/dist/__tests__/behavior-fixtures-3.test.d.ts.map +1 -0
  14. package/dist/__tests__/behavior-fixtures-3.test.js +658 -0
  15. package/dist/__tests__/behavior-fixtures-3.test.js.map +1 -0
  16. package/dist/__tests__/behavior-fixtures-4.test.d.ts +8 -0
  17. package/dist/__tests__/behavior-fixtures-4.test.d.ts.map +1 -0
  18. package/dist/__tests__/behavior-fixtures-4.test.js +590 -0
  19. package/dist/__tests__/behavior-fixtures-4.test.js.map +1 -0
  20. package/dist/__tests__/behavior-fixtures-5.test.d.ts +7 -0
  21. package/dist/__tests__/behavior-fixtures-5.test.d.ts.map +1 -0
  22. package/dist/__tests__/behavior-fixtures-5.test.js +548 -0
  23. package/dist/__tests__/behavior-fixtures-5.test.js.map +1 -0
  24. package/dist/__tests__/behavior-fixtures-6.test.d.ts +18 -0
  25. package/dist/__tests__/behavior-fixtures-6.test.d.ts.map +1 -0
  26. package/dist/__tests__/behavior-fixtures-6.test.js +1700 -0
  27. package/dist/__tests__/behavior-fixtures-6.test.js.map +1 -0
  28. package/dist/__tests__/behavior-fixtures.test.d.ts +10 -0
  29. package/dist/__tests__/behavior-fixtures.test.d.ts.map +1 -0
  30. package/dist/__tests__/behavior-fixtures.test.js +812 -0
  31. package/dist/__tests__/behavior-fixtures.test.js.map +1 -0
  32. package/dist/__tests__/branch-fixtures-2.test.d.ts +6 -0
  33. package/dist/__tests__/branch-fixtures-2.test.d.ts.map +1 -0
  34. package/dist/__tests__/branch-fixtures-2.test.js +1369 -0
  35. package/dist/__tests__/branch-fixtures-2.test.js.map +1 -0
  36. package/dist/__tests__/branch-fixtures-3.test.d.ts +7 -0
  37. package/dist/__tests__/branch-fixtures-3.test.d.ts.map +1 -0
  38. package/dist/__tests__/branch-fixtures-3.test.js +877 -0
  39. package/dist/__tests__/branch-fixtures-3.test.js.map +1 -0
  40. package/dist/__tests__/branch-fixtures.test.d.ts +6 -0
  41. package/dist/__tests__/branch-fixtures.test.d.ts.map +1 -0
  42. package/dist/__tests__/branch-fixtures.test.js +1072 -0
  43. package/dist/__tests__/branch-fixtures.test.js.map +1 -0
  44. package/dist/__tests__/checks.test.d.ts +2 -0
  45. package/dist/__tests__/checks.test.d.ts.map +1 -0
  46. package/dist/__tests__/checks.test.js +39 -0
  47. package/dist/__tests__/checks.test.js.map +1 -0
  48. package/dist/__tests__/fixture-coverage.allowlist.d.ts +19 -0
  49. package/dist/__tests__/fixture-coverage.allowlist.d.ts.map +1 -0
  50. package/dist/__tests__/fixture-coverage.allowlist.js +27 -0
  51. package/dist/__tests__/fixture-coverage.allowlist.js.map +1 -0
  52. package/dist/__tests__/fixture-coverage.test.d.ts +13 -0
  53. package/dist/__tests__/fixture-coverage.test.d.ts.map +1 -0
  54. package/dist/__tests__/fixture-coverage.test.js +57 -0
  55. package/dist/__tests__/fixture-coverage.test.js.map +1 -0
  56. package/dist/__tests__/no-bootstrap-tool-import.test.d.ts +2 -0
  57. package/dist/__tests__/no-bootstrap-tool-import.test.d.ts.map +1 -0
  58. package/dist/__tests__/no-bootstrap-tool-import.test.js +75 -0
  59. package/dist/__tests__/no-bootstrap-tool-import.test.js.map +1 -0
  60. package/dist/__tests__/phantom-dependency-detection.test.d.ts +12 -0
  61. package/dist/__tests__/phantom-dependency-detection.test.d.ts.map +1 -0
  62. package/dist/__tests__/phantom-dependency-detection.test.js +112 -0
  63. package/dist/__tests__/phantom-dependency-detection.test.js.map +1 -0
  64. package/dist/__tests__/typescript-frontend.test.d.ts +8 -0
  65. package/dist/__tests__/typescript-frontend.test.d.ts.map +1 -0
  66. package/dist/__tests__/typescript-frontend.test.js +57 -0
  67. package/dist/__tests__/typescript-frontend.test.js.map +1 -0
  68. package/dist/checks/architecture/circular-import-detection.d.ts +14 -0
  69. package/dist/checks/architecture/circular-import-detection.d.ts.map +1 -0
  70. package/dist/checks/architecture/circular-import-detection.js +55 -0
  71. package/dist/checks/architecture/circular-import-detection.js.map +1 -0
  72. package/dist/checks/architecture/contracts-schema-consistency.d.ts +11 -0
  73. package/dist/checks/architecture/contracts-schema-consistency.d.ts.map +1 -0
  74. package/dist/checks/architecture/contracts-schema-consistency.js +75 -0
  75. package/dist/checks/architecture/contracts-schema-consistency.js.map +1 -0
  76. package/dist/checks/architecture/drizzle-orm-migration-guardrails.d.ts +12 -0
  77. package/dist/checks/architecture/drizzle-orm-migration-guardrails.d.ts.map +1 -0
  78. package/dist/checks/architecture/drizzle-orm-migration-guardrails.js +92 -0
  79. package/dist/checks/architecture/drizzle-orm-migration-guardrails.js.map +1 -0
  80. package/dist/checks/architecture/index.d.ts +10 -0
  81. package/dist/checks/architecture/index.d.ts.map +1 -0
  82. package/dist/checks/architecture/index.js +10 -0
  83. package/dist/checks/architecture/index.js.map +1 -0
  84. package/dist/checks/architecture/missing-type-exports.d.ts +13 -0
  85. package/dist/checks/architecture/missing-type-exports.d.ts.map +1 -0
  86. package/dist/checks/architecture/missing-type-exports.js +245 -0
  87. package/dist/checks/architecture/missing-type-exports.js.map +1 -0
  88. package/dist/checks/architecture/module-coupling-fan-out.d.ts +20 -0
  89. package/dist/checks/architecture/module-coupling-fan-out.d.ts.map +1 -0
  90. package/dist/checks/architecture/module-coupling-fan-out.js +120 -0
  91. package/dist/checks/architecture/module-coupling-fan-out.js.map +1 -0
  92. package/dist/checks/architecture/no-bootstrap-tool-import.d.ts +38 -0
  93. package/dist/checks/architecture/no-bootstrap-tool-import.d.ts.map +1 -0
  94. package/dist/checks/architecture/no-bootstrap-tool-import.js +95 -0
  95. package/dist/checks/architecture/no-bootstrap-tool-import.js.map +1 -0
  96. package/dist/checks/architecture/package-json-exports-field.d.ts +10 -0
  97. package/dist/checks/architecture/package-json-exports-field.d.ts.map +1 -0
  98. package/dist/checks/architecture/package-json-exports-field.js +56 -0
  99. package/dist/checks/architecture/package-json-exports-field.js.map +1 -0
  100. package/dist/checks/architecture/phantom-dependency-detection.d.ts +22 -0
  101. package/dist/checks/architecture/phantom-dependency-detection.d.ts.map +1 -0
  102. package/dist/checks/architecture/phantom-dependency-detection.js +330 -0
  103. package/dist/checks/architecture/phantom-dependency-detection.js.map +1 -0
  104. package/dist/checks/architecture/tsconfig-extends-validation.d.ts +10 -0
  105. package/dist/checks/architecture/tsconfig-extends-validation.d.ts.map +1 -0
  106. package/dist/checks/architecture/tsconfig-extends-validation.js +78 -0
  107. package/dist/checks/architecture/tsconfig-extends-validation.js.map +1 -0
  108. package/dist/checks/index.d.ts +6 -0
  109. package/dist/checks/index.d.ts.map +1 -0
  110. package/dist/checks/index.js +6 -0
  111. package/dist/checks/index.js.map +1 -0
  112. package/dist/checks/quality/api/api-contract-validation.d.ts +15 -0
  113. package/dist/checks/quality/api/api-contract-validation.d.ts.map +1 -0
  114. package/dist/checks/quality/api/api-contract-validation.js +316 -0
  115. package/dist/checks/quality/api/api-contract-validation.js.map +1 -0
  116. package/dist/checks/quality/api/api-response-validation.d.ts +14 -0
  117. package/dist/checks/quality/api/api-response-validation.d.ts.map +1 -0
  118. package/dist/checks/quality/api/api-response-validation.js +209 -0
  119. package/dist/checks/quality/api/api-response-validation.js.map +1 -0
  120. package/dist/checks/quality/api/fastify-route-validation.d.ts +14 -0
  121. package/dist/checks/quality/api/fastify-route-validation.d.ts.map +1 -0
  122. package/dist/checks/quality/api/fastify-route-validation.js +298 -0
  123. package/dist/checks/quality/api/fastify-route-validation.js.map +1 -0
  124. package/dist/checks/quality/api/fastify-schema-coverage.d.ts +11 -0
  125. package/dist/checks/quality/api/fastify-schema-coverage.d.ts.map +1 -0
  126. package/dist/checks/quality/api/fastify-schema-coverage.js +261 -0
  127. package/dist/checks/quality/api/fastify-schema-coverage.js.map +1 -0
  128. package/dist/checks/quality/api/index.d.ts +5 -0
  129. package/dist/checks/quality/api/index.d.ts.map +1 -0
  130. package/dist/checks/quality/api/index.js +5 -0
  131. package/dist/checks/quality/api/index.js.map +1 -0
  132. package/dist/checks/quality/code-structure/duplicate-utility-functions.d.ts +32 -0
  133. package/dist/checks/quality/code-structure/duplicate-utility-functions.d.ts.map +1 -0
  134. package/dist/checks/quality/code-structure/duplicate-utility-functions.js +451 -0
  135. package/dist/checks/quality/code-structure/duplicate-utility-functions.js.map +1 -0
  136. package/dist/checks/quality/code-structure/index.d.ts +3 -0
  137. package/dist/checks/quality/code-structure/index.d.ts.map +1 -0
  138. package/dist/checks/quality/code-structure/index.js +3 -0
  139. package/dist/checks/quality/code-structure/index.js.map +1 -0
  140. package/dist/checks/quality/code-structure/no-any-types.d.ts +13 -0
  141. package/dist/checks/quality/code-structure/no-any-types.d.ts.map +1 -0
  142. package/dist/checks/quality/code-structure/no-any-types.js +116 -0
  143. package/dist/checks/quality/code-structure/no-any-types.js.map +1 -0
  144. package/dist/checks/quality/data-integrity/__tests__/null-safety-fp.test.d.ts +15 -0
  145. package/dist/checks/quality/data-integrity/__tests__/null-safety-fp.test.d.ts.map +1 -0
  146. package/dist/checks/quality/data-integrity/__tests__/null-safety-fp.test.js +51 -0
  147. package/dist/checks/quality/data-integrity/__tests__/null-safety-fp.test.js.map +1 -0
  148. package/dist/checks/quality/data-integrity/array-validation.d.ts +16 -0
  149. package/dist/checks/quality/data-integrity/array-validation.d.ts.map +1 -0
  150. package/dist/checks/quality/data-integrity/array-validation.js +508 -0
  151. package/dist/checks/quality/data-integrity/array-validation.js.map +1 -0
  152. package/dist/checks/quality/data-integrity/database-index-coverage.d.ts +14 -0
  153. package/dist/checks/quality/data-integrity/database-index-coverage.d.ts.map +1 -0
  154. package/dist/checks/quality/data-integrity/database-index-coverage.js +235 -0
  155. package/dist/checks/quality/data-integrity/database-index-coverage.js.map +1 -0
  156. package/dist/checks/quality/data-integrity/database-schema-validation.d.ts +16 -0
  157. package/dist/checks/quality/data-integrity/database-schema-validation.d.ts.map +1 -0
  158. package/dist/checks/quality/data-integrity/database-schema-validation.js +328 -0
  159. package/dist/checks/quality/data-integrity/database-schema-validation.js.map +1 -0
  160. package/dist/checks/quality/data-integrity/in-memory-repository-detection.d.ts +14 -0
  161. package/dist/checks/quality/data-integrity/in-memory-repository-detection.d.ts.map +1 -0
  162. package/dist/checks/quality/data-integrity/in-memory-repository-detection.js +157 -0
  163. package/dist/checks/quality/data-integrity/in-memory-repository-detection.js.map +1 -0
  164. package/dist/checks/quality/data-integrity/index.d.ts +8 -0
  165. package/dist/checks/quality/data-integrity/index.d.ts.map +1 -0
  166. package/dist/checks/quality/data-integrity/index.js +8 -0
  167. package/dist/checks/quality/data-integrity/index.js.map +1 -0
  168. package/dist/checks/quality/data-integrity/missing-input-validation.d.ts +12 -0
  169. package/dist/checks/quality/data-integrity/missing-input-validation.d.ts.map +1 -0
  170. package/dist/checks/quality/data-integrity/missing-input-validation.js +180 -0
  171. package/dist/checks/quality/data-integrity/missing-input-validation.js.map +1 -0
  172. package/dist/checks/quality/data-integrity/null-safety.d.ts +33 -0
  173. package/dist/checks/quality/data-integrity/null-safety.d.ts.map +1 -0
  174. package/dist/checks/quality/data-integrity/null-safety.js +766 -0
  175. package/dist/checks/quality/data-integrity/null-safety.js.map +1 -0
  176. package/dist/checks/quality/data-integrity/numeric-validation.d.ts +12 -0
  177. package/dist/checks/quality/data-integrity/numeric-validation.d.ts.map +1 -0
  178. package/dist/checks/quality/data-integrity/numeric-validation.js +409 -0
  179. package/dist/checks/quality/data-integrity/numeric-validation.js.map +1 -0
  180. package/dist/checks/quality/frontend/a11y-form-labels.d.ts +14 -0
  181. package/dist/checks/quality/frontend/a11y-form-labels.d.ts.map +1 -0
  182. package/dist/checks/quality/frontend/a11y-form-labels.js +93 -0
  183. package/dist/checks/quality/frontend/a11y-form-labels.js.map +1 -0
  184. package/dist/checks/quality/frontend/a11y-semantic-html.d.ts +14 -0
  185. package/dist/checks/quality/frontend/a11y-semantic-html.d.ts.map +1 -0
  186. package/dist/checks/quality/frontend/a11y-semantic-html.js +88 -0
  187. package/dist/checks/quality/frontend/a11y-semantic-html.js.map +1 -0
  188. package/dist/checks/quality/frontend/index.d.ts +4 -0
  189. package/dist/checks/quality/frontend/index.d.ts.map +1 -0
  190. package/dist/checks/quality/frontend/index.js +4 -0
  191. package/dist/checks/quality/frontend/index.js.map +1 -0
  192. package/dist/checks/quality/frontend/test-only-frontend-modules.d.ts +13 -0
  193. package/dist/checks/quality/frontend/test-only-frontend-modules.d.ts.map +1 -0
  194. package/dist/checks/quality/frontend/test-only-frontend-modules.js +159 -0
  195. package/dist/checks/quality/frontend/test-only-frontend-modules.js.map +1 -0
  196. package/dist/checks/quality/incomplete-regex-escaping.d.ts +13 -0
  197. package/dist/checks/quality/incomplete-regex-escaping.d.ts.map +1 -0
  198. package/dist/checks/quality/incomplete-regex-escaping.js +207 -0
  199. package/dist/checks/quality/incomplete-regex-escaping.js.map +1 -0
  200. package/dist/checks/quality/index.d.ts +11 -0
  201. package/dist/checks/quality/index.d.ts.map +1 -0
  202. package/dist/checks/quality/index.js +11 -0
  203. package/dist/checks/quality/index.js.map +1 -0
  204. package/dist/checks/quality/linting/index.d.ts +2 -0
  205. package/dist/checks/quality/linting/index.d.ts.map +1 -0
  206. package/dist/checks/quality/linting/index.js +2 -0
  207. package/dist/checks/quality/linting/index.js.map +1 -0
  208. package/dist/checks/quality/linting/typescript-frontend.d.ts +25 -0
  209. package/dist/checks/quality/linting/typescript-frontend.d.ts.map +1 -0
  210. package/dist/checks/quality/linting/typescript-frontend.js +159 -0
  211. package/dist/checks/quality/linting/typescript-frontend.js.map +1 -0
  212. package/dist/checks/quality/observability/index.d.ts +5 -0
  213. package/dist/checks/quality/observability/index.d.ts.map +1 -0
  214. package/dist/checks/quality/observability/index.js +5 -0
  215. package/dist/checks/quality/observability/index.js.map +1 -0
  216. package/dist/checks/quality/observability/logger-event-name-format.d.ts +12 -0
  217. package/dist/checks/quality/observability/logger-event-name-format.d.ts.map +1 -0
  218. package/dist/checks/quality/observability/logger-event-name-format.js +124 -0
  219. package/dist/checks/quality/observability/logger-event-name-format.js.map +1 -0
  220. package/dist/checks/quality/observability/no-hardcoded-correlation-id.d.ts +5 -0
  221. package/dist/checks/quality/observability/no-hardcoded-correlation-id.d.ts.map +1 -0
  222. package/dist/checks/quality/observability/no-hardcoded-correlation-id.js +77 -0
  223. package/dist/checks/quality/observability/no-hardcoded-correlation-id.js.map +1 -0
  224. package/dist/checks/quality/observability/observability-coverage/__tests__/analyzer.test.d.ts +11 -0
  225. package/dist/checks/quality/observability/observability-coverage/__tests__/analyzer.test.d.ts.map +1 -0
  226. package/dist/checks/quality/observability/observability-coverage/__tests__/analyzer.test.js +107 -0
  227. package/dist/checks/quality/observability/observability-coverage/__tests__/analyzer.test.js.map +1 -0
  228. package/dist/checks/quality/observability/observability-coverage/__tests__/logger-detector.test.d.ts +12 -0
  229. package/dist/checks/quality/observability/observability-coverage/__tests__/logger-detector.test.d.ts.map +1 -0
  230. package/dist/checks/quality/observability/observability-coverage/__tests__/logger-detector.test.js +94 -0
  231. package/dist/checks/quality/observability/observability-coverage/__tests__/logger-detector.test.js.map +1 -0
  232. package/dist/checks/quality/observability/observability-coverage/analyzer.d.ts +13 -0
  233. package/dist/checks/quality/observability/observability-coverage/analyzer.d.ts.map +1 -0
  234. package/dist/checks/quality/observability/observability-coverage/analyzer.js +117 -0
  235. package/dist/checks/quality/observability/observability-coverage/analyzer.js.map +1 -0
  236. package/dist/checks/quality/observability/observability-coverage/index.d.ts +4 -0
  237. package/dist/checks/quality/observability/observability-coverage/index.d.ts.map +1 -0
  238. package/dist/checks/quality/observability/observability-coverage/index.js +4 -0
  239. package/dist/checks/quality/observability/observability-coverage/index.js.map +1 -0
  240. package/dist/checks/quality/observability/observability-coverage/logger-detector.d.ts +29 -0
  241. package/dist/checks/quality/observability/observability-coverage/logger-detector.d.ts.map +1 -0
  242. package/dist/checks/quality/observability/observability-coverage/logger-detector.js +111 -0
  243. package/dist/checks/quality/observability/observability-coverage/logger-detector.js.map +1 -0
  244. package/dist/checks/quality/observability/observability-coverage/types.d.ts +64 -0
  245. package/dist/checks/quality/observability/observability-coverage/types.d.ts.map +1 -0
  246. package/dist/checks/quality/observability/observability-coverage/types.js +6 -0
  247. package/dist/checks/quality/observability/observability-coverage/types.js.map +1 -0
  248. package/dist/checks/quality/observability/pii-exposure-in-logs.d.ts +22 -0
  249. package/dist/checks/quality/observability/pii-exposure-in-logs.d.ts.map +1 -0
  250. package/dist/checks/quality/observability/pii-exposure-in-logs.js +212 -0
  251. package/dist/checks/quality/observability/pii-exposure-in-logs.js.map +1 -0
  252. package/dist/checks/quality/observability/pii-exposure-in-logs.test.d.ts +11 -0
  253. package/dist/checks/quality/observability/pii-exposure-in-logs.test.d.ts.map +1 -0
  254. package/dist/checks/quality/observability/pii-exposure-in-logs.test.js +46 -0
  255. package/dist/checks/quality/observability/pii-exposure-in-logs.test.js.map +1 -0
  256. package/dist/checks/quality/patterns/__tests__/toctou-fp.test.d.ts +14 -0
  257. package/dist/checks/quality/patterns/__tests__/toctou-fp.test.d.ts.map +1 -0
  258. package/dist/checks/quality/patterns/__tests__/toctou-fp.test.js +61 -0
  259. package/dist/checks/quality/patterns/__tests__/toctou-fp.test.js.map +1 -0
  260. package/dist/checks/quality/patterns/async-waterfall-detection.d.ts +26 -0
  261. package/dist/checks/quality/patterns/async-waterfall-detection.d.ts.map +1 -0
  262. package/dist/checks/quality/patterns/async-waterfall-detection.js +410 -0
  263. package/dist/checks/quality/patterns/async-waterfall-detection.js.map +1 -0
  264. package/dist/checks/quality/patterns/dispose-pattern-completeness.d.ts +13 -0
  265. package/dist/checks/quality/patterns/dispose-pattern-completeness.d.ts.map +1 -0
  266. package/dist/checks/quality/patterns/dispose-pattern-completeness.js +220 -0
  267. package/dist/checks/quality/patterns/dispose-pattern-completeness.js.map +1 -0
  268. package/dist/checks/quality/patterns/error-handling-quality.d.ts +17 -0
  269. package/dist/checks/quality/patterns/error-handling-quality.d.ts.map +1 -0
  270. package/dist/checks/quality/patterns/error-handling-quality.js +335 -0
  271. package/dist/checks/quality/patterns/error-handling-quality.js.map +1 -0
  272. package/dist/checks/quality/patterns/index.d.ts +10 -0
  273. package/dist/checks/quality/patterns/index.d.ts.map +1 -0
  274. package/dist/checks/quality/patterns/index.js +10 -0
  275. package/dist/checks/quality/patterns/index.js.map +1 -0
  276. package/dist/checks/quality/patterns/lifecycle-cleanup-enforcement.d.ts +16 -0
  277. package/dist/checks/quality/patterns/lifecycle-cleanup-enforcement.d.ts.map +1 -0
  278. package/dist/checks/quality/patterns/lifecycle-cleanup-enforcement.js +205 -0
  279. package/dist/checks/quality/patterns/lifecycle-cleanup-enforcement.js.map +1 -0
  280. package/dist/checks/quality/patterns/result-pattern-consistency.d.ts +16 -0
  281. package/dist/checks/quality/patterns/result-pattern-consistency.d.ts.map +1 -0
  282. package/dist/checks/quality/patterns/result-pattern-consistency.js +328 -0
  283. package/dist/checks/quality/patterns/result-pattern-consistency.js.map +1 -0
  284. package/dist/checks/quality/patterns/silent-early-returns.d.ts +23 -0
  285. package/dist/checks/quality/patterns/silent-early-returns.d.ts.map +1 -0
  286. package/dist/checks/quality/patterns/silent-early-returns.js +266 -0
  287. package/dist/checks/quality/patterns/silent-early-returns.js.map +1 -0
  288. package/dist/checks/quality/patterns/stream-buffer-size-limits.d.ts +13 -0
  289. package/dist/checks/quality/patterns/stream-buffer-size-limits.d.ts.map +1 -0
  290. package/dist/checks/quality/patterns/stream-buffer-size-limits.js +163 -0
  291. package/dist/checks/quality/patterns/stream-buffer-size-limits.js.map +1 -0
  292. package/dist/checks/quality/patterns/throws-documentation.d.ts +23 -0
  293. package/dist/checks/quality/patterns/throws-documentation.d.ts.map +1 -0
  294. package/dist/checks/quality/patterns/throws-documentation.js +519 -0
  295. package/dist/checks/quality/patterns/throws-documentation.js.map +1 -0
  296. package/dist/checks/quality/patterns/toctou-race-condition.d.ts +48 -0
  297. package/dist/checks/quality/patterns/toctou-race-condition.d.ts.map +1 -0
  298. package/dist/checks/quality/patterns/toctou-race-condition.js +639 -0
  299. package/dist/checks/quality/patterns/toctou-race-condition.js.map +1 -0
  300. package/dist/checks/quality/stubbed-implementation-detection.d.ts +24 -0
  301. package/dist/checks/quality/stubbed-implementation-detection.d.ts.map +1 -0
  302. package/dist/checks/quality/stubbed-implementation-detection.js +355 -0
  303. package/dist/checks/quality/stubbed-implementation-detection.js.map +1 -0
  304. package/dist/checks/quality/unused-config-options.d.ts +12 -0
  305. package/dist/checks/quality/unused-config-options.d.ts.map +1 -0
  306. package/dist/checks/quality/unused-config-options.js +245 -0
  307. package/dist/checks/quality/unused-config-options.js.map +1 -0
  308. package/dist/checks/resilience/__tests__/callback-invocation-safe.test.d.ts +2 -0
  309. package/dist/checks/resilience/__tests__/callback-invocation-safe.test.d.ts.map +1 -0
  310. package/dist/checks/resilience/__tests__/callback-invocation-safe.test.js +79 -0
  311. package/dist/checks/resilience/__tests__/callback-invocation-safe.test.js.map +1 -0
  312. package/dist/checks/resilience/__tests__/context-leakage-fp.test.d.ts +12 -0
  313. package/dist/checks/resilience/__tests__/context-leakage-fp.test.d.ts.map +1 -0
  314. package/dist/checks/resilience/__tests__/context-leakage-fp.test.js +34 -0
  315. package/dist/checks/resilience/__tests__/context-leakage-fp.test.js.map +1 -0
  316. package/dist/checks/resilience/__tests__/context-mutation.test.d.ts +11 -0
  317. package/dist/checks/resilience/__tests__/context-mutation.test.d.ts.map +1 -0
  318. package/dist/checks/resilience/__tests__/context-mutation.test.js +54 -0
  319. package/dist/checks/resilience/__tests__/context-mutation.test.js.map +1 -0
  320. package/dist/checks/resilience/callback-invocation-safe.d.ts +34 -0
  321. package/dist/checks/resilience/callback-invocation-safe.d.ts.map +1 -0
  322. package/dist/checks/resilience/callback-invocation-safe.js +247 -0
  323. package/dist/checks/resilience/callback-invocation-safe.js.map +1 -0
  324. package/dist/checks/resilience/context-leakage.d.ts +25 -0
  325. package/dist/checks/resilience/context-leakage.d.ts.map +1 -0
  326. package/dist/checks/resilience/context-leakage.js +435 -0
  327. package/dist/checks/resilience/context-leakage.js.map +1 -0
  328. package/dist/checks/resilience/context-mutation.d.ts +21 -0
  329. package/dist/checks/resilience/context-mutation.d.ts.map +1 -0
  330. package/dist/checks/resilience/context-mutation.js +368 -0
  331. package/dist/checks/resilience/context-mutation.js.map +1 -0
  332. package/dist/checks/resilience/detached-promises.d.ts +40 -0
  333. package/dist/checks/resilience/detached-promises.d.ts.map +1 -0
  334. package/dist/checks/resilience/detached-promises.js +646 -0
  335. package/dist/checks/resilience/detached-promises.js.map +1 -0
  336. package/dist/checks/resilience/index.d.ts +7 -0
  337. package/dist/checks/resilience/index.d.ts.map +1 -0
  338. package/dist/checks/resilience/index.js +7 -0
  339. package/dist/checks/resilience/index.js.map +1 -0
  340. package/dist/checks/resilience/no-raw-fetch.d.ts +11 -0
  341. package/dist/checks/resilience/no-raw-fetch.d.ts.map +1 -0
  342. package/dist/checks/resilience/no-raw-fetch.js +110 -0
  343. package/dist/checks/resilience/no-raw-fetch.js.map +1 -0
  344. package/dist/checks/resilience/no-unbounded-concurrency.d.ts +11 -0
  345. package/dist/checks/resilience/no-unbounded-concurrency.d.ts.map +1 -0
  346. package/dist/checks/resilience/no-unbounded-concurrency.js +117 -0
  347. package/dist/checks/resilience/no-unbounded-concurrency.js.map +1 -0
  348. package/dist/checks/security/__tests__/sql-injection.test.d.ts +17 -0
  349. package/dist/checks/security/__tests__/sql-injection.test.d.ts.map +1 -0
  350. package/dist/checks/security/__tests__/sql-injection.test.js +97 -0
  351. package/dist/checks/security/__tests__/sql-injection.test.js.map +1 -0
  352. package/dist/checks/security/index.d.ts +4 -0
  353. package/dist/checks/security/index.d.ts.map +1 -0
  354. package/dist/checks/security/index.js +4 -0
  355. package/dist/checks/security/index.js.map +1 -0
  356. package/dist/checks/security/input-sanitization.d.ts +20 -0
  357. package/dist/checks/security/input-sanitization.d.ts.map +1 -0
  358. package/dist/checks/security/input-sanitization.js +255 -0
  359. package/dist/checks/security/input-sanitization.js.map +1 -0
  360. package/dist/checks/security/sql-injection.d.ts +24 -0
  361. package/dist/checks/security/sql-injection.d.ts.map +1 -0
  362. package/dist/checks/security/sql-injection.js +330 -0
  363. package/dist/checks/security/sql-injection.js.map +1 -0
  364. package/dist/checks/security/unsafe-secret-comparison.d.ts +17 -0
  365. package/dist/checks/security/unsafe-secret-comparison.d.ts.map +1 -0
  366. package/dist/checks/security/unsafe-secret-comparison.js +227 -0
  367. package/dist/checks/security/unsafe-secret-comparison.js.map +1 -0
  368. package/dist/checks/testing/index.d.ts +2 -0
  369. package/dist/checks/testing/index.d.ts.map +1 -0
  370. package/dist/checks/testing/index.js +2 -0
  371. package/dist/checks/testing/index.js.map +1 -0
  372. package/dist/checks/testing/mock-implementations-in-production.d.ts +12 -0
  373. package/dist/checks/testing/mock-implementations-in-production.d.ts.map +1 -0
  374. package/dist/checks/testing/mock-implementations-in-production.js +211 -0
  375. package/dist/checks/testing/mock-implementations-in-production.js.map +1 -0
  376. package/dist/display/architecture.d.ts +9 -0
  377. package/dist/display/architecture.d.ts.map +1 -0
  378. package/dist/display/architecture.js +18 -0
  379. package/dist/display/architecture.js.map +1 -0
  380. package/dist/display/index.d.ts +20 -0
  381. package/dist/display/index.d.ts.map +1 -0
  382. package/dist/display/index.js +30 -0
  383. package/dist/display/index.js.map +1 -0
  384. package/dist/display/quality.d.ts +7 -0
  385. package/dist/display/quality.d.ts.map +1 -0
  386. package/dist/display/quality.js +39 -0
  387. package/dist/display/quality.js.map +1 -0
  388. package/dist/display/resilience.d.ts +7 -0
  389. package/dist/display/resilience.d.ts.map +1 -0
  390. package/dist/display/resilience.js +13 -0
  391. package/dist/display/resilience.js.map +1 -0
  392. package/dist/display/security-testing.d.ts +9 -0
  393. package/dist/display/security-testing.d.ts.map +1 -0
  394. package/dist/display/security-testing.js +14 -0
  395. package/dist/display/security-testing.js.map +1 -0
  396. package/dist/display/types.d.ts +6 -0
  397. package/dist/display/types.d.ts.map +1 -0
  398. package/dist/display/types.js +6 -0
  399. package/dist/display/types.js.map +1 -0
  400. package/dist/index.d.ts +19 -0
  401. package/dist/index.d.ts.map +1 -0
  402. package/dist/index.js +21 -0
  403. package/dist/index.js.map +1 -0
  404. package/package.json +55 -0
@@ -0,0 +1,159 @@
1
+ /**
2
+ * @fileoverview TypeScript Frontend Compiler Check
3
+ *
4
+ * Validates TypeScript compilation for frontend apps (apps/*). Runs
5
+ * `tsc --noEmit` in each discovered `apps/<name>/` that has a `tsconfig.json`,
6
+ * and reports the parsed compiler errors. Because it shells out to an external
7
+ * toolchain (one invocation per app, in that app's own directory so its
8
+ * `tsconfig.json` resolves correctly), it is modelled as `analysisMode:'command'`
9
+ * using the same `sh -c` orchestration idiom as `dependency-vulnerability-audit`.
10
+ */
11
+ import { join } from 'node:path';
12
+ import { defineCheck } from '@opensip-cli/fitness';
13
+ /**
14
+ * Shell program run from the project root (the command's cwd). For each
15
+ * `apps/<name>/` containing a `tsconfig.json` it emits an `::app::` marker, runs
16
+ * `tsc --noEmit` in that directory (merging stderr), then an `::exit::` marker
17
+ * carrying the per-app exit code. We always `exit 0` so the framework treats the
18
+ * run as successful and defers entirely to `parseOutput` (mirrors
19
+ * `dependency-vulnerability-audit`).
20
+ */
21
+ const TSC_PER_APP_PROGRAM = `
22
+ for d in apps/*/; do
23
+ [ -f "\${d}tsconfig.json" ] || continue
24
+ echo "::app::\${d}"
25
+ (cd "$d" && npx tsc --noEmit 2>&1)
26
+ echo "::exit::$?"
27
+ done
28
+ exit 0
29
+ `;
30
+ // Markers emitted by the shell program.
31
+ const APP_MARKER_PATTERN = /^::app::(.+)$/;
32
+ const EXIT_MARKER_PATTERN = /^::exit::(\d+)$/;
33
+ /**
34
+ * A single tsc diagnostic line: `file(line,col): error TSxxxx: message`.
35
+ * ReDoS-safe: `[^(]+` is bounded by the `(` delimiter, the numeric groups match
36
+ * digits only, and each group has a distinct fixed delimiter.
37
+ */
38
+ // eslint-disable-next-line sonarjs/slow-regex -- [^(]+ bounded by '(' delimiter; each group has distinct delimiters
39
+ const TS_ERROR_LINE_PATTERN = /^([^(]+)\((\d+),(\d+)\):\s*(error|warning)\s+(TS\d+):\s*(.+)$/;
40
+ /**
41
+ * Create a generic compilation failure violation (app failed to compile but no
42
+ * structured tsc diagnostics were parsed — e.g. a config error or crash).
43
+ */
44
+ function createGenericFailure(appPath, app) {
45
+ return {
46
+ filePath: appPath,
47
+ line: 1,
48
+ message: `App ${app} compilation failed`,
49
+ severity: 'error',
50
+ suggestion: `Run \`cd apps/${app} && npx tsc --noEmit\` to see the full error output`,
51
+ match: app,
52
+ };
53
+ }
54
+ /**
55
+ * Convert parsed TypeScript errors to violations (capped at 10 per app to avoid
56
+ * overwhelming output).
57
+ */
58
+ function errorsToViolations(appPath, errors) {
59
+ return errors.slice(0, 10).map((err) => ({
60
+ filePath: join(appPath, err.file),
61
+ line: err.line,
62
+ message: `${err.code}: ${err.message}`,
63
+ severity: 'error',
64
+ suggestion: `Fix the TypeScript error: ${err.message}. See https://typescript.tv/errors/#${err.code.toLowerCase()} for explanation`,
65
+ type: err.code,
66
+ match: err.code,
67
+ }));
68
+ }
69
+ /**
70
+ * Strip the `apps/` prefix and trailing slash to get the bare app name. The
71
+ * shell glob (`apps/<name>/`) yields exactly one trailing slash.
72
+ */
73
+ function appNameFromDir(appDir) {
74
+ return appDir.replace(/^apps\//, '').replace(/\/$/, '');
75
+ }
76
+ /**
77
+ * Parse the combined per-app tsc output into violations. Tracks the current app
78
+ * via `::app::` markers and finalizes it on the matching `::exit::` marker: a
79
+ * non-zero exit with parsed diagnostics yields those; a non-zero exit with no
80
+ * parseable diagnostics yields a single generic failure; a zero exit yields none.
81
+ */
82
+ export function parseTscOutput(stdout, cwd) {
83
+ const violations = [];
84
+ let currentApp = null;
85
+ let buffer = [];
86
+ const finalize = (appDir, exitCode) => {
87
+ if (exitCode !== 0) {
88
+ const appPath = join(cwd, appDir);
89
+ if (buffer.length > 0) {
90
+ violations.push(...errorsToViolations(appPath, buffer));
91
+ }
92
+ else {
93
+ violations.push(createGenericFailure(appPath, appNameFromDir(appDir)));
94
+ }
95
+ }
96
+ buffer = [];
97
+ };
98
+ for (const line of stdout.split('\n')) {
99
+ const appMatch = APP_MARKER_PATTERN.exec(line);
100
+ if (appMatch?.[1]) {
101
+ currentApp = appMatch[1];
102
+ buffer = [];
103
+ continue;
104
+ }
105
+ const exitMatch = EXIT_MARKER_PATTERN.exec(line);
106
+ if (exitMatch?.[1] && currentApp) {
107
+ finalize(currentApp, Number.parseInt(exitMatch[1], 10));
108
+ currentApp = null;
109
+ continue;
110
+ }
111
+ if (!currentApp)
112
+ continue;
113
+ const errMatch = TS_ERROR_LINE_PATTERN.exec(line);
114
+ if (errMatch) {
115
+ buffer.push({
116
+ file: errMatch[1] ?? '',
117
+ // @fitness-ignore-next-line numeric-validation -- regex (\d+) guarantees digits only
118
+ line: Number.parseInt(errMatch[2] ?? '0', 10),
119
+ code: errMatch[5] ?? '',
120
+ message: errMatch[6] ?? '',
121
+ });
122
+ }
123
+ }
124
+ return violations;
125
+ }
126
+ /**
127
+ * Check: quality/typescript-frontend
128
+ *
129
+ * Runs the TypeScript compiler for each frontend app under `apps/*`.
130
+ */
131
+ export const typescriptFrontend = defineCheck({
132
+ id: 'a32ab706-f817-404c-835f-da79f64505c7',
133
+ slug: 'typescript-frontend',
134
+ scope: { languages: ['typescript', 'tsx'], concerns: ['frontend', 'ui'] },
135
+ confidence: 'medium',
136
+ description: 'Validates TypeScript compilation for frontend apps',
137
+ longDescription: `**Purpose:** Validates that all frontend apps compile cleanly with the TypeScript compiler, running \`tsc --noEmit\` in each app directory that contains a \`tsconfig.json\`.
138
+
139
+ **Detects:**
140
+ - TypeScript compilation errors parsed from \`tsc --noEmit\` output using the pattern \`file(line,col): error TSxxxx: message\`
141
+ - Per-app compilation failures across all apps discovered in the \`apps/\` directory
142
+ - Reports up to 10 errors per app to avoid overwhelming output
143
+
144
+ **Why it matters:** Frontend apps have their own \`tsconfig.json\` settings and dependencies. Compiling each app independently catches type errors specific to that app's configuration and imported modules.
145
+
146
+ **Scope:** External toolchain check (\`analysisMode:'command'\`). Runs \`tsc --noEmit\` in each discovered \`apps/*\` directory from the project root. General best practice.`,
147
+ tags: ['quality', 'type-safety', 'code-quality'],
148
+ fileTypes: ['ts', 'tsx'],
149
+ command: {
150
+ bin: 'sh',
151
+ args: ['-c', TSC_PER_APP_PROGRAM],
152
+ // The shell program always exits 0; per-app status is carried inline.
153
+ expectedExitCodes: [0],
154
+ parseOutput(stdout, _stderr, _exitCode, _files, cwd) {
155
+ return parseTscOutput(stdout, cwd);
156
+ },
157
+ },
158
+ });
159
+ //# sourceMappingURL=typescript-frontend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript-frontend.js","sourceRoot":"","sources":["../../../../src/checks/quality/linting/typescript-frontend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAuB,MAAM,sBAAsB,CAAC;AAExE;;;;;;;GAOG;AACH,MAAM,mBAAmB,GAAG;;;;;;;;CAQ3B,CAAC;AAEF,wCAAwC;AACxC,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAC3C,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAC9C;;;;GAIG;AACH,oHAAoH;AACpH,MAAM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-logs.js';
4
+ export * from './observability-coverage/index.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/checks/quality/observability/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './logger-event-name-format.js';
2
+ export * from './no-hardcoded-correlation-id.js';
3
+ export * from './pii-exposure-in-logs.js';
4
+ export * from './observability-coverage/index.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/checks/quality/observability/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @fileoverview Validates logger event names follow the 3+ dot-separated segment convention
3
+ */
4
+ /**
5
+ * Check: quality/logger-event-name-format
6
+ *
7
+ * Validates that all logger evt field values follow the required
8
+ * domain.component.action format with a minimum of 3 dot-separated segments.
9
+ * Unlike logging-standards, this check has NO path exemptions.
10
+ */
11
+ export declare const loggerEventNameFormat: import("@opensip-cli/fitness").Check;
12
+ //# sourceMappingURL=logger-event-name-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger-event-name-format.d.ts","sourceRoot":"","sources":["../../../../src/checks/quality/observability/logger-event-name-format.ts"],"names":[],"mappings":"AACA;;GAEG;AA+FH;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,sCAoChC,CAAC"}
@@ -0,0 +1,124 @@
1
+ // @fitness-ignore-file project-readme-existence -- internal module, not a package root
2
+ /**
3
+ * @fileoverview Validates logger event names follow the 3+ dot-separated segment convention
4
+ */
5
+ import { defineCheck, isInsideStringLiteral, isTestFile, } from '@opensip-cli/fitness';
6
+ import { countUnescapedBackticks } from '@opensip-cli/lang-typescript';
7
+ /**
8
+ * Validates evt format: domain.component.action (3+ segments in lowercase with underscores)
9
+ * Also allows hyphens in segments (e.g., 'tickets.service.create-many')
10
+ */
11
+ const EVT_FORMAT_PATTERN = /^[a-z0-9_-]{1,50}\.[a-z0-9_-]{1,50}\.[a-z0-9_.-]{1,100}$/;
12
+ /**
13
+ * Extracts evt field value from a line — only matches single/double quoted strings, NOT template literals.
14
+ * Template literals with interpolation (e.g., `${prefix}.action.start`) resolve at runtime
15
+ * and cannot be statically validated.
16
+ */
17
+ const EVT_FIELD_PATTERN = /evt\s{0,5}:\s{0,5}['"]([^'"]{1,200})['"]/;
18
+ /**
19
+ * Patterns that indicate event constant usage (can't statically validate)
20
+ */
21
+ const EVENT_CONSTANT_PATTERNS = [
22
+ /evt\s*:\s*EVENT_NAMES\./,
23
+ /evt\s*:\s*EVENTS\./,
24
+ /evt\s*:\s*LogEvents\./,
25
+ /evt\s*:\s*LOG_EVENTS\./,
26
+ /evt\s*:\s*[A-Z_]+_EVENTS\./,
27
+ ];
28
+ function shouldSkipLine(line, inTemplateLiteral, backtickCount) {
29
+ /* v8 ignore next -- defensive AST/type guard */
30
+ if (inTemplateLiteral && backtickCount % 2 === 0)
31
+ return true;
32
+ const trimmed = line.trim();
33
+ /* v8 ignore next -- defensive AST/type guard */
34
+ if (trimmed.startsWith('//') || trimmed.startsWith('*'))
35
+ return true;
36
+ if (EVENT_CONSTANT_PATTERNS.some((p) => p.test(line)))
37
+ return true;
38
+ return false;
39
+ }
40
+ function isEvtPropertyContext(line, matchIndex) {
41
+ /* v8 ignore next -- defensive non-negative guard */
42
+ const beforeEvt = line.slice(0, Math.max(0, matchIndex)).trim();
43
+ return beforeEvt.length === 0 || /^[{,]$/.test(beforeEvt);
44
+ }
45
+ function createEvtViolation(evtValue, evtMatch, lineNum, filePath) {
46
+ const segmentCount = evtValue.split('.').length;
47
+ return {
48
+ line: lineNum,
49
+ column: evtMatch.index,
50
+ message: `Logger evt '${evtValue}' has ${segmentCount} segment(s) — minimum 3 required (domain.component.action)`,
51
+ severity: 'error',
52
+ suggestion: `Change to a 3+ segment format, e.g., '${evtValue}.start' or restructure as 'domain.component.action'`,
53
+ match: evtMatch[0],
54
+ type: 'invalid-evt-segments',
55
+ filePath,
56
+ };
57
+ }
58
+ function analyzeEvtNames(content, filePath) {
59
+ const violations = [];
60
+ const lines = content.split('\n');
61
+ let inTemplateLiteral = false;
62
+ for (const [i, line] of lines.entries()) {
63
+ /* v8 ignore next -- defensive guard */
64
+ if (!line)
65
+ continue;
66
+ const backtickCount = countUnescapedBackticks(line);
67
+ if (backtickCount % 2 === 1)
68
+ inTemplateLiteral = !inTemplateLiteral;
69
+ if (shouldSkipLine(line, inTemplateLiteral, backtickCount))
70
+ continue;
71
+ const evtMatch = EVT_FIELD_PATTERN.exec(line);
72
+ if (!evtMatch?.[1])
73
+ continue;
74
+ if (isInsideStringLiteral(line, evtMatch.index))
75
+ continue;
76
+ if (!isEvtPropertyContext(line, evtMatch.index))
77
+ continue;
78
+ if (!EVT_FORMAT_PATTERN.test(evtMatch[1])) {
79
+ violations.push(createEvtViolation(evtMatch[1], evtMatch, i + 1, filePath));
80
+ }
81
+ }
82
+ return violations;
83
+ }
84
+ /**
85
+ * Check: quality/logger-event-name-format
86
+ *
87
+ * Validates that all logger evt field values follow the required
88
+ * domain.component.action format with a minimum of 3 dot-separated segments.
89
+ * Unlike logging-standards, this check has NO path exemptions.
90
+ */
91
+ export const loggerEventNameFormat = defineCheck({
92
+ id: '880c2472-9dd2-47c1-a1b8-03f06407a9ed',
93
+ slug: 'logger-event-name-format',
94
+ scope: { languages: ['typescript'], concerns: ['backend', 'frontend', 'cli'] },
95
+ contentFilter: 'raw',
96
+ confidence: 'medium',
97
+ description: 'Validate logger evt fields have 3+ dot-separated segments',
98
+ longDescription: `**Purpose:** Enforces the project convention that all logger event names (\`evt\` field) must have at least 3 dot-separated segments following the \`domain.component.action[.status]\` pattern.
99
+
100
+ **Detects:**
101
+ - \`evt\` field string values with fewer than 3 dot-separated segments (e.g., \`evt: 'cli.sync'\` should be \`evt: 'cli.sync.start'\`)
102
+ - \`evt\` values with invalid characters (must be lowercase alphanumeric with underscores/hyphens)
103
+ - Skips template literal evt values (runtime interpolation cannot be statically validated)
104
+ - Skips event constant references (\`EVENT_NAMES.foo\`) since those are validated at definition
105
+ - Skips evt fields inside string literals (suggestion/description text containing example code)
106
+
107
+ **Why it matters:** Consistent event naming enables log filtering, dashboard creation, and alert configuration. Two-segment names are ambiguous and break the \`domain.component.action\` hierarchy.
108
+
109
+ **Scope:** Codebase-specific convention. Analyzes every file with NO path exemptions — all code must follow the same evt naming rules.`,
110
+ tags: ['quality', 'observability', 'logging', 'conventions'],
111
+ fileTypes: ['ts'],
112
+ analyze(content, filePath) {
113
+ // Skip test files
114
+ if (isTestFile(filePath)) {
115
+ return [];
116
+ }
117
+ // Quick check: must have both logger and evt
118
+ if (!content.includes('logger.') || !content.includes('evt')) {
119
+ return [];
120
+ }
121
+ return analyzeEvtNames(content, filePath);
122
+ },
123
+ });
124
+ //# sourceMappingURL=logger-event-name-format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger-event-name-format.js","sourceRoot":"","sources":["../../../../src/checks/quality/observability/logger-event-name-format.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF;;GAEG;AAEH,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,UAAU,GAEX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE;;;GAGG;AACH,MAAM,kBAAkB,GAAG,0DAA0D,CAAC;AAEtF;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,0CAA0C,CAAC;AAErE;;GAEG;AACH,MAAM,uBAAuB,GAAG;IAC9B,yBAAyB;IACzB,oBAAoB;IACpB,uBAAuB;IACvB,wB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AG,WAAW,CAAC;IAC/C,EAAE,EAAE,sCAAsC;IAC1C,IAAI,EAAE,0BAA0B;IAChC,KAAK,EAAE,EAAE,SAAS,EAAE,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE;IAC9E,aAAa,EAAE,KAAK;IAEpB,UAAU,EAAE,QAAQ;IACpB,WAAW,EAAE,2DAA2D;IACxE,eAAe,EAAE;;;;;;;;;;;uIAWoH;IACrI,IAAI,EAAE,CAAC,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,CAAC;IAC5D,SAAS,EAAE,CAAC,IAAI,CAAC;IAEjB,OAAO,CAAC,OAAe,EAAE,QAAgB;QACvC,kBAAkB;QAClB,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,6CAA6C;QAC7C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7D,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC5C,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @fileoverview Detects hardcoded correlation ID values
3
+ */
4
+ export declare const noHardcodedCorrelationId: import("@opensip-cli/fitness").Check;
5
+ //# sourceMappingURL=no-hardcoded-correlation-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-hardcoded-correlation-id.d.ts","sourceRoot":"","sources":["../../../../src/checks/quality/observability/no-hardcoded-correlation-id.ts"],"names":[],"mappings":"AACA;;GAEG;AAgDH,eAAO,MAAM,wBAAwB,sCAiCnC,CAAC"}
@@ -0,0 +1,77 @@
1
+ // @fitness-ignore-file project-readme-existence -- internal module, not a package root
2
+ /**
3
+ * @fileoverview Detects hardcoded correlation ID values
4
+ */
5
+ import { defineCheck, isTestFile } from '@opensip-cli/fitness';
6
+ import { countUnescapedBackticks } from '@opensip-cli/lang-typescript';
7
+ /**
8
+ * Pattern for detecting hardcoded correlationId string literal assignments.
9
+ * Matches: correlationId: 'something' or correlationId: "something"
10
+ * Only matches single/double quotes, not backtick template literals.
11
+ */
12
+ const HARDCODED_CORR_ID_PATTERN = /correlationId\s{0,5}:\s{0,5}['"]([a-zA-Z0-9_-]{1,100})['"]/g;
13
+ function findHardcodedCorrelationIds(content, filePath) {
14
+ const violations = [];
15
+ const lines = content.split('\n');
16
+ let inTemplateLiteral = false;
17
+ for (const [i, line] of lines.entries()) {
18
+ /* v8 ignore next -- defensive guard */
19
+ if (!line)
20
+ continue;
21
+ const backtickCount = countUnescapedBackticks(line);
22
+ if (backtickCount % 2 === 1)
23
+ inTemplateLiteral = !inTemplateLiteral;
24
+ if (inTemplateLiteral && backtickCount % 2 === 0)
25
+ continue;
26
+ const trimmed = line.trim();
27
+ if (trimmed.startsWith('//') || trimmed.startsWith('*'))
28
+ continue;
29
+ HARDCODED_CORR_ID_PATTERN.lastIndex = 0;
30
+ let match;
31
+ while ((match = HARDCODED_CORR_ID_PATTERN.exec(line)) !== null) {
32
+ violations.push({
33
+ line: i + 1,
34
+ column: match.index,
35
+ message: `Hardcoded correlationId '${match[1]}' — use generateCorrelationId() instead`,
36
+ severity: 'warning',
37
+ suggestion: 'Use a correlation ID generator function (e.g., uuid or nanoid) to create unique IDs for each operation',
38
+ match: match[0],
39
+ type: 'hardcoded-correlation-id',
40
+ filePath,
41
+ });
42
+ }
43
+ }
44
+ return violations;
45
+ }
46
+ export const noHardcodedCorrelationId = defineCheck({
47
+ id: 'de7e8777-2979-4ea5-97b7-8fbcc37bdfef',
48
+ slug: 'no-hardcoded-correlation-id',
49
+ scope: { languages: ['typescript'], concerns: ['backend', 'frontend', 'cli'] },
50
+ contentFilter: 'raw',
51
+ confidence: 'medium',
52
+ description: 'Detect hardcoded correlation ID string literals',
53
+ longDescription: `**Purpose:** Ensures correlation IDs are generated dynamically using the canonical \`generateCorrelationId()\` function instead of hardcoded string literals.
54
+
55
+ **Detects:**
56
+ - \`correlationId: 'literal-string'\` patterns where a static string is used instead of a generated ID
57
+ - Skips test files (hardcoded IDs in tests are expected)
58
+
59
+ **Why it matters:** Hardcoded correlation IDs make request tracing impossible — every operation would share the same ID, defeating the purpose of correlation-based observability.
60
+
61
+ **Scope:** Codebase-specific convention. Analyzes each file individually via regex.`,
62
+ tags: ['quality', 'observability', 'correlation', 'tracing'],
63
+ fileTypes: ['ts'],
64
+ analyze(content, filePath) {
65
+ if (isTestFile(filePath)) {
66
+ return [];
67
+ }
68
+ if (filePath.includes('/fitness/src/checks/')) {
69
+ return [];
70
+ }
71
+ if (!content.includes('correlationId')) {
72
+ return [];
73
+ }
74
+ return findHardcodedCorrelationIds(content, filePath);
75
+ },
76
+ });
77
+ //# sourceMappingURL=no-hardcoded-correlation-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-hardcoded-correlation-id.js","sourceRoot":"","sources":["../../../../src/checks/quality/observability/no-hardcoded-correlation-id.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAuB,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE;;;;GAIG;AACH,MAAM,yBAAyB,GAAG,6DAA6D,CAAC;AAEhG,SAAS,2BAA2B,CAAC,OAAe,EAAE,QAAgB;IACpE,MAAM,UAAU,GAAqB,EAAE,CAAC;IACxC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,iBAAiB,GAAG,KAAK,CAAC;IAE9B,KAAK,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;QACxC,uCAAuC;QACvC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AE,iDAAiD;IAC9D,eAAe,EAAE;;;;;;;;oFAQiE;IAClF,IAAI,EAAE,CAAC,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,CAAC;IAC5D,SAAS,EAAE,CAAC,IAAI,CAAC;IAEjB,OAAO,CAAC,OAAe,EAAE,QAAgB;QACvC,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,IAAI,QAAQ,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,CAAC;YAC9C,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;YACvC,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,2BAA2B,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACxD,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @fileoverview Direct unit tests for the observability-coverage analyzer
3
+ * helper module.
4
+ *
5
+ * Exercises the AST function extraction across function-like declarations
6
+ * (function/method/arrow/constructor/expressions), accessor skipping, the
7
+ * try/catch detector, async modifier detection, and named-vs-anonymous
8
+ * resolution.
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=analyzer.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyzer.test.d.ts","sourceRoot":"","sources":["../../../../../../src/checks/quality/observability/observability-coverage/__tests__/analyzer.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * @fileoverview Direct unit tests for the observability-coverage analyzer
3
+ * helper module.
4
+ *
5
+ * Exercises the AST function extraction across function-like declarations
6
+ * (function/method/arrow/constructor/expressions), accessor skipping, the
7
+ * try/catch detector, async modifier detection, and named-vs-anonymous
8
+ * resolution.
9
+ */
10
+ import { describe, expect, it } from 'vitest';
11
+ import { extractFunctions } from '../analyzer.js';
12
+ describe('observability-coverage analyzer — extractFunctions', () => {
13
+ it('returns an empty array when the source cannot be parsed', () => {
14
+ // getSharedSourceFile returns undefined for unsupported extensions.
15
+ // We force that path by passing a non-TS path; for safety we also pass
16
+ // empty content so any fallback returns nothing.
17
+ expect(extractFunctions('export const x = 1', 'test.ts')).toEqual([]);
18
+ });
19
+ it('extracts a top-level FunctionDeclaration with body', () => {
20
+ const src = `
21
+ export function add(a: number, b: number): number {
22
+ return a + b
23
+ }
24
+ `;
25
+ const fns = extractFunctions(src, 'add.ts');
26
+ expect(fns).toHaveLength(1);
27
+ expect(fns[0]?.name).toBe('add');
28
+ expect(fns[0]?.isAsync).toBe(false);
29
+ expect(fns[0]?.hasTryCatch).toBe(false);
30
+ });
31
+ it('marks async functions and detects try/catch in the body', () => {
32
+ const src = `
33
+ export async function fetchUser(id: string) {
34
+ try {
35
+ return await fetch('/api/user/' + id)
36
+ } catch (e) {
37
+ throw e
38
+ }
39
+ }
40
+ `;
41
+ const fns = extractFunctions(src, 'fetch.ts');
42
+ expect(fns).toHaveLength(1);
43
+ expect(fns[0]?.name).toBe('fetchUser');
44
+ expect(fns[0]?.isAsync).toBe(true);
45
+ expect(fns[0]?.hasTryCatch).toBe(true);
46
+ });
47
+ it('extracts arrow functions assigned to a variable using the variable name', () => {
48
+ const src = `
49
+ const greet = (name: string) => 'Hello ' + name
50
+ `;
51
+ const fns = extractFunctions(src, 'arrow.ts');
52
+ expect(fns.find((f) => f.name === 'greet')).toBeDefined();
53
+ });
54
+ it('uses property name for function expressions assigned in object literals', () => {
55
+ const src = `
56
+ export const handlers = {
57
+ onClick: function () { return 1 },
58
+ onHover: function namedHover() { return 2 },
59
+ }
60
+ `;
61
+ const fns = extractFunctions(src, 'handlers.ts');
62
+ const names = fns.map((f) => f.name);
63
+ expect(names).toContain('onClick');
64
+ // Named function expressions resolve via the property assignment path
65
+ // before falling through to node.name resolution.
66
+ expect(names).toContain('onHover');
67
+ });
68
+ it('falls back to <anonymous> for unnamed/IIFE function expressions', () => {
69
+ const src = `
70
+ const result = (function () { return 42 })()
71
+ `;
72
+ const fns = extractFunctions(src, 'iife.ts');
73
+ expect(fns.some((f) => f.name === '<anonymous>')).toBe(true);
74
+ });
75
+ it('extracts methods, constructors, and skips getters/setters', () => {
76
+ const src = `
77
+ export class UserService {
78
+ constructor(private readonly db: { query: (sql: string) => unknown }) {}
79
+ async findById(id: string) { return this.db.query('SELECT 1') }
80
+ get name() { return 'service' }
81
+ set name(_: string) { /* noop */ }
82
+ }
83
+ `;
84
+ const fns = extractFunctions(src, 'class.ts');
85
+ const names = fns.map((f) => f.name);
86
+ expect(names).toContain('constructor');
87
+ expect(names).toContain('findById');
88
+ // Accessors are skipped explicitly
89
+ expect(names).not.toContain('name');
90
+ });
91
+ it('skips abstract methods and overload signatures (no body)', () => {
92
+ const src = `
93
+ export abstract class Base {
94
+ abstract run(): void
95
+ }
96
+ export function overload(x: number): number
97
+ export function overload(x: string): string
98
+ export function overload(x: number | string) { return x }
99
+ `;
100
+ const fns = extractFunctions(src, 'overload.ts');
101
+ // Overload signatures lack bodies — only the implementation should be
102
+ // extracted.
103
+ const overloads = fns.filter((f) => f.name === 'overload');
104
+ expect(overloads).toHaveLength(1);
105
+ });
106
+ });
107
+ //# sourceMappingURL=analyzer.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyzer.test.js","sourceRoot":"","sources":["../../../../../../src/checks/quality/observability/observability-coverage/__tests__/analyzer.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,QAAQ,CAAC,oDAAoD,EAAE,GAAG,EAAE;IAClE,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;QACjE,oEAAoE;QACpE,uEAAuE;QACvE,iDAAiD;QACjD,MAAM,CAAC,gBAAg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C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QACvC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACpC,mCAAmC;QACnC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAClE,MAAM,GAAG,GAAG;;;;;;;KAOX,CAAC;QACF,MAAM,GAAG,GAAG,gBAAgB,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;QACjD,sEAAsE;QACtE,aAAa;QACb,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;QAC3D,MAAM,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @fileoverview Direct unit tests for the observability-coverage logger
3
+ * detector helper module.
4
+ *
5
+ * Exercises:
6
+ * - logger.* / this.logger.* / direct logToFitnessFile/logToCLIFile detection
7
+ * - line-range filtering (out-of-range calls are excluded)
8
+ * - non-logger property access calls (e.g., db.info) are ignored
9
+ * - fileImportsLogger over import-path patterns and direct identifiers
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=logger-detector.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger-detector.test.d.ts","sourceRoot":"","sources":["../../../../../../src/checks/quality/observability/observability-coverage/__tests__/logger-detector.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}