@dotsetlabs/bellwether 0.10.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 (403) hide show
  1. package/CHANGELOG.md +291 -0
  2. package/LICENSE +21 -0
  3. package/README.md +739 -0
  4. package/dist/auth/credentials.d.ts +64 -0
  5. package/dist/auth/credentials.js +218 -0
  6. package/dist/auth/index.d.ts +6 -0
  7. package/dist/auth/index.js +6 -0
  8. package/dist/auth/keychain.d.ts +64 -0
  9. package/dist/auth/keychain.js +268 -0
  10. package/dist/baseline/ab-testing.d.ts +80 -0
  11. package/dist/baseline/ab-testing.js +236 -0
  12. package/dist/baseline/ai-compatibility-scorer.d.ts +95 -0
  13. package/dist/baseline/ai-compatibility-scorer.js +606 -0
  14. package/dist/baseline/calibration.d.ts +77 -0
  15. package/dist/baseline/calibration.js +136 -0
  16. package/dist/baseline/category-matching.d.ts +85 -0
  17. package/dist/baseline/category-matching.js +289 -0
  18. package/dist/baseline/change-impact-analyzer.d.ts +98 -0
  19. package/dist/baseline/change-impact-analyzer.js +592 -0
  20. package/dist/baseline/comparator.d.ts +64 -0
  21. package/dist/baseline/comparator.js +916 -0
  22. package/dist/baseline/confidence.d.ts +55 -0
  23. package/dist/baseline/confidence.js +122 -0
  24. package/dist/baseline/converter.d.ts +61 -0
  25. package/dist/baseline/converter.js +585 -0
  26. package/dist/baseline/dependency-analyzer.d.ts +89 -0
  27. package/dist/baseline/dependency-analyzer.js +567 -0
  28. package/dist/baseline/deprecation-tracker.d.ts +133 -0
  29. package/dist/baseline/deprecation-tracker.js +322 -0
  30. package/dist/baseline/diff.d.ts +55 -0
  31. package/dist/baseline/diff.js +1584 -0
  32. package/dist/baseline/documentation-scorer.d.ts +205 -0
  33. package/dist/baseline/documentation-scorer.js +466 -0
  34. package/dist/baseline/embeddings.d.ts +118 -0
  35. package/dist/baseline/embeddings.js +251 -0
  36. package/dist/baseline/error-analyzer.d.ts +198 -0
  37. package/dist/baseline/error-analyzer.js +721 -0
  38. package/dist/baseline/evaluation/evaluator.d.ts +42 -0
  39. package/dist/baseline/evaluation/evaluator.js +323 -0
  40. package/dist/baseline/evaluation/expanded-dataset.d.ts +45 -0
  41. package/dist/baseline/evaluation/expanded-dataset.js +1164 -0
  42. package/dist/baseline/evaluation/golden-dataset.d.ts +58 -0
  43. package/dist/baseline/evaluation/golden-dataset.js +717 -0
  44. package/dist/baseline/evaluation/index.d.ts +15 -0
  45. package/dist/baseline/evaluation/index.js +15 -0
  46. package/dist/baseline/evaluation/types.d.ts +186 -0
  47. package/dist/baseline/evaluation/types.js +8 -0
  48. package/dist/baseline/external-dependency-detector.d.ts +181 -0
  49. package/dist/baseline/external-dependency-detector.js +524 -0
  50. package/dist/baseline/golden-output.d.ts +162 -0
  51. package/dist/baseline/golden-output.js +636 -0
  52. package/dist/baseline/health-scorer.d.ts +174 -0
  53. package/dist/baseline/health-scorer.js +451 -0
  54. package/dist/baseline/incremental-checker.d.ts +97 -0
  55. package/dist/baseline/incremental-checker.js +174 -0
  56. package/dist/baseline/index.d.ts +31 -0
  57. package/dist/baseline/index.js +42 -0
  58. package/dist/baseline/migration-generator.d.ts +137 -0
  59. package/dist/baseline/migration-generator.js +554 -0
  60. package/dist/baseline/migrations.d.ts +60 -0
  61. package/dist/baseline/migrations.js +197 -0
  62. package/dist/baseline/performance-tracker.d.ts +214 -0
  63. package/dist/baseline/performance-tracker.js +577 -0
  64. package/dist/baseline/pr-comment-generator.d.ts +117 -0
  65. package/dist/baseline/pr-comment-generator.js +546 -0
  66. package/dist/baseline/response-fingerprint.d.ts +127 -0
  67. package/dist/baseline/response-fingerprint.js +728 -0
  68. package/dist/baseline/response-schema-tracker.d.ts +129 -0
  69. package/dist/baseline/response-schema-tracker.js +420 -0
  70. package/dist/baseline/risk-scorer.d.ts +54 -0
  71. package/dist/baseline/risk-scorer.js +434 -0
  72. package/dist/baseline/saver.d.ts +89 -0
  73. package/dist/baseline/saver.js +554 -0
  74. package/dist/baseline/scenario-generator.d.ts +151 -0
  75. package/dist/baseline/scenario-generator.js +905 -0
  76. package/dist/baseline/schema-compare.d.ts +86 -0
  77. package/dist/baseline/schema-compare.js +557 -0
  78. package/dist/baseline/schema-evolution.d.ts +189 -0
  79. package/dist/baseline/schema-evolution.js +467 -0
  80. package/dist/baseline/semantic.d.ts +203 -0
  81. package/dist/baseline/semantic.js +908 -0
  82. package/dist/baseline/synonyms.d.ts +60 -0
  83. package/dist/baseline/synonyms.js +386 -0
  84. package/dist/baseline/telemetry.d.ts +165 -0
  85. package/dist/baseline/telemetry.js +294 -0
  86. package/dist/baseline/test-pruner.d.ts +120 -0
  87. package/dist/baseline/test-pruner.js +387 -0
  88. package/dist/baseline/types.d.ts +449 -0
  89. package/dist/baseline/types.js +5 -0
  90. package/dist/baseline/version.d.ts +138 -0
  91. package/dist/baseline/version.js +206 -0
  92. package/dist/cache/index.d.ts +5 -0
  93. package/dist/cache/index.js +5 -0
  94. package/dist/cache/response-cache.d.ts +151 -0
  95. package/dist/cache/response-cache.js +287 -0
  96. package/dist/ci/index.d.ts +60 -0
  97. package/dist/ci/index.js +342 -0
  98. package/dist/cli/commands/auth.d.ts +12 -0
  99. package/dist/cli/commands/auth.js +352 -0
  100. package/dist/cli/commands/badge.d.ts +3 -0
  101. package/dist/cli/commands/badge.js +74 -0
  102. package/dist/cli/commands/baseline-accept.d.ts +15 -0
  103. package/dist/cli/commands/baseline-accept.js +178 -0
  104. package/dist/cli/commands/baseline-migrate.d.ts +12 -0
  105. package/dist/cli/commands/baseline-migrate.js +164 -0
  106. package/dist/cli/commands/baseline.d.ts +14 -0
  107. package/dist/cli/commands/baseline.js +449 -0
  108. package/dist/cli/commands/beta.d.ts +10 -0
  109. package/dist/cli/commands/beta.js +231 -0
  110. package/dist/cli/commands/check.d.ts +11 -0
  111. package/dist/cli/commands/check.js +820 -0
  112. package/dist/cli/commands/cloud/badge.d.ts +3 -0
  113. package/dist/cli/commands/cloud/badge.js +74 -0
  114. package/dist/cli/commands/cloud/diff.d.ts +6 -0
  115. package/dist/cli/commands/cloud/diff.js +79 -0
  116. package/dist/cli/commands/cloud/history.d.ts +6 -0
  117. package/dist/cli/commands/cloud/history.js +102 -0
  118. package/dist/cli/commands/cloud/link.d.ts +9 -0
  119. package/dist/cli/commands/cloud/link.js +119 -0
  120. package/dist/cli/commands/cloud/login.d.ts +7 -0
  121. package/dist/cli/commands/cloud/login.js +499 -0
  122. package/dist/cli/commands/cloud/projects.d.ts +6 -0
  123. package/dist/cli/commands/cloud/projects.js +44 -0
  124. package/dist/cli/commands/cloud/shared.d.ts +7 -0
  125. package/dist/cli/commands/cloud/shared.js +42 -0
  126. package/dist/cli/commands/cloud/teams.d.ts +8 -0
  127. package/dist/cli/commands/cloud/teams.js +169 -0
  128. package/dist/cli/commands/cloud/upload.d.ts +8 -0
  129. package/dist/cli/commands/cloud/upload.js +181 -0
  130. package/dist/cli/commands/contract.d.ts +11 -0
  131. package/dist/cli/commands/contract.js +280 -0
  132. package/dist/cli/commands/discover.d.ts +3 -0
  133. package/dist/cli/commands/discover.js +82 -0
  134. package/dist/cli/commands/eval.d.ts +9 -0
  135. package/dist/cli/commands/eval.js +187 -0
  136. package/dist/cli/commands/explore.d.ts +11 -0
  137. package/dist/cli/commands/explore.js +437 -0
  138. package/dist/cli/commands/feedback.d.ts +9 -0
  139. package/dist/cli/commands/feedback.js +174 -0
  140. package/dist/cli/commands/golden.d.ts +12 -0
  141. package/dist/cli/commands/golden.js +407 -0
  142. package/dist/cli/commands/history.d.ts +10 -0
  143. package/dist/cli/commands/history.js +202 -0
  144. package/dist/cli/commands/init.d.ts +9 -0
  145. package/dist/cli/commands/init.js +219 -0
  146. package/dist/cli/commands/interview.d.ts +3 -0
  147. package/dist/cli/commands/interview.js +903 -0
  148. package/dist/cli/commands/link.d.ts +10 -0
  149. package/dist/cli/commands/link.js +169 -0
  150. package/dist/cli/commands/login.d.ts +7 -0
  151. package/dist/cli/commands/login.js +499 -0
  152. package/dist/cli/commands/preset.d.ts +33 -0
  153. package/dist/cli/commands/preset.js +297 -0
  154. package/dist/cli/commands/profile.d.ts +33 -0
  155. package/dist/cli/commands/profile.js +286 -0
  156. package/dist/cli/commands/registry.d.ts +11 -0
  157. package/dist/cli/commands/registry.js +146 -0
  158. package/dist/cli/commands/shared.d.ts +79 -0
  159. package/dist/cli/commands/shared.js +196 -0
  160. package/dist/cli/commands/teams.d.ts +8 -0
  161. package/dist/cli/commands/teams.js +169 -0
  162. package/dist/cli/commands/test.d.ts +9 -0
  163. package/dist/cli/commands/test.js +500 -0
  164. package/dist/cli/commands/upload.d.ts +8 -0
  165. package/dist/cli/commands/upload.js +223 -0
  166. package/dist/cli/commands/validate-config.d.ts +6 -0
  167. package/dist/cli/commands/validate-config.js +35 -0
  168. package/dist/cli/commands/verify.d.ts +11 -0
  169. package/dist/cli/commands/verify.js +283 -0
  170. package/dist/cli/commands/watch.d.ts +12 -0
  171. package/dist/cli/commands/watch.js +253 -0
  172. package/dist/cli/index.d.ts +3 -0
  173. package/dist/cli/index.js +178 -0
  174. package/dist/cli/interactive.d.ts +47 -0
  175. package/dist/cli/interactive.js +216 -0
  176. package/dist/cli/output/terminal-reporter.d.ts +19 -0
  177. package/dist/cli/output/terminal-reporter.js +104 -0
  178. package/dist/cli/output.d.ts +226 -0
  179. package/dist/cli/output.js +438 -0
  180. package/dist/cli/utils/env.d.ts +5 -0
  181. package/dist/cli/utils/env.js +14 -0
  182. package/dist/cli/utils/progress.d.ts +59 -0
  183. package/dist/cli/utils/progress.js +206 -0
  184. package/dist/cli/utils/server-context.d.ts +10 -0
  185. package/dist/cli/utils/server-context.js +36 -0
  186. package/dist/cloud/auth.d.ts +144 -0
  187. package/dist/cloud/auth.js +374 -0
  188. package/dist/cloud/client.d.ts +24 -0
  189. package/dist/cloud/client.js +65 -0
  190. package/dist/cloud/http-client.d.ts +38 -0
  191. package/dist/cloud/http-client.js +215 -0
  192. package/dist/cloud/index.d.ts +23 -0
  193. package/dist/cloud/index.js +25 -0
  194. package/dist/cloud/mock-client.d.ts +107 -0
  195. package/dist/cloud/mock-client.js +545 -0
  196. package/dist/cloud/types.d.ts +515 -0
  197. package/dist/cloud/types.js +15 -0
  198. package/dist/config/defaults.d.ts +160 -0
  199. package/dist/config/defaults.js +169 -0
  200. package/dist/config/loader.d.ts +24 -0
  201. package/dist/config/loader.js +122 -0
  202. package/dist/config/template.d.ts +42 -0
  203. package/dist/config/template.js +647 -0
  204. package/dist/config/validator.d.ts +2112 -0
  205. package/dist/config/validator.js +658 -0
  206. package/dist/constants/cloud.d.ts +107 -0
  207. package/dist/constants/cloud.js +110 -0
  208. package/dist/constants/core.d.ts +521 -0
  209. package/dist/constants/core.js +556 -0
  210. package/dist/constants/testing.d.ts +1283 -0
  211. package/dist/constants/testing.js +1568 -0
  212. package/dist/constants.d.ts +10 -0
  213. package/dist/constants.js +10 -0
  214. package/dist/contract/index.d.ts +6 -0
  215. package/dist/contract/index.js +5 -0
  216. package/dist/contract/validator.d.ts +177 -0
  217. package/dist/contract/validator.js +574 -0
  218. package/dist/cost/index.d.ts +6 -0
  219. package/dist/cost/index.js +5 -0
  220. package/dist/cost/tracker.d.ts +134 -0
  221. package/dist/cost/tracker.js +313 -0
  222. package/dist/discovery/discovery.d.ts +16 -0
  223. package/dist/discovery/discovery.js +173 -0
  224. package/dist/discovery/types.d.ts +51 -0
  225. package/dist/discovery/types.js +2 -0
  226. package/dist/docs/agents.d.ts +3 -0
  227. package/dist/docs/agents.js +995 -0
  228. package/dist/docs/contract.d.ts +51 -0
  229. package/dist/docs/contract.js +1681 -0
  230. package/dist/docs/generator.d.ts +4 -0
  231. package/dist/docs/generator.js +4 -0
  232. package/dist/docs/html-reporter.d.ts +9 -0
  233. package/dist/docs/html-reporter.js +757 -0
  234. package/dist/docs/index.d.ts +10 -0
  235. package/dist/docs/index.js +11 -0
  236. package/dist/docs/junit-reporter.d.ts +18 -0
  237. package/dist/docs/junit-reporter.js +210 -0
  238. package/dist/docs/report.d.ts +14 -0
  239. package/dist/docs/report.js +44 -0
  240. package/dist/docs/sarif-reporter.d.ts +19 -0
  241. package/dist/docs/sarif-reporter.js +335 -0
  242. package/dist/docs/shared.d.ts +35 -0
  243. package/dist/docs/shared.js +162 -0
  244. package/dist/docs/templates.d.ts +12 -0
  245. package/dist/docs/templates.js +76 -0
  246. package/dist/errors/index.d.ts +6 -0
  247. package/dist/errors/index.js +6 -0
  248. package/dist/errors/retry.d.ts +92 -0
  249. package/dist/errors/retry.js +323 -0
  250. package/dist/errors/types.d.ts +321 -0
  251. package/dist/errors/types.js +584 -0
  252. package/dist/index.d.ts +32 -0
  253. package/dist/index.js +32 -0
  254. package/dist/interview/dependency-resolver.d.ts +11 -0
  255. package/dist/interview/dependency-resolver.js +32 -0
  256. package/dist/interview/interviewer.d.ts +232 -0
  257. package/dist/interview/interviewer.js +1939 -0
  258. package/dist/interview/mock-response-generator.d.ts +7 -0
  259. package/dist/interview/mock-response-generator.js +102 -0
  260. package/dist/interview/orchestrator.d.ts +237 -0
  261. package/dist/interview/orchestrator.js +1296 -0
  262. package/dist/interview/rate-limiter.d.ts +15 -0
  263. package/dist/interview/rate-limiter.js +55 -0
  264. package/dist/interview/response-validator.d.ts +10 -0
  265. package/dist/interview/response-validator.js +132 -0
  266. package/dist/interview/schema-inferrer.d.ts +8 -0
  267. package/dist/interview/schema-inferrer.js +71 -0
  268. package/dist/interview/schema-test-generator.d.ts +71 -0
  269. package/dist/interview/schema-test-generator.js +834 -0
  270. package/dist/interview/smart-value-generator.d.ts +155 -0
  271. package/dist/interview/smart-value-generator.js +554 -0
  272. package/dist/interview/stateful-test-runner.d.ts +19 -0
  273. package/dist/interview/stateful-test-runner.js +106 -0
  274. package/dist/interview/types.d.ts +561 -0
  275. package/dist/interview/types.js +2 -0
  276. package/dist/llm/anthropic.d.ts +41 -0
  277. package/dist/llm/anthropic.js +355 -0
  278. package/dist/llm/client.d.ts +123 -0
  279. package/dist/llm/client.js +42 -0
  280. package/dist/llm/factory.d.ts +38 -0
  281. package/dist/llm/factory.js +145 -0
  282. package/dist/llm/fallback.d.ts +140 -0
  283. package/dist/llm/fallback.js +379 -0
  284. package/dist/llm/index.d.ts +18 -0
  285. package/dist/llm/index.js +15 -0
  286. package/dist/llm/ollama.d.ts +37 -0
  287. package/dist/llm/ollama.js +330 -0
  288. package/dist/llm/openai.d.ts +25 -0
  289. package/dist/llm/openai.js +320 -0
  290. package/dist/llm/token-budget.d.ts +161 -0
  291. package/dist/llm/token-budget.js +395 -0
  292. package/dist/logging/logger.d.ts +70 -0
  293. package/dist/logging/logger.js +130 -0
  294. package/dist/metrics/collector.d.ts +106 -0
  295. package/dist/metrics/collector.js +547 -0
  296. package/dist/metrics/index.d.ts +7 -0
  297. package/dist/metrics/index.js +7 -0
  298. package/dist/metrics/prometheus.d.ts +20 -0
  299. package/dist/metrics/prometheus.js +241 -0
  300. package/dist/metrics/types.d.ts +209 -0
  301. package/dist/metrics/types.js +5 -0
  302. package/dist/persona/builtins.d.ts +54 -0
  303. package/dist/persona/builtins.js +219 -0
  304. package/dist/persona/index.d.ts +8 -0
  305. package/dist/persona/index.js +8 -0
  306. package/dist/persona/loader.d.ts +30 -0
  307. package/dist/persona/loader.js +190 -0
  308. package/dist/persona/types.d.ts +144 -0
  309. package/dist/persona/types.js +5 -0
  310. package/dist/persona/validation.d.ts +94 -0
  311. package/dist/persona/validation.js +332 -0
  312. package/dist/prompts/index.d.ts +5 -0
  313. package/dist/prompts/index.js +5 -0
  314. package/dist/prompts/templates.d.ts +180 -0
  315. package/dist/prompts/templates.js +431 -0
  316. package/dist/registry/client.d.ts +49 -0
  317. package/dist/registry/client.js +191 -0
  318. package/dist/registry/index.d.ts +7 -0
  319. package/dist/registry/index.js +6 -0
  320. package/dist/registry/types.d.ts +140 -0
  321. package/dist/registry/types.js +6 -0
  322. package/dist/scenarios/evaluator.d.ts +43 -0
  323. package/dist/scenarios/evaluator.js +206 -0
  324. package/dist/scenarios/index.d.ts +10 -0
  325. package/dist/scenarios/index.js +9 -0
  326. package/dist/scenarios/loader.d.ts +20 -0
  327. package/dist/scenarios/loader.js +285 -0
  328. package/dist/scenarios/types.d.ts +153 -0
  329. package/dist/scenarios/types.js +8 -0
  330. package/dist/security/index.d.ts +17 -0
  331. package/dist/security/index.js +18 -0
  332. package/dist/security/payloads.d.ts +61 -0
  333. package/dist/security/payloads.js +268 -0
  334. package/dist/security/security-tester.d.ts +42 -0
  335. package/dist/security/security-tester.js +582 -0
  336. package/dist/security/types.d.ts +166 -0
  337. package/dist/security/types.js +8 -0
  338. package/dist/transport/base-transport.d.ts +59 -0
  339. package/dist/transport/base-transport.js +38 -0
  340. package/dist/transport/http-transport.d.ts +67 -0
  341. package/dist/transport/http-transport.js +238 -0
  342. package/dist/transport/mcp-client.d.ts +141 -0
  343. package/dist/transport/mcp-client.js +496 -0
  344. package/dist/transport/sse-transport.d.ts +88 -0
  345. package/dist/transport/sse-transport.js +316 -0
  346. package/dist/transport/stdio-transport.d.ts +43 -0
  347. package/dist/transport/stdio-transport.js +238 -0
  348. package/dist/transport/types.d.ts +125 -0
  349. package/dist/transport/types.js +16 -0
  350. package/dist/utils/concurrency.d.ts +123 -0
  351. package/dist/utils/concurrency.js +213 -0
  352. package/dist/utils/formatters.d.ts +16 -0
  353. package/dist/utils/formatters.js +37 -0
  354. package/dist/utils/index.d.ts +8 -0
  355. package/dist/utils/index.js +8 -0
  356. package/dist/utils/jsonpath.d.ts +87 -0
  357. package/dist/utils/jsonpath.js +326 -0
  358. package/dist/utils/markdown.d.ts +113 -0
  359. package/dist/utils/markdown.js +265 -0
  360. package/dist/utils/network.d.ts +14 -0
  361. package/dist/utils/network.js +17 -0
  362. package/dist/utils/sanitize.d.ts +92 -0
  363. package/dist/utils/sanitize.js +191 -0
  364. package/dist/utils/semantic.d.ts +194 -0
  365. package/dist/utils/semantic.js +1051 -0
  366. package/dist/utils/smart-truncate.d.ts +94 -0
  367. package/dist/utils/smart-truncate.js +361 -0
  368. package/dist/utils/timeout.d.ts +153 -0
  369. package/dist/utils/timeout.js +205 -0
  370. package/dist/utils/yaml-parser.d.ts +58 -0
  371. package/dist/utils/yaml-parser.js +86 -0
  372. package/dist/validation/index.d.ts +32 -0
  373. package/dist/validation/index.js +32 -0
  374. package/dist/validation/semantic-test-generator.d.ts +50 -0
  375. package/dist/validation/semantic-test-generator.js +176 -0
  376. package/dist/validation/semantic-types.d.ts +66 -0
  377. package/dist/validation/semantic-types.js +94 -0
  378. package/dist/validation/semantic-validator.d.ts +38 -0
  379. package/dist/validation/semantic-validator.js +340 -0
  380. package/dist/verification/index.d.ts +6 -0
  381. package/dist/verification/index.js +5 -0
  382. package/dist/verification/types.d.ts +133 -0
  383. package/dist/verification/types.js +5 -0
  384. package/dist/verification/verifier.d.ts +30 -0
  385. package/dist/verification/verifier.js +309 -0
  386. package/dist/version.d.ts +19 -0
  387. package/dist/version.js +48 -0
  388. package/dist/workflow/auto-generator.d.ts +27 -0
  389. package/dist/workflow/auto-generator.js +513 -0
  390. package/dist/workflow/discovery.d.ts +40 -0
  391. package/dist/workflow/discovery.js +195 -0
  392. package/dist/workflow/executor.d.ts +82 -0
  393. package/dist/workflow/executor.js +611 -0
  394. package/dist/workflow/index.d.ts +10 -0
  395. package/dist/workflow/index.js +10 -0
  396. package/dist/workflow/loader.d.ts +24 -0
  397. package/dist/workflow/loader.js +194 -0
  398. package/dist/workflow/state-tracker.d.ts +98 -0
  399. package/dist/workflow/state-tracker.js +424 -0
  400. package/dist/workflow/types.d.ts +337 -0
  401. package/dist/workflow/types.js +5 -0
  402. package/package.json +94 -0
  403. package/schemas/bellwether-check.schema.json +651 -0
@@ -0,0 +1,1568 @@
1
+ /**
2
+ * Change impact analysis configuration.
3
+ * Used by change-impact-analyzer.ts for semantic breaking change detection.
4
+ */
5
+ export const CHANGE_IMPACT = {
6
+ /** Risk weights for different schema change types (0-100 scale) */
7
+ RISK_WEIGHTS: {
8
+ parameter_removed: 100,
9
+ parameter_required_added: 90,
10
+ parameter_type_changed: 85,
11
+ enum_value_removed: 80,
12
+ constraint_tightened: 60,
13
+ format_changed: 50,
14
+ constraint_added: 40,
15
+ default_changed: 30,
16
+ constraint_removed: 20,
17
+ parameter_required_removed: 15,
18
+ enum_value_added: 10,
19
+ parameter_added: 10,
20
+ description_changed: 5,
21
+ constraint_relaxed: 5,
22
+ },
23
+ /** Migration complexity thresholds (number of breaking changes) */
24
+ COMPLEXITY_THRESHOLDS: {
25
+ /** 0-1 breaking changes = trivial migration */
26
+ trivial: 1,
27
+ /** 2-3 breaking changes = simple migration */
28
+ simple: 3,
29
+ /** 4-6 breaking changes = moderate migration */
30
+ moderate: 6,
31
+ // 7+ breaking changes = complex migration
32
+ },
33
+ /** Risk score thresholds for severity classification */
34
+ SEVERITY_THRESHOLDS: {
35
+ info: 20,
36
+ warning: 50,
37
+ breaking: 70,
38
+ },
39
+ };
40
+ /**
41
+ * Check command configuration defaults.
42
+ * Used by check.ts and incremental-checker.ts.
43
+ */
44
+ export const CHECK = {
45
+ /** Default cache age for incremental checking (1 week in hours) */
46
+ DEFAULT_INCREMENTAL_CACHE_HOURS: 168,
47
+ /** Minimum cache age (1 hour) */
48
+ MIN_INCREMENTAL_CACHE_HOURS: 1,
49
+ /** Maximum cache age (30 days in hours) */
50
+ MAX_INCREMENTAL_CACHE_HOURS: 720,
51
+ };
52
+ /**
53
+ * Performance tracking configuration.
54
+ * Used by performance-tracker.ts for latency regression detection.
55
+ */
56
+ export const PERFORMANCE_TRACKING = {
57
+ /** Default regression threshold (10% = tool is 10% slower) */
58
+ DEFAULT_REGRESSION_THRESHOLD: 0.10,
59
+ /** Warning threshold for minor regressions (5%) */
60
+ WARNING_THRESHOLD: 0.05,
61
+ /** Minimum samples required for reliable metrics */
62
+ MIN_SAMPLES: 3,
63
+ /** Trend detection thresholds */
64
+ TREND_THRESHOLDS: {
65
+ /** Performance is "improving" if p50 is at least 5% faster */
66
+ improving: -0.05,
67
+ /** Performance is "degrading" if p50 is at least 5% slower */
68
+ degrading: 0.05,
69
+ },
70
+ /** Percentiles to calculate for latency analysis */
71
+ PERCENTILES: [50, 95, 99],
72
+ };
73
+ /**
74
+ * Performance confidence scoring configuration.
75
+ * Used by performance-tracker.ts for statistical validity assessment.
76
+ *
77
+ * Confidence levels indicate how reliable performance baselines are:
78
+ * - HIGH: Enough samples with low variability - baselines are reliable
79
+ * - MEDIUM: Moderate samples or variability - use with caution
80
+ * - LOW: Few samples or high variability - consider collecting more data
81
+ */
82
+ export const PERFORMANCE_CONFIDENCE = {
83
+ /** Thresholds for high confidence level */
84
+ HIGH: {
85
+ /** Minimum samples required for high confidence */
86
+ MIN_SAMPLES: 10,
87
+ /** Maximum coefficient of variation for high confidence (0.3 = 30%) */
88
+ MAX_CV: 0.3,
89
+ },
90
+ /** Thresholds for medium confidence level */
91
+ MEDIUM: {
92
+ /** Minimum samples required for medium confidence */
93
+ MIN_SAMPLES: 5,
94
+ /** Maximum coefficient of variation for medium confidence (0.5 = 50%) */
95
+ MAX_CV: 0.5,
96
+ },
97
+ /** Warmup configuration for excluding cold-start overhead from variance */
98
+ WARMUP: {
99
+ /** Default number of warmup runs before timing (0 = include first sample in variance) */
100
+ DEFAULT_RUNS: 1,
101
+ /** Whether to exclude warmup from variance calculation by default */
102
+ EXCLUDE_FROM_VARIANCE: true,
103
+ },
104
+ /** Display labels for confidence levels */
105
+ LABELS: {
106
+ high: 'HIGH',
107
+ medium: 'MEDIUM',
108
+ low: 'LOW',
109
+ },
110
+ /** Emoji indicators for confidence levels (used in Markdown) */
111
+ INDICATORS: {
112
+ high: '✓',
113
+ medium: '~',
114
+ low: '!',
115
+ },
116
+ /** Recommendation messages for low confidence */
117
+ RECOMMENDATIONS: {
118
+ /** Message when sample count is too low */
119
+ LOW_SAMPLES: (current, target) => `Run with --samples ${target - current + current} for reliable baseline`,
120
+ /** Message when variability is too high */
121
+ HIGH_VARIABILITY: 'High variability in response times; consider investigating causes',
122
+ /** Message when no samples collected */
123
+ NO_SAMPLES: 'No performance samples collected',
124
+ },
125
+ };
126
+ /**
127
+ * Deprecation lifecycle configuration.
128
+ * Used by deprecation-tracker.ts for tool deprecation management.
129
+ */
130
+ export const DEPRECATION = {
131
+ /** Default configuration values */
132
+ DEFAULTS: {
133
+ /** Warn when using deprecated tools */
134
+ warnOnUsage: true,
135
+ /** Fail when using tools past their removal date */
136
+ failOnExpired: true,
137
+ /** Default grace period in days after removal date */
138
+ gracePeriodDays: 90,
139
+ },
140
+ /** Days thresholds for warning levels */
141
+ THRESHOLDS: {
142
+ /** Warn about upcoming removal within this many days */
143
+ upcomingRemovalDays: 30,
144
+ /** Critical warning within this many days */
145
+ criticalRemovalDays: 7,
146
+ },
147
+ };
148
+ /**
149
+ * Verification tier thresholds for the Verified by Bellwether program.
150
+ * Used by verifier.ts to determine verification tier based on test coverage.
151
+ */
152
+ export const SCHEMA_EVOLUTION = {
153
+ // Timeline tracking settings (schema-evolution.ts)
154
+ /** Default maximum versions to keep per tool */
155
+ DEFAULT_MAX_VERSIONS_PER_TOOL: 50,
156
+ /** Default limit for "most active tools" queries */
157
+ DEFAULT_ACTIVE_TOOLS_LIMIT: 10,
158
+ /** Default number of versions to display in formatted output */
159
+ DEFAULT_DISPLAY_VERSIONS: 10,
160
+ /** Default number of changes to display per version */
161
+ DEFAULT_DISPLAY_CHANGES: 5,
162
+ /** Default width for visual timeline */
163
+ DEFAULT_VISUAL_TIMELINE_WIDTH: 80,
164
+ /** Maximum versions to show in visual timeline */
165
+ MAX_VISUAL_TIMELINE_VERSIONS: 20,
166
+ // Stability analysis settings (response-schema-tracker.ts)
167
+ /** Minimum samples required for meaningful stability assessment */
168
+ MIN_SAMPLES_FOR_STABILITY: 3,
169
+ /** Minimum samples for high confidence stability assessment */
170
+ HIGH_CONFIDENCE_MIN_SAMPLES: 10,
171
+ /** Stability confidence threshold for flagging issues (0-1) */
172
+ STABILITY_THRESHOLD: 0.7,
173
+ /** Grade thresholds for schema stability scoring */
174
+ GRADE_THRESHOLDS: {
175
+ /** Minimum confidence for grade A */
176
+ A: 0.95,
177
+ /** Minimum confidence for grade B */
178
+ B: 0.85,
179
+ /** Minimum confidence for grade C */
180
+ C: 0.7,
181
+ /** Minimum confidence for grade D */
182
+ D: 0.5,
183
+ // Below D threshold = grade F
184
+ },
185
+ /** Display labels for stability states */
186
+ STABILITY_LABELS: {
187
+ STABLE: 'Stable',
188
+ UNSTABLE: 'Unstable',
189
+ UNKNOWN: 'Unknown',
190
+ INSUFFICIENT_DATA: 'Insufficient Data',
191
+ },
192
+ /** Display labels for change types */
193
+ CHANGE_LABELS: {
194
+ FIELDS_ADDED: 'Fields Added',
195
+ FIELDS_REMOVED: 'Fields Removed',
196
+ TYPE_CHANGED: 'Type Changed',
197
+ REQUIRED_CHANGED: 'Required Changed',
198
+ STRUCTURE_CHANGED: 'Structure Changed',
199
+ },
200
+ };
201
+ /**
202
+ * Error analysis configuration.
203
+ * Used by error-analyzer.ts for enhanced error analysis and remediation.
204
+ */
205
+ export const ERROR_ANALYSIS = {
206
+ /** Trend significance thresholds */
207
+ TREND_THRESHOLDS: {
208
+ /** Multiplier threshold for "increasing" trend (current > previous * 1.5) */
209
+ INCREASING: 1.5,
210
+ /** Multiplier threshold for "decreasing" trend (current < previous * 0.5) */
211
+ DECREASING: 0.5,
212
+ },
213
+ /** Severity weights for error analysis */
214
+ SEVERITY_WEIGHTS: {
215
+ critical: 100,
216
+ high: 75,
217
+ medium: 50,
218
+ low: 25,
219
+ info: 10,
220
+ },
221
+ /** Category display labels */
222
+ CATEGORY_LABELS: {
223
+ client_error_validation: 'Validation Error',
224
+ client_error_auth: 'Authentication Error',
225
+ client_error_not_found: 'Not Found',
226
+ client_error_conflict: 'Conflict',
227
+ client_error_rate_limit: 'Rate Limited',
228
+ server_error: 'Server Error',
229
+ unknown: 'Unknown Error',
230
+ },
231
+ /** Trend display labels */
232
+ TREND_LABELS: {
233
+ increasing: 'Increasing',
234
+ decreasing: 'Decreasing',
235
+ stable: 'Stable',
236
+ new: 'New',
237
+ resolved: 'Resolved',
238
+ },
239
+ /** Maximum remediations to display per tool */
240
+ MAX_REMEDIATIONS_DISPLAY: 5,
241
+ /** Maximum related parameters to extract */
242
+ MAX_RELATED_PARAMETERS: 5,
243
+ };
244
+ /**
245
+ * Migration guide generation configuration.
246
+ * Used by migration-generator.ts for auto-generating migration guides.
247
+ */
248
+ export const MIGRATION_GUIDE = {
249
+ /** Maximum code examples per migration step */
250
+ MAX_CODE_EXAMPLES_PER_STEP: 3,
251
+ /** Maximum steps in a migration guide */
252
+ MAX_MIGRATION_STEPS: 20,
253
+ /** Minimum changes required to generate a guide */
254
+ MIN_CHANGES_FOR_GUIDE: 1,
255
+ /** Effort estimation thresholds (number of breaking changes) */
256
+ EFFORT_THRESHOLDS: {
257
+ /** 0-1 breaking changes = trivial */
258
+ trivial: 1,
259
+ /** 2-3 breaking changes = minor */
260
+ minor: 3,
261
+ /** 4-6 breaking changes = moderate */
262
+ moderate: 6,
263
+ // 7+ breaking changes = major
264
+ },
265
+ };
266
+ /**
267
+ * Auto-generated test scenario configuration.
268
+ * Used by scenario-generator.ts for generating test scenarios.
269
+ */
270
+ export const SCENARIO_GENERATION = {
271
+ /** Maximum happy path scenarios per tool */
272
+ MAX_HAPPY_PATH_SCENARIOS: 5,
273
+ /** Maximum edge case scenarios per tool */
274
+ MAX_EDGE_CASE_SCENARIOS: 10,
275
+ /** Maximum error case scenarios per tool */
276
+ MAX_ERROR_CASE_SCENARIOS: 5,
277
+ /** Maximum security test scenarios per tool */
278
+ MAX_SECURITY_SCENARIOS: 5,
279
+ /** Default minimum coverage percentage */
280
+ DEFAULT_MIN_COVERAGE: 80,
281
+ /** Common SQL injection payloads for testing */
282
+ SQL_INJECTION_PAYLOADS: [
283
+ "'; DROP TABLE users; --",
284
+ "1' OR '1'='1",
285
+ "1; SELECT * FROM users",
286
+ ],
287
+ /** Common XSS payloads for testing */
288
+ XSS_PAYLOADS: [
289
+ '<script>alert("xss")</script>',
290
+ '"><img src=x onerror=alert(1)>',
291
+ "javascript:alert('xss')",
292
+ ],
293
+ /** Common path traversal payloads for testing */
294
+ PATH_TRAVERSAL_PAYLOADS: [
295
+ '../../../etc/passwd',
296
+ '..\\..\\..\\windows\\system32\\config\\sam',
297
+ '/etc/passwd',
298
+ ],
299
+ /** Categories of test scenarios */
300
+ CATEGORIES: ['happy_path', 'edge_cases', 'error_handling', 'security'],
301
+ };
302
+ /**
303
+ * PR comment formatting configuration.
304
+ * Used by pr-comment-generator.ts for generating GitHub PR comments.
305
+ */
306
+ export const PR_COMMENTS = {
307
+ /** Maximum tools to show in detailed section */
308
+ MAX_DETAILED_TOOLS: 10,
309
+ /** Maximum changes to show per tool */
310
+ MAX_CHANGES_PER_TOOL: 5,
311
+ /** Maximum workflows to show in affected section */
312
+ MAX_AFFECTED_WORKFLOWS: 5,
313
+ /** Maximum code examples in migration section */
314
+ MAX_MIGRATION_EXAMPLES: 3,
315
+ /** Truncation length for long values */
316
+ VALUE_TRUNCATE_LENGTH: 50,
317
+ /** Badge colors for different severity levels */
318
+ BADGE_COLORS: {
319
+ breaking: 'red',
320
+ warning: 'orange',
321
+ info: 'blue',
322
+ none: 'green',
323
+ },
324
+ };
325
+ // ==================== Schema Testing (Check Mode) ====================
326
+ /**
327
+ * Schema-based test generation configuration for check mode.
328
+ * Used by schema-test-generator.ts for deterministic test case creation.
329
+ * These tests are generated from JSON Schema without requiring LLM.
330
+ */
331
+ export const SCHEMA_TESTING = {
332
+ /** Maximum tests per test category to prevent explosion */
333
+ MAX_TESTS_PER_CATEGORY: 3,
334
+ /** Maximum total tests per tool (across all categories) */
335
+ MAX_TESTS_PER_TOOL: 12,
336
+ /** Minimum tests to generate even for simple tools */
337
+ MIN_TESTS_PER_TOOL: 3,
338
+ /** Boundary test values for various types */
339
+ BOUNDARY_VALUES: {
340
+ /** Empty string for string boundary testing */
341
+ EMPTY_STRING: '',
342
+ /** Long string length for boundary testing */
343
+ LONG_STRING_LENGTH: 150,
344
+ /** Zero value for number boundary */
345
+ ZERO: 0,
346
+ /** Negative value for number boundary */
347
+ NEGATIVE_ONE: -1,
348
+ /** Large negative value */
349
+ LARGE_NEGATIVE: -999999999,
350
+ /** Very large number for boundary testing */
351
+ LARGE_POSITIVE: 999999999,
352
+ /** Maximum safe integer */
353
+ MAX_SAFE_INT: Number.MAX_SAFE_INTEGER,
354
+ /** Minimum safe integer */
355
+ MIN_SAFE_INT: Number.MIN_SAFE_INTEGER,
356
+ /** Decimal value for integer field testing */
357
+ DECIMAL: 1.5,
358
+ /** Empty array */
359
+ EMPTY_ARRAY: [],
360
+ /** Empty object */
361
+ EMPTY_OBJECT: {},
362
+ },
363
+ /** Values for type coercion testing */
364
+ TYPE_COERCION: {
365
+ /** String that looks like a number */
366
+ NUMERIC_STRING: '123',
367
+ /** String that looks like boolean */
368
+ TRUE_STRING: 'true',
369
+ /** String that looks like boolean */
370
+ FALSE_STRING: 'false',
371
+ /** Empty string for coercion testing */
372
+ EMPTY_STRING: '',
373
+ /** String "null" for null coercion testing */
374
+ NULL_STRING: 'null',
375
+ /** String "undefined" */
376
+ UNDEFINED_STRING: 'undefined',
377
+ },
378
+ /** Invalid enum value to use when testing enum violations */
379
+ INVALID_ENUM_VALUES: [
380
+ 'INVALID_ENUM_VALUE_12345',
381
+ '__not_a_valid_option__',
382
+ ],
383
+ /** Test names for different test categories (used in descriptions) */
384
+ CATEGORY_DESCRIPTIONS: {
385
+ HAPPY_PATH: 'Happy path test',
386
+ BOUNDARY: 'Boundary value test',
387
+ TYPE_COERCION: 'Type coercion test',
388
+ ENUM_VIOLATION: 'Enum validation test',
389
+ NULL_HANDLING: 'Null/undefined handling test',
390
+ ARRAY_HANDLING: 'Array handling test',
391
+ NESTED_OBJECT: 'Nested object test',
392
+ ERROR_HANDLING: 'Error handling test',
393
+ MISSING_REQUIRED: 'Missing required parameter test',
394
+ },
395
+ /** Array test configuration */
396
+ ARRAY_TESTS: {
397
+ /** Number of items for "many items" test */
398
+ MANY_ITEMS_COUNT: 10,
399
+ },
400
+ };
401
+ // ==================== Test Outcome Assessment ====================
402
+ /**
403
+ * Configuration for test outcome assessment.
404
+ * Used by interviewer.ts and schema-test-generator.ts to properly
405
+ * categorize test results and calculate meaningful metrics.
406
+ *
407
+ * Key insight: Tests that expect errors (validation tests) should be
408
+ * counted as "success" when they correctly reject invalid input.
409
+ * This prevents misleading low success rates for tools that properly
410
+ * validate their inputs.
411
+ */
412
+ export const OUTCOME_ASSESSMENT = {
413
+ /**
414
+ * Test categories that expect errors (validation tests).
415
+ * Tools should reject these inputs - rejection counts as success.
416
+ */
417
+ EXPECTS_ERROR_CATEGORIES: [
418
+ 'error_handling',
419
+ ],
420
+ /**
421
+ * Test descriptions that indicate error-expectation.
422
+ * Matched case-insensitively against test descriptions.
423
+ */
424
+ EXPECTS_ERROR_PATTERNS: [
425
+ /missing required/i,
426
+ /invalid.*type/i,
427
+ /type coercion/i,
428
+ /enum validation/i,
429
+ /null.*handling/i,
430
+ /boundary.*invalid/i,
431
+ /should.*reject/i,
432
+ /should.*fail/i,
433
+ /expects.*error/i,
434
+ /error handling/i,
435
+ ],
436
+ /**
437
+ * Categories where tests always expect success (happy path).
438
+ * Errors on these tests indicate actual tool problems.
439
+ */
440
+ EXPECTS_SUCCESS_CATEGORIES: [
441
+ 'happy_path',
442
+ ],
443
+ /**
444
+ * Categories where outcome is unpredictable (edge cases).
445
+ * Either success or error is acceptable.
446
+ */
447
+ EITHER_OUTCOME_CATEGORIES: [
448
+ 'edge_case',
449
+ 'boundary',
450
+ ],
451
+ /**
452
+ * Reliability metrics calculation.
453
+ * These control how success/failure rates are computed.
454
+ */
455
+ METRICS: {
456
+ /**
457
+ * Whether to count correct rejection as success.
458
+ * When true: validation tests that correctly reject count as success.
459
+ * When false: only actual successes count (misleading for validators).
460
+ * @default true
461
+ */
462
+ COUNT_REJECTION_AS_SUCCESS: true,
463
+ /**
464
+ * Whether to separate validation metrics from reliability metrics.
465
+ * When true: separate "Validation Rate" from "Success Rate".
466
+ * @default true
467
+ */
468
+ SEPARATE_VALIDATION_METRICS: true,
469
+ },
470
+ /**
471
+ * Labels for different metrics in output.
472
+ */
473
+ LABELS: {
474
+ /** Label for happy path success rate */
475
+ HAPPY_PATH_SUCCESS: 'Reliability',
476
+ /** Label for validation test success (correct rejections) */
477
+ VALIDATION_SUCCESS: 'Validation',
478
+ /** Label for overall combined metric */
479
+ OVERALL: 'Overall',
480
+ /** Label for unexpected errors */
481
+ UNEXPECTED_ERRORS: 'Bugs',
482
+ },
483
+ /**
484
+ * Icons/indicators for outcome assessment results.
485
+ */
486
+ INDICATORS: {
487
+ /** Correct outcome (success or expected error) */
488
+ correct: '✓',
489
+ /** Incorrect outcome (unexpected behavior) */
490
+ incorrect: '✗',
491
+ /** Ambiguous outcome (either was acceptable) */
492
+ ambiguous: '~',
493
+ },
494
+ };
495
+ // ==================== Rate Limiting ====================
496
+ /**
497
+ * Rate limiting configuration defaults and detection patterns.
498
+ */
499
+ export const RATE_LIMITING = {
500
+ /** Error patterns indicating rate limiting */
501
+ ERROR_PATTERNS: [
502
+ /rate limit/i,
503
+ /too many requests/i,
504
+ /429\b/,
505
+ /throttle/i,
506
+ /slow down/i,
507
+ ],
508
+ /** Base delay for backoff (ms) */
509
+ BASE_DELAY_MS: 500,
510
+ /** Maximum backoff delay (ms) */
511
+ MAX_DELAY_MS: 10000,
512
+ /** Jitter ratio (0-1) */
513
+ JITTER_RATIO: 0.2,
514
+ };
515
+ // ==================== Stateful Testing ====================
516
+ /**
517
+ * Stateful testing configuration.
518
+ */
519
+ export const STATEFUL_TESTING = {
520
+ /** Parameter patterns that should use state from previous tools */
521
+ PREFERRED_PARAM_PATTERNS: [
522
+ /_?id$/i,
523
+ /token/i,
524
+ /session/i,
525
+ /cursor/i,
526
+ /account/i,
527
+ /resource/i,
528
+ ],
529
+ /** Maximum number of stored values across tool calls */
530
+ MAX_STORED_VALUES: 50,
531
+ };
532
+ // ==================== Security Testing (Check Mode) ====================
533
+ /**
534
+ * Security testing configuration for check mode.
535
+ * Used by security-tester.ts for deterministic vulnerability detection.
536
+ *
537
+ * Security testing is opt-in via the --security flag and runs deterministic
538
+ * payload tests without requiring LLM. This enables detection of common
539
+ * vulnerability patterns like SQL injection, XSS, path traversal, etc.
540
+ */
541
+ export const SECURITY_TESTING = {
542
+ /** Maximum payloads per category to test (limits test time) */
543
+ MAX_PAYLOADS_PER_CATEGORY: 3,
544
+ /** Timeout for each security test in milliseconds */
545
+ TEST_TIMEOUT_MS: 5000,
546
+ /** Maximum parameters to test per tool (for tools with many params) */
547
+ MAX_PARAMS_PER_TOOL: 5,
548
+ /** Risk score weights by risk level (for calculating overall risk) */
549
+ RISK_WEIGHTS: {
550
+ critical: 40,
551
+ high: 25,
552
+ medium: 15,
553
+ low: 5,
554
+ info: 1,
555
+ },
556
+ /** Risk score thresholds for severity classification */
557
+ RISK_THRESHOLDS: {
558
+ /** Score >= this is critical severity */
559
+ critical: 70,
560
+ /** Score >= this is high severity */
561
+ high: 50,
562
+ /** Score >= this is medium severity */
563
+ medium: 25,
564
+ /** Score >= this is low severity */
565
+ low: 10,
566
+ // Score < 10 is info severity
567
+ },
568
+ /** Default categories to test when --security is used without --security-categories */
569
+ DEFAULT_CATEGORIES: [
570
+ 'sql_injection',
571
+ 'xss',
572
+ 'path_traversal',
573
+ 'command_injection',
574
+ 'ssrf',
575
+ 'error_disclosure',
576
+ ],
577
+ /** Parameter name patterns that suggest security-relevant parameters */
578
+ SECURITY_RELEVANT_PARAM_PATTERNS: [
579
+ /path/i,
580
+ /file/i,
581
+ /dir/i,
582
+ /directory/i,
583
+ /url/i,
584
+ /uri/i,
585
+ /link/i,
586
+ /href/i,
587
+ /query/i,
588
+ /sql/i,
589
+ /command/i,
590
+ /cmd/i,
591
+ /exec/i,
592
+ /script/i,
593
+ /code/i,
594
+ /input/i,
595
+ /data/i,
596
+ /content/i,
597
+ /text/i,
598
+ /message/i,
599
+ /name/i,
600
+ /value/i,
601
+ /param/i,
602
+ /arg/i,
603
+ ],
604
+ /** CWE (Common Weakness Enumeration) IDs for each category */
605
+ CWE_IDS: {
606
+ sql_injection: 'CWE-89',
607
+ xss: 'CWE-79',
608
+ path_traversal: 'CWE-22',
609
+ command_injection: 'CWE-78',
610
+ ssrf: 'CWE-918',
611
+ error_disclosure: 'CWE-209',
612
+ },
613
+ /** Patterns that indicate a security rejection (good behavior) */
614
+ REJECTION_PATTERNS: [
615
+ /invalid/i,
616
+ /rejected/i,
617
+ /not allowed/i,
618
+ /forbidden/i,
619
+ /denied/i,
620
+ /blocked/i,
621
+ /malicious/i,
622
+ /unsafe/i,
623
+ /security/i,
624
+ /validation failed/i,
625
+ /illegal/i,
626
+ /prohibited/i,
627
+ ],
628
+ /** Patterns that indicate error information disclosure */
629
+ ERROR_DISCLOSURE_PATTERNS: {
630
+ /** Stack trace patterns */
631
+ stackTrace: [
632
+ /at\s+[\w.]+\s+\([^)]+\.js:\d+:\d+\)/,
633
+ /at\s+[\w.]+\s+\([^)]+\.ts:\d+:\d+\)/,
634
+ /Error:.*\n\s+at\s+/,
635
+ /Traceback \(most recent call last\)/,
636
+ ],
637
+ /** File path patterns */
638
+ filePath: [
639
+ /\/[\w./\-_]+\.(js|ts|py|rb|java|go|rs|cpp|c|h)/,
640
+ /[A-Z]:\\[\w\\.\-_]+\.(js|ts|py|rb|java|go|rs|cpp|c|h)/i,
641
+ ],
642
+ /** Database patterns */
643
+ database: [
644
+ /\bSQL\b/i,
645
+ /\bpostgres/i,
646
+ /\bmysql/i,
647
+ /\bmongodb/i,
648
+ /\bredis/i,
649
+ /\bsqlite/i,
650
+ /SQLSTATE/i,
651
+ ],
652
+ /** Internal IP patterns */
653
+ internalIp: [
654
+ /\b(10|172\.(1[6-9]|2\d|3[01])|192\.168)\.\d{1,3}\.\d{1,3}\b/,
655
+ /\blocalhost\b/i,
656
+ /\b127\.0\.0\.1\b/,
657
+ ],
658
+ },
659
+ };
660
+ // ==================== Semantic Validation ====================
661
+ /**
662
+ * Semantic validation configuration for check mode.
663
+ * Used by validation module for semantic type inference and testing.
664
+ *
665
+ * Semantic validation infers types (dates, emails, URLs, etc.) from
666
+ * parameter names and descriptions, then generates targeted tests
667
+ * to verify proper input validation.
668
+ */
669
+ export const SEMANTIC_VALIDATION = {
670
+ /** Minimum confidence threshold for generating semantic tests (0-1) */
671
+ MIN_CONFIDENCE_THRESHOLD: 0.5,
672
+ /** Maximum invalid values to test per parameter */
673
+ MAX_INVALID_VALUES_PER_PARAM: 2,
674
+ /** Maximum semantic tests per tool */
675
+ MAX_SEMANTIC_TESTS_PER_TOOL: 6,
676
+ /** Confidence scores for different inference sources */
677
+ CONFIDENCE: {
678
+ /** Confidence when schema format explicitly specifies type */
679
+ SCHEMA_FORMAT: 0.95,
680
+ /** Confidence boost from parameter name pattern match */
681
+ NAME_PATTERN_MATCH: 0.4,
682
+ /** Confidence boost from description pattern match */
683
+ DESCRIPTION_PATTERN_MATCH: 0.5,
684
+ },
685
+ /** Semantic type display names for documentation */
686
+ TYPE_DISPLAY_NAMES: {
687
+ date_iso8601: 'ISO 8601 Date',
688
+ date_month: 'Year-Month',
689
+ datetime: 'DateTime',
690
+ timestamp: 'Unix Timestamp',
691
+ amount_currency: 'Currency Amount',
692
+ percentage: 'Percentage',
693
+ identifier: 'Identifier',
694
+ email: 'Email Address',
695
+ url: 'URL',
696
+ phone: 'Phone Number',
697
+ ip_address: 'IP Address',
698
+ file_path: 'File Path',
699
+ json: 'JSON String',
700
+ base64: 'Base64 Encoded',
701
+ regex: 'Regular Expression',
702
+ unknown: 'Unknown',
703
+ },
704
+ /** Example valid values for documentation */
705
+ EXAMPLE_VALUES: {
706
+ date_iso8601: '2024-01-15',
707
+ date_month: '2024-01',
708
+ datetime: '2024-01-15T14:30:00Z',
709
+ timestamp: '1705330200',
710
+ amount_currency: '99.99',
711
+ percentage: '75',
712
+ identifier: 'user-123-abc',
713
+ email: 'user@example.com',
714
+ url: 'https://example.com',
715
+ phone: '+1-555-123-4567',
716
+ ip_address: '192.168.1.1',
717
+ file_path: '/path/to/file.txt',
718
+ json: '{"key": "value"}',
719
+ base64: 'SGVsbG8gV29ybGQ=',
720
+ regex: '^[a-z]+$',
721
+ unknown: '',
722
+ },
723
+ };
724
+ // ==================== Exit Codes ====================
725
+ /**
726
+ * Granular exit codes for CI/CD integration.
727
+ *
728
+ * Enables semantic responses to drift detection, allowing CI pipelines
729
+ * to differentiate between severity levels and take appropriate action.
730
+ *
731
+ * Usage in CI:
732
+ * bellwether check ...
733
+ * case $? in
734
+ * 0) echo "No changes" ;;
735
+ * 1) echo "Info-level changes" ;;
736
+ * 2) echo "Warning-level changes" ;;
737
+ * 3) echo "Breaking changes" ;;
738
+ * 4) echo "Runtime error" ;;
739
+ * 5) echo "Low confidence warning" ;;
740
+ * esac
741
+ */
742
+ export const EXIT_CODES = {
743
+ /** No changes detected - baseline matches current state */
744
+ CLEAN: 0,
745
+ /** Info-level changes only (non-breaking additions, description changes) */
746
+ INFO: 1,
747
+ /** Warning-level changes (potential issues, new error patterns) */
748
+ WARNING: 2,
749
+ /** Breaking changes detected (schema changes, removed tools) */
750
+ BREAKING: 3,
751
+ /** Runtime error (connection failed, timeout, configuration error) */
752
+ ERROR: 4,
753
+ /** Low confidence warning - metrics have insufficient statistical confidence */
754
+ LOW_CONFIDENCE: 5,
755
+ };
756
+ /**
757
+ * Map severity level to exit code.
758
+ * Used by check command to determine appropriate exit status.
759
+ */
760
+ export const SEVERITY_TO_EXIT_CODE = {
761
+ none: EXIT_CODES.CLEAN,
762
+ info: EXIT_CODES.INFO,
763
+ warning: EXIT_CODES.WARNING,
764
+ breaking: EXIT_CODES.BREAKING,
765
+ };
766
+ // ==================== Payload Limits ====================
767
+ /**
768
+ * Payload size limits for protection against resource exhaustion.
769
+ *
770
+ * These limits prevent DoS scenarios where malformed or malicious
771
+ * MCP servers could cause memory exhaustion or infinite loops.
772
+ */
773
+ export const PAYLOAD_LIMITS = {
774
+ /** Maximum schema size in bytes (1MB) */
775
+ MAX_SCHEMA_SIZE: 1024 * 1024,
776
+ /** Maximum baseline file size in bytes (10MB) */
777
+ MAX_BASELINE_SIZE: 10 * 1024 * 1024,
778
+ /** Maximum response content size in bytes (5MB) */
779
+ MAX_RESPONSE_SIZE: 5 * 1024 * 1024,
780
+ /** Maximum array items to process in fingerprinting */
781
+ MAX_ARRAY_ITEMS: 10000,
782
+ /** Maximum object properties to process */
783
+ MAX_OBJECT_PROPERTIES: 1000,
784
+ /** Maximum schema depth for circular reference protection */
785
+ MAX_SCHEMA_DEPTH: 50,
786
+ };
787
+ // ==================== Documentation Quality Scoring ====================
788
+ // ==================== Check Mode Sampling ====================
789
+ /**
790
+ * Statistical sampling configuration for check mode.
791
+ * Used by check.ts and interviewer.ts for confidence-based testing.
792
+ *
793
+ * Controls minimum sample counts for reliable performance baselines
794
+ * and enables adaptive sample escalation for high-variability tools.
795
+ */
796
+ export const CHECK_SAMPLING = {
797
+ /** Default minimum samples per tool */
798
+ DEFAULT_MIN_SAMPLES: 10,
799
+ /** Recommended minimum samples for production baselines */
800
+ RECOMMENDED_MIN_SAMPLES: 10,
801
+ /** Maximum samples when auto-escalating for high variability */
802
+ MAX_AUTO_ESCALATE_SAMPLES: 15,
803
+ /** Coefficient of variation threshold that triggers auto-escalation (50%) */
804
+ HIGH_VARIABILITY_THRESHOLD: 0.5,
805
+ /** Number of additional samples to add when escalating */
806
+ AUTO_ESCALATE_INCREMENT: 2,
807
+ /** Target confidence levels (maps to PERFORMANCE_CONFIDENCE thresholds) */
808
+ TARGET_CONFIDENCE: {
809
+ low: 'low',
810
+ medium: 'medium',
811
+ high: 'high',
812
+ },
813
+ /** Minimum samples required for each target confidence level */
814
+ SAMPLES_FOR_CONFIDENCE: {
815
+ low: 1,
816
+ medium: 5,
817
+ high: 10,
818
+ },
819
+ };
820
+ // ==================== External Dependency Detection ====================
821
+ /**
822
+ * External dependency detection configuration.
823
+ * Used by external-dependency-detector.ts for categorizing errors
824
+ * from known external services vs code bugs.
825
+ *
826
+ * Helps distinguish between:
827
+ * - Environment misconfiguration (missing credentials)
828
+ * - External API failures (service down, rate limited)
829
+ * - Actual code bugs
830
+ */
831
+ export const EXTERNAL_DEPENDENCIES = {
832
+ /** Known external service fingerprints */
833
+ SERVICES: {
834
+ plaid: {
835
+ name: 'Plaid',
836
+ /** Patterns in tool names/descriptions that indicate Plaid usage */
837
+ toolPatterns: [
838
+ /plaid/i,
839
+ /link_create/i,
840
+ /link_exchange/i,
841
+ /link_token/i,
842
+ /public_token/i,
843
+ /access_token.*item/i,
844
+ ],
845
+ /** Patterns in error messages that indicate Plaid errors */
846
+ errorPatterns: [
847
+ /INVALID_LINK_TOKEN/i,
848
+ /ITEM_LOGIN_REQUIRED/i,
849
+ /SANDBOX/i,
850
+ /INVALID_PUBLIC_TOKEN/i,
851
+ /PLAID_ERROR/i,
852
+ /INVALID_ACCESS_TOKEN/i,
853
+ /plaid\.com/i,
854
+ ],
855
+ /** HTTP status codes typical of Plaid errors */
856
+ statusCodes: [400, 401, 403],
857
+ /** Remediation suggestion for Plaid errors */
858
+ remediation: 'Configure Plaid sandbox credentials (PLAID_CLIENT_ID, PLAID_SECRET, PLAID_ENV=sandbox)',
859
+ /** Credential expectations for configuration checks */
860
+ credentials: {
861
+ requiredEnv: ['PLAID_CLIENT_ID', 'PLAID_SECRET'],
862
+ optionalEnv: ['PLAID_ENV'],
863
+ requiredConfigKeys: ['clientId', 'secret'],
864
+ sandboxAvailable: true,
865
+ mockAvailable: true,
866
+ },
867
+ },
868
+ stripe: {
869
+ name: 'Stripe',
870
+ toolPatterns: [
871
+ /stripe/i,
872
+ /payment/i,
873
+ /charge/i,
874
+ /customer.*create/i,
875
+ /subscription/i,
876
+ ],
877
+ errorPatterns: [
878
+ /sk_test_/i,
879
+ /pk_test_/i,
880
+ /api_key_invalid/i,
881
+ /stripe\.com/i,
882
+ /StripeError/i,
883
+ /invalid_request_error/i,
884
+ ],
885
+ statusCodes: [401, 402, 429],
886
+ remediation: 'Configure Stripe API keys (STRIPE_SECRET_KEY)',
887
+ credentials: {
888
+ requiredEnv: ['STRIPE_SECRET_KEY'],
889
+ optionalEnv: ['STRIPE_PUBLISHABLE_KEY'],
890
+ requiredConfigKeys: ['secretKey'],
891
+ sandboxAvailable: true,
892
+ mockAvailable: true,
893
+ },
894
+ },
895
+ aws: {
896
+ name: 'AWS',
897
+ toolPatterns: [
898
+ /aws/i,
899
+ /s3/i,
900
+ /dynamo/i,
901
+ /lambda/i,
902
+ /cloudwatch/i,
903
+ /sqs/i,
904
+ /sns/i,
905
+ ],
906
+ errorPatterns: [
907
+ /amazonaws\.com/i,
908
+ /AccessDenied/i,
909
+ /NoSuchBucket/i,
910
+ /NoSuchKey/i,
911
+ /InvalidAccessKeyId/i,
912
+ /SignatureDoesNotMatch/i,
913
+ /ExpiredToken/i,
914
+ /CredentialsError/i,
915
+ ],
916
+ statusCodes: [403, 404, 400],
917
+ remediation: 'Configure AWS credentials (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION)',
918
+ credentials: {
919
+ requiredEnv: ['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY'],
920
+ optionalEnv: ['AWS_REGION'],
921
+ requiredConfigKeys: ['accessKeyId', 'secretAccessKey'],
922
+ sandboxAvailable: false,
923
+ mockAvailable: true,
924
+ },
925
+ },
926
+ openai: {
927
+ name: 'OpenAI',
928
+ toolPatterns: [
929
+ /openai/i,
930
+ /gpt/i,
931
+ /chatgpt/i,
932
+ /completion/i,
933
+ /embedding/i,
934
+ ],
935
+ errorPatterns: [
936
+ /openai\.com/i,
937
+ /rate_limit_exceeded/i,
938
+ /insufficient_quota/i,
939
+ /invalid_api_key/i,
940
+ /model_not_found/i,
941
+ /context_length_exceeded/i,
942
+ ],
943
+ statusCodes: [401, 429, 400],
944
+ remediation: 'Configure OpenAI API key (OPENAI_API_KEY)',
945
+ credentials: {
946
+ requiredEnv: ['OPENAI_API_KEY'],
947
+ optionalEnv: [],
948
+ requiredConfigKeys: ['apiKey'],
949
+ sandboxAvailable: false,
950
+ mockAvailable: true,
951
+ },
952
+ },
953
+ anthropic: {
954
+ name: 'Anthropic',
955
+ toolPatterns: [
956
+ /anthropic/i,
957
+ /claude/i,
958
+ ],
959
+ errorPatterns: [
960
+ /anthropic\.com/i,
961
+ /invalid_api_key/i,
962
+ /rate_limit/i,
963
+ /overloaded/i,
964
+ ],
965
+ statusCodes: [401, 429, 529],
966
+ remediation: 'Configure Anthropic API key (ANTHROPIC_API_KEY)',
967
+ credentials: {
968
+ requiredEnv: ['ANTHROPIC_API_KEY'],
969
+ optionalEnv: [],
970
+ requiredConfigKeys: ['apiKey'],
971
+ sandboxAvailable: false,
972
+ mockAvailable: true,
973
+ },
974
+ },
975
+ firebase: {
976
+ name: 'Firebase',
977
+ toolPatterns: [
978
+ /firebase/i,
979
+ /firestore/i,
980
+ /realtime.*database/i,
981
+ ],
982
+ errorPatterns: [
983
+ /firebase/i,
984
+ /firestore/i,
985
+ /PERMISSION_DENIED/i,
986
+ /INVALID_ARGUMENT/i,
987
+ ],
988
+ statusCodes: [403, 400],
989
+ remediation: 'Configure Firebase credentials (FIREBASE_CONFIG or service account)',
990
+ credentials: {
991
+ requiredEnv: ['FIREBASE_CONFIG'],
992
+ optionalEnv: ['GOOGLE_APPLICATION_CREDENTIALS'],
993
+ requiredConfigKeys: ['config'],
994
+ sandboxAvailable: false,
995
+ mockAvailable: true,
996
+ },
997
+ },
998
+ twilio: {
999
+ name: 'Twilio',
1000
+ toolPatterns: [
1001
+ /twilio/i,
1002
+ /sms/i,
1003
+ /phone.*send/i,
1004
+ ],
1005
+ errorPatterns: [
1006
+ /twilio\.com/i,
1007
+ /INVALID_ACCOUNT_SID/i,
1008
+ /INVALID_AUTH_TOKEN/i,
1009
+ ],
1010
+ statusCodes: [401, 400],
1011
+ remediation: 'Configure Twilio credentials (TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)',
1012
+ credentials: {
1013
+ requiredEnv: ['TWILIO_ACCOUNT_SID', 'TWILIO_AUTH_TOKEN'],
1014
+ optionalEnv: [],
1015
+ requiredConfigKeys: ['accountSid', 'authToken'],
1016
+ sandboxAvailable: true,
1017
+ mockAvailable: true,
1018
+ },
1019
+ },
1020
+ sendgrid: {
1021
+ name: 'SendGrid',
1022
+ toolPatterns: [
1023
+ /sendgrid/i,
1024
+ /email.*send/i,
1025
+ ],
1026
+ errorPatterns: [
1027
+ /sendgrid\.com/i,
1028
+ /api\.sendgrid/i,
1029
+ /INVALID_API_KEY/i,
1030
+ ],
1031
+ statusCodes: [401, 403],
1032
+ remediation: 'Configure SendGrid API key (SENDGRID_API_KEY)',
1033
+ credentials: {
1034
+ requiredEnv: ['SENDGRID_API_KEY'],
1035
+ optionalEnv: [],
1036
+ requiredConfigKeys: ['apiKey'],
1037
+ sandboxAvailable: false,
1038
+ mockAvailable: true,
1039
+ },
1040
+ },
1041
+ github: {
1042
+ name: 'GitHub',
1043
+ toolPatterns: [
1044
+ /github/i,
1045
+ /gh_/i,
1046
+ /repository/i,
1047
+ /pull.*request/i,
1048
+ ],
1049
+ errorPatterns: [
1050
+ /api\.github\.com/i,
1051
+ /Bad credentials/i,
1052
+ /rate limit/i,
1053
+ /Resource not accessible/i,
1054
+ ],
1055
+ statusCodes: [401, 403, 404],
1056
+ remediation: 'Configure GitHub token (GITHUB_TOKEN)',
1057
+ credentials: {
1058
+ requiredEnv: ['GITHUB_TOKEN'],
1059
+ optionalEnv: [],
1060
+ requiredConfigKeys: ['token'],
1061
+ sandboxAvailable: false,
1062
+ mockAvailable: true,
1063
+ },
1064
+ },
1065
+ database: {
1066
+ name: 'Database',
1067
+ toolPatterns: [
1068
+ /database/i,
1069
+ /postgres/i,
1070
+ /mysql/i,
1071
+ /mongodb/i,
1072
+ /redis/i,
1073
+ /sql/i,
1074
+ ],
1075
+ errorPatterns: [
1076
+ /ECONNREFUSED/i,
1077
+ /connection.*refused/i,
1078
+ /authentication failed/i,
1079
+ /database.*not.*exist/i,
1080
+ /role.*not.*exist/i,
1081
+ /no.*pg_hba\.conf/i,
1082
+ /ER_ACCESS_DENIED/i,
1083
+ /ETIMEDOUT/i,
1084
+ ],
1085
+ statusCodes: [], // Database errors typically don't use HTTP status
1086
+ remediation: 'Check database connection string and ensure database server is running',
1087
+ credentials: {
1088
+ requiredEnv: [],
1089
+ optionalEnv: ['DATABASE_URL'],
1090
+ requiredConfigKeys: ['connectionString'],
1091
+ sandboxAvailable: false,
1092
+ mockAvailable: false,
1093
+ },
1094
+ },
1095
+ },
1096
+ /** Error source categories */
1097
+ ERROR_SOURCES: {
1098
+ /** Error is from external service API */
1099
+ external_dependency: 'external_dependency',
1100
+ /** Error is from missing/invalid environment configuration */
1101
+ environment: 'environment',
1102
+ /** Error appears to be a code bug */
1103
+ code_bug: 'code_bug',
1104
+ /** Cannot determine error source */
1105
+ unknown: 'unknown',
1106
+ },
1107
+ /** Patterns that indicate environment/configuration issues */
1108
+ ENVIRONMENT_PATTERNS: [
1109
+ /missing.*credentials/i,
1110
+ /missing.*api.*key/i,
1111
+ /missing.*token/i,
1112
+ /environment.*variable/i,
1113
+ /not.*configured/i,
1114
+ /invalid.*configuration/i,
1115
+ /ENOENT/i,
1116
+ /config.*not.*found/i,
1117
+ /credentials.*not.*found/i,
1118
+ ],
1119
+ /** Patterns that indicate transient/temporary issues (should retry) */
1120
+ TRANSIENT_PATTERNS: [
1121
+ /timeout/i,
1122
+ /ETIMEDOUT/i,
1123
+ /ECONNRESET/i,
1124
+ /ECONNREFUSED/i,
1125
+ /temporarily.*unavailable/i,
1126
+ /service.*unavailable/i,
1127
+ /rate.*limit/i,
1128
+ /too.*many.*requests/i,
1129
+ /overloaded/i,
1130
+ /retry/i,
1131
+ /503/i,
1132
+ /504/i,
1133
+ /429/i,
1134
+ ],
1135
+ };
1136
+ // ==================== Example Output Configuration ====================
1137
+ /**
1138
+ * Example output configuration for documentation generation.
1139
+ * Used by docs/contract.ts for CONTRACT.md example formatting.
1140
+ *
1141
+ * Controls truncation behavior and provides configurable limits
1142
+ * for different output modes (default, full, AI-optimized).
1143
+ */
1144
+ export const EXAMPLE_OUTPUT = {
1145
+ /** Default example length (backwards compatible) */
1146
+ DEFAULT_LENGTH: 300,
1147
+ /** Full example length (with --full-examples) */
1148
+ FULL_LENGTH: 5000,
1149
+ /** AI-optimized example length (balanced for context windows) */
1150
+ AI_OPTIMIZED_LENGTH: 2000,
1151
+ /** Maximum examples per tool in documentation */
1152
+ MAX_EXAMPLES_PER_TOOL: 3,
1153
+ /** Default examples per tool */
1154
+ DEFAULT_EXAMPLES_PER_TOOL: 2,
1155
+ /** Minimum length to show truncation indicator */
1156
+ MIN_TRUNCATION_INDICATOR_LENGTH: 50,
1157
+ /** Truncation indicators for different content types */
1158
+ TRUNCATION_INDICATORS: {
1159
+ json: '... (truncated)',
1160
+ markdown: '\n\n... (content truncated)',
1161
+ text: '...',
1162
+ },
1163
+ /** Smart truncation settings */
1164
+ SMART_TRUNCATE: {
1165
+ /** Preserve JSON structure when truncating */
1166
+ preserveJsonStructure: true,
1167
+ /** Preserve markdown headers when truncating */
1168
+ preserveMarkdownHeaders: true,
1169
+ /** Minimum items to show in truncated arrays */
1170
+ minArrayItems: 2,
1171
+ /** Message template for omitted array items */
1172
+ arrayOmittedTemplate: '... ({count} more items)',
1173
+ /** Message template for omitted object keys */
1174
+ objectOmittedTemplate: '... ({count} more fields)',
1175
+ },
1176
+ };
1177
+ // ==================== Reliability Display ====================
1178
+ /**
1179
+ * Display thresholds and symbols for reliability metrics.
1180
+ */
1181
+ export const RELIABILITY_DISPLAY = {
1182
+ /** High reliability threshold (percentage) */
1183
+ HIGH_THRESHOLD: 90,
1184
+ /** Medium reliability threshold (percentage) */
1185
+ MEDIUM_THRESHOLD: 50,
1186
+ /** Status symbols for reliability and validation summaries */
1187
+ SYMBOLS: {
1188
+ PASS: '✓',
1189
+ WARN: '⚠',
1190
+ FAIL: '✗',
1191
+ },
1192
+ };
1193
+ /**
1194
+ * Confidence indicators for terminal and documentation output.
1195
+ */
1196
+ export const CONFIDENCE_INDICATORS = {
1197
+ high: '🟢',
1198
+ medium: '🟡',
1199
+ low: '🔴',
1200
+ };
1201
+ // ==================== Documentation Quality Scoring ====================
1202
+ /**
1203
+ * Documentation quality scoring configuration.
1204
+ * Used by documentation-scorer.ts for tool documentation assessment.
1205
+ *
1206
+ * Scoring evaluates four key components:
1207
+ * - Description coverage: percentage of tools with descriptions
1208
+ * - Description quality: depth and clarity of descriptions
1209
+ * - Parameter documentation: percentage of parameters documented
1210
+ * - Example coverage: percentage of tools with examples
1211
+ */
1212
+ export const DOCUMENTATION_SCORING = {
1213
+ /** Component weights for overall score (should sum to 1.0) */
1214
+ WEIGHTS: {
1215
+ descriptionCoverage: 0.30,
1216
+ descriptionQuality: 0.30,
1217
+ parameterDocumentation: 0.25,
1218
+ exampleCoverage: 0.15,
1219
+ },
1220
+ /** Grade thresholds (minimum score for each grade) */
1221
+ GRADE_THRESHOLDS: {
1222
+ A: 90,
1223
+ B: 80,
1224
+ C: 70,
1225
+ D: 60,
1226
+ F: 0,
1227
+ },
1228
+ /** Description quality scoring criteria */
1229
+ DESCRIPTION: {
1230
+ /** Minimum length for a "good" description */
1231
+ MIN_GOOD_LENGTH: 50,
1232
+ /** Minimum length for an "acceptable" description */
1233
+ MIN_ACCEPTABLE_LENGTH: 20,
1234
+ /** Score for good length (>= MIN_GOOD_LENGTH) */
1235
+ GOOD_LENGTH_SCORE: 40,
1236
+ /** Score for acceptable length (>= MIN_ACCEPTABLE_LENGTH) */
1237
+ ACCEPTABLE_LENGTH_SCORE: 20,
1238
+ /** Score bonus for starting with imperative verb */
1239
+ IMPERATIVE_VERB_BONUS: 20,
1240
+ /** Score bonus for describing behavior/returns */
1241
+ BEHAVIOR_DESCRIPTION_BONUS: 20,
1242
+ /** Score bonus for including examples or specifics */
1243
+ EXAMPLES_BONUS: 20,
1244
+ },
1245
+ /** Penalties for documentation issues */
1246
+ PENALTIES: {
1247
+ /** Penalty for missing tool description */
1248
+ missingDescription: 30,
1249
+ /** Penalty for short description (< MIN_ACCEPTABLE_LENGTH) */
1250
+ shortDescription: 15,
1251
+ /** Penalty multiplier for undocumented parameters (applied per-param) */
1252
+ undocumentedParamMultiplier: 25,
1253
+ },
1254
+ /** Pattern to detect imperative verb at start of description */
1255
+ IMPERATIVE_PATTERN: /^[A-Z][a-z]+s?\s/,
1256
+ /** Pattern to detect behavior/return value description */
1257
+ BEHAVIOR_PATTERN: /returns?|provides?|gets?|creates?|deletes?|updates?|retrieves?|sends?|fetches?/i,
1258
+ /** Pattern to detect examples or specific details */
1259
+ EXAMPLES_PATTERN: /e\.g\.|example|such as|like|for instance/i,
1260
+ /** Issue severity levels */
1261
+ SEVERITY: {
1262
+ missingDescription: 'error',
1263
+ shortDescription: 'warning',
1264
+ missingParamDescription: 'warning',
1265
+ noExamples: 'info',
1266
+ },
1267
+ /** Maximum suggestions to include in report */
1268
+ MAX_SUGGESTIONS: 5,
1269
+ /** Threshold for suggesting examples (tools without examples / total tools) */
1270
+ EXAMPLES_SUGGESTION_THRESHOLD: 0.5,
1271
+ };
1272
+ // ==================== AI Agent Compatibility Scoring ====================
1273
+ /**
1274
+ * AI Agent Compatibility scoring configuration.
1275
+ * Used by ai-compatibility-scorer.ts for evaluating how well
1276
+ * an MCP server is designed for AI agent consumption.
1277
+ *
1278
+ * Scoring factors:
1279
+ * - Description clarity (20%): LLM understanding
1280
+ * - Parameter naming (15%): Semantic inference
1281
+ * - Error message quality (15%): Actionable errors
1282
+ * - Example completeness (20%): Non-truncated examples
1283
+ * - Workflow documentation (15%): Multi-step guidance
1284
+ * - Response predictability (15%): Schema stability
1285
+ */
1286
+ export const AI_COMPATIBILITY = {
1287
+ /** Component weights for overall score (should sum to 1.0) */
1288
+ WEIGHTS: {
1289
+ descriptionClarity: 0.20,
1290
+ parameterNaming: 0.15,
1291
+ errorMessageQuality: 0.15,
1292
+ exampleCompleteness: 0.20,
1293
+ workflowDocumentation: 0.15,
1294
+ responsePredictability: 0.15,
1295
+ },
1296
+ /** Grade thresholds (minimum score for each grade) */
1297
+ GRADE_THRESHOLDS: {
1298
+ A: 90,
1299
+ B: 80,
1300
+ C: 70,
1301
+ D: 60,
1302
+ F: 0,
1303
+ },
1304
+ /** Description quality scoring */
1305
+ DESCRIPTION: {
1306
+ /** Minimum acceptable description length */
1307
+ MIN_LENGTH: 50,
1308
+ /** Good description length */
1309
+ GOOD_LENGTH: 100,
1310
+ /** Pattern to detect action verb at start */
1311
+ ACTION_VERB_PATTERN: /^(Get|Create|Update|Delete|List|Search|Find|Fetch|Send|Post|Retrieve|Query|Export|Import|Generate|Calculate|Validate|Check|Convert|Parse|Format|Transform|Add|Remove|Set|Clear|Reset|Initialize|Connect|Disconnect|Start|Stop|Enable|Disable|Sync|Refresh|Load|Save|Upload|Download|Process|Execute|Run|Call|Invoke|Register|Unregister|Subscribe|Unsubscribe|Publish)\s/i,
1312
+ /** Pattern to detect purpose/behavior explanation */
1313
+ PURPOSE_PATTERN: /returns?|provides?|retrieves?|generates?|creates?|enables?|allows?|performs?/i,
1314
+ /** Pattern to detect input/output mentions */
1315
+ IO_PATTERN: /takes?|accepts?|requires?|outputs?|returns?|produces?/i,
1316
+ /** Points for various description qualities */
1317
+ POINTS: {
1318
+ /** Points for minimum length */
1319
+ MIN_LENGTH: 20,
1320
+ /** Points for good length */
1321
+ GOOD_LENGTH: 30,
1322
+ /** Points for action verb */
1323
+ ACTION_VERB: 25,
1324
+ /** Points for purpose explanation */
1325
+ PURPOSE: 25,
1326
+ /** Points for I/O mention */
1327
+ IO_MENTION: 20,
1328
+ },
1329
+ },
1330
+ /** Parameter naming quality scoring */
1331
+ PARAMETER: {
1332
+ /** Generic/bad parameter names to flag */
1333
+ BAD_NAMES: ['data', 'value', 'input', 'output', 'param', 'arg', 'x', 'y', 'n', 'i', 'val', 'obj', 'item', 'thing', 'stuff'],
1334
+ /** Minimum acceptable parameter name length */
1335
+ MIN_NAME_LENGTH: 2,
1336
+ },
1337
+ /** Error message quality scoring */
1338
+ ERROR: {
1339
+ /** Minimum error message length for quality */
1340
+ MIN_MESSAGE_LENGTH: 20,
1341
+ /** Pattern to detect actionable error content */
1342
+ ACTIONABLE_PATTERN: /try|use|provide|specify|check|ensure|make sure|should|must|need|require|expected|format|valid/i,
1343
+ /** Pattern to detect remediation hints */
1344
+ REMEDIATION_PATTERN: /example|e\.g\.|such as|instead|correct|fix|solution|hint/i,
1345
+ /** Default score when no errors observed */
1346
+ DEFAULT_SCORE: 70,
1347
+ },
1348
+ /** Example completeness scoring */
1349
+ EXAMPLE: {
1350
+ /** Weight for coverage in score */
1351
+ COVERAGE_WEIGHT: 0.6,
1352
+ /** Weight for quality (non-truncated) in score */
1353
+ QUALITY_WEIGHT: 0.4,
1354
+ },
1355
+ /** Workflow documentation scoring */
1356
+ WORKFLOW: {
1357
+ /** Pattern to detect sequence hints */
1358
+ SEQUENCE_PATTERN: /first|then|after|before|next|followed by|prior to|subsequently|finally|once|when/i,
1359
+ /** Pattern to detect dependency hints */
1360
+ DEPENDENCY_PATTERN: /requires?|needs?|depends? on|must have|expects?|assumes?|prerequisite/i,
1361
+ },
1362
+ /** Response predictability scoring */
1363
+ RESPONSE: {
1364
+ /** Default score when no evolution data */
1365
+ DEFAULT_SCORE: 80,
1366
+ },
1367
+ /** Maximum recommendations to generate */
1368
+ MAX_RECOMMENDATIONS: 5,
1369
+ /** Score threshold below which to recommend improvements */
1370
+ RECOMMENDATION_THRESHOLD: 80,
1371
+ };
1372
+ // ==================== Contract Testing ====================
1373
+ /**
1374
+ * Contract-as-code testing configuration.
1375
+ * Used by contract validator for verifying MCP server behavior
1376
+ * against defined expectations.
1377
+ */
1378
+ export const CONTRACT_TESTING = {
1379
+ /** Default contract file names (in order of preference) */
1380
+ CONTRACT_FILENAMES: [
1381
+ 'contract.bellwether.yaml',
1382
+ 'contract.bellwether.yml',
1383
+ '.bellwether-contract.yaml',
1384
+ '.bellwether-contract.yml',
1385
+ ],
1386
+ /** Current contract schema version */
1387
+ SCHEMA_VERSION: '1',
1388
+ /** Maximum number of output assertions per tool */
1389
+ MAX_OUTPUT_ASSERTIONS: 20,
1390
+ /** Maximum validation errors to report before truncating */
1391
+ MAX_VALIDATION_ERRORS: 50,
1392
+ /** Validation modes */
1393
+ MODES: {
1394
+ /** Strict mode - fail on any contract violation */
1395
+ STRICT: 'strict',
1396
+ /** Lenient mode - warn on non-breaking violations */
1397
+ LENIENT: 'lenient',
1398
+ /** Report mode - report violations without failing */
1399
+ REPORT: 'report',
1400
+ },
1401
+ /** Severity levels for contract violations */
1402
+ VIOLATION_SEVERITY: {
1403
+ /** Tool is missing from server */
1404
+ MISSING_TOOL: 'breaking',
1405
+ /** Required parameter is missing */
1406
+ MISSING_REQUIRED_PARAM: 'breaking',
1407
+ /** Parameter type mismatch */
1408
+ TYPE_MISMATCH: 'breaking',
1409
+ /** Output assertion failed */
1410
+ OUTPUT_ASSERTION_FAILED: 'warning',
1411
+ /** Extra unexpected tool found */
1412
+ UNEXPECTED_TOOL: 'info',
1413
+ /** Extra unexpected field in output */
1414
+ UNEXPECTED_FIELD: 'info',
1415
+ },
1416
+ /** JSONPath patterns for output validation */
1417
+ JSONPATH: {
1418
+ /** Maximum depth for JSONPath evaluation */
1419
+ MAX_DEPTH: 20,
1420
+ /** Timeout for JSONPath evaluation (ms) */
1421
+ TIMEOUT: 1000,
1422
+ },
1423
+ };
1424
+ // ==================== Regression Risk Scoring ====================
1425
+ /**
1426
+ * Regression risk scoring configuration.
1427
+ * Used by risk-scorer.ts for prioritizing fixes based on
1428
+ * weighted risk factors.
1429
+ */
1430
+ export const REGRESSION_RISK = {
1431
+ /** Risk factor weights (should sum to 1.0) */
1432
+ WEIGHTS: {
1433
+ /** Weight for breaking change severity */
1434
+ breakingChangeSeverity: 0.35,
1435
+ /** Weight for affected tool importance */
1436
+ toolImportance: 0.25,
1437
+ /** Weight for error rate delta */
1438
+ errorRateDelta: 0.15,
1439
+ /** Weight for performance regression */
1440
+ performanceRegression: 0.15,
1441
+ /** Weight for security posture changes */
1442
+ securityPosture: 0.10,
1443
+ },
1444
+ /** Risk level thresholds (minimum score for each level) */
1445
+ LEVEL_THRESHOLDS: {
1446
+ critical: 80,
1447
+ high: 60,
1448
+ medium: 40,
1449
+ low: 20,
1450
+ info: 0,
1451
+ },
1452
+ /** Breaking change severity scores */
1453
+ BREAKING_SCORES: {
1454
+ /** Score for removed tool */
1455
+ toolRemoved: 100,
1456
+ /** Score for removed required parameter */
1457
+ requiredParamRemoved: 90,
1458
+ /** Score for type change */
1459
+ typeChanged: 80,
1460
+ /** Score for removed enum value */
1461
+ enumValueRemoved: 70,
1462
+ /** Score for tightened constraint */
1463
+ constraintTightened: 50,
1464
+ /** Score for added required parameter */
1465
+ requiredParamAdded: 40,
1466
+ },
1467
+ /** Tool importance indicators (patterns in descriptions) */
1468
+ IMPORTANCE_PATTERNS: {
1469
+ /** Patterns indicating high-frequency tools */
1470
+ highFrequency: [/primary|main|core|essential|critical|frequently/i],
1471
+ /** Patterns indicating low-frequency tools */
1472
+ lowFrequency: [/rarely|admin|debug|internal|deprecated/i],
1473
+ },
1474
+ /** Error rate change thresholds */
1475
+ ERROR_RATE: {
1476
+ /** Threshold for significant increase (%) */
1477
+ SIGNIFICANT_INCREASE: 10,
1478
+ /** Threshold for critical increase (%) */
1479
+ CRITICAL_INCREASE: 25,
1480
+ /** Base score for error rate calculation */
1481
+ BASE_SCORE: 50,
1482
+ },
1483
+ /** Performance regression scoring */
1484
+ PERFORMANCE: {
1485
+ /** Threshold for minor regression (%) */
1486
+ MINOR_REGRESSION: 10,
1487
+ /** Threshold for major regression (%) */
1488
+ MAJOR_REGRESSION: 25,
1489
+ /** Threshold for critical regression (%) */
1490
+ CRITICAL_REGRESSION: 50,
1491
+ /** Scores for each threshold */
1492
+ SCORES: {
1493
+ minor: 30,
1494
+ major: 60,
1495
+ critical: 90,
1496
+ },
1497
+ },
1498
+ /** Security change scoring */
1499
+ SECURITY: {
1500
+ /** Score for new vulnerability */
1501
+ NEW_VULNERABILITY: 100,
1502
+ /** Score for resolved vulnerability */
1503
+ RESOLVED_VULNERABILITY: -20,
1504
+ /** Score for severity increase */
1505
+ SEVERITY_INCREASE: 50,
1506
+ },
1507
+ /** Maximum recommendations to include */
1508
+ MAX_RECOMMENDATIONS: 5,
1509
+ };
1510
+ // ==================== Intelligent Test Pruning ====================
1511
+ /**
1512
+ * Intelligent test pruning configuration.
1513
+ * Used to skip unnecessary tests based on tool characteristics
1514
+ * and testing history.
1515
+ */
1516
+ export const TEST_PRUNING = {
1517
+ /** Test categories that can be pruned */
1518
+ CATEGORIES: {
1519
+ boundary: 'boundary',
1520
+ enum: 'enum',
1521
+ optionalCombinations: 'optional_combinations',
1522
+ errorHandling: 'error_handling',
1523
+ happyPath: 'happy_path',
1524
+ security: 'security',
1525
+ semantic: 'semantic',
1526
+ },
1527
+ /** Categories that should always run */
1528
+ ALWAYS_RUN: ['happy_path', 'error_handling'],
1529
+ /** Tool prioritization weights */
1530
+ PRIORITY_WEIGHTS: {
1531
+ /** Weight for previous error history */
1532
+ errorHistory: 0.30,
1533
+ /** Weight for external dependencies */
1534
+ externalDependency: 0.25,
1535
+ /** Weight for schema complexity */
1536
+ schemaComplexity: 0.20,
1537
+ /** Weight for time since last test */
1538
+ timeSinceLastTest: 0.15,
1539
+ /** Weight for change frequency */
1540
+ changeFrequency: 0.10,
1541
+ },
1542
+ /** Schema complexity thresholds */
1543
+ SCHEMA_COMPLEXITY: {
1544
+ /** Number of parameters for "complex" classification */
1545
+ HIGH_PARAM_COUNT: 10,
1546
+ /** Number of nested levels for "complex" classification */
1547
+ HIGH_NESTING_DEPTH: 3,
1548
+ /** Number of required params for priority boost */
1549
+ MANY_REQUIRED_PARAMS: 5,
1550
+ },
1551
+ /** Historical success thresholds */
1552
+ SUCCESS_HISTORY: {
1553
+ /** Success rate threshold to reduce testing (%) */
1554
+ HIGH_SUCCESS_THRESHOLD: 95,
1555
+ /** Number of consecutive successes to consider stable */
1556
+ STABLE_RUN_COUNT: 5,
1557
+ },
1558
+ /** Time-based thresholds */
1559
+ TIME_THRESHOLDS: {
1560
+ /** Hours since last test to increase priority */
1561
+ STALE_HOURS: 168, // 1 week
1562
+ /** Hours since last test for maximum priority */
1563
+ VERY_STALE_HOURS: 720, // 30 days
1564
+ },
1565
+ /** Maximum tests to skip per tool (safety limit) */
1566
+ MAX_SKIPPED_CATEGORIES_PER_TOOL: 3,
1567
+ };
1568
+ //# sourceMappingURL=testing.js.map